/* PlateBill - one stylesheet for every page.
   Tokens first, then the shell, then components, then the responsive rules. */

:root {
  --bg: #f4f3ee;
  --bg-2: #ecebe4;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --line: rgba(20, 33, 61, 0.10);
  --line-strong: rgba(20, 33, 61, 0.18);
  --text: #121a2b;
  --text-2: #4b556a;
  --muted: #7a8599;
  --brand: #d8322d;
  --brand-ink: #b3261e;
  --brand-soft: rgba(216, 50, 45, 0.10);
  --navy: #14213d;
  --navy-2: #1f3a5f;
  --ok: #15803d;      --ok-soft: rgba(21, 128, 61, 0.10);
  --warn: #b45309;    --warn-soft: rgba(180, 83, 9, 0.11);
  --bad: #b42318;     --bad-soft: rgba(180, 35, 24, 0.09);
  --focus: 0 0 0 3px rgba(31, 58, 95, 0.22);
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 1px rgba(16, 24, 40, 0.03);
  --shadow-2: 0 2px 4px rgba(16, 24, 40, 0.04), 0 16px 40px -16px rgba(16, 24, 40, 0.18);
  --shadow-3: 0 24px 64px -24px rgba(16, 24, 40, 0.35);
  --r-lg: 18px; --r-md: 12px; --r-sm: 9px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218; --bg-2: #141922; --surface: #171c26; --surface-2: #1d2330;
    --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.16);
    --text: #eef1f6; --text-2: #b4bccb; --muted: #7f8a9d;
    --brand: #ef5a55; --brand-ink: #ff7a75; --brand-soft: rgba(239, 90, 85, 0.14);
    --navy: #0b1222; --navy-2: #243b5e;
    --ok: #4ade80; --ok-soft: rgba(74, 222, 128, 0.12);
    --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, 0.12);
    --bad: #f87171; --bad-soft: rgba(248, 113, 113, 0.12);
    --focus: 0 0 0 3px rgba(96, 165, 250, 0.35);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
    --shadow-3: 0 24px 64px -24px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; overflow-x: hidden; font: 15px/1.5 var(--font); color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 10% -10%, rgba(216, 50, 45, 0.07), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(31, 58, 95, 0.10), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
