/* Toadmaster app styles. Light theme only. Six studio palettes chosen by the owner; "toad" is Toadmaster's own, taken from the logo. */

:root, [data-palette="toad"] {
  --lead: #4D694E;
  --second: #4D694E;
  --page: #FFF3D5;
  --ink: color-mix(in oklab, #4D694E 40%, oklch(0.16 0.01 140));
}
/* Studio palettes (owner's choice). Two- and three-colour sets get a dark ink made from their lead colour. */
[data-palette="forest"] { --lead: #235347; --second: #8EB69B; --page: #DAF1DE; --ink: #051F20; }
[data-palette="bloodstone"] { --lead: #5D0D18; --second: #9FB2AC; --page: #FFF9EB; --ink: color-mix(in oklab, #5D0D18 35%, oklch(0.17 0.01 20)); }
[data-palette="emerald"] { --lead: #134E43; --second: #C8A96A; --page: #F7F6F1; --ink: #0F3D34; }
[data-palette="wine"] { --lead: #7F011F; --second: #7F011F; --page: #F5EBD0; --ink: color-mix(in oklab, #7F011F 35%, oklch(0.17 0.01 20)); }
[data-palette="venice"] { --lead: #16587B; --second: #84B3CE; --page: #F5EEDD; --ink: color-mix(in oklab, #16587B 40%, oklch(0.16 0.01 240)); }
[data-palette="olive"] { --lead: #4D694E; --second: #4D694E; --page: #FFF3D5; --ink: color-mix(in oklab, #4D694E 40%, oklch(0.16 0.01 140)); }

:root {
  --surface: color-mix(in oklab, var(--page) 30%, oklch(0.997 0.002 250));
  --rail: color-mix(in oklab, var(--page) 92%, var(--lead));
  --line: color-mix(in oklab, var(--ink) 11%, var(--page));
  --line-strong: color-mix(in oklab, var(--ink) 22%, var(--page));
  --muted: color-mix(in oklab, var(--ink) 72%, var(--page));
  --faint: color-mix(in oklab, var(--ink) 46%, var(--page));
  --hover: color-mix(in oklab, var(--ink) 5%, transparent);
  --press: color-mix(in oklab, var(--ink) 9%, transparent);
  --lead-ink: oklch(0.985 0.004 260);
  --lead-hover: color-mix(in oklab, var(--lead) 88%, var(--ink));
  --lead-soft: color-mix(in oklab, var(--lead) 10%, var(--surface));
  --lead-line: color-mix(in oklab, var(--lead) 38%, var(--surface));
  --second-soft: color-mix(in oklab, var(--second) 22%, var(--surface));
  --second-mark: color-mix(in oklab, var(--second) 85%, var(--ink));
  /* Due and late read the same in every palette. */
  --due: oklch(0.5 0.115 68);
  --due-soft: oklch(0.955 0.05 88);
  --late: oklch(0.5 0.19 27);
  --late-soft: oklch(0.955 0.03 25);
  --shadow: 0 1px 2px color-mix(in oklab, var(--ink) 8%, transparent), 0 8px 24px color-mix(in oklab, var(--ink) 8%, transparent);
  --shadow-lg: 0 2px 6px color-mix(in oklab, var(--ink) 10%, transparent), 0 24px 64px color-mix(in oklab, var(--ink) 16%, transparent);

  --font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Bricolage Grotesque", var(--font-ui);
  --t-xs: 0.75rem; --t-sm: 0.8125rem; --t-base: 0.875rem; --t-md: 1rem; --t-lg: 1.1875rem; --t-xl: 1.4375rem; --t-2xl: 1.75rem;
  --r-sm: 6px; --r: 9px; --r-lg: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rail-w: 84px; --top-h: 60px; --ctl-h: 38px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 var(--t-base)/1.5 var(--font-ui); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; margin: 0; }
h1 { font-size: var(--t-xl); } h2 { font-size: var(--t-lg); } h3 { font-size: var(--t-md); font-family: var(--font-ui); font-weight: 600; letter-spacing: 0; }
p { margin: 0 0 0.75em; max-width: 70ch; }
a { color: var(--lead); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lead); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--lead-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }

/* ── Shell ── */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; grid-template-rows: var(--top-h) 1fr; min-height: 100dvh; }
.rail {
  grid-row: 1 / 3; background: var(--rail); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: stretch; padding: 12px 8px; gap: 2px;
  position: sticky; top: 0; height: 100dvh;
}
.rail-mark { display: grid; place-items: center; height: 44px; margin-bottom: 10px; color: var(--lead); }
.rail-mark img { width: 38px; height: 38px; }
.rail a {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 7px;
  border-radius: var(--r); color: var(--muted); text-decoration: none; font-size: 0.6875rem; font-weight: 550;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.rail a .ic { display: grid; place-items: center; width: 40px; height: 28px; border-radius: 999px; transition: background-color 160ms var(--ease); }
.rail a:hover { color: var(--ink); }
.rail a:hover .ic { background: var(--hover); }
.rail a[aria-current="page"] { color: var(--lead); }
.rail a[aria-current="page"] .ic { background: var(--lead-soft); }
.rail .rail-end { margin-top: auto; }

.top {
  grid-column: 2; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  border-bottom: 1px solid var(--line); background: var(--page); position: sticky; top: 0; z-index: 20;
}
.top h1 { font-size: var(--t-xl); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .studio-name { color: var(--muted); font-size: var(--t-sm); white-space: nowrap; }
.search-btn {
  margin-left: auto; display: flex; align-items: center; gap: 8px; height: var(--ctl-h); min-width: 240px;
  padding: 0 10px 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface);
  color: var(--muted); cursor: pointer; text-align: left;
}
.search-btn:hover { border-color: var(--faint); }
.search-btn kbd { margin-left: auto; font: 500 var(--t-xs) var(--font-ui); padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); }
main.view { grid-column: 2; padding: 24px; min-width: 0; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head p { margin: 4px 0 0; color: var(--muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--ctl-h); padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink);
  font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.btn:hover { background: color-mix(in oklab, var(--surface), var(--ink) 4%); }
.btn:active { background: color-mix(in oklab, var(--surface), var(--ink) 8%); }
.btn-lead { background: var(--lead); border-color: var(--lead); color: var(--lead-ink); }
.btn-lead:hover { background: var(--lead-hover); border-color: var(--lead-hover); }
.btn-lead:active { background: color-mix(in oklab, var(--lead), var(--ink) 22%); }
.btn-quiet { background: transparent; border-color: transparent; }
.btn-quiet:hover { background: var(--hover); }
.btn-danger { color: var(--late); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--t-sm); }
.btn-icon { width: var(--ctl-h); padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin 700ms linear infinite;
}
.btn-lead[aria-busy="true"]::after { border-color: var(--lead-ink) transparent var(--lead-ink) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ── */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .label { font-size: var(--t-sm); font-weight: 600; }
.field .hint { font-size: var(--t-xs); color: var(--muted); font-weight: 400; }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; height: var(--ctl-h); padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.field textarea { height: auto; min-height: 92px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23777' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--lead); box-shadow: 0 0 0 3px var(--lead-soft); }
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: var(--faint); }
.field.bad input, .field.bad select, .field.bad textarea { border-color: var(--late); }
.field .err { font-size: var(--t-xs); color: var(--late); }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--lead); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-foot { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; }
fieldset { border: 0; padding: 0; margin: 0; }
.money-in { position: relative; }
.money-in > b { position: absolute; left: 11px; top: 50%; translate: 0 -50%; color: var(--muted); font-weight: 500; pointer-events: none; }
.money-in input { padding-left: 26px !important; text-align: right; }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: var(--r); background: color-mix(in oklab, var(--page), var(--ink) 6%); gap: 2px; }
.seg button, .seg label { border: 0; background: transparent; padding: 0 12px; height: 30px; border-radius: 7px; cursor: pointer; font-weight: 550; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg [aria-pressed="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px color-mix(in oklab, var(--ink) 12%, transparent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--lead); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 9px 12px; border: 0; background: none; color: var(--muted); text-decoration: none; font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--ink); border-bottom-color: var(--lead); }

/* Tags and status words (always a word, never colour alone) */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; background: var(--hover); color: var(--muted); white-space: nowrap; }
.tag-lead { background: var(--lead-soft); color: var(--lead); }
.tag-second { background: var(--second-soft); color: var(--ink); }
.tag-due { background: var(--due-soft); color: var(--due); }
.tag-late { background: var(--late-soft); color: var(--late); }
.tag-ink { background: var(--ink); color: var(--page); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* ── Panels, lists, tables ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-pad { padding: 18px; }
.section + .section, .ledger + .section, .notice + .section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list > li.clickable { cursor: pointer; transition: background-color 120ms var(--ease); }
.list > li.clickable:hover { background: var(--hover); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--t-xs); font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--hover); }
.table .r { text-align: right; }
.table-wrap { overflow-x: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: var(--t-sm); }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; font-size: var(--t-sm); }
.totals .big { font-size: var(--t-md); font-weight: 700; }
.bar { height: 6px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--lead); border-radius: inherit; }

/* ── Boards ── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(264px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; scroll-snap-type: x proximity; }
.col { background: color-mix(in oklab, var(--page), var(--ink) 3%); border-radius: var(--r-lg); padding: 10px; min-height: 120px; scroll-snap-align: start; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 600; }
.col-head .count { font-size: var(--t-xs); color: var(--muted); font-weight: 600; }
.col-body { display: flex; flex-direction: column; gap: 8px; }
.tile {
  display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 12px; cursor: pointer; color: inherit; text-decoration: none;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.tile .t { font-weight: 600; }
.tile .m { margin-top: 3px; font-size: var(--t-sm); color: var(--muted); }
.tile .f { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.col-empty { padding: 14px 8px; color: var(--faint); font-size: var(--t-sm); text-align: center; }

/* ── Drawer (records open beside the list) ── */
.scrim { position: fixed; inset: 0; background: color-mix(in oklab, var(--ink) 16%, transparent); opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease); z-index: 40; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 50;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(104%);
  transition: transform 240ms var(--ease); visibility: hidden;
}
.drawer.on { transform: none; visibility: visible; }
.drawer.wide { width: min(980px, 100vw); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; overscroll-behavior: contain; }
.drawer-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.drawer-foot .left { margin-right: auto; }

/* ── Dialog, toast, palette ── */
dialog.dlg { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); width: min(440px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: color-mix(in oklab, var(--ink) 22%, transparent); }
.dlg-body { padding: 20px 20px 8px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.toasts { position: fixed; left: 50%; top: 14px; translate: -50% 0; display: flex; flex-direction: column; gap: 8px; z-index: 90; pointer-events: none; }
.toast { background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: var(--r); box-shadow: var(--shadow-lg); font-weight: 500; animation: toast-in 220ms var(--ease); max-width: min(480px, calc(100vw - 32px)); }
.toast.bad { background: var(--late); color: oklch(0.985 0.01 25); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
dialog.palette { margin-top: 12vh; width: min(560px, calc(100vw - 24px)); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font-size: var(--t-md); background: transparent; outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.palette li a[aria-selected="true"], .palette li a:hover { background: var(--lead-soft); }
.palette li .k { margin-left: auto; color: var(--muted); font-size: var(--t-xs); }
.menu { position: absolute; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 5px; z-index: 60; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-sm); text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; }
.menu button:hover, .menu a:hover, .menu :focus-visible { background: var(--hover); outline: none; }

/* ── Empty and loading states ── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 20px; gap: 6px; color: var(--muted); }
.empty .toad { width: 76px; height: 76px; margin-bottom: 6px; }
.empty h3 { color: var(--ink); font-family: var(--font-head); font-size: var(--t-lg); font-weight: 650; }
.empty p { max-width: 44ch; margin: 0 0 8px; }
.sk { border-radius: var(--r); background: color-mix(in oklab, var(--page), var(--ink) 6%); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.sk-line { height: 14px; margin: 8px 0; } .sk-block { height: 120px; }

/* ── Palette chooser ── */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.swatch { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--lead); outline-offset: 2px; }
.swatch .chips { display: flex; height: 36px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); }
.swatch .chips i { flex: 1; }
.swatch b { font-weight: 600; font-size: var(--t-sm); }

/* ── Setup and sign-in ── */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(300px, 0.9fr) 1.1fr; }
.auth-side { background: var(--lead); color: var(--lead-ink); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .brand-logo { width: 168px; height: auto; }
.auth-side .credit { display: block; margin-top: 6px; }
.auth-side .credit a { color: inherit; text-underline-offset: 2px; }
.credit-line { margin: 40px 0 8px; font-size: var(--t-xs); color: var(--muted); }
.credit-line a { color: inherit; text-underline-offset: 2px; }
.auth-side .line { font-family: var(--font-head); font-size: clamp(1.75rem, 3.2vw, 2.6rem); font-weight: 650; line-height: 1.1; max-width: 14ch; letter-spacing: -0.02em; }
.auth-side small { opacity: 0.8; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-form { width: min(380px, 100%); }
.auth-form h1 { font-size: var(--t-2xl); margin-bottom: 6px; }
.auth-form > p { color: var(--muted); margin-bottom: 22px; }
.auth-form .field { margin-bottom: 14px; }
.auth-form .btn { width: 100%; height: 44px; margin-top: 6px; }
.notice { padding: 10px 12px; border-radius: var(--r); background: var(--late-soft); color: var(--late); font-size: var(--t-sm); margin-bottom: 14px; }
.notice.calm { background: var(--lead-soft); color: var(--ink); }
.notice.due { background: var(--due-soft); color: var(--due); }
.notice a { color: inherit; font-weight: 600; }
.qr { display: grid; place-items: center; padding: 14px; background: oklch(0.995 0.002 250); border: 1px solid var(--line); border-radius: var(--r); width: max-content; margin: 0 auto 12px; }
.secret { font-size: var(--t-sm); letter-spacing: 0.08em; word-break: break-all; text-align: center; color: var(--muted); margin-bottom: 16px; }
.code-in { font-size: 1.5rem !important; letter-spacing: 0.3em; text-align: center; height: 52px !important; }
.setup { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.setup .progress { display: flex; gap: 6px; margin: 0 0 22px; }
.setup .progress i { flex: 1; height: 4px; border-radius: 999px; background: var(--line); }
.setup .progress i.on { background: var(--lead); }
.setup h1 { font-size: var(--t-2xl); margin-bottom: 6px; }
.setup .lede { color: var(--muted); margin-bottom: 22px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--lead); background: var(--lead-soft); }
.choice b { display: block; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Phone ── */
@media (max-width: 760px) {
  :root { --ctl-h: 44px; --top-h: 56px; }
  body { font-size: 0.9375rem; }
  .shell { grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30; flex-direction: row;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); justify-content: space-around;
  }
  .rail-mark, .rail .rail-end, .rail a.desk { display: none; }
  .rail a { flex: 1; }
  .top { grid-column: 1; padding: 0 12px; }
  .top .studio-name { display: none; }
  .search-btn { min-width: 0; width: var(--ctl-h); padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  main.view { grid-column: 1; padding: 16px 14px 96px; }
  .grid-2, .grid-3, .choices { grid-template-columns: 1fr; }
  .board { grid-auto-columns: 86%; }
  .drawer, .drawer.wide { width: 100vw; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 24px; gap: 28px; }
  .auth-side .brand-logo { width: 112px; }
  .table-stack thead { display: none; }
  .table-stack tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 4px; border-bottom: 1px solid var(--line); }
  .table-stack td { border: 0; padding: 2px 10px; }
  .btn-text-desk { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* Shell modes */
.phone-only { display: none !important; }
body.solo .shell { grid-template-columns: 1fr; grid-template-rows: 1fr; }
body.solo .rail, body.solo .top { display: none; }
body.solo main.view { grid-column: 1; padding: 0; }
@media (max-width: 760px) {
  .rail a.phone-only { display: flex !important; }
  body.solo main.view { padding: 0 0 40px; }
}

/* ── Editors (price lists, workflow, payment plans) ── */
.ed-head, .ed-row { display: grid; gap: 8px; align-items: center; }
.ed-head { font-size: var(--t-xs); font-weight: 600; color: var(--muted); padding: 0 4px 6px; }
.ed-row { padding: 8px 4px; border-top: 1px solid var(--line); }
.ed-row .input, .ed-row select.input { height: 34px; padding: 0 8px; }
.ed-row textarea.input { height: auto; min-height: 34px; padding: 7px 8px; resize: vertical; }
.ed-row .tools { display: flex; gap: 2px; justify-content: flex-end; }
.ed-price { grid-template-columns: minmax(120px, 1.2fr) minmax(150px, 2fr) 108px 96px 96px 56px 64px 96px; }
.ed-flow { grid-template-columns: 64px 124px 92px 140px minmax(110px, 1fr) minmax(110px, 1fr) 96px;
  grid-template-areas: "lab lab lab lab lab cli tools" "n unit dir from role cond ."; }
.ed-flow > :nth-child(1) { grid-area: lab; } .ed-flow > :nth-child(2) { grid-area: n; } .ed-flow > :nth-child(3) { grid-area: unit; }
.ed-flow > :nth-child(4) { grid-area: dir; } .ed-flow > :nth-child(5) { grid-area: from; } .ed-flow > :nth-child(6) { grid-area: cli; }
.ed-flow > :nth-child(7) { grid-area: role; } .ed-flow > :nth-child(8) { grid-area: cond; } .ed-flow > :nth-child(9) { grid-area: tools; }
.ed-flow [data-cap]::before { content: attr(data-cap); display: block; font-size: var(--t-xs); color: var(--muted); margin-bottom: 2px; }
.ed-flow .check { align-self: center; }
.ed-flow .check .sr { position: static; width: auto; height: auto; clip-path: none; font-size: var(--t-xs); color: var(--muted); }
.ed-pay { grid-template-columns: minmax(160px, 2fr) 76px 210px 80px 96px; }
.ed-cost { grid-template-columns: 1fr 96px; }
.ed-sec { grid-template-columns: 44px 170px 1fr 96px; align-items: start; }
.ed-sec .t { padding-top: 7px; font-weight: 600; font-size: var(--t-sm); }
.ed-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 4px 0; border-top: 1px solid var(--line); }
.stage-h { margin: 18px 0 4px; font-size: var(--t-sm); font-weight: 650; display: flex; gap: 8px; align-items: center; }
.pct-ok { color: var(--muted); } .pct-bad { color: var(--late); font-weight: 600; }
.margin-cell { font-size: var(--t-xs); color: var(--muted); text-align: right; }
.margin-cell.low { color: var(--late); font-weight: 600; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumbs figure { margin: 0; position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; background: var(--hover); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs figure button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: color-mix(in oklab, var(--ink) 70%, transparent); color: var(--page); display: grid; place-items: center; cursor: pointer; }
.cover-prev { width: 100%; max-width: 420px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); display: block; background: var(--hover); }
@media (max-width: 1000px) {
  .ed-head { display: none; }
  .ed-price, .ed-pay, .ed-sec { grid-template-columns: 1fr 1fr; }
  .ed-flow { grid-template-columns: 1fr 1fr; grid-template-areas: "lab lab" "n unit" "dir from" "role cond" "cli tools"; }
  .ed-price > :nth-child(1), .ed-price > :nth-child(2), .ed-pay > :nth-child(1), .ed-sec > :nth-child(3) { grid-column: 1 / -1; }
  .ed-row .tools { grid-column: 1 / -1; }
  .ed-row [data-cap]::before { content: attr(data-cap); display: block; font-size: var(--t-xs); color: var(--muted); margin-bottom: 2px; }
}

/* ── Quote builder ── */
.qb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.qb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.qb-main .panel h2 { margin-bottom: 10px; }
.qb-side { position: sticky; top: calc(var(--top-h) + 14px); }
.qb-nums .big { font-size: var(--t-xl); font-family: var(--font-head); }
.qb-line { grid-template-columns: minmax(180px, 1fr) 70px 86px 110px 104px 40px; align-items: start; }
.qb-amt { text-align: right; font-weight: 600; padding-top: 8px; }
.qb-cov { grid-template-columns: minmax(120px, 1fr) 140px 140px 100px minmax(140px, 1.3fr) 84px 40px; }
.qb .ed-head.qb-line .r { text-align: right; }
@media (max-width: 1180px) { .qb-grid { grid-template-columns: 1fr; } .qb-side { position: static; } }
@media (max-width: 1000px) {
  .qb-line, .qb-cov { grid-template-columns: 1fr 1fr; }
  .qb-line > :first-child, .qb-cov > :first-child { grid-column: 1 / -1; }
  .qb-amt { text-align: left; }
}

/* ── Job page ── */
.jb-item { gap: 10px; padding: 9px 4px !important; }
.jb-item.is-done .jb-label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.jb-who { height: 32px !important; width: 150px; font-size: var(--t-sm); padding: 0 8px; }
.jb-add { margin-top: 6px; } .jb-add .input { height: 34px; }
@media (max-width: 760px) { .jb-item { flex-wrap: wrap; } .jb-who { width: 100%; } }

/* ── Today strip ── */
.strip { display: grid; grid-template-columns: repeat(14, minmax(52px, 1fr)); gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.strip-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.strip-day:hover { border-color: var(--line-strong); }
.strip-day .wd { font-size: var(--t-xs); color: var(--muted); }
.strip-day b { font-family: var(--font-head); font-size: var(--t-lg); line-height: 1.1; }
.strip-day.is-today { background: var(--lead); border-color: var(--lead); color: var(--lead-ink); }
.strip-day.is-today .wd { color: inherit; opacity: 0.85; }
.marks { display: flex; gap: 3px; height: 7px; }
.marks i, .strip-key i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.mk-shoot { background: var(--lead); } .strip-day.is-today .mk-shoot { background: var(--lead-ink); }
.mk-due { background: var(--due); } .mk-money { background: var(--second-mark); }
.strip-key { margin: 8px 0 0; display: flex; align-items: center; gap: 6px; }
.strip-key i { margin-left: 8px; } .strip-key i:first-child { margin-left: 0; }
.td-item .check { align-items: flex-start; }

/* ── Calendar ── */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal-wd span { padding: 8px 10px; font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.is-out { background: color-mix(in oklab, var(--page), var(--ink) 2%); }
.cal-n { font-size: var(--t-sm); font-weight: 600; color: var(--muted); }
.cal-cell.is-today .cal-n { color: var(--lead-ink); background: var(--lead); border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-ev { display: block; font-size: 0.6875rem; line-height: 1.3; padding: 2px 6px; border-radius: 5px; text-decoration: none; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-shoot { background: var(--lead-soft); } .ev-hold { background: transparent; border: 1px dashed var(--line-strong); }
.ev-due { background: var(--due-soft); } .ev-money { background: var(--second-soft); }
.cal-key { display: inline-block; padding: 1px 8px; border-radius: 5px; margin-left: 4px; font-size: var(--t-xs); min-width: 14px; min-height: 14px; }
.cal-list { display: none; }
.cal-list h3 { margin: 16px 0 6px; }
@media (max-width: 760px) { .cal { display: none; } .cal-list { display: block; } }

/* ── Books ledger ── */
.ledger { display: grid; grid-template-columns: repeat(3, 1fr); }
.ledger > div { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ledger > div:nth-child(3n) { border-right: 0; } .ledger > div:nth-last-child(-n+3) { border-bottom: 0; }
.ledger span { font-size: var(--t-sm); color: var(--muted); }
.ledger b { font-size: var(--t-lg); font-weight: 650; }
.ledger small { font-size: var(--t-xs); color: var(--faint); }
@media (max-width: 760px) { .ledger { grid-template-columns: 1fr 1fr; } .ledger > div { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; } }
.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 14px; align-items: start; }

/* ── Locked settings and save confirmations ── */
.lockbar { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r); background: color-mix(in oklab, var(--page), var(--ink) 5%); font-size: var(--t-sm); margin-bottom: 14px; }
.lockbar.is-open { background: var(--due-soft); color: var(--ink); }
.is-locked :is(input, select, textarea):not([type=checkbox]):not([type=radio]) { background: color-mix(in oklab, var(--page), var(--ink) 2%); border-color: var(--line); }
.is-locked .swatch, .is-locked .check { opacity: 0.8; }
ul.changes { margin: 0 0 6px; padding-left: 18px; max-height: 46vh; overflow-y: auto; }
ul.changes li { margin: 4px 0; font-size: var(--t-sm); }
ul.changes li.warn { color: var(--late); font-weight: 600; list-style: none; margin-left: -18px; }

/* ── Simpler kinds-of-work editor ── */
.pr-row { grid-template-columns: minmax(150px, 1.6fr) 104px 104px 196px 100px 48px 100px; align-items: start; }
.cost-cell { padding-top: 9px; font-size: var(--t-sm); }
.cost-cell a { font-size: var(--t-xs); font-weight: 600; color: var(--lead); }
.pay-row { grid-template-columns: 76px minmax(160px, 1.6fr) 210px 80px 40px; }
.st-row { grid-template-columns: minmax(200px, 1.3fr) minmax(160px, 1fr) 130px; }
.row-more { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 4px 12px; }
.st-more { align-items: flex-end; }
.st-more .field input[type=number] { width: 72px; }
.st-more .field select { min-width: 110px; }
.st-more .field > span { font-size: var(--t-xs); }
.margin-cell { padding-top: 9px; }
.linkbtn { display: block; margin-top: 4px; border: 0; background: none; padding: 0; color: var(--lead); font: 600 var(--t-xs) var(--font-ui); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 1000px) {
  .pr-row, .pay-row, .st-row { grid-template-columns: 1fr 1fr; }
  .pr-row > :first-child, .pay-row > :nth-child(2), .st-row > :first-child, .st-row > :nth-child(2) { grid-column: 1 / -1; }
}

/* ── Roster: roles and what they cost ── */
.chip-check { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }
.chip-check:has(input:checked) { border-color: var(--lead-line); background: var(--lead-soft); }
.pay-line { display: grid; grid-template-columns: minmax(140px, 1fr) 160px; gap: 10px; align-items: center; font-size: var(--t-sm); }
.rate-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 24px; }
.rate-list li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.rate-list li > b { grid-row: 1 / 3; grid-column: 2; align-self: center; font-weight: 600; }

/* ── Previews of what clients see ── */
.pv-frame { display: block; width: 100%; min-height: 480px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.ly-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.ly-card { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg, 12px); background: var(--surface); overflow: hidden; cursor: pointer; font: inherit; color: inherit; transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease); }
.ly-card:hover { border-color: var(--lead-line); box-shadow: 0 6px 18px color-mix(in oklab, var(--ink) 9%, transparent); }
.ly-card:focus-visible { outline: 2px solid var(--lead); outline-offset: 2px; }
.ly-shot { position: relative; height: 230px; overflow: hidden; background: var(--page); border-bottom: 1px solid var(--line); }
.pv-thumb { position: absolute; top: 0; left: 0; width: 1200px; height: 1150px; border: 0; transform-origin: 0 0; pointer-events: none; }
.ly-meta { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.icon-logo { width: 40px; height: 40px; }
