/* ALmond Store — operations console.
   Warm paper surfaces, teal for anything you can act on, almond amber for the brand.
   Built to be read fast on a Mac and used one-handed in the warehouse. */
:root {
  color-scheme: light;
  --page: #f6f5f2; --surface: #ffffff; --sunken: #f1efea;
  --ink: #1a1815; --ink2: #5b5750; --muted: #8c877e;
  --line: #e4e1da; --grid: #eceae4; --axis: #cfccc4; --border: #e4e1da; --hover: rgba(26,24,21,.045);
  --brand: #c0893f;
  --accent: #0f6f62; --accent-ink: #0b544a; --accent-soft: #e6f1ef;
  --s1: #0f6f62; --s2: #c0893f;
  --good: #15803d; --good-text: #15803d; --good-soft: #e8f3ec;
  --warn: #b45309; --warn-text: #b45309; --warn-soft: #fbf0e2;
  --serious: #c2410c; --crit: #b91c1c; --crit-text: #b91c1c; --crit-soft: #fbeaea;
  --r: 10px; --r-lg: 14px;
  --shadow: 0 1px 2px rgba(26,24,21,.05), 0 1px 1px rgba(26,24,21,.03);
  --nav-h: 54px;
  /* page groups in the side menu: one colour each, so you know where you are at a glance */
  --g-today: #2563eb; --g-sell: #15803d; --g-stock: #d9730d; --g-make: #7c3aed; --g-money: #b8860b; --g-set: #6b7280;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) {
    color-scheme: dark;
    --page: #0e0d0c; --surface: #1a1917; --sunken: #232220;
    --ink: #e9e6e0; --ink2: #a8a39a; --muted: #7d7870;
    --line: #35322e; --grid: #292725; --axis: #4a4641; --border: #35322e; --hover: rgba(255,255,255,.05);
    --brand: #d9a35f; --accent: #2f9d89; --accent-ink: #58c9b4; --accent-soft: #14312c;
    --s1: #2b8d7c; --s2: #b8823f;
    --good: #2f9e52; --good-text: #5bc87d; --good-soft: #16281c;
    --warn: #b07a1e; --warn-text: #e0a33c; --warn-soft: #2b2113;
    --crit: #b4393c; --crit-text: #ef7b7b; --crit-soft: #2b1718;
    --shadow: none;
    --g-today: #6c9cff; --g-sell: #4cc47a; --g-stock: #f0a04b; --g-make: #a78bfa; --g-money: #e2b93b; --g-set: #9ca3af;
    --top-bg: #141311; --bar-track: #242220; --card-line: #302d29; --kpi-val: #f0ede7; --tick: #8a857d; --tip-bg: #efece6; --tip-ink: #191715;
    --field-bg: #141312; --btn-bg: #232220; --btn-line: #3d3935; --btn-hover: #2b2927; --on-accent: #06201c; --tabs-bg: #161513; --tb-on: #2e2c29; --focus-bg: #16322d;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e0d0c; --surface: #1a1917; --sunken: #232220;
  --ink: #e9e6e0; --ink2: #a8a39a; --muted: #7d7870;
  --line: #35322e; --grid: #292725; --axis: #4a4641; --border: #35322e; --hover: rgba(255,255,255,.05);
  --brand: #d9a35f; --accent: #2f9d89; --accent-ink: #58c9b4; --accent-soft: #14312c;
  --s1: #2b8d7c; --s2: #b8823f;
  --good: #2f9e52; --good-text: #5bc87d; --good-soft: #16281c;
  --warn: #b07a1e; --warn-text: #e0a33c; --warn-soft: #2b2113;
  --crit: #b4393c; --crit-text: #ef7b7b; --crit-soft: #2b1718;
  --shadow: none;
  --g-today: #6c9cff; --g-sell: #4cc47a; --g-stock: #f0a04b; --g-make: #a78bfa; --g-money: #e2b93b; --g-set: #9ca3af;
  --top-bg: #141311; --bar-track: #242220; --card-line: #302d29; --kpi-val: #f0ede7; --tick: #8a857d; --tip-bg: #efece6; --tip-ink: #191715;
  --field-bg: #141312; --btn-bg: #232220; --btn-line: #3d3935; --btn-hover: #2b2927; --on-accent: #06201c; --tabs-bg: #161513; --tb-on: #2e2c29; --focus-bg: #16322d;
}
/* ---- more themes (Account → Appearance). Light ones only change colours; dark ones also set data-mode="dark" */
:root[data-theme="sand"] {
  --page: #f3ede2; --surface: #fffcf6; --sunken: #ede5d6; --ink: #2a2117; --ink2: #66594a; --muted: #948673;
  --line: #e2d7c4; --grid: #ebe2d3; --axis: #cfc2ab; --border: #e2d7c4; --hover: rgba(80,55,20,.05);
  --brand: #b07332; --accent: #9a5b1e; --accent-ink: #7a4614; --accent-soft: #f6e8d6; --s1: #9a5b1e; --s2: #3f7d6e;
}
:root[data-theme="ocean"] {
  --page: #f2f6f9; --surface: #ffffff; --sunken: #e9f0f5; --ink: #11202b; --ink2: #4a5b68; --muted: #7d8d99;
  --line: #dbe5ec; --grid: #e6edf2; --axis: #c3d0da; --border: #dbe5ec; --hover: rgba(17,32,43,.045);
  --brand: #c0893f; --accent: #1f5fa8; --accent-ink: #174a84; --accent-soft: #e5eef8; --s1: #1f5fa8; --s2: #d08a2e;
}
:root[data-theme="forest"] {
  --page: #f2f5f0; --surface: #ffffff; --sunken: #e8eee4; --ink: #17211a; --ink2: #4f5e52; --muted: #7f8c82;
  --line: #dce5d8; --grid: #e6ece2; --axis: #c5d1c0; --border: #dce5d8; --hover: rgba(23,33,26,.045);
  --brand: #b07a32; --accent: #2f6b2f; --accent-ink: #235223; --accent-soft: #e5f0e3; --s1: #2f6b2f; --s2: #b07a32;
}
:root[data-theme="rose"] {
  --page: #f8f3f4; --surface: #ffffff; --sunken: #f2e9eb; --ink: #2a1a1f; --ink2: #6a5559; --muted: #998589;
  --line: #ecdfe2; --grid: #f1e7e9; --axis: #dac8cc; --border: #ecdfe2; --hover: rgba(42,26,31,.045);
  --brand: #c0893f; --accent: #9c2f55; --accent-ink: #7b2443; --accent-soft: #f7e6ec; --s1: #9c2f55; --s2: #c0893f;
}
:root[data-theme="contrast"] {
  --page: #ffffff; --surface: #ffffff; --sunken: #f0f0f0; --ink: #000000; --ink2: #222222; --muted: #4a4a4a;
  --line: #8a8a8a; --grid: #cfcfcf; --axis: #6f6f6f; --border: #8a8a8a; --hover: rgba(0,0,0,.07);
  --brand: #8a5a12; --accent: #0040a8; --accent-ink: #002f7d; --accent-soft: #e3ecfb; --s1: #0040a8; --s2: #a85a00;
  --good: #0b6b2b; --good-text: #0b6b2b; --warn: #8a4500; --warn-text: #8a4500; --crit: #a50f0f; --crit-text: #a50f0f;
  --shadow: none;
}
:root[data-theme="midnight"] {
  color-scheme: dark;
  --page: #0b1020; --surface: #121a2e; --sunken: #18223a; --ink: #e4e9f5; --ink2: #a2adc4; --muted: #75809a;
  --line: #26314c; --grid: #1d2740; --axis: #3a4766; --border: #26314c; --hover: rgba(255,255,255,.05);
  --brand: #e0a95f; --accent: #4f8cf0; --accent-ink: #8bb3ff; --accent-soft: #172846; --s1: #4f8cf0; --s2: #e0a95f;
  --good: #34a35f; --good-text: #64d18c; --good-soft: #13281e; --warn: #c18a2a; --warn-text: #e8b14f; --warn-soft: #2a2213;
  --crit: #c2474a; --crit-text: #f08585; --crit-soft: #2c1619; --shadow: none;
  --g-today: #7aa7ff; --g-sell: #4cc47a; --g-stock: #f0a04b; --g-make: #a78bfa; --g-money: #e2b93b; --g-set: #9ca3af;
  --top-bg: #0d1426; --bar-track: #1d2740; --card-line: #26314c; --kpi-val: #eef2fb; --tick: #7f8aa3; --tip-bg: #e8edf8; --tip-ink: #0b1020;
  --field-bg: #0d1426; --btn-bg: #1a2440; --btn-line: #33405f; --btn-hover: #222e4f; --on-accent: #061024; --tabs-bg: #0f1729; --tb-on: #24304f; --focus-bg: #18294a;
}
:root[data-theme="graphite"] {
  color-scheme: dark;
  --page: #111214; --surface: #1b1c1f; --sunken: #232428; --ink: #e8e8ea; --ink2: #a7a8ad; --muted: #7b7c82;
  --line: #333438; --grid: #28292d; --axis: #48494e; --border: #333438; --hover: rgba(255,255,255,.05);
  --brand: #d9a35f; --accent: #e08a3c; --accent-ink: #f2ad6d; --accent-soft: #33261a; --s1: #e08a3c; --s2: #6aa6d6;
  --good: #3aa55d; --good-text: #6ccf8c; --good-soft: #17271c; --warn: #c08a2a; --warn-text: #e6b04c; --warn-soft: #2b2314;
  --crit: #c2474a; --crit-text: #f08585; --crit-soft: #2c1619; --shadow: none;
  --g-today: #6c9cff; --g-sell: #4cc47a; --g-stock: #f0a04b; --g-make: #a78bfa; --g-money: #e2b93b; --g-set: #9ca3af;
  --top-bg: #151618; --bar-track: #28292d; --card-line: #333438; --kpi-val: #f2f2f4; --tick: #85868c; --tip-bg: #ececee; --tip-ink: #111214;
  --field-bg: #151618; --btn-bg: #26272b; --btn-line: #3d3e43; --btn-hover: #2e2f34; --on-accent: #1d1206; --tabs-bg: #17181a; --tb-on: #303135; --focus-bg: #3a2a1a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .sub { color: var(--ink2); }
h1 { font-size: 19px; letter-spacing: -.01em; margin: 0 0 4px; }
h2 { font-size: 14px; font-weight: 600; letter-spacing: -.005em; margin: 0; }
.hint { color: var(--ink2); font-size: 12.5px; margin: 2px 0 12px; max-width: 72ch; }
.hint:empty { display: none; }
a { color: var(--accent-ink); }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 4px;
  height: var(--nav-h); padding: 0 16px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
a.brand {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none;
  font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; white-space: nowrap; padding: 4px 8px 4px 4px;
  border-radius: var(--r); margin-right: 6px;
}
a.brand:hover { background: var(--hover); }
.brand .mark { width: 22px; height: 22px; flex: none; }
.brand .eg { color: var(--muted); font-weight: 450; }
.top nav { display: flex; align-items: center; gap: 1px; flex: 1 1 auto; min-width: 0; overflow: hidden; flex-wrap: nowrap; }
.top nav a {
  padding: 6px 10px; border-radius: 8px; color: var(--ink2); text-decoration: none;
  white-space: nowrap; font-size: 13px; font-weight: 500; position: relative;
}
.top nav a:hover { background: var(--hover); color: var(--ink); }
.top nav a.on { color: var(--ink); font-weight: 600; background: var(--hover); }
.top nav a.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px 2px 0 0; }
.top nav a .dot {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; font-size: 10px;
  text-align: center; margin-left: 5px; background: var(--crit); color: #fff; font-weight: 700; padding: 0 4px;
}
.right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
#syncInfo { font-size: 12px; white-space: nowrap; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) 72px max(16px, env(safe-area-inset-left)); }
@media (min-width: 1400px) { .wrap { max-width: 1400px; padding-left: 28px; padding-right: 28px; } }

