@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&display=swap');

:root {
  --brand: #c92f32;       /* sampled from the Legends Hydration logo */
  --brand-dark: #a02426;
  --brand-light: #fdf1f1;
  --ink: #17130f;         /* near-black, matches the logo's lettering */
  --muted: #6b6560;
  --muted-soft: #8f8983;  /* lighter secondary text — meta lines, placeholders */
  --line: #e7e2de;
  --line-strong: #d9d3cd; /* a step darker than --line, for things that need to stand off a plain card border (active rows, dividers under headings) */
  --bg: #f6f4f2;
  --card: #ffffff;
  --ok: #1e8e5a;
  --ok-soft: #e4f4ec;
  --err: #d93025;
  --err-soft: #fbe6e5;
  --warn: #a05a00;
  --warn-soft: #fdf1de;

  /* Neutral chip/pill tone — for statuses that are neither positive,
     warning nor critical (e.g. "partial"). Kept warm-grey rather than the
     blue an earlier pass reached for: blue reads as a second accent colour
     next to --brand, and a status that isn't a claim about health doesn't
     need one. */
  --neutral-soft: #efebe6;
  --neutral-ink: var(--muted);
  /* A step lighter than --brand, for hover borders on tiles — named so the
     two call sites (picker-tile, pos-tile) share one value instead of each
     hand-rolling the same hex. */
  --brand-line: #f0d5d3;

  /* Spacing scale, 4px base. Most of this file predates it and still uses
     one-off pixel values — left alone rather than churned wholesale — but
     new and touched-up rules below use these so components share a rhythm
     instead of each inventing its own gap/padding. */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;

  /* Radius scale. Moderate corners (~8-12px), not the 18px this used to
     run to — a deliberate step down so cards/tiles/modals read as an
     operations tool rather than a consumer app. */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius: 12px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* ---- sidebar: the one dark surface in the shell ----
     A near-black rail against a white workspace, with the brand red spent
     on the active row alone, is what gives the shell its anchor — the
     same reasoning as the sibling ProShop portal, in Hydration's own red
     rather than its exact hex. */
  --sidebar-bg: #171412;
  --sidebar-hover: #262220;
  --sidebar-active-bg: var(--brand);
  --sidebar-line: #322d29;
  --sidebar-text: #cfc9c4;
  --sidebar-text-strong: #ffffff;
  --sidebar-muted: #8c8681;

  /* Shadows: three subtle depths rather than every card/popover hand-rolling
     its own rgba() — a resting surface (--shadow-xs), a raised one like a
     hovered tile or the sidebar (--shadow-sm), and a floating one like a
     modal or dropdown (--shadow-md). */
  --shadow-xs: 0 1px 2px rgba(23,19,15,.05);
  --shadow-sm: 0 4px 14px rgba(23,19,15,.07);
  --shadow-md: 0 14px 36px rgba(23,19,15,.14);

  --heading-font: 'Oswald', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, .brand-word, .tile-label, .btn { font-family: var(--heading-font); }

/* ---------- app shell: persistent sidebar + main content ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30;
}
.side-brand { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-5) var(--space-5) var(--space-4); }
.side-brand img.logo { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.12); background: #fff; }
.side-brand .brand-word {
  font-family: var(--heading-font); font-weight: 700; font-size: 14px; letter-spacing: .02em;
  text-transform: uppercase; line-height: 1.2; color: var(--sidebar-text-strong);
}
.low-stock-alert {
  flex-basis: 100%; display: inline-flex; align-items: center; gap: 6px; width: fit-content;
  background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-pill);
  padding: 5px 11px; font-size: 12px; font-weight: 600; text-decoration: none;
  transition: background .12s ease;
}
.low-stock-alert:hover { background: #fbe6c8; }
.low-stock-alert .nav-icon { flex-shrink: 0; }
.mobile-topbar .low-stock-alert { flex-basis: auto; margin-left: auto; }
.side-nav { flex: 1; padding: var(--space-2) var(--space-3) var(--space-4); }
.side-section {
  display: flex; align-items: center; gap: var(--space-2);
  font-family: var(--heading-font); font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--sidebar-muted); padding: var(--space-4) var(--space-2) var(--space-2);
  border-top: 1px solid var(--sidebar-line); margin-top: var(--space-1);
}
.side-section:first-child { border-top: none; margin-top: 0; }
.side-section-icon { display: flex; color: var(--sidebar-muted); flex-shrink: 0; }
.side-link {
  display: flex; align-items: center; gap: var(--space-2); padding: 9px var(--space-2) 9px 30px;
  border-radius: var(--radius-md); color: var(--sidebar-text); text-decoration: none; font-size: 14px;
  font-weight: 500; margin-bottom: 1px; transition: background .12s ease, color .12s ease;
}
.side-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.side-link.active { background: var(--sidebar-active-bg); color: #fff; }
.side-link-home { padding-left: var(--space-2); font-weight: 600; }
.side-link-icon { display: flex; flex-shrink: 0; }
.nav-icon { display: block; flex-shrink: 0; }
.side-user {
  padding: var(--space-4) var(--space-5); border-top: 1px solid var(--sidebar-line); display: flex; align-items: center;
  justify-content: space-between; gap: var(--space-2); font-size: 13px; color: var(--sidebar-text);
}
.side-user .iconbtn {
  padding: 6px 10px; font-size: 12px; background: transparent; border-color: var(--sidebar-line); color: var(--sidebar-text);
}
.side-user .iconbtn:hover { border-color: var(--brand); color: #fff; background: var(--sidebar-hover); }

.mobile-topbar {
  display: none; align-items: center; justify-content: space-between; padding: 12px 16px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.mobile-topbar img.logo { width: 28px; height: 28px; border-radius: 50%; }
.mobile-topbar .iconbtn { display: inline-flex; align-items: center; gap: 6px; }

.main { flex: 1; min-width: 0; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-topbar { display: flex; }
}

.iconbtn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 12px; border-radius: var(--radius-md); font-size: 14px; cursor: pointer; text-decoration: none;
  transition: border-color .12s ease, color .12s ease;
}
.iconbtn:hover { border-color: var(--brand); color: var(--brand); }
.iconbtn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* 720px was fine for a lone entry form; Reports/Admin have since grown into
   wide tables and 15+ tabs that were clipping at that width. Entry forms
   themselves stay narrow (.container.narrow) since a 2-4 field form
   stretched across a wide screen just reads as empty space either side. */
.container { max-width: 1180px; margin: 0 auto; padding: 20px 16px 80px; }
.container.narrow { max-width: 720px; }
/* POS Sale needs more room than the standard container gives — a product
   grid plus a fixed-width cart panel side by side doesn't fit 1180px
   without cramping both. */
.container.wide { max-width: 1500px; }

/* Sentence case, not a banner — a page title is a name ("Purchase Orders"),
   the eyebrow labels below it are what carry the uppercase treatment. */
.page-title {
  font-family: var(--heading-font); font-weight: 700; font-size: 22px; letter-spacing: -.01em;
  margin: 22px 0 2px;
}

.section-heading {
  display: flex; align-items: center; gap: var(--space-2);
  font-family: var(--heading-font); font-size: 13px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin: 28px 0 4px;
}
.section-heading:first-of-type { margin-top: 18px; }
.section-heading-icon { display: flex; color: var(--brand); flex-shrink: 0; }

.picker-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px;
}
@media (min-width: 560px) { .picker-grid { grid-template-columns: repeat(3, 1fr); } }
.picker-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 12px 18px; text-align: center; cursor: pointer; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: transform .1s ease, box-shadow .1s ease, border-color .1s ease;
  position: relative; overflow: hidden;
}
.picker-tile::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--brand); transform: scaleX(0); transform-origin: left;
  transition: transform .15s ease;
}
.picker-tile:hover::before { transform: scaleX(1); }
.picker-tile:active { transform: scale(0.97); }
.picker-tile:hover { box-shadow: var(--shadow-sm); border-color: var(--brand-line); }
.picker-tile .icon-badge {
  width: 52px; height: 52px; border-radius: 50%; background: var(--brand-light); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
}
.picker-tile .tile-label { font-weight: 600; font-size: 13px; letter-spacing: .01em; text-transform: uppercase; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-xs); padding: 18px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.report-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.report-actions .btn { width: auto; font-size: 12px; padding: 8px 12px; }
.card h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field label .req { color: var(--brand); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(201,47,50,.12);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

/* Item lines as a real spreadsheet-style table — one column per field,
   one row per item — instead of a stacked card per item. Column headers
   carry the labels, so the per-field <label> (still rendered by the shared
   field controllers, unchanged) is hidden here rather than duplicated. */
.items-table { border-collapse: collapse; width: 100%; min-width: 560px; }
.items-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); padding: 4px 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.items-table th .req { color: var(--brand); }
.items-table td { padding: 6px 8px; vertical-align: top; border-bottom: 1px solid var(--line); }
.items-table tr:last-child td { border-bottom: none; }
.items-table .field { margin: 0; min-width: 130px; }
.items-table .field label { display: none; }
.items-table input, .items-table select { padding: 9px 10px; font-size: 14px; }
.items-table .autocomplete input { min-width: 160px; }
.items-table .remove-line {
  border: none; background: none; color: var(--muted); font-size: 17px; cursor: pointer; padding: 8px 4px;
}
.items-table .remove-line:hover { color: var(--brand); }
.items-table .photo-list { max-width: 180px; }

