/* Typefaces ship with the app (SIL Open Font License, see fonts/OFL.txt). */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/Barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/Barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/Barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("fonts/BarlowCondensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("fonts/BarlowCondensed-700.woff2") format("woff2"); }

/* The shop's brand colors (--brand, --accent and their inks) are set by app.js from Settings. */
:root {
  --brand: #1E3A4C;
  --brand-ink: #ffffff;
  --brand-light: #7FA6BD;  /* the brand color, lightened for dark mode */
  --accent: #E08A2E;
  --accent-ink: #1b1305;
  --bg: #f3f2ee;
  --card: #ffffff;
  --ink: #18242b;
  --soft: #586771;
  --line: #d9d8d1;
  --go: var(--brand);     /* main action */
  --go-ink: var(--brand-ink);
  --go-soft: color-mix(in srgb, var(--brand) 12%, #ffffff);
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --money: #1f6b4f;
  --hold: #8a4b00;        /* "handle this yourself" */
  --hold-bg: #fdf1e1;
  --late: #b3261e;
  --radius: 14px;
  --tap: 48px;
  --rail: 68px;          /* sidebar width on a phone */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10161a; --card: #1a2228; --ink: #eef1f2; --soft: #a3b0b8; --line: #2c3740;
    --go: var(--brand-light); --go-ink: #0c1216; --go-soft: color-mix(in srgb, var(--brand-light) 18%, #1a2228);
    --money: #5cc898; --hold: #f3b46b; --hold-bg: #2f2416; --late: #ff8a80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10161a; --card: #1a2228; --ink: #eef1f2; --soft: #a3b0b8; --line: #2c3740;
  --go: var(--brand-light); --go-ink: #0c1216; --go-soft: color-mix(in srgb, var(--brand-light) 18%, #1a2228);
  --money: #5cc898; --hold: #f3b46b; --hold-bg: #2f2416; --late: #ff8a80; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.45 var(--body);
  padding-left: calc(var(--rail) + env(safe-area-inset-left));
}
main { max-width: 640px; margin: 0 auto; padding: 4px 16px 24px; outline: none; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--go); }

/* ---- Top bar ---- */
.top {
  max-width: 640px; margin: 0 auto; padding: 12px 16px 0;
  display: flex; align-items: center; gap: 10px;
  color: var(--soft); font-size: 15px; font-weight: 600;
}
.sample {
  padding: 3px 10px; border-radius: 99px; font-weight: 500;
  background: var(--card); border: 1px solid var(--line);
}
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.icon-button {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); cursor: pointer;
  display: grid; place-items: center;
}
a.icon-button { color: var(--ink); }
.icon-button[aria-current="page"] { border-color: var(--go); background: var(--go-soft); }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

h1, h2, .headline, .fact strong, .tabs a { font-family: var(--display); letter-spacing: .01em; }
h1 { font-size: clamp(32px, 9vw, 44px); line-height: 1.02; margin: 10px 0 4px; font-weight: 700; text-wrap: balance; }
h2 { font-size: 24px; margin: 22px 0 10px; font-weight: 700; }
.summary { font-size: 21px; font-weight: 600; margin: 0 0 4px; }
.subtle { color: var(--soft); font-size: 15px; }
.subtle a { color: var(--money); font-weight: 600; text-decoration: none; }

/* ---- Section labels ---- */
.when {
  margin: 22px 0 8px; font-size: 14px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--soft);
}

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; transition: opacity .25s, transform .25s;
}
.card.leaving { opacity: 0; transform: translateX(40px); }
.card-top { display: flex; justify-content: space-between; gap: 10px; color: var(--soft); font-size: 15px; font-weight: 600; }
.card-top .amount { color: var(--money); font-weight: 700; font-size: 17px; }
.headline { font-size: 20px; font-weight: 700; line-height: 1.25; margin: 4px 0 6px; }
.detail { margin: 0 0 10px; }

.hold {
  background: var(--hold-bg); color: var(--hold); border-radius: 10px;
  padding: 10px 12px; margin: 10px 0; font-weight: 600; font-size: 16px;
}
.hold::before { content: "Handle this one yourself · "; font-weight: 700; }