.more { position: relative; flex: none; }
.top .more > a { padding: 6px 10px; border-radius: 8px; color: var(--ink2); text-decoration: none; white-space: nowrap; font-size: 13px; font-weight: 500; }
.top .more > a:hover { background: var(--hover); color: var(--ink); }
@media (max-width: 760px) { .top .more { display: none; } }
/* phone: the More tab's sheet */
#moreSheet .sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; }
#moreSheet .sheet { position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 61; background: var(--surface);
  border-radius: 16px; padding: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.25); max-height: 70vh; overflow: auto; }
#moreSheet .sheet a { display: block; padding: 13px 14px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 500; }
#moreSheet .sheet a + a { border-top: 1px solid var(--grid); }
#moreSheet .sheet a:active { background: var(--hover); }
.more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: 0 10px 30px rgba(26,24,21,.14); padding: 5px; min-width: 190px; z-index: 40;
}
.more-menu a { display: block; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 13px; }
.more-menu a:hover { background: var(--hover); }

/* ---------------------------------------------------------------- controls */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 16px; }
.controls label { color: var(--ink2); font-size: 12px; display: flex; align-items: center; gap: 6px; }
select, input[type=date], input[type=number], input[type=text], input[type=password], input[type=search], input[type=email], input[type=tel], input[type=url], input[type=time], input[type=month], textarea {
  font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: 6px 9px; min-height: 32px;
}
select { -webkit-appearance: none; appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink2) 50%), linear-gradient(135deg, var(--ink2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: 6px 12px; min-height: 32px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------------------------------------------------------------- cards and numbers */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; min-width: 0; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .g2, .g3 { grid-template-columns: 1fr; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.kpis .card, .kpis .kpi { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 13px 16px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kpi .lab { color: var(--ink2); font-size: 11.5px; font-weight: 500; }
.kpi .val { font-size: 23px; font-weight: 620; letter-spacing: -.02em; margin-top: 3px; line-height: 1.15;
  font-variant-numeric: tabular-nums; }
.kpi .note { color: var(--muted); font-size: 11.5px; margin-top: 3px; min-height: 16px; }
.up { color: var(--good-text); font-weight: 600; } .down { color: var(--crit-text); font-weight: 600; }

.banner { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  border-radius: var(--r); padding: 10px 13px; margin-bottom: 14px; color: var(--ink); font-size: 13px; }
.banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.err { color: var(--crit-text); min-height: 18px; margin-top: 8px; font-size: 13px; }

/* ---------------------------------------------------------------- charts */
.chart { position: relative; } svg { display: block; width: 100%; height: auto; }
.tick { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 10px; font-size: 12px; color: var(--ink2); }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.legend i.dash { border-top-style: dashed; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--page); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.2); display: none; white-space: nowrap; z-index: 50; }
.tip b { display: block; font-weight: 600; }
.bars .row { display: grid; grid-template-columns: minmax(90px, 170px) 1fr 96px; align-items: center; gap: 10px; padding: 5px 0; }
.bars .name { color: var(--ink2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { height: 12px; background: var(--sunken); border-radius: 4px; }
.bars .fill { height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; }
.bars .fill.neg { background: var(--crit); }
.bars .num { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- tables */
.tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tools input[type=search] { min-width: 140px; flex: 0 1 200px; }
.sortby { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink2); }
.sortby select { padding: 5px 28px 5px 8px; font-size: 12.5px; max-width: 190px; }
.dirbtn { font-size: 12px; padding: 5px 10px; }
.bartools { justify-content: flex-end; margin-bottom: 4px; }
.showmore { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 0 2px; border-top: 1px dashed var(--grid); margin-top: 6px; }
.showmore [data-more] { min-width: 140px; }
tr.total td { border-top: 1.5px solid var(--axis); background: var(--sunken); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
thead { background: var(--surface); }
thead th { background: var(--surface); color: var(--ink2); font-weight: 550; font-size: 11.5px;
  letter-spacing: .01em; user-select: none; border-bottom: 1px solid var(--axis); }
/* a long table gets its own scroll box, so the header can stay put while the rows move */
.tall { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.tall thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--axis); }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--ink); }
th:first-child, td:first-child, .l { text-align: left; }
td.num { font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--hover); }
tr.total td { font-weight: 650; border-top: 1px solid var(--axis); background: var(--sunken); }
tr.dim td { opacity: .5; }
tr.warnrow td { background: var(--warn-soft); }

.st { display: inline-flex; align-items: center; gap: 6px; }
.ic { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex: none; }
.alert { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--grid); align-items: flex-start; }
.alert:last-child { border-bottom: 0; } .alert .t { font-weight: 600; } .alert .d { color: var(--ink2); font-size: 12.5px; }
.alert a { margin-left: auto; font-size: 12px; white-space: nowrap; }
pre.brief { white-space: pre-wrap; font: inherit; line-height: 1.75; margin: 0; direction: rtl; text-align: right; }
td input[type=number], td input[type=text] { width: 100%; min-width: 70px; text-align: left; }
td input.missing { border-color: var(--warn); background: var(--warn-soft); }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink2); }
.saved { color: var(--good-text); font-size: 12px; margin-left: 8px; }
details { color: var(--ink2); font-size: 12.5px; margin-top: 10px; } summary { cursor: pointer; padding: 4px 0; }
.empty { color: var(--muted); padding: 16px 0; text-align: center; }
a.skul { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--axis); }
a.skul:hover { border-bottom-style: solid; color: var(--accent-ink); }
ul.plain { margin: 6px 0 0; padding-left: 20px; line-height: 1.8; } ul.plain li { margin: 2px 0; }
textarea { font: inherit; padding: 8px; }

/* spreadsheet-style editing */
.sheet { max-height: 68vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.sheet table { border-collapse: separate; border-spacing: 0; }
.sheet thead th { top: 0; }
.sheet td:first-child, .sheet th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); border-right: 1px solid var(--grid); }
.sheet th:first-child { z-index: 3; }
.sheet td { padding: 0; border-right: 1px solid var(--grid); }
.sheet td:first-child, .sheet td.l { padding: 0 10px; }
.sheet td input[type=text], .sheet td input[type=number], .sheet td select { border: 0; border-radius: 0; background: transparent; height: 36px; padding: 0 10px; width: 100%; }
.sheet td input:focus, .sheet td select:focus { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }
.sheet td input.missing { background: var(--warn-soft); }
.sheet td input[type=checkbox] { margin: 0 12px; }
.sheet td:nth-child(2) input { text-align: right; font-variant-numeric: tabular-nums; }
.ptools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ptools label { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink2); }

/* tabs inside a page */
.tabs { display: inline-flex; gap: 2px; flex-wrap: wrap; max-width: 100%; background: var(--sunken); padding: 3px; border-radius: var(--r); border: 0; }
.tb { padding: 6px 12px; border-radius: 7px; color: var(--ink2); text-decoration: none; font-size: 13px; font-weight: 500; }
.tb:hover { color: var(--ink); } .tb.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- toasts */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 200;
  max-width: 100vw; padding: 0 12px;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--page);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: 0 8px 28px rgba(0,0,0,.26);
  animation: toastin .18s cubic-bezier(.2,.8,.2,1); max-width: min(92vw, 460px); }
