:root {
  color-scheme: dark;
  --bg: #0f1218;
  --surface: #1b1f2a;
  --ink: #eef1f6;
  --muted: #a3abba;
  --line: #31384a;
  --accent: #9ec0ff;
  --accent-ink: #0f1218;
  --accent-soft: #24344f;
  --nav: rgba(18, 21, 28, 0.94);
  --danger: #ffb4b4;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.shell { height: 100dvh; display: flex; background: var(--bg); }
.side {
  display: none;
  width: 240px;
  flex: none;
  flex-direction: column;
  gap: 6px;
  padding: 22px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; padding: 6px 12px 16px; }
.side button, .tabbar button {
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 650;
}
.side button { min-height: 46px; padding: 0 14px; font-size: 16px; }
.side button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.main { flex: 1; min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}
.top h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
#theme-toggle, .ghost, .sheet-bar .ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
}
.views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.stage { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 8px 16px 16px; }
.stage img { width: min(100%, 480px); height: auto; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.state { max-width: 420px; margin: 12vh auto 0; text-align: center; }
.state h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.03em; }
.state p { margin: 0 0 16px; color: var(--muted); line-height: 1.45; }
.state button, .controls button, .key-row button, .segment button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
}
.controls {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.countdown { margin: 0; flex: 1; font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.controls .ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.frame-host { flex: 1; min-height: 0; }
.frame-host[hidden] { display: none !important; }
.app-frame { width: 100%; height: 100%; border: 0; background: var(--bg); }
.segment { display: flex; gap: 6px; padding: 0 16px 10px; }
.segment button { flex: 1; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.segment button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.garage { height: 100%; overflow: auto; padding: 0 16px 24px; }
.sample-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.garage-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 0 0 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}
.kicker { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.garage-row strong { font-size: 17px; }
.meta { color: var(--muted); font-size: 14px; }
.tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--nav);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.tabbar button { text-align: center; min-height: 48px; font-size: 12px; }
.tabbar button[aria-current="page"] { color: var(--accent); }
#lane-board { display: grid; gap: 10px; }
.task-card { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task-card a { color: var(--accent); }
#todayStrip, #cacheLine, #live-feed { margin: 2px 0; color: var(--muted); font-size: 13px; }
[data-badge="broken"] { box-shadow: inset 0 -2px 0 #ffb4b4; }
[data-badge="stale"] { box-shadow: inset 0 -2px 0 #e5a44a; }
[data-badge="ok"] { box-shadow: inset 0 -2px 0 #7dcea0; }
#view-brief .stage { background: radial-gradient(1200px 400px at 20% -10%, #24344f, transparent 60%); }
#view-brief .countdown { font-size: 28px; letter-spacing: -0.04em; }
.task-card, .garage-row, .chart-box { background: #151922; border: 1px solid #31384a; border-radius: 16px; padding: 12px 14px; }
.chart-box { margin: 0 16px 12px; }
select, input { background: #0f1218; color: #eef1f6; border: 1px solid #31384a; border-radius: 10px; min-height: 40px; padding: 0 10px; }
.sheet-root { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; border: 0; background: rgba(15, 18, 24, 0.46); }
.sheet {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet h2 { margin: 8px 0; font-size: 20px; }
.sheet p { color: var(--muted); line-height: 1.45; }
.key-row { display: flex; gap: 8px; }
.key-row input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
}
@media (min-width: 960px) {
  .side { display: flex; }
  .tabbar { display: none; }
  .top { padding: 22px 28px 8px; }
  .stage { padding: 8px 28px 20px; }
  .controls { padding: 14px 28px 18px; }
  .segment, .garage { padding-left: 28px; padding-right: 28px; }
  .sheet-root { align-items: center; }
  .sheet { border-radius: 22px; margin-bottom: 0; }
}
