:root {
  color-scheme: light;
  --ink: #182321;
  --muted: #64716d;
  --line: #d9ded7;
  --paper: #fffdfa;
  --canvas: #f3f6f1;
  --deep: #12343b;
  --accent: #d9824b;
  --gold: #f4ce69;
  --green: #557a62;
  --blue: #436f8f;
  --danger: #af4f38;
  --shadow: 0 18px 45px rgba(25, 38, 34, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  overflow-x: hidden;
}

button, input, select, textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 34px);
  background: rgba(243, 246, 241, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar > * {
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

main {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 32px) 96px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 4vw, 2.25rem);
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 12vw, 4.8rem);
  line-height: 0.96;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.grid {
  display: grid;
  gap: 14px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.focus-card, .panel, .item-card {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.focus-card {
  display: grid;
  align-content: center;
  min-height: calc(100svh - 190px);
  padding: clamp(22px, 7vw, 44px);
}

.focus-card.wake {
  border-color: rgba(67, 111, 143, 0.38);
}

.focus-card.sleep {
  border-color: rgba(85, 122, 98, 0.38);
}

.focus-card.onboarding {
  align-content: start;
  gap: 8px;
}

.panel {
  padding: clamp(16px, 4vw, 24px);
}

.item-card {
  padding: 14px;
  box-shadow: none;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.86rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.space {
  justify-content: space-between;
}

.action-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 4px;
}

.choice-button {
  min-height: 54px;
  padding: 0 16px;
  color: var(--ink);
  background: #f6f8f4;
  border: 1px solid var(--line);
  text-align: left;
  font-weight: 850;
}

.choice-button:hover,
.choice-button:focus {
  border-color: var(--blue);
  background: #eef6fa;
}

.primary, .secondary, .quiet, .icon-button {
  padding: 0 14px;
  font-weight: 850;
}

.compact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
}

.primary {
  color: white;
  background: var(--deep);
}

.secondary {
  color: var(--ink);
  background: var(--gold);
}

.quiet {
  color: var(--ink);
  background: #e7ece4;
}

.icon-button {
  color: white;
  background: var(--deep);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--gold);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.time-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #f6f8f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.task-meta span, .pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--deep);
  background: #e9f0ec;
  font-weight: 800;
  font-size: 0.8rem;
}

.review-note {
  padding: 12px;
  color: #6e351f;
  background: #fff0df;
  border: 1px solid #f0c9a7;
  border-radius: 8px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf6;
}

.stat strong {
  display: block;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.install-panel {
  border-color: rgba(244, 206, 105, 0.68);
  background: #fffaf0;
}

.install-help {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: end center;
  padding: 18px;
  background: rgba(18, 35, 33, 0.42);
}

.install-help:target {
  display: grid;
}

.install-help-card {
  width: min(520px, 100%);
  padding: clamp(18px, 5vw, 28px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.install-help-card h2 {
  font-size: clamp(1.9rem, 8vw, 3.2rem);
}

.install-steps {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.install-steps p {
  margin: 0;
  padding: 12px;
  background: #f6f8f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.schedule-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.schedule-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.schedule-row.current {
  border-color: var(--blue);
  background: #eef6fa;
}

.schedule-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.schedule-row em {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: normal;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
  min-height: auto;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 4;
  width: min(440px, calc(100% - 24px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  background: rgba(18, 52, 59, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.bottom-nav button {
  min-width: 0;
  padding: 0 8px;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  font-weight: 850;
}

.bottom-nav button.active {
  color: var(--ink);
  background: var(--gold);
}

.is-onboarding .bottom-nav {
  display: none;
}

@media (max-width: 720px) {
  .two, .stat-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 10px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .compact-button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 0.88rem;
  }

  .focus-card {
    min-height: calc(100svh - 178px);
  }

  .schedule-row {
    grid-template-columns: 64px 1fr;
  }

  .schedule-row em {
    grid-column: 2;
  }
}
