/* Look "Today" (default): friendly, colourful daily digest. Ported from design/directions/today.html,
   with the a11y review folded in. Unscoped: css/flightdeck.css restyles the same markup. */

@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url(/assets/fonts/nunito-vietnamese-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url(/assets/fonts/nunito-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url(/assets/fonts/nunito-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url(/assets/fonts/jetbrains-mono-vietnamese-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url(/assets/fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --font-ui: 'Nunito', ui-rounded, system-ui, sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, monospace;

  --bg: #f6f3ee; --bg-glow-a: #ffe2c8; --bg-glow-b: #dcdcff;
  --surface: #ffffff; --surface-2: #f1eee8; --line: #e4dfd6;
  --ink: #1c1a2e; --muted: #5a576e; --track: #ebe7f1;
  --shadow: 0 1px 2px rgb(28 26 46 / .06), 0 8px 24px -12px rgb(28 26 46 / .18);
  --shadow-lift: 0 2px 4px rgb(28 26 46 / .08), 0 18px 36px -16px rgb(28 26 46 / .35);

  --doing: #4338ca;   --doing-bg: #e8e7ff;
  --waiting: #a5460a; --waiting-bg: #ffeedb;
  --watching: #0f766e; --watching-bg: #d8f4ef;
  --auto: #6d28d9;    --auto-bg: #efe6ff;
  --ideas: #be185d;   --ideas-bg: #ffe4f0;
  --other: #475569;   --other-bg: #e9edf2;

  --ok: #12702f;   --ok-bg: #dcf5e4;
  --warn: #a35200; --warn-bg: #fff0d6;
  --bad: #b91c1c;  --bad-bg: #ffe2e0;
  --idle: #525f72; --idle-bg: #edf0f4;
  /* Graphic fills (gauges, bars): light uses the text tokens so arcs reach 3:1 (a11y #5). */
  --fill-ok: #12702f; --fill-warn: #a86400; --fill-bad: #c2302c;
  --st-working: #16a34a; --st-idle: #64748b; --st-blocked: #dc2626; --st-waiting: #d97706;

  --card-blocked: #c42b30;  --card-blocked-ink: #ffffff;
  --card-question: #5b3fd9; --card-question-ink: #ffffff;
  --card-waiting: #f5b400;  --card-waiting-ink: #231900;

  --radius-xl: 28px; --radius-lg: 20px; --radius-md: 14px; --radius-pill: 999px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --text-xs: .75rem; --text-sm: .875rem; --text-md: 1rem; --text-lg: 1.25rem; --text-xl: 1.75rem; --text-2xl: 2.125rem;
  --duration-fast: 150ms; --duration-normal: 300ms; --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --focus: #2563eb;
  --tabbar-space: 104px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121120; --bg-glow-a: #3a1f4a; --bg-glow-b: #1b2a55;
    --surface: #1d1b2e; --surface-2: #26243a; --line: #34314c;
    --ink: #f3f1ff; --muted: #b0acc8; --track: #312e48;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px -14px rgb(0 0 0 / .7);
    --shadow-lift: 0 2px 6px rgb(0 0 0 / .5), 0 20px 40px -14px rgb(0 0 0 / .8);
    --doing: #a5b4fc; --doing-bg: #2a2a5c; --waiting: #fdba74; --waiting-bg: #4a2c14;
    --watching: #5eead4; --watching-bg: #123d3a; --auto: #c4b5fd; --auto-bg: #36255e;
    --ideas: #f9a8d4; --ideas-bg: #4d1d36; --other: #cbd5e1; --other-bg: #2c3442;
    --ok: #86efac; --ok-bg: #173b26; --warn: #fcd34d; --warn-bg: #45330c;
    --bad: #fca5a5; --bad-bg: #4b1c1f; --idle: #a8b3c4; --idle-bg: #2b3140;
    --fill-ok: #22c55e; --fill-warn: #f59e0b; --fill-bad: #ef4444;
    --focus: #93c5fd;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121120; --bg-glow-a: #3a1f4a; --bg-glow-b: #1b2a55;
  --surface: #1d1b2e; --surface-2: #26243a; --line: #34314c;
  --ink: #f3f1ff; --muted: #b0acc8; --track: #312e48;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px -14px rgb(0 0 0 / .7);
  --shadow-lift: 0 2px 6px rgb(0 0 0 / .5), 0 20px 40px -14px rgb(0 0 0 / .8);
  --doing: #a5b4fc; --doing-bg: #2a2a5c; --waiting: #fdba74; --waiting-bg: #4a2c14;
  --watching: #5eead4; --watching-bg: #123d3a; --auto: #c4b5fd; --auto-bg: #36255e;
  --ideas: #f9a8d4; --ideas-bg: #4d1d36; --other: #cbd5e1; --other-bg: #2c3442;
  --ok: #86efac; --ok-bg: #173b26; --warn: #fcd34d; --warn-bg: #45330c;
  --bad: #fca5a5; --bad-bg: #4b1c1f; --idle: #a8b3c4; --idle-bg: #2b3140;
  --fill-ok: #22c55e; --fill-warn: #f59e0b; --fill-bad: #ef4444;
  --focus: #93c5fd;
}

/* ---------- base ---------- */
html { scroll-padding-bottom: var(--tabbar-space); }
body {
  font-family: var(--font-ui); font-size: var(--text-md); line-height: 1.4; color: var(--ink);
  background:
    radial-gradient(60rem 30rem at -10% -10%, var(--bg-glow-a), transparent 60%),
    radial-gradient(50rem 30rem at 110% 0%, var(--bg-glow-b), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.code { font-family: var(--font-code); font-size: .8em; font-weight: 700; letter-spacing: .01em; }
.empty { color: var(--muted); font-weight: 700; padding: var(--space-3) 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: var(--radius-pill); border: 0; font-weight: 900; cursor: pointer; background: var(--ink); color: var(--bg);
  transition: transform var(--duration-fast) var(--ease-out-expo);
}
a.btn { text-decoration: none; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn--soft { background: var(--surface-2); color: var(--ink); min-height: 44px; border: 1px solid var(--line); }
.btn--link { background: none; color: var(--muted); min-height: 44px; padding: 0 6px; font-weight: 800;
  text-decoration: underline; text-underline-offset: 3px; }
.btn--link:hover { color: var(--ink); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); flex: none;
  transition: transform var(--duration-fast) var(--ease-out-expo);
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }

/* ---------- gates: pairing + lock ---------- */
.gate {
  min-height: 100dvh; display: grid; place-items: center; overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + var(--space-5)) max(var(--space-4), env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + var(--space-5)) max(var(--space-4), env(safe-area-inset-left));
  background: var(--bg); /* opaque: nothing behind it shows through */
}
.frame {
  width: min(380px, 100%); display: grid; justify-items: center; align-content: start; gap: var(--space-3); text-align: center;
  padding: var(--space-6) var(--space-5); border-radius: 34px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.frame-title { font-size: var(--text-xl); font-weight: 900; letter-spacing: -.01em; }
.frame-sub { color: var(--muted); font-weight: 700; font-size: var(--text-sm); }
.gate__msg { min-height: 1.4em; font-size: var(--text-sm); font-weight: 800; color: var(--bad); }
.gate__msg:empty { display: none; }
.gate__msg[data-tone='info'] { color: var(--muted); }
.orb {
  width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #5b3fd9, #ec4899); box-shadow: var(--shadow-lift);
}
.orb .i { width: 34px; height: 34px; }
.orb--pair { background: linear-gradient(135deg, #0f766e, #22c55e); }

.pair { display: grid; justify-items: center; gap: var(--space-3); width: 100%; }
.pair-code {
  font-family: var(--font-code); font-weight: 700; font-size: clamp(1.9rem, 1.2rem + 4vw, 2.4rem); letter-spacing: .08em;
  padding: var(--space-3) var(--space-5); border-radius: var(--radius-lg); background: var(--doing-bg); color: var(--doing);
  white-space: nowrap; user-select: all;
}
.pair__how { color: var(--muted); font-weight: 600; font-size: var(--text-sm); max-width: 30ch; }
.pair__url { font-family: var(--font-code); font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.pair__status { display: inline-flex; align-items: center; gap: 8px; min-height: 1.4em; font-size: var(--text-sm); font-weight: 800; color: var(--muted); }
.pair__status::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.pair[data-state='waiting'] .pair__status::before { background: var(--fill-ok); animation: blink 1.6s ease-in-out infinite; }
.pair[data-state='done'] .pair__status::before { background: var(--fill-ok); }
.pair:is([data-state='expired'], [data-state='denied'], [data-state='error']) .pair__status { color: var(--bad); }
.pair:is([data-state='expired'], [data-state='denied'], [data-state='error']) .pair__status::before { background: var(--bad); }
.pair:is([data-state='expired'], [data-state='denied']) .pair-code { opacity: .4; text-decoration: line-through; }
@keyframes blink { 50% { opacity: .35; } }

.pin-form { display: grid; justify-items: center; gap: var(--space-2); }
.pin-input {
  width: 13ch; min-height: 48px; padding: 0 var(--space-3); border-radius: var(--radius-md);
  border: 2px solid var(--line); background: var(--surface-2); color: var(--ink); text-align: center;
  font-family: var(--font-code); font-size: 1.5rem; letter-spacing: .3em;
}
.pin-input:focus-visible { outline-offset: 2px; }
.pin-input.shake { animation: shake 360ms var(--ease-out-expo); border-color: var(--bad); }
@keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 64px); gap: 10px 20px; justify-content: center; }
.key {
  width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink);
  font-size: 1.375rem; font-weight: 800; cursor: pointer; display: grid; place-items: center;
  transition: transform var(--duration-fast) var(--ease-out-expo);
}
.key:active { transform: scale(.94); }
.key--fn { background: transparent; color: var(--muted); }
.key--fn .i { width: 26px; height: 26px; }
.key--go { color: var(--doing); }

/* ---------- app shell ---------- */
.app {
  max-width: 1440px; margin: 0 auto;
  padding: 0 max(var(--space-4), env(safe-area-inset-right)) calc(var(--tabbar-space) + env(safe-area-inset-bottom)) max(var(--space-4), env(safe-area-inset-left));
}
.topbar { display: flex; align-items: center; gap: var(--space-2); padding: calc(env(safe-area-inset-top) + var(--space-3)) 0 var(--space-3); }
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 900; font-size: var(--text-lg); letter-spacing: -.01em; margin-right: auto; }
.brand-mark { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: conic-gradient(from 200deg, #5b3fd9, #ec4899, #f59e0b, #10b981, #5b3fd9); }
.brand-mark .i { width: 18px; height: 18px; }
.banner { margin: 0 0 var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--warn-bg); color: var(--warn); font-weight: 800; font-size: var(--text-sm); }

.fresh-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.fresh { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px 4px 10px; border-radius: var(--radius-pill);
  font-size: var(--text-sm); font-weight: 800; background: var(--surface); border: 1px solid var(--line); }
.fresh .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fill-ok); box-shadow: 0 0 0 3px var(--ok-bg); flex: none; }
.fresh.stale { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.fresh .i { width: 16px; height: 16px; }

/* ---------- hero ---------- */
.section-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--space-3); padding: var(--space-3) 0 var(--space-5); }
.hello-text { grid-column: 1; grid-row: 1; }
.health, .segbar, .g--ring { display: none; } /* Flight deck parts */
.hello-date { font-size: var(--text-sm); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.section-hero h1 { font-size: var(--text-2xl); font-weight: 900; line-height: 1.05; letter-spacing: -.02em; margin-top: 4px; }
.hello-sub { margin-top: var(--space-2); font-weight: 700; color: var(--muted); }
.hello-sub strong { color: var(--bad); }
.hello-sub.calm strong { color: var(--ok); }
.hello-art { grid-column: 2; grid-row: 1; width: 104px; height: 78px; }
.section-hero .fresh-row { grid-column: 1 / -1; grid-row: 2; }
.art-sun-soft { fill: var(--waiting-bg); }
.art-hill-a { fill: var(--watching-bg); }
.art-hill-b { fill: var(--doing-bg); }
.art-hill-c { fill: var(--auto-bg); }
.art-pole { stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.art-flag { fill: #c42b30; }
.art-bang { fill: #fff; font-family: var(--font-ui); font-weight: 900; font-size: 18px; }
.art-knob, .art-sun, .art-sun-halo { fill: #f5b400; }
.art-sun-halo { opacity: .18; }
.art-cloud { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.art-sprout { stroke: var(--ok); stroke-width: 3; stroke-linecap: round; fill: none; }
.art-leaf { fill: var(--ok-bg); }
.art-rays { stroke: #f5b400; stroke-width: 3; stroke-linecap: round; fill: none; }

/* ---------- section headings ---------- */
.sec { margin-top: var(--space-6); }
.sec-head { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-3); }
.sec-head h2 { font-size: var(--text-lg); font-weight: 900; letter-spacing: -.01em; }
.sec-head .count { font-weight: 800; color: var(--muted); }
.sec-head .count:empty { display: none; }
.sec-head .aside { margin-left: auto; font-size: var(--text-sm); font-weight: 700; color: var(--muted); }

/* ---------- needs you ---------- */
.needs-scroller { margin-inline: calc(-1 * var(--space-4)); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--space-4);
  scrollbar-width: none; overscroll-behavior-x: contain; }
.needs-scroller::-webkit-scrollbar { display: none; }
.needs-scroller:focus-visible { outline-offset: -3px; }
.needs-track { display: grid; grid-auto-flow: column; grid-auto-columns: 84%; gap: var(--space-3); padding: 4px var(--space-4) var(--space-4); }
.need { scroll-snap-align: start; position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: var(--space-3); min-height: 168px; padding: var(--space-5);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lift); }
.need::after { content: ''; position: absolute; inset: auto -30px -50px auto; width: 160px; height: 160px; border-radius: 50%;
  background: rgb(255 255 255 / .08); z-index: -1; }
.need-kind { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 10px 4px 6px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 900; letter-spacing: .1em; text-transform: uppercase; background: rgb(0 0 0 / .16); }
.need-kind .i { width: 16px; height: 16px; }
.need-text { font-size: var(--text-lg); font-weight: 800; line-height: 1.25; }
.need-meta { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-weight: 700; font-size: var(--text-sm); }
.need-meta .code { font-size: .85rem; }
.need-mac { display: inline-flex; align-items: center; gap: 4px; }
.need-mac .i { width: 16px; height: 16px; }
.need-ghost { position: absolute; right: 14px; top: 14px; width: 54px; height: 54px; opacity: .22; z-index: -1; }
.need.blocked { background: var(--card-blocked); color: var(--card-blocked-ink); }
.need.question { background: var(--card-question); color: var(--card-question-ink); }
.need.waiting { background: var(--card-waiting); color: var(--card-waiting-ink); }
.need.waiting .need-kind { background: rgb(0 0 0 / .1); }
.need.other { background: var(--ink); color: var(--bg); }
.all-clear { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-xl);
  background: var(--ok-bg); color: var(--ok); font-weight: 900; }
.all-clear .i { width: 32px; height: 32px; }
.all-clear p { color: var(--ink); font-weight: 700; }

/* ---------- plans ---------- */
.plans-stack, .plans-grid { display: grid; gap: var(--space-3); }
.plan { position: relative; display: grid; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); }
.plan-top { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 10px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 800; background: var(--hue-bg, var(--other-bg)); color: var(--hue, var(--other)); }
.tag .i { width: 14px; height: 14px; }
.tag.prio-high { background: var(--bad-bg); color: var(--bad); }
.tag.prio-medium { background: var(--warn-bg); color: var(--warn); }
.tag.prio-low { background: var(--idle-bg); color: var(--idle); }
.plan-title { font-size: 1.0625rem; font-weight: 800; line-height: 1.3; }
.plan-meta { font-size: var(--text-sm); font-weight: 600; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; }
.plan-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.plan-meta .i { width: 15px; height: 15px; }
.pill { display: flex; align-items: center; gap: var(--space-3); }
.pill-track { flex: 1; height: 14px; border-radius: var(--radius-pill); background: var(--track); overflow: hidden; }
.pill-fill { height: 100%; width: 100%; border-radius: inherit; background: var(--hue, var(--doing)); transform-origin: left center;
  transform: scaleX(var(--p, 0)); transition: transform 900ms var(--ease-out-expo); }
.pill-num { min-width: 3.2ch; text-align: right; font-weight: 900; font-size: var(--text-lg); color: var(--hue, var(--doing)); }
.wake { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: 800; }
.wake .i { width: 16px; height: 16px; }
.wake.overdue { background: var(--bad-bg); color: var(--bad); }
.wake.today { background: var(--warn-bg); color: var(--warn); }
.wake.soon { background: var(--watching-bg); color: var(--watching); }
.wake.cond { background: var(--surface-2); color: var(--muted); }
.list-card { border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.row-plan { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px var(--space-3);
  padding: var(--space-3) var(--space-4); min-height: 56px; }
.row-plan + .row-plan { border-top: 1px solid var(--line); }
.row-plan .txt { flex: 1 1 150px; display: grid; gap: 2px; }
.row-plan .t { font-weight: 800; line-height: 1.3; }
.row-plan .s { font-size: var(--text-sm); color: var(--muted); font-weight: 600; }

[data-b] { --hue: var(--other); --hue-bg: var(--other-bg); }
[data-b='doing'] { --hue: var(--doing); --hue-bg: var(--doing-bg); }
[data-b='waiting'] { --hue: var(--waiting); --hue-bg: var(--waiting-bg); }
[data-b='watching'] { --hue: var(--watching); --hue-bg: var(--watching-bg); }
[data-b='auto'] { --hue: var(--auto); --hue-bg: var(--auto-bg); }
[data-b='ideas'] { --hue: var(--ideas); --hue-bg: var(--ideas-bg); }
.bucket-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.bucket-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--hue-bg); color: var(--hue); flex: none; }
.bucket-head h3 { font-size: var(--text-lg); font-weight: 900; }
.bucket-head .n { margin-left: auto; min-width: 32px; height: 32px; padding: 0 10px; border-radius: var(--radius-pill); display: grid; place-items: center;
  background: var(--hue-bg); color: var(--hue); font-weight: 900; }
.buckets { margin-top: var(--space-6); display: grid; gap: var(--space-6); }
.strip-card { padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); }
.strip { display: flex; height: 18px; border-radius: var(--radius-pill); overflow: hidden; gap: 3px; }
.strip span { background: var(--hue); }
.strip-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: var(--space-3); font-size: var(--text-sm); font-weight: 700; color: var(--muted); }
.strip-legend b { color: var(--hue); font-weight: 900; }
.strip-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--hue); margin-right: 6px; }
.section-plans { padding-top: var(--space-5); }

