/* Kiln admin. Phone-first; desktop from 900px. Stone neutrals, one ember accent.
   The ember is the only decoration: the brand dot, a switch that's on, the current menu item,
   the loading bar and the sign-in glow. Everything else stays quiet.
   Contrast: text and controls meet WCAG AA in light and dark. White on #D9480F is only 4.3:1, so
   buttons and links use the deeper --ember-strong (5.2:1); #D9480F itself is for glow and focus. */

:root {
  color-scheme: light dark;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "Segoe UI Mono", Menlo, Consolas, monospace;

  --bg: #F5F5F4;
  --surface: #FFFFFF;
  --surface-2: #FAFAF9;
  --sunken: #EFEEEC;
  --line: #E7E5E4;
  --line-strong: #D6D3D1;
  --text: #1C1917;
  --text-2: #57534E;
  --text-3: #6F6862;

  --ember: #D9480F;
  --ember-strong: #C2410C;
  --ember-hover: #A8380A;
  --ember-text: #C2410C;
  --ember-tint: #FFF4ED;
  --ember-glow: rgba(247, 103, 7, .45);
  --coal: radial-gradient(circle at 35% 30%, #FFE3CF 0 12%, #FF922B 38%, #D9480F 70%, #A8380A 100%);

  --ok: #2F7D4F;
  --ok-tint: #EDF7F0;
  --danger: #B42318;
  --danger-fill: #B42318;
  --danger-tint: #FEF3F2;
  --toast-bg: #1C1917;
  --toast-text: #FAFAF9;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(28, 25, 23, .06);
  --shadow-2: 0 10px 30px rgba(28, 25, 23, .16);
  --focus: 0 0 0 3px rgba(217, 72, 15, .3);
  --side-w: 252px;
  --topbar-h: 52px;
  --tabbar-h: 60px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12100E;
    --surface: #1C1917;
    --surface-2: #211D1B;
    --sunken: #171412;
    --line: #2C2724;
    --line-strong: #44403C;
    --text: #F5F5F4;
    --text-2: #A8A29E;
    --text-3: #8A847F;
    --ember: #F76707;
    --ember-hover: #D9480F;
    --ember-text: #FB923C;
    --ember-tint: rgba(247, 103, 7, .12);
    --ok: #6CCB8F;
    --ok-tint: rgba(108, 203, 143, .12);
    --danger: #F97066;
    --danger-tint: rgba(249, 112, 102, .12);
    --toast-bg: #F5F5F4;
    --toast-text: #1C1917;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 12px 34px rgba(0, 0, 0, .55);
    --focus: 0 0 0 3px rgba(247, 103, 7, .35);
  }
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p, figure { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 650; letter-spacing: -.015em; text-wrap: balance; }
h2 { font-size: 1.0625rem; line-height: 1.3; font-weight: 600; letter-spacing: -.005em; }
a { color: var(--ember-text); text-underline-offset: 2px; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
main:focus { outline: none; }
[hidden] { display: none !important; }
::selection { background: rgba(247, 103, 7, .25); }

.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); font-size: .9em; }
.pad { padding: 16px; }
.req { color: var(--ember-text); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; z-index: 100; left: 12px; top: -60px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface); font-weight: 600;
}
.skip:focus { top: 12px; box-shadow: var(--shadow-2); } /* no shadow while parked off-screen: it bled onto the top edge */
.boot { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; color: var(--text-2); }

.icon { display: inline-flex; flex: none; line-height: 0; }
.icon svg { display: block; }

/* The coal: the one mark that says Kiln. */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; text-decoration: none;
}
.brand-dot {
  flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--coal);
  box-shadow: 0 0 0 3px rgba(217, 72, 15, .12), 0 0 14px 2px var(--ember-glow);
}

/* ------------------------------------------------------------------ frame: phone first */

