/* Admin / back-office dashboard */
body { background: var(--bg); }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: radial-gradient(120% 40% at 0% 0%, #12472d 0%, transparent 60%), #0b2618; color: #cfe3d7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand .logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; display: grid; place-items: center; }
.brand .logo img { width: 32px; height: 32px; object-fit: contain; }
.brand b { color: #fff; font-size: 15px; display: block; }
.brand span { font-size: 11.5px; opacity: .7; }
.nav { display: grid; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 12px; border-radius: 11px; color: #b4cdbf; font-weight: 600; text-align: left; transition: background .15s, color .15s; }
.nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav button.on { background: var(--g); color: #fff; box-shadow: 0 8px 20px -10px rgba(0,150,75,.9); }
.nav .n { margin-left: auto; min-width: 22px; height: 20px; border-radius: 10px; padding: 0 6px; background: #f59e0b; color: #1f1300; font-size: 11.5px; font-weight: 800; display: grid; place-items: center; }
.side .foot { margin-top: auto; font-size: 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.side .foot button { color: #fca5a5; font-size: 12px; margin-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: rgba(244,247,245,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 21px; font-weight: 800; }
.top .live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; color: var(--g-dark); background: var(--g-soft); padding: 4px 9px; border-radius: 20px; letter-spacing: .5px; }
.top .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--g); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3 } }
html.offline .top .live { color: #92400e; background: #fef3c7; }
html.offline .top .live i { background: var(--amber); }
.top .grow { flex: 1; }
/* Quiet problems from health.js: one line each, above every page. */
.healthbar { margin: 16px 24px 0; padding: 10px 14px; border-radius: 12px; background: #fef2f2; border: 1.5px solid #fecaca; color: #991b1b; font-size: 13px; display: grid; gap: 4px; }
.healthbar div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.healthbar span { color: #b91c1c; font-weight: 500; }
.select { height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; padding: 0 10px; font-weight: 600; outline: 0; }
.tsearch { display: flex; align-items: center; gap: 8px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; padding: 0 10px; color: var(--ink-3); width: 240px; }
.tsearch input { border: 0; outline: 0; flex: 1; min-width: 0; background: transparent; }
/* Both drop the browser's outline for their own look, so they draw their own focus: without it a
   keyboard user could not see that the branch filter or the search box had been reached. */
.tsearch:focus-within, .select:focus-visible { border-color: var(--g); box-shadow: 0 0 0 3px var(--g-soft); }
.select:focus { outline: 0; }

.page { padding: 20px 24px 40px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { background: #fff; border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12.5px; color: var(--ink-3); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kpi .l .ic { width: 28px; height: 28px; padding: 6px; border-radius: 9px; background: var(--g-soft); color: var(--g-dark); box-sizing: border-box; }
.kpi .v { font-size: 27px; font-weight: 800; margin-top: 10px; letter-spacing: -.03em; }
.kpi .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.panel { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel > header h3 { margin: 0; font-size: 15px; }
.panel > header .sub { color: var(--ink-3); font-size: 12.5px; }
/* "Inapakia…" and the error under the users and settings panels: the class comes from the shop's
   stylesheet, which this console does not load, so it sat flush against the panel's edge. */
.panel .empty { padding: 18px 16px; color: var(--ink-3); }
/* The page-wide focus ring is green, nearly invisible on the dark green menu. */
.side :focus-visible { outline-color: rgba(255,255,255,.75); }

.kanban { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.col { background: #edf2ef; border-radius: 14px; padding: 8px; min-height: 260px; display: flex; flex-direction: column; gap: 8px; }
/* "Imethibitishwa" is one long word: at 1280px the column was five pixels short of it and the
   heading read "Imethibitish…". A slightly smaller heading and count fit it whole; the title
   attribute still gives the full name where a column is narrower still. */
.col > h4 { margin: 0; display: flex; align-items: center; gap: 5px; font-size: 12px; letter-spacing: -.01em; padding: 2px 2px 4px 4px; }
.col > h4 i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.col > h4 b { min-width: 0; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.col > h4 span { margin-left: auto; flex: none; background: #fff; border-radius: 10px; padding: 1px 7px; font-size: 12px; }
.kcard { background: #fff; border-radius: 12px; padding: 11px 12px; box-shadow: 0 1px 2px rgba(14,29,21,.06), 0 2px 8px -4px rgba(14,29,21,.08); cursor: pointer; border: 1.5px solid transparent; transition: border-color .15s, transform .12s, box-shadow .15s; }
.kcard:hover { border-color: var(--g-line); transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(14,29,21,.25); }
.col-empty { display: grid; justify-items: center; gap: 6px; padding: 26px 4px; color: var(--ink-3); font-size: 12px; font-weight: 700; border: 1.5px dashed #d5dfda; border-radius: 12px; }
.kcard.flash { animation: newcard 2.4s ease-out; border-color: #f59e0b; }
@keyframes newcard { 0%, 30% { background: #fff4d6; transform: scale(1.02) } 100% { background: #fff; transform: none } }
.kcard .t { display: flex; justify-content: space-between; align-items: center; gap: 4px; white-space: nowrap; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.kcard .c { font-weight: 700; margin-top: 5px; font-size: 13.5px; line-height: 1.25; overflow-wrap: anywhere; }
.kcard .a { font-size: 12px; color: var(--ink-3); }
.kcard .m { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; flex-wrap: wrap; gap: 4px; }
.kcard .m b { white-space: nowrap; }
.kcard .btn { width: 100%; margin-top: 9px; white-space: normal; height: auto; min-height: 34px; padding: 6px 8px; line-height: 1.2; font-size: 12.5px; }
.flashrow { animation: flash 2.4s; }
.col .more { text-align: center; font-size: 12px; color: var(--ink-3); padding: 4px; }

.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 14px; }
.grid3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; margin-top: 14px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11px; color: var(--ink-3); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafcfb; white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
/* ids, amounts and chips never break mid-token */
table.t td.num, table.t td > b:only-child, table.t .badge, table.t .chip { white-space: nowrap; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f6faf8; }
table.t tr.flash td { animation: flash 2.4s; }
.tablewrap { overflow-x: auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tabs button { height: 32px; padding: 0 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.tabs button.on { background: var(--ink); color: #fff; }
.tabs button span { opacity: .6; margin-left: 4px; }

.drawer-bg { position: fixed; inset: 0; background: rgba(6,18,12,.38); backdrop-filter: blur(2px); z-index: 60; }
.drawer-bg.enter { animation: fade .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: #fff; z-index: 61; display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(0,0,0,.15); }
.drawer.enter { animation: slidein .28s var(--ease); }
@keyframes slidein { from { transform: translateX(40px); opacity: .4 } }
.drawer > header { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.drawer > header h2 { margin: 0; font-size: 21px; font-weight: 800; }
.drawer .body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.drawer .foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.drawer .foot .btn { flex: 1; }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.box h5 { margin: 0 0 8px; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13.5px; }
.kv span:first-child { color: var(--ink-3); }
.drv { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 1.5px solid var(--line); cursor: pointer; margin-bottom: 6px; }
.drv:hover { border-color: var(--g-line); }
.drv.best { border-color: var(--g); background: var(--g-soft); }
.avatar.veh { background: #eef2f0; color: var(--ink-2); }
.veh-pic { width: 66px; height: 44px; object-fit: contain; flex: none; background: none; }
.veh-pic.sm { width: 30px; height: 20px; margin: -2px 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--g-soft); color: var(--g-dark); display: grid; place-items: center; font-weight: 800; flex: none; font-size: 13px; }
.mini-tl { display: grid; gap: 6px; }
.mini-tl div { display: flex; gap: 10px; font-size: 13px; align-items: center; }
.mini-tl i { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.chart-tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px; z-index: 100; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 16px; font-size: 13px; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: #eef3f0; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--g); border-radius: 4px; }
.inline-in { width: 92px; height: 34px; border-radius: 8px; border: 1.5px solid var(--line); padding: 0 8px; text-align: right; outline: 0; font-variant-numeric: tabular-nums; }
.inline-in:focus { border-color: var(--g); box-shadow: 0 0 0 3px var(--g-soft); }
/* The same small box holding words (a reason, a note, a reference): words start at the left, and
   a right-aligned placeholder such as "mf. Leseni haisomeki" was cut off at its start. */
.inline-in.txt { text-align: left; }
/* A price or stock figure the role may read but not change (office-users.js decides who may). */
.inline-in[readonly] { background: transparent; border-color: transparent; }

.tw { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: #111827; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .3px; text-transform: none; vertical-align: 1px; }
.erpchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 20px; background: #eef2ff; color: #3730a3; font-size: 11.5px; font-weight: 800; letter-spacing: .3px; transition: .2s; white-space: nowrap; }
.erpchip i { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; }
.erpchip.pulse { background: #3730a3; color: #fff; }
.flow { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 16px; padding: 18px; align-items: center; }
.flowcol h4 { margin: 0 0 8px; font-size: 13px; }
.flowitem { padding: 8px 10px; border-radius: 8px; font-size: 12.5px; margin-bottom: 6px; background: #f3f6f4; border-left: 3px solid var(--g); }
.flowitem.erp { border-left-color: #3730a3; background: #f3f4fb; }
.flowmid { display: grid; gap: 12px; text-align: center; }
.flowmid .hub { background: var(--ink); color: #fff; border-radius: 12px; padding: 14px; font-weight: 700; }
.flowmid small { display: block; font-weight: 500; font-size: 11.5px; opacity: .75; margin-top: 3px; }
.flowmid .arrow { font-weight: 700; font-size: 13px; padding: 8px; border-radius: 10px; }
.flowmid .arrow.in { background: #e0f2fe; color: #075985; }
.flowmid .arrow.out { background: var(--g-soft); color: var(--g-deep); }
@media (max-width: 900px) { .flow { grid-template-columns: 1fr; } }
.print-area { display: none; }
@media print {
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block; padding: 20px; font-size: 12px; color: #000; }
  .print-area table { width: 100%; border-collapse: collapse; margin-top: 12px; }
  .print-area td, .print-area th { border: 1px solid #999; padding: 6px; text-align: left; }
  /* The A4 Sales Order (printNote), laid out like the one the ERP prints. */
  .print-area:has(.so) { padding: 0; }
  .so { font: 11px/1.3 Arial, Helvetica, sans-serif; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .so-top { display: flex; justify-content: space-between; font-size: 8px; margin-bottom: 4px; }
  .so-box { border: 1.5px solid #000; }
  .so-head { display: flex; border-bottom: 1px solid #000; }
  .so-logo { width: 150px; border-right: 1px solid #000; padding: 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .so-logo img { width: 70px; }
  .so-logo b { color: #1f8a3b; font-size: 10px; }
  .so-logo i { font-family: Georgia, serif; font-size: 9px; }
  .so-co { flex: 1; padding: 8px 10px; color: #1a1a8c; font-size: 10.5px; }
  .so-name { font-size: 18px; margin-bottom: 4px; }
  .so-split { display: flex; justify-content: space-between; }
  .so-call { color: #000; }
  .so-title { text-align: center; border-bottom: 1px solid #000; padding: 2px; font-size: 11px; }
  .so-parties { display: flex; justify-content: space-between; padding: 4px 6px; font-size: 11px; }
  .so-ref { min-width: 42%; }
  .print-area table.so-t { margin: 0; border-collapse: collapse; width: 100%; }
  .print-area .so-t th, .print-area .so-t td { border: 0; border-left: 1px solid #000; padding: 2px 4px; font-size: 10.5px; vertical-align: top; }
  .print-area .so-t th:first-child, .print-area .so-t td:first-child { border-left: 0; }
  .print-area .so-t thead th { border-top: 1px solid #000; border-bottom: 1px solid #000; background: #d9f1f7; text-align: center; font-weight: 700; }
  .print-area .so-t thead th.l { text-align: left; }
  .print-area .so-t tbody td { padding-top: 4px; padding-bottom: 4px; }
  .print-area .so-t tr.total td { border-top: 1px solid #000; border-bottom: 1px solid #000; }
  .so-t .c { text-align: center; } .so-t .r { text-align: right; white-space: nowrap; }
  .so-t .sub { padding-left: 14px; }
  .so-t .words { font-size: 9px; }
  .so-foot { display: flex; gap: 10px; padding: 4px 6px; }
  .so-terms { flex: 1.3; font-size: 10px; }
  .so-remark { width: 120px; border: 1px solid #000; align-self: flex-start; margin-top: 30px; }
  .so-remark div:first-child { border-bottom: 1px solid #000; text-align: center; font-weight: 700; }
  .so-remark div:last-child { min-height: 36px; padding: 2px; font-size: 9px; }
  .so-sign { flex: 1; text-align: right; }
  .so-recv { padding: 8px 6px 4px; font-size: 10.5px; }
  .so-bank { padding: 6px; border-top: 1px solid #000; }
  .so-acc { text-align: center; font-size: 14px; font-weight: 700; margin: 2px 0 6px; }
  .so-banks { display: flex; justify-content: space-between; font-size: 10px; }
  .so-banks > div { flex: 1; }
  .so-banks > div:last-child { text-align: right; }
  .so-t tbody tr { page-break-inside: avoid; }
  .so-t thead { display: table-header-group; }
  /* "Kwa MARG" (pageMarg): what left, on A4, for Sales to enter in MARG by hand. One order per page
     when several are printed; the day's list runs on, each order's lines kept together. */
  .print-area:has(.mp) { padding: 0; }
  html:has(.print-area .mp), body:has(.print-area .mp) { background: #fff !important; }
  .mp { page: mp; font: 11px/1.35 Arial, Helvetica, sans-serif; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .mp-order + .mp-order { break-before: page; }
  .mp-head { display: flex; align-items: center; gap: 10px; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
  .mp-head img { width: 44px; height: auto; }
  .mp-co { font-size: 16px; font-weight: 700; }
  .mp-title { font-weight: 700; }
  .mp-printed { margin-left: auto; text-align: right; font-size: 9px; }
  .mp-meta { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
  .mp-id { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
  .mp-shop { text-align: right; }
  .mp-shop b { font-size: 13px; }
  .print-area table.mp-t { margin: 0; width: 100%; border-collapse: collapse; }
  .print-area .mp-t th, .print-area .mp-t td { border: 1px solid #555; padding: 3px 5px; font-size: 10.5px; vertical-align: top; text-align: left; }
  .print-area .mp-t thead th { background: #e8f5ec; font-weight: 700; }
  .mp-t thead { display: table-header-group; }
  .mp-t tr { break-inside: avoid; }
  .mp-t tbody.mp-group { break-inside: avoid; }
  .print-area .mp-t .c { text-align: center; } .print-area .mp-t .r { text-align: right; white-space: nowrap; }
  .print-area .mp-t tr.mp-split td { border-top: 0; font-style: italic; }
  .mp-sub { font-size: 9.5px; color: #333; }
  .mp-q { font-size: 9.5px; }
  .mp-none { font-weight: 700; font-style: italic; }
  .print-area .mp-t tr.mp-sum td { font-weight: 700; background: #f4f4f4; }
  .print-area .mp-t tr.mp-total td { font-weight: 700; font-size: 12px; border-top: 2px solid #000; }
  .mp-foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; }
}
@page mp { size: A4; margin: 12mm; }

@media (max-width: 1250px) { .kpis { grid-template-columns: repeat(3, 1fr); } .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  /* The menu strip keeps its own height: on a short page (Ghala switched off, Settings loading)
     the grid shared the spare screen height between both rows and the strip grew to 140px. */
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 12px; gap: 8px; }
  .brand { padding: 0 8px 0 0; } .brand div { display: none; }
  .nav { display: flex; } .nav button { white-space: nowrap; } .side .foot { display: none; }
  /* minmax(0, 1fr): a long word ("Imeunganishwa" on the ERP page) shrinks with its card instead
     of pushing the second column off the screen. */
  .kpis, .kpis.four, .kpis.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid2, .grid3 { grid-template-columns: 1fr; }
  .kpi .v { overflow-wrap: anywhere; }
  /* payment channels: logo beside the name, the numbers and the buttons under it */
  table.pc tr { display: grid; grid-template-columns: 52px 1fr; align-items: start; border-top: 1px solid var(--line); padding: 8px 0; }
  table.pc td { border: 0 !important; padding: 4px 10px; }
  table.pc td:nth-child(3), table.pc td:nth-child(4) { grid-column: 2; text-align: left !important; }
  table.pc .row-acts { justify-content: flex-start !important; flex-wrap: wrap; }
  /* riders on a phone: who, what they drive, and whether they are on duty (with the buttons) */
  table.riders th:nth-child(n+3):nth-child(-n+5), table.riders td:nth-child(n+3):nth-child(-n+5) { display: none; }
  .page { padding: 16px; } .top { padding: 12px 16px; } .tsearch { width: 100%; } .healthbar { margin: 12px 16px 0; }
}

/* scrollbars on desktop */
.main ::-webkit-scrollbar, .drawer ::-webkit-scrollbar { width: 10px; height: 10px; }
.main ::-webkit-scrollbar-thumb, .drawer ::-webkit-scrollbar-thumb { background: #cfd9d4; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* small office forms and row actions */
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; min-height: 40px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--g); }
select.inline-in { text-align: left; padding-right: 6px; cursor: pointer; }
.x-btn { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.x-btn:hover { background: var(--bg); }
.row-acts { display: flex; gap: 2px; margin: 4px 0 0 -6px; }
.row-acts button { font-size: 12px; font-weight: 700; color: var(--g-dark); padding: 4px 6px; border-radius: 6px; }
.row-acts button:hover { background: var(--g-soft); }
.row-acts button.neg { color: var(--red); }
.row-acts button.neg:hover { background: #fff5f5; }
table.t.compact th, table.t.compact td { padding-left: 10px; padding-right: 10px; }
.drv:focus-visible, .kcard:focus-visible, table.t tr.click:focus-visible { outline: 3px solid rgba(0,150,75,.4); outline-offset: 1px; }

/* EN | SW switch in the top bar */
.langsw { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--line, #e3eae6); flex: none; }
.langsw button {
  border: 0; background: none; cursor: pointer; border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 800;
  color: var(--ink-3, #75857c); letter-spacing: .3px; line-height: 1.2;
}
.langsw button:hover { color: var(--ink, #0e1d15); }
.langsw button.on { background: #fff; color: var(--g-dark, #007a3d); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.langsw button:focus-visible { outline: 2px solid var(--g, #00964b); outline-offset: 2px; }

/* ---------- runtime settings ---------- */
/* A form somebody fills in from an email: the label carries the explanation, because the person
   typing an API key into it has no other way of knowing what it is for. */
.cfgform { padding: 4px 16px 16px; display: grid; gap: 14px; }
.cfgrow { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(240px, 1.2fr); gap: 16px; align-items: start; }
.cfgrow label { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.cfgrow label small { color: var(--ink-3); font-size: 12px; line-height: 1.45; }
.cfgrow label .chip { align-self: flex-start; margin: 2px 0; }
.cfgrow input, .cfgrow select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
.cfgrow input:focus, .cfgrow select:focus { outline: none; border-color: var(--g); box-shadow: 0 0 0 3px var(--g-soft); }
@media (max-width: 760px) { .cfgrow { grid-template-columns: 1fr; gap: 6px; } }

/* the office sign-in page: a page of its own, not a dialog over a console nobody may see yet */
.signin { position: fixed; inset: 0; z-index: 9999; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 20px 16px;
  background: radial-gradient(120% 60% at 0% 0%, #12472d 0%, transparent 60%), #0b2618; }
.signin .card { background: #fff; border-radius: 16px; width: 100%; max-width: 420px; padding: 24px; box-shadow: 0 24px 60px rgba(0,0,0,.35); margin: auto; }
.signin .head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.signin .head img { width: 36px; height: 36px; object-fit: contain; }
.signin .head b { display: block; font-size: 15px; }
.signin .head span { font-size: 12px; color: var(--ink-3); }
.signin .head .langsw { margin-left: auto; }
.signin h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.signin .why { color: var(--ink-3); font-size: 13.5px; margin: 0 0 8px; line-height: 1.5; }
.signin .pick { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); margin: 12px 0 6px; }
.signin .pick button { height: 38px; border-radius: 9px; font-weight: 700; color: var(--ink-3); }
.signin .pick button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(14,29,21,.14); }
.signin label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin: 12px 0 6px; }
.signin input { width: 100%; box-sizing: border-box; height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; background: #fff; }
.signin input:focus { outline: none; border-color: var(--g); box-shadow: 0 0 0 3px var(--g-soft); }
.signin .btn { width: 100%; margin-top: 16px; }
.signin .err { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fef2f2; color: #991b1b; font-size: 13px; line-height: 1.45; }
.signin .demo { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fef3c7; color: #92400e; font-size: 13px; }
.signin .demo b { font-size: 16px; letter-spacing: .12em; }
.signin .setup { margin: 8px 0 4px; padding: 12px; border-radius: 10px; background: #fef3c7; color: #92400e; font-size: 13px; line-height: 1.5; }
.signin .setup code { display: block; margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #fff8e1; color: #1f1300; font-size: 12px; word-break: break-all; }
.signin .note { margin-top: 10px; color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.signin .link { margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--g-dark); }
/* The generated temporary password, shown once for the administrator to pass on. */
.oupw { font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }
.urow td { background: #fafcfb; }
.side .foot .who { color: #fff; font-size: 13px; }
.top .me-out { display: none; }
@media (max-width: 900px) { .top .me-out { display: inline-flex; } }

/* A shop's phone number is a link to call it, drawn like the text around it. */
a.tel { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; white-space: nowrap; }   /* "0718 220" on one line and "945" on the next was a number nobody could ring */
a.tel:hover { color: var(--g-dark); }

/* On a phone the menu scrolls sideways without a grey bar under it, and the orders table keeps
   what a desk needs at a glance (order, shop, total, status) instead of hiding the total
   and the status off the right-hand edge. Branch, time, payment and rider are in the order itself. */
@media (max-width: 900px) {
  .side { scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
}
/* The columns are named (c-shop, c-amt…) rather than counted: the route tick-box column is there
   only for those who may book routes, and counting from it hid the shop, the total and the status
   on a phone and kept the time, the payment and the rider instead. */
@media (max-width: 640px) {
  table.t.orders .c-br, table.t.orders .c-when, table.t.orders .c-pay, table.t.orders .c-drv { display: none; }
  table.t.orders th, table.t.orders td { padding-left: 8px; padding-right: 8px; }
  table.t.orders td.c-shop .muted { display: none; }   /* the address is in the order itself */
  table.t.orders td.c-shop { min-width: 0 !important; }
  table.t.orders .badge { white-space: normal !important; line-height: 1.25; }   /* statusBadge sets nowrap inline */
  table.t.orders td { font-size: 13px; }
  table.t.orders td.c-id { font-size: 12px; }
  table.t.orders td.c-amt, table.t.orders td.c-amt b { white-space: normal !important; }   /* "TZS" may sit above the figure */
  table.t.orders .badge { font-size: 11px; padding-right: 8px; }
}
/* On a phone the top bar scrolls away with the page: kept on screen it was a search box, the
   language switch and the branch list stacked over a third of a 640px screen. The language,
   sign-out and branch share one row. Panel headings put their explanation on a line of its own
   so the title and the button beside it keep their width. */
@media (max-width: 640px) {
  .top { position: static; backdrop-filter: none; }
  .top .select { flex: 1 1 140px; min-width: 0; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 22px; }
  .panel > header { flex-wrap: wrap; row-gap: 2px; }
  .panel > header .sub { order: 3; flex-basis: 100%; }
}

/* a product's shelf, changeable in the products list */
select.pcat { border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 12px; padding: 0 2px; cursor: pointer; }
select.pcat:hover, select.pcat:focus { color: var(--g-dark); text-decoration: underline; }
/* The product's picture in the catalogue table doubles as the way to give it a photograph. */
.photo-pick { position: relative; display: block; cursor: pointer; flex: none; border-radius: 12px; }
.photo-pick > span { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; background: var(--g); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; font-size: 12px; }
.photo-pick:hover .art { filter: brightness(.92); }
.photo-pick:focus-within { outline: 2px solid var(--g); outline-offset: 2px; }

/* The Ghala page (js/admin-warehouse.js): a row of labelled fields that wraps on a narrow screen. */
.wh-form { display: flex; flex-wrap: wrap; gap: 12px; padding: 14px 16px; align-items: flex-end; }
.wh-field { display: grid; gap: 4px; min-width: 140px; flex: 1; }
.wh-field > span { font-size: 12px; font-weight: 600; color: var(--ink-3); }
/* Fields as tall as the buttons beside them, and a comfortable target on a tablet. */
.wh-field .input { height: 44px; width: 100%; border-radius: 10px; }
/* A date box needs room for dd/mm/yyyy and its calendar button: at the 140px every field may
   shrink to, the button sat on top of the quantity box beside it. */
.wh-field:has(input[type="date"]) { min-width: 170px; }
.wh-wide { flex: 3; min-width: 260px; position: relative; }
.wh-hits { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.08); overflow: hidden; }
.wh-hits button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; cursor: pointer; font: inherit; }
.wh-hits button:hover, .wh-hits button:focus { background: var(--g-soft, #ecfdf3); }
.wh-chosen { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 4px; flex-wrap: wrap; }
.wh-result { padding: 12px 16px; border-top: 1px solid var(--line); }
.wh-btn { flex: 0 0 auto; min-width: 0; }
.wh-field input::placeholder { text-transform: none; }
.wh-bar { display: inline-block; width: 90px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; vertical-align: middle; margin-right: 8px; }
.wh-bar > i { display: block; height: 100%; background: var(--g, #16a34a); }
.wh-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--g-soft, #ecfdf3); font-size: 12px; font-weight: 600; margin: 2px 0; }
.wh-on td { background: var(--g-soft, #ecfdf3); }
.wh-on td:first-child { box-shadow: inset 3px 0 0 var(--g); }
/* Shelf labels (whPrintLabels): printed only, several to an A4 page. */
.wh-labels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10mm; }
.wh-label { display: flex; gap: 6mm; align-items: center; border: 1px dashed #888; border-radius: 3mm; padding: 5mm; break-inside: avoid; }
.wh-label-qr { width: 32mm; height: 32mm; flex: none; }
.wh-label-qr svg { width: 100%; height: 100%; }
.wh-label-code { font-size: 30pt; font-weight: 800; letter-spacing: 1px; line-height: 1; }
.wh-label-sub { font-size: 10pt; color: #333; margin-top: 2mm; }
.wh-label-q { display: inline-block; margin-top: 2mm; padding: 1mm 3mm; border: 2px solid #000; font-weight: 800; font-size: 11pt; }
/* The Ghala tab bar: grouped tabs in a panel; one scrolling row on a narrow screen. */
.wh-tabbar { margin-bottom: 14px; }
.wh-tabbar .tabs { border-bottom: 0; }
@media (max-width: 900px) { .wh-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .wh-tabs button { flex: none; } }
@media (pointer: coarse) { .tabs button { height: 40px; } }
/* A segmented choice (the report's period), not a second row of page tabs. */
.wh-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 12px; }
.wh-seg button { height: 34px; padding: 0 14px; border-radius: 9px; font-weight: 700; color: var(--ink-3); }
.wh-seg button.on { background: var(--ink); color: #fff; }
/* Notes inside a panel: done, a warning, an error. */
.wh-note { margin: 0 16px 12px; padding: 10px 12px; border-radius: 10px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wh-note.ok { background: var(--g-soft); }
.wh-note.warn { background: #fef3c7; color: #92400e; }
.wh-note.err { background: #fef2f2; color: #991b1b; box-shadow: inset 0 0 0 1.5px #fecaca; }
.wh-empty { padding: 16px; color: var(--ink-3); }
/* A file picker that is a button and still reachable from the keyboard. */
.btn:focus-within { outline: 3px solid rgba(0,150,75,.4); outline-offset: 2px; }
.wh-done { margin: 0 16px 12px; padding: 10px 12px; border-radius: 10px; background: var(--g-soft, #ecfdf3); font-weight: 600; }
/* Makers' barcodes linked to the product chosen. */
.wh-codes { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.wh-x { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; color: var(--ink-3); }
.wh-x:hover, .wh-x:focus-visible { color: var(--red); }
.wh-note.wh-code-note { display: block; margin: 6px 0 0; padding: 6px 10px; font-size: 12.5px; font-weight: 400; line-height: 1.45; }
.wh-note.wh-code-note .btn { margin-left: 6px; vertical-align: middle; }

/* Ghala: a scan field with the camera beside it, and the camera itself (admin-warehouse.js whCamera) */
.wh-inrow { display: flex; gap: 6px; align-items: center; width: 100%; }
.wh-inrow .input { flex: 1; min-width: 0; }
.wh-cam { flex: none; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--g-soft, #e8f5ee); color: var(--g-dark, #0b5d36); display: grid; place-items: center; cursor: pointer; }
.scan-host { position: fixed; inset: 0; z-index: 900; background: #000; color: #fff; }
.scan-host video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-aim { position: absolute; left: 12%; right: 12%; top: 34%; height: 30%; border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scan-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px; font-size: 14px; }
.scan-close { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; }
/* A phone in the godown: one field per row, buttons a thumb can reach. */
@media (max-width: 640px) {
  .wh-form { padding: 12px; gap: 10px; }
  .wh-field { min-width: 100%; }
  .wh-field.wh-btn > span { display: none; }
  .wh-field.wh-btn .btn { width: 100%; height: 48px; }
}

/* Motion only for those who have not asked their system for less: the LIVE dot, new-order
   flashes and the drawer sliding in are decoration, never the only sign of anything. */
@media (prefers-reduced-motion: reduce) {
  .top .live i, .kcard.flash, .flashrow, table.t tr.flash td, .drawer.enter, .drawer-bg.enter { animation: none; }
  .kcard, .kcard:hover { transition: none; transform: none; }
}

/* A wide table that scrolls sideways says so: a soft shadow on the edge that has more columns
   behind it, gone once that edge is reached. Without it the status and credit columns sat off the
   right-hand edge of a 1366px screen with nothing to show they were there. Pure CSS (the covers
   scroll with the content, the shadows stay put). */
.panel .tablewrap, .drawer .tablewrap {
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center / 36px 100% no-repeat local,
    linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) right center / 36px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(14,29,21,.24), transparent) left center / 16px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(14,29,21,.24), transparent) right center / 16px 100% no-repeat scroll;
}

/* A tablet or a small laptop (a 1024px tablet, a 1280px screen with the browser not maximised):
   the menu folds to its icons, with the name on hover and for screen readers, and gives the
   tables the width the menu's labels took. The orders table kept its status column off-screen
   at 1024px. Below 900px the menu is already a strip across the top. */
@media (min-width: 901px) and (max-width: 1180px) {
  .shell { grid-template-columns: 72px 1fr; }
  .side { padding: 14px 10px; overflow-y: auto; scrollbar-width: none; }
  .nav button { height: 40px; }
  .brand { justify-content: center; padding: 2px 0 16px; }
  .brand > div:not(.logo) { display: none; }
  .nav button { justify-content: center; padding: 0; position: relative; }
  .nav button .lbl, .side .foot .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav .n { position: absolute; top: 2px; right: 2px; margin: 0; min-width: 18px; height: 17px; padding: 0 4px; font-size: 10.5px; }
  .side .foot { padding: 8px 4px; text-align: center; }
  .side .foot .fw, .side .foot br { display: none; }
  .side .foot button { margin: 4px auto 0; width: 36px; height: 32px; display: grid; place-items: center; border-radius: 8px; }
  .side .foot button:hover { background: rgba(255,255,255,.08); }
  .top { padding: 12px 18px; gap: 10px; }
  .tsearch { width: 200px; }
  .page { padding: 16px 18px 36px; }
  .healthbar { margin: 12px 18px 0; }
  table.t th, table.t td { padding-left: 10px; padding-right: 10px; }
}

/* A 1366×768 laptop leaves the browser about 650px: the menu's eleven pages and the signed-in box
   under them ran past the bottom of the sticky sidebar, and "Sign out" was cut in half with no
   way to scroll to it. The rows tighten on a short screen, and the sidebar scrolls if still needed. */
@media (min-width: 901px) {
  .side { overflow-y: auto; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
}
@media (min-width: 901px) and (max-height: 760px) {
  .nav button { height: 38px; }
  .brand { padding-bottom: 12px; }
  .side .foot { padding: 10px 12px; }
}