.autocomplete { position: relative; }
/* left/top/width are set inline in JS (position: fixed, viewport-relative)
   so the dropdown isn't clipped by a scrolling ancestor — e.g. the
   horizontal-scroll wrapper around the item-entry table. */
.ac-list {
  position: fixed; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.08);
  max-height: 220px; overflow-y: auto; z-index: 210; display: none;
}
.ac-list.open { display: block; }
.ac-item { padding: 10px 12px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ac-item:hover, .ac-item.active { background: var(--brand-light); }
.ac-item.quickadd { color: var(--brand); font-weight: 600; border-top: 1px solid var(--line); }
.ac-detail { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.items-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.items-toolbar .btn { width: auto; flex: 1 1 auto; font-size: 12px; padding: 11px 14px; }

/* Details + Items now live in one card (one form, not two floating boxes)
   — a divider marks the section break instead of a gap between cards. */
#itemsCard { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(23,19,15,.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: #fff; border-radius: var(--radius); padding: 20px; width: 100%; max-width: 560px; border-top: 4px solid var(--brand); box-shadow: var(--shadow-md); }
.modal h3 { margin: 0 0 6px; font-family: var(--heading-font); text-transform: uppercase; letter-spacing: .03em; font-size: 15px; }
.modal textarea {
  width: 100%; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical;
}
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn { width: auto; flex: 1; }

.payment-row { margin-bottom: 10px; }
.payment-row-main { display: flex; gap: 10px; align-items: center; }
.payment-row-main select { flex: 1.2; } .payment-row-main input { flex: 1; }
.payment-row .rm { border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.payment-recon { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; padding-left: 4px; }
.payment-recon input[type=text] { flex: 1; min-width: 140px; }
.recon-photo-btn {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--brand);
  border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; white-space: nowrap;
}
.recon-photo-btn:hover { background: var(--brand-light); }
.total-line { font-size: 13px; color: var(--muted); margin-top: 4px; }
.total-line.ok { color: var(--ok); }
.total-line.err { color: var(--err); }
.link-btn { border: none; background: none; padding: 0; color: var(--brand); text-decoration: underline; font-size: inherit; cursor: pointer; }

/* Sentence case with solid edges — a button label is a name ("Submit
   entry"), not a banner; the small caps this used to carry is the eyebrow
   treatment, spent elsewhere (.section-heading, .card h3). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-md); padding: 13px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; width: 100%;
  transition: background .12s ease, box-shadow .12s ease, transform .06s ease, border-color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-sm); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-ghost { background: none; color: var(--brand); padding: 8px; width: auto; }
.btn-ghost:hover { background: var(--brand-light); }
/* A standalone action that sits above a table/card body (a report's
   "Refresh", not a form's single submit) — the base .btn is full-width
   because it's usually the one thing a form does, but a lone toolbar-style
   button stretched across a whole card reads as a mistake, not a choice. */
.btn-inline { width: auto; padding: 11px 20px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 100; max-width: calc(100% - 32px); text-align: center;
}
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

.error-text { color: var(--err); font-size: 13px; margin-top: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.commission-breakdown { font-size: 12px; margin-top: 6px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; white-space: nowrap; }
table.simple th.sortable-th { cursor: pointer; user-select: none; }
table.simple th.sortable-th:hover { color: var(--ink); }
table.simple th .sort-ind { color: var(--brand); }
.table-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.table-filters input[type="text"], .table-filters select { max-width: 220px; }
.table-scroll { overflow-x: auto; }
.access-grid th, .access-grid td { white-space: nowrap; }
.scope-badge {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; line-height: 1.5;
}
.scope-badge.header { background: var(--brand-light); color: var(--brand-dark); }
.scope-badge.item { background: var(--neutral-soft); color: var(--neutral-ink); }
.scope-badge.status-pending, .scope-badge.status-open { background: var(--warn-soft); color: var(--warn); }
.scope-badge.status-approved, .scope-badge.status-received { background: var(--ok-soft); color: var(--ok); }
.scope-badge.status-rejected, .scope-badge.status-cancelled { background: var(--err-soft); color: var(--err); }
.scope-badge.status-partial { background: var(--neutral-soft); color: var(--neutral-ink); }
.scope-badge.status-closed { background: var(--ok-soft); color: var(--ok); }

/* Open Orders — one card per running court tab, click through to add
   items/close/cancel. Not literal drag-and-drop columns (courts are
   free-typed, not a fixed set) — a status-grouped card board instead. */
.oo-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.oo-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.oo-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-1px); }
.oo-card .oo-court { font-family: var(--heading-font); font-size: 15px; text-transform: uppercase; letter-spacing: .02em; }
.oo-card .oo-meta { color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; }
.oo-card .oo-total { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.oo-empty { color: var(--muted); font-size: 14px; padding: 30px 0; text-align: center; }
.modal-wide { max-width: 720px; }

/* Hover-preview: a floating "page" shown on hovering a compact list row
   (see attachHoverPreview in panel.js) — a lighter-weight look at the same
   detail the click-through modal/print view shows. Positioned in JS
   (fixed, next to the row), styled like a small printed page. */
.hover-preview { position: fixed; z-index: 300; pointer-events: none; animation: hp-in .12s ease-out; }
.hover-preview-page {
  width: 360px; max-height: 70vh; overflow: hidden; background: #fff; color: var(--ink);
  border-radius: 6px; box-shadow: 0 14px 36px rgba(0,0,0,.24); border: 1px solid var(--line);
  padding: 16px; font-size: 12px;
}
.hover-preview-page h4 { margin: 0 0 2px; font-family: var(--heading-font); font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
.hover-preview-page .muted { font-size: 11px; }
.hover-preview-page table.simple th, .hover-preview-page table.simple td { padding: 4px 6px; font-size: 11px; }
@keyframes hp-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .hover-preview { display: none; } } /* no hover on touch */

/* POS Sale — a register-style alternative to the Sale entry form: tap
   product tiles into a running cart, one payment decision, Charge. No
   product photos exist in the catalog, so each tile carries a colored
   initial badge (hashed from category) instead of an image. */
.pos-layout { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .pos-layout { grid-template-columns: 1fr; } }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.pos-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 10px;
  transition: transform .08s ease, box-shadow .08s ease, border-color .08s ease;
}
.pos-tile:hover { box-shadow: 0 6px 16px rgba(0,0,0,.08); border-color: var(--brand-line); }
.pos-tile:active { transform: scale(.97); }
.pos-tile .pos-tile-badge {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-family: var(--heading-font); font-weight: 700; font-size: 16px; color: #fff;
}
.pos-tile .pos-tile-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.pos-tile .pos-tile-meta { color: var(--muted); font-size: 11.5px; }
.pos-tile .pos-tile-price { font-weight: 700; font-size: 14px; color: var(--brand-dark); }
.pos-cart { position: sticky; top: 16px; }
.pos-cart-empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 24px 0; }
.pos-cart-line { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pos-cart-line .pos-line-name { flex: 1; font-size: 13.5px; font-weight: 600; }
.pos-cart-line .pos-line-price { font-size: 12px; color: var(--muted); }
.pos-cart-line .pos-qty-ctrl { display: flex; align-items: center; gap: 6px; }
.pos-cart-line .pos-qty-ctrl button {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 14px; line-height: 1; color: var(--ink);
}
.pos-cart-line .pos-qty-ctrl span { min-width: 18px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.pos-cart-line .pos-line-total { width: 64px; text-align: right; font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.pos-cart-line .pos-line-rm { border: none; background: none; color: var(--err); cursor: pointer; font-size: 15px; padding: 0 2px; }
.pos-cart-totals { padding-top: 10px; font-size: 14px; }
.pos-cart-totals .pos-total-row { display: flex; justify-content: space-between; padding: 3px 0; }
.pos-cart-totals .pos-total-row.grand { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }

.day-status {
  padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.day-status.open { background: #e4f4ec; color: var(--ok); }
.day-status.closed { background: #fbe6e5; color: var(--err); }
.day-status .btn { width: auto; padding: 8px 16px; font-size: 12.5px; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--brand-light); }

.photo-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.photo-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--brand-light); color: var(--brand-dark);
  padding: 5px 8px; border-radius: 8px; font-size: 12px;
}
.photo-chip button { border: none; background: none; color: var(--brand-dark); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }

/* padding-bottom gives the scrollbar its own strip below the pills instead
   of overlapping their text; the thin custom scrollbar keeps that strip
   small instead of the OS's full-size (often opaque) default. */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 12px; scrollbar-width: thin; }
.tabs::-webkit-scrollbar { height: 6px; }
.tabs::-webkit-scrollbar-track { background: transparent; }
.tabs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.tabs::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.tabs button {
  border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; white-space: nowrap; cursor: pointer; font-weight: 500;
}
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
/* The second-level row (a section's own report tabs) reads as nested under
   the section pills above it — smaller and brand-toned instead of a second
   identical black-on-active row. */
.tabs.sub-tabs { margin-top: -8px; }
.tabs.sub-tabs button { padding: 6px 12px; font-size: 12.5px; background: var(--bg); }
.tabs.sub-tabs button.active { background: var(--brand); border-color: var(--brand); }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 50% 0%, #fff 0%, var(--bg) 65%);
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 34px 26px 30px;
  box-shadow: 0 16px 50px rgba(23,19,15,.10); border-top: 4px solid var(--brand); text-align: center;
}
.login-card img.logo { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 16px; display: block; box-shadow: 0 0 0 4px var(--brand-light); }
.login-card h1 {
  font-family: var(--heading-font); font-weight: 700; font-size: 22px; letter-spacing: .04em;
  margin: 0 0 4px; text-transform: uppercase;
}
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 13px; letter-spacing: .02em; }
.login-card .field { text-align: left; }

