/* Personal Planner: calm, minimal, system type. Light + dark are both first-class. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --ink: #15171c;
  --ink-2: #4d5461;
  --ink-3: #616876; /* UAT-07: 5.1:1 on --bg, 4.9:1 on --surface-2 (was 4.49:1) */
  --line: #dfe2e8;
  --accent: #1d5ab8;
  --accent-ink: #ffffff;
  --accent-soft: #e6eefb;
  --danger: #b3261e;
  --danger-soft: #fcebea;
  --warn: #8a5300;
  --warn-soft: #fbf0dc;
  --ok: #1e6b3a;
  --ok-soft: #e4f3e8;
  --appt: #1d5ab8;
  --task: #5b6270;
  --due: #a33a1b;
  --focus: #1d5ab8;
  --shadow: 0 1px 2px rgba(16, 20, 28, .06), 0 8px 24px rgba(16, 20, 28, .08);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 44px;
  --nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216; --surface: #181b21; --surface-2: #20242c; --ink: #eceef2; --ink-2: #b2b8c4; --ink-3: #9198a6; --line: #2b3039;
    --accent: #8ab4ff; --accent-ink: #0b1220; --accent-soft: #1b2a45; --danger: #ff8f86; --danger-soft: #3a1d1c; --warn: #f2bd63; --warn-soft: #362a14;
    --ok: #7fd49b; --ok-soft: #173023; --appt: #8ab4ff; --task: #aab1be; --due: #ffa68a; --focus: #8ab4ff;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101216; --surface: #181b21; --surface-2: #20242c; --ink: #eceef2; --ink-2: #b2b8c4; --ink-3: #9198a6; --line: #2b3039;
  --accent: #8ab4ff; --accent-ink: #0b1220; --accent-soft: #1b2a45; --danger: #ff8f86; --danger-soft: #3a1d1c; --warn: #f2bd63; --warn-soft: #362a14;
  --ok: #7fd49b; --ok-soft: #173023; --appt: #8ab4ff; --task: #aab1be; --due: #ffa68a; --focus: #8ab4ff;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(88px + var(--safe-top)); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
.tnum, time, .time, .date { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); }
.skip:focus { top: calc(12px + var(--safe-top)); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-2); }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
main { padding: 0 max(16px, var(--safe-left)) calc(var(--nav-h) + var(--safe-bottom) + 24px) max(16px, var(--safe-right)); outline: none; }
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  padding: calc(14px + var(--safe-top)) 0 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.top-inner { max-width: 760px; margin: 0 auto; }
.top h1 { font-size: 28px; font-weight: 700; line-height: 1.15; }
.top .sub { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.net-status { max-width: 760px; margin: 8px auto 0; font-size: 14px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
.view { max-width: 760px; margin: 0 auto; }

/* bottom tab bar (phones) / side rail (tablets, desktop) */
.nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line); padding: 4px max(8px, var(--safe-left)) calc(4px + var(--safe-bottom)) max(8px, var(--safe-right)); }
.nav-brand { display: none; }
.nav-link { position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; min-width: var(--tap);
  color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 600; border-radius: 10px; }
