/* Local, offline utility stylesheet.
 *
 * Deliberately NOT the Tailwind CDN script: this prototype must run with no
 * network at all. The class names below mirror the Tailwind utilities the two
 * templates use, plus a few component classes for the phone frame and the
 * tap targets. Swap this file for a real compiled Tailwind build later and the
 * markup keeps working.
 */

:root {
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --emerald-50: #ecfdf5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --red-50: #fef2f2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --blue-50: #eff6ff;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --radius: 10px;
  --topbar-h: 46px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* Tamil first in the stack, from faces the device ALREADY has: Noto Sans
   * Tamil on Android, Nirmala UI / Latha on Windows, Tamil Sangam MN on
   * iOS. No webfont is downloaded - an embedded Tamil face is 200-400KB on
   * every first load, which is exactly the kind of cost a field agent on a
   * metered connection should not pay. Latin text falls through to the
   * system UI font, so mixed English/Tamil lines still look right. */
  font-family: "Noto Sans Tamil", "Nirmala UI", Latha, "Tamil Sangam MN",
               "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--slate-100);
  color: var(--slate-800);
  -webkit-font-smoothing: antialiased;
}

/* Tamil glyphs carry taller ascenders and descenders than Latin, so the
   default line-height clips them inside tight buttons and table cells. */
html[lang="ta"] body { line-height: 1.65; }
html[lang="ta"] .tap,
html[lang="ta"] .btn { line-height: 1.4; }

/* ----- layout ----- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.hidden { display: none !important; }
.relative { position: relative; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-md { max-width: 28rem; }
.max-w-6xl { max-width: 72rem; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-hidden { overflow: hidden; }

/* ----- spacing ----- */
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* ----- type ----- */
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 15px; }
.text-lg { font-size: 17px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

/* ----- colour ----- */
.text-white { color: #fff; }
.text-slate-400 { color: var(--slate-400); }
.text-slate-500 { color: var(--slate-500); }
.text-slate-600 { color: var(--slate-600); }
.text-slate-800 { color: var(--slate-800); }
.text-emerald-600 { color: var(--emerald-600); }
.text-red-600 { color: var(--red-600); }
.text-amber-600 { color: var(--amber-600); }
.text-blue-600 { color: var(--blue-600); }
.bg-white { background: #fff; }
.bg-slate-50 { background: var(--slate-50); }
.bg-slate-100 { background: var(--slate-100); }
.bg-slate-800 { background: var(--slate-800); }
.bg-slate-900 { background: var(--slate-900); }
.bg-emerald-50 { background: var(--emerald-50); }
.bg-emerald-500 { background: var(--emerald-500); }
.bg-emerald-600 { background: var(--emerald-600); }
.bg-red-50 { background: var(--red-50); }
.bg-red-500 { background: var(--red-500); }
.bg-amber-50 { background: var(--amber-50); }
.bg-amber-500 { background: var(--amber-500); }
.bg-blue-50 { background: var(--blue-50); }
.bg-blue-600 { background: var(--blue-600); }

/* ----- borders / shape ----- */
.border { border: 1px solid var(--slate-200); }
.border-t { border-top: 1px solid var(--slate-200); }
.border-b { border-bottom: 1px solid var(--slate-200); }
.border-dashed { border-style: dashed; }
.rounded { border-radius: 6px; }
.rounded-lg { border-radius: var(--radius); }
.rounded-xl { border-radius: 14px; }
.rounded-full { border-radius: 999px; }
.shadow-sm { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06); }
.shadow { box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); }
.shadow-lg { box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18); }

/* ----- components ----- */
.card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate-500); }

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.chip-cash { background: var(--emerald-50); color: var(--emerald-700); }
.chip-credit { background: var(--red-50); color: var(--red-600); }
.chip-partial { background: var(--amber-50); color: var(--amber-600); }
.chip-upi { background: var(--blue-50); color: var(--blue-600); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  padding: 8px 10px;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--slate-100); }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.meter { height: 6px; background: var(--slate-200); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--emerald-500); }
.meter.warn > span { background: var(--amber-500); }
.meter.danger > span { background: var(--red-500); }

/* ----- phone simulator ----- */
.phone-shell {
  width: 390px;
  height: 780px;
  max-height: 94vh;
  background: #000;
  border-radius: 42px;
  padding: 10px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
}
.phone-screen {
  width: 100%;
  height: 100%;
  background: var(--slate-50);
  border-radius: 34px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.phone-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 20px;
  background: #000;
  border-radius: 999px;
  z-index: 5;
}

