/*
  Metona — visual system.

  Thesis: an ephemeris, not a dashboard. Metona is a night-sky almanac for
  your time. The ground is obsidian (silver paper in light mode), structure is
  hairline ruling like a star chart, and colour is reserved for meaning:
  electric blue for Peak hours and "now", violet for Steady, silver for Low
  and for the moon. Events are flat slabs hung from a coloured top edge, the
  protected minutes around them are hatched runways, and how open a day is
  shows as a moon phase. Each kind of information has its own form: the week
  is a time grid, the next two weeks are a trajectory, booking types are a
  ledger of links, hours are a paint surface, bookings are a register,
  linked calendars are a patch bay. Events borrowed from other calendars are
  drawn as outlines, light reflected from elsewhere rather than Metona's own.
  Cortex tasks are survey marks: a square and, at a due time, a ruled line.

  Rules for this file (docs/design/ELVN-VISUAL-AUTHORSHIP.md and
  test/design.test.js): no left-edge accent rails, no pill shapes, no
  gradients, no backdrop blur, no glow, no shared card shell. A banned
  technique needs a "design-exception: <reason>" comment inside its rule.
*/

/* ELVN's existing Space Grotesk latin subset, licensed under SIL OFL 1.1. */
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --night: #06070c;          /* obsidian ground */
  --surface: #0e1019;        /* dialogs and menus: things really on top */
  --field: #0a0c14;
  --wash: #141826;           /* hover and selected */
  --ink: #e8eaf2;
  --ink-2: #b9bfd0;
  --muted: #858ca3;
  --rule: #1c2131;
  --rule-strong: #3a4158;
  --silver: #c7ccd9;
  --silver-dim: #5d647a;
  --blue: #4d8dff;           /* electric blue: Peak, now, links */
  --violet: #9b7bff;         /* Steady */
  --indigo: #6c70e8;
  --warn: #f0b45a;           /* clashes and things to look at */
  --critical: #ff7a70;       /* destructive and genuinely critical only */
  --action: #4d8dff;
  --action-ink: #06070c;
  --zone-peak: #4d8dff;
  --zone-steady: #9b7bff;
  --zone-low: #c7ccd9;
  --sky: #000000;            /* the logo's own black, both modes */

  --font-ui: "Space Grotesk", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-figure: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --gutter-w: 56px;
  --dock-h: 64px;
  --move: 160ms;

  color-scheme: dark;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--night);
}
@media (prefers-color-scheme: light) {
  :root {
    --night: #f1f2f6;
    --surface: #ffffff;
    --field: #ffffff;
    --wash: #e6e8ef;
    --ink: #0b0d16;
    --ink-2: #363c52;
    --muted: #5c6379;
    --rule: #d5d8e1;
    --rule-strong: #9aa1b5;
    --silver: #5c6379;
    --silver-dim: #b3b8c7;
    --blue: #1556d6;
    --violet: #5b3cc4;
    --indigo: #2b2d8c;
    --warn: #8a4b00;
    --critical: #b42318;
    --action: #2b2d8c;
    --action-ink: #ffffff;
    --zone-peak: #1556d6;
    --zone-steady: #5b3cc4;
    --zone-low: #7a8196;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--night); color: var(--ink); font: 15px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--blue); }
h1, h2, h3 { font-weight: 500; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.offscreen { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 32px; color: var(--muted); }

/* ------------------------------------------------------------ controls */

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; background: var(--field); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 3px;
}
textarea { resize: vertical; min-height: 72px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); width: 18px; height: 18px; margin: 0; }
label > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; letter-spacing: .02em; }
label small, legend small { color: var(--muted); font-weight: 400; letter-spacing: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 12px; color: var(--muted); padding: 0; margin-bottom: 6px; letter-spacing: .02em; }

