/* Schetsboek — calm, dark-first web app.
   Layout: fixed sidebar + content column; cards only where they group something. */
:root {
  --bg: #0e0f12;
  --bg-side: #111317;
  --surface: #16181d;
  --surface-2: #1b1e24;
  --hover: #1f232a;
  --border: #262a31;
  --border-2: #333843;
  --text: #ececee;
  --text-2: #9a9ea7;
  --text-3: #6b707a;
  --accent: #8e97ff;
  --accent-strong: #a9b0ff;
  --accent-soft: rgba(142, 151, 255, .14);
  --on-accent: #0e0f12;
  --ok: #4fc48a;   --ok-soft: rgba(79, 196, 138, .14);
  --warn: #e6b450; --warn-soft: rgba(230, 180, 80, .14);
  --bad: #f07171;  --bad-soft: rgba(240, 113, 113, .14);
  --ev-lavender: rgba(142, 151, 255, .16); --ev-lavender-ink: #c3c8ff;
  --ev-sage: rgba(79, 196, 138, .15);      --ev-sage-ink: #9fe0bd;
  --ev-rose: rgba(240, 113, 113, .15);     --ev-rose-ink: #f6b1b1;
  --ev-sky: rgba(86, 170, 240, .16);       --ev-sky-ink: #a9d3f7;
  --ev-graphite: rgba(160, 166, 178, .14); --ev-graphite-ink: #d2d5db;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, .6);
  --radius: 12px;
  --radius-sm: 8px;
  --hour: 52px;
  --side: 236px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-side: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --hover: #f0f1f4;
  --border: #e4e6eb;
  --border-2: #d5d8df;
  --text: #15171c;
  --text-2: #5f6570;
  --text-3: #8b909a;
  --accent: #4b53d1;
  --accent-strong: #3c43b5;
  --accent-soft: #eceefe;
  --on-accent: #ffffff;
  --ok: #1f8a55;   --ok-soft: #e3f4ea;
  --warn: #a2690d; --warn-soft: #fbf0dc;
  --bad: #c43d3d;  --bad-soft: #fbe6e6;
  --ev-lavender: #eceefe; --ev-lavender-ink: #3c43b5;
  --ev-sage: #e3f4ea;     --ev-sage-ink: #1f6e46;
  --ev-rose: #fbe6e6;     --ev-rose-ink: #a33434;
  --ev-sky: #e3f0fb;      --ev-sky-ink: #24618f;
  --ev-graphite: #eceef1; --ev-graphite-ink: #3a3f48;
  --shadow: 0 12px 32px -14px rgba(20, 24, 34, .22);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.eyebrow { font-size: 12px; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn.small { height: 32px; padding: 0 10px; font-size: 13.5px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn svg, .icon-btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: 13px; color: var(--text-3); }
.error { font-size: 13.5px; color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: var(--radius-sm); }
.notice { font-size: 13.5px; color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: var(--radius-sm); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--hover); color: var(--text-2); white-space: nowrap; }
.chip.lav { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.pulse .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 7px; color: var(--text-2); font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14.5px; }
.card-pad { padding: 16px; }
.count-pill { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- theme switch ---------- */
.theme-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.theme-switch button { width: 30px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 999px; background: none; color: var(--text-3); cursor: pointer; }
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15.5px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); flex: none; }
.mark svg { width: 16px; height: 16px; }

