/* Chitwright styles — mobile first, high contrast, light and dark mode */

/* ---------- Colours and sizes ---------- */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --text: #0e1419;
  --muted: #4e5966;
  --border: #c9d0d8;
  --primary: #0f766e;
  --primary-text: #ffffff;
  --primary-soft: #d7f0ec;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --success: #116b35;
  --success-soft: #dcf3e4;
  --warning: #8a5300;
  --warning-soft: #fff1d6;
  --info: #1d4ed8;
  --info-soft: #e1e9fd;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .06);
  --radius: 14px;
  --tap: 48px;
  --tabbar-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1416;
    --surface: #152024;
    --surface-2: #1b282d;
    --text: #f1f5f7;
    --muted: #a9b6bf;
    --border: #33454c;
    --primary: #3fd0bd;
    --primary-text: #062a26;
    --primary-soft: #12403b;
    --danger: #ff8a7f;
    --danger-soft: #45201d;
    --success: #6fdc95;
    --success-soft: #173a25;
    --warning: #ffc96b;
    --warning-soft: #3f3117;
    --info: #93b4ff;
    --info-soft: #1d2a4d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  min-height: 56px;
  padding: env(safe-area-inset-top) 8px 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  flex: 1; min-width: 0; margin: 0;
  font-size: 1.25rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#back-btn:not([hidden]) + h1 { padding-left: 0; }
#top-actions { display: flex; gap: 4px; }

/* ---------- Main area ---------- */
main {
  flex: 1;
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom));
  outline: none;
}

/* ---------- Bottom navigation ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar button {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--muted);
  font-size: .75rem; font-weight: 600; line-height: 1.1;
  padding: 6px 2px; cursor: pointer;
}
.tabbar button span {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px;
}
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button[aria-current="page"] { color: var(--primary); }
.tabbar button[aria-current="page"] svg { stroke-width: 2.4; }

/* ---------- Icons ---------- */
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; background: none; color: var(--text); cursor: pointer; padding: 0 8px;
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px;
  border: 2px solid transparent; border-radius: 12px;
  background: var(--surface-2); color: var(--text); border-color: var(--border);
  font-weight: 700; text-align: center; cursor: pointer; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger-outline { background: none; color: var(--danger); border-color: var(--danger); }
.btn.ghost { background: none; border-color: transparent; color: var(--primary); }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 64px; font-size: 1.1rem; border-radius: 16px; }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: .95rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }

/* ---------- Cards and lists ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.card > h2, .section-title {
  margin: 0 0 12px; font-size: 1.05rem; font-weight: 800; letter-spacing: .01em;
}
.section-title { margin: 24px 4px 10px; color: var(--muted); text-transform: uppercase; font-size: .85rem; }
.list { list-style: none; margin: 0 0 16px; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 12px 14px;
  border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; color: inherit;
}
.list > li:last-child .list-item, .list > .list-item:last-child { border-bottom: 0; }
.list-item:active { background: var(--surface-2); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; overflow-wrap: anywhere; }
.list-item .sub { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.list-item .end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-item .amount { font-weight: 800; white-space: nowrap; }

.empty {
  text-align: center; color: var(--muted); padding: 40px 16px;
}
.empty .icon { width: 48px; height: 48px; margin-bottom: 8px; opacity: .7; }
.empty p { margin: 0 0 16px; }

/* Status badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 800; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > .label, .label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .95rem; }
.field .hint, .hint { display: block; color: var(--muted); font-size: .88rem; margin-top: 4px; }
.input, select.input, textarea.input {
  display: block; width: 100%; min-height: var(--tap);
  padding: 10px 12px;
  border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
  font-size: 17px; /* 16px+ stops phones zooming in */
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--primary); outline: none; }
.input.invalid { border-color: var(--danger); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1 1 0; min-width: 0; }
.error-text { color: var(--danger); font-weight: 700; font-size: .92rem; margin-top: 4px; }

/* Switch (checkbox styled as a toggle) */
.switch { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; margin-bottom: 12px; }
.switch .text { flex: 1; font-weight: 700; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--border); position: relative; flex: none; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { left: 23px; }