.primary {
  min-height: 44px; padding: 0 20px; border: 1px solid var(--action); background: var(--action); color: var(--action-ink);
  font-weight: 600; letter-spacing: .01em;
}
.primary:hover { background: color-mix(in srgb, var(--action) 86%, var(--ink)); }
.primary:disabled { opacity: .6; cursor: progress; }
.quiet {
  min-height: 44px; padding: 0 12px; background: transparent; border: 1px solid transparent; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 14px;
}
.quiet:hover { background: var(--wash); color: var(--ink); }
.quiet.small { min-height: 36px; padding: 0 10px; font-size: 13px; border-color: var(--rule); }
.quiet.tiny { min-height: 30px; padding: 0 8px; font-size: 12px; }
.danger { color: var(--critical); }
.linkish { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; border: 0; justify-content: flex-start; padding: 0; }
.grow { flex: 1; }
.form-note { min-height: 1.2em; margin: 0; color: var(--warn); font-size: 13px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check > span { display: inline; margin: 0; font-size: 14px; color: var(--ink); }
.check.small { min-height: 36px; }
.check.small > span { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------- threshold */

.threshold { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100dvh; }
.threshold-sky { background: var(--sky); display: grid; place-items: center; position: relative; overflow: hidden; }
.threshold-sky::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #1c2131; }
.threshold-mark { width: 168px; height: 168px; position: relative; z-index: 1; }
.threshold-form { padding: 56px clamp(24px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; max-width: 520px; }
.wordmark { margin: 0 0 20px; font-size: 13px; font-weight: 600; letter-spacing: .42em; color: var(--silver); }
.threshold h1 { font-size: 34px; line-height: 1.1; margin: 0 0 10px; font-weight: 400; letter-spacing: -.01em; }
.lede { margin: 0 0 28px; color: var(--ink-2); max-width: 40ch; }
#authForm { display: flex; flex-direction: column; gap: 14px; }
#authForm .quiet { align-self: flex-start; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
#authHandleHint { font-family: var(--font-figure); }

/* ------------------------------------------------------------- shell */

.shell {
  display: grid; height: 100dvh;
  grid-template-columns: 252px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "horizon horizon" "sidebar stage";
}
.horizon { grid-area: horizon; display: flex; align-items: center; gap: 20px; padding: 10px 20px; border-bottom: 1px solid var(--rule); position: relative; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--silver); text-decoration: none; font-size: 12px; font-weight: 600; letter-spacing: .38em; }
.brand img { width: 30px; height: 30px; }
.command { flex: 1; max-width: 720px; position: relative; display: flex; align-items: center; background: var(--field); border: 1px solid var(--rule-strong); }
.command:focus-within { border-color: var(--blue); }
.command-prompt { padding: 0 6px 0 14px; color: var(--blue); font-family: var(--font-figure); font-size: 18px; }
.command input { flex: 1; border: 0; background: transparent; min-height: 42px; padding: 0 12px 0 4px; outline: none; }
.command input:focus-visible { outline: none; }
.command-read { position: absolute; top: calc(100% + 1px); left: -1px; right: -1px; background: var(--surface); border: 1px solid var(--blue); border-top-color: var(--rule); padding: 8px 14px; font-size: 13px; color: var(--ink-2); }
.command-read:empty { display: none; }
.command-read b { color: var(--ink); }
.menu-toggle { display: none; }

.sidebar { grid-area: sidebar; overflow-y: auto; border-right: 1px solid var(--rule); padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 26px; }
.side-block h2 { font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.side-foot { margin-top: auto; }
.mini-head { display: flex; align-items: baseline; justify-content: space-between; }
.mini-head h2 { letter-spacing: .12em; }
.mini-nav button { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 18px; }
.mini-nav button:hover { color: var(--ink); }
.mini-month { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-variant-numeric: tabular-nums; }
.mini-dow { font-size: 10px; color: var(--muted); padding-bottom: 4px; }
.mini-day { min-height: 30px; border: 0; background: none; color: var(--ink-2); font-size: 12px; padding: 0; }
.mini-day:hover { background: var(--wash); color: var(--ink); }
.mini-day.out { color: var(--silver-dim); }
.mini-day.today { color: var(--blue); font-weight: 700; }
.mini-day[aria-current="date"] { outline: 1px solid var(--silver); outline-offset: -1px; color: var(--ink); }
.cal-list { list-style: none; margin: 0 0 6px; padding: 0; }
.cal-list li { display: flex; align-items: center; gap: 4px; }
.cal-name { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-size: 14px; }
.cal-name > span:last-child { display: inline; margin: 0; font-size: 14px; color: var(--ink); letter-spacing: 0; }
.cal-swatch { display: inline-block; width: 9px; height: 9px; background: var(--c); transform: rotate(45deg); flex: none; margin: 0 2px; }
.cal-swatch.big { width: 16px; height: 16px; margin: 0; }
.side-links { list-style: none; margin: 0 0 10px; padding: 0; }
.side-links a { display: flex; justify-content: space-between; align-items: center; min-height: 40px; color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule); font-size: 14px; }
.side-links a:hover, .side-links a.on { color: var(--ink); }
.side-links a.on::after { content: "✦"; color: var(--blue); font-size: 11px; }
.count { font-family: var(--font-figure); color: var(--blue); font-size: 12px; }
.share-line { display: flex; align-items: center; gap: 8px; margin: 0; }
.share-path { flex: 1; font-family: var(--font-figure); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who { margin: 0 0 6px; font-size: 12px; color: var(--muted); }

.stage { grid-area: stage; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.stage:focus { outline: none; }
.stage-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; padding: 16px 24px 12px; border-bottom: 1px solid var(--rule); }
.period h1 { font-size: 26px; line-height: 1.1; margin: 0; letter-spacing: -.01em; }
.period-sub { margin: 4px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .16em; text-transform: uppercase; min-height: 1em; }
.period-nav { margin-left: auto; display: flex; }
.period-nav button { min-width: 44px; min-height: 40px; padding: 0 12px; background: transparent; border: 1px solid var(--rule-strong); color: var(--ink); margin-left: -1px; }
.period-nav button:hover { background: var(--wash); }
.views { display: flex; border: 1px solid var(--rule-strong); }
.views a { display: flex; align-items: center; min-height: 38px; padding: 0 14px; color: var(--muted); text-decoration: none; font-size: 14px; border-bottom: 2px solid transparent; }
.views a:hover { color: var(--ink); }
.views a.on { color: var(--ink); background: var(--wash); border-bottom-color: var(--blue); }
.view { flex: 1; min-height: 0; overflow: auto; position: relative; }
body[data-view="week"] .view, body[data-view="day"] .view { overflow: hidden; }
.dock { display: none; }

/* ---------------------------------------------------------- energy pips */

/* Charges: a day's energy budget as small diamonds, filled as it's spent. */
.charges { display: inline-flex; align-items: center; gap: 4px; min-height: 8px; }
.charges i { width: 5px; height: 5px; border: 1px solid var(--silver-dim); transform: rotate(45deg); }
.charges i.used { background: var(--blue); border-color: var(--blue); }
.charges.big { gap: 7px; }
.charges.big i { width: 10px; height: 10px; }
.over-word { font: 600 10px var(--font-figure); color: var(--warn); margin-left: 2px; }

/* The moon: dark disc, silver lit part. Shape carries "how full". */
.moon-disc { fill: color-mix(in srgb, var(--silver) 10%, transparent); stroke: var(--silver-dim); stroke-width: 1; }
.moon-lit { fill: var(--silver); }

/* ---------------------------------------------------------- time grid */

.timegrid { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: 100%; }
.tg-head, .tg-allday, .tg-body { display: grid; grid-template-columns: var(--gutter-w) repeat(var(--days), minmax(0, 1fr)); }
.tg-head, .tg-allday { overflow-y: hidden; scrollbar-gutter: stable; }
.tg-head { border-bottom: 1px solid var(--rule); }
.tg-corner { display: flex; align-items: flex-end; justify-content: flex-end; padding: 0 8px 8px 0; font-size: 10px; color: var(--muted); }
.tz-label { font-family: var(--font-figure); }
.tg-day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 8px; min-height: 44px; color: var(--ink); text-decoration: none; border-left: 1px solid var(--rule); }
.tg-day:hover { background: var(--wash); }
.tg-dow { font-size: 11px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.tg-num { font: 400 21px/1 var(--font-figure); }
.tg-day.today .tg-num, .tg-day.today .tg-dow { color: var(--blue); }
.tg-allday { border-bottom: 1px solid var(--rule-strong); min-height: 30px; }
.tg-allday .tg-corner { align-items: center; padding-bottom: 0; }
.tg-allday-cell { border-left: 1px solid var(--rule); padding: 3px 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.allday-chip {
  display: block; width: 100%; text-align: left; font-size: 12px; padding: 2px 6px; min-height: 22px; color: var(--ink);
  background: color-mix(in srgb, var(--c) 20%, var(--night)); border: 0; border-top: 2px solid var(--c);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tg-scroll { overflow-y: auto; min-height: 0; scrollbar-gutter: stable; }
.tg-body { height: calc(var(--hour) * 24); }
.tg-gutter { display: grid; grid-template-rows: repeat(24, var(--hour)); }
.tg-hour { font: 10px var(--font-figure); color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-.65em); white-space: nowrap; }
.tg-col {
  position: relative; border-left: 1px solid var(--rule); touch-action: pan-y;
  background-image: repeating-linear-gradient(to bottom, var(--rule) 0 1px, transparent 1px var(--hour));
  /* design-exception: draws the hour ruling of the time grid, one hairline per hour, like a star chart's graticule */
}
.tg-col.today { background-color: color-mix(in srgb, var(--blue) 4%, transparent); }

/* Energy zones: the hours you've painted, as a faint wash whose top edge is
   a dashed contour line, like altitude bands on a chart. Its name is in the
   day view's ledger and in the tooltip; colour is never the only signal. */
.zone { position: absolute; left: 0; right: 0; border-top: 1px dashed; }
.zone-peak { background: color-mix(in srgb, var(--zone-peak) 11%, transparent); border-top-color: color-mix(in srgb, var(--zone-peak) 55%, transparent); }
.zone-steady { background: color-mix(in srgb, var(--zone-steady) 8%, transparent); border-top-color: color-mix(in srgb, var(--zone-steady) 45%, transparent); }
.zone-low { background: color-mix(in srgb, var(--zone-low) 5%, transparent); border-top-color: color-mix(in srgb, var(--zone-low) 30%, transparent); }

/* Events: flat slabs hung from their calendar's colour. */
.slab {
  position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 1px; padding: 3px 6px 4px; overflow: hidden;
  text-align: left; color: var(--ink); font-size: 12px; line-height: 1.25; cursor: pointer; touch-action: pan-y;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  background: color-mix(in srgb, var(--c) 24%, var(--night)); border: 0; border-top: 2px solid var(--c);
}
.slab:hover { background: color-mix(in srgb, var(--c) 34%, var(--night)); }
.slab-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.slab-meta { font: 11px var(--font-figure); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slab.short { flex-direction: row; align-items: baseline; gap: 6px; padding-top: 1px; }
.slab.short .slab-title { white-space: nowrap; }
.slab.booked { border-top-style: double; border-top-width: 4px; }
.booked-mark { color: var(--c); font-weight: 400; }
.slab.clash { outline: 1px dashed var(--warn); outline-offset: -1px; }
.clash-word { position: absolute; right: 5px; bottom: 3px; font: 600 9px var(--font-figure); letter-spacing: .12em; text-transform: uppercase; color: var(--warn); }
.slab.short .clash-word { bottom: auto; top: 2px; }
.slab-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.slab.dragging { opacity: .85; z-index: 5; cursor: grabbing; outline: 1px solid var(--c); }

/* Borrowed events (from linked calendars): an outline, not a filled slab.
   Dotted hanging edge, a hairline frame, an arrow for "from elsewhere", the
   source named in the meta line (clashes stay dashed amber). Free
   time from elsewhere fades further: it is shown, but it doesn't block. */
.slab.borrowed {
  cursor: pointer; color: var(--ink-2); background: color-mix(in srgb, var(--c) 6%, var(--night));
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); border-top: 2px dotted var(--c);
}
.borrowed-mark { color: var(--c); font-weight: 400; }
.slab.borrowed:hover { background: color-mix(in srgb, var(--c) 14%, var(--night)); }
.slab.borrowed .slab-title { font-weight: 500; }
.slab.borrowed.free { opacity: .62; }
.allday-chip.borrowed { background: transparent; border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); border-top: 2px dotted var(--c); color: var(--ink-2); }
.mg-events li.borrowed button { color: var(--ink-2); }
.mg-events li.borrowed button::before { background: transparent; border: 1px solid var(--c); }
.tj-row.borrowed .tj-title { font-weight: 400; color: var(--ink-2); }
.tj-row.borrowed .tj-title::before { background: transparent; border: 1px solid var(--c); }

/* Cortex tasks: deadlines, not time. A task is a survey mark, a hollow
   square while open and a filled one once done. With a due time it is a
   ruled line across that day at that moment with the task tagged above it;
   without one it sits in the all-day lane as plain marked text. Time made
   for a task is an ordinary slab (it really takes time) carrying the square;
   once done in Cortex the slab is struck through and steps back. Overdue is
   said in words as well as amber. */
.task-mark { font-family: var(--font-figure); font-weight: 400; color: var(--ink-2); }
.task-chip {
  display: flex; align-items: baseline; gap: 5px; width: 100%; min-height: 22px; padding: 2px 4px; text-align: left; font-size: 12px;
  color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--rule-strong); overflow: hidden; white-space: nowrap;
}
.task-chip:hover { background: var(--wash); }
.task-name { overflow: hidden; text-overflow: ellipsis; }
.deadline { position: absolute; left: 0; right: 0; height: 0; z-index: 3; border-top: 1px solid var(--silver); pointer-events: none; }
.deadline-flag {
  position: absolute; left: 0; bottom: 0; max-width: 100%; display: flex; align-items: baseline; gap: 4px; min-height: 20px; padding: 2px 5px 2px 3px;
  background: var(--night); border: 0; color: var(--ink); font: 11px/1.2 var(--font-figure); white-space: nowrap; overflow: hidden; cursor: pointer; pointer-events: auto;
}
.deadline-flag:hover { background: var(--wash); }
.deadline.late { border-top-color: var(--warn); }
.slab.focus .task-mark { color: var(--ink); }
.slab.done { opacity: .55; }
.slab.done .slab-name, .tj-row.done .tj-title { text-decoration: line-through; }
.tj-row.task .tj-title::before, .tj-row.focus .tj-title::before, .mg-events li.task button::before { display: none; }
.tj-row.task .tj-title { font-weight: 400; }
.tj-row.task .tj-time { color: var(--ink); }
.task-chip.late .task-mark, .deadline.late .task-mark, .mg-events li.late .task-mark, .tj-row.late .tj-time { color: var(--warn); }

/* Landing strips: prep before and reset after, drawn as runway hatching
   because they protect time without being a meeting. */
.strip {
  position: absolute; z-index: 1; pointer-events: none; overflow: hidden;
  background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 38%, transparent) 0 1.5px, transparent 1.5px 7px);
  /* design-exception: the hatching depicts a landing-strip runway, the protected minutes around an event that are not a meeting */
}
.strip-prep { border-bottom: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); }
.strip-reset { border-top: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); }
.strip-word { display: inline-block; font: 600 9px/1 var(--font-figure); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); background: var(--night); padding: 2px 4px; margin: 2px; }
.strip.thin .strip-word { display: none; }
.ghost { position: absolute; left: 2px; right: 2px; z-index: 4; pointer-events: none; background: color-mix(in srgb, var(--blue) 22%, transparent); border: 1px dashed var(--blue); font: 11px var(--font-figure); padding: 2px 6px; color: var(--ink); }
.now-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--blue); z-index: 3; pointer-events: none; }
.now-star { position: absolute; left: -7px; top: -10px; color: var(--blue); font-size: 14px; line-height: 1; }