/* ---------- landing ---------- */
.landing { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.landing-top, .landing-main, .landing-foot { width: 100%; max-width: 1080px; margin: 0 auto; }
.landing-top { display: flex; justify-content: space-between; align-items: center; padding-block: 20px; }
.landing-main { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 56px; align-items: center; padding-block: 32px 56px; }
.pitch h1 { font-size: clamp(34px, 4.6vw, 52px); line-height: 1.05; letter-spacing: -.03em; }
.pitch h1 span { color: var(--accent); }
.pitch > p { font-size: 16.5px; color: var(--text-2); margin-top: 16px; max-width: 46ch; }
.features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.features li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; }
.features .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--accent); }
.features .ico svg { width: 18px; height: 18px; }
.features b { display: block; font-weight: 600; }
.features span { color: var(--text-2); font-size: 14px; }
.auth-card { padding: 28px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 20px; }
.auth-tabs { margin: 18px 0 20px; }
.auth-form { display: grid; gap: 14px; }
.steps { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text-3); }
.steps b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border-2); font-size: 11px; font-weight: 600; margin-right: 6px; }
.steps .on { color: var(--text); }
.steps .on b { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.landing-foot { padding-block: 20px 28px; color: var(--text-3); font-size: 13px; border-top: 1px solid var(--border); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 22px; padding: 18px 12px; padding-top: max(18px, env(safe-area-inset-top, 0px)); padding-left: max(12px, env(safe-area-inset-left, 0px)); background: var(--bg-side); border-right: 1px solid var(--border); }
.sidebar .brand { padding: 4px 8px; }
.nav { display: grid; gap: 2px; }
.nav-label { font-size: 11.5px; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 600; background: var(--accent); color: var(--on-accent); }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.side-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; }
.user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.user .who { min-width: 0; flex: 1; }
.user .who b { display: block; font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .who span { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user form { margin: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.mobile-top { display: none; }
.page { width: 100%; max-width: 1160px; margin: 0 auto; padding: 28px 32px 56px; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; line-height: 1.2; }
.page-head p { color: var(--text-2); margin-top: 4px; }

/* ---------- inbox ---------- */
.inbox-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.inbox-col { display: grid; gap: 16px; min-width: 0; }
.quick-add { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px; padding: 8px; }
.quick-add .input { background: transparent; border-color: transparent; }
.quick-add .input:focus { background: var(--surface-2); }
.quick-add input[type="date"] { color: var(--text-2); }
.items { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 16px; border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; }
.item:hover { background: var(--surface-2); }
.item-body { min-width: 0; cursor: pointer; }
.item-title { font-weight: 500; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.item-notes { font-size: 13px; color: var(--text-2); margin-top: 5px; white-space: pre-line; overflow-wrap: anywhere; }
.item .time { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.item.done .item-title { color: var(--text-3); text-decoration: line-through; }
.item-actions { opacity: 0; transition: opacity .12s; }
.item:hover .item-actions, .item:focus-within .item-actions { opacity: 1; }
@media (hover: none) { .item-actions { opacity: 1; } }
.check { margin: 0; margin-top: 1px; width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--border-2); display: grid; place-items: center; }
.check svg { width: 22px; height: 22px; }
.check .ring { fill: none; stroke: currentColor; stroke-width: 1.6; }
.check .fill { fill: var(--accent); opacity: 0; transition: opacity .15s; }
.check .tick { fill: none; stroke: var(--on-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity .15s; }
.check:hover { color: var(--accent); }
.check[aria-checked="true"] .fill, .check[aria-checked="true"] .tick { opacity: 1; }
.check[aria-checked="true"] .ring { stroke: var(--accent); }
.empty-row { padding: 18px 16px; color: var(--text-3); font-size: 13.5px; }
.done-toggle { width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--border); color: var(--text-3); cursor: pointer; font-weight: 500; padding: 12px 16px; }
.done-toggle:hover { color: var(--text); }
.day-aside { display: grid; gap: 16px; position: sticky; top: 24px; }
.progress { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center; }
.ring-svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring-svg circle { fill: none; stroke-width: 6; }
.ring-svg .track { stroke: var(--hover); }
.ring-svg .bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.stat-big { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-list { display: grid; gap: 10px; }
.stat-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.stat-line span:first-child { color: var(--text-2); }
.stat-line span:last-child { font-variant-numeric: tabular-nums; font-weight: 500; }
.next-up { display: grid; gap: 2px; }
.next-up b { font-weight: 500; }

/* ---------- agenda ---------- */
.cal { display: grid; grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 56px); }
.cal-bar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 16px; }
.cal-bar h1 { font-size: 22px; flex: 1; min-width: 0; }
.cal-body { min-height: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.week-scroll-x { overflow-x: auto; height: 100%; }
.wk-scroll { height: 100%; overflow-y: auto; }
.wk-sticky { position: sticky; top: 0; z-index: 5; background: var(--surface); }
.wk-head, .wk-allday, .wk-grid { display: grid; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); }
.wk-head > div { padding: 10px 6px 8px; text-align: center; border-left: 1px solid var(--border); }
.wk-head > div:first-child { border-left: 0; }
.wk-head .dname { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 500; }
.dnum, .mnum { border: 0; background: none; color: inherit; padding: 0; cursor: pointer; font-weight: 600; font-variant-numeric: tabular-nums; }
.wk-head .dnum { font-size: 18px; width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; margin-top: 2px; }
.wk-head .dnum:hover { background: var(--hover); }
.wk-head .today .dnum { background: var(--accent); color: var(--on-accent); }
.wk-allday { border-bottom: 1px solid var(--border); min-height: 30px; }
.wk-allday > div { border-left: 1px solid var(--border); padding: 3px; display: grid; gap: 3px; align-content: start; cursor: pointer; }
.wk-allday .lbl { font-size: 11px; color: var(--text-3); text-align: right; padding: 7px 8px 0 0; border: 0; cursor: default; }
.hours { display: grid; grid-auto-rows: var(--hour); }
.hours div { font-family: var(--mono); font-size: 11px; color: var(--text-3); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.daycol { position: relative; border-left: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px var(--hour)); height: calc(var(--hour) * 24); cursor: pointer; }
.daycol.today { background-color: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.now-line { position: absolute; left: -4px; right: 0; height: 2px; background: var(--bad); z-index: 3; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -1px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.ev { position: absolute; z-index: 2; overflow: hidden; padding: 4px 8px; font-size: 12.5px; line-height: 1.3; cursor: pointer; border: 0; border-left: 3px solid currentColor; border-radius: 6px; text-align: left; }
.ev b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .t { font-family: var(--mono); font-size: 11px; opacity: .85; }
.ev.closed { opacity: .5; }
.ev.chip-ev { position: static; display: block; width: 100%; padding: 2px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-lavender { background: var(--ev-lavender); color: var(--ev-lavender-ink); }
.c-sage { background: var(--ev-sage); color: var(--ev-sage-ink); }
.c-rose { background: var(--ev-rose); color: var(--ev-rose-ink); }
.c-sky { background: var(--ev-sky); color: var(--ev-sky-ink); }
.c-graphite { background: var(--ev-graphite); color: var(--ev-graphite-ink); }
.month { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.month-head, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head div { padding: 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 500; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.month-head div:first-child, .mcell:nth-child(7n+1) { border-left: 0; }
.month-grid { grid-auto-rows: minmax(96px, 1fr); overflow-y: auto; }
.mcell { border-left: 1px solid var(--border); border-top: 1px solid var(--border); padding: 6px; display: grid; gap: 3px; align-content: start; cursor: pointer; min-width: 0; }
.mcell:nth-child(-n+7) { border-top: 0; }
.mcell:hover { background: var(--surface-2); }
.mcell.other { background: color-mix(in srgb, var(--bg) 55%, transparent); }
.mcell.other .mnum { color: var(--text-3); }
.mnum { font-size: 13px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.mcell.today .mnum { background: var(--accent); color: var(--on-accent); }
.more { font-size: 12px; color: var(--text-3); font-weight: 500; padding-left: 4px; }
.dots { display: none; gap: 3px; flex-wrap: wrap; padding-left: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- mail ---------- */
.stack { display: grid; gap: 16px; max-width: 860px; }
.acct { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--border); }
.acct:first-child { border-top: 0; }
.acct-main b { font-weight: 500; overflow-wrap: anywhere; }
.mail-log { list-style: none; margin: 0; padding: 0; }
.mail-log li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.mail-log li:first-child { border-top: 0; }
.mail-log .subj { font-weight: 500; overflow-wrap: anywhere; }
.mail-log .from { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.mail-log .why { font-size: 13.5px; color: var(--text-2); margin-top: 3px; }
.form-grid { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
details.how { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-2); }
details.how summary { cursor: pointer; font-weight: 500; }
details.how ol { margin: 10px 0 2px; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); }

/* ---------- tools & projects ---------- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.app-card { display: grid; gap: 10px; padding: 16px; cursor: pointer; text-align: left; color: inherit; transition: border-color .12s, background .12s; }
.app-card:hover { border-color: var(--border-2); background: var(--surface-2); }
.app-card-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; flex: none; }
.app-card h3 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card p { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.app-card .meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-3); }
.empty-state { padding: 44px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.empty-state .app-icon { width: 44px; height: 44px; margin-bottom: 6px; }
.empty-state h2 { font-size: 16px; }
.empty-state p { color: var(--text-2); max-width: 44ch; }
.empty-state .btn { margin-top: 10px; }

.detail { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
.detail-bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg); min-width: 0; flex-wrap: wrap; }
.detail-bar h1 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.detail-bar .grow { flex: 1; }
.detail-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; }
.detail-body.no-panel { grid-template-columns: minmax(0, 1fr); }
.stage { position: relative; min-height: 0; background: var(--bg); }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.stage .placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--hover); border-top-color: var(--accent); animation: spin 0.9s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.panel { border-left: 1px solid var(--border); background: var(--bg-side); display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.panel-tabs { display: flex; gap: 2px; padding: 10px; border-bottom: 1px solid var(--border); }
.panel-tabs button { flex: 1; height: 30px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font-weight: 500; cursor: pointer; }
.panel-tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.panel-body { overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.req { display: grid; gap: 4px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.req .q { font-size: 13.5px; white-space: pre-line; overflow-wrap: anywhere; }
.req .a { font-size: 13px; color: var(--text-2); }
.req .when { font-size: 12px; color: var(--text-3); }
.versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.versions li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.versions li b { font-weight: 500; font-size: 13.5px; display: block; overflow-wrap: anywhere; }
.versions li span { font-size: 12px; color: var(--text-3); }
.code-area { width: 100%; min-height: 50vh; font-family: var(--mono); font-size: 12px; line-height: 1.5; padding: 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--text); resize: vertical; white-space: pre; }
.about dt { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 10px; }
.about dd { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- dialog ---------- */
dialog.modal { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(5, 6, 8, .55); backdrop-filter: blur(2px); }
.dlg-form { display: grid; gap: 14px; padding: 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { font-size: 17px; }
.swatches { display: flex; gap: 10px; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px currentColor; border: 2px solid transparent; }
.swatches input:checked + span { border-color: var(--text); }
.swatches input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.dlg-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13.5px; cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------- development board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--bg-side); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; min-height: 160px; align-content: start; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 6px; }
.col-head h2 { font-size: 13.5px; }
.col-head .count-pill { background: var(--hover); padding: 1px 8px; border-radius: 999px; }
.col-hint { font-size: 12px; color: var(--text-3); padding: 0 6px 4px; }
.dcard { display: grid; gap: 8px; padding: 12px; text-align: left; cursor: pointer; color: inherit; transition: border-color .12s; }
.dcard:hover { border-color: var(--border-2); }
.dcard h3 { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.dcard .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--text-3); }
.dcard.attention { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.dcard.failed { border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); }
dialog.modal.wide { width: min(780px, calc(100vw - 32px)); }
.opts { display: grid; gap: 10px; }
.opt { display: grid; gap: 6px; padding: 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.opt-top { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.opt b { font-weight: 600; }
.opt p { color: var(--text-2); font-size: 13.5px; }
.opt details summary { cursor: pointer; font-size: 13px; color: var(--text-3); }
.opt details p { margin-top: 6px; white-space: pre-line; }
.tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tl li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
.tl .avatar { width: 28px; height: 28px; font-size: 11.5px; }
.tl .avatar.claude { background: var(--accent); color: var(--on-accent); }
.tl .avatar.system { background: var(--hover); color: var(--text-3); }
.tl .who-line { font-size: 12.5px; color: var(--text-3); }
.tl .who-line b { color: var(--text); font-weight: 500; margin-right: 6px; }
.tl .body { white-space: pre-line; overflow-wrap: anywhere; font-size: 14px; margin-top: 2px; }
.action-box { display: grid; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.test-banner { position: sticky; top: 0; z-index: 70; background: var(--warn); color: #1a1406; text-align: center; font-weight: 600; font-size: 13px; padding: 6px 12px; }

/* ---------- small screens ---------- */
.bottom-nav { display: none; }
@media (max-width: 1000px) {
  .inbox-grid { grid-template-columns: minmax(0, 1fr); }
  .day-aside { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); order: -1; }
  .detail-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .panel { border-left: 0; border-top: 1px solid var(--border); max-height: 50dvh; }
}
@media (max-width: 860px) {
  .landing-main { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 12px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-top { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 10px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); padding-top: max(10px, env(safe-area-inset-top, 0px)); background: var(--bg); border-bottom: 1px solid var(--border); }
  .bottom-nav { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg-side); border-top: 1px solid var(--border); padding: 6px max(6px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-right, 0px)); }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 8px; color: var(--text-3); font-size: 11px; font-weight: 500; text-decoration: none; position: relative; }
  .bottom-nav a svg { width: 20px; height: 20px; }
  .bottom-nav a[aria-current="page"] { color: var(--accent); }
  .bottom-nav .count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; font-size: 10px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
  .main { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .page { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
  .cal { height: calc(100dvh - 140px - env(safe-area-inset-bottom, 0px)); }
  .detail { height: calc(100dvh - 120px - env(safe-area-inset-bottom, 0px)); }
  .detail-bar { padding: 10px 16px; }
}
@media (max-width: 560px) {
  .quick-add { grid-template-columns: minmax(0, 1fr) auto; }
  .quick-add input[type="date"] { grid-column: 1 / -1; grid-row: 2; }
  .two { grid-template-columns: 1fr; }
  .mail-log li, .acct { grid-template-columns: 1fr; }
  .month-grid { grid-auto-rows: minmax(64px, 1fr); }
  .mcell .ev, .mcell .more { display: none; }
  .mcell .dots { display: flex; }
  .page-head h1 { font-size: 21px; }
  .cal-bar h1 { flex-basis: 100%; font-size: 19px; }
  .auth-card { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
