:root {
  --bg: #f4f5f8;
  --panel: #ffffff;
  --text: #16181d;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #3b6cf6;
  --accent-soft: #e8eefe;
  --warn: #b54708;
  --warn-soft: #fff4e5;
  --ok: #067647;
  --danger: #c01048;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --panel: #161b22;
    --text: #e6e8eb;
    --muted: #8b949e;
    --line: #2a313c;
    --accent: #6d95ff;
    --accent-soft: #1b2640;
    --warn: #f5a524;
    --warn-soft: #2b2112;
    --ok: #3fb950;
    --danger: #ff6b8b;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 22px; }
.brand-name { font-weight: 700; }
.clock { color: var(--muted); font-size: 14px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.nav button.active { background: var(--accent-soft); color: var(--accent); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }

.view { padding: 20px; max-width: 1400px; margin: 0 auto; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 17px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel h2 .sub { font-weight: 500; color: var(--muted); font-size: 14px; }
.panel.review { border-color: var(--warn); background: var(--warn-soft); }
.heads-up .summary { margin: 0 0 6px; font-size: 17px; }
.heads-up li { align-items: flex-start; }
.heads-up li.link { cursor: pointer; }
.heads-up li.note .icon { color: var(--muted); width: 1.3em; text-align: center; }
.heads-up li.alert { color: var(--warn); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); font-style: italic; padding: 8px 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li .grow { flex: 1; min-width: 0; }
.list li.done .title { text-decoration: line-through; color: var(--muted); }

.event { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg); margin-bottom: 6px; cursor: pointer; }
.event .bar { width: 4px; border-radius: 4px; align-self: stretch; background: var(--accent); flex: none; }
.event .time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.event .title { font-weight: 600; }
.event.proposed { outline: 1.5px dashed var(--warn); }

.day-head { font-weight: 700; margin: 14px 0 6px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day-head.today { color: var(--accent); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week .col { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 240px; }
.week .col.today { border-color: var(--accent); }
.week .col .day-head { margin-top: 0; }
.week .event { flex-direction: column; gap: 2px; }
.week .event .bar { display: none; }
.week .event { border-left: 4px solid var(--accent); }
@media (max-width: 900px) { .week { grid-template-columns: 1fr; } .week .col { min-height: 0; } }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.btn { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg); color: var(--danger); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 140px; }
.spacer { flex: 1; }

input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="time"], input[type="password"], select, textarea {
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 10px; width: 100%;
}
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
textarea { min-height: 140px; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
label.field > * { color: var(--text); font-weight: 400; font-size: 15px; }
.stack { display: grid; gap: 12px; }
.stack p { margin: 0; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(520px, 94vw); background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
dialog form { padding: 20px; display: grid; gap: 12px; }
dialog h3 { margin: 0; }

.review-item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.review-item .quote { font-size: 13px; color: var(--muted); margin: 6px 0; }
.confidence { font-size: 12px; font-weight: 700; }
.confidence.low { color: var(--danger); }

.activity .msg { padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity .msg:last-child { border: 0; }
.activity .body { white-space: pre-wrap; font-size: 13px; color: var(--muted); max-height: 4.5em; overflow: hidden; }
.run { font-size: 13px; margin-top: 4px; }
.run.error { color: var(--danger); }
.run.ok { color: var(--ok); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.status-dot.on { background: var(--ok); }
code.url { display: block; word-break: break-all; font-size: 12px; background: var(--bg); padding: 8px; border-radius: 8px; margin-top: 4px; }

.login { max-width: 360px; margin: 12vh auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 20; }
.event .grow { min-width: 0; overflow-wrap: anywhere; }
.week .event .time { white-space: normal; }
[hidden] { display: none !important; }
