/* tasteskill / app.css
   A neutral foundation for app screens (dashboards, admin, settings, inboxes), set to the defaults
   measured in the study of real product screens (references/app-screens.md). Copy it into the project,
   replace the token values with the ones on the app sheet (draw.mjs --app), and build on top.
   Delete what you do not use. It has no brand of its own: neutral grounds, one quiet line, one accent. */

/* ---------- tokens (replace with the dealt style) ---------- */
:root {
  /* OLA Dates: the accent ladder built from the school's blue (#0055a5); the ground one step toward its palest tint */
  --ground: #f7f9fc;
  --surface: #ffffff;
  --raised: #f1f5fb;          /* hover rows, weekend cells */
  --active: #dbe7f6;          /* the active nav row: tint 100 with the dark ink of the hue */
  --tint: #eaf1fa;            /* tint 50: the selected day, the search highlight */
  --border: #e2e8f0;
  --rule: #edf1f6;
  --control: #c6d1df;
  --text: #121c2c;
  --muted: #55657a;           /* 5.9:1 on white, 5.4:1 on the ground */
  --faint: #5f6e82;           /* 5.0:1 on white, 4.6:1 on the ground */
  --accent: #0055a5;          /* the one hue: stamps, today, the active icon, focus */
  --accent-ink: #0b3d7a;      /* the dark of the hue, for text on its tints */
  --primary: #121c2c;
  --primary-ink: #ffffff;
  --positive: #247b50; --negative: #c4242a; --warning: #92400e;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #eeeeee; --pill-neutral-ink: #3d3d3d;
  --chart-1: var(--accent); --chart-muted: #cfd3d6; --chart-mark: var(--text); --chart-span: 0.06;
  --grid: var(--rule); --axis-ink: var(--muted); --ink: var(--text);

  --font: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;   /* one grotesk, tabular figures */
  --display: "Oswald", "Arial Narrow", sans-serif;                 /* the school site's face: wordmark and day numerals only */
  --fs-title: 28px; --fs-section: 16px; --fs-kpi: 24px; --fs-body: 14px; --fs-small: 12px;

  --sidebar-width: 232px;
  --pad: 32px;
  --gap: 24px;
  --card-pad: 20px;
  --radius-card: 8px;
  --radius-control: 6px;
  --control-height: 32px;
  --row-height: 48px;
  --nav-row: 32px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --t-press: 120ms; --t-hover: 150ms; --t-ui: 200ms;
}
/* dark: one true-neutral ground, elevation by lightness; two greys that read apart (not #aaa beside #969696) */
:root[data-theme="dark"] {
  --ground: #000000; --surface: #111111; --raised: #222222; --active: #222222;
  --border: #1a1a1a; --rule: #161616; --control: #444444;
  --text: #ffffff; --muted: #b4b4b4; --faint: #949494;
  --primary: #ffffff; --primary-ink: #000000;
  --positive: #3fc07a; --negative: #e5566f; --warning: #e5a93b;  /* a green or yellow-green accent is also --positive */
  --pill-positive-bg: #172a1d; --pill-positive-ink: #3fc07a;
  --pill-negative-bg: #2c1a20; --pill-negative-ink: #e5566f;
  --pill-warning-bg: #2b2414; --pill-warning-ink: #e5a93b;
  --pill-neutral-bg: #222222; --pill-neutral-ink: #ffffff;
  --chart-muted: #4a4a4a; --grid: #2b2b2b;
  --chart-span: 0.12;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: var(--fs-body)/20px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num, table, .kpi-value { font-variant-numeric: tabular-nums; }  /* not body-wide: Schibsted's tnum widens punctuation too */

/* ---------- shell: sidebar + canvas ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100svh; }
.sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; overflow: auto; }
.sidebar .group-label { margin: 20px 8px 6px; font-size: var(--fs-small); color: var(--faint); }
.nav-item { display: flex; align-items: center; gap: 10px; height: var(--nav-row); padding: 0 8px; border-radius: 8px; color: var(--muted); transition: background-color var(--t-hover) ease, color var(--t-hover) ease; }
.nav-item svg { width: 16px; height: 16px; flex: none; stroke-width: 1.5; }
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--text); }
.sidebar .bottom { margin-top: auto; }
.canvas { min-width: 0; padding: var(--pad); }

/* ---------- title block and filters ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.title-row h1 { font-size: var(--fs-title); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.title-row .sub { margin-top: 4px; color: var(--muted); }
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: var(--gap); flex-wrap: wrap; }
.filters .spacer { flex: 1; }
.stamp { color: var(--faint); font-size: var(--fs-small); }

/* ---------- panels and grid ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad); min-width: 0; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel h2 { font-size: var(--fs-section); line-height: 1.3; font-weight: 600; }
.panel .meta { color: var(--faint); font-size: var(--fs-small); }
/* paired cards in one row: a card stretches to its neighbour only when it has content to fill. Otherwise it keeps
   its own height (add .top to the row), and only an action or a total may be pinned to a stretched card's bottom */
.grid.top { align-items: start; }

/* a chart's heading row: its title (and legend or period) with a fixed 8px to the svg */
.chart-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.chart-head h3 { font-size: var(--fs-body); line-height: 20px; font-weight: 500; }
.chart { position: relative; min-width: 0; }

/* a link at a card's foot or header ("Show all 7", "Sell-out history"): ink, a 12px chevron, an underline on hover,
   and no inline padding, so its text sits on the card's content edge */
.card-link { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; color: var(--text); font-weight: 500; cursor: pointer; text-underline-offset: 3px; }
.card-link::after { content: ""; width: 12px; height: 12px; flex: none; background: currentColor; -webkit-mask: var(--chevron) center / 12px no-repeat; mask: var(--chevron) center / 12px no-repeat; }
.card-link:hover { text-decoration: underline; }
:root { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5 8 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* list rows: a rule between rows and none above the first. A rule on a rounded box curls up at both ends, so a row
   that carries a rule has square corners */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--rule); border-radius: 0; }