.toast.bad { background: var(--crit); color: #fff; }
.toast.good { background: var(--good); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; padding: 0; flex: none; }
.toast span { white-space: pre-wrap; }
.toast.stay { align-items: flex-start; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; color: var(--ink2); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes toastin { from { transform: translateY(10px); opacity: 0 } }

.skel { background: linear-gradient(90deg, var(--sunken) 25%, var(--hover) 37%, var(--sunken) 63%);
  background-size: 400% 100%; animation: sh 1.3s ease infinite; border-radius: 6px; height: 13px; }
@keyframes sh { from { background-position: 100% 0 } to { background-position: 0 0 } }

.login { min-height: 100svh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 22px; }

/* ---------------------------------------------------------------- phone */
.tabbar { display: none; }
@media (max-width: 760px) {
  .wrap { padding: 14px 14px calc(78px + env(safe-area-inset-bottom)); }
  .top nav { display: none; }
  .top { height: 52px; }
  #syncInfo { display: none; }
  .top .right .btn { padding: 6px 9px; }
  .top .right .btn .lbl { display: none; }
  .brand .eg { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .card, .kpis .kpi { padding: 11px 13px; }
  .kpi .val { font-size: 19px; } .kpi .note { font-size: 11px; min-height: 0; }
  .card { padding: 14px; border-radius: 12px; }
  h2 { font-size: 15px; }

  table.auto, table.auto tbody, table.auto tr, table.auto td { display: block; width: auto; }
  table.auto thead { display: none; }
  table.auto tr { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; background: var(--surface); }
  table.auto tr:hover td { background: transparent; }
  table.auto td { border: 0; padding: 3px 0; text-align: left !important; white-space: normal;
    display: grid; grid-template-columns: 44% 1fr; gap: 10px; align-items: baseline; }
  table.auto td::before { content: attr(data-label); color: var(--muted); font-size: 11.5px; }
  table.auto td:first-child { font-weight: 600; font-size: 14.5px; border-bottom: 1px solid var(--grid);
    padding-bottom: 7px; margin-bottom: 5px; grid-template-columns: 1fr; }
  table.auto td:first-child::before { display: none; }
  table.auto tr.total { background: var(--sunken); }
  .scroll:has(> table.auto) { overflow-x: visible; }
  .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tb { white-space: nowrap; }

  #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }   /* clear of the bar at the bottom */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative;
    color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 500; padding: 3px 0; border-radius: 8px; }
  .tabbar a.on { color: var(--accent); }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .dot { position: absolute; top: 0; left: 50%; margin-left: 4px; background: var(--crit); color: #fff;
    border-radius: 9px; font-size: 9px; font-weight: 700; padding: 1px 5px; }
}
@media (max-width: 1150px) { #syncInfo { display: none; } }   /* the pages need that space more */
@media (min-width: 761px) and (max-width: 1100px) {
  th, td { padding: 10px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (hover: none) {
  .btn { min-height: 38px; } input, select { min-height: 38px; }
  .tb { padding: 8px 14px; }
}

/* ---------------------------------------------------------------- date picker */
.dp-btn { min-width: 150px; text-align: left; font-variant-numeric: tabular-nums; } .dp-btn.empty { color: var(--muted); }
.dp-ov { position: fixed; inset: 0; z-index: 100; background: rgba(26,24,21,.4); display: flex; align-items: flex-end; justify-content: center; animation: ovin .15s ease-out; }
.dp-ov.top { align-items: flex-start; padding-top: 12vh; }
.dp { width: min(420px, 100%); background: var(--surface); border-radius: 18px 18px 0 0; padding: 14px 16px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2); animation: dpin .22s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 600px) { .dp-ov { align-items: center; } .dp { border-radius: 18px; padding-bottom: 22px; } }
.dp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dp-top b { font-size: 14px; text-align: center; flex: 1; }
.dp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { font: inherit; font-size: 12px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink2); cursor: pointer; }
.chip:hover { background: var(--hover); color: var(--ink); }
.dp-wheels { position: relative; display: grid; grid-template-columns: 1fr 1.7fr 1.2fr; gap: 4px; height: 200px; }
.dp-band { position: absolute; left: 0; right: 0; top: 80px; height: 40px; background: var(--accent-soft); border-radius: 10px; pointer-events: none; }
.wheel { position: relative; height: 200px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; outline: none; overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.wheel::-webkit-scrollbar { display: none; }
.wpad { height: 80px; } .wi { height: 40px; line-height: 40px; text-align: center; scroll-snap-align: center; font-size: 18px; color: var(--muted); font-variant-numeric: tabular-nums; user-select: none; }
.wi.sel { color: var(--ink); font-weight: 600; } .wi.off { opacity: .3; }
.wheel:focus-visible { outline: 2px solid var(--accent); border-radius: 10px; }
@keyframes dpin { from { transform: translateY(24px); opacity: .6 } } @keyframes ovin { from { opacity: 0 } }

/* quick search */
.pal { width: min(560px, calc(100% - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 56px rgba(0,0,0,.26); overflow: hidden; align-self: flex-start; }
.pal input { width: 100%; border: 0; border-bottom: 1px solid var(--grid); border-radius: 0; padding: 14px 16px; font-size: 16px; background: transparent; outline: none; }
.pal-r { max-height: 50vh; overflow: auto; padding: 6px; }
.pal-g { font-size: 11.5px; color: var(--muted); padding: 8px 10px 4px; }
.pal-i { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.pal-i span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.pal-i.on, .pal-i:hover { background: var(--accent-soft); }

/* pick list */
.room { padding: 16px; } .roomh { font-size: 16px; margin: 0 0 12px; display: flex; gap: 10px; align-items: baseline; }
.wall { margin-bottom: 16px; }
.wallh { font-size: 12.5px; font-weight: 600; color: var(--ink2); border-bottom: 1px solid var(--grid); padding-bottom: 5px; margin-bottom: 7px; display: flex; gap: 8px; align-items: baseline; }
.place { padding: 7px 0 9px; } .placeh { font-size: 13px; margin-bottom: 3px; }
table.picks { width: 100%; } table.picks td { border-bottom: 0; padding: 4px 6px; }
table.picks input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }

@media print {
  .top, .tabbar, .controls, .tools, .btn, a.btn, .kpis { display: none !important; }
  body { background: #fff; } .card { break-inside: avoid; border: 0; padding: 0 0 10px; box-shadow: none; }
  .room { break-before: page; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* arabic / right-to-left */
[dir=rtl] body { font-family: -apple-system, system-ui, "SF Arabic", "Segoe UI", Tahoma, Arial, sans-serif; }
[dir=rtl] svg, [dir=rtl] .chart, [dir=rtl] .bars .track, [dir=rtl] .dp-wheels { direction: ltr; }
[dir=rtl] .right { margin-left: 0; margin-right: auto; }
[dir=rtl] a.brand { margin-right: 0; margin-left: 6px; }
[dir=rtl] th, [dir=rtl] td { text-align: right; }
[dir=rtl] td.num, [dir=rtl] th.num { text-align: left; direction: ltr; }
[dir=rtl] .top nav a .dot { margin-left: 0; margin-right: 5px; }
[dir=rtl] ul.plain { padding-left: 0; padding-right: 20px; }
[dir=rtl] .dp-btn { text-align: right; }
[dir=rtl] .sheet td:first-child, [dir=rtl] .sheet th:first-child { left: auto; right: 0; border-right: 0; border-left: 1px solid var(--grid); }
[dir=rtl] table.auto td { text-align: right !important; }
[dir=rtl] .alert a { margin-left: 0; margin-right: auto; }
[dir=rtl] .hint, [dir=rtl] .note, [dir=rtl] .banner, [dir=rtl] .alert .t, [dir=rtl] .alert .d,
[dir=rtl] .empty, [dir=rtl] li, [dir=rtl] .muted, [dir=rtl] summary { unicode-bidi: plaintext; }

/* dark mode is read in a dim room: softer text, borders instead of shadows, calmer colour */
/* dark themes: the same rules for every dark palette (the colours come from the palette) */
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) .card, :root:not([data-mode]) .kpis { box-shadow: none; }
  :root:not([data-mode]) .top { background: var(--top-bg); }
  :root:not([data-mode]) .bars .track { background: var(--bar-track); }
  :root:not([data-mode]) .bars .fill { background: var(--s1); }
  :root:not([data-mode]) .card { border-color: var(--card-line); }
  :root:not([data-mode]) .kpi .val { color: var(--kpi-val); }
  :root:not([data-mode]) .tick { fill: var(--tick); }
  :root:not([data-mode]) .tip, :root:not([data-mode]) .toast { background: var(--tip-bg); color: var(--tip-ink); }
  :root:not([data-mode]) input, :root:not([data-mode]) select, :root:not([data-mode]) textarea { background: var(--field-bg); }
  :root:not([data-mode]) .btn { background: var(--btn-bg); border-color: var(--btn-line); }
  :root:not([data-mode]) .btn:hover { background: var(--btn-hover); }
  :root:not([data-mode]) .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
  :root:not([data-mode]) .btn.primary:hover { background: var(--accent-ink); }
  :root:not([data-mode]) .tabs { background: var(--tabs-bg); }
  :root:not([data-mode]) .tb.on { background: var(--tb-on); }
  :root:not([data-mode]) .sheet td input:focus, :root:not([data-mode]) .sheet td select:focus { background: var(--focus-bg); }
}
:root[data-mode="dark"] .card, :root[data-mode="dark"] .kpis { box-shadow: none; }
:root[data-mode="dark"] .top { background: var(--top-bg); }
:root[data-mode="dark"] .bars .track { background: var(--bar-track); }
:root[data-mode="dark"] .bars .fill { background: var(--s1); }
:root[data-mode="dark"] .card { border-color: var(--card-line); }
:root[data-mode="dark"] .kpi .val { color: var(--kpi-val); }
:root[data-mode="dark"] .tick { fill: var(--tick); }
:root[data-mode="dark"] .tip, :root[data-mode="dark"] .toast { background: var(--tip-bg); color: var(--tip-ink); }
:root[data-mode="dark"] input, :root[data-mode="dark"] select, :root[data-mode="dark"] textarea { background: var(--field-bg); }
:root[data-mode="dark"] .btn { background: var(--btn-bg); border-color: var(--btn-line); }
:root[data-mode="dark"] .btn:hover { background: var(--btn-hover); }
:root[data-mode="dark"] .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
:root[data-mode="dark"] .btn.primary:hover { background: var(--accent-ink); }
:root[data-mode="dark"] .tabs { background: var(--tabs-bg); }
:root[data-mode="dark"] .tb.on { background: var(--tb-on); }
:root[data-mode="dark"] .sheet td input:focus, :root[data-mode="dark"] .sheet td select:focus { background: var(--focus-bg); }

.login .card label { gap: 5px; color: var(--ink2); }
.login .card input { font-size: 15px; }
.login h1 { margin-bottom: 0; }
.login .sub { margin: 0 0 6px; font-size: 13px; }
.login code { background: var(--sunken); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.who { display: flex; align-items: center; gap: 8px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 650; flex: none; }
.rolechip { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--sunken); color: var(--ink2); }

.loginbox { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login .card { width: 100%; gap: 6px; }
.login .card label { margin-top: 6px; font-weight: 500; }
.login .card input { font-size: 16px; }      /* 16px keeps iOS from zooming the page */
.login .card .btn.primary { margin-top: 14px; justify-content: center; }
.btn.link { background: none; border: 0; color: var(--accent-ink); padding: 6px; min-height: 0; justify-content: center; font-size: 12.5px; }
.btn.link:hover { background: none; text-decoration: underline; }
#httpNote { text-align: center; line-height: 1.6; }

/* camera scanner */
.withcam { display: flex; gap: 6px; } .withcam input { flex: 1; min-width: 0; }
.cambtn { flex: none; padding: 6px 10px; }
.cam-ov { position: fixed; inset: 0; z-index: 300; background: #000; display: flex; }
.cam { display: flex; flex-direction: column; width: 100%; height: 100%; color: #fff; }
.cam-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
.cam-top b { flex: 1; font-size: 15px; } .cam-count { font-size: 13px; color: #9fe3d6; font-weight: 600; }
.cam-top .btn { background: #262422; border-color: #3d3935; color: #fff; }
.cam-top .btn.primary { background: var(--accent); border-color: var(--accent); }
.cam-view { position: relative; flex: 1; overflow: hidden; }
.cam-view video { width: 100%; height: 100%; object-fit: cover; }
.cam-frame { position: absolute; left: 10%; right: 10%; top: 20%; bottom: 20%; border: 2px solid rgba(255,255,255,.85);
  border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.cam-flash { position: absolute; inset: 0; background: #3fbfa8; opacity: 0; pointer-events: none; }
.cam-flash.on { animation: camflash .35s ease-out; }
@keyframes camflash { from { opacity: .45 } to { opacity: 0 } }
.cam-msg { text-align: center; padding: 10px 14px 4px; font-size: 13px; color: #d8d4cc; }
.cam-last { text-align: center; padding: 0 14px calc(14px + env(safe-area-inset-bottom)); font: 600 16px/1.4 ui-monospace, Menlo, monospace; min-height: 24px; color: #fff; }

/* shelf labels */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.label { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "qr text" "bar bar"; align-items: center; gap: 8px 12px; border: 1px dashed var(--axis); border-radius: 10px; padding: 10px; background: #fff; color: #111; break-inside: avoid; }
.label .qr { grid-area: qr; width: 96px; height: 96px; flex: none; }
.label .qr svg { display: block; width: 100%; height: 100%; }
.label .bar { grid-area: bar; height: 44px; }
.label .bar svg { display: block; width: 100%; height: 100%; }
.ltext { grid-area: text; display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.ltext b { font-size: 19px; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.ltext span { font-size: 12px; color: #555; }
@media print {
  .noprint { display: none !important; }
  .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .label { border: 1px dashed #999; padding: 3mm; }
  .label .qr { width: 24mm !important; height: 24mm !important; }
  .label .bar { height: 12mm; }
  .ltext b { font-size: 13pt; white-space: nowrap; }
}

/* icons inside buttons keep their own size; the global svg rule is for charts */
.btn svg { width: auto; height: auto; flex: none; display: block; }
.top .right { flex: none; }
@media (max-width: 760px) {
  #logoutBtn { display: none; }          /* sign out lives on the account page on a phone */
  .top .right { gap: 5px; }
}

/* sales by governorate: tile map + table */
.geo-wrap { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 18px; align-items: start; }
.gtiles { display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 46px; gap: 4px; }
.gtile { border: 1px solid var(--grid); border-radius: 7px; padding: 4px 5px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--sunken); overflow: hidden; color: var(--ink); }
.gtile b { font-size: 9.5px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.gtile span { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); }
.gtile.dark, .gtile.dark span { color: #fff; }
@media (max-width: 760px) { .geo-wrap { grid-template-columns: 1fr; } .gtiles { max-width: 360px; } }

/* size runs: one chip per size, red where a selling size is empty */
.runs { display: grid; gap: 10px; }
.run { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--surface); }
.run-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.run-s { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sz { display: inline-flex; flex-direction: column; align-items: center; min-width: 40px; padding: 4px 6px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.sz i { font-style: normal; font-weight: 400; font-size: 11px; opacity: .8; }
.sz.hole { background: var(--crit-soft); color: var(--crit-text); outline: 1.5px solid var(--crit); }
.sz.empty { background: var(--sunken); color: var(--muted); }
.bad { color: var(--crit-text); font-weight: 600; }
.toast.bad { color: #fff; }

.cyc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 12px; }
.btn.cyc { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; height: auto; padding: 10px 12px; text-align: start; }
.warn-t { color: var(--warn-text); }

/* pick list: the confirm bar stays at the bottom of the screen while you walk */
.pickbar { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
@media (max-width: 760px) { .pickbar { bottom: 74px; } }
@media print { .pickbar { display: none; } }

/* FBA shipment wizard */
.fsteps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.fsteps li { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-size: 13px; }
.fsteps li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); font-weight: 600; font-size: 12px; }
.fsteps li.done { color: var(--accent-ink); background: var(--accent-soft); }
.fsteps li.now { color: #fff; background: var(--accent); }
.fsteps li.now span { color: var(--accent); }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); margin-top: 8px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.fgroup { border-top: 1px solid var(--grid); padding-top: 10px; margin-top: 10px; }
.fgroup:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
table.boxgrid td, table.boxgrid th { white-space: nowrap; }
table.picks { width: 100%; }
table.picks td { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 760px) { table.picks td { padding-left: 4px; padding-right: 4px; } }

/* production board */
.prod { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-top: 10px; background: var(--surface); }
.prod.late { border-color: var(--crit); }
.prod-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.fsteps li small { opacity: .75; font-size: 11px; }

.updbar { margin: 10px auto; max-width: 1200px; display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }

.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.codes code { font-size: 17px; padding: 8px 10px; background: var(--sunken); border-radius: 8px; text-align: center; letter-spacing: .05em; }
.waytag { display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.waytag.fba { background: color-mix(in srgb, var(--s1) 16%, transparent); color: var(--s1); }
.waytag.es { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--ink); }
.seg { display: inline-flex; gap: 6px; }
.trackbar .tb-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.trackbar .track { height: 10px; background: var(--sunken); border-radius: 5px; overflow: hidden; }
.trackbar .fill { height: 100%; background: var(--good); border-radius: 5px; min-width: 2px; }

/* ---------------------------------------------------------------- side menu */
.g-today { --g: var(--g-today); } .g-sell { --g: var(--g-sell); } .g-stock { --g: var(--g-stock); }
.g-make { --g: var(--g-make); } .g-money { --g: var(--g-money); } .g-set { --g: var(--g-set); }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; border: 0;
  background: transparent; color: var(--ink2); cursor: pointer; font: inherit; flex: none; position: relative; }
.iconbtn:hover { background: var(--hover); color: var(--ink); }
.menubtn { display: inline-flex; margin-right: 2px; }          /* always there: it also switches the menu style back */
.menubtn[data-n]:not([data-n=""])::after { content: attr(data-n); position: absolute; top: 2px; right: 0; min-width: 15px; height: 15px; line-height: 15px;
  border-radius: 8px; background: var(--crit); color: #fff; font-size: 9.5px; font-weight: 700; padding: 0 3px; text-align: center; }
body.sidemenu .top nav, body.sidemenu .top .more { display: none !important; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: 300px; max-width: 86vw; z-index: 70; background: var(--surface);
  border-right: 1px solid var(--line); box-shadow: 8px 0 40px rgba(0,0,0,.18); transform: translateX(-104%); transition: transform .2s ease;
  display: flex; flex-direction: column; visibility: hidden; }
[dir=rtl] .drawer { left: auto; right: 0; border-right: 0; border-left: 1px solid var(--line); transform: translateX(104%); box-shadow: -8px 0 40px rgba(0,0,0,.18); }
body.dr-open .drawer, body.dr-pinned .drawer { transform: none; visibility: visible; }
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 69; }
body.dr-pinned .drawer { top: var(--nav-h); box-shadow: none; z-index: 20; width: 270px; }
body.dr-pinned .wrap { margin-left: 270px; max-width: none; padding-left: 24px; padding-right: 24px; }
[dir=rtl] body.dr-pinned .wrap { margin-left: 0; margin-right: 270px; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.dr-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px 16px; border-bottom: 1px solid var(--grid); }
.dr-tools { display: flex; align-items: center; gap: 4px; }
.dr-body { overflow-y: auto; padding: 6px 8px 12px; flex: 1; }
.dr-group { margin-top: 10px; }
.dr-gname { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--g); padding: 4px 8px; }
.dr-gname i { width: 10px; height: 10px; border-radius: 3px; background: var(--g); display: inline-block; }
.dr-item { display: block; padding: 7px 10px 8px 26px; border-radius: 9px; text-decoration: none; color: var(--ink); position: relative; }
[dir=rtl] .dr-item { padding: 7px 26px 8px 10px; }
.dr-item:hover { background: var(--hover); }
.dr-item.on { background: color-mix(in srgb, var(--g) 13%, transparent); }
.dr-item.on::before { content: ""; position: absolute; left: 10px; top: 10px; bottom: 10px; width: 4px; border-radius: 2px; background: var(--g); }
[dir=rtl] .dr-item.on::before { left: auto; right: 10px; }
.dr-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.dr-desc { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 1px; }
.dr-badge { font-size: 10.5px; font-weight: 700; color: #fff; background: var(--warn); border-radius: 9px; padding: 0 6px; line-height: 17px; }
.dr-badge.critical { background: var(--crit); }
.dr-foot { border-top: 1px solid var(--grid); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dr-foot .btn { padding: 5px 10px; font-size: 12.5px; }
/* the page you are on: its name, in its group's colour */
.ph { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 2px 0 8px; border-bottom: 2px solid color-mix(in srgb, var(--g) 35%, transparent); }
.ph i { width: 11px; height: 11px; border-radius: 3px; background: var(--g); align-self: center; }
.ph b { font-size: 18px; letter-spacing: -.01em; color: var(--ink); }
.ph span { color: var(--muted); font-size: 13px; }
body[data-group] .card > h2 { position: relative; }
body[data-group="today"] { --g: var(--g-today); } body[data-group="sell"] { --g: var(--g-sell); } body[data-group="stock"] { --g: var(--g-stock); }
body[data-group="make"] { --g: var(--g-make); } body[data-group="money"] { --g: var(--g-money); } body[data-group="set"] { --g: var(--g-set); }
body[data-group] #page .card > h2::before { content: ""; display: inline-block; width: 4px; height: 13px; border-radius: 2px; background: var(--g); margin-right: 8px; vertical-align: -1px; }
[dir=rtl] body[data-group] #page .card > h2::before { margin-right: 0; margin-left: 8px; }
td.wrapl { white-space: normal; min-width: 150px; }
.sub3 { font-size: 13px; font-weight: 650; margin: 16px 0 6px; }
.kindgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
.kind { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 4px 0; }
.kind input { margin-top: 3px; }

/* ---------------------------------------------------------------- logo and reports */
.brand img.brandlogo { height: 26px; max-width: 120px; object-fit: contain; flex: none; }
.logoprev { width: 160px; height: 70px; border: 1px dashed var(--axis); border-radius: 10px; display: grid; place-items: center; padding: 6px; background: var(--sunken); }
.logoprev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.rtile { text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
[dir=rtl] .rtile { text-align: right; }
.rtile b { display: block; font-size: 13.5px; }
.rtile span { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.rtile:hover { border-color: var(--axis); }
.rtile.on { border-color: var(--g, var(--accent)); box-shadow: inset 0 0 0 1px var(--g, var(--accent)); background: color-mix(in srgb, var(--g, var(--accent)) 7%, var(--surface)); }
.rfilters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 12.5px; color: var(--ink2); }
.rfilters label { display: inline-flex; gap: 6px; align-items: center; }
.rfilters select { padding: 5px 28px 5px 8px; font-size: 12.5px; }
.rfilters .rf { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.rfilters .rf input { width: 130px; padding: 5px 8px; font-size: 12.5px; }
.rnotes { margin-top: 10px; font-size: 12.5px; color: var(--ink2); }
#printArea { display: none; }
@media print {
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; color: #000; font: 10pt/1.4 -apple-system, "Helvetica Neue", Arial, sans-serif; }
  #printArea .phead { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
  #printArea .plogo { height: 46px; max-width: 160px; object-fit: contain; }
  #printArea .pstore { font-size: 9pt; color: #555; } #printArea h1 { font-size: 16pt; margin: 0; } #printArea .pmeta { font-size: 9pt; color: #555; }
  #printArea table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  #printArea th { text-align: right; border-bottom: 1px solid #000; padding: 4px 5px; } #printArea th:first-child { text-align: left; }
  #printArea td { padding: 3px 5px; border-bottom: 0.5px solid #ccc; text-align: right; white-space: nowrap; } #printArea td.l { text-align: left; }
  #printArea tr.total td { border-top: 1.5px solid #000; font-weight: 700; }
  #printArea a { color: #000; text-decoration: none; } #printArea .pnotes { font-size: 8pt; color: #444; margin-top: 10px; }
  @page { margin: 12mm; }
}

/* ---------------------------------------------------------------- thermal labels (sizes in mm, black on white) */
.tlbl { background: #fff; color: #000; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden;
  font-family: "Helvetica Neue", Arial, sans-serif; outline: 1px dashed #bbb; }
.lb-top { display: flex; gap: 1mm; flex: 1; min-height: 0; align-items: center; }
.lb-top.qrleft { flex-direction: row-reverse; }
.lb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: .3mm; }
.lb-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.lb-logo { max-height: 6mm; max-width: 24mm; object-fit: contain; align-self: flex-start; margin-bottom: .5mm; }
.lb-qr { flex: none; } .lb-qr svg, .lb-bar svg { width: 100%; height: 100%; display: block; }
.lb-bar { margin: .5mm auto 0; flex: none; }
.lb-err { font-size: 6pt; color: #b00; }
.lbprev { overflow: auto; padding: 4px; background: repeating-conic-gradient(var(--sunken) 0% 25%, transparent 0% 50%) 50% / 16px 16px; border-radius: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip.small { font-size: 11.5px; padding: 3px 9px; }
.lnrow { grid-template-columns: 3fr 1fr auto; }
label.chk { display: inline-flex; gap: 6px; align-items: center; flex-direction: row; }
@media print { body.printing #printArea .tlbl { outline: 0; } }
@media (max-width: 760px) {
  .menubtn { display: inline-flex; width: 40px; height: 40px; }   /* on a phone too: the ☰ at the top left opens every page */
  .brand img.brandlogo { max-width: 70px; height: 22px; }
}
.ftiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.ftile h2 { margin-bottom: 2px; } .upl { cursor: pointer; }
.banner.info { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.btn.small { padding: 3px 9px; font-size: 12px; }
.seclist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.seclist li { display: flex; gap: 10px; align-items: flex-start; }
.seclist li > span { width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; color: #fff; flex: none; margin-top: 1px; }
.seclist li.ok > span { background: var(--good); } .seclist li.bad > span { background: var(--crit); } .seclist li.minor > span { background: var(--warn); }

/* ---------------------------------------------------------------- iPhone + MacBook polish */
html { -webkit-tap-highlight-color: transparent; }
button, .btn, a, select, label, .chip, .tb { touch-action: manipulation; }   /* no 300ms double-tap wait */
.top { padding-top: env(safe-area-inset-top); height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.drawer { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
body.dr-pinned .drawer { padding-top: 0; }
/* 8 numbers fit as two rows of four, not seven and one on its own */
@media (min-width: 761px) { .kpis:has(> :nth-child(8):last-child) { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 761px) { .kpis:has(> :nth-child(6):last-child) { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }

/* phone (iPhone 12 Pro Max is 428 wide) */
@media (max-width: 760px) {
  /* 16px stops Safari from zooming in when you tap a box */
  select, input, textarea, .sortby select { font-size: 16px !important; }
  .top { height: calc(52px + env(safe-area-inset-top)); }
  .wrap { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .btn { min-height: 40px; padding: 8px 13px; font-size: 14px; }
  .dirbtn, .btn.small { min-height: 36px; }
  .controls { gap: 8px; }
  .controls > label, .controls > select { flex: 1 1 auto; }
  .tools { flex-wrap: wrap; gap: 8px; }
  .tools input[type=search] { flex: 1 1 100%; min-width: 0; }
  .sortby { flex: 1 1 auto; } .sortby select { flex: 1; max-width: none; }
  .hint { font-size: 13px; }
  .kpi .lab { font-size: 12px; } .kpi .note { font-size: 11.5px; }
  .bars .row { grid-template-columns: minmax(80px, 38%) 1fr auto; gap: 8px; }
  .bars .name, .bars .num { font-size: 12.5px; }
  th, td { padding: 10px 8px; }
  thead th { font-size: 12px; }
  .showmore [data-more] { min-width: 0; flex: 1 1 auto; }
  .tabbar a { font-size: 11px; min-height: 44px; justify-content: center; }
  .tabbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .sheet { max-height: 62vh; }
  .form { grid-template-columns: 1fr; }
  .alert { gap: 8px; }
  #pagehead { flex-wrap: wrap; }
}
/* phone turned sideways: the notch sits on one side */
@media (max-width: 960px) and (orientation: landscape) and (hover: none) {
  .wrap { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
}
.form > *, .form label { min-width: 0; }
.form select, .form input { width: 100%; max-width: 100%; }
select { max-width: 100%; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- report theme */
.rsum { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 2px 0 12px;
  background: color-mix(in srgb, var(--g, var(--accent)) 5%, var(--surface)); }
.rsum > div { padding: 9px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rsum span { display: block; font-size: 11.5px; color: var(--ink2); } .rsum b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rchart { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 6px; margin-bottom: 12px; }
.rchart-t { margin-bottom: 6px; }
@media (max-width: 760px) { .rsum { grid-template-columns: 1fr 1fr; } .rsum b { font-size: 15.5px; } }
@media print {
  #printArea .rsum { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid #000; border-radius: 0; background: #fff; margin: 0 0 8px; }
  #printArea .rsum > div { border-right: 0.5px solid #999; border-bottom: 0; padding: 4px 6px; }
  #printArea .rsum span { color: #444; font-size: 7.5pt; } #printArea .rsum b { font-size: 11pt; }
  #printArea .pchart { margin: 0 0 8px; break-inside: avoid; } #printArea .pchart svg { max-height: 150px; width: 100%; }
  #printArea .pchart .bars .row { padding: 1px 0; } #printArea .pchart .track { background: #eee; }
  #printArea .pchart .fill, #printArea .pchart .bar { background: #333 !important; fill: #333; }
  #printArea thead { display: table-header-group; } #printArea tr { break-inside: avoid; }
  #printArea tbody tr:nth-child(even) td { background: #f4f4f4; }
  #printArea .pfoot { margin-top: 8px; font-size: 7.5pt; color: #666; border-top: 0.5px solid #999; padding-top: 4px; }
}

.paybox { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--grid); }
.sub3 { font-size: 13.5px; font-weight: 650; margin: 0; }
.phase-v b { font-size: 15px; } .phase-v div { margin-top: 3px; color: var(--ink2); }

/* sales → profit steps */
.wfall { margin-top: 12px; display: grid; gap: 4px; }
.wrow { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 110px; gap: 10px; align-items: center; font-size: 12.5px; }
.wrow span { color: var(--ink2); } .wrow b { text-align: right; font-variant-numeric: tabular-nums; }
.wtrack { height: 12px; background: var(--sunken); border-radius: 6px; overflow: hidden; }
.wtrack i { display: block; height: 100%; border-radius: 6px; } .wtrack i.pos { background: var(--s1); } .wtrack i.neg { background: var(--crit); opacity: .75; } .wtrack i.tot { background: var(--good); }
.wtot { border-top: 1px solid var(--grid); padding-top: 6px; margin-top: 2px; } .wtot span { color: var(--ink); font-weight: 650; }
@media (max-width: 760px) { .wrow { grid-template-columns: 96px 1fr 92px; gap: 6px; font-size: 12px; } }
[dir=rtl] .wrow b { text-align: left; }

/* phone: no bar at the bottom; everything is in the ☰ menu at the top left */
@media (max-width: 760px) {
  .tabbar { display: none !important; }
  .wrap { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  #toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }
  #moreSheet .sheet { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .pickbar { bottom: calc(10px + env(safe-area-inset-bottom)); }
  .top .brand { margin-right: 0; }
  .drawer { width: 320px; max-width: 88vw; }
  .dr-item { padding-top: 9px; padding-bottom: 9px; }
}
@media (max-width: 760px) {
  .brand img.brandlogo + svg + span, .brand:has(img.brandlogo) > span:first-of-type { display: none; }   /* the logo says it already */
  .top { gap: 2px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .top .right { gap: 4px; }
}
@media (max-width: 380px) { .brand > span:first-of-type { display: none; } }

/* new listing form */
.nlc { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.nlimgs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.nlimg { position: relative; width: 74px; height: 74px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.nlimg img { width: 100%; height: 100%; object-fit: contain; } .nlimg button { position: absolute; top: 2px; right: 2px; min-height: 0; padding: 0 5px; }
.nlimg b { position: absolute; left: 2px; bottom: 2px; font-size: 10px; background: var(--accent); color: #fff; border-radius: 4px; padding: 0 4px; }
.wrapl { white-space: normal; min-width: 220px; }

.askrow { display: flex; gap: 8px; } .askrow input { flex: 1; min-width: 0; }
.askans { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--sunken); line-height: 1.7; }

/* free-placement labels */
.tlbl { position: relative; display: block; padding: 0; }
.lp { position: absolute; box-sizing: border-box; overflow: hidden; }
.lp-t { white-space: pre-wrap; overflow: hidden; line-height: 1.12; word-break: break-word; }
.lp-bar { display: flex; flex-direction: column; justify-content: flex-start; } .lp-bar svg, .lp-qr svg { width: 100%; height: 100%; display: block; }
.lp-hr { text-align: center; line-height: 1; font-family: ui-monospace, Menlo, monospace; }
.lp-logo img { width: 100%; height: 100%; object-fit: contain; object-position: left center; display: block; }
.lp-rule { background: #000; } .lp-box { border: 0.3mm solid #000; }
.lbd-paper { position: relative; background: repeating-conic-gradient(var(--sunken) 0% 25%, transparent 0% 50%) 50% / 16px 16px; margin: 6px 0; }
.lbd-scale { transform-origin: top left; }
.lbd-canvas { overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); touch-action: none; max-height: 70vh; }
.lbd-canvas .tlbl { outline: 1px dashed #888; background: #fff; background-image: radial-gradient(#d8d8d8 0.12mm, transparent 0.13mm); background-size: 1mm 1mm; }
.lbd-canvas .lp { cursor: move; outline: 0.15mm dashed rgba(0,0,0,.18); }
.lbd-canvas .lp.sel { outline: 0.25mm solid var(--accent); z-index: 5; overflow: visible; }
.lp-h { position: absolute; right: -1.2mm; bottom: -1.2mm; width: 2.4mm; height: 2.4mm; background: var(--accent); border: 0.3mm solid #fff; border-radius: 0.5mm; cursor: nwse-resize; }
.lbd-tools { display: grid; gap: 8px; } .lbd-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lbd-props { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.lbd-ph { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; } .lbd-ph b { margin-inline-end: 6px; }
.form label.wide { grid-column: 1 / -1; }
@media print { body.printing #printArea .lp { outline: 0 !important; } body.printing #printArea .lp-h { display: none; } }

/* ---------------------------------------------------------------- printing: only the page, full width, no app chrome */
.printonly { display: none; }
@media print {
  .drawer, .drawer-bg, #drawerBg, .menubtn, #toasts, .tabbar, #moreSheet, .pickbar, #pagehead .ph-tools, .controls, .askrow, #askBox, #retAI { display: none !important; }
  body.dr-pinned .wrap, .wrap { margin: 0 !important; max-width: none !important; padding: 0 !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .card { box-shadow: none !important; border: 0 !important; background: #fff !important; }
  a { color: #000; text-decoration: none; }
  .printonly { display: block !important; }
  .phdr { border-bottom: 1.5px solid #000; padding-bottom: 4px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 10px; }
  .scroll, .tall, .sheet { max-height: none !important; overflow: visible !important; }
  table.auto thead { display: table-header-group !important; }
  tr { break-inside: avoid; }
  @page { margin: 10mm; }
}

@media print {
  #printArea .pchart .bars .row { display: grid; grid-template-columns: 42mm 1fr 24mm; gap: 3mm; align-items: center; font-size: 8pt; }
  #printArea .pchart .bars .track { height: 3mm; background: #eee; border-radius: 1mm; overflow: hidden; }
  #printArea .pchart .bars .track i, #printArea .pchart .bars .fill { display: block; height: 100%; background: #333 !important; }
  #printArea .pchart .showmore, #printArea .pchart .bartools { display: none !important; }
}
@media print { #printArea, #printArea * { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
@media (max-width: 760px) { .ptools { flex-wrap: wrap; } .ptools .sortby { flex: 1 1 100%; min-width: 0; } .ptools .sortby select { min-width: 0; width: 100%; } }

/* print center */
.pc-list { display: grid; gap: 8px; }
.pc-row { display: grid; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; background: var(--surface); }
a.pc-row:hover { border-color: var(--axis); } .pc-row span { font-size: 12px; color: var(--muted); }
.pc-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
@media print { #printArea .psign { display: grid; grid-template-columns: 1fr 1fr; gap: 20mm; margin-top: 18mm; font-size: 9pt; }
  #printArea .psign div { border-top: 0.5px solid #000; padding-top: 2mm; } }
@media print { #printArea th.l { text-align: left; } }
th.sortable[data-arrow]:not([data-arrow=""])::after { content: " " attr(data-arrow); font-size: .8em; }
th.sortable { user-select: none; }
table:not(.rng-show) tr.rng-out { display: none; }
.rng-note { margin-top: 6px; }
.rng-note .btn.link, .tools .btn.link.small { padding: 0 4px; min-height: 0; }

/* ---------------------------------------------------------------- the table kit */
.kwrap { max-height: 76vh; overflow: auto; }
.kwrap thead th { position: sticky; top: 0; z-index: 3; background: var(--sunken); box-shadow: inset 0 -1px 0 var(--axis); }
.kwrap thead tr.tsum td { position: sticky; top: var(--hh, 34px); z-index: 3; }
thead tr.tsum td { background: var(--accent-soft); font-weight: 650; font-size: 12.5px; box-shadow: inset 0 -1.5px 0 var(--axis); color: var(--ink); }
.kwrap tbody td:first-child, .kwrap thead th:first-child, .kwrap thead tr.tsum td:first-child { position: sticky; left: 0; }
.kwrap tbody td:first-child { z-index: 1; background: var(--surface); box-shadow: inset -1px 0 0 var(--grid); }
.kwrap thead th:first-child, .kwrap thead tr.tsum td:first-child { z-index: 4; }
.kwrap tr.warnrow td:first-child { background: var(--warn-soft); }
.kwrap tr.total td:first-child, .kwrap tr.grp td:first-child { background: var(--sunken); }
tr.sel td, .kwrap tr.sel td:first-child { background: var(--accent-soft); }
tr.rowlink { cursor: pointer; }
.rsel { margin: 0 7px 0 0; vertical-align: -2px; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.gsel { margin: 0 6px 0 0; vertical-align: -2px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.qpick { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.qpick select { min-width: 70px; max-width: 150px; }
.qpick.on { color: var(--accent-ink); font-weight: 600; } .qpick.on select { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
td.cr { color: var(--crit-text); font-weight: 600; } td.co { color: var(--warn-text); font-weight: 600; } td.cg { color: var(--good-text); font-weight: 600; }
td.chip.cr { background: var(--crit-soft); } td.chip.co { background: var(--warn-soft); } td.chip.cg { background: var(--good-soft); }
td.dbar { background-image: linear-gradient(to left, color-mix(in srgb, var(--accent) 17%, transparent) var(--p), transparent var(--p)); }
.dlt { font-size: 10.5px; margin-left: 5px; font-weight: 650; white-space: nowrap; }
.dlt.g { color: var(--good-text); } .dlt.b { color: var(--crit-text); } .dlt.same, .dlt.new { color: var(--muted); font-weight: 500; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.fchip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12px; }
.fchip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.kpanel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 12px; margin: -4px 0 10px; box-shadow: var(--shadow); }
.kpanel .cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; font-size: 13px; }
.selbar { position: sticky; bottom: 10px; z-index: 6; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 8px; padding: 8px 12px;
  background: var(--ink); color: var(--surface); border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.selbar .sp { flex: 1; } .selbar .btn { background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 35%, transparent); }
.selbar[hidden] { display: none; }
tr.grp td { background: var(--sunken); cursor: pointer; border-top: 1px solid var(--axis); }
tr.g-hide, tr.f-out { display: none; }
.gbtn { border: 0; background: none; cursor: pointer; color: inherit; font-size: 12px; padding: 0 2px; }
body.dense th, body.dense td { padding: 4px 8px; font-size: 12px; }
body.dense td input, body.dense td select { padding: 2px 6px; min-height: 0; height: 26px; }
.qd { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.qd button { border: 1px solid var(--line); background: var(--surface); color: var(--ink2); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.qd button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 760px) {
  .kwrap:has(> table.auto) { max-height: none; overflow: visible; }
  table.auto td:first-child { position: static !important; box-shadow: none !important; }
  table.auto tr.grp td:not(:first-child):empty { display: none; }
  .kwrap { max-height: 70vh; }
}
@media print {
  .kwrap { max-height: none !important; overflow: visible !important; }
  .ktools, .kb, .selbar, .rsel, .gsel, .qpick, .kpanel, .dlt, .qd, thead tr.tsum { display: none !important; }
  .kwrap thead th, .kwrap td:first-child { position: static !important; }
}
@media (max-width: 760px) {
  .tools .kb.btn, .tools [data-x].btn, .tools [data-dir].btn, .tools [data-cmp].btn { min-height: 34px; padding: 5px 10px; font-size: 13px; }
  .qd button { padding: 4px 9px; }
}
.cam-lens { display: flex; gap: 6px; padding: 0 14px 8px; overflow-x: auto; }
.cam-lens .btn { background: #262422; border-color: #3d3935; color: #fff; padding: 6px 12px; min-height: 0; font-size: 13px; white-space: nowrap; }
.cam-lens .btn.on { background: var(--accent); border-color: var(--accent); }
.rsum i { display: block; font-style: normal; font-size: 11.5px; font-weight: 650; margin-top: 1px; }

/* ---------------------------------------------------------------- after the site review (Oct 2026) */
td.qc.cr { background: var(--crit-soft); } td.qc.co { background: var(--warn-soft); } td.qc.cg { background: var(--good-soft); }
td.qc.cm { color: var(--muted); font-weight: 400; }
/* the tick and the SKU stay on one line */
.kwrap tbody td:first-child, .kwrap thead th:first-child { white-space: nowrap; }
.kwrap td:first-child .rsel, .kwrap th:first-child .rsel { display: inline-block; vertical-align: middle; }
/* fingers: everything you tap at least 44 px high, and no text under 13 px */
@media (pointer: coarse) {
  .btn, a.btn, button.btn, select, input[type=text], input[type=search], input[type=number], input[type=date], input[type=email], input[type=password] { min-height: 44px; }
  td input[type=number], td input[type=text], td select { min-height: 40px; }
  .small, .muted.small, .kpi .note, .hint, .rsum span, thead th, .fchip, .qd button { font-size: 13px; }
  table { font-size: 14px; }
  .rsel { width: 20px; height: 20px; }
  .qd button { padding: 8px 12px; }
}
/* the governorate table never pushes the page wider than the screen (iPad portrait) */
.geo-wrap > * { min-width: 0; }
@media (max-width: 1000px) { .geo-wrap { grid-template-columns: 1fr; } .gtiles { max-width: none; } }
/* the tabs of a menu section (Sales & profit: Sales · Profit · Insights) */
.hubtabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.hubtabs::-webkit-scrollbar { display: none; }
.hubtabs a { padding: 9px 14px; text-decoration: none; color: var(--ink2); font-weight: 550; font-size: 14px; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.hubtabs a:hover { color: var(--ink); }
.hubtabs a.on { color: var(--ink); border-bottom-color: var(--g, var(--accent)); }
.hubtabs .dr-badge { position: static; }
@media (pointer: coarse) { .hubtabs a { padding: 12px 16px; } }
@media print { .hubtabs { display: none !important; } }

/* theme picker */
.thgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.thsw { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; text-align: start; }
.thsw:hover { border-color: var(--axis); } .thsw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.thprev { position: relative; display: block; height: 38px; border-radius: 7px; border: 1px solid rgba(0,0,0,.08); overflow: hidden; }
.thprev span { position: absolute; left: 8px; right: 8px; top: 8px; bottom: 0; border-radius: 5px 5px 0 0; }
.thprev i { position: absolute; left: 14px; top: 15px; width: 34px; height: 8px; border-radius: 4px; }
.thname { font-size: 12px; }
.thpop { position: fixed; z-index: 60; width: min(380px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }

/* suppliers: a tile per supplier, then that supplier's tabs */
.suptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.suptile { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; box-shadow: var(--shadow); }
.suptile b { font-size: 15px; } .suptile span { font-size: 12px; color: var(--ink2); } .suptile span.down { color: var(--crit-text); }
.suptile em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--warn-text); background: var(--warn-soft); padding: 1px 7px; border-radius: 999px; margin-top: 2px; }
.suptile:hover { border-color: var(--axis); } .suptile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.suptile.add { border-style: dashed; background: transparent; } .suptile.add b { color: var(--accent-ink); }
.suphead { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.suptabs { flex-wrap: wrap; max-width: 100%; }

/* outside-Amazon sale form: one row per SKU */
.olines { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.oline { display: grid; grid-template-columns: minmax(170px, 2fr) 90px 130px minmax(120px, 2fr) auto; gap: 8px; align-items: end; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--sunken); }
.oline label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink2); }
.oline > span { padding-bottom: 8px; }
@media (max-width: 640px) { .oline { grid-template-columns: 1fr 1fr; } .oline label:first-child, .oline > span { grid-column: 1 / -1; } }

/* table toolbar: one line; the rarely used tools live under ⋯ */
.tools .tcount { order: 8; } .tools .tmore { order: 9; margin-inline-start: auto; position: relative; }
.tmore > summary { list-style: none; min-width: 36px; text-align: center; font-weight: 700; letter-spacing: 1px; }
.tmore > summary::-webkit-details-marker { display: none; }
.tmore[open] > summary { background: var(--accent-soft); border-color: var(--accent); }
.tmenu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 210px;
  padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.tmenu .btn { justify-content: flex-start; text-align: start; } .tmenu .sortby { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
/* section chips on long pages */
.secbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
@media (max-width: 760px) { .secbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; } }
.secbar .chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink2); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.secbar .chip:hover { border-color: var(--axis); color: var(--ink); } .secbar .chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); font-weight: 600; }
.sec-off { display: none !important; }
@media print { .secbar, .tmore { display: none !important; } .sec-off { display: block !important; } }
/* broken size runs: side by side on wide screens */
@media (min-width: 1100px) { .runs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.tools .qpick select { min-width: 64px; }
.tools .qpick[data-k] { }
@media (max-width: 480px) { #themeBtn { display: none; } }
.oline input, .oline select { min-width: 0; width: 100%; }
.oline label { min-width: 0; }
.secbar { min-width: 0; } .stack > .secbar { width: 100%; }
@media (max-width: 760px) { td, th { overflow-wrap: anywhere; } }
@media (max-width: 760px) { td, td * { white-space: normal !important; overflow-wrap: anywhere; } .seg { flex-wrap: wrap; max-width: 100%; } }
@media (max-width: 760px) { .suptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .suptile { padding: 9px 10px; } .suptile b { font-size: 14px; } }

/* ---- charts (charts.js). Series colours in a fixed, colour-blind-checked order; dark mode has its own steps */
:root { --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300; --c7: #6250d6; --c8: #e34948; }
@media (prefers-color-scheme: dark) { :root:not([data-mode]) { --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767; } }
:root[data-mode="dark"] { --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767; }
svg.chx { width: 100%; height: auto; display: block; overflow: visible; }
svg.chx .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
svg.chx .hk { font-size: 12px; fill: var(--ink2); } svg.chx .hv { font-size: 12px; fill: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
svg.chx .hc { font-size: 10.5px; fill: var(--ink); } svg.chx .hc.on { fill: #fff; }
svg.chx .tm { font-size: 12px; font-weight: 600; fill: var(--ink); } svg.chx .tm2 { font-size: 11px; fill: var(--ink2); }
svg.chx .tm.on, svg.chx .tm2.on { fill: #fff; }
svg.chx [data-t] { transition: opacity .12s; } svg.chx path.hov, svg.chx rect.hov:not(.hitc), svg.chx circle.hov { opacity: .82; }
svg.chx g.hov rect { filter: brightness(1.06); }
.legend .sw, .dleg .sw, .tsw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-inline-end: 6px; }
.tsw { width: 8px; height: 8px; margin-inline-end: 4px; }
.donut { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; } .donut svg { width: 170px; height: 170px; flex: none; }
.donut .dc-v { font-size: 17px; font-weight: 700; fill: var(--ink); }
.dleg { list-style: none; margin: 0; padding: 0; flex: 1 1 180px; display: grid; gap: 6px; }
.dleg li { display: grid; grid-template-columns: auto 1fr auto 44px; gap: 6px; align-items: center; font-size: 13px; cursor: default; }
.dleg li b { font-weight: 600; font-variant-numeric: tabular-nums; } .dleg li em { font-style: normal; color: var(--muted); text-align: end; font-size: 12px; }
.dleg li.hov { color: var(--accent-ink); }
.scroll-x { overflow-x: auto; max-width: 100%; }
.hscale { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 6px; } .hscale i { width: 110px; height: 8px; border-radius: 4px; display: block; }
.funnel { display: grid; gap: 8px; } .fn-row { display: grid; grid-template-columns: 110px 1fr 80px minmax(90px, auto); gap: 10px; align-items: center; font-size: 13px; }
.fn-track { height: 22px; display: flex; justify-content: center; } .fn-bar { height: 100%; border-radius: 4px; }
.fn-row b { text-align: end; font-variant-numeric: tabular-nums; } .fn-row em { font-style: normal; color: var(--muted); font-size: 12px; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.meter .mt-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; } .meter .mt-h span { color: var(--ink2); font-size: 13px; }
.meter .mt-h b { font-size: 20px; } .meter .mt-h em { font-style: normal; color: var(--muted); font-size: 12px; }
.mt-track { position: relative; height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--s1) 14%, var(--surface)); margin-top: 6px; }
.mt-track i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 5px; background: var(--s1); }
.meter.good .mt-track i { background: var(--good); } .meter.warn .mt-track i { background: var(--warn); } .meter.bad .mt-track i { background: var(--crit); }
.mt-track s { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.chgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }
@media (max-width: 560px) { .fn-row { grid-template-columns: 80px 1fr 60px; } .fn-row em { display: none; } }

.chgrid > .wide { grid-column: 1 / -1; }
.chgrid > .card { min-width: 0; }
.stat1 { padding: 18px 4px; color: var(--ink2); } .stat1 b { font-size: 26px; color: var(--ink); margin-inline-end: 6px; }
svg.chx .hc.me { font-weight: 700; }

/* quick screen for the phone */
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.qbig { display: flex; flex-direction: column; gap: 4px; padding: 16px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); min-height: 112px; }
.qbig:hover { border-color: var(--accent); } .qbig .qi { font-size: 26px; line-height: 1; } .qbig b { font-size: 15px; } .qbig span:last-child { font-size: 12px; color: var(--muted); }
.qfind { margin-top: 8px; } .qfind input { font-size: 17px; padding: 12px; flex: 1; min-width: 0; }
.qres { margin-top: 12px; } .qres-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; } .qres-h b { font-size: 17px; }
.qplaces { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; } .qplaces .chip { border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--ink); text-decoration: none; background: var(--surface); }

.po-card h2 { display: flex; align-items: center; gap: 8px; } .po-tick { display: inline-flex; } .po-tick .rsel { margin: 0; }
#poBar { position: sticky; top: calc(var(--nav-h) + 6px); bottom: auto; }

/* phone: the header never pushes past the screen (Arabic labels are wider): the shop name gives way first */
@media (max-width: 760px) {
  .top .brand { min-width: 0; flex: 0 1 auto; overflow: hidden; }
  .top .brand > span:first-of-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .top .right { min-width: 0; }
  #langBtn { padding-left: 7px; padding-right: 7px; }
}
/* put an alert away */
.asnooze { position: relative; }
.asnooze > summary { list-style: none; cursor: pointer; padding: 2px 8px; }
.asnooze > summary::-webkit-details-marker { display: none; }
.asnooze .kpanel { position: absolute; inset-inline-end: 0; top: 100%; z-index: 30; display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.card.warnbox { border-color: var(--warn, #c98a00); box-shadow: inset 3px 0 0 var(--warn, #c98a00); }
.nlimg em { position: absolute; top: 2px; inset-inline-start: 4px; font-style: normal; font-weight: 700; background: var(--surface); border-radius: 50%; width: 16px; height: 16px; text-align: center; line-height: 16px; }
.nlimg button[data-mvimg] { top: auto; bottom: 2px; right: auto; left: 2px; }

/* arrange a page */
.ph .arrbtn { margin-inline-start: auto; }
.ph .arrbtn2 { margin-inline-start: 4px; }
.ph.ph-min { display: flex; justify-content: flex-end; padding: 0 0 6px; border: 0; }
.ph.ph-min::before, .ph.ph-min > i { display: none; }
.lay-off { display: none !important; }
body.arranging .lay-off { display: block !important; opacity: .45; }
body.arranging .chgrid.lay-off { display: grid !important; }
.arrtool { display: flex; align-items: center; gap: 6px; padding: 6px 8px; margin: -4px -4px 10px; border: 1px dashed var(--brand); border-radius: 8px; background: var(--hover); font-size: 13px; grid-column: 1 / -1; }
.arrtool .grip { cursor: grab; font-size: 16px; color: var(--ink2); }
.arrtool .sp { flex: 1; }
body.arranging [draggable=true] { outline: 1px dashed var(--line); outline-offset: 2px; }
.dragging { opacity: .5; }
@media (max-width: 760px) { .arrtool b { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
.arrtool.mini { margin: -6px -6px 8px; padding: 3px 6px; border-style: dotted; }

/* a page split into tabs (Sales, Ads, Settings…): the same look as the tabs on Warehouse */
.stack > .secbar.sectabs { width: auto; max-width: 100%; align-self: flex-start; }
.secbar.sectabs { display: inline-flex; gap: 2px; background: var(--sunken); padding: 3px; border-radius: var(--r); }
.secbar.sectabs .chip { border: 0; background: none; border-radius: 7px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--ink2); }
.secbar.sectabs .chip:hover { color: var(--ink); background: none; }
.secbar.sectabs .chip.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.secbar.sectabs .chip.all { opacity: .7; font-size: 12px; }
/* forecast: how the number is made */
table.fcwhy { table-layout: fixed; }
table.fcwhy th { text-align: start; font-weight: 600; vertical-align: top; padding: 7px 10px 7px 0; width: 150px; white-space: normal; }
table.fcwhy td { vertical-align: top; padding: 7px 10px 7px 0; white-space: normal; overflow-wrap: anywhere; }
table.fcwhy td:nth-child(2) { width: 30%; }
@media (max-width: 640px) { table.fcwhy, table.fcwhy tbody { display: block; } table.fcwhy tr { display: grid; grid-template-columns: 120px 1fr; }
  table.fcwhy th { width: auto; } table.fcwhy td:nth-child(2) { width: auto; } table.fcwhy td.muted { grid-column: 1 / -1; padding-top: 0; } }

/* ======================================================================== look, November 2026
   One family for both languages (IBM Plex Sans Arabic has Latin too), figures that line up in columns,
   and the shoe-box size grid as the one memorable element. The font is downloaded once by the Mac (web/vendor);
   until then, or offline, the system font is used. */
@font-face { font-family: "ALmond Sans"; font-weight: 400; font-display: swap; src: url(/vendor/plex-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "ALmond Sans"; font-weight: 500; font-display: swap; src: url(/vendor/plex-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "ALmond Sans"; font-weight: 600; font-display: swap; src: url(/vendor/plex-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "ALmond Sans"; font-weight: 700; font-display: swap; src: url(/vendor/plex-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "ALmond Sans"; font-weight: 400; font-display: swap; src: url(/vendor/plex-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191-2193, U+2212, U+FEFF; }
@font-face { font-family: "ALmond Sans"; font-weight: 500; font-display: swap; src: url(/vendor/plex-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191-2193, U+2212, U+FEFF; }
@font-face { font-family: "ALmond Sans"; font-weight: 600; font-display: swap; src: url(/vendor/plex-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191-2193, U+2212, U+FEFF; }
@font-face { font-family: "ALmond Sans"; font-weight: 700; font-display: swap; src: url(/vendor/plex-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191-2193, U+2212, U+FEFF; }
:root {
  --font: "ALmond Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  /* stock on a shelf: what is there, what is running out, what is gone, what was never made */
  --stk-ok: #2e7d4f; --stk-ok-soft: #e3f1e8; --stk-low: #b8741a; --stk-low-soft: #f8ecd9; --stk-out: #b3322a; --stk-out-soft: #f7e2df; --stk-none: #ece9e3;
}
:root[data-mode="dark"], :root[data-theme="dark"] {
  --stk-ok: #4cb77a; --stk-ok-soft: #173023; --stk-low: #e2a24a; --stk-low-soft: #33261a; --stk-out: #ec7a70; --stk-out-soft: #3a1d1b; --stk-none: #26241f;
}
@media (prefers-color-scheme: dark) { :root:not([data-mode]):not([data-theme]) {
  --stk-ok: #4cb77a; --stk-ok-soft: #173023; --stk-low: #e2a24a; --stk-low-soft: #33261a; --stk-out: #ec7a70; --stk-out-soft: #3a1d1b; --stk-none: #26241f; } }
body, [dir=rtl] body, button, input, select, textarea { font-family: var(--font); }
[dir=rtl] body { line-height: 1.6; }
.num, td.num, .kpi .val, .tile .v, .gridbox .q, .tday .v { font-variant-numeric: tabular-nums; }
.kpi .val { font-weight: 600; }
.dr-gname { text-transform: none; letter-spacing: 0; font-size: 12px; }

/* ---- product pictures: a small square photo in front of a SKU; the space is kept even before it loads */
.pimg { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: #fff; border: 1px solid var(--line);
  vertical-align: middle; margin-inline-end: 7px; flex: none; }
.pimg.lg { width: 92px; height: 92px; border-radius: 12px; margin: 0; }
.pimg.md { width: 44px; height: 44px; border-radius: 9px; }
a.skul { display: inline-flex; align-items: center; }

/* ---- the size grid: sizes are shoe-box ends, colours are the shelf rows */
.sizegrid { overflow-x: auto; }
.sizegrid table { border-collapse: separate; border-spacing: 5px; width: auto; }
.sizegrid th { font-size: 12px; font-weight: 500; color: var(--ink2); padding: 0 4px; text-align: center; white-space: nowrap; }
.sizegrid th.rowh { text-align: start; padding-inline-end: 10px; }
.sizegrid td { padding: 0; }
.gridbox { display: block; width: 58px; min-height: 52px; border-radius: 6px 6px 3px 3px; padding: 5px 4px 4px; text-align: center;
  background: var(--stk-none); color: var(--muted); border: 1px solid transparent; border-bottom-width: 4px; text-decoration: none; line-height: 1.15; }
.gridbox .q { display: block; font-size: 17px; font-weight: 600; color: inherit; }
.gridbox .w { display: block; font-size: 10.5px; opacity: .85; margin-top: 2px; white-space: nowrap; }
.gridbox.ok { background: var(--stk-ok-soft); color: var(--stk-ok); border-color: var(--stk-ok); border-width: 0 0 4px; }
.gridbox.low { background: var(--stk-low-soft); color: var(--stk-low); border-color: var(--stk-low); border-width: 0 0 4px; }
.gridbox.out { background: var(--stk-out-soft); color: var(--stk-out); border-color: var(--stk-out); border-width: 0 0 4px; }
.gridbox.here { outline: 2px solid var(--ink); outline-offset: 1px; }
a.gridbox:hover { filter: brightness(.97); }
a.gridbox:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gridlegend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink2); margin-top: 8px; }
.gridlegend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-inline-end: 5px; }

/* ---- Today: four numbers that matter, each with its last two weeks; then what to do */
.today { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; }
.tday { padding: 16px 18px 12px; border-inline-start: 1px solid var(--line); min-width: 0; }
.tday:first-child { border-inline-start: 0; }
.tday .l { font-size: 12.5px; color: var(--ink2); }
.tday .v { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; white-space: nowrap; }
.tday .n { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 18px; }
.tday svg.spark { display: block; width: 100%; height: 34px; margin-top: 8px; overflow: visible; }
.todo { display: flex; flex-direction: column; }
.todo .it { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px 2px; border-top: 1px solid var(--line); }
.todo .it:first-child { border-top: 0; }
.todo .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: var(--sunken); }
.todo .it.critical .ic { background: var(--stk-out-soft); } .todo .it.money .ic { background: var(--stk-ok-soft); } .todo .it.stock .ic { background: var(--stk-low-soft); }
.todo .t { font-weight: 600; font-size: 14px; }
.todo .d { color: var(--ink2); font-size: 12.5px; margin-top: 1px; }
.todo .worth { font-size: 12px; color: var(--stk-ok); font-weight: 600; white-space: nowrap; }
.todo .act { display: flex; gap: 8px; align-items: center; }
@media (max-width: 760px) {
  .today { grid-template-columns: 1fr 1fr; }
  .tday:nth-child(3) { border-inline-start: 0; } .tday:nth-child(n+3) { border-top: 1px solid var(--line); }
  .tday .v { font-size: 23px; }
  .todo .it { grid-template-columns: 32px 1fr; } .todo .act { grid-column: 2; }
  .gridbox { width: 48px; min-height: 46px; } .gridbox .q { font-size: 15px; }
}


.phead { display: flex; gap: 16px; align-items: flex-start; }
.phead > div { min-width: 0; }
.sizegrid th.rowh { white-space: nowrap; } .sizegrid th.rowh .pimg { margin-inline-end: 8px; }
.bars .name .pimg { width: 20px; height: 20px; border-radius: 5px; margin-inline-end: 6px; }
/* the operations manager page */
.aglist { display: flex; flex-direction: column; gap: 10px; }
.agi { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line, #e5e5e5); }
.agi:last-child { border-bottom: 0; }
.agd { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.agb { display: flex; gap: 6px; flex-shrink: 0; }
.agout { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg2, #f6f6f6); padding: 10px; border-radius: 8px; margin-top: 10px; max-height: 420px; overflow: auto; }
.aglog pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.agn { padding: 4px 0; }
@media (max-width: 600px) { .agi { flex-direction: column; } }