/* ---------- Now tab: Mac glance ---------- */
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.glance-card { display: grid; gap: var(--space-2); align-content: start; padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); text-align: left; cursor: pointer; min-height: 44px;
  transition: transform var(--duration-fast) var(--ease-out-expo); }
.glance-card:hover { transform: translateY(-2px); }
.glance-title { font-size: var(--text-md); font-weight: 900; }
.glance-card .fresh { justify-self: start; }
.mini-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 800; color: var(--muted); }
.mini-bar .tr { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.mini-bar .fl { display: block; height: 100%; width: 100%; background: var(--lv); transform-origin: left; transform: scaleX(var(--p)); border-radius: inherit; }
.mini-bar b { color: var(--lv-text); text-align: right; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; }
.dots span { width: 12px; height: 12px; border-radius: 50%; background: var(--st-idle); }
.dots span[data-s='working'] { background: var(--st-working); }
.dots span[data-s='blocked'] { background: var(--st-blocked); }
.dots span[data-s='waiting'] { background: var(--st-waiting); }
.dots span[data-s='gone'] { background: transparent; outline: 2px dashed var(--muted); outline-offset: -2px; }
.lv-ok { --lv: var(--fill-ok); --lv-text: var(--ok); }
.lv-warn { --lv: var(--fill-warn); --lv-text: var(--warn); }
.lv-bad { --lv: var(--fill-bad); --lv-text: var(--bad); }
.lv-none { --lv: var(--track); --lv-text: var(--muted); }

/* ---------- Macs ---------- */
.mac + .mac { margin-top: var(--space-7); }
.mac-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.mac-head h3 { font-size: var(--text-xl); font-weight: 900; letter-spacing: -.02em; }
.mac-sub { font-size: var(--text-xs); font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: var(--space-5) 0 var(--space-3); }
.mac-split > div:first-child > .mac-sub:first-child { margin-top: 0; }
.section-macs { padding-top: var(--space-5); }
.unread { font-size: var(--text-sm); font-weight: 700; color: var(--warn); width: 100%; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-4) var(--space-2); }
.person { display: grid; justify-items: center; text-align: center; gap: 4px; align-content: start; }
.avatar { position: relative; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 1.125rem; color: #fff; background: var(--av); box-shadow: var(--shadow); }
.person[data-s='gone'] .avatar { background: var(--surface-2); color: var(--muted); box-shadow: none; outline: 2px dashed var(--muted); outline-offset: -2px; }
.badge { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 3px solid var(--bg); background: var(--st-bg); color: var(--st); }
.badge .i { width: 14px; height: 14px; stroke-width: 2.6; }
.person[data-s='working'] { --st: #fff; --st-bg: var(--st-working); --st-text: var(--ok); }
.person[data-s='idle'] { --st: #fff; --st-bg: var(--st-idle); --st-text: var(--muted); }
.person[data-s='blocked'] { --st: #fff; --st-bg: var(--st-blocked); --st-text: var(--bad); }
.person[data-s='waiting'] { --st: #fff; --st-bg: var(--st-waiting); --st-text: var(--warn); }
.person[data-s='gone'] { --st: var(--muted); --st-bg: var(--surface-2); --st-text: var(--muted); }
.person[data-s='working'] .avatar::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--st-working); opacity: .5;
  animation: ring 2.4s var(--ease-out-expo) 3; /* a11y #9: three runs, not forever */ }
@keyframes ring { from { transform: scale(.92); opacity: .7; } to { transform: scale(1.15); opacity: 0; } }
.p-name { max-width: 100%; font-size: var(--text-sm); font-weight: 800; overflow-wrap: anywhere; }
.p-state { font-size: var(--text-xs); font-weight: 800; color: var(--st-text); }
.p-meta { display: flex; gap: 4px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: var(--text-xs); color: var(--muted); font-weight: 700; }
.p-detail { font-size: var(--text-xs); color: var(--muted); font-weight: 600; }
.prof { padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); font-family: var(--font-code); font-size: .75rem; line-height: 1.5; }

.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--space-2); }
.meter { display: grid; justify-items: center; align-content: start; padding: var(--space-3) var(--space-2); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.meter svg.g { width: 100%; max-width: 104px; height: auto; overflow: visible; }
.g-track { stroke: var(--track); }
.g-fill { stroke: var(--lv); }
.g-icon { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.meter .val { font-size: var(--text-lg); font-weight: 900; margin-top: -6px; }
.meter .lbl { font-size: var(--text-sm); font-weight: 800; color: var(--muted); }
.meter .flag { font-size: var(--text-xs); font-weight: 900; color: var(--lv-text); letter-spacing: .04em; text-transform: uppercase; }
.meter .note { font-size: var(--text-xs); font-weight: 700; color: var(--muted); text-align: center; }
.services { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }
.svc { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 10px 2px 6px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: 800; }
.svc .i { width: 16px; height: 16px; }
.svc.up { background: var(--ok-bg); color: var(--ok); }
.svc.down { background: var(--bad-bg); color: var(--bad); }
.repo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); min-height: 56px; }
.repo + .repo { border-top: 1px solid var(--line); }
.repo .n { font-weight: 800; }
.repo .b { font-size: var(--text-sm); color: var(--muted); font-weight: 600; display: flex; align-items: flex-start; gap: 4px; }
.repo .b .i { width: 14px; height: 14px; margin-top: 3px; }
.chips { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 900; }
.chip .i { width: 13px; height: 13px; stroke-width: 2.6; }
.chip.behind { background: var(--waiting-bg); color: var(--waiting); }
.chip.ahead { background: var(--doing-bg); color: var(--doing); }
.chip.dirty { background: var(--ideas-bg); color: var(--ideas); }
.chip.fail { background: var(--bad-bg); color: var(--bad); }
.chip.clean { background: var(--ok-bg); color: var(--ok); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-2); }