/* KPIs as one divided strip: a label above a number, no icons, no tiles */
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.kpi { padding: 16px var(--card-pad); }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { color: var(--muted); }
.kpi-value { margin-top: 6px; font-size: var(--fs-kpi); line-height: 1.15; font-weight: 500; letter-spacing: -0.01em; }
.kpi-value small { font-size: 0.55em; color: var(--muted); font-weight: 400; margin-left: 2px; }
.delta { margin-top: 4px; font-size: var(--fs-small); color: var(--muted); }
.delta .up { color: var(--positive); } .delta .down { color: var(--negative); }
/* KPIs as the chart's tabs: the selected one carries a 2px rule and an ink label; the others keep a grey label and
   their value in ink at a lighter weight (a grey value reads as disabled). When the tabs are the per-entity
   breakdown the brief asks for (takings by shop), add .entities: nothing changes but the rule */
.kpis[role="tablist"] .kpi { position: relative; cursor: pointer; }
.kpis[role="tablist"] .kpi[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }
.kpis[role="tablist"]:not(.entities) .kpi[aria-selected="true"] .kpi-label { color: var(--text); }
.kpis[role="tablist"]:not(.entities) .kpi[aria-selected="false"] .kpi-value { color: var(--text); font-weight: 400; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 36px; padding: 0 12px; text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
/* cells share one baseline, so a figure never sits 2px below the name beside it; the row height comes from padding */
td { padding: calc((var(--row-height) - 20px) / 2) 12px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
tbody tr:last-child td { border-bottom: 0; }
/* no hover that changes the fill; a row that drives a detail pane takes the nav pill's fill when selected */
tbody tr[aria-selected="true"] td { background: var(--active); }
th.n, td.n { text-align: right; }
td .sub { display: block; font-size: var(--fs-small); color: var(--muted); }
.truncate { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* status pill: a pale tint with dark ink of the same hue, one per row */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-height); padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); font-weight: 500; cursor: pointer; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.field { display: grid; gap: 8px; }
.field label { font-weight: 500; }
.field .hint { color: var(--muted); font-size: var(--fs-small); }
.input, select.input { height: 38px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.input::placeholder { color: var(--faint); }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: var(--gap); }
.tabs a { position: relative; padding: 10px 0; color: var(--muted); transition: color var(--t-hover) ease; }
.tabs a[aria-selected="true"] { color: var(--text); }
.tabs a[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }
/* as wide as its options; full width only on a narrow phone */
.segmented { display: inline-flex; width: max-content; max-width: 100%; padding: 3px; border-radius: 8px; background: var(--raised); }
.segmented button { height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.switch { appearance: none; width: 32px; height: 20px; border-radius: 999px; background: var(--control); position: relative; cursor: pointer; transition: background-color var(--t-ui) ease; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--t-ui) var(--ease-out); }
.switch:checked { background: var(--text); } .switch:checked::after { transform: translateX(12px); }

/* empty and loading states keep the frame; a loading value is a flat grey bar at its real size, with no shimmer */
.empty { display: grid; place-items: center; min-height: 96px; padding: 16px; border: 1px dashed var(--control); border-radius: var(--radius-control); color: var(--muted); text-align: center; }
.skeleton { background: var(--raised); border-radius: 4px; }

/* ---------- phone: the navigation folds away and the canvas takes the width ---------- */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  /* the menu opens as a full-screen sheet */
  .sidebar { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 20; background: var(--surface); transform: translateX(-100%); transition: transform var(--t-ui) var(--ease-out); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .canvas { padding: 16px; }
  .grid > * { grid-column: 1 / -1 !important; }
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  /* an odd count leaves no half-empty row: the last cell takes the full width */
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* KPI tabs in a 2-up grid: the selected cell takes a fill, never an underline floating mid-grid */
  .kpis[role="tablist"] .kpi[aria-selected="true"] { background: var(--active); }
  .kpis[role="tablist"] .kpi[aria-selected="true"]::after { content: none; }
  .title-row { flex-wrap: wrap; align-items: flex-start; }
}
@media (max-width: 480px) {
  .segmented { display: flex; width: 100%; }
  .segmented button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; } }