/* Segmented control (two or three choices side by side) */
.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 16px; }
.segmented button { flex: 1 1 0; min-width: 0; min-height: 44px; border: 0; border-radius: 9px; background: none; font-weight: 700; color: var(--muted); cursor: pointer; padding: 4px 6px; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Search box */
.search { position: relative; margin-bottom: 12px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 44px; }

/* Sticky action bar above the tab bar (Save buttons on forms) */
.action-bar {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--border);
}
.action-bar .inner { max-width: 680px; margin: 0 auto; display: flex; gap: 10px; }
.action-bar .btn { flex: 1; }
main.has-action-bar { padding-bottom: calc(var(--tabbar-h) + 110px + env(safe-area-inset-bottom)); }

/* Floating "new" button */
.fab {
  position: fixed; z-index: 24; right: 16px;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  min-height: 56px; padding: 0 22px 0 18px; border-radius: 999px; border: 0;
  background: var(--primary); color: var(--primary-text); font-weight: 800; font-size: 1rem;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer;
}
@media (min-width: 720px) { .fab { right: calc(50% - 340px + 16px); } }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; z-index: 60; transform: translate(-50%, 20px);
  bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Dialogs ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 600px) { .overlay { align-items: center; padding: 16px; } }
.dialog {
  background: var(--surface); color: var(--text);
  width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow: auto;
  border-radius: 20px 20px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0,0,0,.3);
}
@media (min-width: 600px) { .dialog { border-radius: 20px; } }
.dialog h2 { margin: 0 0 8px; font-size: 1.2rem; }
.dialog .body { margin-bottom: 16px; overflow-wrap: anywhere; }
.dialog .body p { margin: 0 0 10px; }
.dialog .buttons { display: flex; flex-direction: column-reverse; gap: 10px; }
@media (min-width: 420px) { .dialog .buttons { flex-direction: row; justify-content: flex-end; } .dialog .buttons .btn { flex: 1; } }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 16px; }
.small-text { font-size: .9rem; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.kv.total { border-top: 2px solid var(--border); margin-top: 6px; padding-top: 10px; font-size: 1.15rem; }
.kv.total .k { color: var(--text); font-weight: 800; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Settings ---------- */
.saved-chip {
  display: inline-flex; align-items: center; gap: 4px; align-self: center;
  padding: 4px 10px 4px 6px; border-radius: 999px; margin-right: 4px;
  background: var(--success-soft); color: var(--success); font-weight: 800; font-size: .85rem;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.saved-chip .icon { width: 18px; height: 18px; stroke-width: 3; }
.saved-chip.show { opacity: 1; }
.logo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-preview {
  width: 112px; height: 80px; border: 2px dashed var(--border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--surface-2); overflow: hidden;
}
.logo-preview.has-logo { border-style: solid; background: #fff; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-buttons { display: flex; flex-direction: column; gap: 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); cursor: pointer;
  box-shadow: 0 0 0 2px var(--border); padding: 0; position: relative;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--text); }
.swatch.custom { display: inline-flex; align-items: center; justify-content: center; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); overflow: hidden; }
.swatch.custom .icon { width: 20px; height: 20px; color: #fff; filter: drop-shadow(0 0 2px #000); pointer-events: none; }
.color-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

/* ---------- Clients ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: .95rem;
}
.client-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.client-head h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.client-head .avatar { width: 52px; height: 52px; font-size: 1.1rem; }
.contact-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.contact-row {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; background: var(--surface-2);
}
.contact-row > span:first-of-type { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.contact-action { color: var(--primary); font-weight: 800; }
.kv-block { padding: 8px 0; border-top: 1px solid var(--border); }
.kv-block .k { color: var(--muted); font-size: .9rem; font-weight: 700; }

/* ---------- Quotes and invoices ---------- */
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 170px; }
.spacer { height: 8px; }
.btn-col { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.link { background: none; border: 0; padding: 0; min-height: 44px; color: var(--primary); font-weight: 700; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.doc-number { font-size: 1.3rem; font-weight: 800; }

/* Line items while editing */
.items-edit { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.item-edit { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--surface-2); }
.item-head { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 6px; }
.item-no { font-weight: 800; color: var(--muted); }
.item-head .btn { color: var(--danger); padding: 4px 8px; }
.item-desc { min-height: 64px; margin-bottom: 8px; }
.item-grid { display: grid; grid-template-columns: 1fr 1.25fr 1.5fr; gap: 8px; }
.item-grid .input { padding: 8px 10px; }
.item-grid select.input { padding-right: 28px; background-position: calc(100% - 16px) 50%, calc(100% - 10px) 50%; }
.mini { display: block; min-width: 0; }
.mini > span { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; }
.line-total { font-weight: 800; }
.with-suffix { position: relative; margin-bottom: 8px; }
.with-suffix .input { padding-right: 64px; }
.with-suffix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }

/* Line items and totals when reading */
.items-view { list-style: none; margin: 0 0 8px; padding: 0; }
.items-view li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.items-view .desc { font-weight: 600; }
.items-view .calc { display: flex; justify-content: space-between; gap: 12px; margin-top: 2px; }
.items-view .calc .muted { overflow-wrap: anywhere; }
.totals .kv.note { color: var(--muted); font-size: .92rem; padding-top: 0; }
.totals .kv.note .v { font-weight: 600; }
.totals-card h2 { margin-bottom: 4px; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.photo-grid:empty { display: none; }
.photo, .photo-grid > button.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); padding: 0; cursor: pointer; }
.photo img, .photo-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.photo-remove {
  position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .65); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.photo-remove .icon { width: 20px; height: 20px; }
.photo-large { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; }

/* Balance box on invoices and receipts */
.balance-box {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 700;
}
.balance-box strong { font-size: 1.35rem; font-weight: 800; white-space: nowrap; }
.balance-box.paid { background: var(--success-soft); color: var(--success); border-color: transparent; }
.balance-box.overdue { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.balance-box.part { background: var(--info-soft); color: var(--info); border-color: transparent; }
.balance-box.unpaid { background: var(--warning-soft); color: var(--warning); border-color: transparent; }

/* Payments list */
.payments { list-style: none; margin: 0; padding: 0; }
.payments li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.payments li:last-child { border-bottom: 0; }
.pay-main { flex: 1 1 140px; min-width: 0; }
.pay-amount { font-weight: 800; font-size: 1.05rem; }
.pay-actions { display: flex; align-items: center; gap: 4px; }
.pay-actions .icon-btn { color: var(--danger); }

/* ---------- Home ---------- */
.big-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.big-buttons .btn { flex-direction: column; gap: 4px; min-height: 84px; padding: 10px 8px; line-height: 1.2; }
.big-buttons .btn .icon { width: 28px; height: 28px; }
.welcome h2 { font-size: 1.25rem; }
.welcome p { margin: 0 0 16px; }
.money .money-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.money .money-row:last-child { border-bottom: 0; }
.money .money-row span { font-weight: 700; color: var(--muted); }
.money .money-row strong { font-size: 1.35rem; font-weight: 800; margin-left: auto; text-align: right; overflow-wrap: anywhere; }
.money .money-row.overdue strong { color: var(--danger); }
.money .money-row.paid strong { color: var(--success); }
.overdue-item { border-bottom: 1px solid var(--border); }
.overdue-item:last-child { border-bottom: 0; }
.overdue-item .list-item { border-bottom: 0; padding-bottom: 4px; }
.reminder-row { padding: 0 14px 12px; }
.reminder-text { min-height: 200px; }

/* ---------- Reports ---------- */
.reports-link { margin-bottom: 8px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 12px; }
.stepper strong { font-size: 1.15rem; text-align: center; flex: 1; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); min-width: 0; }
.tile span { display: block; color: var(--muted); font-weight: 700; font-size: .9rem; }
.tile strong { display: block; font-size: 1.2rem; font-weight: 800; overflow-wrap: anywhere; }
.tile.paid strong { color: var(--success); }
.tile.owed strong { color: var(--warning); }
.chart { display: flex; align-items: stretch; gap: 3px; height: 180px; margin: 8px 0; }
.bar-group { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); border-radius: 6px; }
.bar-group.selected { background: var(--primary-soft); color: var(--text); }
.bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 1px; border-bottom: 2px solid var(--border); }
.bar { width: 45%; min-height: 0; border-radius: 3px 3px 0 0; }
.bar.invoiced, .swatch-invoiced { background: var(--info); opacity: .45; }
.bar.paid, .swatch-paid { background: var(--primary); }
.bar-label { font-size: .75rem; font-weight: 700; text-align: center; }
.legend { display: flex; gap: 16px; font-size: .9rem; color: var(--muted); font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.card-title-row h2 { margin: 0 0 12px; font-size: 1.05rem; font-weight: 800; }

/* ---------- Backup ---------- */
.backup-counts { margin: 8px 0 12px; padding: 4px 12px; border-radius: 12px; background: var(--surface-2); }
.warning-text { color: var(--danger); font-weight: 700; }
.backup-reminder { border-color: var(--warning); background: var(--warning-soft); }
.backup-reminder p { margin: 0 0 12px; }
.reminder-head { display: flex; align-items: center; gap: 8px; color: var(--warning); margin-bottom: 4px; }
.reminder-head h2 { margin: 0; font-size: 1.05rem; color: var(--text); }

/* ---------- Unlock ---------- */
.unlock-card h2 { font-size: 1.25rem; margin: 8px 0 12px; }
.unlock-card p { margin: 0 0 12px; }
.unlock-icon { width: 72px; height: 72px; margin: 4px auto 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); }
.unlock-icon .icon { width: 36px; height: 36px; }
.unlock-icon.done { background: var(--success-soft); color: var(--success); }