/* ---------- This device ---------- */
.device { margin-top: var(--space-7); padding: var(--space-5); border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.device .mac-sub { margin-top: 0; }
.device__line { color: var(--muted); font-weight: 700; font-size: var(--text-sm); }
.seg { margin-top: var(--space-4); display: flex; flex-wrap: wrap; gap: 6px; }
.seg legend { width: 100%; margin-bottom: 6px; font-size: var(--text-xs); font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 800; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.device__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-4); }
.device .gate__msg { color: var(--muted); margin-top: var(--space-2); }

/* ---------- phone tab bar ---------- */
.tabbar { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  width: min(360px, calc(100% - 24px)); padding: 6px; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line); box-shadow: var(--shadow-lift); }
.tabbar__list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tab { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border: 0; border-radius: var(--radius-pill);
  background: transparent; font-weight: 800; color: var(--muted); cursor: pointer; transition: background var(--duration-fast); }
.tab[aria-selected='true'] { background: var(--ink); color: var(--bg); }
.tab .n { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--card-blocked); color: #fff; font-size: .75rem; display: grid; place-items: center; }
.panel { display: none; }
.panel.is-active { display: block; animation: rise var(--duration-normal) var(--ease-out-expo); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel:focus-visible { outline-offset: 6px; }

/* Short screens (landscape / big zoom): the bar must not eat the viewport. */
@media (max-height: 500px) {
  .tabbar { position: static; transform: none; margin: var(--space-5) auto 0; }
  .app { padding-bottom: var(--space-5); }
  html { scroll-padding-bottom: 0; }
}

/* ---------- desktop: real multi-column dashboard ---------- */
@media (min-width: 1024px) {
  html { scroll-padding-bottom: 0; }
  .app { padding: 0 var(--space-6) var(--space-7); }
  .tabbar, .only-phone { display: none !important; }
  .panel { display: block; animation: none; }
  #panel-now { display: none; }
  .section-hero { grid-template-columns: minmax(0, 1fr) auto auto; padding-top: var(--space-5); }
  .section-hero h1 { font-size: 2.75rem; }
  .hello-art { width: 168px; height: 126px; grid-column: 3; }
  .section-hero .fresh-row { grid-column: 2; grid-row: 1; align-self: start; justify-content: flex-end; }
  .needs-scroller { margin: 0; overflow: visible; }
  .needs-track { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); padding: 0; }
  .desk { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; margin-top: var(--space-6); }
  .section-plans, .section-macs { padding-top: 0; }
  .buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-5); align-items: start; }
  .bucket[data-b='doing'] { grid-column: 1 / -1; }
  .bucket[data-b='doing'] .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Sticky, but never clipped: no max-height/overflow, so a column taller than the viewport
     still scrolls fully into view by the end of the desk. */
  .macs-col { position: sticky; top: var(--space-4); align-self: start; }
  .macs-col.is-tall { position: static; }
  .mac { padding: var(--space-5); border-radius: var(--radius-xl); background: color-mix(in srgb, var(--surface) 55%, transparent); border: 1px solid var(--line); }
  .mac + .mac { margin-top: var(--space-5); }
  .device { margin-top: var(--space-5); }
}
@media (min-width: 1360px) {
  .mac .people { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