/* Every interactive element in the mobile view is a big tap target -
   the workflow is zero-typing by design. */
.tap {
  border: 1px solid var(--slate-200);
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 54px;
  width: 100%;
  transition: transform 0.05s ease, border-color 0.12s ease;
}
.tap:active { transform: scale(0.985); }
.tap:hover { border-color: var(--slate-300); }
.tap.selected { border-color: var(--emerald-500); background: var(--emerald-50); }
.tap.disabled { opacity: 0.45; pointer-events: none; }

.tap-sm { min-height: 40px; padding: 8px 10px; text-align: center; }
.tap[disabled] { opacity: 0.45; cursor: not-allowed; }

/* A button that reads as a link - used for the in-screen "change shop" style
   actions, which must stay real buttons for keyboard and screen-reader use. */
.link-btn {
  background: none;
  border: none;
  padding: 4px 2px;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  min-height: 32px;
}

/* Visible focus ring: without it, keyboard and switch-access users cannot
   tell where they are. Applied only for keyboard focus so a tap does not
   leave a ring behind. */
.tap:focus-visible,
.btn:focus-visible,
.qty-btn:focus-visible,
.link-btn:focus-visible,
.topbar a:focus-visible {
  outline: 3px solid var(--blue-500);
  outline-offset: 2px;
}

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
}
.btn-primary { background: var(--emerald-600); color: #fff; }
.btn-primary:disabled { background: var(--slate-300); cursor: not-allowed; }
.btn-dark { background: var(--slate-800); color: #fff; }
.btn-ghost { background: transparent; color: var(--slate-600); border: 1px solid var(--slate-200); }

.qty-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--slate-300);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.qty-btn:active { background: var(--slate-100); }

/* The typed quantity between the two buttons.
   16px is not a style choice: anything smaller and iOS zooms the whole page
   in when the field is focused, which on a phone held one-handed at a shop
   counter is genuinely disorienting. */
.qty-input {
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--slate-300);
  background: #fff;
  font: inherit;
  font-size: 16px;
  padding: 0 4px;
}
.qty-input:focus {
  outline: 3px solid var(--blue-500);
  outline-offset: 1px;
  border-color: var(--blue-500);
}

.step-dots { display: flex; gap: 6px; }
.step-dots i {
  width: 22px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}
