/* Neverblate — white and grey, flat, quiet. Left sidebar, content on a soft grey canvas, white panels with hairline borders. */
:root {
  --canvas: #f7f7f8;
  --surface: #ffffff;
  --sunken: #f3f3f5;
  --hover: #f0f0f2;
  --line: #e6e6ea;
  --line-2: #d6d6dc;
  --fg: #17171a;
  --fg-2: #3c3c43;
  --muted: #6e6e78;
  --faint: #a0a0aa;
  --ink: #1f1f23;
  --ink-fg: #ffffff;
  --focus: #17171a;
  --red: #b42318; --red-bg: #fdf0ef;
  --amber: #a15c07; --amber-bg: #fdf6e7;
  --green: #18794e; --green-bg: #edf7f1;
  --r: 6px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--fg); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.95em; }
.r { text-align: right; }
.eyebrow { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.err-text { color: var(--red); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.loading { padding: 80px 24px; text-align: center; color: var(--muted); }
.ic { width: 18px; height: 18px; flex: none; }
.ic.sm { width: 14px; height: 14px; }
.ic.xs { width: 12px; height: 12px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px 12px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.03em; padding: 0 8px; }
.brand.lg { font-size: 22px; padding: 0; margin-bottom: 18px; }
.brand.sm { font-size: 15px; }
.logo { width: 20px; height: 20px; border-radius: 5px; background: var(--ink); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 5px 5px; border: 2px solid var(--ink-fg); border-top: 0; border-right: 0; transform: skewX(-12deg); }
.org-name { color: var(--muted); font-size: 12.5px; padding: 2px 8px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: grid; gap: 1px; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); text-decoration: none; color: var(--fg-2); font-weight: 500; }
.nav a:hover { background: var(--hover); color: var(--fg); }
.nav a.on { background: var(--sunken); color: var(--fg); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.nav a .ic { color: var(--muted); }
.nav a.on .ic { color: var(--fg); }
.count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--ink); color: var(--ink-fg); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
h2 .count, .subnav .count { margin-left: 6px; display: inline-block; vertical-align: 1px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 9px; padding: 0 4px; min-width: 0; }
.me .grow { min-width: 0; display: grid; }
.me b { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-switch { width: 100%; }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.mtop { display: none; }
.main { padding: 24px 28px 64px; min-width: 0; }
.scrim { display: none; }
.demo-bar { background: var(--sunken); border-bottom: 1px solid var(--line); padding: 7px 28px; font-size: 12.5px; color: var(--fg-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.demo-bar select { padding: 3px 8px; height: auto; width: auto; }

/* ---------- page scaffolding ---------- */
.page { display: grid; gap: 16px; max-width: 1600px; margin: 0 auto; }
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.phead p { margin-top: 3px; }
.phead-r { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-top: -6px; }
.subnav a { padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; }
.subnav a:hover { color: var(--fg); }
.subnav a.on { color: var(--fg); border-bottom-color: var(--fg); font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-width: 0; }
.panel > h2 { margin-bottom: 12px; display: flex; align-items: center; }
.panel.flush { padding: 0; }
.panel.narrow { max-width: 720px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 16px; align-items: start; }
.cols.eq { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.col-main, .col-side { display: grid; gap: 16px; min-width: 0; }
.cols > .col-side.first { order: -1; }
.cols:has(> .col-side.first) { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.c-full { grid-column: 1 / -1; }
.empty { color: var(--muted); padding: 14px 0; display: grid; gap: 10px; }
.empty-row { color: var(--muted); padding: 22px 14px !important; text-align: center; }
.hint { color: var(--faint); font-size: 12.5px; }
.pad { padding: 14px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--fg); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-fg); }
.btn.primary:hover { background: #33333a; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.icon { width: 34px; padding: 0; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.sm.icon { width: 28px; }
.btn.danger { color: var(--red); }
.btn.armed { background: var(--red); border-color: var(--red); color: #fff; }
.btn.on { background: var(--sunken); border-color: var(--fg-2); }
.btn.full { width: 100%; }
.btn.filter { color: var(--fg-2); }
.btn.filter.on { border-color: var(--fg); color: var(--fg); }
.btn .count { margin-left: 2px; }
.link { background: none; border: 0; padding: 0; color: var(--fg-2); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: 13px; justify-self: start; }
.btn-pair { display: inline-flex; }
.btn-pair .btn:first-child { border-radius: var(--r) 0 0 var(--r); }
.btn-pair .btn:last-child { border-radius: 0 var(--r) var(--r) 0; margin-left: -1px; }
.seg { display: inline-flex; padding: 2px; background: var(--sunken); border: 1px solid var(--line); border-radius: 7px; gap: 2px; }
.seg button, .seg label { border: 0; background: none; padding: 4px 11px; border-radius: 5px; font-weight: 500; color: var(--muted); cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.seg button.on, .seg label:has(input:checked) { background: var(--surface); color: var(--fg); box-shadow: 0 0 0 1px var(--line-2); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg.full { display: flex; }
.seg.full > * { flex: 1; justify-content: center; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]), select, textarea, .field-input {
  height: 34px; width: 100%; min-width: 0; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); }
textarea, textarea.field-input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px rgba(23, 23, 26, .08); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 15px; height: 15px; margin: 0; }
input[type="color"] { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); cursor: pointer; }
select { padding-right: 28px; }
.toolbar select, .toolbar input, .tb-group select { width: auto; }
.search { width: 240px !important; }
.field { display: grid; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--fg-2); min-width: 0; }
.field > span { font-weight: 500; }
.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--fg); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 2px; }
.stack { display: grid; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-inline select { width: auto; }
.sp { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; } .c12 { grid-column: span 12; }
.pill { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 500; background: var(--sunken); color: var(--fg-2); border: 1px solid var(--line); white-space: nowrap; text-transform: capitalize; }
.pill.ok { background: var(--green-bg); color: var(--green); border-color: transparent; }
.pill.bad { background: var(--red-bg); color: var(--red); border-color: transparent; }
.pill.wait { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.pill.dark { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--faint)); margin-right: 6px; flex: none; vertical-align: 0; }
.av { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--sunken); border: 1px solid var(--line); display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 600; color: var(--fg-2); letter-spacing: .02em; }
.av.lg { width: 54px; height: 54px; font-size: 18px; }

