/* White Star Invoicing — same look as white-star.uk (fonts from /site/fonts) */
@font-face { font-family: "WS Stencil"; src: url(fonts/stardos-stencil-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(fonts/barlow-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --brown: #53441d;
  --brown-deep: #2b230d;
  --brown-2: #433716;
  --amber: #e9ac25;
  --amber-2: #f6c75a;
  --sand: #e4d6b0;
  --brown-soft: #7a6838;
  --cream: #f4eddb;
  --paper: #fbf8f0;
  --line: #ddd0ad;
  --ink: #1e190c;
  --muted: #6b6047;
  --ok: #2f6b3a;
  --ok-bg: #e6f1e4;
  --warn: #9a5a00;
  --warn-bg: #fbefd9;
  --danger: #a3261b;
  --danger-bg: #fbe5e2;
  --radius: 6px;
  --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --stencil: "WS Stencil", "Rockwell", Georgia, serif;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --ui: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 16px/1.45 var(--ui);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--brown); color: #fff;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.topbar .star { width: 34px; height: 34px; border-radius: 8px; flex: none; }
.topbar h1 {
  margin: 0; font: 700 17px/1.1 var(--stencil); letter-spacing: .08em; text-transform: uppercase;
}
.topbar small { display: block; font: 500 11px/1.2 var(--ui); letter-spacing: .06em; opacity: .8; text-transform: uppercase; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; opacity: .85; text-align: right; }

/* ---------- Layout ---------- */
main { max-width: 760px; margin: 0 auto; padding: 14px 12px calc(150px + var(--safe-b)); }
.view-title { font: 700 22px/1.2 var(--stencil); margin: 6px 4px 12px; color: var(--brown-deep); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(60,45,10,.05);
}
.card h2 {
  margin: 0 0 10px; font: 700 13px/1.2 var(--ui); letter-spacing: .09em; text-transform: uppercase; color: var(--brown);
  display: flex; align-items: center; gap: 8px;
}
.card h2 .step {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brown); color: #fff;
  display: inline-grid; place-items: center; font-size: 12px; letter-spacing: 0;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .grid-2.stack-sm { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 16px; /* 16px stops iPhone zooming in */
  appearance: none; -webkit-appearance: none;
}
select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--brown) 50%), linear-gradient(135deg, var(--brown) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 12px) 21px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px;
}
textarea.input { min-height: 84px; resize: vertical; line-height: 1.4; }
.input:focus { outline: none; border-color: var(--brown-soft); box-shadow: 0 0 0 3px rgba(122,104,56,.18); }
.input[readonly] { background: #f7f4ec; }
.money-wrap { position: relative; }
.money-wrap::before { content: "£"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money-wrap .input { padding-left: 26px; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); }
.check input { width: 22px; height: 22px; accent-color: var(--brown); }
.hint { font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; color: var(--brown-deep); font-weight: 650; cursor: pointer; text-decoration: none;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--brown); border-color: var(--brown); color: #fff; }
.btn-primary:active { background: var(--brown-deep); }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); border-color: #efc7c2; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-radius: 10px; }
.btn-stack { display: grid; gap: 10px; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* quick add chips */
.quick-add { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.quick-add .btn { min-height: 54px; flex-direction: column; gap: 0; font-size: 14px; line-height: 1.15; padding: 4px; }
.quick-add .btn b { font-size: 15px; }
.quick-add .btn small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.quick-add .btn.day { background: var(--brown); border-color: var(--brown); color: #fff; }
.quick-add .btn.day small { color: #e9e1c9; }

/* ---------- Work entries ---------- */
.entries { display: grid; gap: 10px; margin-bottom: 10px; }
.entry {
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 10px;
  border-left: 5px solid var(--brown);
}
.entry[data-type="materials"] { border-left-color: #8a7a4a; }
.entry[data-type="note"] { border-left-color: #bbb; }
.entry-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.entry-head select.input { min-height: 40px; padding: 6px 30px 6px 10px; font-weight: 650; width: auto; flex: 1; background-position: calc(100% - 16px) 17px, calc(100% - 10px) 17px; }
.entry-head .amount { font-weight: 750; font-size: 17px; white-space: nowrap; color: var(--brown-deep); }
.entry .input.date { min-height: 44px; }
.entry textarea.input { min-height: 70px; }
.qty-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: end; margin-top: 8px; }
.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { width: 44px; height: 44px; border: 0; background: #f4efe2; font-size: 22px; font-weight: 700; color: var(--brown); }
.stepper input { width: 58px; height: 44px; border: 0; text-align: center; font-size: 17px; font-weight: 700; }
.stepper input:focus { outline: none; }
.mini-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 3px; display: block; }
.entry-tools { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.empty { text-align: center; color: var(--muted); padding: 18px 10px; border: 1.5px dashed var(--line); border-radius: 12px; margin-bottom: 10px; }

details.more { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
details.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 650; color: var(--brown); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "＋"; margin-left: auto; }
details.more[open] summary::after { content: "－"; }

.customer-preview { background: #f7f4ec; border-radius: 10px; padding: 10px 12px; white-space: pre-line; font-family: "Times New Roman", Georgia, serif; font-size: 15.5px; margin-bottom: 10px; }

/* ---------- Sticky total bar ---------- */
.totalbar {
  position: fixed; left: 0; right: 0; bottom: calc(62px + var(--safe-b)); z-index: 25;
  background: var(--paper); border-top: 1px solid var(--line);
  padding: 8px 12px; box-shadow: 0 -4px 14px rgba(60,45,10,.08);
}
.totalbar .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.totalbar .sum { flex: 1; line-height: 1.15; }
.totalbar .sum b { font-size: 21px; color: var(--brown-deep); display: block; }
.totalbar .sum span { font-size: 12.5px; color: var(--muted); }
.totalbar .btn { min-width: 150px; }

/* ---------- Bottom tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 26;
  background: var(--brown-deep); display: flex; padding-bottom: var(--safe-b);
}
.tabs button {
  flex: 1; height: 62px; border: 0; background: transparent; color: #d9cfb4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
}
.tabs button svg { width: 23px; height: 23px; }
.tabs button.active { color: #fff; background: rgba(255,255,255,.08); box-shadow: inset 0 3px 0 #e8dcb5; }

/* ---------- Sheets (bottom drawer dialogs) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(30,24,8,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .18s; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  background: var(--paper); width: 100%; max-width: 760px; max-height: 92vh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 8px 16px calc(18px + var(--safe-b));
  transform: translateY(30px); transition: transform .2s;
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: #d8cfb8; margin: 4px auto 10px; }
.sheet h3 { margin: 0 0 12px; font: 700 19px/1.2 var(--stencil); color: var(--brown-deep); display: flex; align-items: center; gap: 8px; }
.sheet h3 .x { margin-left: auto; }
@media (min-width: 800px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; } }

/* ---------- Preview ---------- */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; background: #efe8d6; border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.mode-switch button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; font-weight: 650; color: var(--muted); font-size: 14px; }
.mode-switch button.on { background: #fff; color: var(--brown-deep); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pages { display: grid; gap: 10px; margin-bottom: 12px; }
.pages img { width: 100%; display: block; border-radius: 6px; box-shadow: 0 2px 12px rgba(40,30,5,.18); background: #fff; }
.pages.plain img { outline: 1px dashed #b9ae92; outline-offset: -1px; }

.choices { display: grid; gap: 8px; margin-bottom: 12px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-height: 62px;
  padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer;
}
.choice .ic { width: 38px; height: 38px; border-radius: 50%; background: #f1ead7; display: grid; place-items: center; font-size: 18px; flex: none; }
.choice b { display: block; font-size: 16px; color: var(--brown-deep); }
.choice small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.choice.on { border-color: var(--brown); background: #fbf7ec; box-shadow: 0 0 0 3px rgba(83,68,29,.12); }
.choice.on .ic { background: var(--brown); color: #fff; }
.choice:disabled { opacity: .5; }

.dates-block { margin-bottom: 8px; }
.date-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { min-height: 38px; padding: 0 12px; border-radius: 19px; border: 1.5px solid var(--brown); background: var(--brown); color: #fff; font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chip span { opacity: .75; font-size: 12px; }
.chip.chip-add { background: #fff; color: var(--brown-deep); border-color: var(--line); }
.cal { margin-top: 8px; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; background: #fffdf8; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head b { font-size: 15.5px; color: var(--brown-deep); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow span { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 2px 0; }
.cal-grid button { position: relative; height: 42px; border-radius: 10px; border: 1px solid transparent; background: #f4efe2; font-size: 15.5px; font-weight: 600; color: var(--ink); }
.cal-grid button.today { border-color: var(--brown-soft); }
.cal-grid button.on { background: var(--brown); color: #fff; }
.cal-grid button.used::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #c08a2a; }

/* website control panel */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 600px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.ph { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: #e9e1cc; cursor: pointer; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-tags { position: absolute; top: 5px; left: 5px; display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: rgba(255,255,255,.92); color: var(--brown-deep); padding: 2px 6px; border-radius: 6px; }
.tag.hero { background: #e9ac25; }
.ph-cat { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(30,24,8,.8)); color: #fff; font-size: 11.5px; font-weight: 700; padding: 14px 6px 5px; text-align: left; }
.enq-done { opacity: .7; }
#enqBadge { color: #c27c00; }

/* ---------- Lists ---------- */
.search { margin-bottom: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chips button { flex: none; min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1.5px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; color: var(--muted); }
.chips button.on { background: var(--brown); border-color: var(--brown); color: #fff; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; color: var(--brown-deep); }
.stat span { font-size: 12.5px; color: var(--muted); }
.list { display: grid; gap: 8px; }
.list-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; text-align: left; width: 100%;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer;
}
.list-item .t { font-weight: 700; }
.list-item .s { font-size: 13px; color: var(--muted); }
.list-item .amt { font-weight: 750; text-align: right; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .04em; }
.badge.unpaid { background: var(--warn-bg); color: var(--warn); }
.badge.paid { background: var(--ok-bg); color: var(--ok); }
.badge.reference { background: #eee; color: #555; }

.section-title { font: 700 12.5px/1 var(--ui); letter-spacing: .09em; text-transform: uppercase; color: var(--brown); margin: 18px 4px 8px; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.notice { border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.notice.warn { background: var(--warn-bg); color: #6d4300; }
.notice.ok { background: var(--ok-bg); color: #1f4d28; }
.done-hero { text-align: center; padding: 10px 0 4px; }
.done-hero .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin: 0 auto 8px; font-size: 34px; }

/* ---------- Toasts / confirm (shared.js) ---------- */
.toast-host { position: fixed; left: 12px; right: 12px; top: calc(70px + var(--safe-t)); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { max-width: 520px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; transform: translateY(-8px); transition: .2s; font-size: 15px; }
.toast.is-visible { opacity: 1; transform: none; }
.toast-error { background: var(--danger); }
.toast-success { background: var(--ok); }
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(30,24,8,.5); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .16s; }
.modal-backdrop.is-open { opacity: 1; }
.modal-card { background: var(--paper); border-radius: 16px; padding: 20px; max-width: 420px; width: 100%; text-align: center; }
.modal-card h2 { margin: 6px 0; font: 700 19px var(--stencil); }
.modal-icon { width: 46px; height: 46px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: #efe8d6; color: var(--brown); font-weight: 800; font-size: 22px; }
.modal-icon.danger { background: var(--danger-bg); color: var(--danger); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.modal-actions .button { min-height: var(--tap); border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-weight: 650; }
.modal-actions .button-primary { background: var(--brown); border-color: var(--brown); color: #fff; }
.modal-actions .button-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth .brandband { background: var(--brown); padding: calc(18px + var(--safe-t)) 12px 14px; text-align: center; }
.auth .brandband img { width: 100%; max-width: 560px; display: block; margin: 0 auto; }
.auth .box { width: 100%; max-width: 440px; margin: 20px auto; padding: 0 16px; }
.auth h1 { font: 700 22px var(--stencil); color: var(--brown-deep); margin: 8px 0 4px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 70px; }
.password-wrap .peek { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--brown); font-weight: 700; min-height: 40px; padding: 0 10px; }
.msg { min-height: 1.4em; margin-top: 10px; color: var(--danger); font-weight: 600; }

/* ---------- Print: headed-paper pages only ---------- */
#printArea { display: none; }
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea img { display: block; width: 210mm; height: 297mm; page-break-after: always; break-after: page; }
  #printArea img:last-child { page-break-after: auto; break-after: auto; }
}


/* =====================================================================
   WEBSITE THEME LAYER – makes the app match white-star.uk
   ===================================================================== */
body { background: var(--paper); font-size: 16.5px; }
.stencil { font-family: var(--stencil); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

/* header – same as the website */
.topbar { min-height: 64px; padding: calc(8px + var(--safe-t)) 16px 8px; box-shadow: 0 3px 18px rgba(30,24,8,.25); }
.topbar .brand { display: flex; flex-direction: column; align-items: flex-start; text-decoration: none; color: #fff; line-height: 1; }
.topbar .brand-name { font: 700 24px/1 var(--stencil); letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.topbar .brand-name svg { width: 19px; height: 19px; color: #fff; }
.topbar .brand-sub { font: 700 10.5px/1 var(--cond); letter-spacing: .26em; text-transform: uppercase; margin-top: 5px; color: var(--sand); }
.topbar .who { font: 600 14px var(--cond); letter-spacing: .1em; text-transform: uppercase; color: #f1e9d2; }
.topbar .site-link { font: 700 14px var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--brown-deep); background: var(--cream); padding: 9px 12px; border-radius: 4px; text-decoration: none; box-shadow: 3px 3px 0 var(--amber); white-space: nowrap; }
@media (max-width: 420px) { .topbar .site-link { display: none; } .topbar .brand-name { font-size: 21px; } }

/* headings, labels, cards */
.view-title { font: 700 clamp(26px, 4vw, 34px)/1.05 var(--stencil); text-transform: uppercase; letter-spacing: .03em; color: var(--brown-deep); margin: 8px 2px 14px; }
.card { background: #fff; border: 2px solid var(--line); border-radius: 6px; padding: 16px; box-shadow: none; }
.card h2 { font: 700 15px/1.2 var(--cond); letter-spacing: .16em; color: var(--brown); }
.card h2 .step { background: var(--brown); color: #fff; border-radius: 3px; font: 700 14px var(--cond); box-shadow: 2px 2px 0 var(--amber); }
.section-title { font: 700 14px/1 var(--cond); letter-spacing: .18em; color: var(--brown); }
label.f > span, .mini-label { font: 700 13.5px/1.2 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--brown); }
.input, select.input, textarea.input { border: 2px solid var(--line); border-radius: 6px; background: var(--paper); font-family: var(--ui); }
.input:focus { border-color: var(--brown); box-shadow: 0 0 0 4px rgba(233,172,37,.25); }
.hint { color: var(--muted); }

/* buttons – website style */
.btn { border-radius: 4px; border: 2px solid var(--line); font: 700 16px/1 var(--cond); letter-spacing: .09em; text-transform: uppercase; color: var(--brown-deep); background: #fff; }
.btn-primary { background: var(--brown); border-color: var(--brown); color: #fff; box-shadow: 4px 4px 0 var(--amber); }
.btn-primary:active { background: var(--brown-deep); }
.btn-primary:disabled { box-shadow: none; }
.btn-danger { color: var(--danger); border-color: #efc7c2; }
.btn-sm { font-size: 14px; min-height: 40px; }
.quick-add .btn { border-radius: 4px; font-family: var(--cond); }
.quick-add .btn b { font: 700 16px/1.1 var(--cond); letter-spacing: .06em; }
.quick-add .btn small { font: 600 13px var(--ui); letter-spacing: 0; text-transform: none; }
.quick-add .btn.day { box-shadow: 3px 3px 0 var(--amber); }
.entry { border-radius: 6px; border-width: 2px; }
.entry-head .amount { font: 700 20px var(--cond); letter-spacing: .04em; }
.chips button, .mode-switch button { font: 700 14.5px/1 var(--cond); letter-spacing: .08em; text-transform: uppercase; }
.chips button { border-radius: 40px; }
.chips button.on { box-shadow: 2px 2px 0 var(--amber); }
.mode-switch { border-radius: 6px; }
.mode-switch button { border-radius: 4px; }
.choice { border-radius: 6px; }
.choice b { font: 700 17px/1.2 var(--cond); letter-spacing: .06em; text-transform: uppercase; }
.list-item { border-radius: 6px; border-width: 2px; }
.list-item .t { font-weight: 700; }
.list-item .amt { font: 700 18px var(--cond); }
.stat { border-radius: 6px; border-width: 2px; background: #fff; }
.stat b { font: 700 24px var(--cond); letter-spacing: .02em; }
.badge { border-radius: 3px; font-family: var(--cond); letter-spacing: .1em; }
.sheet { border-radius: 10px 10px 0 0; background: var(--paper); }
.sheet h3 { font: 700 22px/1.1 var(--stencil); text-transform: uppercase; letter-spacing: .03em; }
.done-hero .tick { background: var(--brown); color: var(--amber); box-shadow: 4px 4px 0 var(--amber); }
.modal-card h2 { font-family: var(--stencil); text-transform: uppercase; }
.customer-preview { background: var(--cream); border-radius: 6px; }
.notice { border-radius: 6px; }

/* bottom bar + tabs */
.totalbar .sum b { font: 700 26px/1 var(--cond); letter-spacing: .02em; }
.totalbar .btn { box-shadow: 4px 4px 0 var(--amber); }
.tabs { background: var(--brown-deep); }
.tabs button { font: 700 12.5px/1 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: #d9cdab; }
.tabs button.active { box-shadow: inset 0 3px 0 var(--amber); color: #fff; }

/* ---------- tablets & desktop: tabs move to the top, wider page ---------- */
@media (min-width: 760px) {
  .tabs { position: sticky; top: calc(64px + var(--safe-t)); bottom: auto; z-index: 29; padding: 0 max(16px, calc((100vw - 1180px) / 2)); background: var(--brown-2); justify-content: flex-start; gap: 4px; box-shadow: 0 2px 10px rgba(30,24,8,.15); }
  .tabs button { flex: none; height: 52px; flex-direction: row; gap: 9px; padding: 0 18px; font-size: 15px; }
  .tabs button svg { width: 20px; height: 20px; }
  .tabs button.active { box-shadow: inset 0 -4px 0 var(--amber); background: rgba(255,255,255,.07); }
  main { max-width: 860px; padding: 22px 24px calc(110px + var(--safe-b)); }
  .totalbar { bottom: 0; }
  .grid-2.stack-sm { grid-template-columns: 1fr 1fr; }
  .quick-add { grid-template-columns: repeat(6, 1fr); }
  .photo-grid { grid-template-columns: repeat(5, 1fr); }
  .sheet { max-width: 640px; border-radius: 10px; }
  .sheet-backdrop { align-items: center; }
  .sheet { max-height: 90vh; }
}

/* ---------- desktop: live invoice preview beside the form (like the original program) ---------- */
.live { display: none; }
@media (min-width: 1180px) {
  body.view-new main { max-width: 1240px; }
  .new-layout { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 28px; align-items: start; }
  .live { display: block; position: sticky; top: 140px; }
  .live .pages { max-height: calc(100vh - 250px); overflow: auto; padding: 4px 8px 8px 4px; }
  .live-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .live-head b { font: 700 14px var(--cond); letter-spacing: .16em; text-transform: uppercase; color: var(--brown); }
  .live .mode-switch { margin: 0; width: 260px; }
  .live .mode-switch button { min-height: 34px; font-size: 12.5px; }
}

/* ---------- sign-in pages: centred card ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--cream); }
.auth-header { background: var(--brown); color: #fff; padding: calc(14px + var(--safe-t)) 16px 14px; display: flex; justify-content: center; box-shadow: 0 3px 18px rgba(30,24,8,.25); }
.auth-header .brand { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: #fff; line-height: 1; }
.auth-header .brand-name { font: 700 30px/1 var(--stencil); letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
.auth-header .brand-name svg { width: 24px; height: 24px; }
.auth-header .brand-sub { font: 700 11.5px/1 var(--cond); letter-spacing: .28em; text-transform: uppercase; margin-top: 6px; color: var(--sand); }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 28px 16px 40px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 2px solid var(--brown-deep); border-radius: 6px; padding: 28px 24px 22px; box-shadow: 8px 8px 0 var(--brown); }
.auth-card .kicker { font: 700 13px/1 var(--cond); letter-spacing: .22em; text-transform: uppercase; color: var(--brown); display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.auth-card .kicker::before { content: ""; width: 28px; height: 3px; background: var(--amber); }
.auth-card h1 { font: 700 32px/1.05 var(--stencil); text-transform: uppercase; letter-spacing: .03em; color: var(--brown-deep); margin: 0 0 6px; }
.auth-card .lead { color: var(--muted); margin: 0 0 18px; }
.auth-card .btn { width: 100%; }
.auth-card .btn + .btn { margin-top: 10px; }
.auth-foot { text-align: center; padding: 0 16px 22px; font-size: 14px; color: var(--muted); }
.auth-foot a { color: var(--brown); font-weight: 600; }

/* alignment touches */
.auth-card .msg:empty { display: none; }
.auth-card form { margin: 0; }
@media (min-width: 760px) {
  .topbar { padding-left: max(16px, calc((100vw - 1240px) / 2 + 16px)); padding-right: max(16px, calc((100vw - 1240px) / 2 + 16px)); }
  .tabs { padding-left: max(16px, calc((100vw - 1240px) / 2)); padding-right: max(16px, calc((100vw - 1240px) / 2)); }
  main { max-width: 1000px; }
  .totalbar .inner { max-width: 952px; }
}
@media (min-width: 1180px) {
  body.view-new .totalbar .inner { max-width: 1192px; }
}
@media (min-width: 760px) { .toast-host { top: calc(128px + var(--safe-t)); } }