.app { min-height: 100vh; min-height: 100dvh; }
.app > .side { display: none; }
.main-col { min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-site {
  min-width: 0; margin-left: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-2); font-size: .9375rem; font-weight: 500;
}
.main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 32px); }

.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 4px env(safe-area-inset-bottom);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 4px; border: 0; background: none;
  color: var(--text-2); font-size: .6875rem; font-weight: 600; letter-spacing: .01em; text-decoration: none;
  cursor: pointer;
}
.tab > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab[aria-current="page"], .tab.is-current, .tab[aria-expanded="true"] { color: var(--ember-text); }
.tab[aria-current="page"] .icon, .tab.is-current .icon { filter: drop-shadow(0 0 6px var(--ember-glow)); }

.drawer {
  position: fixed; z-index: 25; left: 0; right: 0;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg);
  animation: rise .18s ease-out;
}
.drawer .side > .brand { display: none; } /* the top bar already shows it */
body.drawer-open { overflow: hidden; }

/* The menu: same markup in the desktop column and the phone drawer. */
.side { display: flex; flex-direction: column; gap: 2px; min-height: 100%; padding: 16px 12px; }
.side > .brand { padding: 6px 10px 18px; }
.site-name { padding: 4px 10px 12px; font-weight: 600; }
select.site-switch { margin: 0 0 12px; font-weight: 600; }
.nav { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-group {
  margin: 16px 10px 6px;
  color: var(--text-3); font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 10px;
  border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text-2); font-size: .9375rem; font-weight: 500; text-align: left; text-decoration: none;
  cursor: pointer;
}
.nav-link:hover { background: var(--sunken); color: var(--text); }
.nav-link[aria-current="page"] {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--ember), var(--shadow-1);
}
.nav-link[aria-current="page"] .icon { color: var(--ember-text); }
.nav-sep { margin-top: 10px; border-top: 1px solid var(--line); }
.side-foot { display: grid; gap: 2px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.nav-sep + .side-foot { margin-top: auto; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .app > .side {
    display: flex; position: sticky; top: 0;
    height: 100vh; height: 100dvh; overflow-y: auto;
    border-right: 1px solid var(--line);
  }
  .topbar, .tabbar, .drawer { display: none !important; }
  .main { padding-bottom: 64px; }
  h1 { font-size: 1.75rem; }
}

/* ------------------------------------------------------------------ page */

.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 20px 16px 0; }
.page-narrow { max-width: 680px; }
.page > * + * { margin-top: 16px; }
.page > .page-head + * { margin-top: 22px; }
.page > p:empty { margin-top: 0; } /* an idle status line takes no space */
@media (min-width: 900px) { .page { padding: 40px 40px 0; } }

.page-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head > .muted { margin-top: 6px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-actions:empty { display: none; }
.back {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 0 10px -6px; padding: 6px 8px 6px 4px;
  border-radius: var(--radius-sm); color: var(--text-2); font-size: .9375rem; font-weight: 500; text-decoration: none;
}
.back:hover { background: var(--sunken); color: var(--text); }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: .9375rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, transform .06s;
}
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  border-color: var(--ember-strong); background: var(--ember-strong); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(168, 56, 10, .3);
}
.btn-primary:hover { border-color: var(--ember-hover); background: var(--ember-hover); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-quiet:hover { border-color: transparent; background: var(--sunken); color: var(--text); }
.btn-danger { border-color: var(--line-strong); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-tint); }
.btn.is-armed, .btn.is-armed:hover { border-color: var(--danger-fill); background: var(--danger-fill); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; border-radius: 8px; font-size: .875rem; }
.btn-block { width: 100%; }
/* A <label> styled as a button for a hidden file input: show focus when the input has it. */
.btn:has(+ input[type="file"]:focus-visible) { outline: 2px solid var(--ember); outline-offset: 2px; }

