:root {
  /* Layout: a rail beside a bento of smoke tiles on white; white cards sit inside tiles. */
  --bg: #ffffff;
  --tile: #f3f3f3;
  --card: #ffffff;
  --ink: #242527;
  --muted: #696a6e;
  --line: #e7e7e8;
  --blue: #0062fd;
  --on-blue: #ffffff;
  --emerald: #00dc84;
  --ok: #08774a;
  --ok-bg: #dcf7ea;
  --warn: #a14a05;
  --warn-bg: #fdf0d9;
  --crit: #c22424;
  --crit-bg: #fde7e7;
  --font: "Red Hat Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-tile: 24px;
  --r-card: 16px;
  --shadow: 14px 30px 44px rgba(0, 0, 0, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18191b; --tile: #242527; --card: #2f3033; --ink: #f3f3f3; --muted: #a9aaae; --line: #3d3e42;
    --blue: #4f93ff; --on-blue: #0a1730; --emerald: #00dc84;
    --ok: #4fe0a4; --ok-bg: #123627; --warn: #f5b867; --warn-bg: #3d2c12; --crit: #ff8f8f; --crit-bg: #421c1c;
    --shadow: 14px 30px 44px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #18191b; --tile: #242527; --card: #2f3033; --ink: #f3f3f3; --muted: #a9aaae; --line: #3d3e42;
  --blue: #4f93ff; --on-blue: #0a1730; --emerald: #00dc84;
  --ok: #4fe0a4; --ok-bg: #123627; --warn: #f5b867; --warn-bg: #3d2c12; --crit: #ff8f8f; --crit-bg: #421c1c;
  --shadow: 14px 30px 44px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Shell */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.app.has-panel { grid-template-columns: 248px minmax(0, 1fr) 440px; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 28px 16px 20px; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; color: var(--ink); min-height: 44px; }
.logo { height: 21px; width: auto; display: block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: block; } }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.brand-tag { font-weight: 800; font-size: 13px; letter-spacing: 0.12em; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--bg); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; }
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a .n-label { flex: 1; }
.nav a .n-count { font-size: 13px; font-weight: 700; color: var(--muted); }
.nav a:hover { background: var(--tile); }
.nav a[aria-current="page"] { background: var(--blue); color: var(--on-blue); }
.nav a[aria-current="page"] .n-count { color: var(--on-blue); }
.rail-note { margin-top: auto; padding: 0 8px; font-size: 13px; color: var(--muted); }
.rail-me { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; font-size: 13px; color: var(--muted); }
.rm-out { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink); font-weight: 700; text-decoration: none; }
.rm-out svg { width: 16px; height: 16px; flex: none; }
.rm-out:hover .rm-label { text-decoration: underline; text-underline-offset: 3px; }
.main { padding: 36px 40px 64px; min-width: 0; outline: none; }
.loading { color: var(--muted); padding: 24px 0; }