.also { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.also .also-title { font-weight: 700; }

.said { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; margin: 10px 0; color: var(--soft); font-size: 16px; }
.said strong { color: var(--ink); font-weight: 600; }

.draft { background: var(--bg); border-radius: 10px; padding: 12px; margin: 10px 0; }
.draft-label { font-size: 13px; font-weight: 700; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.draft textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  padding: 10px; margin-top: 6px; resize: vertical; min-height: 96px; font-size: 17px;
}

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn {
  min-height: var(--tap); padding: 10px 16px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink);
}
.btn.go { background: var(--go); color: var(--go-ink); border-color: var(--go); }
.btn.soft { background: var(--go-soft); border-color: transparent; color: var(--ink); }
.btn.grow { flex: 1 1 140px; }
.btn.link { border: none; background: none; color: var(--soft); padding-left: 6px; padding-right: 6px; font-weight: 500; text-decoration: underline; }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--go); outline-offset: 2px; }

.confirm { background: var(--go-soft); border-radius: 10px; padding: 12px; margin-top: 10px; font-weight: 600; }

.why { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); color: var(--soft); font-size: 15px; }
.why ul { margin: 4px 0 0; padding-left: 18px; }

.empty, .working {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 28px 20px; color: var(--soft); text-align: center; margin-top: 16px;
}
.working::before {
  content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--go); animation: spin 1s linear infinite;
}
.notice { background: var(--hold-bg); color: var(--hold); border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; font-size: 15px; }

/* ---- Lists (Money, Estimates, Customers) ---- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 6px; }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.fact strong { display: block; font-size: 22px; line-height: 1.15; }
.fact span { color: var(--soft); font-size: 14px; }
.fact.money strong { color: var(--money); }
.fact.late strong { color: var(--late); }
@media (max-width: 420px) { .facts { grid-template-columns: 1fr 1fr; } .facts .fact:first-child { grid-column: 1 / -1; } }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 12px; }
.list a, .list .line {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px;
  border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.list > :last-child { border-bottom: none; }
.list .main { flex: 1; min-width: 0; }
.list .name { font-weight: 650; }
.list .sub { color: var(--soft); font-size: 15px; }
.list .right { text-align: right; font-weight: 700; white-space: nowrap; }
.list .right .sub { font-weight: 500; }
.late-text { color: var(--late) !important; }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--hold-bg); color: var(--hold); }

.search {
  width: 100%; min-height: var(--tap); padding: 10px 14px; margin-top: 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-size: 18px;
}
a.sample { text-decoration: none; color: var(--go); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.btn { position: relative; }
label.btn:focus-within { outline: 3px solid var(--go); outline-offset: 2px; }
.pick { display: block; margin-top: 10px; font-size: 15px; font-weight: 600; color: var(--soft); }
.pick .search { margin-top: 4px; color: var(--ink); }
.back { display: inline-block; margin-top: 8px; text-decoration: none; font-weight: 600; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---- Left sidebar: icons with small labels on a phone, icon and name side by side when wide ---- */
.tabs {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 5;
  width: calc(var(--rail) + env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border-right: 1px solid var(--line);
  padding: calc(12px + env(safe-area-inset-top)) 6px calc(12px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
}
.tabs a {
  min-height: 60px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--soft); text-decoration: none; font-size: 11px; font-weight: 600; text-align: center;
}
.tabs svg { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--go); background: var(--go-soft); }
@media (min-width: 900px) {
  :root { --rail: 200px; }
  .tabs { padding-left: 12px; padding-right: 12px; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 14px; font-size: 16px; }
}

/* ---- Toast ---- */
.toast {
  position: fixed; left: calc(50% + var(--rail) / 2); transform: translateX(-50%); z-index: 6;
  bottom: calc(20px + env(safe-area-inset-bottom)); width: min(calc(92vw - var(--rail)), 480px);
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px;
  background: var(--ink); color: var(--bg); border-radius: 12px; font-weight: 600;
}
.toast span { flex: 1; }
.toast button { background: none; border: none; color: var(--bg); font-weight: 700; text-decoration: underline; min-height: 40px; cursor: pointer; }