.link { color: var(--ember-text); font-size: .875rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ forms */

:where(input[type="text"], input[type="email"], input[type="password"], input[type="number"],
  input[type="search"], input[type="date"], input[type="datetime-local"], input[type="time"], select, textarea) {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: 1rem; line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
}
:where(select) {
  appearance: none; -webkit-appearance: none;
  padding-right: 40px;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  cursor: pointer;
}
:where(textarea) { min-height: 104px; resize: vertical; }
:where(input, textarea)::placeholder { color: var(--text-3); }
:where(input, select, textarea):focus { outline: none; border-color: var(--ember); box-shadow: var(--focus); }
:where(input, select, textarea):disabled { background-color: var(--sunken); color: var(--text-2); cursor: not-allowed; }
input[type="checkbox"]:not(.switch) { accent-color: var(--ember-strong); }

.form-fields, .edit-form { display: grid; gap: 20px; }
.edit-form {
  padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-1);
}
@media (min-width: 600px) { .edit-form { padding: 24px; } }
.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-label { padding: 0; font-size: .875rem; font-weight: 600; }
legend.field-label { margin-bottom: 8px; }
.field-help { color: var(--text-2); font-size: .8125rem; }
.field-error { color: var(--danger); font-size: .8125rem; font-weight: 600; }
.has-error :where(input, select, textarea) { border-color: var(--danger); }
.is-readonly > .field-label, .is-readonly .switch-label { color: var(--text-2); }
textarea.mono { font-size: .875rem; }

.form-error, .form-ok, .form-note { padding: 10px 12px; border-radius: 10px; font-size: .9375rem; font-weight: 500; }
.form-note { background: var(--sunken); color: var(--text-2); }
.form-error { background: var(--danger-tint); color: var(--danger); }
.form-ok { background: var(--ok-tint); color: var(--ok); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.grid-2 { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

input.search {
  max-width: 420px; padding-left: 40px;
  background-image: var(--magnifier); background-repeat: no-repeat; background-position: 12px center; background-size: 18px;
}

.money { position: relative; }
.money-sym { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.money input[type="text"] { padding-left: 28px; font-variant-numeric: tabular-nums; }

/* Switch: the control people touch most ("sold out", "show the banner"). On = ember. */
.switch {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: none; width: 46px; height: 28px; margin: 0;
  border-radius: 999px; background: var(--line-strong);
  box-shadow: inset 0 0 0 1px rgba(28, 25, 23, .06);
  cursor: pointer; transition: background-color .18s;
}
.switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(28, 25, 23, .3);
  transition: transform .2s cubic-bezier(.3, .7, .4, 1), box-shadow .2s;
}
.switch:checked { background: var(--ember-strong); }
.switch:checked::before {
  transform: translateX(18px);
  box-shadow: 0 1px 3px rgba(120, 40, 8, .45), 0 0 12px 1px rgba(255, 146, 43, .6);
}
.switch:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; cursor: pointer; }
.switch-label { font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.chip-check span {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  font-size: .9375rem; font-weight: 500;
}
.chip-check input:checked + span { border-color: var(--ember); background: var(--ember-tint); color: var(--ember-text); }
.chip-check input:checked + span::before { content: "\2713"; margin-right: 6px; font-weight: 700; }
.chip-check input:focus-visible + span { box-shadow: var(--focus); }
.chip-check input:disabled + span { opacity: .6; }

.checks { display: grid; gap: 8px; }
.check {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.check:has(input:checked) { border-color: var(--ember); background: var(--ember-tint); }
.check input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; }
.check strong { font-weight: 600; }
.check .muted { display: block; }

/* Weekly hours: one row per day; the times sit beside the day on wider screens. */
/* No frame of its own: it already sits inside the form's card, and on a phone every px counts.
   minmax(0, ...) tracks let the time boxes shrink instead of pushing the page sideways. */
.hours { display: grid; }
.hours-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "day split" "ranges ranges";
  align-items: center; gap: 8px 12px; padding: 12px 0;
}
.hours-row + .hours-row { border-top: 1px solid var(--line); }
.hours-day { grid-area: day; display: flex; align-items: center; gap: 12px; min-height: 36px; font-weight: 600; cursor: pointer; }
.ranges { grid-area: ranges; display: grid; gap: 8px; min-width: 0; }
.hours-row > .btn { grid-area: split; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.range input[type="time"] { min-width: 0; padding-left: 10px; padding-right: 6px; font-variant-numeric: tabular-nums; }
.range .btn { padding: 0 6px; } /* icon-only remove: leave the room to the times */
@media (min-width: 640px) {
  .hours-row { grid-template-columns: 150px minmax(0, 1fr) auto; grid-template-areas: "day ranges split"; }
  .range { max-width: 380px; }
}
/* Phones open the time picker on tap; the clock icon only steals room from "7:00 AM". */
@media (max-width: 419px) {
  .range input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
}

.img-field { display: grid; gap: 10px; justify-items: start; }
.img-preview {
  display: grid; place-items: center; width: 168px; aspect-ratio: 4 / 3; overflow: hidden;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--sunken);
  color: var(--text-2); font-size: .875rem;
}
.img-preview:has(img) { border-style: solid; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ------------------------------------------------------------------ cards and the home screen */

.cards {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.card {
  display: grid; gap: 14px; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-1);
}
@media (min-width: 600px) { .card { padding: 20px; } }
.card > div { display: grid; gap: 12px; }
.card .btn { justify-self: start; }
.card > .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 6px; }
.card-slim { gap: 6px; padding-top: 14px; padding-bottom: 14px; }
.cards > .card-slim { grid-column: 1 / -1; } /* a status strip across the top, not a short card leaving a hole beside a tall one */
.status-open { color: var(--ok); font-weight: 600; }
.status-open::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; vertical-align: 1px;
  border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px var(--ok-tint);
}

