/* SHAAN Ops — Brand tokens: Forest Green #4B6743, Navy #21387F, Terracotta #E66E3E, Pale Mint #D5FFD2, Ink #20261F */
:root {
  --green: #4B6743;
  --navy: #21387F;
  --terra: #E66E3E;
  --mint: #D5FFD2;
  --ink: #20261F;
  --bg: #F7F8F5;
  --card: #fff;
  --border: #DDE3D6;
  --muted: #6B7A62;
  --radius: 8px;
  --fs: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "IBM Plex Sans Arabic", sans-serif; background: var(--bg); color: var(--ink); font-size: var(--fs); direction: rtl; }
h3,h4 { margin: 16px 0 8px; font-size:1.05em; color: var(--green); }

button.ghost { background:none; border:1px solid var(--border); color:var(--ink); padding:5px 10px; border-radius:var(--radius); cursor:pointer; font-family:inherit; font-size:var(--fs); }
button.ghost:hover { border-color:var(--green); color:var(--green); }
button.alt { background:var(--navy); color:#fff; border:none; padding:6px 12px; border-radius:var(--radius); cursor:pointer; font-family:inherit; font-size:var(--fs); }
button.alt:hover { opacity:.9; }

/* Sync */
#syncmsg { text-align:center; font-size:.85em; color:var(--muted); padding:4px; min-height:20px; }

/* Main */
main { max-width:1180px; margin:0 auto; padding:20px 24px 40px; }
.tab { display:none; }
.tab.on { display:block; }

/* Filters */
.filters { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:12px; }
.filters label { display:flex; align-items:center; gap:4px; font-size:.9em; }
input, select { border:1px solid var(--border); border-radius:var(--radius); padding:6px 10px; font-family:inherit; font-size:var(--fs); background:#fff; color:var(--ink); }
input:focus, select:focus { outline:2px solid var(--green); }
button[type=submit], button:not(.ghost):not(.alt):not(.call-action):not(.move-btn):not([data-tab]):not(.icon-btn):not(.wa-chip):not(.danger):not(.alt-accent):not([role=tab]):not(.tile):not(.slot):not(.plain) {
  background:var(--green); color:#fff; border:none; padding:6px 14px; border-radius:var(--radius); cursor:pointer; font-family:inherit; font-size:var(--fs);
}
button:not(.ghost):not(.alt):not(.call-action):not(.move-btn):not([data-tab]):not(.icon-btn):not(.wa-chip):not(.danger):not(.alt-accent):not([role=tab]):not(.tile):not(.slot):not(.plain):hover { opacity:.9; }

/* Grid KPIs */
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:10px; margin-bottom:16px; }
.kpi { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:12px; text-align:center; }
.kpi b { display:block; font-size:1.4em; color:var(--navy); }
.kpi span { font-size:.8em; color:var(--muted); }

/* Chips */
.chips { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.chip { background:var(--mint); color:var(--ink); border-radius:12px; padding:4px 10px; font-size:.85em; }
.chip b { color:var(--green); margin-right:4px; }
.chip-sm { background:var(--terra); color:#fff; border-radius:8px; padding:2px 6px; font-size:.75em; margin-right:4px; }

/* Dash row */
.dash-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:12px; }
@media(max-width:600px){.dash-row{grid-template-columns:1fr;}}

/* Alert */
.alert-warning { background:#FFF3CD; border:1px solid #FBBF24; color:#92400E; padding:10px 14px; border-radius:var(--radius); margin-top:8px; }
.muted { color:var(--muted); font-size:.9em; }

/* Cards (queue) */
.card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:12px; margin-bottom:10px; }
.card-head { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:8px; }
.card-actions { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.card-phone { display:flex; gap:10px; }
.dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.dot-new { background:#6EE7B7; }
.dot-retry { background:#FCD34D; }
.dot-hot { background:var(--terra); }

/* Call action buttons */
.call-action { padding:5px 10px; border:none; border-radius:var(--radius); cursor:pointer; font-family:inherit; font-size:.85em; }
.call-action.confirmed { background:var(--green); color:#fff; }
.call-action.canceled { background:#EF4444; color:#fff; }
.call-action.no_answer, .call-action.busy { background:#FCD34D; color:var(--ink); }
.call-action.rejected { background:#F97316; color:#fff; }
.call-action.postponed { background:var(--navy); color:#fff; }
.call-action.wrong_number { background:#6B7280; color:#fff; }

/* Move buttons */
.move-btn { background:var(--bg); border:1px solid var(--border); color:var(--ink); font-size:.8em; padding:4px 8px; border-radius:6px; cursor:pointer; margin:2px; }
.move-btn:hover { border-color:var(--green); }

/* Tables */
table { width:100%; border-collapse:collapse; background:var(--card); border-radius:var(--radius); overflow:hidden; }
th { background:var(--ink); color:#fff; text-align:right; padding:8px 12px; font-size:.85em; font-weight:600; }
td { padding:8px 12px; border-bottom:1px solid var(--border); font-size:.9em; }
.order-row:hover td { background:var(--mint); }

/* Stage badges */
.stage { font-size:.8em; padding:2px 8px; border-radius:8px; background:var(--mint); }
.stage-delivered { background:var(--green); color:#fff; }
.stage-canceled, .stage-returned { background:#FEE2E2; color:#991B1B; }
.stage-shipped, .stage-out_for_delivery { background:#DBEAFE; color:#1D4ED8; }
.stage-confirmed, .stage-ready { background:#D1FAE5; color:#065F46; }
.stage-unreachable { background:#F3F4F6; color:#6B7280; }

/* Dialog */
dialog { border:none; border-radius:var(--radius); padding:20px; max-width:600px; width:90%; box-shadow:0 20px 60px rgba(0,0,0,.2); direction:rtl; }
dialog::backdrop { background:rgba(0,0,0,.4); }
dialog h3 { margin-bottom:8px; color:var(--navy); }
dialog p { margin-bottom:6px; font-size:.9em; }
dialog h4 { color:var(--green); margin:12px 0 4px; }
dialog ul { list-style:none; padding:0; }
dialog li { font-size:.85em; color:var(--muted); padding:2px 0; }

.row{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px;align-items:center}
.tag{font-size:12px;border-radius:6px;padding:1px 7px;background:var(--mint);color:var(--green)}
.tag.warn{background:#FDEBE3;color:#9A3F1B}
.tag.ok{background:#E3F2E8;color:#1F6B3A}
.tag.bad{background:#F9E0E0;color:#9B1C1C}

/* ── login + user menu ── */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #F4F6F3; z-index: 50; }
.login[hidden] { display: none; }
.login-card { display: flex; flex-direction: column; gap: 10px; width: min(340px, calc(100vw - 32px)); background: #fff;
  padding: 24px; border-radius: 12px; box-shadow: 0 6px 24px rgba(32,38,31,.12); }
.login-card .brand { font-size: 1.6rem; text-align: center; }
.warn-text { color: #B3261E; min-height: 1em; margin: 0; }
.me[hidden], [hidden] { display: none !important; }
.login-card .brand { color: #4B6743; }
.reason-list { display: grid; gap: 8px; margin: 12px 0; min-width: 260px; }
.pick td.qty { font-size: 1.6rem; font-weight: 700; width: 64px; text-align: center; }
.pick td { font-size: 1.1rem; }
.pack-actions button { font-size: 1.05rem; padding: 10px 16px; }
.addr-form { display: grid; gap: 8px; max-width: 520px; }
.chip.warn { background: #FDE7DC; color: #B3261E; }
tr.flash { background: #D5FFD2; }
/* picking list: shown over the page, and alone when printed */
#print-area { display: none; }
body.print-mode #print-area { display: block; position: fixed; inset: 0; overflow: auto; background: #fff; padding: 16px; z-index: 40; }
.pick-order { break-inside: avoid; margin: 8px 0; padding: 6px 0; border-bottom: 1px solid #ddd; }
@media print {
  body.print-mode > :not(#print-area) { display: none !important; }
  body.print-mode #print-area { position: static; padding: 0; }
  .no-print { display: none !important; }
}
.secret { font-family: monospace; font-size: 1.1rem; background: #F4F6F3; padding: 4px 8px; border-radius: 6px; user-select: all; }
tr.avoid td { background: #FDE7DC; }
.lbl.on { background: #D5FFD2; border-color: #4B6743; }
.note { background: #FFF8E1; padding: 6px 8px; border-radius: 6px; margin: 4px 0; }
.rule-edit { display: grid; gap: 6px; padding: 6px 0; }

/* ══ Shell: light sidebar (right, RTL) + top bar ════════════════════════════ */
:root { --side-w: 248px; --wa-green: #00A884; --wa-bubble-out: #D9FDD3; --wa-bg: #EFEAE2; --wa-panel: #F0F2F5; --wa-line: #E9EDEF;
  --nav-ink: #37433A; --nav-active: #E4EEE2; --nav-hover: #F2F5F0; }
.mi { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 1.25em; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; vertical-align: -0.22em;
  -webkit-font-smoothing: antialiased; font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; user-select: none; }
button .mi, a .mi { pointer-events: none; }
body { padding-right: var(--side-w); min-height: 100vh; }
#side { position: fixed; top: 0; right: 0; bottom: 0; width: var(--side-w); background: #fff; color: var(--nav-ink);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 12px; }
.side-head .brand { font-size: 1.3em; color: var(--green); }
.side-head .brand span { color: var(--terra); }
#side nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.nav-group > span { font-size: .72em; font-weight: 600; color: #8A9585; padding: 4px 14px; letter-spacing: .03em; }
#side nav button { display: flex; align-items: center; gap: 14px; width: 100%; text-align: right; background: none; border: none;
  color: var(--nav-ink); padding: 10px 14px; border-radius: 12px; cursor: pointer; font-family: inherit; font-size: 14.5px; font-weight: 600; }
#side nav button .mi { font-size: 22px; color: #3F4B42; }
#side nav button:hover { background: var(--nav-hover); }
#side nav button.on { background: var(--nav-active); color: var(--green); }
#side nav button.on .mi { color: var(--green); }
#side nav button b { margin-right: auto; background: var(--terra); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .72em; line-height: 18px; }
#side nav button b:empty { display: none; }
#side nav button[data-tab="inbox"] b { background: var(--wa-green); }
.me { border-top: 1px solid var(--border); padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; color: var(--nav-ink); }
.me-who { display: flex; align-items: center; gap: 10px; }
.me-who b { display: block; color: var(--ink); }
.me-who small { color: #8A9585; }
.me label { font-size: .85em; display: flex; gap: 6px; align-items: center; color: #5B6858; }
.me-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.me-actions .ghost { font-size: 12px; padding: 3px 9px; border-radius: 8px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  background: rgba(247,248,245,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 1.2em; color: var(--ink); flex: 1; font-weight: 600; }
.topbar #sync { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn { background: none; border: none; font-size: 18px; line-height: 1; padding: 7px; border-radius: 50%; cursor: pointer;
  color: #54656F; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn .mi { font-size: 24px; vertical-align: middle; }
.icon-btn:hover { background: rgba(0,0,0,.06); }
.only-mobile { display: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 14px; flex-shrink: 0; background: var(--green); }
.avatar.big { width: 96px; height: 96px; font-size: 32px; }
#me-avatar { width: 36px; height: 36px; font-size: 13px; background: var(--green); }
.card { border-radius: 12px; box-shadow: 0 1px 2px rgba(32,38,31,.05); }
table { border-radius: 12px; box-shadow: 0 1px 2px rgba(32,38,31,.05); }
th { background: #EEF2EA; color: var(--ink); }
.kpi { border-radius: 12px; }
button .mi, .tag .mi, .chip .mi, h3 .mi, h4 .mi, p .mi, .alert-warning .mi { font-size: 1.15em; margin-left: 3px; }
.dot-on { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--wa-green); margin-left: 4px; }
.wa-empty-logo .mi { font-size: 64px; color: #8696A0; }
.wa-preview .mi { font-size: 16px; color: #53BDEB; vertical-align: -3px; }
.wa-send .mi { font-size: 22px; }
.bell-ic .mi { color: #54656F; } .bell-ic.problem .mi { color: #D93025; } .bell-ic.chat .mi { color: var(--wa-green); }
@media (max-width: 900px) {
  body { padding-right: 0; }
  #side { transform: translateX(100%); transition: transform .2s ease; box-shadow: -8px 0 24px rgba(0,0,0,.18); }
  body.side-open #side { transform: none; }
  #side-shade { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; display: none; }
  body.side-open #side-shade { display: block; }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 10px 12px; }
  main { padding: 12px 12px 32px; }
}

/* ══ Inbox: WhatsApp Web look ═══════════════════════════════════════════════ */
body.full-tab main { max-width: none; padding: 0; }
.wa { display: grid; grid-template-columns: 360px 1fr; height: calc(100vh - 57px); background: #fff; border-top: 1px solid var(--wa-line); }
.wa.info-open { grid-template-columns: 360px 1fr 320px; }
.wa-list { display: flex; flex-direction: column; border-left: 1px solid var(--wa-line); min-height: 0; background: #fff; }
.wa-list-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.wa-list-head b { font-size: 1.15em; }
.wa-hours { font-size: .8em; color: #667781; }
.wa-search { padding: 4px 12px 8px; }
.wa-search input { width: 100%; background: var(--wa-panel); border: none; border-radius: 8px; padding: 9px 14px; }
.wa-search input:focus { outline: 2px solid var(--wa-green); }
.wa-chips { display: flex; gap: 6px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
.wa-chip { border: none; background: var(--wa-panel); color: #54656F; border-radius: 16px; padding: 5px 12px; font-family: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.wa-chip.on { background: #E7FCE3; color: #008069; font-weight: 600; }
.wa-convs { overflow-y: auto; flex: 1; }
.wa-conv { display: flex; gap: 12px; padding: 10px 14px; cursor: pointer; align-items: center; }
.wa-conv:hover { background: #F5F6F6; }
.wa-conv.on { background: var(--wa-panel); }
.wa-conv-body { flex: 1; min-width: 0; border-bottom: 1px solid var(--wa-line); padding-bottom: 10px; }
.wa-conv-top, .wa-conv-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.wa-conv-top b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-conv-top small { color: #667781; font-size: 12px; flex-shrink: 0; }
.wa-conv-top small.fresh { color: var(--wa-green); font-weight: 600; }
.wa-preview { color: #667781; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.wa-unread { background: var(--wa-green); color: #fff; border-radius: 10px; min-width: 20px; height: 20px; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; font-weight: 600; }
.wa-fail { background: #F15C6D; color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.wa-labels { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.wa-labels span { font-size: 11px; background: #FFF4E5; color: #9A5B00; border-radius: 6px; padding: 0 6px; }
.wa-none { color: #667781; text-align: center; padding: 30px 16px; }
.wa-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background-color: var(--wa-bg);
  background-image: radial-gradient(rgba(75,103,67,.07) 1px, transparent 1px), radial-gradient(rgba(230,110,62,.05) 1px, transparent 1px);
  background-size: 22px 22px, 34px 34px; background-position: 0 0, 11px 17px; }
.wa-empty { margin: auto; text-align: center; max-width: 420px; color: #667781; padding: 24px; }
.wa-empty-logo { font-size: 56px; }
.wa-empty h2 { color: #41525D; font-weight: 400; margin: 12px 0 8px; font-size: 1.6em; }
.wa-chat-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--wa-panel); border-bottom: 1px solid var(--wa-line); }
.wa-chat-head .avatar { width: 40px; height: 40px; }
.wa-who { flex: 1; min-width: 0; }
.wa-who b { display: block; }
.wa-who small { color: #667781; font-size: 12px; direction: ltr; unicode-bidi: plaintext; }
.wa-back { display: none; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 16px 6% 10px; display: flex; flex-direction: column; gap: 3px; }
.wa-day { text-align: center; margin: 10px 0 6px; }
.wa-day span { background: #fff; color: #54656F; font-size: 12px; padding: 4px 12px; border-radius: 8px; box-shadow: 0 1px .5px rgba(11,20,26,.13); }
.wa-bubble { position: relative; max-width: min(65%, 560px); padding: 6px 9px 8px; border-radius: 8px; box-shadow: 0 1px .5px rgba(11,20,26,.13);
  font-size: 14.2px; line-height: 1.45; word-wrap: break-word; }
.wa-text { white-space: pre-wrap; }
.wa-media { display: block; max-width: 100%; margin-bottom: 4px; border-radius: 6px; }
.wa-media img { display: block; max-width: min(100%, 320px); max-height: 320px; border-radius: 6px; object-fit: cover; }
audio.wa-media { width: min(100%, 280px); }
video.wa-media { max-height: 320px; background: #000; }
.wa-file { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: 4px; border-radius: 6px;
  background: rgba(0,0,0,.05); color: inherit; text-decoration: none; }
/* RTL like WhatsApp in Arabic: the customer on the right, us on the left */
.wa-bubble.in { align-self: flex-start; background: #fff; border-top-right-radius: 0; }
.wa-bubble.out { align-self: flex-end; background: var(--wa-bubble-out); border-top-left-radius: 0; }
.wa-bubble.in + .wa-bubble.in, .wa-bubble.out + .wa-bubble.out { border-radius: 8px; }
.wa-tpl { font-size: 11.5px; color: #008069; margin-bottom: 2px; }
.wa-meta { font-size: 11px; color: #667781; text-align: left; margin-top: 2px; direction: ltr; }
.tick { font-style: normal; color: #8696A0; letter-spacing: -3px; margin-left: 2px; }
.tick.read { color: #53BDEB; }
.tick.fail { color: #F15C6D; font-weight: 700; letter-spacing: 0; }
.wa-err { font-size: 12px; color: #B3261E; margin-top: 4px; }
.wa-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; background: var(--wa-panel); }
.wa-compose textarea { flex: 1; resize: none; border: none; border-radius: 8px; padding: 10px 12px; font-family: inherit; font-size: 15px;
  max-height: 140px; background: #fff; }
.wa-compose textarea:focus { outline: none; }
.wa-send { width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--wa-green) !important; color: #fff;
  font-size: 18px; cursor: pointer; transform: scaleX(-1); flex-shrink: 0; padding: 0 !important; }
.wa-qr { background: #fff; border-top: 1px solid var(--wa-line); max-height: 220px; overflow-y: auto; }
.wa-qr button { display: flex; gap: 10px; width: 100%; text-align: right; border: none; background: none !important; color: var(--ink) !important;
  padding: 8px 16px !important; cursor: pointer; font-family: inherit; border-radius: 0 !important; }
.wa-qr button:hover { background: var(--wa-panel) !important; }
.wa-qr button b { color: #008069; flex-shrink: 0; }
.wa-qr button span { color: #54656F; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-qr p { padding: 10px 16px; }
.wa-closed { background: #FFF8E1; border-top: 1px solid #F3E2B3; padding: 10px 16px; font-size: 13.5px; color: #6B5300; }
.wa-info { background: #fff; border-right: 1px solid var(--wa-line); overflow-y: auto; }
.wa-info-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--wa-panel); }
.wa-info-card { text-align: center; padding: 24px 16px; border-bottom: 8px solid var(--wa-panel); }
.wa-info-card h3 { color: var(--ink); margin: 12px 0 4px; font-size: 1.2em; }
.wa-info-card p { color: #667781; }
.wa-info-sec { padding: 12px 16px; border-bottom: 8px solid var(--wa-panel); }
.wa-info-sec h4 { color: #008069; margin: 0 0 8px; font-size: .9em; }
.wa-order { display: flex; gap: 8px; align-items: center; padding: 6px 0; color: var(--ink); text-decoration: none; }
.wa-info .note { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 1100px) { .wa.info-open { grid-template-columns: 300px 1fr; } .wa-info { position: fixed; inset: 0 auto 0 0; width: min(340px, 100vw); z-index: 35; box-shadow: 8px 0 24px rgba(0,0,0,.2); } }
@media (max-width: 900px) {
  .wa, .wa.info-open { grid-template-columns: 1fr; height: calc(100vh - 53px); }
  .wa .wa-chat { display: none; }
  .wa.chat-open .wa-list { display: none; }
  .wa.chat-open .wa-chat { display: flex; }
  .wa-back { display: inline-flex; }
  .wa-bubble { max-width: 85%; }
  .wa-msgs { padding: 12px 10px; }
}
/* the inbox fills the window under the top bar, whatever banners are shown above it */
body.full-tab { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
body.full-tab main { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; }
body.full-tab #inbox.on { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.full-tab .wa { flex: 1; height: auto; min-height: 0; }
body.full-tab .alert-warning { margin: 6px 12px; }

/* 🔔 notifications */
.bell-wrap { position: relative; }
#bell { position: relative; }
#bell b { position: absolute; top: 0; left: 0; background: var(--terra); color: #fff; font-size: 11px; border-radius: 9px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px; }
#bell b:empty { display: none; }
.bell-panel { position: absolute; left: 0; top: 44px; width: min(360px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(32,38,31,.18); z-index: 40; }
.bell-head { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.bell-item { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #F0F2EE; cursor: default; }
.bell-item[data-order] { cursor: pointer; }
.bell-item:hover { background: #F7F8F5; }
.bell-item.new { background: #F1FBEF; }
.bell-item p { color: #54656F; font-size: 13px; margin-top: 2px; }
.bell-item small { color: #8A9585; font-size: 11.5px; }
/* phones: a wide table scrolls inside itself, the page never gets wider than the screen */
@media (max-width: 900px) {
  table { display: block; overflow-x: auto; white-space: nowrap; max-width: 100%; }
  .dash-row > * { min-width: 0; }
  .filters input, .filters select { max-width: 100%; }
}

/* order history */
li.ev { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid #F0F2EE; list-style: none; }
li.ev .ev-ic { color: var(--green); font-size: 20px; margin-top: 1px; }
li.ev small { display: block; font-size: 11.5px; }

/* daily report */
.report-card summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-text { white-space: pre-wrap; font-family: inherit; background: #F7F8F5; border-radius: 10px; padding: 12px 14px; margin: 10px 0; line-height: 1.7; }
.install-btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; font-size: 13px; }

/* work guide */
#guide { max-width: 640px; }
.guide-head { display: flex; justify-content: space-between; align-items: center; }
#guide-body ol { padding-right: 20px; margin: 4px 0 10px; }
#guide-body li { margin: 6px 0; line-height: 1.6; color: var(--ink); font-size: .95em; }
#guide .wa-chips { padding: 6px 0 4px; }
#wa-ai-btn .mi { color: #7A5C99; }
#wa-ai-btn.busy .mi { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* system health */
.health summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.health-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-right: auto; }
.hp { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 2px 8px; border-radius: 12px; }
.hp .mi { font-size: 16px; }
.hp.ok { background: #E3F2E8; color: #1F6B3A; } .hp.bad { background: #F9E0E0; color: #9B1C1C; } .hp.off { background: #EEF0EC; color: #6B7A62; }

/* top-bar search */
.search-wrap { position: relative; display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 0 10px; flex: 0 1 380px; }
.search-wrap .mi { color: #8A9585; }
.search-wrap input { border: none; padding: 8px 2px; flex: 1; min-width: 0; background: none; }
.search-wrap input:focus { outline: none; }
.search-res { position: absolute; top: 42px; right: 0; left: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(32,38,31,.16); z-index: 45; max-height: 60vh; overflow-y: auto; min-width: 300px; }
.sr { padding: 9px 14px; border-bottom: 1px solid #F0F2EE; cursor: pointer; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sr:hover { background: #F7F8F5; }
@media (max-width: 900px) { .search-wrap { order: 5; flex-basis: 100%; } .topbar { flex-wrap: wrap; } }

/* confirmation card: script + secondary outcomes */
details.script { margin: 6px 0 8px; background: #F7F8F5; border-radius: 10px; padding: 6px 12px; }
details.script summary { cursor: pointer; color: var(--green); font-weight: 600; }
details.script ol { padding-right: 18px; margin: 6px 0; line-height: 1.8; }
details.script p { font-size: .85em; line-height: 1.7; }
details.more-outcomes { display: inline-block; }
details.more-outcomes summary { cursor: pointer; list-style: none; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .85em; color: var(--muted); }
details.more-outcomes[open] { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 6px; }
.card-phone { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.card-phone a, .card-phone button { display: inline-flex; align-items: center; gap: 4px; }

/* folded sections (settings, team, dashboard, order dialog) */
details.set-sec, details.od-sec { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; margin: 10px 0; }
details.set-sec > summary, details.od-sec > summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
details.set-sec[open] > summary, details.od-sec[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
details.set-sec[open], details.od-sec[open] { padding-bottom: 12px; }
.od-head h3 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.od-head p { margin: 4px 0; }
.od-actions { padding: 6px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ══ Design system v2 (2026-10-29) ═════════════════════════════════════════════
   Neutral surfaces (zinc-like, slightly warm), brand green for primary actions, Terracotta (#E66E3E,
   SHAAN's own orange) for active indicators, focus and highlights. Dark mode = same tokens, other values.
   Set by <html data-theme="light|dark"> (remembered per device, default follows the system). */
:root {
  --accent: #E66E3E; --accent-soft: #FDEEE7;
  --bg: #F6F6F4; --card: #FFFFFF; --card-2: #FAFAF9; --border: #E5E5E2; --border-strong: #D4D4CF;
  --ink: #1F2420; --muted: #6E7470; --nav-ink: #3A403B; --nav-active: #F1F3EF; --nav-hover: #F5F5F3;
  --ok: #16A34A; --ok-soft: #E8F6EC; --warn: #D97706; --warn-soft: #FEF3E2; --bad: #DC2626; --bad-soft: #FDECEC;
  --shadow: 0 1px 2px rgba(20,24,20,.04), 0 1px 1px rgba(20,24,20,.03); --shadow-lg: 0 10px 30px rgba(20,24,20,.10);
  --radius: 10px; --radius-xl: 14px;
}
:root[data-theme="dark"] {
  --bg: #0E100F; --card: #17191A; --card-2: #1C1F1E; --border: #2A2E2C; --border-strong: #3A3F3C;
  --ink: #ECEEEC; --muted: #9AA19C; --nav-ink: #C9CEC9; --nav-active: #212624; --nav-hover: #1C201E;
  --green: #7FA673; --navy: #8EA3E6; --mint: #1E2B1E; --accent-soft: #3A2318;
  --ok: #4ADE80; --ok-soft: #13261A; --warn: #FBBF24; --warn-soft: #2C2212; --bad: #F87171; --bad-soft: #2E1616;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --wa-panel: #1C1F1E; --wa-line: #2A2E2C; --wa-bg: #111413; --wa-bubble-out: #1F3A2A;
  color-scheme: dark;
}
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }

/* surfaces follow the tokens (they were hard-coded white / light green) */
#side, .card, .kpi, table, dialog, .bell-panel, .search-res, .login-card, .search-wrap, details.set-sec, details.od-sec,
.wa, .wa-list, .wa-info, .wa-compose textarea, .wa-qr, .wa-day span, .wa-bubble.in { background: var(--card); color: var(--ink); }
input, select, textarea { background: var(--card); color: var(--ink); border-color: var(--border); }
.topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom-color: var(--border); }
th { background: var(--card-2); color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
td { border-bottom-color: var(--border); }
.order-row:hover td, .sr:hover, .bell-item:hover, .wa-conv:hover { background: var(--nav-hover); }
.login { background: var(--bg); }
.report-text, details.script, .secret, .note { background: var(--card-2); color: var(--ink); }
.wa-chat-head, .wa-compose, .wa-info-head { background: var(--wa-panel); }
.bell-item.new { background: var(--ok-soft); }
.bell-head, .bell-item, .sr, li.ev { border-color: var(--border); }
.me, #side { border-color: var(--border); }
.me-who b, .wa-conv-top b { color: var(--ink); }
button.ghost, a.ghost { color: var(--ink); border-color: var(--border); background: transparent; }
button.ghost:hover, a.ghost:hover { border-color: var(--accent); color: var(--accent); }
a.btn-link, label.btn-link { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; font-size: var(--fs); white-space: nowrap; }
.card, table, details.set-sec, details.od-sec { border-color: var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }

/* sidebar: the active page gets a terracotta bar */
#side nav button { position: relative; }
#side nav button.on { background: var(--nav-active); color: var(--ink); }
#side nav button.on .mi { color: var(--accent); }
#side nav button.on::before { content: ""; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
#side nav button .mi { color: var(--muted); }
#side nav button b { background: var(--accent); }

/* KPI cards: one clean grid, never overflowing */
.grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { position: relative; text-align: right; padding: 14px 16px 12px; border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; min-width: 0; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.kpi b { display: block; font-size: clamp(1.25em, 2.2vw, 1.6em); font-weight: 700; color: var(--ink); line-height: 1.2;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.kpi b small { font-size: .55em; color: var(--muted); font-weight: 500; }
.kpi > span { display: block; font-size: .82em; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.kpi > small { display: block; font-size: .72em; color: var(--muted); margin-top: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.kpi-ic { position: absolute; left: 12px; top: 12px; font-style: normal; width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; background: var(--card-2); color: var(--muted); }
.kpi-ic .mi { font-size: 18px; margin: 0; }
.kpi.good b { color: var(--ok); } .kpi.good .kpi-ic { background: var(--ok-soft); color: var(--ok); }
.kpi.warn b { color: var(--warn); } .kpi.warn .kpi-ic { background: var(--warn-soft); color: var(--warn); }
.kpi.bad b { color: var(--bad); } .kpi.bad .kpi-ic { background: var(--bad-soft); color: var(--bad); }
.kpi.bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }

/* dashboard filters: quick ranges + dates + downloads on one line, wrapping cleanly */
.dash-filters { gap: 10px; }
.range-chips { display: inline-flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.range-chip { background: transparent !important; color: var(--muted) !important; border: none; padding: 5px 10px !important;
  border-radius: 7px !important; font-size: .85em !important; cursor: pointer; }
.range-chip.on, .range-chip:hover { background: var(--accent-soft) !important; color: var(--accent) !important; }
.dl-group { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-right: auto; }

/* system status: glowing dots, green / yellow / red */
.hp { position: relative; gap: 6px; padding: 3px 10px 3px 9px; border: 1px solid var(--border); background: var(--card); color: var(--ink); }
.hp .mi { display: none; }
.hp::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.hp.ok { background: var(--card); color: var(--ink); } .hp.ok::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft), 0 0 8px var(--ok); }
.hp.warn::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft), 0 0 8px var(--warn); }
.hp.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.hp.bad::before { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent), 0 0 10px var(--bad); animation: pulse 1.6s ease-in-out infinite; }
.hp.off { background: transparent; color: var(--muted); } .hp.off::before { background: var(--border-strong); }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .hp.bad::before { animation: none; } .kpi { transition: none; } }

/* toasts */
#toasts { position: fixed; bottom: 18px; left: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--card); color: var(--ink); border: 1px solid var(--border);
  border-inline-start: 4px solid var(--ok); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-lg); font-size: .9em;
  opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; overflow-wrap: anywhere; }
.toast.in { opacity: 1; transform: none; }
.toast .mi { color: var(--ok); margin: 0; flex-shrink: 0; }
.toast.error { border-inline-start-color: var(--bad); } .toast.error .mi { color: var(--bad); }
.toast.warn { border-inline-start-color: var(--warn); } .toast.warn .mi { color: var(--warn); }
.toast.info { border-inline-start-color: var(--accent); } .toast.info .mi { color: var(--accent); }

/* top bar controls */
.refresh-sel { padding: 5px 8px; font-size: .85em; border-radius: 9px; max-width: 150px; }

/* RTL text never overflows its box */
.card, .kpi, td, .wa-conv-body, .bell-item, .chip { overflow-wrap: anywhere; }
.chip { background: var(--mint); color: var(--ink); }
.stage { background: var(--mint); color: var(--ink); }
.tag { background: var(--mint); }

/* tablets and phones: sidebar collapses, top bar wraps, controls stay reachable */
@media (max-width: 1100px) { .hide-sm { display: none; } }
@media (max-width: 900px) {
  .refresh-sel { max-width: 120px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-group { margin-right: 0; }
  .range-chips { flex-wrap: wrap; }
  #toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (max-width: 330px) { .grid { grid-template-columns: 1fr; } }
.topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 900px) { .topbar h1 { font-size: 1.05em; } .kpi { padding: 12px; } .kpi-ic { width: 26px; height: 26px; } }
.alert-warning { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--ink); }
.alert-warning .mi { color: var(--warn); }
.wa-closed { background: var(--warn-soft); border-top-color: var(--border); color: var(--ink); }
.wa-preview, .wa-conv-top small, .wa-hours, .wa-who small, .wa-meta, .wa-none { color: var(--muted); }
.wa-chip { background: var(--wa-panel); color: var(--muted); }
.wa-search input { background: var(--wa-panel); color: var(--ink); }
.wa-info-card, .wa-info-sec { border-bottom-color: var(--wa-panel); }
@media (max-width: 900px) {
  .topbar h1 { min-width: 92px; flex: 1 1 92px; }
  .refresh-sel { max-width: 92px; padding: 5px 4px; font-size: .78em; }
}

/* ── Readable buttons in both themes (contrast check 2026-10-31) ──────────────
   Button colours have their own tokens: the dark theme lightens --green / --navy for text, and white
   text on those light shades was unreadable (2.5–2.8:1). Every pair below is ≥ 4.5:1. */
:root { --btn-primary: #4B6743; --btn-primary-hover: #3F5838; --btn-alt: #21387F; --btn-on: #FFFFFF; --chip-line: var(--border-strong); }
:root[data-theme="dark"] { --btn-primary: #4E6B45; --btn-primary-hover: #5A7A50; --btn-alt: #2E4A9E; --chip-line: #3A3F3C; }
button[type=submit], button:not(.ghost):not(.alt):not(.call-action):not(.move-btn):not([data-tab]):not(.icon-btn):not(.wa-chip):not(.range-chip):not(.danger):not(.alt-accent):not([role=tab]):not(.tile):not(.slot):not(.plain) {
  background: var(--btn-primary); color: var(--btn-on); }
button:not(.ghost):not(.alt):not(.call-action):not(.move-btn):not([data-tab]):not(.icon-btn):not(.wa-chip):not(.range-chip):not(.danger):not(.alt-accent):not([role=tab]):not(.tile):not(.slot):not(.plain):hover {
  background: var(--btn-primary-hover); opacity: 1; }
button.alt { background: var(--btn-alt); color: var(--btn-on); }
/* call outcomes: fixed colours that read on any theme */
.call-action { border: 1px solid transparent; }
.call-action.confirmed { background: var(--btn-primary); color: #fff; }
.call-action.canceled { background: #B91C1C; color: #fff; }
.call-action.no_answer, .call-action.busy { background: #FCD34D; color: #1F2420; }
.call-action.rejected { background: #C2410C; color: #fff; }
.call-action.postponed { background: var(--btn-alt); color: #fff; }
.call-action.wrong_number { background: #4B5563; color: #fff; }
.call-action:not(.confirmed):not(.canceled):not(.no_answer):not(.busy):not(.rejected):not(.postponed):not(.wrong_number) {
  background: var(--card); color: var(--ink); border-color: var(--chip-line); }
/* WhatsApp labels and other chips: a visible outline on any background */
.wa-chip { border: 1px solid var(--chip-line); background: var(--card); color: var(--ink); }
.wa-chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.move-btn { background: var(--card); color: var(--ink); border-color: var(--chip-line); }
select { border-color: var(--chip-line); }
.icon-btn { color: var(--muted); }
:root[data-theme="dark"] .icon-btn { color: #C9CEC9; }
/* terracotta as text needs a deeper shade on light backgrounds (bars and dots keep --accent) */
:root { --accent-ink: #A3451C; } :root[data-theme="dark"] { --accent-ink: #F2A07C; }
.wa-chip.on, .range-chip.on, .range-chip:hover { color: var(--accent-ink) !important; }
button.ghost:hover, a.ghost:hover { color: var(--accent-ink); }
.icon-btn { color: #4F5651; }
:root[data-theme="dark"] .icon-btn { color: #C9CEC9; }

.stars-1, .stars-2 { color: #B3261E; } .stars-3 { color: #8A6D00; } .stars-4, .stars-5 { color: #B5502A; }     /* terracotta, darkened to 4.5:1 on white */

#solve-dlg { width: min(440px, calc(100vw - 32px)); margin: auto; }   /* the global reset sets margin 0 */
#solve-dlg label { display: grid; gap: 4px; margin-bottom: 12px; font-weight: 600; }
#solve-dlg select, #solve-dlg input { width: 100%; font-weight: normal; }

.qh-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 8px; }
.qh { background: var(--card, #fff); border: 1px solid var(--line, #e5e5e5); border-radius: 10px; padding: 10px 12px; display: grid; }
.qh b { font-size: 1.5em; } .qh small { color: var(--muted); }
.qh-late { border-color: #B3261E; } .qh-late b { color: #B3261E; }

/* French interface (i18n.js sets html[dir=ltr]): the same layout, mirrored */
html[dir="ltr"] body, html[dir="ltr"] dialog { direction: ltr; font-family: "IBM Plex Sans", "IBM Plex Sans Arabic", sans-serif; }
html[dir="ltr"] th, html[dir="ltr"] table.data th, html[dir="ltr"] #side nav button, html[dir="ltr"] .kpi,
html[dir="ltr"] .wa-qr button, html[dir="ltr"] .pos .tile { text-align: left; }
html[dir="ltr"] body { padding-right: 0; padding-left: var(--side-w); }
html[dir="ltr"] #side { right: auto; left: 0; }
html[dir="ltr"] #side nav button b { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .chip b, html[dir="ltr"] .chip-sm { margin-right: 0; margin-left: 4px; }
html[dir="ltr"] .wa-info { border-right: 0; border-left: 1px solid var(--wa-line); }
html[dir="ltr"] #guide-body ol, html[dir="ltr"] details.script ol { padding-right: 0; padding-left: 20px; }
html[dir="ltr"] .kpi-ic { left: auto; right: 12px; }
html[dir="ltr"] button .mi, html[dir="ltr"] .tag .mi, html[dir="ltr"] .chip .mi, html[dir="ltr"] h3 .mi, html[dir="ltr"] h4 .mi,
html[dir="ltr"] p .mi, html[dir="ltr"] .alert-warning .mi { margin-left: 0; margin-right: 3px; }
html[dir="ltr"] #toasts { left: auto; right: 18px; }
@media (max-width: 900px) {
  html[dir="ltr"] body { padding-left: 0; }
  html[dir="ltr"] #side { transform: translateX(-100%); box-shadow: 8px 0 24px rgba(0,0,0,.18); }
  html[dir="ltr"] body.side-open #side { transform: none; }
}

/* dashboard (2026-10-31): status tiles, map card, bar lists, details in tabs */
.health-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
.health-card > summary::-webkit-details-marker { display: none; }
.hs-title { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hs-title > .mi { color: var(--c-primary); font-size: 22px; }
.health-card[open] .hs-more { visibility: hidden; }
.hs-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 12px 0 6px; }
.hs-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--c-surface); text-align: center; }
.hs-ic { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.hs-ic > .mi:first-child { font-size: 22px; }
.hs-dot { position: absolute; bottom: -4px; inset-inline-end: -4px; font-size: 16px !important; background: var(--c-surface); border-radius: 50%; }
.hs-name { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.hs-state { font-size: 11px; color: var(--muted); }
.hs-tile.ok .hs-ic { background: #E3F2E8; color: #1F6B3A; } .hs-tile.ok .hs-dot { color: #1F6B3A; }
.hs-tile.bad { border-color: #E9B4B4; } .hs-tile.bad .hs-ic { background: #F9E0E0; color: #9B1C1C; } .hs-tile.bad .hs-dot { color: #9B1C1C; }
.hs-tile.warn .hs-ic { background: #FDEEE7; color: #B8461A; } .hs-tile.warn .hs-dot { color: #B8461A; }
.hs-tile.off .hs-ic { background: #EEF0EC; color: #6B7A62; } .hs-tile.off .hs-dot { color: #8A8F8A; }
.dash-main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; margin: 12px 0; }
@media (max-width: 900px) { .dash-main { grid-template-columns: 1fr; } }
.dash-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dash-card-head h3, .dash-side h3 { margin: 0 0 8px; font-size: 1em; display: flex; align-items: center; gap: 6px; }
.dash-side h3 + * { margin-bottom: 14px; }
.dash-map { min-height: 260px; display: grid; place-items: center; }
.dash-map .mm-pt:hover circle:last-child, .dash-map .mm-pt:focus circle:last-child { fill-opacity: 1; stroke: var(--ink); }
.dash-map .mm-pt:focus { outline: none; }
.dash-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; margin: 6px 0 0; }
.dash-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.barlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.barlist li { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; align-items: center; gap: 8px; font-size: 13px; }
.barlist li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist li i { display: block; height: 10px; border-radius: 6px; background: var(--c-primary); opacity: .8; }
.barlist.alt li i { background: var(--c-accent); }
.barlist li b { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: end; }
.dash-more .tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.dash-more [role=tab] { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; color: var(--muted);
  font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.dash-more [role=tab][aria-selected=true] { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }
.hs-head { display: flex; align-items: center; justify-content: space-between; }
.hs-details > summary { cursor: pointer; font-size: 13px; padding: 4px 0; }
.hs-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.hs-tile { flex-direction: row; align-items: center; text-align: start; gap: 8px; padding: 6px 8px; }
.hs-tile .hs-ic { flex: none; width: 32px; height: 32px; border-radius: 9px; }
.hs-tile .hs-ic > .mi:first-child { font-size: 19px; }
.hs-tile > .hs-name { flex: 1; min-width: 0; font-size: 12px; }
.hs-tile > .hs-state { display: none; }
.hs-tile.bad > .hs-state, .hs-tile.warn > .hs-state { display: block; font-size: 10.5px; }
.hs-word { display: block; font-size: 10.5px; font-weight: 400; color: var(--muted); }
.hs-tile.bad .hs-word { color: #9B1C1C; } .hs-tile.warn .hs-word { color: #B8461A; }

/* sidebar: find a page, fold groups */
.nav-find { display: flex; align-items: center; gap: 6px; margin: 4px 12px 6px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--c-surface); }
.nav-find .mi { font-size: 18px; color: var(--muted); }
.nav-find input { border: 0; outline: 0; background: none; font: inherit; font-size: 13px; width: 100%; color: var(--ink); padding: 0; }
.nav-head { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: .72em; font-weight: 600; color: #8A9585; padding: 4px 14px; letter-spacing: .03em; }
.nav-head .mi { font-size: 18px; transition: transform .15s ease; }
#side .nav-group.folded > button[data-tab] { display: none; }   /* #side: beats the sidebar button style */
.nav-group.folded .nav-head .mi { transform: rotate(90deg); }
html[dir="ltr"] .nav-group.folded .nav-head .mi { transform: rotate(-90deg); }
#side.finding .nav-group.folded > button[data-tab]:not(.merged):not(.in-hub) { display: flex; }
#side nav button.nomatch, #side .nav-group.nomatch { display: none !important; }

/* نظرة مباشرة: panel + zoomable map (after Shopify Live View) */
.live-card { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 0; padding: 0; overflow: hidden; margin: 12px 0; min-height: 560px; }
.live-card:fullscreen { min-height: 100vh; border-radius: 0; background: var(--bg); }
@media (max-width: 900px) { .live-card { grid-template-columns: 1fr; } .live-mapwrap { order: -1; } }
.live-panel { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 760px; overflow-y: auto; background: var(--bg); }
.live-card:fullscreen .live-panel { max-height: 100vh; }
.live-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.live-head h3 { margin: 0; font-size: 1.05em; display: flex; align-items: center; gap: 8px; }
.live-head select { font: inherit; font-size: 12.5px; padding: 3px 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--c-surface); color: var(--ink); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #1A9BE6; box-shadow: 0 0 0 0 rgba(26,155,230,.6); animation: livepulse 2s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(26,155,230,.55); } 70% { box-shadow: 0 0 0 8px rgba(26,155,230,0); } 100% { box-shadow: 0 0 0 0 rgba(26,155,230,0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.live-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.live-kpi, .live-box { background: var(--c-surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; }
.live-kpi span { display: block; font-size: 12px; color: var(--muted); }
.live-kpi b { display: block; font-size: 1.25em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 30px; display: block; }
.spark polyline { fill: none; stroke: #1A9BE6; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark polygon { fill: rgba(26,155,230,.12); }
.spark.alt polyline { stroke: var(--c-primary); } .spark.alt polygon { fill: rgba(75,103,67,.12); }
.live-box h4 { margin: 0 0 8px; font-size: 13px; }
.live-funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.live-funnel div { border-inline-start: 1px solid var(--border); padding-inline-start: 6px; }
.live-funnel div:first-child { border: 0; padding: 0; }
.live-funnel span { display: block; font-size: 11px; color: var(--muted); line-height: 1.3; min-height: 2.6em; }
.live-funnel b { font-size: 1.1em; }
.live-box .barlist li i { background: #1A9BE6; }
.live-box .barlist.alt li i { background: var(--c-primary); }
.live-legend2 { display: flex; gap: 14px; font-size: 12px; margin: 0 0 6px; }
.live-legend2 i, .live-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: -1px; }
.live-legend2 i.n, .split i.n { background: #1A9BE6; } .live-legend2 i.r, .split i.r { background: #6C47E0; }
.split { display: flex; gap: 3px; height: 30px; border-radius: 6px; overflow: hidden; }
.split i { display: block; min-width: 3px; }
.live-note { font-size: 11px; margin: 0; }
.live-mapwrap { position: relative; display: flex; flex-direction: column; min-height: 420px; }
.live-map { flex: 1; min-height: 420px; }
.live-legend { position: absolute; bottom: 10px; inset-inline-start: 10px; margin: 0; font-size: 12px; background: var(--c-surface);
  border-radius: 20px; padding: 4px 10px; box-shadow: var(--shadow); }
.live-legend i { background: #1A9BE6; }
.lmap { position: relative; overflow: hidden; background: #E8EAED; touch-action: none; cursor: grab; user-select: none; }
.lmap.grab { cursor: grabbing; }
.lm-tiles img { position: absolute; left: 0; top: 0; filter: grayscale(.85) contrast(1.05); pointer-events: none; image-rendering: -webkit-optimize-contrast; }
html[data-theme="dark"] .lm-tiles img, .dark .lm-tiles img { filter: grayscale(1) invert(.9) brightness(.9) contrast(.9); }
.lm-pts { position: absolute; inset: 0; pointer-events: none; }
.lm-pt { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid rgba(255,255,255,.9); padding: 0;
  background: rgba(26,155,230,.62); box-shadow: 0 1px 4px rgba(0,0,0,.18); pointer-events: auto; cursor: pointer; }
.lm-pt:hover, .lm-pt:focus-visible { background: rgba(26,155,230,.9); outline: none; }
.lm-tip { position: absolute; transform: translate(-50%, calc(-100% - 18px)); background: var(--c-surface); color: var(--ink); border-radius: 10px;
  padding: 6px 10px; font-size: 12.5px; box-shadow: var(--shadow-lg); pointer-events: none; white-space: nowrap; z-index: 3; }
.lm-ctl { position: absolute; top: 10px; inset-inline-end: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.lm-ctl button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--c-surface); color: var(--ink);
  font: 600 18px/1 inherit; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); }
.lm-ctl button .mi { font-size: 19px; }
.lm-attr { position: absolute; bottom: 2px; inset-inline-end: 6px; font-size: 10px; color: #555; background: rgba(255,255,255,.75); padding: 0 4px; border-radius: 4px; }

/* system status network */
.health-card { background: #0A0F24; color: #E7EBFF; border-color: #1C2550; }
.health-card .hs-title b { color: #fff; } .health-card .muted { color: #9AA6D8; } .health-card .warn-text { color: #FFB38A; }
.health-card .hs-title > .mi { color: #8EA2FF; }
.health-card .hs-details > summary { color: #9AA6D8; }
.health-card .hs-details table td { border-color: #1C2550; color: #C9D1F5; }
.sg { width: 100%; height: auto; display: block; margin: 4px 0; }
.sg-edge { stroke: #3A4A9A; stroke-width: 1.4; opacity: .85; }
.sg-edge.side { stroke-width: 1; opacity: .45; }
.sg-edge.ok { stroke: #4FD1A5; stroke-dasharray: 6 10; animation: sgflow 1.6s linear infinite; }
.sg-edge.warn { stroke: #F2A35E; } .sg-edge.bad { stroke: #FF6B6B; stroke-width: 2; } .sg-edge.off { stroke: #2C3770; stroke-dasharray: 3 6; }
@keyframes sgflow { to { stroke-dashoffset: -32; } }
@media (prefers-reduced-motion: reduce) { .sg-edge.ok { animation: none; } }
.sg-hub circle { fill: #5B7CFA; stroke: #C7D2FF; stroke-width: 2; }
.sg-node circle { stroke-width: 2.5; }
.sg-node.ok circle { stroke: #4FD1A5; } .sg-node.warn circle { stroke: #F2A35E; } .sg-node.bad circle { stroke: #FF6B6B; } .sg-node.off circle { stroke: #3A4580; }
.sg-node { cursor: pointer; outline: none; }
.sg-node:hover circle, .sg-node:focus circle { fill: #1D2A66; }
.sg-ic { font-family: "Material Symbols Rounded"; font-size: 20px; text-anchor: middle; fill: #E7EBFF; }
.sg-hub .sg-ic { font-size: 26px; fill: #fff; }
.sg-node.off .sg-ic { fill: #7884B8; }
.sg-label { font: 600 12.5px "IBM Plex Sans Arabic", sans-serif; text-anchor: middle; fill: #DCE2FF; }
.sg-node.off .sg-label { fill: #8C97C9; }
.hs-pick { font-size: 12.5px; margin: 0 0 6px; min-height: 1.4em; }
/* the app's button style must not reach the map */
.lmap .lm-pt { all: unset; position: absolute; transform: translate(-50%, -50%); border-radius: 50%; box-sizing: border-box;
  border: 2px solid rgba(255,255,255,.9); background: rgba(26,155,230,.62); box-shadow: 0 1px 4px rgba(0,0,0,.18); pointer-events: auto; cursor: pointer; }
.lmap .lm-pt:hover, .lmap .lm-pt:focus-visible { background: rgba(26,155,230,.92); }
.lmap .lm-ctl button { all: unset; box-sizing: border-box; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--c-surface); color: var(--ink); font-size: 20px; font-weight: 600; line-height: 1; cursor: pointer; display: grid;
  place-items: center; box-shadow: var(--shadow); }
.lmap .lm-ctl button:hover { border-color: #1A9BE6; color: #1A9BE6; }
.lmap .lm-ctl button:focus-visible { outline: 2px solid #1A9BE6; }
.lmap { touch-action: pan-y; }
.lm-tiles, .lm-pts { position: absolute; inset: 0; will-change: transform; }
.lm-hint { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20,24,22,.42); color: #fff;
  font-weight: 600; font-size: 15px; pointer-events: none; z-index: 4; text-align: center; padding: 20px; }
.lm-hint[hidden] { display: none; }
/* status network in SHAAN colours, real logos (2026-10-31, owner) */
.health-card { background: #15211A; border-color: #24352A; color: #E9F0E6; }
.health-card .muted { color: #A9BBA4; } .health-card .hs-title > .mi { color: #8DB580; } .health-card .warn-text { color: #F4A47E; }
.health-card .hs-details > summary { color: #A9BBA4; } .health-card .hs-details table td { border-color: #24352A; color: #D3DECF; }
.sg-edge { fill: none; stroke: #3E5640; stroke-width: 1.4; opacity: .9; }
.sg-edge.side { stroke-width: 1; opacity: .5; }
.sg-edge.ok { stroke: #8DB580; stroke-dasharray: 5 9; animation: sgflow 2.4s linear infinite; }
.sg-edge.warn { stroke: #E66E3E; } .sg-edge.bad { stroke: #FF6B6B; stroke-width: 2; } .sg-edge.off { stroke: #34483A; stroke-dasharray: 2 6; }
.sg-hub circle { fill: #4B6743; stroke: none; } .sg-hub .sg-hub-ring { fill: none; stroke: #E66E3E; stroke-width: 2; }
.sg-brand { font: 700 15px "IBM Plex Sans", sans-serif; fill: #fff; text-anchor: middle; letter-spacing: .02em; }
.sg-ring { fill: #1C2B22; stroke-width: 2.5; }
.sg-node.ok .sg-ring { stroke: #8DB580; } .sg-node.warn .sg-ring { stroke: #E66E3E; } .sg-node.bad .sg-ring { stroke: #FF6B6B; } .sg-node.off .sg-ring { stroke: #3A4E3F; }
.sg-dot { stroke: #15211A; stroke-width: 2; }
.sg-node.ok .sg-dot { fill: #6FCF97; } .sg-node.warn .sg-dot { fill: #E66E3E; } .sg-node.bad .sg-dot { fill: #FF6B6B; } .sg-node.off .sg-dot { fill: #6B7D6E; }
.sg-node.off > circle:not(.sg-ring):not(.sg-dot), .sg-node.off .sg-logo { opacity: .55; }
.sg-logo { filter: invert(1); }
.sg-own { fill: #2A3D30; }
.sg-word { font: 800 8.5px "IBM Plex Sans", sans-serif; fill: #1B2A20; text-anchor: middle; letter-spacing: .02em; }
.sg-mini { font-size: 13px !important; fill: #fff; }
.sg-label { fill: #DCE6D8; } .sg-node.off .sg-label { fill: #93A58F; }
.sg-node:hover .sg-ring, .sg-node:focus .sg-ring { fill: #26382C; }
.sg-node.off > circle:not(.sg-ring):not(.sg-dot), .sg-node.off .sg-logo { opacity: .8; }
.sg-word { font-size: 9.5px; }
.sg-pill rect { fill: #1C2B22; stroke: #3E5640; }
.sg-pill text { font: 600 11px "IBM Plex Sans", sans-serif; fill: #A9BBA4; text-anchor: middle; }
.sg-pill.on rect { fill: #24382B; stroke: #8DB580; } .sg-pill.on text { fill: #E9F0E6; }
.sg-ago { font: 400 10.5px "IBM Plex Sans Arabic", sans-serif; fill: #93A58F; text-anchor: middle; }

/* المخططات: the visual flow editor */
.fl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.fl-templates { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 14px; }
.fl-tpl p { font-size: 12.5px; margin: 6px 0 10px; }
.fl-switch { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.fl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.fl-name { font: 600 15px inherit; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; background: transparent; color: var(--ink); min-width: 14em; }
.fl-name:hover, .fl-name:focus { border-color: var(--border); background: var(--c-surface); }
.fl-warn { margin-bottom: 8px; }
.fl-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; height: calc(100vh - 210px); min-height: 520px; }
@media (max-width: 900px) { .fl-wrap { grid-template-columns: 1fr; height: auto; } .fl-canvas { height: 70vh; } }
.fl-canvas { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; cursor: grab; touch-action: none; user-select: none;
  background-color: var(--c-surface); background-image: radial-gradient(var(--border) 1.2px, transparent 1.2px); background-size: 18px 18px; }
.fl-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; direction: ltr; }
.fl-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.fl-edge { fill: none; stroke: #8A8F8A; stroke-width: 1.8; }
.fl-edge.no { stroke: #D9534F; stroke-dasharray: 5 4; }
.fl-edge.hit { stroke: #1F9D55; stroke-width: 3; }
.fl-blabel { display: inline-block; font: 600 11px "IBM Plex Sans Arabic", sans-serif; background: #E7F5EC; color: #1F6B3A; border-radius: 10px;
  padding: 2px 8px; direction: rtl; white-space: nowrap; }
.fl-blabel.no { background: #FBE7E6; color: #9B1C1C; }
.fl-node { position: absolute; background: var(--c-surface); border: 1.6px solid var(--border); border-radius: 12px; padding: 8px 10px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); direction: rtl; cursor: pointer; min-height: 64px; }
.fl-node.t-trigger { border-color: #A855F7; } .fl-node.t-condition { border-color: #F59E0B; } .fl-node.t-action { border-color: #22A06B; }
.fl-node.t-wait { border-color: #E5484D; } .fl-node.t-await { border-color: #0EA5A4; }
.fl-node.sel { box-shadow: 0 0 0 3px rgba(75,103,67,.25); } .fl-node.hit { outline: 3px solid #1F9D55; outline-offset: 2px; }
.fl-nh { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.fl-nh .mi { font-size: 18px; } .t-trigger .fl-nh .mi { color: #A855F7; } .t-condition .fl-nh .mi { color: #F59E0B; } .t-action .fl-nh .mi { color: #22A06B; }
.t-wait .fl-nh .mi { color: #E5484D; } .t-await .fl-nh .mi { color: #0EA5A4; }
.fl-ns { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fl-tr { font-size: 11px; margin-top: 4px; color: #1F6B3A; background: #E7F5EC; border-radius: 6px; padding: 1px 6px; }
.fl-x { all: unset; margin-inline-start: auto; cursor: pointer; color: var(--muted); font-size: 16px; padding: 0 4px; }
.fl-x:hover { color: #D9534F; }
.fl-add { all: unset; position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%;
  background: #1F2420; color: #fff; display: grid; place-items: center; font-size: 15px; cursor: pointer; }
.fl-add:hover { background: #4B6743; }
.fl-menu { position: absolute; z-index: 5; background: var(--c-surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; display: grid; gap: 2px; min-width: 180px; max-height: 60%; overflow-y: auto; }
.fl-menu button { all: unset; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.fl-menu button:hover { background: var(--bg); } .fl-menu .mi { font-size: 18px; }
.fl-mh { font-size: 11px; font-weight: 700; color: var(--muted); padding: 6px 8px 2px; }
.fl-zoom { position: absolute; bottom: 10px; inset-inline-start: 10px; display: flex; flex-direction: column; gap: 4px; }
.fl-zoom button { all: unset; width: 32px; height: 32px; border-radius: 9px; background: var(--c-surface); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 18px; cursor: pointer; box-shadow: var(--shadow); }
.fl-zoom .mi { font-size: 18px; }
.fl-hint { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20,24,22,.35); color: #fff; font-weight: 600; pointer-events: none; }
.fl-hint[hidden] { display: none; }
.fl-side { border: 1px solid var(--border); border-radius: 14px; background: var(--c-surface); padding: 12px; overflow-y: auto; }
.fl-side h4 { margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.fl-help { padding-inline-start: 18px; font-size: 13px; line-height: 1.7; }
.fl-log { list-style: none; padding: 0; margin: 0; font-size: 12.5px; display: grid; gap: 8px; }

/* ── page header: icon, section, page name ─────────────────────────────────── */
.topbar h1 { display: flex; align-items: center; gap: 10px; }
.pt-ic { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.pt-ic .mi { font-size: 20px; margin: 0; }
.pt-crumb { font-size: .62em; font-weight: 500; color: var(--muted); white-space: nowrap; }
.pt-crumb::after { content: "›"; margin-inline: 6px; opacity: .6; }
.pt-name { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .pt-crumb { display: none; } .pt-ic { width: 28px; height: 28px; } }

/* ── every page: one look (toolbars, sections, tables, headings) ───────────── */
.tab.on { animation: tabin .18s ease; }
@keyframes tabin { from { transform: translateY(4px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .tab.on { animation: none; } }
.tab > .filters, .mod-root > .filters, .tab > form.filters { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 10px 12px; box-shadow: var(--shadow); }
.tab h2, .mod-root h2 { font-size: 1.12em; font-weight: 700; display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; }
.tab h3, .mod-root h3 { font-size: 1em; font-weight: 600; display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }
.tab h2 .mi, .tab h3 .mi, .mod-root h2 .mi, .mod-root h3 .mi { color: var(--accent); font-size: 20px; }
table { overflow: hidden; }
th { font-size: .8em; letter-spacing: .01em; padding-block: 9px; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
details.set-sec > summary { list-style: none; }
details.set-sec > summary::-webkit-details-marker { display: none; }
details.set-sec > summary::after { content: "expand_more"; font-family: "Material Symbols Rounded"; font-size: 20px; margin-inline-start: auto;
  color: var(--muted); transition: transform .15s ease; }
details.set-sec[open] > summary::after { transform: rotate(180deg); }
details.set-sec > summary .mi { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--card-2); color: var(--accent); font-size: 18px; }
details.set-sec.hub-flash { animation: hubflash 1.4s ease; }
@keyframes hubflash { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: var(--shadow); } }
.empty { padding: 26px 12px; text-align: center; color: var(--muted); }
.empty .mi { font-size: 36px; opacity: .55; display: block; margin: 0 auto 6px; }

/* ── sidebar footer: settings, and the pages that now live inside it ───────── */
.nav-foot { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
#side nav button.in-hub { display: none; }
#side.finding nav button.in-hub:not(.nomatch) { display: flex; }

/* ── settings in one place ─────────────────────────────────────────────────── */
.hub-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hub-head h2 { margin: 0 0 2px; }
.hub-head p { margin: 0; }
.hub-find { margin: 0; min-width: 240px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.hub-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: 14px;
  transition: border-color .15s ease, box-shadow .15s ease; }
.hub-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.hub-card header { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.hub-card header b { display: block; }
.hub-card header small { display: block; color: var(--muted); font-size: .8em; line-height: 1.4; }
.hub-ic { width: 38px; height: 38px; border-radius: 11px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.hub-items { display: flex; flex-direction: column; }
button.plain.hub-item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 6px;
  border-radius: 8px; cursor: pointer; font-size: .92em; color: var(--ink); }
button.plain.hub-item:hover { background: var(--nav-hover); }
button.plain.hub-item:focus-visible { outline: 2px solid var(--accent); }
.hub-item .mi { font-size: 19px; color: var(--muted); }
.hub-item span:not(.mi) { flex: 1; min-width: 0; }
.hub-item > .mi:last-child { font-size: 18px; opacity: .6; }
html[dir="ltr"] .hub-item > .mi:last-child { transform: scaleX(-1); }
.hub-item[hidden], .hub-card[hidden] { display: none; }
.hub-below { margin-top: 26px !important; color: var(--muted); }

/* ── محطة السكان ──────────────────────────────────────────────────────────── */
.station { display: flex; flex-direction: column; gap: 12px; }
.station:fullscreen { background: var(--bg); padding: 18px; overflow-y: auto; }
.st-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 4px; flex-wrap: wrap; }
.seg button.plain { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: .92em; }
.seg button.plain:hover { color: var(--ink); background: var(--nav-hover); }
.seg button.plain.on { background: var(--accent); color: #fff; }
.seg button.plain:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.st-opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: .88em; }
.st-opts .switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.st-scan { display: flex; align-items: center; gap: 8px; background: var(--card); border: 2px solid var(--accent); border-radius: 18px;
  padding: 8px 10px 8px 8px; box-shadow: var(--shadow-lg); }
.st-scan:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent), var(--shadow-lg); }
.st-scan-ic { font-size: 30px; color: var(--accent); padding-inline: 6px; }
.st-scan input { flex: 1; min-width: 0; border: 0 !important; outline: 0 !important; background: none; font-size: 1.35em; font-weight: 600;
  padding: 8px 4px; direction: ltr; text-align: right; letter-spacing: .02em; }
.st-scan input::placeholder { font-weight: 400; font-size: .78em; letter-spacing: 0; }
.st-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .st-main { grid-template-columns: 1fr; } }
.st-side { display: flex; flex-direction: column; gap: 10px; }
.st-side .card { margin: 0; }
.st-kpis .dash-row { grid-template-columns: repeat(3, 1fr) !important; margin: 0 !important; }
.st-kpis .kpi { padding: 10px 12px; }
.st-result { min-height: 300px; margin: 0; display: flex; flex-direction: column; gap: 10px; border-width: 2px; transition: border-color .2s ease, background-color .2s ease; }
.st-result.tone-ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 7%, var(--card)); }
.st-result.tone-warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--card)); }
.st-result.tone-bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--card)); }
.st-result.tone-info { border-color: #1A9BE6; }
.st-result.flash { animation: stflash .5s ease; }
@keyframes stflash { 0% { transform: scale(.985); } 60% { transform: scale(1.005); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .st-result.flash { animation: none; } }
.st-idle { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); text-align: center; }
.st-idle .mi { font-size: 64px; color: color-mix(in srgb, var(--accent) 55%, var(--muted)); }
.st-idle b { font-size: 1.3em; color: var(--ink); }
.st-msg { display: flex; align-items: center; gap: 10px; font-size: 1.25em; }
.st-msg .mi { font-size: 40px; }
.tone-ok .st-msg .mi { color: var(--ok); } .tone-warn .st-msg .mi { color: var(--warn); } .tone-bad .st-msg .mi { color: var(--bad); }
.tone-info .st-msg .mi { color: #1A9BE6; }
.st-order { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.st-order-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 1.1em; margin-bottom: 2px; }
.st-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.st-lines li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); font-size: 1.05em; }
.st-lines li span:not(.mi) { flex: 1; min-width: 0; }
.st-lines li b { font-variant-numeric: tabular-nums; }
.st-lines li.done { border-color: var(--ok); background: var(--ok-soft); }
.st-lines li.done .mi { color: var(--ok); }
.st-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.st-errs { margin: 0; padding-inline-start: 20px; color: var(--bad); font-size: .9em; }
.st-hours { display: flex; align-items: flex-end; gap: 3px; height: 92px; }
.st-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; }
.st-bar i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 55%, var(--card)); }
.st-bar.now i { background: var(--accent); }
.st-bar span { font-size: 10px; color: var(--muted); }
.st-hint { font-size: .85em; margin: 0 0 8px; }
.st-batches { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.st-batches li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.st-batches li:last-child { border: 0; }
.st-help ul { margin: 8px 0 0; padding-inline-start: 18px; line-height: 1.9; font-size: .92em; }
.st-help summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 6px; }
iframe.st-print { position: fixed; width: 1px; height: 1px; left: -9999px; top: 0; border: 0; opacity: 0; }
.st-lines small, .st-batches small { margin-inline-start: 8px; }

/* team: departments */
.dept-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.dept-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.dept-card > .mi, .dept-opt > .mi { width: 34px; height: 34px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); font-size: 19px; }
.dept-card b, .dept-opt b { display: block; }
.dept-card small, .dept-opt small { display: block; color: var(--muted); font-size: .8em; line-height: 1.45; margin: 2px 0 6px; }
.dept-who { display: flex; flex-wrap: wrap; gap: 4px; }
.dept-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.dept-pick { display: grid; gap: 8px; max-width: 520px; }
.dept-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.dept-opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.dept-opt input { margin-top: 9px; }

/* merged pages: one sidebar entry, tabs at the top of the page */
#side nav button.merged { display: none; }
#side.finding nav button.merged:not(.nomatch) { display: flex; }
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 14px; padding: 4px; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; width: fit-content; max-width: 100%; box-shadow: var(--shadow); }
.subtabs button.plain { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: .9em; }
.subtabs button.plain .mi { font-size: 18px; }
.subtabs button.plain:hover { color: var(--ink); background: var(--nav-hover); }
.subtabs button.plain.on { background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.subtabs button.plain:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── phones ───────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* the notifications open as a sheet under the top bar instead of running off the screen */
  .bell-panel { position: fixed; top: 64px; left: 10px; right: 10px; width: auto; max-height: calc(100vh - 90px); z-index: 80;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border); border-radius: 16px; }
  .refresh-sel { display: none; }
  .topbar { gap: 2px; padding: 8px 8px; }
  .topbar .icon-btn { padding: 6px; }
  .topbar #sync { padding: 5px 8px; }
  .topbar h1 { min-width: 70px; flex: 1 1 70px; font-size: 1em; }
  main { padding-inline: 12px; overflow-x: clip; }
  .st-top { flex-direction: column; align-items: stretch; }
  .seg { display: grid; grid-template-columns: repeat(4, 1fr); }
  .seg button.plain { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: .78em; justify-content: center; }
  .st-opts { justify-content: space-between; gap: 8px; }
  .st-scan input { font-size: 1.05em; }
  .st-result { min-height: 200px; }
  .hub-find { min-width: 0; width: 100%; }
  .subtabs { width: 100%; }
  dialog { max-width: calc(100vw - 20px); }
}
.st-cam-big { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px; font-size: 1.15em;
  border-radius: 16px; font-weight: 700; }
.st-cam-big .mi { font-size: 28px; }
.st-printinfo { margin: -4px 0 0; font-size: .85em; display: flex; align-items: center; gap: 6px; }
a.st-print-big { font-size: 1.1em; padding: 12px 18px; background: var(--btn-primary); color: var(--btn-on); border-color: transparent; }

/* camera scanner */
.cam-dlg { width: min(480px, calc(100vw - 20px)); }
.cam-box { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.cam-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-aim { position: absolute; inset: 22% 12%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.cam-box.hit .cam-aim { animation: camhit .5s ease; }
@keyframes camhit { 0% { border-color: #3CCB6E; transform: scale(1.04); } 100% { border-color: rgba(255,255,255,.85); transform: none; } }
.st-printer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .88em; padding: 10px 12px; border: 1px dashed var(--border-strong);
  border-radius: 12px; background: var(--card); }
.st-printer .tag .mi { font-size: 15px; vertical-align: -3px; }
.st-printer-sw b { font-weight: 600; }
.st-pname { width: 150px; padding: 4px 8px; font-size: .95em; }
.st-kiosk { flex-basis: 100%; }
.st-kiosk summary { cursor: pointer; font-size: .92em; }
.st-printed { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.st-send-sw.live { color: var(--warn); font-weight: 700; }
.st-send-sw.live::after { content: "· كوليس حقيقي"; font-weight: 600; font-size: .85em; margin-inline-start: 4px; }
html[dir="ltr"] .st-send-sw.live::after { content: "· real parcel"; }

/* الكوليسات عند AMEEX */
.pc-code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; }
.pc-dlg { width: min(980px, calc(100vw - 20px)); }
.pc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pc-order { background: var(--card-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; line-height: 1.7; }
.pc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .pc-cols { grid-template-columns: 1fr; } }
.pc-cols section { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; max-height: 420px; overflow: auto; }
.pc-cols h4, .pc-dlg h4 { margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.pc-tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pc-tl li { border-inline-start: 3px solid var(--border-strong); padding-inline-start: 10px; }
.pc-tl li:first-child { border-color: var(--accent); }
table.pc-info { box-shadow: none; border: 0; font-size: .85em; }
table.pc-info th { text-align: start; font-weight: 500; color: var(--muted); background: none; width: 45%; word-break: break-all; }
table.pc-info td { word-break: break-word; }
.pc-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pc-sum > div { border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; background: var(--card); }
.pc-sum small { display: block; font-size: .75em; }
.pc-sum b { font-weight: 600; font-size: .92em; overflow-wrap: anywhere; }

/* Document settings (admcompany.js): sections on the side, image cards, colour chips */
.set-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.set-head kbd { border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; font-size: var(--fs-sm); }
.set-layout { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.set-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px; position: sticky; top: 8px; }
.set-nav button { display: flex; gap: 10px; align-items: center; text-align: start; background: none; color: inherit; border: 0; padding: 10px; border-radius: var(--radius); }
.set-nav button span { display: flex; flex-direction: column; min-width: 0; }
.set-nav button small { color: var(--text-muted, #656B67); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-nav button.on { background: var(--c-brand, #4B6743); color: #fff; }
.set-nav button.on small { color: rgba(255, 255, 255, .85); }
.set-body h4 { margin-top: 0; display: flex; gap: 6px; align-items: center; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.set-imgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.set-img { margin: 0; }
.set-drop { position: relative; border: 2px dashed var(--border); border-radius: var(--radius); min-height: 140px; display: flex; flex-direction: column;
  gap: 8px; align-items: center; justify-content: center; padding: 12px; margin-bottom: 8px; }
.set-drop img { max-height: 120px; object-fit: contain; }
.set-del { position: absolute; top: 6px; inset-inline-end: 6px; }
.set-chip { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
.set-chip.on { border-color: var(--text, #1F2420); box-shadow: 0 0 0 2px #fff inset; }
dialog.doc-preview { width: min(960px, 96vw); }
@media (max-width: 760px) {
  .set-layout { grid-template-columns: 1fr; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; }
  .set-nav button { flex: 0 0 auto; }
  .set-nav button small { display: none; }
}

/* Document pages (Devis, Factures, Avoirs, BL, Bons de commande): the page name and one clear « + new » button */
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.doc-head h3 { margin: 0; font-size: var(--fs-xl, 1.35rem); }
.doc-new { font-size: 1rem; padding: 12px 20px; border-radius: 12px; display: inline-flex; gap: 6px; align-items: center; box-shadow: 0 2px 8px rgba(75, 103, 67, .25); }