footer { text-align: center; color: var(--soft); font-size: 13px; padding: 12px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ---- Brand: the shop's logo in the sidebar ---- */
.brandmark {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 2px 0 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); text-decoration: none;
}
.brandmark img, .brandmark .mono {
  width: 46px; height: 46px; border-radius: 12px; object-fit: contain; display: block;
}
.brandmark .mono {
  background: var(--brand); color: var(--brand-ink); display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: .03em;
}
.brandmark .brandname { display: none; }
@media (min-width: 900px) {
  .brandmark { flex-direction: row; align-items: center; gap: 10px; padding: 0 6px 14px; }
  .brandmark .brandname {
    display: block; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.05;
  }
  .brandmark .brandname small {
    display: block; color: var(--soft); font-family: var(--body); font-weight: 500; font-size: 12px; letter-spacing: 0; margin-top: 2px;
  }
}

/* ---- Today's banner in the shop's color ---- */
.hero {
  position: relative; overflow: hidden; margin: 10px 0 6px;
  background: var(--brand); color: var(--brand-ink); border-radius: 20px;
  padding: 20px 20px 92px;
}
.hero h1 { margin: 0 0 6px; color: inherit; }
.hero .summary { font-size: 21px; font-weight: 600; margin: 0; }
.hero .money-line { margin: 10px 0 0; font-size: 16px; opacity: .92; }
.hero .money-line a {
  color: var(--accent-ink); background: var(--accent); text-decoration: none; font-weight: 700;
  padding: 2px 10px; border-radius: 99px; margin-right: 6px; font-variant-numeric: tabular-nums;
}
.hero .hero-art { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 88px; display: block; }
:root:not([data-theme="light"]) .hero { box-shadow: none; }

/* ---- What kind of card it is, at a glance ---- */
.card-top { align-items: center; }
.kind {
  display: inline-flex; align-items: center; gap: 8px; color: var(--soft);
  font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}
.kind i {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--kind-bg, var(--go-soft)); color: var(--kind-ink, var(--go));
}
.kind svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.kind.call_back { --kind-bg: color-mix(in srgb, var(--accent) 18%, var(--card)); --kind-ink: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.kind.collect { --kind-bg: color-mix(in srgb, var(--money) 16%, var(--card)); --kind-ink: var(--money); }
.kind.estimate { --kind-bg: var(--go-soft); --kind-ink: var(--go); }
.kind.review { --kind-bg: color-mix(in srgb, #E8B021 22%, var(--card)); --kind-ink: color-mix(in srgb, #B07A00 85%, var(--ink)); }
.kind.promise { --kind-bg: color-mix(in srgb, var(--soft) 16%, var(--card)); --kind-ink: var(--ink); }
.card .headline { font-size: 23px; font-weight: 700; line-height: 1.15; }

/* ---- Friendly empty screens ---- */
.empty-art { display: block; width: 120px; height: 90px; margin: 0 auto 10px; color: var(--go); }

/* ---- Your look (Settings) ---- */
.look-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 10px; }
.look-row label { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.look-row input[type="color"] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.look-preview { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.look-preview img, .look-preview .mono { width: 56px; height: 56px; border-radius: 14px; object-fit: contain; }
.look-preview .mono { background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 24px; }

/* The logo link sits in the sidebar but isn't a tab. */
.tabs a.brandmark {
  min-height: 0; border-radius: 0; background: none; text-align: left; font-size: inherit;
  padding: 0 0 12px; justify-content: center;
}
@media (min-width: 900px) {
  .tabs a.brandmark { justify-content: flex-start; padding: 0 6px 16px; }
  .top .shop { display: none; }   /* the sidebar already names the shop */
}

/* ---- Demo: the order card ---- */
.card.order { border: 2px solid var(--accent); }
.card.order .btn.go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---- Online sign-in screen (hosted version) ---- */
body.gated .tabs, body.gated #view, body.gated .top-actions, body.gated .toast { display: none !important; }
body.gated { padding-left: 0; }
.gate { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; }
.gate-brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--brand); }
.gate-brand img { border-radius: 10px; }
.gate-note { font-family: var(--display); font-size: 28px; font-weight: 700; margin: 0; text-align: center; }
.gate-note:empty, .gate-sub:empty { display: none; }
.gate-sub { color: var(--soft); margin: 0; text-align: center; max-width: 26rem; }
.gate-box { width: 100%; max-width: 26rem; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.gate-list, .gate-form { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.gate-input { font: inherit; font-size: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.gate-input:focus { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.gate-problem { color: var(--late); margin: 0; min-height: 1.2em; }
.account { display: inline-flex; align-items: center; }