.quick-actions { display: flex; gap: 8px; margin-left: -16px; margin-right: -16px; padding: 2px 16px 6px; overflow-x: auto; scrollbar-width: none; }
.quick-actions::-webkit-scrollbar { display: none; }
.quick-actions .btn { flex: none; }
@media (min-width: 900px) { .quick-actions { flex-wrap: wrap; margin-left: 0; margin-right: 0; padding: 0; overflow: visible; } }

.card > .quick-list { gap: 0; }
.quick-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 0; }
.quick-row + .quick-row { border-top: 1px solid var(--line); }
.quick-name { min-width: 0; font-weight: 500; }
.quick-name .muted { font-weight: 400; font-variant-numeric: tabular-nums; }
.quick-controls { display: flex; align-items: center; gap: 12px; flex: none; }
.quick-heads { min-height: 0; padding: 0 0 4px; }
.quick-head { color: var(--text-2); font-size: .6875rem; font-weight: 600; text-align: center; line-height: 1.15; }
.quick-head-number { width: 64px; }
.quick-head-toggle { width: 46px; }
input.quick-num { width: 64px; min-height: 38px; padding: 6px 8px; text-align: center; font-variant-numeric: tabular-nums; }

/* Orders board: stages stacked on phones, four columns on wide screens. */
.board-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.board-cancelled { min-height: 36px; gap: 10px; font-size: .875rem; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: .9375rem; font-weight: 500; cursor: pointer;
}
.chip-btn[aria-pressed="true"] { border-color: var(--ember); background: var(--ember-tint); color: var(--ember-text); font-weight: 600; }
.chip-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--ember-strong); color: #fff; font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.chip-count[hidden] { display: none; }
.board { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .board { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
.board-col { display: grid; gap: 10px; align-content: start; }
.board-col > h2 { display: flex; align-items: center; gap: 8px; font-size: .9375rem; }
.board-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--sunken); color: var(--text-2); font-size: .75rem; font-weight: 700;
}
.order-card {
  display: grid; gap: 8px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1);
}
.order-card.is-cancelled { opacity: .6; }
.order-top { display: flex; align-items: center; gap: 10px; }
.order-no { font-size: 1.0625rem; }
.order-time { color: var(--ember-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.order-paid { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--text-2); font-size: .8125rem; font-weight: 600; cursor: pointer; }
.order-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 600; }
.order-contact { display: inline-flex; align-items: center; gap: 4px; color: var(--ember-text); font-weight: 500; text-decoration: none; }
.order-items { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.order-notes { color: var(--text-2); font-style: italic; }
.order-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.order-total { margin-right: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ lists */

.rows {
  margin: 0; padding: 0; list-style: none; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-1);
}
.row-item { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.row-item + .row-item { border-top: 1px solid var(--line); }
.row-link {
  flex: 1; min-width: 0; align-self: stretch;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  color: inherit; text-decoration: none;
}
.row-link:hover { background: var(--surface-2); }
.row-link:focus-visible { outline-offset: -2px; }
.row-item > .row-main { padding: 10px 14px; }
.row-item > .btn, .row-item > select { margin-right: 14px; }
.thumb {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; overflow: hidden;
  border-radius: 10px; background: var(--sunken); color: var(--text-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-title, .row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Names matter more than tidy rows on a phone: up to two lines before cutting off. */
.row-title { font-weight: 600; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.row-sub { font-size: .875rem; font-variant-numeric: tabular-nums; }
.row-sub:empty { display: none; }
.row-switches { display: flex; gap: 14px; padding-right: 14px; }
.row-switch { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.row-switch-label { max-width: 5.5em; color: var(--text-2); font-size: .6875rem; font-weight: 600; line-height: 1.15; text-align: center; }
.row-team { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; }
.row-team > .row-main { flex-basis: 220px; padding: 0; }
.row-team > select, .row-team > .btn { margin-right: 0; }
.row-team > select { width: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; }

.badge {
  flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--sunken);
  color: var(--text-2); font-size: .75rem; font-weight: 700; letter-spacing: .02em;
}
.badge-draft { border-color: transparent; background: var(--ember-tint); color: var(--ember-text); }

/* ------------------------------------------------------------------ photos */

.media-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.media-grid > p { grid-column: 1 / -1; }
.media-tile {
  display: block; aspect-ratio: 1; padding: 0; overflow: hidden;
  border: 0; border-radius: 10px; background: var(--sunken); cursor: pointer;
}
.media-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.media-tile:hover img { transform: scale(1.04); }
.media-tile:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; }
.media-grid-lg { gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 900px) { .media-grid-lg { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.media-card {
  display: grid; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1);
}
.media-card > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--sunken); }
.media-card figcaption { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 8px; padding: 10px; }
.media-card figcaption > input { grid-column: 1 / -1; min-height: 38px; padding: 6px 10px; }

/* Photo picker: a centred dialog on desktop, a bottom sheet on phones. */
.modal {
  width: min(100% - 24px, 720px); max-height: min(100% - 24px, 760px); padding: 0;
  border: 0; border-radius: var(--radius-lg); background: var(--bg); color: var(--text); box-shadow: var(--shadow-2);
}
.modal[open] { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.modal::backdrop { background: rgba(12, 10, 9, .55); }
.modal > .media-grid { min-height: 120px; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.upload-btn { width: 100%; }
@media (max-width: 599px) {
  .modal { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .modal[open] { padding-bottom: calc(16px + env(safe-area-inset-bottom)); animation: rise .2s ease-out; }
}

/* ------------------------------------------------------------------ live preview */

/* Wide screens: the form on the left, the real website on the right, sticky while you scroll. */
.page-wide { max-width: 1480px; }
.with-preview { display: grid; gap: 24px; align-items: start; }
@media (min-width: 1100px) {
  .with-preview { grid-template-columns: minmax(0, 600px) minmax(0, 1fr); }
  /* 100vh less the page heading above it, so its bottom edge (and the site's "not live" badge) is on screen */
  .with-preview > .preview-panel { position: sticky; top: 24px; height: calc(100vh - 140px); }
}
.preview-panel {
  display: flex; flex-direction: column; min-height: 420px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-1);
}
.preview-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.preview-title { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; font-weight: 600; }
input.preview-path { width: 10em; min-height: 32px; padding: 4px 8px; font-family: var(--mono); font-size: .875rem; }
.preview-status { margin-left: auto; color: var(--text-2); font-size: .8125rem; }
/* The website inside: phone width centred, or desktop width scaled to fit (lib/preview.js deviceFrame). */
.frame-box { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #fff; }
.frame-box.is-phone { background: var(--sunken); }
.frame-box > iframe { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; }
.frame-box.is-phone > iframe { box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-2); }
.device-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.device-btn {
  display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 9px;
  border: 0; border-radius: 8px; background: none; color: var(--text-2); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer;
}
.device-btn:hover { color: var(--text); }
.device-btn[aria-pressed="true"] { background: var(--ember-tint); color: var(--ember-text); }
@media (max-width: 599px) { .device-switch { display: none; } } /* a phone shows the phone view: a desktop page would be a third the size */
.preview-empty { margin: 0; padding: 24px; color: var(--text-2); }
/* Phones: full screen. */
.modal.preview-sheet { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border-radius: 0; }
.modal.preview-sheet[open] { display: flex; padding: 0; }
.preview-sheet > .preview-panel { flex: 1; border: 0; border-radius: 0; }
@media (max-width: 599px) { input.preview-path { width: 6.5em; font-size: 1rem; } } /* under 16px, iPhones zoom in */

/* ------------------------------------------------------------------ website editor */
/* The real website fills the screen; the panel is below it on phones (both stay in view while
   you type) and beside it on wide screens. */
.main:has(> .page-editor) { padding-bottom: 0; }
.page-editor { max-width: none; padding: 0; }
.page-editor > * + * { margin-top: 0; }
.editor {
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.editor-site { display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid var(--line); }
.editor-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.editor-panel { display: flex; flex-direction: column; min-height: 0; max-height: 42dvh; background: var(--surface); }
.editor-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 12px; align-content: start; padding: 14px 16px 18px; }
.editor-body > * { margin: 0; }
.editor-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2);
}
.editor-foot .btn[hidden] { display: none; }
.editor-pending { margin: 0; color: var(--text-2); font-size: .875rem; }
.editor-pending.has-changes { color: var(--ember-text); font-weight: 600; }
.editor-title { display: block; font-size: 1.125rem; font-weight: 700; line-height: 1.3; }
.editor-sub { margin: 6px 0 6px; color: var(--text-3); font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.editor-kind { color: var(--text-2); font-size: .8125rem; font-weight: 600; }
.editor-body .back { margin: 0 0 0 -6px; justify-self: start; }
button.back { border: 0; background: none; font: inherit; font-size: .9375rem; cursor: pointer; }
.spots { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.spot {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.spot:hover { border-color: var(--line-strong); background: var(--surface-2); }
.spot-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.spot-label { font-size: .9375rem; font-weight: 600; }
.spot-text { overflow: hidden; color: var(--text-2); font-size: .8125rem; text-overflow: ellipsis; white-space: nowrap; }
.spot-text:empty { display: none; }
.badge-error { border-color: transparent; background: var(--danger-tint); color: var(--danger); }
.words-field { display: grid; gap: 4px; }
.words-field textarea { resize: vertical; }
.words-field > .field-help { justify-self: end; font-variant-numeric: tabular-nums; }
.link-field { display: grid; gap: 10px; }
.link-field .field-label { display: grid; gap: 4px; }
.words-field > .field-count { justify-self: end; font-variant-numeric: tabular-nums; }
.rich-tools { display: grid; gap: 8px; }
.rich-tools .field-help { margin-left: 4px; }
.rich-link { display: flex; gap: 8px; }
.rich-link[hidden] { display: none; }
.rich-link input { flex: 1; min-width: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
/* A repeatable group: one card per item. */
.group-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.group-item { display: grid; gap: 10px; padding: 10px 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.group-item-head { display: flex; align-items: center; gap: 4px; }
.group-item-no {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-right: 6px; padding: 0 6px;
  border-radius: 999px; background: var(--sunken); color: var(--text-2); font-size: .75rem; font-weight: 700;
}
.group-item-title { flex: 1; min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.group-item .field { display: grid; gap: 4px; }
/* History and earlier versions. */
.history, .versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.history-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.history-what { font-weight: 600; font-size: .9375rem; }
.history-item .btn[hidden] { display: none; }
.versions-box > summary { cursor: pointer; color: var(--text-2); font-size: .875rem; font-weight: 600; }
.versions-box[open] > summary { margin-bottom: 8px; }
.versions > li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.versions > li > .btn { grid-row: span 2; }
.version-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; }
/* A product's daily switches, right in the panel. */
.quick-list { display: grid; gap: 4px; }
.quick-list .switch-label { display: grid; gap: 2px; }
@media (min-width: 900px) { .editor { height: 100vh; height: 100dvh; } } /* the side menu instead of the top and tab bars */
@media (min-width: 1100px) {
  .editor { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) 380px; }
  .editor-site { border-bottom: 0; border-right: 1px solid var(--line); }
  .editor-panel { max-height: none; }
}

/* ------------------------------------------------------------------ empty, toast, loading */

.empty {
  display: grid; justify-items: center; gap: 14px; padding: 40px 20px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
  color: var(--text-2); text-align: center;
}
.empty-error { border-style: solid; border-color: transparent; background: var(--danger-tint); color: var(--danger); }

.toast {
  position: fixed; z-index: 60; left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  width: max-content; max-width: min(92vw, 440px); padding: 12px 16px; /* max-content: centred with left:50%, it would otherwise wrap at half the screen */
  border-radius: 12px; background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--shadow-2);
  font-size: .9375rem; font-weight: 500;
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast-ok::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; vertical-align: 1px;
  border-radius: 50%; background: var(--coal); box-shadow: 0 0 8px #FF922B;
}
.toast-error { background: var(--danger-fill); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* While a screen loads: heat moving along the top edge. Only shows if loading takes a moment. */
body.is-loading::after {
  content: ""; position: fixed; z-index: 100; top: 0; left: 0; width: 40%; height: 3px;
  background: linear-gradient(90deg, transparent, #FF922B 35%, #FFD8A8 50%, #FF922B 65%, transparent);
  opacity: 0;
  animation: heat 1.1s ease-in-out infinite, show .2s ease-out .25s forwards;
}
@keyframes heat { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes show { to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------------ sign in */

.auth {
  display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px 56px;
  /* the mouth of the kiln: a low warm glow under the card */
  background:
    radial-gradient(120% 55% at 50% 118%, rgba(247, 103, 7, .24), rgba(247, 103, 7, .07) 45%, transparent 70%),
    var(--bg);
}
.auth-card {
  display: grid; gap: 16px; width: 100%; max-width: 400px; padding: 28px 24px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-2);
}
.auth-card > .brand { margin-bottom: 8px; }
.auth-card h1 { font-size: 1.625rem; }
.auth-card form { display: grid; gap: 16px; }
.auth-foot { font-size: .9375rem; text-align: center; }
.auth-foot a { color: var(--text-2); }
.auth-foot a:hover { color: var(--text); }
input.code-input {
  padding-left: calc(12px + .45em);
  font-family: var(--mono); font-size: 1.75rem; font-variant-numeric: tabular-nums;
  letter-spacing: .45em; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  body.is-loading::after { left: 0; width: 100%; transform: none; }
}
