/*
 * Dark by default — this is used in the evening. Light mode follows the OS.
 *
 * Every activity renders its name as well as its colour, so nothing depends on
 * telling eleven hues apart.
 */

:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --line: #2c2c2a;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --accent: #3987e5;
  --danger: #e66767;
  --good: #0ca30c;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --page: #f9f9f7;
    --surface: #fcfcfb;
    --surface-2: #f2f2ef;
    --line: #e1e0d9;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #898781;
    --accent: #2a78d6;
    --danger: #d03b3b;
    --good: #0ca30c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 18px 16px calc(40px + env(safe-area-inset-bottom));
  max-width: 820px;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px;
}
h1 { font-size: 21px; margin: 0; letter-spacing: -0.02em; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.account { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.save-state { font-size: 12px; color: var(--muted); min-height: 1em; }
.save-state[data-state="saved"] { color: var(--good); }
.save-state[data-state="error"] { color: var(--danger); }

.banner {
  margin: 0 0 14px; padding: 10px 13px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--ink-2); font-size: 13px;
}
.banner[data-tone="error"] {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

/* ---------- buttons ---------- */

.btn {
  font: inherit; font-size: 14px; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  padding: 8px 13px; min-height: 40px;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-icon { min-width: 40px; padding: 6px 10px; font-size: 20px; line-height: 1; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- date bar ---------- */

.datebar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.date-centre { display: flex; flex-direction: column; flex: 1 1 auto;
               min-width: 150px; max-width: 260px; }
.date-input {
  font: inherit; font-size: 16px; font-weight: 600; color: var(--ink);
  background: transparent; border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-height: 40px; width: 100%;
}
.date-relative { color: var(--muted); font-size: 12px; margin-top: 3px; padding-left: 2px; }

/* ---------- progress ---------- */

.progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.progress-track {
  flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2);
  overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0; background: var(--accent);
  border-radius: 3px; transition: width 140ms ease-out;
}
.progress-label { color: var(--muted); font-size: 12px; white-space: nowrap;
                  font-variant-numeric: tabular-nums; }

/* ---------- slots ---------- */

.slots { list-style: none; margin: 0; padding: 0;
         display: flex; flex-direction: column; gap: 6px; }

.slot {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px; align-items: start;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 9px 11px;
}
.slot[data-filled="true"] { background: var(--surface-2); }

.slot-hour {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums; padding-top: 9px;
}

/*
 * Main picker and the parallel activities share one line. Stacking them makes
 * each row ~165px, so the day needs three screens of scrolling — which defeats
 * the point of being faster than a notebook. They wrap only when crowded.
 */
.slot-body {
  display: flex; flex-wrap: wrap; gap: 6px 8px;
  align-items: center; min-width: 0;
}

.slot-main {
  font: inherit; font-size: 15px; min-height: 38px;
  flex: 1 1 190px; min-width: 0;
  padding: 7px 10px; border-radius: 8px; color: var(--ink);
  background: var(--page); border: 1px solid var(--line);
}
.slot-main[data-empty="true"] { color: var(--muted); }

.also { display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
        flex: 0 1 auto; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; padding: 4px 6px 4px 9px; border-radius: 999px;
  background: var(--page); border: 1px solid var(--line); color: var(--ink-2);
  max-width: 100%;
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-remove {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 50%;
}
.chip-remove:hover { color: var(--danger); }

.also-add {
  font: inherit; font-size: 12.5px; color: var(--muted);
  background: transparent; border: 1px dashed var(--line);
  border-radius: 999px; padding: 5px 10px; min-height: 30px; cursor: pointer;
}
.also-add:hover { border-color: var(--accent); color: var(--ink-2); }

/* ---------- manage activities ---------- */

.manage { margin-top: 22px; }
.manage summary {
  cursor: pointer; font-weight: 600; font-size: 14px;
  padding: 10px 0; color: var(--ink-2);
}
.manage summary:hover { color: var(--accent); }

.add-activity { display: flex; gap: 8px; margin: 8px 0 12px; }
.add-activity input {
  flex: 1; font: inherit; font-size: 15px; padding: 8px 11px; min-height: 40px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}

.activity-list { list-style: none; margin: 0; padding: 0;
                 display: flex; flex-direction: column; gap: 4px; }
.activity-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--line);
}
.activity-row[data-archived="true"] { opacity: 0.5; }
.activity-swatch {
  width: 22px; height: 22px; padding: 0; border-radius: 6px;
  border: 1px solid var(--line); cursor: pointer; flex-shrink: 0;
  -webkit-appearance: none; appearance: none; background: none;
}
.activity-swatch::-webkit-color-swatch { border: none; border-radius: 5px; }
.activity-swatch::-moz-color-swatch { border: none; border-radius: 5px; }
.activity-name {
  flex: 1; font: inherit; font-size: 14px; color: var(--ink);
  background: transparent; border: 1px solid transparent;
  border-radius: 6px; padding: 5px 7px; min-width: 0;
}
.activity-name:focus { border-color: var(--accent); outline: none; background: var(--page); }
.activity-action {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 12.5px; padding: 5px 7px; border-radius: 6px; white-space: nowrap;
}
.activity-action:hover { color: var(--accent); }

.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.error { color: var(--danger); font-size: 13px; margin: 0 0 10px; }

footer { display: flex; gap: 8px; margin-top: 26px; flex-wrap: wrap; }

@media (max-width: 420px) {
  .slot { grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 8px 9px; }
  .slot-hour { font-size: 12px; }
  .datebar { gap: 6px; }
  .tagline { display: none; }
}