.nav-link[aria-current="page"] { color: var(--accent); }
.nav-ico { width: 24px; height: 24px; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.ico-today { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='3'/%3E%3Cpath d='M8 3v4M16 3v4M3.5 10h17'/%3E%3Ccircle cx='12' cy='15' r='1.6' fill='black'/%3E%3C/svg%3E"); }
.ico-upcoming { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h10'/%3E%3C/svg%3E"); }
.ico-inbox { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 13l2.5-8h11L20 13v6H4z'/%3E%3Cpath d='M4 13h5l1 2h4l1-2h5'/%3E%3C/svg%3E"); }
.ico-review { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M20 12a8 8 0 1 1-2.4-5.7'/%3E%3Cpath d='M20 4v5h-5'/%3E%3C/svg%3E"); }
.ico-more { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='5' cy='12' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='19' cy='12' r='2'/%3E%3C/svg%3E"); }
.badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ink-3); color: var(--surface); font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.badge-alert { background: var(--danger); color: #fff; }

@media (min-width: 900px) {
  .nav { top: 0; right: auto; bottom: 0; width: 220px; flex-direction: column; justify-content: flex-start; gap: 4px; border-top: 0; border-right: 1px solid var(--line);
    padding: calc(20px + var(--safe-top)) 12px 20px max(12px, var(--safe-left)); background: var(--surface); }
  .nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 4px 10px 18px; color: var(--ink); }
  .nav-link { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; min-height: var(--tap); font-size: 15px; color: var(--ink-2); }
  .nav-link:hover { background: var(--surface-2); }
  .nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  .nav-ico { width: 20px; height: 20px; }
  .badge { position: static; margin-left: auto; }
  main { margin-left: 220px; padding-bottom: 48px; padding-left: 32px; padding-right: 32px; }
  .top { margin: 0 -32px; padding-left: 32px; padding-right: 32px; }
}
.brand-mark { display: inline-block; width: 22px; height: 22px; border-radius: 7px; background: var(--accent); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 5px; border: 2.5px solid var(--surface); border-radius: 50%; }
.brand-mark.big { width: 52px; height: 52px; border-radius: 14px; }
.brand-mark.big::after { inset: 12px; border-width: 4px; }

@media (min-width: 1280px) {
  .view-today, .top-today { max-width: 1160px; }
  .view-today { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); column-gap: 28px; align-items: start; grid-auto-flow: row dense; }
  .view-today > * { grid-column: 1; }
  .view-today > .capture, .view-today > .alert { grid-column: 1 / -1; }
  .view-today > .sec-side { grid-column: 2; }
  .view-today > .sec-main { grid-row: span 2; }
}

/* ---------- capture ---------- */
.capture { margin: 6px 0 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); }
.capture-row { display: flex; gap: 6px; align-items: center; }
.capture input[type="text"] { flex: 1; min-width: 0; min-height: var(--tap); border: 0; background: transparent; padding: 0 10px; font-size: 17px; outline: none; box-shadow: none; }
.capture input[type="text"]:focus { outline: none; }
.capture input::placeholder { color: var(--ink-3); }
.capture:focus-within { border-color: var(--accent); }
.preview { padding: 8px 10px 6px; border-top: 1px solid var(--line); margin-top: 6px; }
.preview:empty { display: none; }
.preview.stale { opacity: .5; } /* the interpretation no longer matches the text: being re-checked (SOL-M1-11) */
.preview .lines { margin: 0; padding: 0; list-style: none; }
.preview .lines li { font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.preview .lines li:first-child { color: var(--ink); font-weight: 600; }
.preview .warn { font-size: 14px; color: var(--warn); margin: 6px 0 0; }
.preview .question { font-weight: 600; margin: 0 0 8px; }
.preview .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* SOL-M1-R4-01: the confirmation card shown before any notice period is saved. */
.confirm-card h3 { font-size: 16px; margin: 0 0 8px; }
.confirm-card .verbatim { margin: 0 0 8px; padding: 8px 12px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 15px; color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.field-error, #edit-when-error, .search-form ~ #search-results .warn, .twoway .warn { font-size: 14px; color: var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0 0 12px; font-weight: 600; } /* UAT-01 / CD18: a sentence, styled as a warning */
.confirm-card .warn { font-size: 14px; color: var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0 0 12px; font-weight: 600; }
.capture .confirm-card input[type="text"] { flex: none; width: 100%; min-height: var(--tap); padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.capture .confirm-card input[type="text"]:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.confirm-card .field { margin-bottom: 12px; }
.confirm-card .field-row > .field { min-width: 0; }
.notice-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px; }
.confirm-result { margin: 4px 0 0; font-size: 16px; }
.confirm-result output { font-weight: 700; font-variant-numeric: tabular-nums; }
.confirm-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: 15px; }
.confirm-list dt { color: var(--ink-2); font-weight: 600; }
.confirm-list dd { margin: 0; overflow-wrap: anywhere; }
/* SOL-M2-03: the confirmation page Hermes's link opens. */
.confirm-page { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.confirm-page h2 { font-size: 20px; margin: 0 0 6px; }
.confirm-page .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.confirm-page .actions .btn { min-height: var(--tap); }
.confirm-state { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.confirm-state-confirmed { color: var(--ok); }
.confirm-state-declined, .confirm-state-expired, .confirm-state-changed, .confirm-state-superseded { color: var(--ink-2); }
/* SOL-M1-R5-01: what an undo or edit changes; R5-03: a restored, unsaved draft. */
.confirm-changes { margin: 0 0 10px; }
.confirm-changes li { font-size: 15px; overflow-wrap: anywhere; }
#confirm-sheet .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.draft-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 12px; padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--ink); font-size: 14px; font-weight: 600; }

/* ---------- buttons, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-danger { color: var(--danger); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent); }
.btn-quiet:hover { background: var(--accent-soft); }
.btn-small { min-height: var(--tap); padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn { width: var(--tap); height: var(--tap); display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--surface-2); }
label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="url"], input[type="date"], input[type="time"], input[type="number"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px; }
input[type="date"], input[type="time"] { font-variant-numeric: tabular-nums; }
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
.hint { font-size: 13px; color: var(--ink-3); margin: 6px 0 0; }
.field-error { color: var(--danger); font-size: 14px; margin: 6px 0 0; }
.field { margin: 0 0 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 500; color: var(--ink); font-size: 15px; margin: 0; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }

/* ---------- sections and rows ---------- */
.section { margin: 0 0 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 8px; }
.section-head h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.section-head .count { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: stretch; gap: 4px; border-top: 1px solid var(--line); min-height: 56px; }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; min-height: var(--tap); display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; } /* UAT-15: at least 44 px */
.row-main:hover { background: var(--surface-2); }
.row-when { flex: none; width: 56px; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink-2); line-height: 1.25; }
.row-when strong { display: block; color: var(--ink); font-weight: 600; font-size: 15px; }
.row-when span { display: block; } /* UAT-15: spans (valid inside a button), laid out as lines */
.row-when .row-endday { font-size: 12px; color: var(--ink-2); } /* UAT-01: the end day of a span over midnight */
.view-upcoming .row-when { width: 64px; }
#edit-when-hint { margin: -4px 0 16px; } /* UAT-01: the hint belongs to the times above it */
#edit-allday-hint { margin: -4px 0 16px; } /* UAT-31: the same 16px rhythm above Location as the hint it replaces */
.search-form { margin-bottom: 8px; }
.search-form input[type="search"] { flex: 1; min-width: 0; }
.search-filters { margin-top: 6px; }
.twoway { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.row-text { min-width: 0; flex: 1; }
.row-title { display: block; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.row-sub { display: block; font-size: 14px; color: var(--ink-2); margin-top: 1px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.row-sub.warn { color: var(--warn); font-weight: 600; } /* CS18: "may still be in Calendar" (text, not colour alone) */
.row.done .row-title { text-decoration: line-through; color: var(--ink-3); }
.row-check { flex: none; width: var(--tap); display: grid; place-items: center; border: 0; background: none; cursor: pointer; padding: 0 0 0 6px; }
.row-check span { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-items: center; }
.row-check[aria-pressed="true"] span { background: var(--ok); border-color: var(--ok); }
.row-check[aria-pressed="true"] span::after { content: ""; width: 10px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: translateY(-1px) rotate(-45deg); }
.row-check.square span { border-radius: 6px; }
.kind-bar { flex: none; width: 4px; align-self: stretch; border-radius: 2px; background: var(--task); }
.kind-appointment .kind-bar { background: var(--appt); }
.kind-deadline .kind-bar { background: var(--due); }
.row-actions { display: flex; gap: 6px; align-items: center; padding-right: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* Phones: row actions drop onto their own line under the title instead of squeezing it. */
.row:has(> .row-actions) { flex-wrap: wrap; }
.row:has(> .row-actions) > .row-main { flex: 1 1 0; }
.row > .row-actions { flex: 1 0 100%; justify-content: flex-start; padding: 0 12px 12px 28px; }
@media (min-width: 700px) {
  .row:has(> .row-actions) { flex-wrap: nowrap; }
  .row > .row-actions { flex: none; padding: 0 10px 0 0; justify-content: flex-end; }
}

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); letter-spacing: .01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag-missed { background: var(--danger-soft); color: var(--danger); }
.tag-today { background: var(--warn-soft); color: var(--warn); }
.tag-approaching { background: var(--accent-soft); color: var(--accent); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.clash { display: block; font-size: 13px; color: var(--warn); margin-top: 3px; font-weight: 600; }
.clash::before { content: "Clash: "; }

.deadlines .list { border-color: color-mix(in srgb, var(--due) 35%, var(--line)); }
.empty { padding: 20px 16px; text-align: center; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); margin: 0 0 16px; font-size: 15px; }
.alert a { color: inherit; font-weight: 700; }
.note { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); font-size: 14px; margin: 8px 0; }
.links-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.links-bar a { text-decoration: none; }

.day-head { position: sticky; top: calc(76px + var(--safe-top)); z-index: 2; background: var(--bg); padding: 10px 2px 6px; font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.day-head.is-today { color: var(--accent); }

.more-list .row-main { min-height: 56px; }

/* ---------- sheet ---------- */
.sheet { padding: 0; border: 0; color: var(--ink); background: var(--surface); width: 100%; max-width: 100%; max-height: 92vh; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; box-shadow: var(--shadow); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .24s cubic-bezier(.2,.8,.2,1); }
.sheet::backdrop { background: rgba(10, 12, 16, .45); }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet-body { overflow-y: auto; padding: 8px max(18px, var(--safe-left)) calc(20px + var(--safe-bottom)) max(18px, var(--safe-right)); overscroll-behavior: contain; }
.sheet-head { display: flex; align-items: flex-start; gap: 8px; position: sticky; top: -8px; background: var(--surface); padding: 8px 0 10px; z-index: 1; }
.sheet-head h2 { font-size: 20px; flex: 1; padding-top: 8px; overflow-wrap: anywhere; }
.sheet-section { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.sheet-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 10px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0 4px; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; margin: 0 0 8px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.rem-list { list-style: none; margin: 0 0 8px; padding: 0; }
.rem-list li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.rem-list li:first-child { border-top: 0; }
.rem-when { font-weight: 600; color: var(--ink); }
.rem-adj { display: block; color: var(--warn); font-size: 13px; }
.offsets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre-wrap; background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-wrap: anywhere; }
@media (min-width: 700px) {
  .sheet { width: min(560px, 100% - 48px); margin: auto; border-radius: 20px; max-height: 88vh; }
  .sheet[open] { animation: sheet-in .2s ease-out; }
  .sheet-grip { display: none; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes sheet-in { from { transform: scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- toast ---------- */
.toast-region { position: fixed; z-index: 50; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px); display: grid; justify-items: center; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 560px; width: 100%; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 10px 10px 16px; box-shadow: var(--shadow); font-size: 15px; animation: toast-in .2s ease-out; }
.toast p { margin: 0; flex: 1; }
.toast .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); min-height: var(--tap); }
.toast.error { background: var(--danger); color: #fff; }
.toast.error .btn { color: #fff; }
@media (min-width: 900px) { .toast-region { left: 220px; bottom: 24px; } }
/* UAT-20: inside the open sheet, the message bar sits below the scrolling body (always visible and tappable) */
.sheet .sheet-toast { position: static; flex: none; display: block; padding: 0 max(12px, var(--safe-left)) calc(10px + var(--safe-bottom)) max(12px, var(--safe-right)); pointer-events: auto; }
.sheet .sheet-toast:empty { display: none; }
.sheet .sheet-toast .toast { max-width: none; box-shadow: none; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- skeleton ---------- */
.skeleton { display: grid; gap: 10px; padding-top: 8px; }
.sk { height: 56px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
.sk-wide { height: 52px; } .sk-short { width: 60%; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- login ---------- */
.login-body { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; padding: 0; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { margin: 14px 0 4px; font-size: 26px; }
.login-card form { text-align: left; margin-top: 20px; display: grid; gap: 4px; }
.login-card .btn { margin-top: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) { .kind-bar, .row-check span { forced-color-adjust: none; } }

/* M2: connections (Settings) and the calendar conflict card. State is in the label text, not colour alone. */
.conn { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; }
.conn-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.conn-head h3 { font-size: 16px; margin: 0; }
.conn-head .tag { white-space: normal; text-align: left; }
.conn .links-bar { margin-top: 10px; }
.conn-result { font-size: 14px; margin: 8px 0 0; min-height: 1em; overflow-wrap: anywhere; }
.conn-result.ok { color: var(--ok); }
.conn-result.bad { color: var(--danger); }
.conn-cals { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.conn-cals li { padding: 4px 0; overflow-wrap: anywhere; }
.conn-cal-name { color: var(--ink); font-weight: 600; }
.conflict-card { margin: 0 0 12px; }
.cf-cols { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0 0 10px; }
@media (min-width: 560px) { .cf-cols { grid-template-columns: 1fr 1fr; } }
.cf-col { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; }
.cf-col h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 6px; }
.cf-deleted { margin: 0; font-weight: 600; color: var(--danger); }
.cf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* CS19 / R7-02: what Calendar last had, before "Put back with these / without them" */
.cf-offer { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 12px; background: var(--surface); }
.cf-offer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 4px; }
.cf-offer-seen { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); }
.cf-offer-group + .cf-offer-group { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.cf-offer-scope { margin: 0 0 2px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.cf-offer-items { margin: 0; padding: 0 0 0 18px; font-size: 15px; line-height: 1.45; }
.cf-offer-items li { overflow-wrap: anywhere; }
.cf-actions-pair .btn { flex: 1 1 160px; }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.linklike { background: none; border: 0; padding: 0; min-height: 24px; font: inherit; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.tag-wrap { white-space: normal; text-align: left; line-height: 1.35; padding: 3px 8px; border-radius: 10px; max-width: 100%; overflow-wrap: anywhere; }

/* CS22: the honest capture card. Words the planner did not understand are marked (colour AND an underline, never colour
   alone); the typed text is shown as typed. */
.preview .verbatim { margin: 0 0 8px; padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--surface-2, var(--bg)); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 15px; overflow-wrap: anywhere; }
.verbatim mark { background: var(--warn-soft); color: var(--warn); font-weight: 600; text-decoration: underline wavy; text-decoration-thickness: 1px; text-underline-offset: 3px; border-radius: 3px; padding: 0 2px; }
.preview #capture-unread { font-weight: 600; }
/* SOL-M2-D-03: the live preview in the edit sheet and the linked-task form (what Save will store). */
.edit-preview { margin: 4px 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); }
.edit-preview[hidden] { display: none; }
.edit-preview:empty { display: none; }
.edit-preview .preview-head { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: none; }
.edit-preview .lines { margin: 0; padding: 0; list-style: none; }
.edit-preview .lines li { font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.edit-preview .lines li + li { margin-top: 2px; }
.edit-preview .warn { font-size: 14px; font-weight: 600; color: var(--warn); margin: 0 0 8px; } /* SOL-M2-F-01: a failed check reads as a warning (the words carry it; colour only supports) */
.hint.end-day { color: var(--warn); font-weight: 600; margin: -6px 0 8px; }
/* UAT-28: a continuation row: "continues" in the time column (small caps-free, fits 56px), then "ends 01:00" */
.row-when.row-cont strong.cont { font-size: 11px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; color: var(--appt); }
.row-when.row-cont .time { font-size: 13px; }
