/* The phone shell, in the tenant's world. Every color and face comes from the tenant's brand
   tokens (layout.js writes them on :root); this file only gives them roles, so a tenant with
   other tokens gets its own look with no change here. ZKB's tokens are the Cardwell canon
   (site-kit DESIGN.md): a coal band, white sheets, a soot bar, one light serif voice, tracked
   uppercase Inter for everything that is not a heading or body copy, 1px hairlines, radius 0,
   no shadows, red only where something needs him. Signed out, the whole page is the band.
   One-handed and readable in sunlight: 17px body, 44px+ tap targets. Motion stays in CSS
   (an iPhone in Low Power Mode caps script animation at 30 fps) and is only ever a color
   change, a chevron turning, or feedback arriving. */
@font-face { font-family: 'Cormorant Garamond'; font-weight: 300; font-display: swap; src: url(/public/fonts/cormorant-garamond-300.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 400; font-display: swap; src: url(/public/fonts/cormorant-garamond-400.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(/public/fonts/inter-400.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(/public/fonts/inter-600.woff2) format('woff2'); }

/* ---- Roles ------------------------------------------------------------------------------ */
:root {
  /* Canon tokens a tenant may leave out; each falls back to a step off its own band. */
  --bar: var(--soot, color-mix(in srgb, var(--band) 95%, var(--band-ink)));
  --lift: var(--fog, color-mix(in srgb, var(--band) 87%, var(--band-ink)));
  --mark: var(--chrome, color-mix(in srgb, var(--band-ink) 70%, var(--band)));
  /* The band's alpha ladder: /60 for idle labels, /35 for the heading-rule. */
  --band-soft: color-mix(in srgb, var(--band-ink) 60%, var(--band));
  --band-hair: color-mix(in srgb, var(--band-ink) 35%, var(--band));
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --pad-l: max(20px, env(safe-area-inset-left, 0px));
  --pad-r: max(20px, env(safe-area-inset-right, 0px));
  --tabbar: 58px;
  /* Over-scroll shows the band, never a white flash. */
  background: var(--band);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
/* [LEARNED] 2026-09-26 — an author display rule beats the browser's own [hidden] rule:
   input { display: block } un-hid every hidden input (the room card's photo picker among
   them). This line puts hidden back above every display rule. */
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.5 var(--body);
  overflow-wrap: break-word;
  /* The serif is never bolded: a heavier serif is never faked. */
  font-synthesis: style;
  /* Derived from the ground they sit on, so body.out re-derives them. */
  --edge: color-mix(in srgb, var(--ink) 50%, var(--ground));
  --press: color-mix(in srgb, var(--ink) 7%, var(--ground));
  --hover: color-mix(in srgb, var(--ink) 86%, var(--ground));
  --down: color-mix(in srgb, var(--ink) 72%, var(--ground));
  --tap: color-mix(in srgb, var(--ink) 12%, transparent);
  /* [LEARNED] 2026-09-26 — the highlight inherits as a computed color: a child that only
     resets --tap keeps its parent's (dark, invisible on coal). The band and the bar set it. */
  -webkit-tap-highlight-color: var(--tap);
}
/* Signed out: the sheet takes the band's ground, so the sign-in is one coal field. */
body.out {
  --ground: var(--band);
  --ink: var(--band-ink);
  --muted: color-mix(in srgb, var(--band-ink) 62%, var(--band));
  --rule: color-mix(in srgb, var(--band-ink) 22%, var(--band));
}
body.in { padding-bottom: calc(var(--tabbar) + var(--safe-bottom) + 32px); }
::selection { background: var(--ink); color: var(--ground); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }

/* ---- The band -------------------------------------------------------------------------- */
.top {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: calc(var(--safe-top) + 2px) var(--pad-r) 22px var(--pad-l);
  background: var(--band);
  color: var(--band-ink);
  --tap: color-mix(in srgb, var(--band-ink) 16%, transparent);
  -webkit-tap-highlight-color: var(--tap);
}
.top :focus-visible { outline-color: var(--band-ink); }
.top .brand { grid-column: 2; grid-row: 1; margin: 0; min-height: 44px; display: flex; align-items: center; font: 600 12px/1.2 var(--body); letter-spacing: .2em; text-transform: uppercase; color: var(--mark); }
.top .back { grid-column: 1; grid-row: 1; display: flex; align-items: center; width: 48px; height: 44px; margin-left: -14px; padding-left: 14px; color: var(--band-ink); }
.top .back svg { display: block; }
.top .back:active { color: var(--band-soft); }
.top h1 { grid-column: 1 / -1; margin: 2px 0 0; font: 300 36px/1.06 var(--display); letter-spacing: -.005em; text-wrap: balance; }
/* The canon's heading-rule: the world's smallest mark, under every page title. */
.top h1::after { content: ''; display: block; width: 32px; height: 1px; margin-top: 15px; background: var(--band-hair); }
.out .top { padding-bottom: 4px; }
.out .top h1 { margin-top: 44px; font-size: 46px; line-height: 1.02; }
.out .top h1::after { margin-top: 22px; }

/* ---- The sheet ------------------------------------------------------------------------- */
main { max-width: 720px; margin: 0 auto; padding: 24px var(--pad-r) 32px var(--pad-l); }
main > :first-child { margin-top: 0; }
.out main { padding-top: 32px; }
h2 { font: 400 26px/1.15 var(--display); letter-spacing: -.005em; margin: 40px 0 14px; text-wrap: balance; }
h3 { font: 600 12px/1.3 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 28px 0 10px; }
.count { margin-left: 2px; font: 600 13px/1 var(--body); letter-spacing: .04em; color: var(--muted); font-variant-numeric: tabular-nums; }
.note, .empty { color: var(--muted); font-size: 15px; line-height: 1.5; }
.empty { font-size: 16px; }
:is(.note, .empty) :is(a, strong) { color: var(--ink); }
strong, b { font-weight: 600; }
.card { padding: 0; }
/* Home before the first job: the statement, the one instruction, the action. */
.blank .lede { margin: 4px 0 10px; font: 300 30px/1.1 var(--display); color: var(--ink); }
.blank .empty { margin: 0 0 28px; max-width: 32ch; }
.money { font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.total { font: 300 44px/1.05 var(--display); font-variant-numeric: lining-nums tabular-nums; margin: 8px 0 16px; }

/* Feedback on the last thing he did: a hairline frame, red when it went wrong. */
.alert, .saved { margin: 0 0 22px; padding: 13px 16px; border: 1px solid var(--rule); font-size: 16px; line-height: 1.45; }
.alert { border-color: var(--accent); }
/* Standing conditions, one per row: a red square must be fixed, an open square checked. */
.warn, .problem { position: relative; margin: 0; padding: 12px 0 12px 24px; border-bottom: 1px solid var(--rule); font-size: 16px; line-height: 1.45; }
.warn::before, .problem::before { content: ''; position: absolute; left: 1px; top: 19px; width: 9px; height: 9px; }
.problem::before { background: var(--accent); }
.warn::before { border: 1px solid var(--ink); }
:is(strong, span, em, b, a).warn { padding: 0; border: 0; color: var(--accent); }
:is(strong, span, em, b, a).warn::before { content: none; }

/* ---- Forms ----------------------------------------------------------------------------- */
.stack { display: grid; gap: 8px; }
.stack > p { margin: 0; }
.stack > :is(label:not(.check), .row, .row2):not(:first-child) { margin-top: 12px; }
.stack > :is(button, .button) { margin-top: 14px; }
.row, .row2 { display: grid; gap: 12px; }
.row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
form:is(.row, .row2) { margin-bottom: 16px; }
/* A label that wraps to two lines must not push its field out of line with its neighbours'. */
:is(.row, .row2) > :is(div, label:not(.check)) { display: flex; flex-direction: column; justify-content: flex-end; }
label { display: block; font: 600 13px/1.35 var(--body); letter-spacing: .01em; color: var(--muted); }
label > :is(input, select, textarea) { margin-top: 8px; }
input, select, textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  font: 17px/1.4 var(--body);
  color: var(--ink);
  background: var(--ground);
  border: 1px solid var(--edge);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  caret-color: var(--accent);
}
:is(input, select, textarea):focus { border-color: var(--ink); outline: 1px solid var(--ink); outline-offset: 0; }
:is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
/* AutoFill paints fields pale yellow, a glare on the coal sign-in. The inset fill is paint,
   not a shadow: it is the only way to recolor an autofilled field. */
input:-webkit-autofill { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0 100px var(--ground) inset; }
:is(input, select, textarea):disabled { color: var(--muted); background: var(--press); -webkit-text-fill-color: var(--muted); opacity: 1; }
textarea { min-height: 120px; resize: vertical; }
/* The code field reads as a code: large, spaced, tabular. */
input[autocomplete='one-time-code'] { min-height: 60px; padding: 10px 14px; font-size: 28px; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
/* A drawn chevron in the ink, since the native one goes with appearance: none. */
select {
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type='checkbox'], input[type='radio'] { flex: none; width: 22px; height: 22px; min-height: 0; margin: 0; padding: 0; -webkit-appearance: auto; appearance: auto; accent-color: var(--ink); }
input[type='file'] { -webkit-appearance: auto; appearance: auto; min-height: 0; padding: 8px 0; border: 0; background: none; font-size: 15px; color: var(--muted); }
input[type='file']::file-selector-button { min-height: 44px; margin-right: 14px; padding: 0 16px; font: 600 12px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); background: transparent; border: 1px solid var(--edge); border-radius: 0; cursor: pointer; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font: 400 16px/1.35 var(--body); letter-spacing: 0; color: var(--ink); cursor: pointer; }

/* Buttons: square, 1px, tracked capitals. Solid is the one thing to do on a screen. */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  margin: 0;
  padding: 0 22px;
  font: 600 13px/1.25 var(--body);
  letter-spacing: .14em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.primary { width: 100%; min-height: 52px; background: var(--ink); border-color: var(--ink); color: var(--ground); }
.danger { border-color: var(--accent); color: var(--accent); }
.small { min-height: 44px; padding: 0 16px; font-size: 12px; letter-spacing: .12em; }
button:disabled { opacity: .62; cursor: progress; }
/* Hover (a pointer only), then pressed, so a press always shows as a press. */
@media (hover: hover) {
  :is(button, .button):hover { background: var(--press); border-color: var(--ink); }
  .primary:hover { background: var(--hover); border-color: var(--hover); }
}
:is(button, .button):active { background: var(--press); border-color: var(--ink); }
.primary:active { background: var(--down); border-color: var(--down); }
.danger:is(:hover, :active) { border-color: var(--accent); }
/* The sticky action bar sits on the sheet, just above the tab bar. */
.bar { position: sticky; bottom: calc(var(--tabbar) + var(--safe-bottom)); z-index: 4; margin: 24px 0 0; padding: 12px 0; background: var(--ground); border-top: 1px solid var(--rule); }
.bar > form { margin: 0; }

/* ---- Lists and records ----------------------------------------------------------------- */
.list { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--rule); }
.list li { border-bottom: 1px solid var(--rule); }
.list li > a, .list li > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 3px 16px; padding: 15px 0 16px; text-decoration: none; color: inherit; }
.list li > a:active { background: var(--press); }
.list li strong { font-size: 17px; line-height: 1.3; }
.list li span { color: var(--muted); font-size: 15px; line-height: 1.4; }
.list li .money { grid-row: 1; grid-column: 2; color: var(--ink); }
/* Name and detail stack on the left; the price, the status and the source sit on the right. */
.list li > :is(a, div) > span:not(.pill, .money, .badge) { grid-column: 1; }
.list li .badge { grid-column: 2; justify-self: end; }
/* Where a job stands: tracked capitals, red only when the customer has opened it. */
.pill, .list li .pill { grid-row: 1; grid-column: 2; font: 600 11px/1.3 var(--body); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; color: var(--muted); }
.pill.drafted, .pill.accepted, .pill.won, .list li .pill:is(.drafted, .accepted, .won) { color: var(--ink); }
.pill.viewed, .list li .pill.viewed { color: var(--accent); }
.badge, .list li .badge { font: 600 11px/1.4 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.badge:is(.zach, .joist_csv), .list li .badge:is(.zach, .joist_csv) { color: var(--ink); }
.badge.calibrated, .list li .badge.calibrated { color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
td, th { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
th { font: 600 11px/1.3 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
:is(td, th).num { text-align: right; padding-right: 0; }
.question { margin: 14px 0; padding: 16px; border: 1px solid var(--ink); }
.question > :first-child { margin-top: 0; }
.question form { display: inline; }
.question button { margin: 8px 8px 0 0; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
details > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; list-style: none; cursor: pointer; font: 600 12px/1.25 var(--body); letter-spacing: .14em; text-transform: uppercase; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
details[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
details[open] > summary { margin-bottom: 6px; }

/* ---- The bar --------------------------------------------------------------------------- */
.bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 env(safe-area-inset-right, 0px) var(--safe-bottom) env(safe-area-inset-left, 0px);
  background: var(--bar);
  --tap: color-mix(in srgb, var(--band-ink) 12%, transparent);
  -webkit-tap-highlight-color: var(--tap);
}
.bottom a { position: relative; display: flex; align-items: center; justify-content: center; min-height: var(--tabbar); padding: 0 4px; font: 600 11px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; white-space: nowrap; color: var(--band-soft); }
.bottom a.on { color: var(--band-ink); }
/* Where he is: a short red rule under the word. */
.bottom a.on::after { content: ''; position: absolute; left: 50%; bottom: 14px; width: 20px; height: 2px; margin-left: -10px; background: var(--accent); }
.bottom a:active { background: var(--lift); }
.bottom :focus-visible { outline-color: var(--band-ink); outline-offset: -4px; }

/* ---- Motion: quiet color changes, and feedback that arrives -------------------------- */
@media (prefers-reduced-motion: no-preference) {
  button, .button, .bottom a, .list li > a, input, select, textarea { transition: background-color .15s linear, color .15s linear, border-color .15s linear; }
  details > summary::after { transition: transform .2s cubic-bezier(.16, 1, .3, 1); }
  .saved, .alert { animation: arrive .32s cubic-bezier(.16, 1, .3, 1); }
  @keyframes arrive { from { opacity: 0; transform: translateY(-6px); } }
}