/* an empty message spans the block it stands in, never one squeezed column */
.rows .empty, .grid > .empty, li > .empty { grid-column: 1 / -1; width: 100%; }

/* ================= OLA Dates ================= */
/* dark: true neutrals from the base, with the ladder rebuilt from a lighter OLA blue so it holds 4.5:1 */
:root[data-theme="dark"] {
  --accent: #6aacf0;          /* 7.4:1 on #000, 6.3:1 on #111 */
  --accent-ink: #bcd6f5;      /* text on the dark tints */
  --active: #16304f;          /* the active nav row, her grade pill */
  --tint: #11243a;            /* selected day, search highlight */
  --raised: #171717;
  --ground: #000000; --surface: #111111; --border: #262626; --rule: #1d1d1d; --control: #3a3a3a;
  --primary: #ffffff; --primary-ink: #000000;
  --pill-neutral-bg: #262626; --pill-neutral-ink: #d6d6d6;
  --pill-warning-bg: #2b2414; --pill-warning-ink: #e5a93b;
  --warning: #e5a93b;
}
:root[data-theme="dark"] .brand .mark { filter: brightness(1.45) saturate(0.85); }
:root[data-theme="dark"] .fresh li.stale i, :root[data-theme="dark"] .fresh-chip i.stale, :root[data-theme="dark"] .cell .dots i.due { background: #e5a93b; }
:root[data-theme="dark"] mark { background: var(--tint); color: var(--accent-ink); }
:root[data-theme="dark"] .topbar { background: var(--ground); }
:root[data-theme="dark"] .segmented button[aria-pressed="true"] { background: var(--active); color: var(--accent-ink); }
:root[data-theme="dark"] .passed-line { background: var(--active); color: var(--accent-ink); }
:root[data-theme="dark"] .src-pills button[aria-pressed="true"] { background: var(--active); color: var(--accent-ink); }
:root[data-theme="dark"] .cell.weekend { background: #0b0b0b; }

/* settings: a burger at the top right, a small centred dialog */
.settings-btn { position: fixed; top: 10px; right: 16px; z-index: 12; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--muted); cursor: pointer; transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease; }
.settings-btn svg { width: 18px; height: 18px; }
.settings-btn:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .settings-btn:hover { background: var(--raised); color: var(--text); } }
@media (min-width: 861px) { .settings-btn { top: 24px; right: 32px; } }
.settings { width: min(360px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
.settings::backdrop { background: rgba(10, 20, 35, .4); }
.settings[open] { animation: settings-in var(--t-ui) var(--ease-out); }
@keyframes settings-in { from { opacity: 0; transform: scale(0.96); } }
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.settings-head h2 { font-size: var(--fs-section); font-weight: 600; }
.settings .close { width: 32px; padding: 0; color: var(--muted); }
.settings-label { margin: 14px 0 6px; font-size: var(--fs-small); color: var(--muted); }
.settings .segmented { display: flex; width: 100%; }
.settings .segmented button { flex: 1; }
.zoom-row { display: flex; align-items: center; gap: 8px; }
.zoom-row .btn { width: 36px; padding: 0; font-size: 16px; }
.zoom-row .num { min-width: 48px; text-align: center; }
.zoom-row .ghost { width: auto; padding: 0 10px; font-size: var(--fs-body); margin-left: auto; }
.settings-note { margin-top: 14px; font-size: var(--fs-small); color: var(--faint); }
@media (prefers-reduced-motion: reduce) { .settings[open] { animation: none; } }
/* Grid (1440): sidebar 232 + canvas padding 32x2 = 296; content 1144 = list 736 + gap 24 + rail 384.
   Phone (390): margins 16x2; content 358 = date 62 + gap 10 + rows 286. */
::selection { background: var(--active); color: var(--accent-ink); }
html { scrollbar-color: var(--control) transparent; }
.sidebar { padding: 24px 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--accent); }
/* the P&F logo (the committee's own mark) with the site's name beside it */
.brand .mark { width: auto; height: 56px; flex: none; }
.wordmark { font-family: var(--display); font-weight: 500; font-size: 22px; letter-spacing: 0.01em; color: var(--text); line-height: 1; white-space: nowrap; }
.sidebar .scope { margin: 6px 0 22px 34px; font-size: var(--fs-small); color: var(--muted); line-height: 16px; }
.nav-item[aria-current="page"] { background: var(--active); color: var(--accent-ink); }
.nav-item[aria-current="page"] svg { color: var(--accent); }
.sidebar .group-label { margin: 0 8px 8px; }
.fresh { display: grid; gap: 2px; margin: 0 8px 10px; }
.fresh li { display: flex; align-items: center; gap: 8px; min-height: 24px; font-size: var(--fs-small); color: var(--muted); }
.fresh li .when { margin-left: auto; color: var(--faint); font-variant-numeric: tabular-nums; }
.fresh li i, .fresh-chip i { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 3px; background: var(--accent); color: #fff; font-style: normal; font-size: 11px; font-weight: 600; line-height: 1; flex: none; }
:root[data-theme="dark"] .fresh li i, :root[data-theme="dark"] .fresh-chip i { color: #000; }
.fresh-chip { gap: 3px; }
.fresh li.stale i, .fresh-chip i.stale { background: #d19a1b; }
.fresh li.bad i, .fresh-chip i.bad { background: var(--negative); }
.sync { height: 28px; padding: 0 8px; justify-content: flex-start; color: var(--muted); }
.sync:disabled { color: var(--faint); cursor: default; }

/* the phone shell: a 48px top bar and a bottom bar of the three destinations; the sidebar is desktop only */
.topbar, .tabbar { display: none; }
.canvas { max-width: calc(1144px + 2 * var(--pad)); }
.title-row h1 { font-weight: 600; letter-spacing: -0.02em; }
.title-row .sub { max-width: 60ch; }
.title-row .sub b { font-weight: 600; color: var(--text); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: var(--gap); align-items: start; }
.rail-head { font-size: var(--fs-section); font-weight: 600; margin: 0 0 8px; }

/* source tiles: N C F in a fixed order, filled where that source mentions the item, hollow where it does not */
.stamps { display: inline-flex; gap: 3px; align-items: center; flex: none; }
.stamps i { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--control); background: transparent; color: var(--faint); font-style: normal; font-size: 11px; font-weight: 600; line-height: 1; }
.stamps i.on { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .stamps i.on { color: #000; }
.src-pills .stamps i { width: 15px; height: 15px; border-radius: 3px; }

/* months: a header that stays pinned while its days pass; months scrolled past fold into lines above it */
:root { --bar: 0px; --passed-h: 0px; }
.month + .month { margin-top: 8px; }
.month-head { position: sticky; top: calc(var(--bar) + var(--passed-h)); z-index: 5; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0 8px; background: var(--ground); }
.month-head h2 { font-size: var(--fs-section); font-weight: 600; line-height: 20px; }
.month-head .meta { font-size: var(--fs-small); color: var(--muted); white-space: nowrap; }
.passed { position: sticky; top: var(--bar); z-index: 6; display: grid; gap: 4px; padding: 6px 0 2px; background: var(--ground); }
.passed-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-control); background: var(--active); color: var(--accent-ink); font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; transition: transform var(--t-ui) var(--ease-out), opacity var(--t-ui) ease; }
.passed-line .meta { font-weight: 400; color: var(--accent-ink); opacity: .8; white-space: nowrap; }
.passed-line:active { transform: scale(0.98); }
@starting-style { .passed-line { opacity: 0; transform: translateY(-6px); } }
@media (hover: hover) and (pointer: fine) { .passed-line:hover { filter: brightness(0.96); } }

/* the day-by-day list: a date column in the display face, rows beside it */
.days { display: grid; gap: 4px; }
.day { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 12px 0; align-items: start; }
.day + .day { border-top: 1px solid var(--border); }
.date { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: start; padding-top: 6px; color: var(--muted); font-size: var(--fs-small); line-height: 14px; }
.dnum { font-family: var(--display); font-weight: 500; font-size: 28px; line-height: 28px; color: var(--text); letter-spacing: -0.01em; }
.dname { display: grid; gap: 1px; padding-top: 1px; }
/* "tomorrow", "in 2 days": a small chip in the ladder's tint, so it reads as a fact rather than a footnote */
.rel { grid-column: 1 / -1; justify-self: start; max-width: 100%; margin-top: 5px; padding: 1px 5px; border-radius: 4px; background: var(--tint); color: var(--accent-ink); font-size: 11px; font-weight: 500; line-height: 15px; }
.day.today .dnum { color: var(--accent); }
.day.today .rel { background: var(--accent); color: #fff; }
.day.weekend .dnum { color: var(--muted); }
.row.item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 44px; padding: 8px 0; }
.row.item:first-child { padding-top: 4px; }
.time { color: var(--muted); font-size: 13px; }
.what { min-width: 0; line-height: 20px; }
.what a { color: var(--text); text-decoration: none; text-underline-offset: 3px; }
.what a:focus-visible { outline-offset: 1px; }
.what .note, .what .sub, .what .snip { display: block; font-size: var(--fs-small); line-height: 16px; color: var(--muted); margin-top: 1px; }
.what .note { color: var(--warning); }
.what .snip { color: var(--text); margin-top: 4px; }
mark { background: var(--tint); color: var(--accent-ink); border-radius: 2px; padding: 0 1px; }

/* grade pills: her grade in the hue's tint with its dark ink, other grades in grey; the row's title in ink either way */
.pills { display: inline-flex; gap: 6px; flex: none; }
.pills:empty { display: none; }
.pill.grade { height: 20px; padding: 0 7px; font-size: 11px; font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.grade.mine { background: var(--active); color: var(--accent-ink); }

/* notices and search hits: a row that opens its text */
details.notice, details.hit { border-top: 1px solid var(--rule); }
details.notice:first-child, details.hit:first-child { border-top: 0; }
details summary { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: start; min-height: 44px; padding: 10px 0; cursor: pointer; list-style: none; }
details.hit summary { grid-template-columns: minmax(0, 1fr); }
details summary::-webkit-details-marker { display: none; }
details summary .when { color: var(--muted); font-size: 13px; padding-top: 1px; }
details .body { padding: 0 0 14px; color: var(--text); line-height: 20px; }
details .body p, details .body ul { margin: 0 0 10px; }
details .body ul { padding-left: 18px; }
details .body a:not(.card-link) { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
details .body .card-link { margin-top: 8px; }
.card-link.more { padding-top: 10px; color: var(--muted); }
.empty-line { color: var(--muted); padding: 8px 0; }
.panel#notices { padding: 4px var(--card-pad) 8px; }

/* month: seven columns, weekends one tone darker, today's number in the hue with a line at the top of its cell */
.month-nav { display: flex; gap: 8px; }
.month-nav .btn { min-width: 32px; padding: 0 10px; }
.month-panel { padding: 0; overflow: hidden; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow { padding: 10px 8px 8px; font-size: 13px; color: var(--muted); text-align: left; border-bottom: 1px solid var(--border); }
.cell { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 96px; padding: 8px; border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--surface); text-align: left; cursor: pointer; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.cell:nth-child(7n) { border-right: 0; }
.cell.pad { cursor: default; background: var(--surface); }
.cell.weekend { background: var(--raised); }
.cell.selected { background: var(--tint); }
.cell.today { border-top: 2px solid var(--accent); padding-top: 6px; }
.cell .n { font-size: 13px; line-height: 16px; color: var(--muted); }
.cell.today .n { color: var(--accent); font-weight: 600; }
.cell .titles { display: grid; gap: 2px; width: 100%; font-size: 13px; line-height: 16px; color: var(--text); }
.cell .titles span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .titles span > span:not(.stamps) { overflow: hidden; text-overflow: ellipsis; }
.cell .titles .due { color: var(--warning); }
.cell .titles .more { color: var(--faint); }
.cell .dots { display: none; gap: 3px; }
.cell .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cell .dots i.due { background: #d19a1b; }
.cell .dots i.plus { background: var(--control); }
#month-days { margin-top: var(--gap); }
#day-head { margin: 12px 0 0; }
/* the day a tapped cell points at */
.day.selected { background: var(--tint); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--radius-card); }
.day.selected + .day { border-top-color: transparent; }
.segmented.window button { padding: 0 8px; white-space: nowrap; }

/* the conflicts pill: green check when the sources agree, an amber mark with a count when they do not */
.conflicts { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 8px; border: 1px solid var(--control); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.conflicts svg { width: 15px; height: 15px; }
.conflicts .warn, .conflicts.warn .ok { display: none; }
.conflicts.warn .warn { display: block; color: #b45309; }
.conflicts.ok .ok { color: var(--positive); }
.conflicts.ok { cursor: default; }
.conflicts.warn { color: var(--text); }
.conflicts[aria-pressed="true"] { background: var(--pill-warning-bg); border-color: transparent; color: var(--pill-warning-ink); }
.conflicts:active { transform: scale(0.97); }
#view-search .conflicts { display: none; }
.conflict-list { margin: -4px 0 12px; padding: 4px 12px; border: 1px solid #fde68a; border-radius: var(--radius-card); background: var(--pill-warning-bg); }
.conflict-list .row { min-height: 40px; padding: 8px 0; }
.conflict-list .row + .row { border-top: 1px solid #fde68a; }
.conflict-list .what a { color: var(--text); }
.conflict-list .sub { color: var(--pill-warning-ink); }
:root[data-theme="dark"] .conflict-list { border-color: #4a3a12; background: var(--pill-warning-bg); }
:root[data-theme="dark"] .conflict-list .row + .row { border-color: #4a3a12; }
:root[data-theme="dark"] .conflicts.warn .warn { color: #e5a93b; }

/* the rail's month at a glance: the same grid, dots only, a tap opens the Month view on that day */
.mini-wrap { margin-bottom: var(--gap); }
.rail-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rail-nav .rail-head { margin: 0; }
.rail-nav span { display: inline-flex; gap: 4px; }
.mini-btn { height: 24px; min-width: 24px; padding: 0 6px; }
/* the rail follows the page on a desktop instead of scrolling away under the list */
@media (min-width: 861px) { .rail { position: sticky; top: 16px; max-height: calc(100vh - 16px); overflow: auto; } }
/* each title in a month cell carries its source stamps, smaller */
.cell .titles span { display: flex; align-items: center; gap: 6px; }
.cell .titles .stamps { gap: 2px; }
.cell .titles .stamps i { width: 14px; height: 14px; border-width: 1px; border-radius: 3px; font-size: 11px; }
.mini .cell { min-height: 44px; padding: 6px; }
.mini .cell .titles { display: none; }
.mini .cell .dots { display: flex; }
.mini .dow { padding: 8px 6px 6px; }

/* search */
.search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.search-row .input { flex: 1; height: 40px; min-width: 0; }
.search-row .btn { height: 40px; }
#search-count { margin-bottom: 8px; min-height: 16px; }
/* source pills: pressed = that source's items show; all three start on */
.src-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 12px; }
.src-pills .item { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; }
.src-pills button { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border: 1px solid var(--control); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer; transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.src-pills button[aria-pressed="true"] { background: var(--active); border-color: transparent; color: var(--accent-ink); }
.src-pills button:active { transform: scale(0.97); }
/* required: a stronger tint and a small lock */
.src-pills button .lock { display: none; width: 13px; height: 13px; margin-left: -2px; }
.src-pills button[data-lock="true"] { background: #b3cdeb; border-color: transparent; color: var(--accent-ink); }
.src-pills button[data-lock="true"] .lock { display: block; }
:root[data-theme="dark"] .src-pills button[data-lock="true"] { background: #244a75; color: #dbe9fb; }
.hint { margin: -6px 0 10px; }
.row.item.dated { grid-template-columns: 108px 64px minmax(0, 1fr) auto auto; }
.row.item.dated .when { color: var(--muted); font-size: 13px; }
.row.item.past .what, .row.item.past .when, .row.item.past .time { color: var(--faint); }
@media (max-width: 860px) {
  .row.item.dated { grid-template-columns: minmax(0, 1fr) auto auto; }
  .row.item.dated .when { grid-column: 1 / -1; order: -2; margin-bottom: -6px; }
}

/* press feedback on everything pressable; hover only where there is a pointer */
.btn, .cell, .tabbar a, .nav-item, .segmented button, details summary { -webkit-tap-highlight-color: transparent; }
.btn:active, .segmented button:active, .tabbar a:active { transform: scale(0.97); }
.cell:not(.pad):active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .what a:hover { text-decoration: underline; }
  .cell:not(.pad):hover { background: var(--raised); }
  .cell.selected:hover { background: var(--tint); }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  :root { --bar: 48px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 56px 0 16px; background: var(--ground); }
  .topbar .wordmark { font-size: 20px; }
  .topbar .brand .mark { height: 36px; }
  .topbar .brand { gap: 8px; }
  /* the chip gives way before the bar wraps: the words truncate, the tiles stay */
  .fresh-chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; min-width: 0; padding: 0 10px 0 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--fs-small); color: var(--muted); cursor: pointer; overflow: hidden; }
  .fresh-chip span { margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .brand { flex: none; }
  .fresh-chip.bad span { color: var(--negative); }
  .fresh-chip.stale span { color: var(--warning); }
  .canvas { padding: 8px 16px calc(72px + env(safe-area-inset-bottom)); }
  .title-row { margin-bottom: 12px; }
  .title-row h1 { font-size: 24px; }
  .title-row .segmented { flex-basis: 100%; }
  .two-col { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .mini-wrap { display: none; }
  /* on a phone the notices come before the list, the newest few */
  .rail { order: -1; }
  .rail .rail-head { margin-bottom: 6px; }
  .day { grid-template-columns: 62px minmax(0, 1fr); gap: 10px; padding: 10px 0; }
  .date { grid-template-columns: 1fr; row-gap: 0; }
  .dname { display: flex; gap: 4px; padding-top: 2px; }
  .row.item { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 10px; padding: 6px 0; }
  .row.item .time { grid-column: 1 / -1; order: -1; margin-bottom: -8px; }
  .row.item .time:empty { display: none; }
  .cell { min-height: 56px; padding: 6px; }
  .cell.today { padding-top: 4px; }
  .cell .titles { display: none; }
  .cell .dots { display: flex; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr); height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: var(--fs-small); color: var(--muted); transition: transform var(--t-press) var(--ease-out); }
  .tabbar a svg { width: 20px; height: 20px; stroke-width: 1.5; }
  .tabbar a[aria-current="page"] { color: var(--accent); font-weight: 500; }
}

/* the notices section header: a button that opens and closes it, with the count in a pill */
.notices-head { margin: 0 0 8px; }
.notices-head button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.notices-head .chev { flex: none; color: var(--muted); transition: transform var(--t-ui) var(--ease-out); }
.notices-head button[aria-expanded="true"] .chev { transform: rotate(90deg); }
.notices-head .count { min-width: 20px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--active); color: var(--accent-ink); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.notices-head .count:empty { display: none; }
#notices[hidden] { display: none; }

/* event names read first: semi-bold in every list (Upcoming, the Month list, Search) */
.row.item .what { font-weight: 500; }
.row.item .what .note, .row.item .what .sub { font-weight: 400; }

/* Bolder text (Settings): every weight steps up one, for eyes that find the regular cut too light */
:root[data-weight="bolder"] body { font-weight: 500; }
:root[data-weight="bolder"] .row.item .what,
:root[data-weight="bolder"] details summary .what,
:root[data-weight="bolder"] .month-head h2,
:root[data-weight="bolder"] .rail-head,
:root[data-weight="bolder"] .notices-head button { font-weight: 600; }
:root[data-weight="bolder"] .row.item .what .note,
:root[data-weight="bolder"] .row.item .what .sub { font-weight: 500; }
:root[data-weight="bolder"] .title-row h1 { font-weight: 700; }
:root[data-weight="bolder"] .muted, :root[data-weight="bolder"] .time, :root[data-weight="bolder"] .dname { color: var(--text); }

/* public copy: a notice is a link out to nForma, laid out like the expandable row */
.notice-link { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 12px; align-items: start; min-height: 44px; padding: 10px 0; border-top: 1px solid var(--rule); color: var(--text); text-decoration: none; }
.notice-link:first-child { border-top: 0; }
.notice-link .when { color: var(--muted); font-size: 13px; padding-top: 1px; }
.notice-link .out { color: var(--accent-ink); font-size: 12px; white-space: nowrap; padding-top: 2px; }
@media (hover: hover) and (pointer: fine) { .notice-link:hover .what { text-decoration: underline; text-underline-offset: 3px; } }