/* View head */
.vhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.vhead h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; }
.vhead .sub { color: var(--muted); margin-top: 8px; max-width: 65ch; }
.vhead-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: var(--r-card); padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.notice-act { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; }
.notice-act span { flex: 1 1 220px; }
.notice-act .btn { color: inherit; flex: none; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--blue); color: var(--on-blue); font-weight: 700; text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: var(--tile); color: var(--ink); }
.btn.line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: var(--crit-bg); color: var(--crit); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--tile); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--tile); }
.tile .seg { background: var(--card); }
.seg button { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* Pills and chips */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #b9babd); }
.st-0 { --dot: #8b5cf6; } .st-1 { --dot: #d97706; } .st-2 { --dot: #0062fd; } .st-3 { --dot: #ea580c; }
.st-4 { --dot: #00b56c; } .st-5 { --dot: #9ca3af; } .st-6 { --dot: #0d9488; } .st-7 { --dot: #6b7280; } .st-8 { --dot: #c4c5c8; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--tile); color: var(--ink); white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.tile .chip { background: var(--card); }
.chip.due { background: var(--crit-bg); color: var(--crit); }
.chip.soon { background: var(--warn-bg); color: var(--warn); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.who { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 800; flex: none; }
.who.w-john { background: var(--emerald); color: #06371f; }
.who.w-claude { background: var(--blue); color: var(--on-blue); }
.who.w-none { background: var(--line); color: var(--ink); }

/* Bento */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.tile { background: var(--tile); border-radius: var(--r-tile); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tile > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tile h2 { font-size: 20px; font-weight: 800; }
.tile .tlink { font-size: 14px; font-weight: 700; color: var(--blue); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; background: none; border: 0; padding: 0; }
.tile .tlink svg { width: 16px; height: 16px; }
.t-fill { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sp-3 { grid-column: span 3; } .sp-4 { grid-column: span 4; } .sp-5 { grid-column: span 5; } .sp-7 { grid-column: span 7; } .sp-12 { grid-column: span 12; }
.rowcard { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border-radius: var(--r-card); background: var(--card); border: 0; text-align: left; color: var(--ink); text-decoration: none; }
button.rowcard:hover, a.rowcard:hover { box-shadow: inset 0 0 0 1.5px var(--blue); }
.rowcard .rc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rowcard .rc-main strong { font-weight: 700; overflow-wrap: anywhere; }
.rowcard .rc-main span { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.empty { background: var(--card); border-radius: var(--r-card); padding: 16px; color: var(--muted); flex: 1; display: flex; align-items: center; }
.big { font-size: 56px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.big small { font-size: 18px; font-weight: 700; letter-spacing: 0; margin-left: 6px; }
.meter { height: 10px; border-radius: 999px; background: var(--card); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--blue); }
.meter.em > i { background: var(--emerald); }
.pipe { display: flex; flex-direction: column; gap: 4px; flex: 1; justify-content: space-between; }
.pipe button { display: grid; grid-template-columns: 150px minmax(0, 1fr) 32px; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; font-weight: 600; font-size: 14px; }
.pipe button:hover { background: var(--card); }
.pipe .bar { height: 8px; border-radius: 999px; background: var(--card); overflow: hidden; }
.pipe .bar i { display: block; height: 100%; border-radius: 999px; background: var(--dot); }
.pipe .cnt { text-align: right; font-weight: 800; }
.pipe .lab { display: flex; align-items: center; gap: 8px; }
.pipe .lab::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); flex: none; }
.quick { display: flex; gap: 8px; }
.quick .input { flex: 1; }

.inlink { color: var(--blue); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.inlink:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 4px; }

/* Projects */
.toolbar { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(4, minmax(120px, 1fr)) auto; gap: 8px; margin-bottom: 20px; align-items: center; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 42px; }
.group { margin-bottom: 12px; background: var(--tile); border-radius: var(--r-tile); }
.group > button.ghead { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 0 20px; border: 0; background: transparent; font-weight: 800; font-size: 18px; text-align: left; border-radius: var(--r-tile); }
.ghead::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--dot); flex: none; }
.ghead .g-count { margin-left: auto; font-size: 14px; color: var(--muted); font-weight: 700; }
.ghead svg { width: 18px; height: 18px; color: var(--muted); transition: transform 0.15s; }
.ghead[aria-expanded="true"] svg { transform: rotate(90deg); }
.gbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 12px 12px; }
.has-panel .gbody { grid-template-columns: minmax(0, 1fr); }
.pcard { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: var(--r-card); background: var(--card); border: 0; text-align: left; min-width: 0; }
.pcard:hover, .pcard[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--blue); }
.pc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pc-top strong { font-size: 17px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.pc-meta { font-size: 13px; color: var(--muted); }
.pc-next { font-size: 15px; overflow-wrap: anywhere; }
.pc-next.none { color: var(--muted); }
.pc-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.bcol { flex: 0 0 300px; background: var(--tile); border-radius: var(--r-tile); display: flex; flex-direction: column; max-height: 72vh; }
.bcol h2 { display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; font-size: 16px; font-weight: 800; }
.bcol h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--dot); }
.bcol h2 span { margin-left: auto; color: var(--muted); font-size: 14px; }
.bcol .bbody { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; overflow-y: auto; }

/* Panel */
.panel { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-left: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 16px; background: var(--bg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { font-size: 14px; font-weight: 700; color: var(--muted); }
.panel .name { font-size: 22px; font-weight: 800; min-height: 52px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fgrid .wide { grid-column: 1 / -1; }
.panel h3 { font-size: 16px; font-weight: 800; margin-top: 8px; }
.panel-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 40; }

/* Linear */
h4 { margin: 0; line-height: 1.2; }
.lin-note { font-size: 14px; }
.lin-also { margin-top: 12px; overflow-wrap: anywhere; }
.lin-projs { display: flex; flex-wrap: wrap; gap: 8px; }
.lin-projs .btn { max-width: 100%; justify-content: flex-start; text-align: left; padding-top: 8px; padding-bottom: 8px; }
.lin-projs .btn svg { flex: none; }
.lin-projs .btn span { overflow-wrap: anywhere; }
.lin-group { display: flex; flex-direction: column; gap: 6px; }
.lin-group h4 { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.linrow { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 48px; padding: 10px 14px; border-radius: 14px; background: var(--tile); color: var(--ink); text-decoration: none; }
.linrow:hover { box-shadow: inset 0 0 0 1.5px var(--blue); }
.linrow .lin-t { font-weight: 600; overflow-wrap: anywhere; }
.linrow .lin-m { font-size: 13px; color: var(--muted); }
.lin-group > .btn { align-self: flex-start; }

/* Claude */
.ask { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--ink); color: var(--bg); font-weight: 700; flex: none; }
.ask svg { width: 18px; height: 18px; flex: none; color: var(--emerald); }
.ask[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--emerald); }
.panel.ai { padding: 0; gap: 0; overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 4px; padding: 14px 12px 14px 24px; border-bottom: 1px solid var(--line); }
.ai-head h2 { flex: 1; font-size: 18px; font-weight: 800; }
.ai-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.ai-log > * { flex: none; }
.ai-label { font-weight: 700; font-size: 14px; }
.ai-empty { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.ai-empty h3 { font-size: 22px; font-weight: 800; margin: 0; }
.ai-empty .rowcard, .handed .rowcard { background: var(--tile); }
.ai-empty .rowcard svg, .handed .rowcard svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.msg { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.msg.me { align-self: flex-end; max-width: 88%; background: var(--blue); color: var(--on-blue); border-radius: 18px 18px 4px 18px; padding: 10px 14px; font-weight: 500; }
.msg.ai { display: flex; flex-direction: column; gap: 8px; white-space: normal; }
.msg .lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
.msg .m-text { white-space: pre-wrap; }
.msg .m-text.thinking { color: var(--muted); }
.msg .m-note { font-size: 14px; font-weight: 600; color: var(--muted); }
.msg .m-note.warn { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 10px 12px; }
.act { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 4px 4px 12px; background: var(--tile); border-radius: 14px; font-size: 14px; font-weight: 600; }
.act > svg { width: 16px; height: 16px; flex: none; color: var(--ok); }
.act .a-text { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 6px 0; }
.act .btn { background: var(--card); }
.act .chip { background: var(--card); margin-right: 8px; }
.act.undone .a-text { text-decoration: line-through; color: var(--muted); }
.act.undone > svg { color: var(--muted); }
.handed { display: flex; flex-direction: column; gap: 8px; }
.hand { background: var(--tile); border-radius: 14px; padding: 12px 6px 6px 14px; display: flex; flex-direction: column; gap: 4px; }
.hand p { white-space: pre-wrap; overflow-wrap: anywhere; padding-right: 8px; }
.hand-foot { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; }
.hand-foot .chip { background: var(--card); }
.hand-foot .icon-btn { margin-left: auto; }
.hand .reply { font-size: 14px; padding: 0 8px 8px 0; }
.hand .reply b { display: block; font-size: 13px; color: var(--muted); }
.ai-confirm { background: var(--crit-bg); color: var(--crit); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.ai-confirm .btn.ghost { background: var(--card); }
.ai-foot { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--bg); }
.ai-input { min-height: 64px; max-height: 180px; resize: none; }
.ai-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-btns .btn { flex: 1 1 auto; }
.ai-btns .btn svg { width: 16px; height: 16px; flex: none; }

/* Tasks */
.addbar { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) 140px 170px auto; gap: 8px; padding: 16px; background: var(--tile); border-radius: var(--r-tile); margin-bottom: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.tgroup { background: var(--tile); border-radius: var(--r-tile); padding: 12px; margin-bottom: 12px; }
.tgroup > h2 { font-size: 16px; font-weight: 800; padding: 8px 8px 12px; display: flex; justify-content: space-between; gap: 12px; }
.tgroup > h2 span { color: var(--muted); font-size: 14px; }
.tlist { display: flex; flex-direction: column; gap: 6px; }
.trow { display: grid; grid-template-columns: 44px minmax(0, 1fr) 160px 130px 44px; align-items: center; gap: 6px; background: var(--card); border-radius: var(--r-card); padding: 4px 6px; }
.trow.compact { grid-template-columns: 44px minmax(0, 1fr) 44px; }
.tick { display: grid; place-items: center; width: 44px; height: 44px; }
.tick input { appearance: none; width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--muted); display: grid; place-items: center; margin: 0; cursor: pointer; background: var(--card); }
.tick input:checked { background: var(--emerald); border-color: var(--emerald); }
.tick input:checked::after { content: ""; width: 11px; height: 6px; border-left: 3px solid #06371f; border-bottom: 3px solid #06371f; transform: rotate(-45deg) translate(1px, -1px); }
.ttext { border: 0; background: transparent; min-height: 44px; padding: 11px 6px; width: 100%; font-weight: 600; border-radius: 8px; line-height: 22px; overflow-wrap: anywhere; }
textarea.ttext { display: block; resize: none; field-sizing: content; font: inherit; font-weight: 600; line-height: 22px; color: inherit; overflow: hidden; }
span.ttext { display: block; }
.ttext:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue); }
.trow.done .ttext { text-decoration: line-through; color: var(--muted); }
.trow .input, .trow .select { min-height: 44px; padding-top: 6px; padding-bottom: 6px; border-color: transparent; background-color: var(--tile); font-size: 14px; }
.trow.overdue .input[type="date"] { background-color: var(--crit-bg); color: var(--crit); font-weight: 700; }

/* Goals */
.ghead-row, .goal { display: grid; grid-template-columns: 48px minmax(0, 1.25fr) minmax(0, 1.5fr) minmax(0, 1.25fr) 210px; gap: 16px; align-items: start; }
.ghead-row { padding: 0 20px 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.goal { background: var(--tile); border-radius: var(--r-tile); padding: 20px; margin-bottom: 8px; }
.goal .gn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--card); font-weight: 800; }
.goal.done .gn { background: var(--emerald); color: #06371f; }
.goal h2 { font-size: 17px; font-weight: 800; line-height: 1.25; }
.goal p { font-size: 15px; overflow-wrap: anywhere; }
.glink { color: var(--blue); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.glink svg { width: 16px; height: 16px; }
.goal .lbl { display: none; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }

/* Decisions */
.dgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.dcard { background: var(--tile); border-radius: var(--r-tile); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dcard header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dcard h2 { font-size: 18px; font-weight: 800; line-height: 1.25; }
.dcard .ctx { font-size: 14px; color: var(--muted); }
.dcard .textarea { flex: 1; }
.dcard .saved { font-size: 13px; color: var(--muted); min-height: 18px; }

/* Clean-up */
.csum { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; align-items: stretch; }
.cgroup { background: var(--tile); border-radius: var(--r-tile); padding: 12px; margin-bottom: 12px; }
.cgroup > h2 { font-size: 16px; font-weight: 800; padding: 8px 8px 12px; display: flex; justify-content: space-between; gap: 12px; }
.cgroup > h2 span { color: var(--muted); font-size: 14px; }
.cline { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 90px auto; gap: 16px; align-items: center; background: var(--card); border-radius: var(--r-card); padding: 14px 16px; margin-bottom: 6px; }
.cline strong { font-weight: 800; overflow-wrap: anywhere; }
.cline .what { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.cline .sug { font-size: 14px; overflow-wrap: anywhere; }
.cline .sug b { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.cline .cost { font-weight: 800; text-align: right; }
.cline .cost small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.cseg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.cseg button { min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; font-weight: 700; font-size: 14px; }
.cseg button[aria-pressed="true"] { border-color: transparent; background: var(--ink); color: var(--bg); }
.cseg button[aria-pressed="true"].d-keep { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1.5px var(--ok); }
.cseg button[aria-pressed="true"].d-pause, .cseg button[aria-pressed="true"].d-cancel { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.cseg button[aria-pressed="true"].d-archive { background: color-mix(in srgb, var(--blue) 14%, var(--card)); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.cseg button[aria-pressed="true"].d-delete { background: var(--crit-bg); color: var(--crit); box-shadow: inset 0 0 0 1.5px var(--crit); }

.toast { display: flex; align-items: center; gap: 4px; position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 700; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

.toast-btn { flex: none; min-height: 44px; margin: -12px -8px -12px 4px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.gbody.in-tile { padding: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Tablet: the rail becomes a top bar, tiles pair up, the project panel slides over. */
@media (max-width: 1099px) {
  .app, .app.has-panel { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; gap: 16px; padding: 10px 24px; border-right: 0; border-bottom: 1px solid var(--line); background: var(--bg); }
  .rail-note { display: none; }
  .rail-me { order: 9; padding: 0; }
  .rm-who { display: none; }
  .rm-out { justify-content: center; width: 44px; }
  .rm-out svg { width: 20px; height: 20px; }
  .rm-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .nav { flex-direction: row; gap: 2px; margin-left: auto; }
  .ask { min-height: 44px; width: 44px; padding: 0; }
  .ask .ask-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .nav a { min-height: 44px; padding: 0 12px; gap: 8px; font-size: 14px; }
  .nav a .n-count { display: none; }
  .main { padding: 28px 24px 56px; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento > .tile { grid-column: span 1; }
  .bento > .tile.t-wide { grid-column: span 2; }
  .panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); height: auto; z-index: 50; box-shadow: var(--shadow); border-left: 0; overscroll-behavior: contain; }
  html:has(.has-panel) { overflow: hidden; }
  .has-panel .gbody { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gbody.in-tile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .toolbar .search { grid-column: 1 / -1; }
  .toolbar .seg { grid-column: 1 / -1; justify-self: start; }
  .addbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .addbar .a-text { grid-column: 1 / -1; }
  .ghead-row { display: none; }
  .goal { grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr); }
  .goal .g-title { grid-column: 2 / -1; }
  .goal .g-stands { grid-column: 2; }
  .goal .g-waits { grid-column: 3; }
  .goal .g-status { grid-column: 2 / -1; max-width: 280px; }
  .goal .lbl { display: block; }
  .cline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 80px; }
  .cline .cseg { grid-column: 1 / -1; }
  .csum > .tile { grid-column: span 6; }
}
@media (min-width: 1100px) {
  .scrim { display: none !important; }
  /* The page shows beside the panel here, with the notice on it. */
  .panel .notice-act { display: none; }
}

/* Phone: one column, sections on a bottom bar, the project panel takes the screen. */
@media (max-width: 767px) {
  .rail { padding: 8px 16px; justify-content: space-between; gap: 8px; }
  .brand { min-width: 0; flex: none; gap: 6px; padding: 0; }
  .logo { height: 17px; }
  .brand-tag { font-size: 11px; padding: 2px 6px; }
  .rail .ask { margin-left: auto; }
  .ask { width: auto; padding: 0 12px; gap: 6px; font-size: 14px; }
  .ask .ask-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .ai-head { padding-left: 16px; }
  .ai-log { padding: 16px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--line); justify-content: space-between; gap: 0; }
  .nav a { flex: 1 1 0; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 2px; font-size: 11px; font-weight: 700; border-radius: 14px; min-width: 0; }
  .nav a .n-label { flex: none; }
  .main { padding: 20px 16px 104px; }
  .vhead h1 { font-size: 30px; }
  .bento, .dgrid { grid-template-columns: minmax(0, 1fr); }
  .bento > .tile, .bento > .tile.t-wide { grid-column: span 1; }
  .tile { padding: 20px 16px; border-radius: 20px; }
  .big { font-size: 44px; }
  .gbody, .has-panel .gbody { grid-template-columns: minmax(0, 1fr); }
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .seg { display: none; }
  .board { display: none; }
  .panel { left: 0; width: auto; padding: 16px 16px 96px; }
  .fgrid { grid-template-columns: minmax(0, 1fr); }
  .addbar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; }
  .addbar .a-proj, .addbar .btn { grid-column: 1 / -1; }
  .trow { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .trow .t-due, .trow .t-who { grid-row: 2; }
  .trow .t-due { grid-column: 1 / 3; margin-left: 44px; }
  .trow .t-who { grid-column: 1 / 3; grid-row: 3; margin-left: 44px; }
  .goal { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 16px; }
  .goal .g-title, .goal .g-stands, .goal .g-waits, .goal .g-status { grid-column: 2; max-width: none; }
  .cline { grid-template-columns: minmax(0, 1fr) 80px; }
  .cline .sug { grid-column: 1 / -1; }
  .cline > div:first-child { grid-column: 1; grid-row: 1; }
  .cline .cost { grid-column: 2; grid-row: 1; align-self: start; }
  .cline .cseg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .cseg button { padding: 0; font-size: 13px; }
  .csum > .tile { grid-column: span 12; }
  .pipe button { grid-template-columns: 136px minmax(0, 1fr) 28px; }
  .toast { bottom: 96px; }
  .gbody.in-tile { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (min-width: 768px) and (max-width: 1099px) {
  .nav a svg { display: none; }
  .nav a { padding: 0 8px; }
}

/* Signed out: the Techbase mark and one Google button, centred, with no rail. */
.signed-out .app { display: block; }
.signed-out .rail { display: none; }
.signin { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px 20px; text-align: center; }
.signin h1 { margin: 0; font-size: 1.75rem; font-weight: 800; }
.signin .notice { margin: 0; max-width: 360px; }