@view-transition { navigation: auto; }
::selection { background: rgba(216, 50, 45, 0.18); }
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-in {
  max-width: 1200px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: nowrap; min-width: 0;
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none !important; min-width: 0; }
.brand .mark { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 2px 6px rgba(216,50,45,.25)); }
.brand .name { line-height: 1.1; min-width: 0; }
.brand .name b { display: block; font-weight: 800; letter-spacing: .02em; font-size: 15px; white-space: nowrap; }
.brand .name span { display: block; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 4px; margin-left: 8px; padding: 4px; border-radius: 999px; background: var(--bg-2); }
.nav a { padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13.5px; color: var(--text-2); white-space: nowrap; transition: background .2s var(--ease), color .2s; }
.nav a:hover { text-decoration: none; color: var(--text); }
.nav a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--line);
  white-space: nowrap; max-width: 100%;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.chip.on .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.chip.off .dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.chip.bad .dot { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.chip span.t { overflow: hidden; text-overflow: ellipsis; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; transition: background .2s, transform .15s var(--ease); }
.iconbtn:hover { background: var(--bg-2); color: var(--text); }
.iconbtn:active { transform: scale(.96); }

.page { max-width: 1200px; margin: 0 auto; padding: 26px 20px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { margin: 0; font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.lede { margin: 6px 0 0; color: var(--text-2); font-size: 15px; max-width: 60ch; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--brand); margin-bottom: 8px; }
h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.005em; }
.sub { color: var(--muted); font-size: 13px; }

/* ---------- cards & surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); padding: 20px; margin-bottom: 16px; position: relative;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); margin-bottom: 14px; font-size: 14px; line-height: 1.45; border: 1px solid transparent; }
.banner > svg, .banner .ic { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.banner > div { min-width: 0; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.banner.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.banner.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.banner.info { background: color-mix(in srgb, var(--navy-2) 9%, transparent); color: var(--text-2); border-color: var(--line); }
.banner b { color: inherit; }
.banner code { font: 12.5px ui-monospace, Menlo, monospace; background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }

/* ---------- controls ---------- */
.btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; border-radius: 12px; min-height: 44px; letter-spacing: .005em;
  color: #fff; background: linear-gradient(180deg, var(--navy-2), var(--navy));
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 8px 20px -10px rgba(20, 33, 61, .7);
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), filter .2s, opacity .2s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 12px 26px -12px rgba(20, 33, 61, .8); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .5; cursor: default; transform: none; filter: none; }
.btn.brand { background: linear-gradient(180deg, #e24641, var(--brand-ink)); box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 10px 24px -10px rgba(216,50,45,.7); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow-1); }
.btn.ghost:hover { background: var(--bg-2); filter: none; }
.btn.subtle { background: transparent; color: var(--text-2); box-shadow: none; padding: 10px 12px; min-height: 40px; }
.btn.subtle:hover { background: var(--bg-2); color: var(--text); filter: none; }
.btn.sm { padding: 8px 12px; min-height: 36px; font-size: 13.5px; border-radius: 10px; }
.btn.lg { padding: 15px 26px; font-size: 16px; border-radius: 14px; min-height: 52px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.ghost .spin { border-color: var(--line-strong); border-top-color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.input, select.input, textarea.input {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px 12px; min-height: 42px; width: 100%; min-width: 0; max-width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
select.input { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.input:hover { border-color: color-mix(in srgb, var(--navy-2) 45%, var(--line-strong)); }
.input:focus { outline: none; border-color: var(--navy-2); box-shadow: var(--focus); background: var(--surface); }
select.input { -webkit-appearance: none; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a8599' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; }
.input.num { text-align: right; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.drop {
  position: relative; border: 1.5px dashed var(--line-strong); border-radius: 16px; padding: 34px 20px; text-align: center;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); cursor: pointer; transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.drop:hover, .drop.over { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-soft), var(--surface)); }
.drop.over { transform: scale(1.01); }
.drop .cam { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 14px; color: #fff;
  background: linear-gradient(145deg, #e24641, var(--brand-ink)); box-shadow: 0 14px 30px -12px rgba(216,50,45,.75); }
.drop .cam svg { width: 30px; height: 30px; }
.drop h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.drop p { margin: 0; color: var(--muted); font-size: 13.5px; }
.drop input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.preview { position: relative; margin-top: 16px; border-radius: 14px; overflow: hidden; background: #0d1117; box-shadow: var(--shadow-2); }
.preview img { display: block; width: 100%; max-height: 62vh; object-fit: contain; }
.preview .scan { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s; }
.preview.reading .scan { opacity: 1; }
.preview .scan::before { content: ""; position: absolute; left: 0; right: 0; height: 36%; top: -40%;
  background: linear-gradient(180deg, transparent, rgba(216,50,45,.22) 60%, rgba(255,255,255,.75) 99%, transparent);
  animation: scan 2.2s var(--ease) infinite; }
.preview .scan::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(255,255,255,.035) 22px 23px); }
.preview .badge { position: absolute; left: 12px; top: 12px; padding: 6px 10px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 600; backdrop-filter: blur(6px); }
.steps { display: grid; gap: 10px; margin-top: 16px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); transition: all .3s var(--ease); }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--bg-2); color: var(--muted); flex: none; }
.step.active { color: var(--text); border-color: color-mix(in srgb, var(--navy-2) 40%, var(--line)); background: var(--surface); box-shadow: var(--shadow-1); }
.step.active .n { background: var(--navy-2); color: #fff; animation: pulse 1.6s ease-in-out infinite; }
.step.done { color: var(--text-2); }
.step.done .n { background: var(--ok); color: #fff; }
.howto { display: grid; gap: 12px; }
.howto .it { display: flex; gap: 12px; align-items: flex-start; }
.howto .it .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--bg-2); color: var(--navy-2); flex: none; }
.howto .it .ic svg { width: 18px; height: 18px; }
.howto b { display: block; font-size: 14px; }
.howto span { color: var(--muted); font-size: 13px; }
.recent { display: grid; gap: 8px; }
.recent a.item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: inherit; transition: background .2s, transform .2s var(--ease); }
.recent a.item:hover { text-decoration: none; background: var(--bg-2); transform: translateX(2px); }
.recent .no { font-weight: 800; font-size: 13.5px; }
.recent .who { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .amt { font-weight: 700; font-size: 13.5px; }

/* ---------- review ---------- */
.review { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.6fr); gap: 18px; align-items: start; }
.photo-card { position: sticky; top: 76px; padding: 12px; }
.photo-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.photo-tools .zoom { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo-tools .zoom button { border: 0; background: var(--surface); color: var(--text); width: 36px; height: 34px; cursor: pointer; font-weight: 700; font-size: 16px; }
.photo-tools .zoom button:hover { background: var(--bg-2); }
.photo-tools .zoom button + button { border-left: 1px solid var(--line); }
.photo-wrap { position: relative; overflow: auto; max-height: calc(100dvh - 190px); border-radius: 12px; background: #0d1117; touch-action: pan-x pan-y pinch-zoom; overscroll-behavior: contain; cursor: zoom-in; }
.photo-wrap img { display: block; width: 100%; max-width: none; transition: width .25s var(--ease); user-select: none; -webkit-user-drag: none; }
.photo-wrap.zoomed { cursor: grab; }
.lightbox { position: fixed; inset: 0; z-index: 110; background: rgba(6, 9, 14, .94); display: grid; grid-template-rows: auto 1fr; animation: fadein .25s var(--ease) both; }
.lightbox .bar { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; color: #fff; }
.lightbox .bar b { font-size: 14px; opacity: .85; }
.lightbox .bar .zoom { border-color: rgba(255,255,255,.25); }
.lightbox .bar .zoom button { background: rgba(255,255,255,.08); color: #fff; }
.lightbox .bar .zoom button + button { border-left-color: rgba(255,255,255,.2); }
.lightbox .bar .iconbtn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.lightbox .lb-wrap { overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.lightbox img { display: block; width: 100%; max-width: none; margin: 0 auto; transition: width .25s var(--ease); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.photo-toggle { display: none; }
.lines { display: grid; gap: 8px; }
.line-head, .line { display: grid; grid-template-columns: 28px minmax(0, 2.2fr) 150px 96px 84px 100px 34px; gap: 8px; align-items: center; }
.line-head { padding: 0 8px 6px; }
.line-head .lbl { font-size: 10.5px; }
.line { padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); transition: background .2s, border-color .2s, box-shadow .2s; animation: rise .4s var(--ease) both; }
.line:hover { background: var(--surface); box-shadow: var(--shadow-1); }
.line.flagged { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface-2)); }
.line .n { font-size: 12.5px; font-weight: 800; color: var(--muted); text-align: center; }
.line .input { min-height: 40px; padding: 8px 10px; }
.line .amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.line .x { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.line .x:hover { background: var(--bad-soft); color: var(--bad); }
.line .cell { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.line .cell .m { display: none; }
.line .note { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.4; color: var(--warn); padding: 2px 4px 0; }
.line .note.check { color: var(--bad); font-weight: 600; }
.line .note.extra { color: var(--muted); }
.line .note:empty { display: none; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 7px 24px; font-size: 14.5px; max-width: 380px; margin-left: auto; }
.totals .k { color: var(--text-2); }
.totals .v { text-align: right; font-variant-numeric: tabular-nums; }
.totals .big { font-weight: 800; font-size: 20px; border-top: 2px solid var(--line-strong); padding-top: 9px; margin-top: 3px; }
.words { margin-top: 10px; font-size: 12.5px; color: var(--muted); text-align: right; letter-spacing: .02em; }
.cta { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.stickybar { display: none; }

/* ---------- invoices ---------- */
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-weight: 700; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.new { animation: glow 2.4s var(--ease) 1; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.inv-cards { display: none; }

/* ---------- gate, toasts, dialogs ---------- */
.gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }
.gate .box { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-3); padding: 28px; text-align: center; animation: pop .45s var(--ease) both; }
.gate .mark { width: 56px; height: 56px; margin: 0 auto 12px; display: block; }
.gate h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.gate p { color: var(--text-2); margin: 0 0 18px; font-size: 14px; }
.gate .pin { font-size: 24px; letter-spacing: .5em; text-align: center; padding-left: calc(12px + .5em); font-weight: 700; }
.gate .err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 8px 0 0; font-weight: 600; }
.setup { text-align: left; margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.setup code { font: 12.5px ui-monospace, Menlo, monospace; background: rgba(0,0,0,.07); padding: 1px 6px; border-radius: 4px; }
.setup ol { margin: 8px 0 0; padding-left: 18px; }
#toasts { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; width: min(480px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--navy); color: #fff; font-size: 14px; line-height: 1.4; box-shadow: var(--shadow-3); animation: toastin .4s var(--ease) both; }
.toast.bad { background: #8f1d16; }
.toast.ok { background: #0f6b36; }
.toast.out { animation: toastout .3s var(--ease) both; }
.dialog { position: fixed; inset: 0; z-index: 90; display: grid; place-items: end center; padding: 16px; background: rgba(10, 14, 22, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dialog .sheet { width: min(520px, 100%); background: var(--surface); border-radius: 22px; padding: 26px; box-shadow: var(--shadow-3); border: 1px solid var(--line); animation: sheetin .45s var(--ease) both; text-align: center; }
.dialog .tick { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.dialog .tick svg { width: 32px; height: 32px; }
.dialog h2 { font-size: 20px; font-weight: 800; }
.dialog .amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.dialog p { color: var(--text-2); margin: 0 0 18px; }
.dialog .acts { display: grid; gap: 10px; }
@media (min-width: 640px) { .dialog { place-items: center; } }

/* ---------- skeleton & motion ---------- */
.skel { position: relative; overflow: hidden; background: var(--bg-2); border-radius: 10px; min-height: 14px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 1.4s infinite; }
.reveal { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes sheetin { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes toastin { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateY(8px); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scan { 0% { top: -40%; } 100% { top: 110%; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(31,58,95,.35); } 50% { box-shadow: 0 0 0 8px rgba(31,58,95,0); } }
@keyframes glow { 0% { background: var(--ok-soft); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .review { grid-template-columns: 1fr; }
  .photo-card { position: static; }
  .photo-wrap { max-height: 38vh; }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar-in { padding: 8px 14px; gap: 8px; }
  .brand { flex: 0 1 auto; overflow: hidden; }
  .brand .mark { width: 34px; height: 34px; }
  .brand .name span { display: none; }
  .brand .name b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  .nav { margin-left: 0; flex: none; }
  .nav a { padding: 6px 9px; font-size: 12.5px; }
  .iconbtn { width: 34px; height: 34px; flex: none; }
  .chip .t { display: none; }
  .chip { padding: 8px; }
  .page { padding: 18px 14px 130px; }
  .card { padding: 16px; border-radius: 16px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 .span { grid-column: 1 / -1; }
  .line-head { display: none; }
  .line { grid-template-columns: 1fr 1fr; grid-template-areas:
      "desc desc" "plating qty" "rate amt" "note note"; padding: 12px; gap: 10px; position: relative; }
  .line .n { position: absolute; top: -8px; left: 10px; background: var(--navy-2); color: #fff; font-size: 11px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
  .line .c-desc { grid-area: desc; padding-top: 6px; }
  .line .c-plating { grid-area: plating; }
  .line .c-qty { grid-area: qty; }
  .line .c-rate { grid-area: rate; }
  .line .c-amt { grid-area: amt; align-items: flex-end; justify-content: flex-end; }
  .line .cell .m { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .line .x { position: absolute; top: 6px; right: 6px; }
  .line .amt { font-size: 16px; }
  .line .note { grid-area: note; }
  .totals { max-width: none; }
  .cta { display: none; }
  .stickybar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
  .stickybar .k { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .stickybar .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
  .photo-toggle { display: inline-flex; }
  .photo-card.collapsed .photo-wrap, .photo-card.collapsed .photo-tools .zoom { display: none; }
  .table-wrap { display: none; }
  .inv-cards { display: grid; gap: 10px; }
  .inv-card { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 6px; }
  .inv-card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
  .inv-card .no { font-weight: 800; }
  .inv-card .amt { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
  .inv-card .who { color: var(--text-2); font-size: 13.5px; }
  .inv-card .meta { color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .dialog .sheet { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .dialog { padding: 0; }
}
@media (max-width: 420px) {
  .brand .name { display: none; }      /* the mark alone; the name is on every screen anyway */
}
@media (max-width: 380px) {
  .grid-3 { grid-template-columns: 1fr; }
}