/* ---------- Install tip ---------- */
.install-steps p { margin: 0 0 10px; }

/* ---------- Tutorial ---------- */
.help-lead { margin: 0 4px 14px; color: var(--muted); }
.help-chapter { margin: 0 4px 4px; color: var(--primary); font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.help-num {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 800;
}
.ui-label { color: var(--primary); font-weight: 800; }
.help-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.help-steps li { counter-increment: step; position: relative; padding: 0 0 14px 44px; min-height: 32px; }
.help-steps li:last-child { padding-bottom: 0; }
.help-steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-text);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem;
}
.help-faq { margin: 0; padding-left: 20px; }
.help-faq li { margin-bottom: 12px; }
.help-faq li:last-child { margin-bottom: 0; }
.help-tip {
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 16px; padding: 12px 14px;
  border-radius: var(--radius); background: var(--primary-soft); color: var(--text);
}
.help-tip .icon { color: var(--primary); margin-top: 2px; }
.help-tip p { margin: 0; }
.help-shots { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 8px; margin: 0 -4px; }
.help-shot { flex: none; width: 168px; margin: 0; scroll-snap-align: start; text-align: center; }
.help-shot button { display: block; width: 100%; padding: 0; border: 6px solid #11181c; border-radius: 22px; overflow: hidden; background: #11181c; cursor: zoom-in; }
.help-shot img { display: block; width: 100%; height: auto; }
.help-shot figcaption { margin-top: 6px; font-size: .85rem; color: var(--muted); }

/* Getting started on Home: three numbered first steps; the next one to do is highlighted */
.steps { list-style: none; margin: 14px 0 10px; padding: 0; display: grid; gap: 8px; }
.step { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.step.current { border: 2px solid var(--primary); background: var(--primary-soft); }
.step-no { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface); border: 1px solid var(--border); }
.step.current .step-no { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.step.done .step-no { background: var(--success-soft); color: var(--success); border-color: transparent; }
.step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.step-title { font-weight: 700; overflow-wrap: anywhere; }
.step.done .step-title { color: var(--muted); }
.step-text { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.step > .icon { flex: none; color: var(--muted); }
.step.current > .icon { color: var(--primary); }

/* Business profile screen */
.profile-intro { margin: 2px 4px 14px; color: var(--muted); }

/* Install tip on Home: title and the ✕ (hide) button on one line */
.install-card .card-title-row { align-items: center; margin: -6px -8px 8px 0; }
.install-card .card-title-row h2 { margin: 0; }