/* Day view: the grid with its ledger beside it. */
.day-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); height: 100%; }
.day-ledger { border-left: 1px solid var(--rule); padding: 20px 22px; overflow-y: auto; }
.day-ledger h2 { font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.day-ledger h2 + * { margin-top: 0; }
.day-ledger h2:not(:first-child) { margin-top: 28px; }
.ledger-figure { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.ledger-figure b { font: 300 44px/1 var(--font-figure); color: var(--ink); margin-right: 6px; }
.ledger-note { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }
.zone-list { list-style: none; margin: 0 0 12px; padding: 0; }
.zone-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.zl-mark { width: 10px; height: 10px; transform: rotate(45deg); }
.zl-peak .zl-mark { background: var(--zone-peak); }
.zl-steady .zl-mark { background: var(--zone-steady); }
.zl-low .zl-mark { background: var(--zone-low); }
.zl-word { flex: 1; }
.zl-time { font: 12px var(--font-figure); color: var(--muted); }

/* ---------------------------------------------------------- month */

.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(6, minmax(104px, 1fr)); min-height: 100%; }
.mg-dow { padding: 8px 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--rule-strong); }
.mg-day { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 4px 6px 6px; min-width: 0; overflow: hidden; }
.mg-day:nth-child(7n) { border-right: 0; }
.mg-num { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; min-width: 30px; font: 14px var(--font-figure); color: var(--ink); text-decoration: none; }
.mg-num:hover { color: var(--blue); }
.mg-day.out { background: color-mix(in srgb, var(--wash) 40%, transparent); }
.mg-day.out .mg-num { color: var(--silver-dim); }
.mg-day.today .mg-num { color: var(--blue); font-weight: 700; }
.mg-day .now-star { position: static; font-size: 11px; }
.mg-events { list-style: none; margin: 0; padding: 0; }
.mg-events button { display: flex; align-items: baseline; gap: 6px; width: 100%; min-height: 22px; padding: 1px 2px; border: 0; background: none; color: var(--ink); font-size: 12px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-events button::before { content: ""; flex: none; width: 6px; height: 6px; background: var(--c); transform: rotate(45deg) translateY(-1px); }
.mg-events button:hover { background: var(--wash); }
.mg-events li.allday button { background: color-mix(in srgb, var(--c) 20%, var(--night)); }
.mg-time { font: 11px var(--font-figure); color: var(--muted); }
.mg-events .more a { font-size: 11px; color: var(--muted); padding-left: 2px; }

/* ---------------------------------------------------------- ahead */

/* The next two weeks as a trajectory: one row per day that has something,
   quiet stretches folded into a single dashed line. */
.trajectory { list-style: none; margin: 0 auto; padding: 8px 28px 96px; max-width: 920px; }
.tj-day { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.tj-date { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 8px; align-items: center; align-content: start; }
.tj-num { grid-row: span 1; font: 300 38px/1 var(--font-figure); }
.tj-words { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.tj-words b { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.tj-load { display: inline-flex; align-items: center; }
.tj-day.today .tj-num, .tj-day.today .tj-words b { color: var(--blue); }
.tj-items { list-style: none; margin: 0; padding: 0; }
.tj-row {
  display: grid; grid-template-columns: 128px minmax(0, 1fr); grid-template-areas: "time title" "time meta"; column-gap: 16px;
  width: 100%; min-height: 44px; padding: 8px 6px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule); color: var(--ink);
}
.tj-items li:last-child .tj-row { border-bottom: 0; }
.tj-row:hover { background: var(--wash); }
.tj-time { grid-area: time; font: 12px/1.6 var(--font-figure); color: var(--ink-2); }
.tj-title { grid-area: title; font-size: 15px; font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.tj-title::before { content: ""; flex: none; width: 7px; height: 7px; background: var(--c); transform: rotate(45deg) translateY(-2px); }
.tj-meta { grid-area: meta; font-size: 12px; color: var(--muted); padding-left: 15px; }
.tj-meta:empty { display: none; }
.tj-empty { color: var(--muted); padding: 10px 6px; font-size: 14px; }
.quiet-days { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 24px; padding: 12px 0; color: var(--muted); font-size: 13px; border-bottom: 1px dashed var(--rule); }
.quiet-mark { text-align: left; font-family: var(--font-figure); color: var(--silver-dim); }

/* ---------------------------------------------------------- pages */

.page { padding: 24px 28px 96px; max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--rule-strong); }
.page-head h1 { font-size: 28px; margin: 0; letter-spacing: -.01em; }
.page-lede { color: var(--ink-2); max-width: 64ch; margin: 6px 0 0; font-size: 14px; }
.empty-state { padding: 36px 0 12px; }
.empty-state p:first-child { font-size: 18px; margin: 0; }

/* Booking types: a ledger of links, facts in a definition grid. */
.type-ledger { list-style: none; margin: 0; padding: 0; counter-reset: type; }
.type-entry { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) auto; gap: 28px; padding: 22px 0; border-bottom: 1px solid var(--rule); align-items: start; counter-increment: type; }
.type-entry.paused { opacity: .62; }
.type-main h2 { font-size: 21px; margin: 0 0 4px; }
.type-main h2::before { content: counter(type, decimal-leading-zero); font: 12px var(--font-figure); color: var(--muted); margin-right: 12px; vertical-align: 3px; }
.type-path { font: 12px var(--font-figure); color: var(--blue); margin: 0; word-break: break-all; }
.type-desc { color: var(--ink-2); font-size: 14px; margin: 10px 0 0; }
.type-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
.type-facts dt { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.type-facts dd { margin: 0; }
.type-facts small { color: var(--muted); }
.energy-word.e-deep { color: var(--zone-peak); }
.energy-word.e-standard { color: var(--zone-steady); }
.energy-word.e-light { color: var(--silver); }
.type-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 140px; }

/* Hours & energy: a paint surface for the week. */
.hours-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; margin-top: 20px; align-items: start; }
.brushes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.brush { position: relative; display: grid; grid-template-columns: 14px auto; grid-template-areas: "sw name" "sw says"; column-gap: 10px; padding: 7px 14px 7px 10px; min-height: 44px; border: 1px solid var(--rule-strong); cursor: pointer; align-items: center; }
.brush input { position: absolute; opacity: 0; pointer-events: none; }
.brush:hover { background: var(--wash); }
.brush:has(input:checked) { border-color: var(--ink); background: var(--wash); }
.brush:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.brush-swatch { grid-area: sw; width: 12px; height: 12px; transform: rotate(45deg); }
.brush > span { margin: 0; }
.brush .brush-name { grid-area: name; font-size: 13px; font-weight: 600; color: var(--ink); }
.brush .brush-says { grid-area: says; font-size: 11px; color: var(--muted); }
.b-peak .brush-swatch { background: var(--zone-peak); }
.b-steady .brush-swatch { background: var(--zone-steady); }
.b-low .brush-swatch { background: var(--zone-low); }
.b-off .brush-swatch { border: 1px dashed var(--muted); }
.painter-scroll { overflow: auto; max-height: 68vh; border: 1px solid var(--rule-strong); }
.painter { display: grid; grid-template-columns: 52px repeat(7, minmax(40px, 1fr)); user-select: none; touch-action: none; }
.pt-corner, .pt-dow { position: sticky; top: 0; z-index: 1; background: var(--night); border-bottom: 1px solid var(--rule-strong); }
.pt-dow { text-align: center; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 8px 0; }
.pt-time { font: 10px var(--font-figure); color: var(--muted); text-align: right; padding-right: 6px; transform: translateY(-.5em); white-space: nowrap; }
.pt-cell { height: 14px; padding: 0; border: 0; border-left: 1px solid var(--rule); border-top: 1px solid transparent; background: transparent; cursor: crosshair; }
.pt-cell.hour { border-top-color: var(--rule); }
.pt-cell:hover { outline: 1px solid var(--ink); outline-offset: -1px; }
.pt-cell.z-peak { background: color-mix(in srgb, var(--zone-peak) 62%, transparent); }
.pt-cell.z-steady { background: color-mix(in srgb, var(--zone-steady) 48%, transparent); }
.pt-cell.z-low { background: color-mix(in srgb, var(--zone-low) 30%, transparent); }
.hours-side { display: flex; flex-direction: column; gap: 30px; }
.hours-side h2 { font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.budget .page-lede { margin: 0 0 14px; font-size: 13px; }
.budget-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.step { width: 44px; height: 44px; border: 1px solid var(--rule-strong); background: transparent; color: var(--ink); font-size: 20px; }
.step:hover { background: var(--wash); }
.budget-figure { font: 300 36px/1 var(--font-figure); min-width: 2ch; text-align: center; }
.override-list { list-style: none; margin: 0; padding: 0; }
.override-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.ov-date { font-weight: 600; white-space: nowrap; }
.ov-what { flex: 1; color: var(--ink-2); font-size: 13px; }
.ov-none { color: var(--muted); font-size: 13px; }
.ov-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ov-add > input, .ov-add > select { flex: 1 1 140px; width: auto; }
.ov-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 100%; }
.ov-custom input, .ov-custom select { flex: 1 1 90px; width: auto; }
.save-row { display: flex; justify-content: flex-end; gap: 8px; padding-top: 14px; border-top: 1px solid var(--rule-strong); }

/* Bookings: a register. */
.ledger-title { font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 30px 0 6px; }
.empty-line { color: var(--muted); margin: 8px 0; }
.booking-ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.booking-ledger th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule-strong); }
.booking-ledger td { padding: 14px 10px 14px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.booking-ledger tr.cancelled td { color: var(--muted); }
.bk-when b, .bk-who b { display: block; font-weight: 600; }
.bk-when span { font: 12px var(--font-figure); color: var(--ink-2); }
.bk-who a { font-size: 12px; }
.bk-answers { margin-top: 6px; font-size: 13px; }
.bk-answers summary { cursor: pointer; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.bk-answers p { margin: 6px 0; color: var(--ink-2); white-space: pre-wrap; }
.bk-status { white-space: nowrap; }
.bk-act { text-align: right; }

/* Linked calendars: a patch bay. Each linked account is a block of inputs;
   its calendars cross three outputs (show here, block booking, receive
   Metona's events) at diamond crosspoints. The directory of services is a
   plain index; the subscribe link is a stub of figures you copy. */
.connect-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 44px; align-items: start; }
.patch { padding: 20px 0 22px; border-bottom: 1px solid var(--rule-strong); }
.patch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.patch-id h3 { font-size: 20px; margin: 0; }
.patch-account { margin: 2px 0 0; font: 12px var(--font-figure); color: var(--muted); }
.patch-status { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.patch-status.bad { color: var(--warn); }
.patch-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.crosspoints { border-collapse: collapse; margin-top: 16px; width: 100%; font-size: 14px; }
.crosspoints thead th { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: center; padding: 0 6px 6px; width: 92px; vertical-align: bottom; }
.crosspoints thead th:first-child { text-align: left; width: auto; padding-left: 0; }
.crosspoints tbody th { text-align: left; font-weight: 400; padding: 0 12px 0 0; border-top: 1px solid var(--rule); }
.crosspoints tbody th .cal-swatch { margin-right: 10px; }
.crosspoints tbody th small { color: var(--muted); }
.crosspoints td { text-align: center; padding: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.crosspoint { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; }
.crosspoint input { position: absolute; opacity: 0; width: 44px; height: 44px; margin: 0; cursor: pointer; }
.cp-mark { width: 12px; height: 12px; margin: 0; border: 1px solid var(--silver-dim); transform: rotate(45deg); transition: background var(--move), border-color var(--move); }
.crosspoint:hover .cp-mark { border-color: var(--ink); }
.crosspoint input:checked + .cp-mark { background: var(--blue); border-color: var(--blue); }
.crosspoint input:focus-visible + .cp-mark { outline: 2px solid var(--blue); outline-offset: 5px; }
.cp-none { color: var(--silver-dim); font-family: var(--font-figure); }
.patch-from { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--rule-strong); }
.patch-from legend { float: left; width: 100%; margin-bottom: 0; }
.patch-from .check.small > span { color: var(--ink-2); }
.connect-side { display: flex; flex-direction: column; gap: 8px; }
.connect-side .ledger-title { margin-top: 6px; }
.service-index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.service-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name go" "how go"; column-gap: 12px;
  width: 100%; min-height: 52px; padding: 8px 4px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule); color: var(--ink);
}
.service-row:hover { background: var(--wash); }
.service-name { grid-area: name; font-size: 15px; }
.service-how { grid-area: how; font: 11px var(--font-figure); color: var(--muted); }
.service-go { grid-area: go; align-self: center; color: var(--blue); }
.subscribe { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.subscribe .page-lede { margin: 0; font-size: 13px; }
.subscribe .primary { align-self: flex-start; }
.feed-link { margin: 0; padding: 10px 12px; font: 12px/1.5 var(--font-figure); color: var(--ink); word-break: break-all; background: var(--field); border: 1px dashed var(--rule-strong); }
.feed-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.link-fields { display: flex; flex-direction: column; gap: 12px; }
.link-oauth { padding: 4px 0; }
.ext-read .ext-source, .task-order .ext-source { margin: 0; font: 12px var(--font-figure); color: var(--muted); }
.ext-read h2 { font-size: 22px; }
.ext-read p { margin: 0; }
.ext-when { font-size: 15px; }
.ext-where { color: var(--ink-2); }
.ext-busy { font-size: 14px; color: var(--ink-2); }

/* The task sheet is a work order: when it's due, what kind of work it is,
   the time already set aside (a short timetable), then how much more. */
.task-due { margin: 0; font-size: 15px; }
.task-due.late { color: var(--warn); }
.task-work { margin: 0; font-size: 13px; color: var(--ink-2); }
.task-blocks .ledger-title { margin: 4px 0 2px; }
.focus-list { list-style: none; margin: 0; padding: 0; font: 13px var(--font-figure); }
.focus-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.fb-len { color: var(--muted); }

/* Cortex on the linked-calendars page: a two-figure tally, not a widget. */
.cortex-link { margin-top: 18px; }
.cortex-figures { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin: 10px 0 0; font-size: 13px; }
.cortex-figures dt, .cortex-figures dd { padding: 7px 0; border-bottom: 1px solid var(--rule); }
.cortex-figures dt { color: var(--ink-2); }
.cortex-figures dd { margin: 0; font: 15px var(--font-figure); text-align: right; }

/* ---------------------------------------------------------- sheets */

dialog.sheet {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 6px;
  box-shadow: 0 30px 80px rgb(0 0 0 / .55);
}
dialog.sheet.narrow { width: min(420px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: rgb(3 4 8 / .62); }
.sheet form { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px 18px; }
.sheet h2 { font-size: 20px; margin: 0; }
input.title-field { font-size: 22px; padding: 6px 0; background: transparent; border: 0; border-bottom: 1px solid var(--rule-strong); width: 100%; color: var(--ink); }
input.title-field:focus-visible { outline: none; border-bottom-color: var(--blue); }
.booking-note { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--blue) 55%, transparent); background: color-mix(in srgb, var(--blue) 9%, transparent); font-size: 13px; color: var(--ink-2); }
.booking-note b { color: var(--ink); font-weight: 600; }
/* A focus block's note points back to its task: plain ruling, not the booking blue. */
.task-note { border-color: var(--rule-strong); background: transparent; }
form.readonly input, form.readonly select, form.readonly textarea, form.readonly .segment { pointer-events: none; opacity: .72; }
.when { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; align-items: end; }
.when .allday { min-height: 44px; display: flex; align-items: center; gap: 8px; }
.when .allday > span { display: inline; margin: 0; font-size: 14px; color: var(--ink); }
.row-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.strips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; border: 1px dashed var(--rule-strong); }
.strips legend { padding: 0 6px; margin-left: -6px; }
.segments { display: flex; flex-wrap: wrap; border: 1px solid var(--rule-strong); }
.segment { position: relative; flex: 1 1 auto; cursor: pointer; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 12px; margin: 0; font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--rule); white-space: nowrap; }
.segment:last-child span { border-right: 0; }
.segment:hover span { background: var(--wash); }
.segment input:checked + span { background: color-mix(in srgb, var(--blue) 22%, transparent); color: var(--ink); }
.segment input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: -2px; }
.energy-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.energy-choice { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); grid-template-areas: "g name" "g says"; column-gap: 8px; padding: 10px 12px; border: 1px solid var(--rule-strong); cursor: pointer; align-items: center; }
.energy-choice input { position: absolute; opacity: 0; pointer-events: none; }
.energy-choice:hover { background: var(--wash); }
.energy-choice:has(input:checked) { border-color: var(--ink); background: var(--wash); }
.energy-choice:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.energy-choice > span { margin: 0; }
.energy-choice .ec-glyph { grid-area: g; font-size: 22px; line-height: 1; color: var(--silver); }
.e-deep .ec-glyph { color: var(--zone-peak); }
.e-standard .ec-glyph { color: var(--zone-steady); }
.energy-choice .ec-name { grid-area: name; font-size: 14px; font-weight: 600; color: var(--ink); }
.energy-choice .ec-says { grid-area: says; font-size: 11px; color: var(--muted); }
.questions { list-style: none; margin: 0 0 6px; padding: 0; }
.question { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.sheet-actions { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--rule); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch-pick { position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; cursor: pointer; }
.swatch-pick input { position: absolute; opacity: 0; pointer-events: none; }
.swatch-pick:has(input:checked) { border-color: var(--ink); }
.swatch-pick:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------------------------------------------------------- toast */

/* Feature search is an app command index: ruled destinations, never a
   marketing grid. It preserves the calendar's star-chart typography and
   gives a direct route to each recurring work surface. */
.feature-trigger { min-height: 44px; padding: 0 14px; flex: none; border: 1px solid var(--rule-strong); background: var(--field); color: var(--ink); font-size: 13px; }
.feature-trigger:hover { border-color: var(--blue); }
dialog.feature-search { width: min(620px, calc(100vw - 32px)); max-height: min(720px, calc(100dvh - 32px)); padding: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--silver-dim); box-shadow: 0 20px 60px #0008; }
dialog.feature-search::backdrop { background: #05060bc9; }
.feature-search-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; border-bottom: 1px solid var(--rule); }
.feature-search-head h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.feature-search-kicker { margin: 0 0 5px; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.feature-search > label { display: block; margin: 18px 24px 6px; color: var(--ink-2); font-size: 12px; }
.feature-search > input { display: block; width: calc(100% - 48px); min-height: 44px; margin: 0 24px; padding: 8px 10px; border: 1px solid var(--rule-strong); background: var(--field); color: var(--ink); }
.feature-search-count { min-height: 19px; margin: 12px 24px 4px; color: var(--muted); font-size: 11px; }
.feature-search-results { max-height: min(430px, 48dvh); overflow: auto; padding: 0 24px 20px; }
.feature-result { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; width: 100%; min-height: 48px; padding: 12px 2px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; text-align: left; text-decoration: none; cursor: pointer; }
.feature-result:hover { background: var(--wash); }
.feature-result-name { color: var(--ink); font-size: 14px; }
.feature-result-hint { color: var(--ink-2); font-size: 11px; text-align: right; }
.feature-result:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: calc(100vw - 32px);
  padding: 11px 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--silver-dim); font-size: 14px;
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity var(--move), transform var(--move);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast[data-tone="bad"] { border-color: var(--warn); }

/* ---------------------------------------------------------- phone */

@media (max-width: 760px) {
  :root { --gutter-w: 40px; }
  .threshold { grid-template-columns: 1fr; }
  .threshold-sky { min-height: 200px; }
  .threshold-mark { width: 112px; height: 112px; }
  .threshold-form { padding: 28px 16px 40px; }
  .threshold h1 { font-size: 28px; }

  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "horizon" "stage"; padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom)); }
  .horizon { flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px 10px; }
  .brand span { display: none; }
  .command { order: 3; flex-basis: 100%; max-width: none; }
  .feature-trigger { margin-left: auto; padding: 0 10px; }
  .menu-toggle { display: inline-flex; align-items: center; margin-left: auto; min-height: 44px; padding: 0 14px; background: transparent; border: 1px solid var(--rule-strong); color: var(--ink); }
  .feature-search-head { padding: 18px 16px 12px; }
  .feature-search > label { margin: 16px 16px 6px; }
  .feature-search > input { width: calc(100% - 32px); margin: 0 16px; }
  .feature-search-count { margin: 12px 16px 4px; }
  .feature-search-results { padding: 0 16px 20px; }
  .feature-result { display: block; }
  .feature-result-hint { display: block; margin-top: 2px; text-align: left; }
  .sidebar { display: none; grid-area: stage; border-right: 0; padding: 16px 16px 32px; }
  body.menu-open .sidebar { display: flex; }
  body.menu-open .stage { display: none; }
  .mini-day { min-height: 44px; font-size: 14px; }
  .side-links a { min-height: 48px; }
  .cal-name { min-height: 44px; }
  .quiet.small, .quiet.tiny { min-height: 44px; }

  .stage-head { padding: 12px 16px 10px; gap: 10px; }
  .period h1 { font-size: 21px; }
  .period-nav button { min-height: 44px; }
  .views { order: 3; width: 100%; }
  .views a { flex: 1; justify-content: center; min-height: 44px; padding: 0 6px; }

  .dock {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--dock-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--night); border-top: 1px solid var(--rule-strong);
  }
  .dock a { display: flex; align-items: center; justify-content: center; min-height: 48px; color: var(--muted); text-decoration: none; font-size: 13px; border-top: 2px solid transparent; }
  .dock a.on { color: var(--ink); border-top-color: var(--blue); }
  .dock-add { justify-self: center; width: 52px; height: 44px; border: 1px solid var(--action); background: var(--action); color: var(--action-ink); font-size: 24px; line-height: 1; }

  .tg-day { padding: 6px 0; }
  .tg-num { font-size: 17px; }
  .tg-dow { font-size: 10px; letter-spacing: .06em; }
  .tg-day .charges { display: none; }
  .cols-1 .tg-day .charges { display: inline-flex; }
  .slab { padding: 2px 3px; font-size: 11px; }
  .cols-7 .slab-meta { display: none; }
  .day-split { display: flex; flex-direction: column; overflow-y: auto; }
  .day-split .timegrid { height: 64vh; flex: none; }
  .day-ledger { border-left: 0; border-top: 1px solid var(--rule-strong); padding: 16px; overflow: visible; }
  body[data-view="day"] .view { overflow: auto; }

  .month-grid { grid-template-rows: auto repeat(6, minmax(72px, 1fr)); }
  .mg-dow { padding: 6px 4px; font-size: 10px; letter-spacing: .04em; }
  .mg-day { padding: 2px 3px; }
  .mg-num { min-height: 28px; min-width: 28px; font-size: 13px; }
  .mg-events button { font-size: 10px; gap: 3px; min-height: 18px; }
  .mg-time { display: none; }

  .trajectory { padding: 4px 16px 32px; }
  .tj-day, .quiet-days { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tj-date { grid-template-columns: auto auto 1fr; grid-template-rows: auto; }
  .tj-date .charges { justify-self: end; }
  .tj-num { font-size: 30px; }
  .tj-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "time" "meta"; padding: 10px 4px; }
  .tj-time { padding-left: 15px; }
  .quiet-mark { display: none; }

  .page { padding: 18px 16px 32px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-head h1 { font-size: 24px; }
  .type-entry { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .type-actions { flex-direction: row; flex-wrap: wrap; }
  .type-actions > * { flex: 1 1 40%; }
  .hours-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .connect-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .crosspoints thead th { width: 64px; padding: 0 2px 6px; font-size: 9px; letter-spacing: .08em; }
  .patch-actions { width: 100%; }
  .brush { flex: 1 1 45%; }
  .booking-ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .booking-ledger tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
  .booking-ledger td { padding: 0; border: 0; }
  .bk-act { grid-row: 1 / span 2; grid-column: 2; }

  dialog.sheet, dialog.sheet.narrow { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 6px 6px 0 0; border-bottom: 0; }
  .sheet form { padding: 18px 16px 16px; }
  .row-3, .energy-choices, .strips { grid-template-columns: minmax(0, 1fr); }
  .question { grid-template-columns: minmax(0, 1fr) auto; }
  .question > button { grid-column: 2; }
  .sheet-actions { flex-wrap: wrap; position: sticky; bottom: -16px; background: var(--surface); padding-bottom: 4px; }
  .toast { bottom: calc(var(--dock-h) + 16px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