.step-dots i.on { background: #fff; }

.banner { border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.banner-error { background: var(--red-50); color: var(--red-600); }
.banner-warn { background: var(--amber-50); color: var(--amber-600); }
.banner-ok { background: var(--emerald-50); color: var(--emerald-700); }

.topbar {
  background: var(--slate-900);
  color: #fff;
  padding: 12px 16px;
  /* Carries the status-bar inset so the app below never sits under the notch. */
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar a { color: #fff; text-decoration: none; font-size: 13px; opacity: 0.8; }
.topbar a:hover { opacity: 1; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--slate-300);
  border-top-color: var(--slate-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- dashboard: tabs ----- */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 0;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--slate-500);
  cursor: pointer;
  min-height: 42px;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--slate-800); }
.tab-btn.active {
  color: var(--slate-900);
  border-bottom-color: var(--emerald-600);
}

/* ----- dashboard: form controls -----
   Inputs are 16px on purpose: anything smaller makes iOS Safari zoom the
   whole page in on focus, which then has to be pinched back out. */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.field > span { color: var(--slate-500); font-weight: 600; }

/* Bare `input` too: an <input> with no type attribute is a text field, but
   input[type="text"] does NOT match it - which left those boxes at Chrome's
   13.3px default and made iOS Safari zoom the page in on focus. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  font: inherit;
  font-size: 16px;
  padding: 9px 10px;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  background: #fff;
  color: var(--slate-800);
  min-height: 42px;
  width: 100%;
  box-sizing: border-box;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 1px;
  border-color: var(--blue-500);
}
input[type="number"] { font-variant-numeric: tabular-nums; }
select { padding-right: 6px; }

table.data input, table.data select { font-size: 13px; min-height: 34px; padding: 5px 7px; }

/* Shop name, phone and beat are edited in place. They stay flat until the
   pointer or the keyboard reaches them, so a long shop list still reads as a
   table rather than as a wall of input boxes. */
.store-field {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  max-width: 100%;
}
.store-field:hover { border-color: var(--slate-200); }
.store-field:focus {
  border-color: var(--slate-400);
  background: #fff;
  outline: none;
}

.row-inactive { opacity: 0.55; }

.thumb-btn {
  padding: 0;
  border: 1px solid var(--slate-200);
  border-radius: 5px;
  background: none;
  cursor: pointer;
  line-height: 0;
  overflow: hidden;
  vertical-align: middle;
}
.thumb-btn img { width: 28px; height: 28px; object-fit: cover; display: block; }

/* ----- dashboard: modal ----- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 760px;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
}

/* The field app's own chrome, so the responsive rules below can retarget it
   instead of fighting inline styles in the template. */
.field-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
  min-height: calc(100dvh - var(--topbar-h));
}
.phone-header { padding: 34px 16px 12px; }   /* 34px clears the simulated notch */
.phone-footer { padding: 12px; }

/* ==================================================================
 * Responsive: the SAME two pages, laid out for the device they open on.
 *
 * The phone frame is a desktop-only affordance. On a real handset the
 * field app drops the frame and becomes the viewport - full height,
 * safe-area aware, with its own internal scroll region intact.
 * ================================================================== */

/* Touch behaviour, all sizes. */
.tap, .btn, .qty-btn, .topbar a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ----- tablet / small laptop ----- */
@media (max-width: 1024px) {
  /* The desktop crib sheet beside the handset is the first thing to go. */
  body.field .crib { display: none; }
  body.admin .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.admin .p-6 { padding: 16px; }
}

/* ----- phone ----- */
@media (max-width: 700px) {
  :root { --topbar-h: 42px; }

  .topbar { padding: 9px 12px; padding-top: calc(9px + env(safe-area-inset-top, 0px)); }
  .topbar strong { font-size: 13px; }
  .topbar nav { gap: 14px; }
  .topbar .env-tag { display: none; }

  /* Field app becomes the screen.
   *
   * The height comes from a flex column, NOT from
   * `calc(100dvh - var(--topbar-h))`: at narrow widths (360px Android) the
   * top bar wraps to two lines, and a hard-coded bar height then makes the
   * app taller than the viewport - the whole page scrolls and the sticky
   * confirm button is pushed off-screen. Flex measures the real bar. */
  body.field {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.field .topbar { flex: 0 0 auto; }
  body.field .field-stage {
    flex: 1 1 auto;
    min-height: 0;          /* lets the flex child shrink instead of overflowing */
    padding: 0;
    align-items: stretch;
    gap: 0;
  }
  body.field .phone-shell {
    width: 100%;
    height: 100%;
    max-height: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
  body.field .phone-screen { border-radius: 0; }
  body.field .phone-notch { display: none; }
  body.field .phone-header { padding: 12px 14px; }
  body.field .phone-footer {
    /* Keep the primary action above the home indicator / gesture bar. */
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  /* Bigger tap targets, one-handed reach. */
  .tap { min-height: 58px; }
  .btn { min-height: 54px; }
  .qty-btn { width: 44px; height: 44px; }

  /* Admin dashboard stacks; wide tables keep their own horizontal scroll. */
  body.admin .p-6 { padding: 12px; }
  body.admin .grid-cols-4,
  body.admin .grid-cols-3,
  body.admin .grid-cols-2 { grid-template-columns: minmax(0, 1fr); }
  body.admin .card { padding: 12px; }
  body.admin .stat-value { font-size: 22px; }
  body.admin table.data { font-size: 12px; }
  body.admin table.data th,
  body.admin table.data td { padding: 7px 8px; }

  /* Tabs scroll sideways instead of wrapping into three rows of chrome. */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 10px; font-size: 12px; }

  .modal { padding: 8px; align-items: flex-start; }
  .modal-card { padding: 14px; max-height: 94vh; margin-top: 8px; }
}

/* ----- narrow phones: keep the top bar on one line ----- */
@media (max-width: 430px) {
  .topbar { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .topbar strong { font-size: 12px; }
  .topbar nav { gap: 10px; }
  .topbar a { font-size: 12px; }
}

/* ----- very narrow phones ----- */
@media (max-width: 380px) {
  body.field .grid-cols-2 { grid-template-columns: minmax(0, 1fr); }
  body.field .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .text-3xl { font-size: 26px; }
}

/* ----- landscape phone: reclaim vertical space ----- */
@media (max-height: 480px) and (orientation: landscape) {
  body.field .phone-header { padding-top: 8px; padding-bottom: 8px; }
  body.field .step-dots { display: none; }
  body.field .tap { min-height: 48px; }
  body.field .btn { min-height: 44px; }
}

/* ----- printed receipts / price lists ----- */
@media print {
  .topbar, .phone-footer, .crib { display: none; }
  .phone-shell { box-shadow: none; padding: 0; }
}

/* ----- brand colour coding -----
 * Each product tile carries its pack's real colour as a thick left edge and a
 * faint wash of the same hue. The colour itself is inline (it comes from the
 * database per brand); these rules only handle what CSS should own - the
 * hover/active states and keeping the edge visible when the tile is disabled
 * for being out of stock. */
.brand-tile { transition: transform 0.05s ease, box-shadow 0.12s ease; }
.brand-tile:hover { box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1); }
.brand-tile.disabled,
.brand-tile[disabled] {
  /* Grey the CONTENT, but leave the colour edge readable so the agent can
     still tell which brand is the one that has run out. */
  opacity: 1;
  background: var(--slate-50) !important;
}
.brand-tile[disabled] .text-sm,
.brand-tile[disabled] .text-xs { opacity: 0.45; }

/* One product, one cell: the tile that adds it, and - once it is in the
   bill - the count sitting directly underneath.
 *
 * The cell now carries the border, the radius and the brand's colour edge,
 * and the button inside it is transparent, so the tile and its counter read
 * as one object rather than two things that happen to be adjacent. */
.brand-cell {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.brand-cell .brand-tile {
  border: 0;
  border-radius: 0;
  background: transparent;
  flex: 1 1 auto;
}
/* In the bill already - the green edge is the same "chosen" signal .selected
   gives everywhere else in the app. */
.brand-cell.in-bill { border-color: var(--emerald-500); }
.brand-cell.is-out { background: var(--slate-50) !important; }

.brand-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-top: 1px solid var(--slate-200);
  background: rgba(255, 255, 255, 0.72);
}
/* Slightly smaller than the ones on the bill line below: two of them plus a
   box have to fit inside half a phone's width without the number - the part
   that actually gets read - being squeezed to nothing. */
.brand-qty .qty-btn { width: 34px; height: 34px; font-size: 18px; flex: 0 0 auto; }
.brand-qty .qty-input {
  height: 34px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-weight: 600;
}

/* Colour swatch beside a brand name in the dashboard catalog. */
.brand-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(15, 23, 42, 0.15);
}

/* ----- Bars, for the month's shape -----
   A month total answers "how much"; only the weeks beside each other answer
   "is it climbing or falling away", which is the question an owner is
   actually asking. Drawn in CSS rather than with a charting library: the
   dashboard has no build step and must render on a phone over a slow link,
   and a bar whose length is a percentage needs nothing else. */
.bar-row {
  display: grid;
  grid-template-columns: minmax(74px, auto) 1fr minmax(84px, auto);
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.bar-track {
  background: var(--slate-100);
  border-radius: 4px;
  height: 20px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--slate-800);
  border-radius: 4px;
  /* A period that traded at all keeps a visible sliver: a bar of zero width
     and a bar that is genuinely nothing must not look the same. */
  min-width: 2px;
  transition: width 0.2s ease;
}
.bar-fill.is-best { background: var(--emerald-600); }
.bar-fill.is-partial {
  /* A week clipped by the start or end of the month did not have seven days
     to earn its total, so it is hatched rather than solid - otherwise the
     month always appears to start and end badly. */
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.25) 0 4px,
    rgba(255, 255, 255, 0) 4px 8px
  );
}
.bar-label { font-size: 12px; color: var(--slate-600); }
.bar-value {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  .bar-row { grid-template-columns: minmax(62px, auto) 1fr minmax(70px, auto); gap: 7px; }
  .bar-label, .bar-value { font-size: 11px; }
}

/* ===================================================================
 * Settings switches
 *
 * Each switch carries its own explanation, because every one of these
 * changes what somebody ELSE sees on their phone, and an owner toggling
 * something he half-remembers is how a beat ends up refusing real sales on
 * a Saturday morning. The words are the feature; the checkbox is small.
 * =================================================================== */
.setting-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--slate-200);
}
.setting-row:last-of-type { border-bottom: 0; }

.setting-switch {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  cursor: pointer;
}
.setting-switch input { width: 20px; height: 20px; margin-top: 2px; }
.setting-switch > span { display: flex; flex-direction: column; gap: 3px; }
.setting-switch strong { font-size: 14px; }

/* Underlined sub-heading that separates candy from the cigarette brands.
 *
 * Underlined rather than a coloured chip or a boxed panel because that is
 * how the seller writes it in the paper book he is replacing - a heading
 * with a line under it, then the items. Matching what he already does means
 * there is nothing to learn. */
.group-heading {
  margin: 4px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--slate-800);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