/* ---------- toolbar & stats ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.tb-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-title { font-size: 18px; font-weight: 600; margin-left: 6px; font-variant-numeric: tabular-nums; }
.inline-sel { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.stat { padding: 12px 16px; display: grid; gap: 2px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat small { color: var(--muted); font-size: 12px; }
.stat.warn b { color: var(--amber); }
.budgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 20px; padding: 2px 2px; }
.budget { display: grid; gap: 5px; font-size: 12.5px; }
.b-top { display: flex; justify-content: space-between; gap: 8px; color: var(--fg-2); }
.bar { height: 4px; background: var(--sunken); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--fg-2); }
.budget.over .bar i { background: var(--red); }
.budget.over .num { color: var(--red); }

/* ---------- week grid ---------- */
.grid-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table.wgrid { width: 100%; min-width: 1100px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.wgrid th, .wgrid td { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.wgrid thead th { background: var(--surface); padding: 10px 10px 9px; text-align: left; font-weight: 500; position: sticky; top: 0; z-index: 1; }
.wgrid thead th.today { background: var(--sunken); }
.wgrid .dw { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wgrid .dn { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.wgrid thead th.today .dn { display: inline-grid; place-items: center; min-width: 30px; height: 30px; margin-left: -4px; border-radius: 15px; background: var(--ink); color: var(--ink-fg); font-size: 16px; }
.wgrid .dh { display: block; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.wgrid .rh { position: sticky; left: 0; z-index: 2; background: var(--surface); width: 210px; text-align: left; padding: 10px 12px; vertical-align: top; border-left: 0; font-weight: 400; }
.wgrid thead .rh { z-index: 3; font-size: 12px; color: var(--muted); vertical-align: bottom; }
.rh-name { font-weight: 600; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-meter { height: 3px; background: var(--sunken); border-radius: 2px; margin: 6px 0 3px; overflow: hidden; }
.rh-meter i { display: block; height: 100%; background: var(--fg-2); }
.rh-meter.over i { background: var(--red); }
.wgrid td { vertical-align: top; padding: 5px; height: 74px; cursor: default; }
.wgrid td[data-a] { cursor: copy; }
.wgrid td[data-a]:hover { background: #fbfbfc; }
.wgrid td.today { background: #fafafb; }
.wgrid tbody tr:last-child > * { border-bottom: 0; }
.open-row .rh, .open-row td { background: #fcfcfc; }
.drop { outline: 2px dashed var(--fg-2); outline-offset: -3px; background: var(--sunken) !important; }

/* shift card */
.sc { display: grid; gap: 1px; width: 100%; text-align: left; padding: 6px 8px; margin-bottom: 4px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--surface); cursor: pointer; position: relative; font-size: 12px; line-height: 1.35; box-shadow: 0 1px 0 rgba(0,0,0,.03); }
.sc:hover { border-color: var(--fg-2); }
.sc[draggable="true"] { cursor: grab; }
.sc-t { font-weight: 600; font-variant-numeric: tabular-nums; padding-right: 16px; }
.sc-l, .sc-w { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.sc-w { color: var(--fg-2); }
.sc-badges { position: absolute; top: 5px; right: 5px; display: flex; gap: 3px; }
.sc-badges em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; }
.sc-badges em.warn, .sc-badges em.err { width: 15px; height: 15px; border-radius: 50%; justify-content: center; color: #fff; background: var(--amber); }
.sc-badges em.err { background: var(--red); }
.sc.draft { border-style: dashed; background: repeating-linear-gradient(135deg, #fff 0 6px, #f7f7f8 6px 12px); }
.sc.draft .sc-badges em:first-child:not(.warn):not(.err) { text-transform: uppercase; letter-spacing: .05em; }
.sc.open { background: var(--sunken); }
.sc.open .sc-w { color: var(--fg); font-weight: 500; }
.sc.mine { border-color: var(--fg); box-shadow: inset 2px 0 0 var(--fg); }
.sc.off { background: repeating-linear-gradient(45deg, #eeeef1 0 5px, #f6f6f8 5px 10px); border-color: var(--line); cursor: default; color: var(--muted); }
.sc.off .sc-t { color: var(--fg-2); }
.sc.off.pending { border-style: dashed; }
.sc.dragging { opacity: .35; }
.un { font-size: 11px; color: var(--muted); padding: 2px 6px; margin-bottom: 4px; border-left: 2px solid var(--line-2); }

/* list (agenda) view */
.agenda { display: grid; gap: 10px; }
.ag-day { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ag-day.today { border-color: var(--fg); }
.ag-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ag-d { font-weight: 600; }
.ag-h .btn { margin-left: auto; }
.ag-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.ag-items .sc { margin: 0; }

/* month grid */
.mgrid-wrap { overflow-x: auto; }
.mgrid { min-width: 980px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mhead { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.mhead div { padding: 9px 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; text-align: center; }
.mbody { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mcell { min-height: 128px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.mcell:nth-child(7n) { border-right: 0; }
.mcell[data-a] { cursor: copy; }
.mcell[data-a]:hover { background: #fbfbfc; }
.mcell.other { background: #fafafa; }
.mcell.other .mnum { color: var(--faint); }
.mnum { font-size: 13px; font-weight: 500; padding: 1px 4px 5px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.mcell.today .mnum { color: var(--ink-fg); }
.mcell.today .mnum::before { content: ""; }
.mcell.today .mnum { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; margin-bottom: 4px; border-radius: 12px; background: var(--ink); }

/* ---------- modal ---------- */
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--fg); box-shadow: 0 24px 60px rgba(15, 15, 20, .18); }
dialog.wide { width: min(760px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(20, 20, 24, .32); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.m-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.m-head h2 { flex: 1; font-size: 16px; }
.m-body { padding: 16px 18px; overflow-y: auto; display: grid; gap: 14px; }
.m-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.summary { display: flex; gap: 20px; flex-wrap: wrap; padding: 10px 12px; background: var(--sunken); border-radius: var(--r); font-size: 13px; color: var(--fg-2); }
.summary b { font-family: var(--mono); font-weight: 500; color: var(--fg); }
.summary:empty { display: none; }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.issues li { padding: 7px 10px; border-radius: var(--r); font-size: 13px; background: var(--amber-bg); color: #5c3a06; }
.issues li.error { background: var(--red-bg); color: #7a1a12; }
.note { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--sunken); font-size: 13px; display: grid; gap: 6px; }
.sec { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.sec-h { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.m-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.m-row:last-child { border-bottom: 0; }
.m-row > span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.m-list { display: grid; }
.tpl-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.chip-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 14px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.chip-btn:hover { background: var(--hover); }
.dl { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.copy-row { display: flex; gap: 6px; }
.doc-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.doc-add input[type="file"] { grid-column: span 2; font-size: 12.5px; }

/* popover & toast */
.pop { position: absolute; z-index: 60; min-width: 220px; max-width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(15, 15, 20, .14); padding: 6px; }
.pop-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pop-search { margin: 2px 0 6px; }
.pop-list { max-height: 300px; overflow-y: auto; display: grid; }
.pop-list .chk { padding: 6px 8px; border-radius: 5px; }
.pop-list .chk:hover { background: var(--hover); }
.menu { display: grid; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-item { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 5px; cursor: pointer; }
.menu-item:hover { background: var(--hover); }
.menu-note { font-size: 12px; color: var(--muted); padding: 6px 10px; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--ink-fg); padding: 10px 16px; border-radius: 8px; font-weight: 500; font-size: 13.5px; transition: .18s; z-index: 100; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); }

/* ---------- lists & tables ---------- */
.item { display: flex; align-items: center; gap: 10px 14px; padding: 11px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.panel > h2 + .item, .group-h + .item, .item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 220px; display: grid; gap: 3px; }
.item .grow .av { margin-right: 8px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.warn-line { font-size: 12.5px; color: var(--amber); }
.err-line { font-size: 12.5px; color: var(--red); }
.group { padding: 4px 0 8px; }
.group + .group { border-top: 1px solid var(--line); padding-top: 12px; }
.group-h { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 4px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fbfbfc; }
.tbl.compact td, .tbl.compact th { padding: 7px 8px; }
.tbl.edit td { padding: 6px; }
.tbl.edit input { height: 30px; }
.tbl td.actions { white-space: nowrap; flex-wrap: nowrap; display: table-cell; }
.tbl td.actions .btn { margin-left: 4px; }
.tbl tr.missing td { background: #fcfbf8; }
.panel.flush .tbl th:first-child, .panel.flush .tbl td:first-child { padding-left: 18px; }
.who { display: flex; align-items: center; gap: 10px; }
.tag { display: inline-flex; align-items: center; font-size: 12.5px; margin-right: 8px; white-space: nowrap; }
.plain { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--fg-2); font-size: 13px; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.day { cursor: pointer; }
.day input { position: absolute; opacity: 0; }
.day span { display: grid; place-items: center; width: 36px; height: 32px; border: 1px solid var(--line-2); border-radius: var(--r); font-size: 12.5px; font-weight: 500; }
.day input:checked + span { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.day input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.side-list { display: grid; gap: 1px; }
.side-list a { padding: 7px 10px; border-radius: var(--r); text-decoration: none; color: var(--fg-2); }
.side-list a:hover { background: var(--hover); }
.side-list a.on { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; color: var(--fg); }
.pos-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 110px auto auto; gap: 8px; align-items: center; padding: 5px 0; }
.pos-row.lt { grid-template-columns: minmax(0, 1fr) 110px auto auto auto; }
.add-row { margin-top: 12px; }
.add-row input { max-width: 260px; }
.sales-tbl { max-height: 420px; overflow-y: auto; margin-top: 10px; }
.num-in { width: 110px !important; height: 30px !important; text-align: right; font-family: var(--mono); }

/* home */
.announce { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--fg); border-radius: 8px; }
.announce .grow { flex: 1; display: grid; gap: 4px; }
.announce p { color: var(--fg-2); }
.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 6px; border-radius: var(--r); cursor: pointer; text-decoration: none; color: inherit; }
.row-btn:hover { background: var(--hover); }
.row-btn .grow { flex: 1; display: grid; gap: 1px; min-width: 0; }
.row-btn .grow .small { display: flex; align-items: center; }
.date-chip { width: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r); padding: 3px 0; font-size: 11px; color: var(--muted); text-transform: uppercase; line-height: 1.15; }
.date-chip b { font-size: 16px; color: var(--fg); }

/* time clock */
.clock-card { display: grid; gap: 16px; }
.clock-state { display: flex; gap: 14px; align-items: center; }
.state-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line-2); flex: none; }
.state-dot.on { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.state-dot.brk { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-bg); }
.clock-big { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.clock-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.clock-actions .btn { height: 42px; padding: 0 18px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { padding-left: 14px; border-left: 2px solid var(--line); display: grid; gap: 2px; }

/* kiosk */
body.kiosk-mode .side, body.kiosk-mode .mtop, body.kiosk-mode .demo-bar { display: none; }
body.kiosk-mode .app { grid-template-columns: minmax(0, 1fr); }
.kiosk { max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; }
.k-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.k-time { font-size: 48px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.k-right { display: flex; gap: 8px; }
.k-right select { width: auto; }
.k-hint { color: var(--muted); }
.k-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.k-person { display: grid; justify-items: center; gap: 6px; padding: 20px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.k-person:hover { border-color: var(--fg-2); }
.k-name { font-weight: 600; font-size: 15px; text-align: center; }
.k-sub { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.k-state { font-size: 12px; padding: 2px 9px; border-radius: 10px; background: var(--sunken); color: var(--muted); }
.k-state.on { background: var(--green-bg); color: var(--green); }
.k-state.brk { background: var(--amber-bg); color: var(--amber); }
.pin { font-size: 24px !important; height: 52px !important; letter-spacing: .4em; text-align: center; font-family: var(--mono); }

/* messages */
.chat { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - 170px); min-height: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.threads { border-right: 1px solid var(--line); overflow-y: auto; }
.thread { display: flex; gap: 10px; padding: 12px 14px; text-decoration: none; border-bottom: 1px solid var(--line); align-items: center; }
.thread:hover { background: var(--hover); }
.thread.on { background: var(--sunken); }
.t-main { flex: 1; min-width: 0; display: grid; }
.t-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-last { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-time { color: var(--faint); font-size: 11.5px; align-self: flex-start; white-space: nowrap; }
.thread.unread .t-name { font-weight: 700; }
.thread.unread .t-time::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); margin-right: 6px; vertical-align: 1px; }
.convo { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.c-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.c-head .back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg { display: grid; justify-items: start; max-width: 72%; gap: 2px; }
.msg.me { align-self: flex-end; justify-items: end; }
.bubble { padding: 8px 12px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--line); overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.m-who { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.m-time { font-size: 11px; color: var(--faint); padding: 0 4px; }
.day-sep { align-self: center; font-size: 11.5px; color: var(--muted); padding: 8px 0 2px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { min-height: 38px; max-height: 160px; }
.center-msg { margin: auto; }
.pick-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 4px; display: grid; }
.pick-list .chk { padding: 6px 8px; border-radius: 5px; }
.pick-list .chk:hover { background: var(--hover); }

/* newsfeed & tasks */
.composer-post { display: grid; gap: 8px; }
.post { display: grid; gap: 8px; }
.post.ann { border-color: var(--fg); }
.post-h { display: flex; align-items: center; gap: 10px; }
.post-h .grow { flex: 1; }
.post-body { color: var(--fg-2); white-space: normal; max-width: 70ch; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.task { display: grid; gap: 10px; }
.task.is-done { opacity: .65; }
.task-h { display: flex; gap: 8px; align-items: flex-start; }
.task-h .grow { flex: 1; display: grid; gap: 3px; }
.checklist { display: grid; gap: 6px; }
.task.is-done .checklist span { text-decoration: line-through; color: var(--muted); }
.task-mini { display: grid; gap: 6px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 32px 16px; gap: 16px; }
.auth-card { width: min(400px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 14px; }
.auth-card h1 { font-size: 20px; }
.auth-foot { color: var(--muted); font-size: 12.5px; text-align: center; }
.auth-msg { padding: 9px 12px; background: var(--sunken); border-radius: var(--r); font-size: 13px; }
.auth-group { display: grid; gap: 6px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; text-align: left; }
.person:hover { background: var(--hover); border-color: var(--line-2); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cols, .cols.eq, .cols:has(> .col-side.first) { grid-template-columns: minmax(0, 1fr); }
  .cols > .col-side.first { order: 0; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 50; transform: translateX(-100%); transition: transform .2s; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20,20,24,.3); z-index: 40; }
  .mtop { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; }
  .main { padding: 18px 16px 56px; }
  .demo-bar { padding: 7px 16px; }
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 150px); }
  .chat.has-thread .threads { display: none; }
  .chat:not(.has-thread) .convo { display: none; }
  .c-head .back { display: inline-flex; }
  .msg { max-width: 88%; }
}
@media (max-width: 640px) {
  h1 { font-size: 20px; }
  .form-grid .c3, .form-grid .c4 { grid-column: span 6; }
  .form-grid .c6 { grid-column: span 12; }
  .tb-title { font-size: 16px; width: 100%; margin: 4px 0 0; order: 5; }
  .search { width: 100% !important; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .wgrid .rh { width: 150px; }
  .k-time { font-size: 36px; }
  .doc-add { grid-template-columns: minmax(0, 1fr); }
  .doc-add input[type="file"] { grid-column: auto; }
  .pos-row, .pos-row.lt { grid-template-columns: 34px minmax(0, 1fr) 90px; }
  .pos-row.lt { grid-template-columns: minmax(0, 1fr) 90px; }
  .dl { grid-template-columns: 80px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
