/* Fonts served from /ops/fonts (no Google round trips; cached by the app). */
@font-face { font-family: 'Syne'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/ops/fonts/syne.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('/ops/fonts/space-grotesk.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 400 900; font-display: swap; src: url('/ops/fonts/cinzel.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/ops/fonts/jost.woff2') format('woff2'); }

/* =====================================================================
   Cannabis Central Ops
   Three themes from one stylesheet, chosen by <body data-brand>:
     cc          head office / builders — Cannabis Central chrome + lime
     potaround   PotAround store managers — dark green, cream, Syne
     highstreet  High Street store managers — gilt on walnut, Cinzel
   ===================================================================== */

:root,
body[data-brand="cc"] {
  --bg: #090a09;
  --bg-glow: radial-gradient(1200px 600px at 85% -10%, rgba(139, 195, 74, 0.10), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(200, 210, 205, 0.06), transparent 60%);
  --surface: #121513;
  --surface-2: #1a1e1b;
  --surface-3: #232825;
  --border: rgba(235, 240, 236, 0.08);
  --border-strong: rgba(235, 240, 236, 0.16);
  /* Form-control edges need 3:1 against the surface (WCAG 1.4.11). */
  --input-border: rgba(238, 241, 237, 0.38);
  --text: #eef1ed;
  --muted: rgba(238, 241, 237, 0.58);
  --accent: #8BC34A;
  --accent-2: #b5e853;
  --accent-ink: #0a0c09;
  --accent-soft: rgba(139, 195, 74, 0.14);
  --heading-fill: linear-gradient(180deg, #ffffff 0%, #c9cfcb 100%);
  --btn-fill: linear-gradient(180deg, #a5d76a 0%, #7cb342 100%);
  --danger: #ef6b5f;
  /* Filled danger (buttons, urgent badges): white text at 5.7:1. */
  --danger-fill: #b83a2e;
  --warn: #f2b84b;
  --ok: #7bc96f;
  --font-head: 'Syne', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --head-transform: none;
  --head-spacing: -0.01em;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --side-bg: linear-gradient(180deg, #0f1210 0%, #0a0c0a 100%);
}

body[data-brand="potaround"] {
  --bg: #0b0d0a;
  --bg-glow: radial-gradient(1100px 600px at 90% -10%, rgba(76, 175, 80, 0.14), transparent 60%),
             radial-gradient(800px 500px at -10% 110%, rgba(212, 168, 67, 0.06), transparent 60%);
  --surface: #121612;
  --surface-2: #1a1f1a;
  --surface-3: #222822;
  --border: rgba(244, 240, 232, 0.08);
  --border-strong: rgba(244, 240, 232, 0.18);
  --input-border: rgba(244, 240, 232, 0.38);
  --text: #f4f0e8;
  --muted: rgba(244, 240, 232, 0.6);
  --accent: #4CAF50;
  --accent-2: #5cbf60;
  --accent-ink: #07130a;
  --accent-soft: rgba(76, 175, 80, 0.15);
  --heading-fill: linear-gradient(180deg, #f4f0e8 0%, #d9d2c2 100%);
  /* potaround.co.za: solid #4CAF50 pills, no gradient. */
  --btn-fill: #4CAF50;
  --font-head: 'Syne', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --side-bg: linear-gradient(180deg, rgba(18, 22, 18, 0.92), rgba(11, 13, 10, 0.97)), url('/ops/brand/potaround-bg.jpg') center / cover;
}

body[data-brand="highstreet"] {
  --bg: #14100C;
  --bg-glow: radial-gradient(1000px 520px at 80% -10%, rgba(255, 230, 166, 0.10), transparent 60%),
             radial-gradient(700px 500px at 0% 100%, rgba(229, 176, 40, 0.06), transparent 60%);
  --surface: #1e1611;
  --surface-2: #2A1F16;
  --surface-3: #33241A;
  --border: rgba(229, 176, 40, 0.16);
  --border-strong: rgba(229, 176, 40, 0.32);
  --input-border: rgba(229, 176, 40, 0.55);
  --text: #F0E6D2;
  --muted: rgba(240, 230, 210, 0.62);
  --accent: #E5B028;
  --accent-2: #FFE6A6;
  --accent-ink: #1B140D;
  --accent-soft: rgba(229, 176, 40, 0.13);
  /* highstreetsa.com: cream Cinzel headings; gold is kept for buttons and small accents. */
  --heading-fill: none;
  --btn-fill: linear-gradient(100deg, #B8871C 0%, #E5B028 30%, #FFE6A6 50%, #E5B028 70%, #B8871C 100%);
  --danger: #e57a5f;
  --font-head: 'Cinzel', Georgia, serif;
  --font-body: 'Jost', system-ui, sans-serif;
  --head-transform: none;
  --head-spacing: 0.02em;
  --radius: 6px;
  --radius-sm: 2px;
  --side-bg: linear-gradient(180deg, rgba(20, 16, 12, 0.88), rgba(20, 16, 12, 0.96)), url('/ops/brand/highstreet-leather.webp') center / 420px;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.modal-is-open { overflow: hidden; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: var(--head-spacing); text-transform: var(--head-transform); margin: 0; line-height: 1.2; }
h1 { font-size: clamp(1.45rem, 3.4vw, 2rem); font-weight: 700; background: var(--heading-fill); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; font-weight: 700; }
h4 { font-size: 0.85rem; margin: 0.9rem 0 0.3rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-body); }
p { margin: 0.4rem 0; }
small, .small { font-size: 0.83rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pre { white-space: pre-wrap; word-break: break-word; }
.grow { flex: 1 1 auto; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout ---------- */

.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.top-logo { height: 30px; width: auto; object-fit: contain; }
body[data-brand="highstreet"] .top-logo { height: 38px; border-radius: 50%; }
body[data-brand="cc"] .top-logo { height: 40px; margin: -6px 0; }
.top-title { font-family: var(--font-head); font-weight: 700; font-size: 1rem; color: var(--muted); }

.main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }
.view > * + * { margin-top: 14px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar .nav-link {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; color: var(--muted); font-size: 0.75rem; font-weight: 600;
  background: none; border: 0; font-family: inherit; position: relative; cursor: pointer; text-decoration: none;
}
.tabbar .nav-link.active { color: var(--accent-2); }
.tabbar .badge { position: absolute; top: 0; right: calc(50% - 22px); }
.ico { width: 22px; height: 22px; flex: none; }

.more-sheet {
  position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 31;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px;
  transform: translateY(16px); opacity: 0; pointer-events: none; transition: 0.18s ease;
}
.more-sheet.open { transform: none; opacity: 1; pointer-events: auto; }
.sheet-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.more-sheet .nav-link { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: var(--radius-sm); color: var(--text); font-size: 0.78rem; position: relative; text-decoration: none; }
.more-sheet .nav-link.active, .more-sheet .nav-link:hover { background: var(--accent-soft); color: var(--accent-2); }
.more-sheet .badge { position: absolute; top: 6px; right: 18%; }

@media (min-width: 900px) {
  .topbar, .tabbar, .more-sheet { display: none; }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 20;
    background: var(--side-bg); border-right: 1px solid var(--border); padding: 18px 14px; overflow-y: auto;
  }
  .main { margin-left: 250px; padding: 28px 32px 48px; }
}
.side-brand img { width: 100%; max-height: 130px; object-fit: contain; margin: 0 auto 6px; }
body[data-brand="highstreet"] .side-brand img { width: 120px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border-strong), 0 8px 30px rgba(0,0,0,.5); }
body[data-brand="potaround"] .side-brand img { padding: 10px 6px; }
.side-who { padding: 10px 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.side-who strong { display: block; }
.side-who span { color: var(--muted); font-size: 0.85rem; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav .nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 600; font-size: 0.93rem; text-decoration: none; position: relative;
}
.side-nav .nav-link:hover { background: var(--surface-2); color: var(--text); }
.side-nav .nav-link.active { background: var(--accent-soft); color: var(--accent-2); box-shadow: inset 3px 0 0 var(--accent); }
.side-nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 14px 10px 0; color: var(--muted); font-size: 0.75rem; }

/* ---------- Page bits ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back { display: inline-block; color: var(--muted); font-size: 0.9rem; margin-bottom: 4px; }
.section-title { margin: 18px 0 8px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-family: var(--font-body); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: block; color: inherit;
}
.card > h3 + *, .card .row-between + * { margin-top: 10px; }
.card.inner { background: var(--surface-2); }
a.card:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
a.card { transition: 0.15s ease; }
body[data-brand="highstreet"] .card { box-shadow: inset 0 1px 0 rgba(255, 230, 166, 0.05); }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cols { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .cols { grid-template-columns: 1fr 1fr; } }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } .tiles.four { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tile-value { font-family: var(--font-head); font-size: 1.35rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { color: var(--muted); font-size: 0.8rem; }
.tile.accent { background: linear-gradient(160deg, var(--accent-soft), var(--surface-2) 70%); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.tile.accent .tile-value { color: var(--accent-2); }
.tile.up .tile-value, td.up { color: var(--ok); }
.tile.down .tile-value, td.down { color: var(--danger); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar.wrap { row-gap: 10px; }
.toolbar label.inline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.88rem; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 0.92rem;
  padding: 10px 12px; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; text-decoration: none; margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent-2); border-bottom-color: var(--accent); }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); font-size: 0.75rem; text-align: center; }
.tab-body > * + * { margin-top: 14px; }
.tab-body { padding-top: 14px; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 3px; flex-wrap: wrap; }
.seg button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 600; padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.seg button.active { background: var(--accent); color: var(--accent-ink); }
.seg.block { display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--radius-sm); gap: 4px; }
.seg.block label { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
.seg.block label small { color: var(--muted); font-weight: 400; }
.seg.block label:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.seg.block input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- Buttons & inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; font-size: 0.92rem;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: 0.15s ease;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn.primary { background: var(--btn-fill); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger, .btn.ghost.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.primary.danger { background: var(--danger-fill); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 0.83rem; }
.btn.big { padding: 14px 20px; font-size: 1.02rem; }
.btn.block { width: 100%; }
body[data-brand="highstreet"] .btn { border-radius: var(--radius-sm); letter-spacing: 0.04em; }
.icon-btn {
  background: none; border: 1px solid transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; cursor: pointer; text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.big { width: 48px; height: 48px; font-size: 1.8rem; border-color: var(--border); }
.link { background: none; border: 0; color: var(--accent-2); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--input-border);
  border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled { opacity: 0.6; }
input[type=date], input[type=time] { color-scheme: dark; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.toolbar select, .page-actions select { width: auto; max-width: 260px; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; min-width: 0; }
.field > span:first-child { font-weight: 600; font-size: 0.88rem; }
.field > span small, .field > small { color: var(--muted); font-weight: 400; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field-row > .field { flex: 1 1 140px; }
.field-row.tight { gap: 6px; }
.field-row.tight > * { flex: 1 1 140px; }
.field-row .or { color: var(--muted); padding-bottom: 22px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 4px 0 10px; }
.check.small { font-size: 0.88rem; margin: 2px 0; }
.stack > * + * { margin-top: 10px; }
.stack .field { margin: 0; }
.form-error { color: var(--danger); margin: 0 18px 8px; }

/* ---------- Lists, chips, tables ---------- */

.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.card .list { border: 0; background: none; border-radius: 0; margin: 6px -16px -16px; }
.list > li + li { border-top: 1px solid var(--border); }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 12px 16px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
button.list-row:hover, a.list-row:hover { background: var(--surface-2); text-decoration: none; }
button.list-row:disabled { cursor: default; }
.list-row.static { cursor: default; }
.list-row.current { background: var(--accent-soft); }
.list.compact .list-row { padding: 9px 16px; }
.list-row .num { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.list-row .num small { color: var(--muted); }
.list-row.overdue strong { color: var(--danger); }
.mini-list { margin: 0; padding-left: 18px; }
.mini-list li.done { color: var(--muted); text-decoration: line-through; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px;
  background: var(--surface-3); color: var(--text); font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border); white-space: nowrap; font-family: var(--font-body);
}
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--accent); }
.chip.small { padding: 1px 8px; font-size: 0.72rem; }
.chip.warn { background: rgba(242, 184, 75, 0.14); color: var(--warn); border-color: rgba(242, 184, 75, 0.3); }
.chip.urgent { background: rgba(239, 107, 95, 0.16); color: var(--danger); border-color: rgba(239, 107, 95, 0.35); }
.chip.ok { background: rgba(123, 201, 111, 0.14); color: var(--ok); border-color: rgba(123, 201, 111, 0.3); }
.chip.live { background: var(--accent); color: var(--accent-ink); border-color: transparent; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 5px transparent; } }
.chip.brand-potaround { background: rgba(76, 175, 80, 0.15); color: #8fd18f; border-color: rgba(76, 175, 80, 0.35); }
.chip.brand-highstreet { background: rgba(229, 176, 40, 0.14); color: #f0cf6b; border-color: rgba(229, 176, 40, 0.35); font-family: 'Cinzel', Georgia, serif; letter-spacing: 0.03em; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.status-sick, .chip.status-absent { color: var(--danger); }
.chip.status-leave { color: var(--warn); }
.chip.pstatus-building, .chip.wstatus-doing, .chip.matstatus-ordered { color: var(--accent-2); }
.chip.pstatus-on_hold { color: var(--warn); }
.chip.pstatus-finished, .chip.wstatus-done, .chip.matstatus-delivered { color: var(--ok); }
.chip.kind-activation { color: var(--accent-2); }
.chip.role-hq { color: var(--accent-2); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 0.68rem; font-weight: 700; font-family: var(--font-body); }
.badge.urgent { background: var(--danger-fill); color: #fff; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot.brand-potaround, .bg-potaround { background: #4CAF50; }
.dot.brand-highstreet, .bg-highstreet { background: #E5B028; }
.shop-label { white-space: nowrap; }
.legend { color: var(--muted); font-size: 0.82rem; display: inline-flex; align-items: center; gap: 4px; }
.legend .dot { margin-left: 8px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card .table-wrap { margin: 8px -16px -16px; border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface-2); white-space: nowrap; }
.table tfoot th { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table tr.missing td { background: rgba(242, 184, 75, 0.04); }
.cell-input { width: 110px; text-align: right; padding: 6px 8px; }
.log-table td small.split { display: block; color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.log-table .missing-cell { color: var(--warn); }
.sticky-col { position: sticky; left: 0; background: var(--surface-2); z-index: 1; white-space: nowrap; }
.share { display: inline-block; width: 60px; height: 6px; background: var(--surface-3); border-radius: 3px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.share i { display: block; height: 100%; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* ---------- Feedback ---------- */

.loading { display: flex; justify-content: center; padding: 48px 0; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty p:first-child { color: var(--text); font-weight: 600; }
.error-box { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.notice.warn { background: rgba(242, 184, 75, 0.1); border-color: rgba(242, 184, 75, 0.3); color: var(--warn); }
.notice-card { border-color: rgba(242, 184, 75, 0.35); }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
@media (min-width: 900px) { #toasts { bottom: 28px; left: calc(50% + 125px); } }
.toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); padding: 10px 16px; border-radius: 99px; box-shadow: var(--shadow); font-weight: 600; font-size: 0.9rem; transition: 0.3s; text-align: center; }
.toast-ok { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.toast-error { background: #3a1714; border-color: var(--danger); color: #ffd7d2; border-radius: 14px; }
.toast-warn { border-color: var(--warn); color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Modal ---------- */

.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.62); display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(3px); animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--border-strong); width: 100%; max-height: 92vh; display: flex; flex-direction: column; border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow); animation: rise 0.2s ease; }
@keyframes rise { from { transform: translateY(24px); opacity: 0.4; } }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { max-width: 520px; border-radius: var(--radius); }
  .modal.wide { max-width: 720px; }
}
.modal-form { display: flex; flex-direction: column; min-height: 0; max-height: 92vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.08rem; }
.modal-body { padding: 16px 18px 6px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-size: 0.82rem; }

/* ---------- Sales entry ---------- */

.entry-card { padding: 18px; }
.date-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.date-label { text-align: center; }
.date-label strong { display: block; font-family: var(--font-head); font-size: 1.3rem; }
.date-label span { color: var(--muted); font-size: 0.85rem; }
.big-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.big-field > span { font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.big-field > span small { font-weight: 400; }
.rand-input { position: relative; }
.rand-input i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 1.4rem; font-family: var(--font-head); }
.rand-input input { font-size: 1.9rem; font-family: var(--font-head); font-weight: 700; padding: 12px 16px 12px 44px; font-variant-numeric: tabular-nums; }
.big-field.total .rand-input input { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-2); }
.other-line { min-height: 1.4em; color: var(--muted); }
.meta { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 10px; }

.cta-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: linear-gradient(120deg, var(--accent-soft), var(--surface) 80%); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
.cta-card:hover { text-decoration: none; border-color: var(--accent); }
.cta-card .ico { width: 30px; height: 30px; color: var(--accent-2); }
.cta-card span { flex: 1; display: flex; flex-direction: column; }
.cta-card small { color: var(--muted); }
.cta-card b { font-size: 1.6rem; color: var(--muted); }
.cta-card.warn { background: linear-gradient(120deg, rgba(242, 184, 75, 0.12), var(--surface) 80%); border-color: rgba(242, 184, 75, 0.4); }
.cta-card.warn .ico { color: var(--warn); }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 0.82rem; font-weight: 600; }
.qa:hover { border-color: var(--accent); text-decoration: none; }
.qa .ico { color: var(--accent-2); }

/* ---------- Roster ---------- */

.week-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .week-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .week-grid { grid-template-columns: repeat(4, 1fr); } }
.day-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.day-card.today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.day-card header { display: flex; justify-content: space-between; padding: 2px 4px 4px; }
.day-card header span { color: var(--muted); font-size: 0.85rem; }
.shift { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 7px 10px; color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer; }
.shift:hover { border-color: var(--border-strong); }
.shift span { color: var(--muted); font-variant-numeric: tabular-nums; }
.shift em { grid-column: 1 / -1; font-style: normal; font-size: 0.75rem; color: var(--warn); }
.shift.status-sick, .shift.status-absent { border-left-color: var(--danger); opacity: 0.75; }
.shift.status-leave { border-left-color: var(--warn); opacity: 0.75; }
.shift.status-worked { border-left-color: var(--ok); }
.shift.overlap { box-shadow: 0 0 0 1px var(--warn); }
.add-shift { background: none; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); padding: 7px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.add-shift:hover { color: var(--accent-2); border-color: var(--accent); }
.people-list .on-now { box-shadow: inset 3px 0 0 var(--accent); }
.list-row.ended { opacity: 0.6; }
.section-details { margin-top: 14px; }
.section-details summary { cursor: pointer; color: var(--muted); padding: 6px 0; }

/* ---------- Needs ---------- */

.need.urgent { box-shadow: inset 3px 0 0 var(--danger); }
.need.done strong { text-decoration: line-through; color: var(--muted); }
.tick { position: relative; flex: none; width: 26px; height: 26px; cursor: pointer; }
.tick input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tick span { position: absolute; inset: 0; border: 2px solid var(--input-border); border-radius: 50%; }
.tick input:checked + span { background: var(--accent); border-color: var(--accent); }
.tick input:checked + span::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent-ink); font-weight: 700; font-size: 0.85rem; }
.repeat { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.repeat-row { display: flex; gap: 8px; align-items: center; }
.repeat-row .check { margin: 0; white-space: nowrap; }

/* ---------- Photos ---------- */

.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-thumb, .photo-add { width: 78px; height: 78px; border-radius: var(--radius-sm); position: relative; overflow: hidden; flex: none; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb.pending img { opacity: 0.4; }
.photo-thumb .spinner { position: absolute; top: 25px; left: 25px; }
.photo-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 0.7rem; cursor: pointer; }
.photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed var(--border-strong); color: var(--muted); cursor: pointer; }
.photo-add span { font-size: 1.5rem; line-height: 1; }
.photo-add:hover { border-color: var(--accent); color: var(--accent-2); }
.photo-strip { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0; }
.photo-strip img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); flex: none; }

/* ---------- Marketing ---------- */

.promo-card h3 { margin: 8px 0 2px; font-size: 1.1rem; }
.offer { color: var(--accent-2); font-weight: 600; margin: 2px 0; }
.offer.big { font-size: 1.2rem; font-family: var(--font-head); }
.promo-card.phase-running { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.store-picks { display: grid; gap: 10px; grid-template-columns: 1fr; margin-top: 6px; }
@media (min-width: 560px) { .store-picks { grid-template-columns: 1fr 1fr; } }
.pick-group { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }

/* ---------- Construction ---------- */

.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.progress i { display: block; height: 100%; background: var(--btn-fill); border-radius: 99px; }
.project-card h3 { margin-top: 8px; }
.tabs.scroll { margin-top: 4px; }
.gantt { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 0 6px; overflow: hidden; }
/* Overlay spans exactly the bar-track column (row padding 12px, label column 36%). */
.gantt-overlay { position: absolute; top: 0; bottom: 0; left: calc(12px + 0.36 * (100% - 24px)); right: 12px; pointer-events: none; z-index: 2; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--accent); }
.gantt-today span { position: absolute; top: 2px; left: 4px; font-size: 0.7rem; color: var(--accent-2); font-weight: 700; }
.gantt-row { display: grid; grid-template-columns: 36% 1fr; width: 100%; align-items: center; padding: 6px 12px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.gantt-row:hover { background: var(--surface-2); }
.gantt-label { display: flex; flex-direction: column; padding-right: 10px; min-width: 0; }
.gantt-label strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; }
.gantt-label small { font-size: 0.72rem; }
.gantt-track { position: relative; height: 14px; background: var(--surface-2); border-radius: 99px; }
.gantt-bar { position: absolute; top: 0; height: 100%; border-radius: 99px; background: color-mix(in srgb, var(--text) 45%, var(--surface-2)); border: 1px solid var(--input-border); }
.mstatus-in_progress { color: var(--accent-2); } .gantt-bar.mstatus-in_progress { background: var(--accent); border-color: var(--accent); }
.mstatus-done { color: var(--ok); } .gantt-bar.mstatus-done { background: var(--ok); border-color: var(--ok); opacity: 0.7; }
.mstatus-delayed { color: var(--danger); } .gantt-bar.mstatus-delayed { background: var(--danger); border-color: var(--danger); }
.mstatus-not_started { color: var(--muted); }

.chat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); height: max(340px, calc(100dvh - 330px - env(safe-area-inset-bottom))); }
@media (min-width: 900px) { .chat { height: min(68vh, 640px); } }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; }
.msg.mine { justify-content: flex-end; }
.bubble { max-width: 80%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px 16px 16px 4px; padding: 8px 12px; }
.msg.mine .bubble { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 16px 16px 4px 16px; }
.bubble .who { display: block; font-size: 0.78rem; color: var(--accent-2); }
.bubble p { margin: 2px 0; }
.bubble small { color: var(--muted); font-size: 0.7rem; }
.chat-form { border-top: 1px solid var(--border); padding: 10px; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-row textarea { min-height: 44px; max-height: 140px; }
.chat-photos .photo-thumb, .chat-photos .photo-add { width: 52px; height: 52px; }
.chat-photos .photo-thumb .spinner { top: 12px; left: 12px; }
.chat-photos { margin-bottom: 8px; }
.timeline-notes { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Chart ---------- */

.chart-wrap { position: relative; margin-top: 10px; }
.chart { width: 100%; height: 260px; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: rgba(255, 255, 255, 0.04); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 190px; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; font-size: 0.82rem; transform: translateY(-100%); }
.tip-total { font-family: var(--font-head); font-size: 1.05rem; color: var(--accent-2); }
.tip-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }

/* ---------- Store directory (each card wears its own brand) ---------- */

.store-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.store-card { border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.store-card .store-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.store-card h3 { font-size: 1.1rem; }
.store-card p { margin: 0; font-size: 0.9rem; }
.store-addr a { color: inherit; opacity: 0.85; }
.store-hours { display: flex; flex-direction: column; font-size: 0.82rem !important; opacity: 0.75; margin-top: 4px !important; }
.store-card.brand-potaround {
  background: linear-gradient(160deg, rgba(26, 58, 26, 0.85), rgba(18, 22, 18, 0.95)), url('/ops/brand/potaround-bg.jpg') center / cover;
  border: 1px solid rgba(76, 175, 80, 0.3); color: #f4f0e8; font-family: 'Space Grotesk', sans-serif;
}
.store-card.brand-potaround h3 { font-family: 'Syne', sans-serif; color: #b5e853; }
.store-card.brand-potaround .store-logo { height: 26px; width: auto; }
.store-card.brand-potaround .store-phone { color: #8BC34A; font-weight: 600; }
.store-card.brand-highstreet {
  background: linear-gradient(170deg, rgba(42, 31, 22, 0.86), rgba(20, 16, 12, 0.95)), url('/ops/brand/highstreet-leather.webp') center / 360px;
  border: 1px solid rgba(229, 176, 40, 0.35); color: #F0E6D2; font-family: 'Jost', sans-serif; border-radius: 6px;
  box-shadow: inset 0 0 0 3px rgba(20, 16, 12, 0.6), inset 0 0 0 4px rgba(229, 176, 40, 0.18);
}
.store-card.brand-highstreet h3 { font-family: 'Cinzel', Georgia, serif; background: linear-gradient(105deg, #C99A24, #FFE6A6 50%, #C99A24); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: 0.03em; }
.store-card.brand-highstreet .store-logo { height: 40px; width: 40px; border-radius: 50%; }
.store-card.brand-highstreet .store-phone { color: #E5B028; font-weight: 500; letter-spacing: 0.04em; }
.soon-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.soon { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); display: flex; flex-direction: column; }
.soon small { color: var(--muted); }
.soon.brand-highstreet strong { font-family: 'Cinzel', Georgia, serif; color: #E5B028; }
.soon.brand-potaround strong { color: #8BC34A; }

/* ---------- High Street flourishes ---------- */

body[data-brand="highstreet"] .page-head h1 { letter-spacing: 0.04em; }
body[data-brand="highstreet"] .tile-value { font-family: 'Cinzel', Georgia, serif; font-weight: 600; }
body[data-brand="highstreet"] .tile-label, body[data-brand="highstreet"] .section-title { font-family: 'Jost', system-ui, sans-serif; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: #E5B028; }
body[data-brand="highstreet"] .card, body[data-brand="highstreet"] .list, body[data-brand="highstreet"] .table-wrap {
  background: linear-gradient(180deg, rgba(42, 31, 22, 0.6), rgba(30, 22, 17, 0.9));
}
body[data-brand="highstreet"] .tabbar, body[data-brand="highstreet"] .topbar { border-color: rgba(229, 176, 40, 0.25); }

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

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.auth-logo { width: min(340px, 90%); margin-bottom: -10px; }
.auth-card { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px 22px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin: 0 0 18px; }
.form-msg { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.9rem; }
.form-msg.error { background: rgba(239, 107, 95, 0.12); color: #ffb4aa; border: 1px solid rgba(239, 107, 95, 0.35); }
.form-msg.ok { background: var(--accent-soft); color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.auth-brands { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 18px; opacity: 0.8; }
.auth-brands img:first-child { height: 26px; }
.auth-brands img:last-child { height: 46px; border-radius: 50%; }

/* ---------- Review fixes (Oct 2026) ---------- */

/* Home: the first tile spans the row so three tiles don't leave an orphan. */
.tile.wide { grid-column: 1 / -1; }
@media (min-width: 640px) { .tile.wide { grid-column: auto; } }

/* Sales Save stays reachable above the phone tab bar at closing time. */
@media (max-width: 899px) {
  .entry-form button[type=submit] {
    position: sticky; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}

/* Touch targets: at least 44px of hit area. */
.icon-btn { width: 44px; height: 44px; }
.photo-x { width: 30px; height: 30px; top: 2px; right: 2px; }
.tick { width: 32px; height: 32px; }
.modal .chip-row .chip { min-height: 38px; padding: 6px 12px; }

/* Needs: actions wrap under the text on narrow phones instead of being clipped. */
@media (max-width: 520px) {
  .needs-list .list-row { flex-wrap: wrap; }
  .needs-list .list-row .grow { flex: 1 1 calc(100% - 48px); }
  .needs-list .list-row .row-actions { margin-left: 44px; flex-basis: calc(100% - 44px); }
}

/* More sheet: really hidden when closed (not tabbable). */
.more-sheet { visibility: hidden; }
.more-sheet.open { visibility: visible; }

/* Keyboard focus is visible on custom checkboxes and segmented radios. */
.tick:has(input:focus-visible) span, .seg.block label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal:focus { outline: none; }

/* Modals fit the visible viewport (mobile keyboard / browser chrome). */
.modal, .modal-form { max-height: 92dvh; }

/* ---------- Round 2: accessibility, brand fidelity, polish (Oct 2026) ---------- */

/* Skip link: first Tab stop, visible only when focused. */
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 200; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font-weight: 700; transform: translateY(-160%); transition: transform 0.15s; }
.skip-link:focus { transform: none; text-decoration: none; }
/* Programmatic focus targets (page h1 after navigation, <main>) don't need a ring. */
h1[tabindex="-1"]:focus, main[tabindex="-1"]:focus { outline: none; }

/* Motion off when the device asks for it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Small text floors: badges and small chips were ~11px. */
.badge { min-width: 20px; height: 20px; font-size: 0.75rem; }
.chip.small { font-size: 0.75rem; }

/* Figures: tabular digits everywhere money is shown. In the Syne themes the
   big numbers use Space Grotesk — Syne's 0 reads like a letter O. */
.tile-value, .tip-total, .rand-input input, .num, .date-label strong { font-variant-numeric: tabular-nums; }
body[data-brand="cc"] .tile-value, body[data-brand="potaround"] .tile-value,
body[data-brand="cc"] .rand-input input, body[data-brand="potaround"] .rand-input input,
body[data-brand="cc"] .tip-total, body[data-brand="potaround"] .tip-total { font-family: var(--font-body); font-weight: 700; }
/* Tile values may wrap (long shop names, 200% text spacing) instead of being cut. */
.tile-value { white-space: normal; overflow-wrap: anywhere; font-size: clamp(1.1rem, 5vw, 1.35rem); line-height: 1.2; }

/* Toolbar date pickers keep their natural width (they were stretching to 100%). */
.toolbar input[type=date], .toolbar input[type=month] { width: auto; flex: 0 1 auto; }

/* ---------- Phones: nothing scrolls sideways ---------- */

/* Tab bars and photo strips wrap onto a second row instead of scrolling. */
.tabs { flex-wrap: wrap; overflow: visible; }
.photo-strip { flex-wrap: wrap; overflow: visible; }

@media (max-width: 640px) {
  /* Period switch: buttons share the width and wrap if they must. */
  .seg:not(.block) { display: flex; flex-wrap: wrap; width: 100%; border-radius: var(--radius-sm); }
  .seg:not(.block) button { flex: 1 1 auto; white-space: nowrap; border-radius: var(--radius-sm); }

  /* Tables become stacked cards: the first cell is the card title, every
     other cell is a "Heading ........ value" line (labels from labelTables). */
  .table-wrap, .card .table-wrap { overflow: visible; border: 0; border-radius: 0; background: none; margin: 8px 0 0; }
  .table, .table tbody, .table tfoot, .table tr { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 12px; margin-bottom: 8px; }
  .card .table tr { background: var(--surface-2); }
  .table tfoot tr { background: var(--surface-2); border-color: var(--border-strong); }
  .table th, .table td { display: block; border: 0; padding: 6px 0; text-align: right; background: none; overflow-wrap: anywhere; }
  .table tbody tr:last-child td { border-bottom: 0; }
  .table td[data-label]::before, .table th[data-label]::before {
    content: attr(data-label); float: left; margin-right: 12px; color: var(--muted);
    font-size: 0.8rem; font-weight: 600; text-transform: none; letter-spacing: 0;
  }
  .table tr > :first-child { text-align: left; font-weight: 700; font-size: 0.95rem; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table tr > :first-child:last-child { border-bottom: 0; }
  .table td:empty, .table th:empty { display: none; }
  .table tr.missing td { background: none; }
  .table tr.missing { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
  .table tr.clickable:hover td { background: none; }
  .sticky-col { position: static; background: none; }
  .share { width: 44px; }

  /* Daily sales entry: big inputs and a full-width Save per shop. */
  .grid-table .cell-input { width: 150px; font-size: 1rem; }
  .grid-table td:last-child { padding-top: 8px; }
  .grid-table td:last-child .btn { width: 100%; }

  /* Sales log: one card per day; shops with no figure are left out. */
  .log-table .missing-cell { display: none; }
  .log-table td small.split { display: inline; margin-left: 6px; }
}

/* Toasts sit at the top on phones so they never cover the main button. */
@media (max-width: 899px) {
  #toasts { bottom: auto; top: calc(env(safe-area-inset-top) + 66px); }
  .toast.out { transform: translateY(-8px); }
}

/* Sales entry: on short phones tighten the big fields so the Note is visible
   above the sticky Save button. */
@media (max-width: 899px) and (max-height: 820px) {
  .entry-card { padding: 14px; }
  .date-nav { margin-bottom: 8px; }
  .big-field { margin-bottom: 8px; }
  .rand-input input { font-size: 1.55rem; padding-top: 9px; padding-bottom: 9px; }
}
@media (max-width: 899px) {
  .entry-form { padding-bottom: 8px; }
  .entry-form button[type=submit] { scroll-margin-bottom: 90px; }
}
/* Desktop: the entry form doesn't need to be 900px wide. */
@media (min-width: 900px) { .entry-card { max-width: 560px; } }

/* Construction schedule: names wrap to two lines instead of "Shopfitting & j…". */
.gantt-label strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.gantt-track { background: color-mix(in srgb, var(--surface-3) 70%, var(--surface)); }

/* Phone top bar: brand mark + name, then your shop / role. */
.top-home { display: inline-flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.top-home:hover { text-decoration: none; }
.top-mark { width: 32px; height: 32px; border-radius: 50%; object-fit: contain; flex: none; }
.top-brand { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.topbar .top-title { margin-left: auto; font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body[data-brand="cc"] .top-mark { background: #fff; padding: 2px; }
body[data-brand="highstreet"] .top-mark { box-shadow: 0 0 0 1px var(--border-strong); }
body[data-brand="highstreet"] .top-brand { font-weight: 600; letter-spacing: 0.06em; color: var(--accent); }

/* ---- PotAround (potaround.co.za) ---- */
body[data-brand="potaround"] h1 { font-weight: 800; letter-spacing: -0.03em; }
body[data-brand="potaround"] .btn { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; font-weight: 600; font-family: 'Space Grotesk', system-ui, sans-serif; }
body[data-brand="potaround"] .btn.small { font-size: 0.75rem; }
body[data-brand="potaround"] .btn.big { font-size: 0.95rem; }
body[data-brand="potaround"] .btn.primary { color: #0b0d0a; }
body[data-brand="potaround"] .btn.primary:hover { filter: none; background: #5cbf60; }

/* ---- High Street (highstreetsa.com) ---- */
body[data-brand="highstreet"] h1 { background: none; color: var(--text); -webkit-text-fill-color: currentColor; font-weight: 600; }
body[data-brand="highstreet"] .btn { font-family: 'Jost', system-ui, sans-serif; font-weight: 500; text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.82rem; border-radius: 2px; }
body[data-brand="highstreet"] .btn.small { font-size: 0.78rem; letter-spacing: 0.12em; }
body[data-brand="highstreet"] .btn.primary { color: #1B140D; box-shadow: inset 0 0 0 1px rgba(255, 230, 166, 0.35); }
body[data-brand="highstreet"] .seg, body[data-brand="highstreet"] .seg button { border-radius: 2px; }
/* Top bar never overlaps: the brand name gives way first. */
.top-home { flex: 0 1 auto; overflow: hidden; }
.top-brand { overflow: hidden; text-overflow: ellipsis; }
.topbar .top-title { flex: none; max-width: 45%; }
body[data-brand="cc"] .top-brand { font-size: 0.95rem; }
@media (max-width: 380px) { body[data-brand="cc"] .top-brand { font-size: 0.84rem; } .top-home { gap: 8px; } }

/* ---------- Round 2 fixes ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.photo-grid:has(input[type=file]:focus-visible) .photo-add { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-thumb.failed img { opacity: 0.45; }
.photo-retry { position: absolute; left: 4px; right: 4px; bottom: 4px; padding: 4px 0; border: 0; border-radius: var(--radius-sm); background: var(--danger-fill, #b83a2e); color: #fff; font-weight: 600; font-size: 0.75rem; cursor: pointer; }
.error-box .btn { margin-top: 8px; }
.chart .partial-bar { fill: none; stroke: var(--muted); stroke-dasharray: 3 3; opacity: 0.6; }
.chart text.axis { font-size: 11px; }
td.num.up { color: var(--ok, #5cbf60); }
td.num.down { color: var(--danger, #ef6b5f); }
.day-card header .day-sum { display: block; width: 100%; font-size: 0.75rem; }
.up-text { color: var(--ok); font-weight: 600; }
.down-text { color: var(--danger); font-weight: 600; }

/* ---------- Leave ---------- */
.leave-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.leave-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.leave-item p { margin: 4px 0; }
.leave-name { font-size: 1.02rem; }
.leave-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.leave-actions .btn { flex: 1 1 auto; }
.leave-alert { background: rgba(242, 184, 75, 0.12); border: 1px solid rgba(242, 184, 75, 0.35); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 12px; }

/* ---------- Audit fixes (Nov 2026) ---------- */

/* iPhone zooms the page when a field's text is under 16px. */
input, select, textarea { font-size: max(16px, 1em); }

/* Long links / unbroken words wrap instead of pushing the page sideways. */
.card, .list-row, .page-head, .page-head h1, .page-head .sub, .project-card, .project-card h3, .project-card p,
.offer, .mini-list li, .leave-item, .bubble, .pre, .notice { overflow-wrap: anywhere; }
.cols { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cols > * { min-width: 0; }
.list-row > *, .list-row .grow { min-width: 0; }
.list-row .shop-label { white-space: normal; }
.list-row .chip-row { flex-shrink: 1; min-width: 0; }

/* Roster day header: "Mon 2 Nov" on one line, the day's totals underneath. */
.day-card header { flex-wrap: wrap; align-items: baseline; gap: 0 8px; }

/* Project chat: the composer sits above the phone tab bar. The view scrolls
   the chat into place when Messages opens (construction.js). */
@media (max-width: 899px) {
  .chat { height: calc(100dvh - 150px - env(safe-area-inset-bottom)); min-height: 320px; scroll-margin-bottom: calc(78px + env(safe-area-inset-bottom)); scroll-margin-top: 70px; }
}
.chat-row textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* "Turn on notifications" nudge: above the phone tab bar / bottom-right on desktop. */
.push-prompt {
  position: fixed; z-index: 35; left: 10px; right: 10px; bottom: calc(80px + env(safe-area-inset-bottom));
  margin: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
}
.push-prompt p { margin: 0; flex: 1 1 200px; }
@media (min-width: 900px) { .push-prompt { left: auto; right: 24px; bottom: 24px; width: 380px; } }
.steps { margin: 8px 0 0; padding-left: 1.3em; display: grid; gap: 6px; }

/* POS photo on the daily sales log. */
.log-table .pos-link, .log-table .pos-missing { display: block; margin-top: 2px; }
.log-table .pos-missing { color: var(--warn); }
.pos-photo .photo-strip { margin-top: 6px; }

/* Tablet / small laptop: the per-shop sales grid fits, Save included. */
@media (min-width: 641px) and (max-width: 1180px) {
  .grid-table .cell-input { width: 76px; }
  .grid-table th, .grid-table td { padding-left: 4px; padding-right: 4px; }
}

/* Touch targets on phones: at least ~40px tall. */
@media (max-width: 899px) {
  .btn.small { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
  .back { padding: 10px 0; margin-bottom: 0; }
  a[href^="tel:"], a[href^="https://maps"], a[href^="https://www.google.com/maps"] { display: inline-block; padding: 10px 0; }
  .seg button { min-height: 40px; }
  .link { padding: 10px 4px; }
}
/* "Forgot your password?" and other centred text buttons. */
.link.center, .center > .link { display: block; margin-left: auto; margin-right: auto; min-height: 44px; }

/* Ideas: the status picker doesn't squeeze the idea at 320-360px. */
@media (max-width: 420px) {
  .ideas-list .list-row { flex-wrap: wrap; }
  .ideas-list .list-row select { width: 100%; max-width: none; }
}

/* Visits: the delete button sits beside the date, not on a row of its own. */
.visit-card .row-between { flex-wrap: nowrap; }

/* Short phones: room for the Note above the sticky Save. */
@media (max-width: 899px) and (max-height: 700px) {
  .entry-form button[type=submit] { position: static; box-shadow: none; }
}

/* Landscape phones: slimmer bars so there's room for content. */
@media (max-width: 899px) and (max-height: 480px) and (orientation: landscape) {
  .topbar { min-height: 0; padding-top: 4px; padding-bottom: 4px; }
  .tabbar a, .tabbar button { padding-top: 4px; padding-bottom: 4px; }
}
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
@media (max-width: 420px) {
  .ideas-list .list-row .row-actions { margin-left: auto; }
}

/* ---------- Photo viewer (tap a photo to enlarge) ---------- */

.zoom {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: calc(64px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.92);
}
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-sm); }
.zoom-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px;
  background: #fff; color: #111; font: inherit; font-weight: 600; cursor: pointer;
}
body.zoom-open { overflow: hidden; }

.auth-switch { text-align: center; font-size: 0.85rem; margin: 14px 0 0; }
.auth-switch a { color: var(--muted, #9aa59d); }
