/* Estate CRM, light edition.
 *
 * Matched to the Jack and Jill Team website: Cormorant Garamond for figures and
 * headings, Jost for everything read at arm's length, warm stone and white
 * grounds, the site's deep navy ink. The idea carried over from the first
 * design: elapsed time and scores are set as large serif numerals, so the page
 * ranks itself before a word is read.
 *
 * Colour jobs, each with one owner:
 *   navy  (--ink, --navy)  text and the primary action
 *   brick (--urgent)       somebody is waiting; nothing else
 *   gold  (--gold)         hairline rules only, never text: it fails contrast
 *
 * Every text pair meets WCAG AA. Spacing is on a 4px scale. Five type sizes.
 */

@font-face {
  font-family: 'Cormorant';
  src: url('/static/fonts/cormorant-var.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: 'Jost';
  src: url('/static/fonts/jost-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --stone: #f4f1ea;
  --stone-2: #ebe6db;
  --card: #ffffff;
  --ink: #172830;
  --muted: #55606a;
  --line: #e2ddd2;
  --navy: #172830;
  --navy-ink: #ffffff;
  --urgent: #a3361f;
  --urgent-soft: #f6e7e2;
  --bronze: #7e6038;
  --gold: #c9a24a;
  --good: #2f6b4f;
  --warm: #8a5a12;
  --cool: #2d5f7c;
  --focus: #2d5f7c;
  --shadow: 0 12px 32px rgb(23 40 48 / 12%);

  --serif: 'Cormorant', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', system-ui, sans-serif;

  --t-small: 15px;
  --t-body: 17px;
  --t-name: 21px;
  --t-head: 38px;
  --t-display: clamp(84px, 24vw, 132px);

  --tabs: 68px;
  --action: 64px;
  color-scheme: light;
}

[data-theme='dark'] {
  --stone: #10181c;
  --stone-2: #182329;
  --card: #172228;
  --ink: #f1ede4;
  --muted: #aab4b6;
  --line: #2a373d;
  --navy: #e9dfc8;
  --navy-ink: #10181c;
  --urgent: #f08a70;
  --urgent-soft: #3a211b;
  --bronze: #d3b98d;
  --gold: #a88a45;
  --good: #7cc8a2;
  --warm: #e5b062;
  --cool: #8cc2df;
  --focus: #8cc2df;
  --shadow: 0 12px 32px rgb(0 0 0 / 45%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* Lining figures everywhere. Cormorant defaults to oldstyle, where 0 and 1 read
   as o and I, and every numeral rule below uses the font shorthand, which would
   reset this. Hence the one !important in the file. */
*, *::before, *::after { font-variant-numeric: lining-nums tabular-nums !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-variant-numeric: lining-nums tabular-nums;
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font: 400 var(--t-body)/1.55 var(--sans);
  overscroll-behavior-y: contain;
  padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom));
}
body.has-actionbar { padding-bottom: calc(var(--tabs) + var(--action) + env(safe-area-inset-bottom)); }
body.bare { padding: 0; }

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
h1 { font: 600 var(--t-head)/1.05 var(--serif); letter-spacing: -.005em; }
h2 { font: 600 28px/1.15 var(--serif); }
h3 { font-size: var(--t-small); font-weight: 600; margin-top: 16px; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary, [role='button'] { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.i { width: 24px; height: 24px; flex: none; display: block; }
code { font-size: var(--t-small); background: var(--stone-2); padding: 0 4px; }

/* ---------------------------------------------------------- frame */

.shell { min-width: 0; }
.top {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.top-search { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0;
  background: var(--stone); padding: 0 12px; height: 48px; border-radius: 24px; }
.top-search .i { width: 20px; height: 20px; color: var(--muted); }
.top-search input { flex: 1; min-width: 0; background: none; border: 0; height: 48px; font-size: 16px; outline-offset: 6px; }
.top-search input::placeholder { color: var(--muted); }
.icon-btn { position: relative; display: grid; place-items: center; width: 48px; height: 48px;
  background: none; border: 0; flex: none; border-radius: 24px; }
.badge { position: absolute; top: 4px; right: 2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--urgent); color: #fff; font-size: 12px; font-weight: 600;
  line-height: 20px; text-align: center; }
[data-theme='dark'] .badge { color: #10181c; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600; }
.brand-mark { width: 12px; height: 32px; background: linear-gradient(var(--urgent) 0 40%, var(--navy) 40% 100%); flex: none; }
.brand-small { flex: none; }
.logo-plate { display: inline-flex; align-items: center; background: #ffffff; padding: 4px 8px; border-radius: 4px; }
.logo-plate img { display: block; height: 40px; width: auto; max-width: 100%; }
.brand-small .logo-plate { padding: 4px; }
.brand-small .logo-plate img { height: 28px; }
.logo-preview { padding-bottom: 8px; }

main { padding-bottom: 32px; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tabs) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs a, .tabs button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: 0; color: var(--muted); text-decoration: none; font-size: 13px;
}
.tabs [aria-current] { color: var(--ink); font-weight: 600; }
.tabs [aria-current] .i { color: var(--navy); }
.tabs [aria-current]::after { content: ''; width: 24px; height: 2px; background: var(--gold); margin-top: 2px; }
.rail { display: none; }

/* ---------------------------------------------------------- today */

.hero { display: flex; align-items: flex-end; gap: 16px; padding: 24px 16px 20px; border-bottom: 1px solid var(--line); }
.hero-figure { font: 500 var(--t-display)/.78 var(--serif); color: var(--navy); flex: none; letter-spacing: -.02em; }
.hero-owed .hero-figure { color: var(--urgent); }
.hero-copy h1 { font-size: var(--t-head); }
.hero-copy p { color: var(--muted); margin-top: 8px; }

.band { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 16px; font-weight: 500;
  background: var(--card); border-bottom: 1px solid var(--line); }
.band-alert { box-shadow: inset 4px 0 0 var(--urgent); }
.band-claim { box-shadow: inset 4px 0 0 var(--navy); justify-content: space-between; }
.band-welcome { box-shadow: inset 4px 0 0 var(--gold); justify-content: space-between; }

/* ---------------------------------------------------------- blocks */

.block { padding: 24px 16px 8px; }
.block > h2 { padding-bottom: 8px; border-bottom: 1px solid var(--gold); }
.block > .sub { color: var(--muted); padding-top: 8px; }
.block-tight { background: var(--card); border-block: 1px solid var(--line); }
.block > .btn, .block > form { margin-top: 12px; }
.count { font: 600 28px/1 var(--serif); color: var(--muted); margin-left: 4px; }
.empty { color: var(--muted); padding: 16px 0; }
.hint { color: var(--muted); font-size: var(--t-small); padding: 8px 0; }
.hint-warn { color: var(--ink); background: var(--urgent-soft); padding: 12px 16px; border-radius: 8px; }
.board-hint { padding: 0 16px 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 24px 16px 16px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.desk-only { display: none; }
.filter-note { padding: 0 16px 8px; color: var(--muted); font-size: var(--t-small); }
.panel { background: var(--card); padding: 20px 16px; margin: 0 0 12px; border-block: 1px solid var(--line); }
.panel h2 { margin-bottom: 8px; }
.panel > summary { min-height: 48px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scroll { overflow-x: auto; }
.pager { display: flex; justify-content: center; gap: 8px; padding: 16px; }

/* ---------------------------------------------------------- lead row */

.rows { border-top: 1px solid var(--line); background: var(--card); }
.lead {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 84px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); background: var(--card);
}
.lead::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 2px 2px 0; background: transparent; }
.heat-2::before { background: var(--line); }
.heat-3::before { background: var(--bronze); }
.heat-4::before { background: var(--urgent); }
.lead-main { flex: 1; min-width: 0; text-decoration: none; display: flex; flex-direction: column; justify-content: center; align-self: stretch; gap: 2px; }
.lead-name { font-size: var(--t-name); font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
.lead-why { display: block; font-size: var(--t-small); font-weight: 500; color: var(--ink); line-height: 1.4; }
.lead-meta { display: block; color: var(--muted); font-size: var(--t-small); line-height: 1.4; }
.lead-clock { flex: none; text-align: right; min-width: 56px; }
.lead-clock b { display: block; font: 600 36px/1 var(--serif); }
.lead-clock span { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; }
.heat-4 .lead-clock b { color: var(--urgent); }
.lead-call.is-empty { visibility: hidden; }
.lead-call { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 26px;
  background: var(--navy); color: var(--navy-ink); }
.score { display: inline-block; min-width: 34px; margin-right: 6px; text-align: center;
  font: 600 20px/28px var(--serif); border: 1px solid var(--line); border-radius: 14px; padding: 0 6px; vertical-align: 1px; }
.score.is-hot { border-color: var(--urgent); color: var(--urgent); }
.demo { font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px;
  border: 1px solid var(--line); border-radius: 4px; color: var(--muted); vertical-align: 3px; }
.late-wrap .task { box-shadow: inset 4px 0 0 var(--urgent); }

.selectable { display: flex; align-items: stretch; }
.selectable .lead { flex: 1; min-width: 0; }
.pick { display: grid; place-items: center; width: 48px; flex: none; background: var(--card); border-bottom: 1px solid var(--line); }
.pick input { width: 22px; height: 22px; }

.task { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 12px 12px 12px 16px;
  background: var(--card); border-bottom: 1px solid var(--line); }
.task-body { flex: 1; min-width: 0; }
.task strong { display: block; font-weight: 500; }
.tick { display: grid; place-items: center; width: 48px; height: 48px; background: none;
  border: 1.5px solid var(--muted); border-radius: 24px; color: transparent; flex: none; }
.tick:hover, .tick:focus-visible { border-color: var(--good); color: var(--good); }

.mini { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.mini strong { display: block; font-weight: 500; }
.mini span { display: block; color: var(--muted); font-size: var(--t-small); }
.mini form { margin-top: 4px; }

.alert { display: block; padding: 16px; background: var(--card); border-bottom: 1px solid var(--line); text-decoration: none; }
.alert strong { display: block; font-weight: 400; }
.alert.is-new { box-shadow: inset 4px 0 0 var(--urgent); }
.alert.is-new strong { font-weight: 600; }
.alert span, .alert time { display: block; color: var(--muted); font-size: var(--t-small); }

/* ---------------------------------------------------------- lead page */

.person-head { padding: 16px 16px 20px; background: var(--card); border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.person-title { display: flex; align-items: flex-start; gap: 4px; margin-left: -8px; }
.back { display: grid; place-items: center; width: 48px; height: 48px; flex: none; }
.person-title h1 { font: 600 clamp(40px, 11vw, 64px)/1 var(--serif); overflow-wrap: anywhere; min-width: 0; padding-top: 4px; }
.summary { font-size: var(--t-name); line-height: 1.45; }
.person-signals { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; color: var(--muted); font-size: var(--t-small); }
.person-signals b { font: 600 32px/1 var(--serif); color: var(--ink); margin-right: 4px; }
.person-signals .is-hot b, .person-signals .is-waiting b { color: var(--urgent); }

.next { margin: 16px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: inset 0 3px 0 var(--navy); }
.next.is-urgent { box-shadow: inset 0 3px 0 var(--urgent); }
.next-label { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bronze); }
.next h2 { margin: 4px 0 4px; font-size: 30px; }
.next p { color: var(--muted); }
.next-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.person-state { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 0 8px; }

.more-detail > details { border-top: 1px solid var(--line); background: var(--card); }
.more-detail > details > summary { list-style: none; display: flex; justify-content: space-between; align-items: center;
  min-height: 60px; padding: 0 16px; font: 600 24px/1.2 var(--serif); }
.more-detail > details > summary::-webkit-details-marker { display: none; }
.more-detail > details > summary::after { content: '+'; font: 300 28px/1 var(--sans); color: var(--muted); }
.more-detail > details[open] > summary::after { content: '\2212'; }
.more-detail > details > .inner { padding: 0 16px 20px; }
.more-detail > details:last-child { border-bottom: 1px solid var(--line); }

.timeline .tl { padding: 16px 0 16px 20px; border-bottom: 1px solid var(--line); position: relative; }
.tl::before { content: ''; position: absolute; left: 0; top: 22px; width: 8px; height: 8px; border-radius: 4px; background: var(--line); }
.tl-inquiry::before, .tl-email_in::before, .tl-registered::before { background: var(--urgent); }
.tl-call::before, .tl-text::before, .tl-email_out::before { background: var(--good); }
.tl-note::before { background: var(--bronze); }
.tl-site_visit::before, .tl-listing::before { background: var(--cool); }
.tl-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 12px; }
.tl-head strong { font-weight: 500; }
.tl time, .tl .by { color: var(--muted); font-size: var(--t-small); }
.tl p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.tl .by { display: block; }
.tl details, .block details { margin-top: 8px; font-size: var(--t-small); color: var(--muted); }
.tl summary, .block summary, .filters summary { min-height: 40px; display: flex; align-items: center; }
.tl li { padding: 2px 0; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 18px; font-size: var(--t-small); text-decoration: none; }

.facts > div { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: var(--t-small); }
.facts dd { overflow-wrap: anywhere; }
.bg { white-space: pre-wrap; padding: 12px 16px; background: var(--stone); border-radius: 8px; margin-top: 12px; overflow-wrap: anywhere; }
.route { font-size: var(--t-small); padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain li { padding: 3px 0; font-size: var(--t-small); }
.taglist { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }

.actionbar {
  position: fixed; left: 0; right: 0; z-index: 25; bottom: calc(var(--tabs) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, 1fr); height: var(--action);
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgb(23 40 48 / 6%);
}
.actionbar a, .actionbar button, .actionbar .off {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: none; border: 0; text-decoration: none; font-size: 13px; font-weight: 500; color: var(--ink); text-align: center; line-height: 1.15;
}
.actionbar > :first-child .i { color: var(--navy); }
.actionbar .off { color: var(--muted); }

/* ---------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; background: var(--card); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 24px; text-decoration: none; font-weight: 500;
}
.btn .i { width: 20px; height: 20px; }
.btn-primary { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.btn-urgent { background: var(--urgent); color: #ffffff; border-color: var(--urgent); }
[data-theme='dark'] .btn-urgent { color: #10181c; }
.btn-danger { color: var(--urgent); border-color: var(--urgent); }
@media (hover: hover) {
  .btn:not(.btn-primary):not(.btn-urgent):hover { background: var(--stone); }
  .btn-primary:hover { filter: brightness(1.15); }
}
.link { background: none; border: 0; padding: 0; text-decoration: underline; min-height: 40px; font-size: var(--t-small); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: var(--t-small); color: var(--muted); }
input:not([type='checkbox'], [type='radio'], [type='file'], [type='search']), select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; background: var(--card);
  border: 1px solid #c9c2b4; border-radius: 8px; font-size: 16px;
}
[data-theme='dark'] input:not([type='checkbox'], [type='radio'], [type='file'], [type='search']),
[data-theme='dark'] select, [data-theme='dark'] textarea { border-color: #46555c; background: var(--stone); }
textarea { resize: vertical; }
input[readonly] { background: var(--stone); }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.check input { width: 22px; height: 22px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; align-items: end; }
.grid-form .wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
.row-form { display: flex; gap: 8px; align-items: center; }
.row-form input, .row-form select { flex: 1; min-width: 0; }
.form-foot { display: flex; flex-wrap: wrap; gap: 8px; }
.filters { padding: 0 16px 12px; }
.filters form { padding-top: 12px; }

.pills { display: flex; gap: 8px; padding: 0 16px 16px; overflow-x: auto; scrollbar-width: none; }
.pills a { flex: none; display: inline-flex; gap: 8px; align-items: center; min-height: 44px; padding: 8px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; text-decoration: none; white-space: nowrap; }
.pills a b { font: 600 22px/1 var(--serif); }
.pills [aria-current] { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.page-head .pills { padding: 0; }

.tag { display: inline-block; padding: 4px 12px; font-size: var(--t-small); background: var(--stone); border: 1px solid var(--line); border-radius: 16px; }
.tone-hot { color: var(--urgent); }
.tone-good { color: var(--good); }
.tone-warm { color: var(--warm); }
.tone-cool { color: var(--cool); }

.table { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--gold); white-space: nowrap; }
.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table input[type='checkbox'] { width: 22px; height: 22px; }

.flash p { padding: 14px 16px; font-weight: 500; background: var(--card); border-bottom: 1px solid var(--line); }
.flash-ok { box-shadow: inset 4px 0 0 var(--good); }
.flash-err { box-shadow: inset 4px 0 0 var(--urgent); }
p.flash-err:not(.flash p) { padding: 10px 14px; background: var(--urgent-soft); border-radius: 8px; }

.toast { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs) + 12px + env(safe-area-inset-bottom));
  z-index: 60; padding: 14px 18px; background: var(--ink); color: var(--card); border-radius: 12px; font-weight: 500; }

/* ---------------------------------------------------------- sheets */

.sheet {
  margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92dvh; padding: 0 16px calc(20px + env(safe-area-inset-bottom));
  border: 0; border-radius: 20px 20px 0 0; background: var(--card); color: var(--ink); box-shadow: var(--shadow); overflow-y: auto;
}
.sheet::backdrop { background: rgb(23 40 48 / 45%); }
.sheet > header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 12px; background: var(--card); }
.sheet-close { min-height: 44px; padding: 0 16px; background: none; border: 1px solid var(--line); border-radius: 22px; }
.sheet-links a, .sheet-links button { display: flex; align-items: center; gap: 14px; min-height: 56px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-decoration: none; text-align: left; padding: 0; font-size: var(--t-body); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice label { display: block; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 56px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; font-weight: 500; }
.choice input:checked + span { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
input[type='file'] { font-size: var(--t-small); color: var(--muted); max-width: 100%; padding: 2px 0; }
input[type='file']::file-selector-button { margin-right: 12px; min-height: 44px; padding: 8px 18px; border: 1px solid var(--ink);
  border-radius: 22px; background: var(--card); color: var(--ink); font: 500 var(--t-small) var(--sans); cursor: pointer; }
.sheet form > .btn-primary:last-child { position: sticky; bottom: 0; box-shadow: 0 -12px 16px var(--card); }
.uploads { display: flex; flex-wrap: wrap; gap: 8px; }
.uploads .file button { background: none; border: 0; padding: 0 0 0 4px; min-height: 28px; color: var(--muted); }

.bulkbar {
  position: fixed; left: 0; right: 0; z-index: 28; bottom: calc(var(--tabs) + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--card); border-top: 2px solid var(--navy); box-shadow: var(--shadow);
}
.bulkbar[hidden] { display: none; }
.bulkbar select, .bulkbar input { flex: 1 1 140px; width: auto; }

/* ---------------------------------------------------------- board */

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 84vw); gap: 12px;
  overflow-x: auto; padding: 0 16px 16px; scroll-snap-type: x proximity; align-items: start; }
.col { background: var(--stone-2); border-radius: 12px; scroll-snap-align: center; min-width: 0; color: var(--ink); }
.col > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.col > header b { font: 600 32px/1 var(--serif); }
.col.tone-hot > header h2 { color: var(--urgent); }
.col-cards { display: grid; gap: 8px; padding: 0 8px 8px; min-height: 96px; }
.col-cards.is-over { background: var(--line); border-radius: 8px; }
.card { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 12px 8px 12px 16px; background: var(--card); border-radius: 8px; touch-action: pan-y; }
.card a { grid-column: 1; grid-row: 1; text-decoration: none; min-width: 0; }
.card strong { display: block; font-weight: 500; overflow-wrap: anywhere; }
.grip { grid-column: 2; grid-row: 1; width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: grab; touch-action: none; }
.card-move { grid-column: 1 / -1; min-height: 44px; }
@media (hover: hover) and (pointer: fine) {
  .card-move:not(:focus) { min-height: 32px; padding-block: 0; font-size: 14px; color: var(--muted); border-color: transparent; background-color: var(--stone); }
}
.card.is-dragging { position: fixed; z-index: 70; pointer-events: none; box-shadow: var(--shadow); opacity: .96; }
.card-gap { background: var(--line); border-radius: 8px; }

.stageline { display: flex; gap: 6px; padding: 0 16px 16px; overflow-x: auto; }
.stageline button { flex: none; min-height: 44px; padding: 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; white-space: nowrap; }
.stageline [aria-current] { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }

.split-row { display: grid; grid-template-columns: 1fr 96px; gap: 8px; margin-bottom: 8px; }
.steps { counter-reset: step; display: grid; gap: 8px; }
.step { counter-increment: step; background: var(--stone); padding: 12px 14px 14px; border-radius: 10px; }
.step-head { display: flex; align-items: center; gap: 12px; }
.step-no::before { content: counter(step); font: 600 34px/1 var(--serif); }
.step-body { display: none; gap: 8px; margin-top: 8px; }
.step-body.is-on { display: flex; flex-wrap: wrap; }
.step-body > * { flex: 1 1 120px; }
.rotation { display: grid; grid-template-columns: 1fr 80px; gap: 8px 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; }
.picks .check { min-height: 44px; }
.page-hint { padding: 0 16px 12px; }
.template { border-bottom: 1px solid var(--line); padding: 10px 0; }
.review { background: var(--card); padding: 14px; border-bottom: 1px solid var(--line); }
.review summary span { display: block; color: var(--muted); font-size: var(--t-small); }
.review pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--stone); padding: 12px; border-radius: 8px; font: inherit; font-size: var(--t-small); }

.bars { display: grid; gap: 16px; padding: 12px 0; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; }
.bar-name { font-weight: 500; }
.bar-value { font: 600 34px/1 var(--serif); }
.bar-track { grid-column: 1 / -1; height: 6px; background: var(--stone-2); border-radius: 3px; display: block; }
.bar-fill { display: block; height: 100%; background: var(--good); border-radius: 3px; }
.bar-fill.is-slow { background: var(--urgent); }
.bar-note { grid-column: 1 / -1; color: var(--muted); font-size: var(--t-small); }

.checklist { display: grid; border-top: 1px solid var(--line); }
.checklist li { background: var(--card); border-bottom: 1px solid var(--line); }
.checklist a { display: block; padding: 14px 16px; text-decoration: none; }
.checklist strong, .checklist span { display: block; }
.checklist strong { font-weight: 500; }
.checklist a span { color: var(--muted); font-size: var(--t-small); }
.checklist .is-done { display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--muted); }
.checklist .is-done .i { color: var(--good); width: 20px; height: 20px; }

.steps-list { counter-reset: n; display: grid; gap: 0; border-top: 1px solid var(--line); }
.steps-list > li { counter-increment: n; display: grid; grid-template-columns: 56px 1fr; gap: 4px 12px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.steps-list > li::before { content: counter(n); grid-row: span 3; font: 500 56px/.9 var(--serif); color: var(--bronze); }
.steps-list h2 { font-size: 26px; }
.bands { display: grid; gap: 8px; margin-top: 8px; }
.bands div { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: baseline; }
.bands b { font: 600 26px/1 var(--serif); }

.invite-results { display: grid; gap: 8px; }
.stagestrip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stagestrip a { display: grid; gap: 2px; min-width: 148px; padding: 14px 18px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.stagestrip b { font: 600 40px/1 var(--serif); }
.stagestrip span { color: var(--muted); font-size: var(--t-small); }
.invite-results input { font-size: 14px; }

/* ---------------------------------------------------------- sign in */

.auth { min-height: 100dvh; display: grid; align-content: center; gap: 28px; padding: 28px 16px; background: var(--stone); }
.auth-figure { font: 500 clamp(64px, 17vw, 150px)/.88 var(--serif); color: var(--navy); letter-spacing: -.01em; }
.auth-card { background: var(--card); padding: 28px 20px; display: grid; gap: 14px; border-radius: 16px; border: 1px solid var(--line); }
.auth-card a:not(.btn) { font-size: var(--t-small); }
body.bare main { padding-bottom: 24px; }

/* ---------------------------------------------------------- wide */

@media (min-width: 960px) {
  :root { --t-head: 44px; }
  body, body.has-actionbar { padding-bottom: 0; padding-left: 248px; }
  body.bare { padding: 0; }
  .tabs { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 20px; position: fixed; inset: 0 auto 0 0; width: 248px; padding: 20px 0;
    background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; z-index: 30;
  }
  .rail .brand { padding: 0 20px; }
  .rail .logo-plate { padding: 0; }
  .rail .logo-plate img { height: 52px; }
  [data-theme='dark'] .rail .logo-plate { padding: 6px 10px; }
  .rail nav { display: grid; gap: 2px; padding: 0 12px; }
  .rail nav a { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); }
  .rail nav a:hover { color: var(--ink); background: var(--stone); }
  .rail nav [aria-current] { color: var(--ink); background: var(--stone); font-weight: 600; }
  .rail nav [aria-current] .i { color: var(--navy); }
  .rail-label { padding: 12px 24px 0; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  .rail-foot { margin-top: auto; padding: 0 24px; font-size: var(--t-small); color: var(--muted); overflow-wrap: anywhere; }
  .top { padding: 12px 24px; background: var(--stone); border-bottom: 0; }
  .top-search { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); max-width: 520px; margin-right: auto; }
  .brand-small { display: none; }
  .hero { padding: 24px 32px 28px; }
  .hero-figure { font-size: 168px; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 8px; }
  .split-even { grid-template-columns: 1fr 1fr; }
  .block, .page-head, .pills, .filters, .page-hint { padding-inline: 32px; }
  .band { padding-inline: 32px; }
  .board { padding-inline: 32px; grid-auto-columns: minmax(250px, 1fr); }
  .board-hint, .filter-note { padding-inline: 32px; }
  .panel { margin-inline: 32px; border: 1px solid var(--line); border-radius: 12px; }
  .rows { margin-inline: 32px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .block .rows { margin-inline: 0; }
  .person-head { padding: 20px 32px 24px; }
  .next { margin: 20px 32px; }
  .more-detail { margin: 0 32px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
  .more-detail > details:first-child { border-top: 0; }
  .more-detail > details:last-child { border-bottom: 0; }
  .actionbar { position: static; margin: 0 32px; height: auto; grid-template-columns: repeat(5, max-content); gap: 8px; background: none; border: 0; box-shadow: none; }
  .actionbar a, .actionbar button, .actionbar .off { flex-direction: row; gap: 8px; min-height: 48px; padding: 0 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); font-size: var(--t-body); }
  .actionbar > :first-child { border-color: var(--navy); }
  body.has-actionbar { padding-bottom: 0; }
  .bulkbar { left: 248px; bottom: 0; }
  .toast { left: auto; right: 24px; bottom: 24px; max-width: 420px; }
  .sheet { margin: auto; width: 580px; max-height: 86dvh; border-radius: 16px; }
  .auth { grid-template-columns: 1.2fr minmax(360px, 440px); align-items: center; padding: 64px; }
  .btn.desk-only { display: inline-flex; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .tick, .pills a, .rail nav a { transition: background-color .15s, color .15s, border-color .15s; }
}

@media print {
  .tabs, .rail, .top, .actionbar { display: none; }
}
