/* RABAB CRM — work-tool design. RTL-first, logical properties, flat panels, one action colour, compact rows. */
:root {
  --ink: #1c232c; --ink-2: #39434f; --muted: #5d6874; --line: #d6dce3; --line-2: #e7ebef;
  --bg: #eef1f4; --panel: #ffffff; --panel-2: #f6f8fa; --hover: #f2f6fa;
  --brand: #0f5f8a; --brand-ink: #ffffff; --brand-dark: #0b4a6c; --brand-soft: #e5f0f6;
  --ok: #17663a; --ok-bg: #e3f3e8; --ok-line: #b7dcc3;
  --warn: #7a4c00; --warn-bg: #fdf0d8; --warn-line: #ecd29b;
  --bad: #a72a22; --bad-bg: #fbe6e4; --bad-line: #eab9b4;
  --info: #24518f; --info-bg: #e6eef9; --info-line: #c4d5ef;
  --neutral-bg: #eceff2; --neutral-line: #d6dce3;
  --r: 6px; --r-sm: 4px;
  --focus: 0 0 0 2px #fff, 0 0 0 4px #1d70b8;
  --font: "Segoe UI", "Noto Sans Hebrew", "Noto Sans Arabic", Arial, "Arial Hebrew", Tahoma, sans-serif;
  --top-h: 52px; --nav-w: 208px; --row-h: 36px;
  --st-active: #17663a; --st-available: #1f8f4f; --st-away: #7c8792; --st-busy: #a72a22; --st-office: #24518f; --st-break: #a96a00;
}
* { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; }
body.lang-ar { font-size: 1.04rem; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 700; }
h1 { font-size: 1.36rem; } h2 { font-size: 1.07rem; } h3 { font-size: .96rem; }
p { margin: 0 0 .6rem; }
small, .muted { color: var(--muted); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 100; border-radius: var(--r-sm); }
.skip:focus { top: calc(var(--top-h) + 8px); }
bdi.ltr, .ltr, .num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.num { white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar { position: fixed; top: 0; inset-inline: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 12px; background: #1c232c; color: #fff; border-bottom: 1px solid #0f141a; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap; min-width: calc(var(--nav-w) - 24px); }
.brand-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 5px; background: var(--brand); color: #fff; font-weight: 800; font-size: .95rem; }
.brand-lg { font-size: 1.2rem; color: var(--ink); justify-content: center; margin-bottom: 14px; min-width: 0; }
.topsearch { flex: 1; max-width: 420px; }
.topsearch input { width: 100%; height: 32px; border-radius: var(--r-sm); border: 1px solid #3b4653; background: #27303b; color: #fff; padding: 0 10px; font: inherit; }
.topsearch input::placeholder { color: #aeb8c3; }
.topbar-user { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.topbar-user form { margin: 0; }
.user-name { color: #fff; text-decoration: none; font-size: .93rem; }
.user-name small { color: #aeb8c3; margin-inline-start: 4px; }
.topbar .btn-ghost { color: #dfe5ea; border-color: #3b4653; height: 30px; }
.nav-toggle { display: none; background: none; border: 1px solid #3b4653; color: #fff; border-radius: var(--r-sm); height: 32px; width: 36px; font-size: 17px; cursor: pointer; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .8rem; font-weight: 600; text-decoration: none; }
.pill-warn { background: #f6c453; color: #3b2600; }

/* ---------- Agent station (status + shift + panel) ---------- */
.agent { display: flex; align-items: center; gap: 6px; }
.status-menu { position: relative; }
.status-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: var(--r-sm); background: #27303b; border: 1px solid #3b4653; cursor: pointer; color: #fff; white-space: nowrap; }
.status-menu > summary::-webkit-details-marker { display: none; }
.status-menu > summary .caret { opacity: .7; font-size: .7rem; }
.status-menu[open] > summary { border-color: #8fb7d0; }
.sdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: #7c8792; }
.sdot.st-active { background: var(--st-active); } .sdot.st-available { background: #3fbf72; } .sdot.st-away { background: var(--st-away); }
.sdot.st-busy { background: #e0584f; } .sdot.st-office { background: #6d9be0; } .sdot.st-break { background: #e5a12a; }
.timer { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; color: #c9d2da; font-size: .86rem; }
.status-list { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 50; min-width: 220px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; box-shadow: 0 6px 20px rgba(20, 30, 40, .16); }
.status-list form { margin: 0; }
.status-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; font: inherit; text-align: start; border-radius: var(--r-sm); cursor: pointer; color: var(--ink); }
.status-list button:hover, .status-list button:focus-visible { background: var(--hover); }
.status-list button[aria-current="true"] { font-weight: 700; background: var(--brand-soft); }
.status-list .hint { padding: 6px 10px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line-2); margin-top: 4px; }
.shift-clock { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 8px; border: 1px solid #3b4653; border-radius: var(--r-sm); }
.shift-clock form { margin: 0; }
.shift-clock .lbl { font-size: .82rem; color: #c9d2da; white-space: nowrap; }
.shift-clock .sm { display: none; }
.shift-clock button { white-space: nowrap; height: 24px; font-size: .8rem; padding: 0 8px; border-radius: 3px; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.shift-in { background: var(--brand); color: #fff; } .shift-out { background: #3b4653; color: #fff; }
.station-toggle { height: 32px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid #3b4653; background: #27303b; color: #fff; font: inherit; cursor: pointer; white-space: nowrap; }
.station-toggle[aria-expanded="true"] { background: var(--brand); border-color: var(--brand); }
.station { position: fixed; top: var(--top-h); inset-inline-end: 0; bottom: 0; width: 340px; max-width: 92vw; z-index: 35; background: var(--panel); border-inline-start: 1px solid var(--line); box-shadow: -4px 0 18px rgba(20, 30, 40, .08); overflow: auto; padding: 14px; display: none; }
body.station-open .station { display: block; }
.station h2 { font-size: .95rem; margin: 14px 0 6px; }
.station h2:first-child { margin-top: 0; }
.station .dial { display: flex; gap: 6px; }
.station .dial input { flex: 1; }
.station ul { list-style: none; margin: 0; padding: 0; }
.station li { padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: .92rem; }

/* ---------- Shell ---------- */
.shell { padding-top: var(--top-h); }
.sidenav { position: fixed; top: var(--top-h); bottom: 0; inset-inline-start: 0; width: var(--nav-w); background: var(--panel); border-inline-end: 1px solid var(--line); padding: 8px 6px 16px; overflow: auto; z-index: 20; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav .nav-group { font-size: .78rem; color: var(--muted); padding: 10px 10px 4px; font-weight: 600; }
.sidenav a { display: flex; justify-content: space-between; align-items: center; height: 32px; padding: 0 10px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.sidenav a:hover { background: var(--hover); color: var(--ink); }
.sidenav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; box-shadow: inset -3px 0 0 var(--brand); }
.count { background: var(--bad); color: #fff; border-radius: 9px; padding: 0 6px; font-size: .75rem; min-width: 18px; text-align: center; line-height: 18px; }
.lang-switch { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px; margin-top: 8px; border-top: 1px solid var(--line-2); font-size: .82rem; color: var(--muted); }
.lang-switch button { font: inherit; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 1px 8px; cursor: pointer; color: var(--ink-2); }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.lang-inline { justify-content: center; border: 0; margin: 0 0 12px; padding: 0; }
main { margin-inline-start: var(--nav-w); padding: 16px 20px 60px; min-width: 0; }
main:focus { outline: none; }

/* ---------- Page structure ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head .actions, .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.panel, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child, .panel > h2:first-child { margin-bottom: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head select, .row select { width: auto; }
.panel-flush { padding: 0; }
.panel-flush > .table-wrap { border: 0; border-radius: var(--r); }
.grid { display: grid; gap: 12px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.inline-form { display: inline; margin: 0; }
.text-bad { color: var(--bad); }

/* Buttons: one brand colour for the main action; everything else is quiet. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-danger { color: var(--bad); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ok { color: var(--ok); border-color: var(--ok-line); }
.btn-ok:hover { background: var(--ok-bg); color: var(--ok); }
.btn-outline { background: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { height: 28px; padding: 0 9px; font-size: .88rem; }
.btn-call { color: var(--ok); border-color: var(--ok-line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Action bar under a record header (Superview-style toolbar) */
.actionbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; background: var(--panel-2); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); margin-bottom: 12px; }
.actionbar form { margin: 0; }
.actionbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; top: calc(100% + 4px); inset-inline-end: 0; z-index: 25; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; box-shadow: 0 6px 20px rgba(20, 30, 40, .14); }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: start; padding: 7px 10px; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: none; border-radius: var(--r-sm); cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--hover); }
.menu-list .danger { color: var(--bad); }

/* Record header */
.rec-head { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0; padding: 12px 14px; display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.rec-head.solo { border-radius: var(--r); margin-bottom: 12px; }
.rec-head .rec-id { display: flex; align-items: center; gap: 6px; }
.rec-num { font-size: 1.36rem; font-weight: 800; direction: ltr; unicode-bidi: isolate; letter-spacing: .01em; }
.rec-title { font-size: 1.05rem; font-weight: 600; }
.rec-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-size: .92rem; margin-top: 4px; }
.rec-meta b { font-weight: 600; color: var(--muted); }
.rec-head.is-red { border-inline-start: 4px solid var(--bad); }
.rec-head.is-yellow { border-inline-start: 4px solid #c98a17; }
.copy-btn { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); height: 24px; padding: 0 6px; font: inherit; font-size: .78rem; cursor: pointer; color: var(--ink-2); }

/* Sections inside a record (label / value grid) */
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.section > h2, .section > summary { display: block; padding: 9px 14px; font-size: .98rem; font-weight: 700; border-bottom: 1px solid var(--line-2); background: var(--panel-2); border-radius: var(--r) var(--r) 0 0; cursor: default; }
.section > summary { cursor: pointer; list-style: none; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary::before { content: "▾"; display: inline-block; margin-inline-end: 6px; color: var(--muted); }
.section:not([open]) > summary::before { content: "◂"; }
.section-body { padding: 12px 14px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 22px; margin: 0; }
.kv > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }

/* Forms */
label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: 3px; color: var(--ink-2); }
.field { margin-bottom: 10px; min-width: 0; }
.field .hint, .hint { font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 32px; padding: 5px 8px; border: 1px solid #b7c0ca; border-radius: var(--r-sm); background: #fff; color: var(--ink); font: inherit;
}
textarea { min-height: 70px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: #1d70b8; }
input[dir=ltr] { text-align: end; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.checkbox input { width: 16px; height: 16px; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; margin: 0 0 10px; }
legend { font-weight: 700; padding: 0 6px; font-size: .9rem; }
.required::after { content: " *"; color: var(--bad); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 130px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r) var(--r) 0 0; }
.toolbar + .table-wrap { border-radius: 0 0 var(--r) var(--r); }
.toolbar .field { margin: 0; min-width: 130px; }

/* Queue tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 0; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); background: var(--hover); }
.tabs a[aria-current="page"] { color: var(--brand-dark); border-color: var(--brand); }
.tabs .n { background: var(--neutral-bg); color: var(--ink-2); border-radius: 9px; padding: 0 6px; font-size: .76rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tabs a[aria-current="page"] .n { background: var(--brand); color: #fff; }
.tabs-boxed { background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r) var(--r) 0 0; padding: 0 6px; }
.tabs-boxed + .toolbar { border-radius: 0; }
.tabs-boxed + .table-wrap { border-radius: 0 0 var(--r) var(--r); }

/* Tables */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { height: var(--row-h); padding: 5px 10px; text-align: start; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { background: var(--panel-2); font-weight: 600; color: var(--muted); font-size: .84rem; white-space: nowrap; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: end; }
td.act { white-space: nowrap; text-align: end; }
td.act .btn { height: 26px; padding: 0 8px; font-size: .85rem; }
tfoot td { font-weight: 700; background: var(--panel-2); }
tr.is-deleted td { color: var(--muted); text-decoration-line: line-through; text-decoration-color: #b7c0ca; }
.empty { color: var(--muted); padding: 18px 12px; text-align: center; }
.empty-state { padding: 22px 12px; text-align: center; color: var(--muted); }
.empty-state p { margin-bottom: 8px; }
.cell-sub { display: block; color: var(--muted); font-size: .82rem; }

/* Tags & traffic light: always text + colour */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; height: 20px; border-radius: 3px; font-size: .78rem; font-weight: 600; background: var(--neutral-bg); color: var(--ink-2); white-space: nowrap; border: 1px solid var(--neutral-line); }
[class*="badge-"][class*="-approved"], [class*="badge-"][class*="-delivered"], [class*="badge-"][class*="-paid"], .badge-ok, [class*="-issued"], [class*="-linked"], [class*="-done"], [class*="-converted"], [class*="-cleared"], [class*="-kept"], [class*="-received"] { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
[class*="-pending"], [class*="-pending_approval"], [class*="-preparing"], [class*="-ready"], [class*="-courier_assigned"], [class*="-billed"], [class*="-partially_paid"], [class*="-partially_delivered"], [class*="-in_progress"], [class*="-issuing"], [class*="-requested"], [class*="-deposited"], [class*="-qualified"], [class*="-contacted"], [class*="-waiting_customer"], [class*="-waiting_backoffice"], [class*="-high"] { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
[class*="-rejected"], [class*="-cancelled"], [class*="-delivery_failed"], [class*="-failed"], [class*="-bounced"], [class*="-broken"], [class*="-lost"], [class*="-unknown"], [class*="-urgent"], .badge-deleted { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
[class*="-released"], [class*="-dispatched"], [class*="-sent"], [class*="-new"], [class*="-open"] { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge-ticket_status-closed, .badge-priority-low, .badge-priority-normal { background: var(--neutral-bg); color: var(--ink-2); border-color: var(--neutral-line); }
.light { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; padding: 0 8px; height: 22px; border-radius: 3px; border: 1px solid; white-space: nowrap; font-size: .85rem; }
.light-green { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.light-yellow { color: var(--warn); border-color: #c98a17; background: var(--warn-bg); }
.light-red { color: #fff; border-color: var(--bad); background: var(--bad); }
.light-big { font-size: .98rem; height: 28px; padding: 0 12px; }

/* Flash / notices */
.flash { padding: 8px 12px; border-radius: var(--r-sm); margin-bottom: 10px; border: 1px solid; font-weight: 500; }
.flash-success { background: var(--ok-bg); color: #0e4d27; border-color: var(--ok-line); }
.flash-error { background: var(--bad-bg); color: #7c1913; border-color: var(--bad-line); }
.flash-info { background: var(--info-bg); color: #163a6a; border-color: var(--info-line); }
.notice { padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--info-line); border-inline-start: 4px solid var(--info); background: var(--info-bg); margin-bottom: 10px; }
.notice-warn { border-color: var(--warn-line); border-inline-start-color: #c98a17; background: var(--warn-bg); }
.notice-bad { border-color: var(--bad-line); border-inline-start-color: var(--bad); background: var(--bad-bg); }

/* Compact summary strip (replaces big KPI cards) */
.strip { display: flex; flex-wrap: wrap; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.strip a, .strip div { flex: 1 1 150px; padding: 8px 12px; text-decoration: none; color: var(--ink); border-inline-end: 1px solid var(--line-2); }
.strip > :last-child { border-inline-end: 0; }
.strip a:hover { background: var(--hover); }
.strip .v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: block; text-align: right; }
.strip .l { font-size: .82rem; color: var(--muted); }
.strip .warn .v { color: var(--warn); } .strip .bad .v { color: var(--bad); }
/* legacy KPI tiles (reports) restyled compact */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; }
.kpi { display: block; padding: 9px 12px; text-decoration: none; color: var(--ink); border-inline-end: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.kpi:hover { background: var(--hover); }
.kpi .kpi-label { font-size: .84rem; color: var(--muted); font-weight: 600; }
.kpi .kpi-value { font-size: 1.2rem; font-weight: 700; direction: ltr; unicode-bidi: isolate; display: block; text-align: right; font-variant-numeric: tabular-nums; }
.kpi .kpi-def { font-size: .75rem; color: var(--muted); }
.kpi-bad .kpi-value { color: var(--bad); } .kpi-warn .kpi-value { color: var(--warn); }

/* Customer header legacy names */
.cust-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); margin-bottom: 12px; }
.cust-head.is-red { border-inline-start: 4px solid var(--bad); }
.cust-head.is-yellow { border-inline-start: 4px solid #c98a17; }
.cust-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--ink-2); font-size: .9rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border-bottom: 0; }
.timeline .tl-type { font-size: .8rem; color: var(--muted); }
.three-status { display: flex; gap: 6px; flex-wrap: wrap; }
.three-status > div { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); }
.three-status .lbl { font-size: .78rem; color: var(--muted); font-weight: 600; }
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--panel); }
.steps li { padding: 5px 10px; font-size: .82rem; color: var(--muted); border-inline-end: 1px solid var(--line-2); }
.steps li.done { color: var(--ok); font-weight: 600; }
.steps li.current { background: var(--brand); color: #fff; font-weight: 700; }
details.disclose > summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 4px 0; }
details.disclose[open] > summary { margin-bottom: 8px; }
.items-table input, .items-table select { min-height: 30px; padding: 3px 6px; }
.items-table td { padding: 4px 6px; }
.totals { margin-inline-start: auto; min-width: 300px; }
.totals td { padding: 3px 8px; border: 0; height: auto; }
.totals tr.grand td { font-size: 1.06rem; font-weight: 800; border-top: 2px solid var(--ink); }
.totals .explain { font-size: .8rem; color: var(--muted); }
.pager { display: flex; gap: 6px; margin: 0 0 12px; align-items: center; }
pre.debug { background: #111; color: #eee; padding: 12px; overflow: auto; font-size: 12px; }
.env-banner { position: fixed; bottom: 0; inset-inline: 0; background: #f6c453; color: #3b2600; text-align: center; font-size: .78rem; font-weight: 700; padding: 2px; z-index: 50; }
.qr { background: #fff; padding: 10px; display: inline-block; border: 1px solid var(--line); }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; }

/* Side panel (create / edit drawers) */
.sidepanel { position: fixed; top: var(--top-h); bottom: 0; inset-inline-end: 0; width: 460px; max-width: 100vw; background: var(--panel); border-inline-start: 1px solid var(--line); z-index: 40; overflow: auto; box-shadow: -6px 0 24px rgba(20, 30, 40, .12); }
.sidepanel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.sidepanel-body { padding: 14px; }
.scrim { position: fixed; inset: var(--top-h) 0 0 0; background: rgba(28, 35, 44, .25); z-index: 39; }

/* Confirmation pages */
.confirm { max-width: 640px; }
.confirm .danger-zone { border: 1px solid var(--bad-line); background: var(--bad-bg); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 10px; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.auth-card h1 { font-size: 1.15rem; text-align: center; margin-bottom: 12px; }
.auth-card .btn { width: 100%; height: 36px; }

/* Print */
.print-doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 28px; color: #000; }
.print-doc h1 { font-size: 1.4rem; }
.print-doc table th { background: #eee; color: #000; }
.watermark { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: 64px; font-weight: 900; color: rgba(167, 42, 34, .13); transform: rotate(-24deg); z-index: 0; text-align: center; }
.draft-banner { border: 3px solid var(--bad); color: var(--bad); font-weight: 900; text-align: center; padding: 8px; font-size: 1.1rem; margin-bottom: 14px; }
.test-banner { border: 3px dashed var(--warn); color: var(--warn); font-weight: 800; text-align: center; padding: 6px; margin-bottom: 12px; }
.sign-box { margin-top: 40px; display: flex; gap: 40px; } .sign-box div { flex: 1; border-top: 1px solid #000; padding-top: 6px; }
@media print {
  .topbar, .sidenav, .no-print, .env-banner, .flash-area, .station, .actionbar { display: none !important; }
  .shell { padding-top: 0; } main { margin: 0; padding: 0; } body { background: #fff; }
  .card, .section { border: 0; }
}

/* Utilities (no inline styles: CSP blocks them) */
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mb-0 { margin-bottom: 0; } .center { text-align: center; } .small { font-size: .84rem; }
.maxw-520 { max-width: 520px; } .maxw-760 { max-width: 760px; } .w-100 { width: 100%; } .nowrap { white-space: nowrap; } .end { text-align: end; }
input.w-qty, .w-qty { width: 80px; } input.w-pct, .w-pct { width: 84px; } input.w-amt, .w-amt { width: 110px; } select.w-sel, .w-sel { min-width: 230px; } select.w-type, .w-type { width: 64px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } .topsearch { max-width: 260px; } }
@media (max-width: 900px) {
  :root { --top-h: 50px; }
  .nav-toggle { display: inline-block; }
  .topsearch, .user-name, .brand > span:last-child { display: none; }
  .brand { min-width: 0; }
  .topbar { padding: 0 8px; gap: 6px; }
  .shift-clock .lbl { display: none; }
  .sidenav { display: none; width: 82%; max-width: 290px; box-shadow: 0 0 40px rgba(0, 0, 0, .25); z-index: 45; }
  body.nav-open .sidenav { display: block; }
  main { margin-inline-start: 0; padding: 12px 10px 70px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .kv > div { grid-template-columns: 100px minmax(0, 1fr); }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 4px 0; }
  table.responsive td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 3px 10px; height: auto; min-height: 28px; }
  table.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: .8rem; }
  table.responsive td.num, table.responsive td.act { text-align: start; }
  table.items-table td input, table.items-table td select { max-width: 60%; min-width: 0; }
  table.items-table .w-sel { min-width: 0; }
  .btn { height: 38px; } .btn-sm { height: 32px; }
  .totals { min-width: 0; width: 100%; }
  .sidepanel { width: 100vw; }
  .status-list { position: fixed; top: var(--top-h); inset-inline: 8px; }
}
@media (max-width: 520px) {
  .shift-clock .lg { display: none; } .shift-clock .sm { display: inline; }
  .topbar .btn-ghost { padding: 0 6px; }
  .status-menu > summary .st-label { display: none; }
  .station-toggle .st-label { display: none; }
}
td .menu-list { position: static; box-shadow: none; min-width: 240px; margin-top: 4px; text-align: start; white-space: normal; }
td .ltr, td bdi.ltr { white-space: nowrap; }
