:root {
  color-scheme: light;
  --bg: #f3f3f3;
  --elevated: #ffffff;
  --editor: #f7f7f7;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --quiet: #8a8a8a;
  --stroke: #d4d4d4;
  --stroke-soft: #e8e8e8;
  --stroke-strong: #bdbdbd;
  --fill: #ececec;
  --fill-soft: #f0f0f0;
  --accent: #3c8aff;
  --on-accent: #ffffff;
  --scrim: rgba(0, 0, 0, 0.18);
  --font: "Geist", "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141414;
    --elevated: #1e1e1e;
    --editor: #181818;
    --ink: #f2f2f2;
    --muted: #a0a0a0;
    --quiet: #7a7a7a;
    --stroke: #3a3a3a;
    --stroke-soft: #2c2c2c;
    --stroke-strong: #525252;
    --fill: #2a2a2a;
    --fill-soft: #242424;
    --accent: #4c9fff;
    --on-accent: #0b1220;
    --scrim: rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px 16px 48px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

button, input { font: inherit; }

button { cursor: pointer; }

.preview {
  width: min(640px, 100%);
  margin: 0 auto 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.frame {
  position: relative;
  width: min(640px, 100%);
  margin: 0 auto;
  background: var(--elevated);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
}

.top {
  padding: 20px 20px 8px;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 20px;
  line-height: 26px;
  font-weight: 590;
}

.subhead {
  margin-top: 2px;
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
}

.composer-wrap {
  padding: 12px 20px 8px;
}

.composer {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px;
  background: var(--editor);
}

.modes, .chips, .row, .undo, .day-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-controls {
  position: relative;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.modes { margin-bottom: 10px; gap: 6px; }

.chips {
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chips.days {
  margin: 0;
  flex: 1;
}

.row { margin-top: 0; }

.grow { flex: 1; min-width: 0; }

input[type="text"] {
  width: 100%;
  border: 1px solid var(--stroke-strong);
  background: var(--elevated);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 20px;
}

input:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip {
  border: 1px solid var(--stroke-soft);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 16px;
}

.chip[aria-selected="true"],
.chip.active,
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--fill);
}

.ghost, .primary {
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 18px;
  white-space: nowrap;
}

.ghost {
  border: 1px solid var(--stroke-strong);
  background: transparent;
  color: var(--ink);
}

.primary {
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
}

.primary:disabled, .ghost:disabled {
  opacity: 0.45;
  cursor: default;
}

#voice {
  height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

.listen {
  flex: 1;
  font-size: 14px;
  line-height: 20px;
}

.hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.notice {
  padding: 8px 20px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.undo {
  margin: 10px 20px 0;
  padding: 8px 10px;
  justify-content: space-between;
  gap: 12px;
  background: var(--fill);
  border-radius: 8px;
}

.undo p {
  font-size: 13px;
  line-height: 18px;
}

.lists {
  padding: 16px 20px 20px;
}

.lists > section { margin-bottom: 16px; }

.lists > section:last-child { margin-bottom: 0; }

h2 {
  margin-bottom: 4px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 590;
}

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  border-top: 1px solid var(--stroke-soft);
}

.task div {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
}

.task strong {
  display: block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
}

.task span, .empty {
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

.empty { padding: 6px 0 2px; color: var(--quiet); }

.date-native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--scrim);
}

.dialog {
  width: min(420px, 100%);
  padding: 16px;
  background: var(--elevated);
  border: 1px solid var(--stroke);
  border-radius: 12px;
}

.dialog h2 {
  margin: 0;
  font-size: 16px;
  line-height: 22px;
  font-weight: 590;
}

#modal-task {
  margin: 6px 0 12px;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
}

#modal-days { margin: 0 0 10px; }

.dialog .row { margin-top: 12px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  body { padding: 16px 12px 40px; }
  .row { flex-wrap: wrap; }
  .primary, .ghost, #voice, #send { min-height: 36px; }
}