/* ---------- overview dashboard: stat tiles + charts ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); padding: 16px 18px; }
.stat-tile .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-tile .stat-value { font-family: var(--heading-font); font-size: 26px; font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-grid .card { margin-bottom: 0; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mini-list li:last-child { border-bottom: none; }
.mini-list .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; margin-right: 8px; flex-shrink: 0; }
.mini-list .row-label { display: flex; align-items: center; color: var(--ink); }
.mini-list .row-value { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row .bar-label { width: 96px; flex-shrink: 0; font-size: 13px; color: var(--muted); }
.bar-row .bar-track { flex: 1; background: var(--brand-light); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-row .bar-fill { background: var(--brand); height: 100%; border-radius: 999px; }
.bar-row .bar-value { width: 64px; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- print ---------- */
@media print {
  .sidebar, .mobile-topbar, .tabs, .report-actions, .no-print, .btn { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; padding: 0; margin-bottom: 24px; page-break-inside: avoid; }
  .container { max-width: none; padding: 0; }
  table.simple th, table.simple td { padding: 6px 4px; }
  /* A report opened inside a detail modal (e.g. the Customer Ledger
     statement) should print as a plain page, not a floating overlay. */
  .modal-backdrop { position: static; background: none; padding: 0; display: block; }
  .modal { max-width: none; border-top: none; padding: 0; }
}

/* ---------- thermal receipt (80mm printers, e.g. BlackCopper) ---------- */
.receipt-modal .modal { max-width: 340px; }
#receiptArea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #000;
  width: 100%; line-height: 1.5;
}
#receiptArea .r-center { text-align: center; }
#receiptArea .r-logo { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 6px; display: block; }
#receiptArea .r-title { font-weight: 700; font-size: 15px; }
#receiptArea .r-line { border-top: 1px dashed #000; margin: 8px 0; }
#receiptArea .r-row { display: flex; justify-content: space-between; gap: 8px; }
#receiptArea .r-total { font-weight: 700; font-size: 14px; }

@media screen {
  #receiptPrintOnly { display: none; }
}
@media print {
  body.printing-receipt > *:not(#receiptPrintOnly) { display: none !important; }
  #receiptPrintOnly { display: block !important; }
  @page { size: 80mm auto; margin: 3mm; }
}
