/* Shared look for the control center and the manager dashboard.
   Same design language as the Creators Hub (creators.percent-labs.com):
   Percent Labs palette, light header with the lockup, pill buttons,
   brand colours, automatic dark mode. */
:root {
  --bg: #F3EEE3; --surface: #FBF8F2; --sunk: #EAE3D5; --line: #DCD3C2; --line-2: #E8E1D3; --fg: #0C0D0C; --muted: #5E5A52; --faint: #8F897C;
  --ember: #FF301B; --ember-ink: #C41F0D; --deep: #7A0D08; --on-ember: #FFFFFF;
  --good: #1E7A4A; --good-bg: #DCEFE3; --warn: #9A5B00; --warn-bg: #F7E6C6; --bad: #A5281E; --bad-bg: #F6DAD5;
  --app: #2D3A8C; --app-bg: #E6E8F6; --hl: #FBEFC2; --hover: #F6F1E6; --hot-row: #FCEDEA;
  --bunzo: #28A5B1; --nash: #791010; --broasty: #D9781A; --rocky: #D6408F; --daboos: #E8590C; --wing: #7D828A;
  --logo-disc: #0C0D0C; --shadow: 0 6px 24px rgba(12,13,12,.12);
  --r: 12px;
  /* old names used by page styles */
  --card: var(--surface); --rule: var(--line); --rule-2: var(--line-2); --bone: var(--sunk); --ink: var(--fg);
  --ok: var(--good); --alarm: var(--bad); --soft-ok: var(--good-bg); --soft-warn: var(--warn-bg); --soft-ember: var(--bad-bg); --soft-alarm: var(--bad-bg); --track: var(--sunk); --radius: var(--r);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E0F0E; --surface: #171817; --sunk: #1F201E; --line: #2F302C; --line-2: #262724; --fg: #F3EEE3; --muted: #A39D90; --faint: #7D786E;
  --ember: #FF4A35; --ember-ink: #FF6B58; --deep: #FF8F80; --on-ember: #0C0D0C;
  --good: #5FCB8E; --good-bg: #16301F; --warn: #E8B04F; --warn-bg: #33270F; --bad: #F07D70; --bad-bg: #3A1714;
  --app: #A9B3F5; --app-bg: #1E2340; --hl: #3A3112; --hover: #1C1D1B; --hot-row: #2A1513;
  --bunzo: #4CC3CE; --nash: #E0605A; --broasty: #F1902A; --rocky: #F27BB8; --daboos: #FF7A33; --wing: #A3A8B0;
  --logo-disc: #FF301B; --shadow: 0 6px 24px rgba(0,0,0,.5); color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0E0F0E; --surface: #171817; --sunk: #1F201E; --line: #2F302C; --line-2: #262724; --fg: #F3EEE3; --muted: #A39D90; --faint: #7D786E;
  --ember: #FF4A35; --ember-ink: #FF6B58; --deep: #FF8F80; --on-ember: #0C0D0C;
  --good: #5FCB8E; --good-bg: #16301F; --warn: #E8B04F; --warn-bg: #33270F; --bad: #F07D70; --bad-bg: #3A1714;
  --app: #A9B3F5; --app-bg: #1E2340; --hl: #3A3112; --hover: #1C1D1B; --hot-row: #2A1513;
  --bunzo: #4CC3CE; --nash: #E0605A; --broasty: #F1902A; --rocky: #F27BB8; --daboos: #FF7A33; --wing: #A3A8B0;
  --logo-disc: #FF301B; --shadow: 0 6px 24px rgba(0,0,0,.5); color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 160px; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: 'Zain', 'Space Grotesk', system-ui, sans-serif; font-size: 15.5px; line-height: 1.5; }
.num, .latin { font-family: 'Space Grotesk', 'Zain', system-ui, sans-serif; font-variant-numeric: tabular-nums; }
span.num, b.num, .big.num, a.num { direction: ltr; unicode-bidi: isolate; }
/* LTR numbers shown as their own line still sit on the right (RTL page) */
.sub.num, .big.num, div.num { text-align: right; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { background: var(--surface); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* header — like the Creators Hub */
header.top { background: var(--bg); color: var(--fg); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
.bar { max-width: 1320px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mark { display: flex; align-items: center; gap: 12px; margin-inline-end: auto; }
.lockup { height: 26px; width: auto; display: block; flex: none; direction: ltr; }
.lg-disc { fill: var(--logo-disc); } .lg-mark { fill: #FFFFFF; } .lg-word { fill: var(--fg); } .lg-labs { fill: #FF301B; }
.mark-sep { width: 1px; height: 28px; background: var(--line); flex: none; }
.mark h1 { font-size: 19px; font-weight: 800; margin: 0; line-height: 1.15; }
.mark small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.meta-dim { font-size: 13px; color: var(--muted); }
.linkbtn { background: none; border: 1px solid var(--line); color: var(--fg); padding: 5px 13px; border-radius: 999px; cursor: pointer; }
.linkbtn:hover { border-color: var(--fg); }
.livedot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.livedot i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.livedot.off i { background: var(--ember); }
.themebtn { border: 1px solid var(--line); background: var(--surface); color: var(--fg); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.catcell { min-width: 0; max-width: 150px; }
.catcell b { font-size: 14.5px; }
.catcell .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main.wrap { max-width: 1320px; margin: 0 auto; padding: 16px 16px 80px; display: grid; gap: 16px; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.panel-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.panel-body { padding: 14px 16px; }
.panel.alarm { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.panel.alarm > .panel-head { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.panel.alarm > .panel-head h2 { color: var(--bad); }
.count { background: var(--sunk); border-radius: 99px; padding: 0 9px; font-size: 13px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.hint { font-size: 14px; color: var(--muted); }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }
.push { margin-inline-start: auto; }

/* buttons & inputs — pills like the hub */
.btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 15px; border-radius: 999px; cursor: pointer; font-weight: 700; white-space: nowrap; line-height: 1.3; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--fg); }
.btn.primary, .btn.ember { background: var(--ember); color: var(--on-ember); border-color: var(--ember); }
.btn.primary:hover, .btn.ember:hover { filter: brightness(.95); }
.btn.dark { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.ok { background: var(--good); color: #fff; border-color: var(--good); }
.btn.sm { padding: 3px 11px; font-size: 13.5px; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--sunk); border-color: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn:disabled { opacity: .45; cursor: default; }
.field { display: grid; gap: 4px; }
.field label, .flabel { font-weight: 800; font-size: 14px; }
.input, select.input, textarea.input { border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; background: var(--surface); width: 100%; }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.6; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 4px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--fg); color: var(--bg); }
.tog { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 3px 12px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); font-size: 14px; }
.tog:hover { border-color: var(--fg); }
.tog i { width: 9px; height: 9px; border-radius: 50%; background: var(--bc, var(--muted)); flex: none; }
.tog.on { color: var(--fg); border-color: var(--bc, var(--fg)); box-shadow: inset 0 0 0 1px var(--bc, var(--fg)); }
.tog.all.on { background: var(--sunk); border-color: var(--line); box-shadow: none; }

/* filter bar (both pages) */
.fbar { position: sticky; top: 59px; z-index: 12; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; display: grid; gap: 8px; box-shadow: 0 4px 14px rgba(12,13,12,.05); }
.fbar .frow { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.fbar .fl { font-size: 12.5px; font-weight: 800; color: var(--muted); min-width: 52px; }
.fbar .nav { display: inline-flex; align-items: center; gap: 6px; }
.fbar .nav button { border: 1px solid var(--line); background: var(--surface); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-weight: 800; }
.fbar .nav button:disabled { opacity: .35; cursor: default; }
.fbar .rangeTxt { font-weight: 800; }
.fbar .custom input { border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; }
.fbar .cmpNote { font-size: 12.5px; color: var(--muted); }
.fbar { padding: 8px 10px; gap: 6px; }
.fbar .fmain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fbar .search { flex: 1 1 180px; max-width: 320px; margin-inline-start: auto; padding: 4px 12px; border-radius: 999px; min-height: 34px; }
.fbar .fbtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 0 14px; min-height: 34px; font: inherit; font-weight: 800; cursor: pointer; }
.fbar .fbtn::before { content: ''; width: 14px; height: 10px; background: linear-gradient(currentColor 0 0) top/100% 2px no-repeat, linear-gradient(currentColor 0 0) center/70% 2px no-repeat, linear-gradient(currentColor 0 0) bottom/40% 2px no-repeat; }
.fbar .fbtn.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.fbar .fcount { background: var(--ember); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: 12px; padding: 0 5px; }
.fbar .factive { display: flex; flex-wrap: wrap; gap: 6px; }
.fbar .fchip { border: 0; background: var(--sunk); color: var(--fg); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.fbar .fclear { border: 0; background: none; color: var(--ember-ink); font: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer; }
.fbar .fmore { display: grid; gap: 8px; border-top: 1px solid var(--line-2); padding-top: 8px; }
@media (max-width: 820px) { .fbar { position: static; } }
@media (max-width: 640px) {
  .fbar .seg { order: 1; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .fbar .seg button { flex: 1 0 auto; padding-inline: 10px; font-size: 14.5px; }
  .fbar .nav { order: 2; }
  .fbar .custom { order: 2; }
  .fbar .fbtn { order: 3; margin-inline-start: auto; }
  .fbar .search { order: 4; flex: 1 1 100%; max-width: none; margin: 0; }
  .fbar .fmore .fl { min-width: 0; flex: 1 0 100%; }
}

/* pills / chips / badges */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px; border-radius: 99px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.mute { background: var(--sunk); color: var(--muted); }
.chips { display: flex; flex-wrap: nowrap; gap: 4px; overflow: hidden; align-items: center; }
.chip { background: var(--sunk); border-radius: 6px; padding: 0 7px; font-size: 13.5px; white-space: nowrap; }
.chip.app { background: var(--app-bg); color: var(--app); }
.chip.more { background: none; color: var(--muted); padding: 0 2px; }
.badge { display: inline-block; border-radius: 6px; padding: 0 6px; font-size: 13px; font-weight: 800; white-space: nowrap; vertical-align: 1px; }
.badge.old { background: var(--warn-bg); color: var(--warn); }
button.badge { border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 800; }
.badge.rpt { background: color-mix(in srgb, var(--ember) 14%, var(--surface)); color: var(--ember-ink); margin-inline-start: 4px; font-family: 'Space Grotesk', sans-serif; }
.badge.rpt:hover { background: var(--ember); color: var(--on-ember); }
.badge.vip { background: linear-gradient(135deg, #E9B949, #C8901A); color: #2A1A00; font-family: 'Space Grotesk', sans-serif; letter-spacing: .04em; margin-inline-start: 4px; }
.badge.direct { background: color-mix(in srgb, #1F7A5A 14%, var(--surface)); color: #1F7A5A; margin-inline-start: 4px; white-space: nowrap; }
:root[data-theme="dark"] .badge.direct { color: #5FD3A6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.direct { color: #5FD3A6; } }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.ov-vip { background: color-mix(in srgb, #E9B949 22%, var(--surface)); border: 1px solid color-mix(in srgb, #C8901A 45%, var(--line)); border-radius: 10px; padding: 10px 12px; font-weight: 800; }
.badge.r1 { background: var(--bad-bg); color: var(--bad); }
.badge.r2 { background: var(--sunk); color: var(--deep); }
.bdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bc, var(--muted)); margin-inline-end: 6px; vertical-align: 1px; }

/* tables: one line per row, equal heights */
.tablewrap { overflow-x: auto; position: relative; }
/* phones: short lines (.mlist) instead of tables; tap one → bottom sheet with everything */
.mlist { display: grid; gap: 6px; padding: 8px; }
.mrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 12px; cursor: pointer; min-height: 56px; -webkit-tap-highlight-color: transparent; }
.mrow:active { background: var(--hover); }
.mrow.hot { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: var(--hot-row); }
.m-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.m1, .m2 { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.m1 { font-size: 16px; }
.m1 .bdot { margin: 0; }
.m1 .m-k, .m1 .m-c { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.m1 b.m-c { color: var(--fg); }
.m1 .m-k::before, .m1 .m-c:not(b)::before { content: '·'; margin-inline-end: 6px; color: var(--faint); }
.m1 .badge { margin: 0; }
.m-t { margin-inline-start: auto; flex: none; padding-inline-start: 8px; color: var(--muted); font-size: 13px; }
.m2 { font-size: 14px; color: var(--muted); }
.m2 > span { flex: none; }
.m2 > .m-n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.m2 .wa { font-size: 12.5px; padding: 1px 8px; }
.m-acts { flex: 1 0 100%; }
.m-acts .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-acts .btn { min-height: 40px; padding-inline: 12px; justify-content: center; width: 100%; }
.m-call { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); text-decoration: none; font-size: 18px; }
@media (max-width: 640px) {
  .panel:has(> div > .mlist) .panel-head .hint, .panel:has(> .mlist) .panel-head .hint { display: none; }
  #page-now .panel { background: transparent; border: 0; box-shadow: none; }
  #page-now .panel-head { padding: 6px 6px 0; border: 0; background: transparent; }
  #page-now .panel-head h2 { font-size: 17px; }
  #page-now .mlist { padding: 4px 0 8px; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ov-panel { animation: none !important; } }
.ov-nav { padding: 8px 18px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ov-nav .btn[disabled] { opacity: .35; }
.ov-actions:not([hidden]) + .ov-nav { border-top: 1px solid var(--line-2); }
/* when a table is wider than its box, a soft edge shows there is more to scroll */
.tablewrap.more-l { box-shadow: inset 18px 0 14px -14px rgba(12,13,12,.22); }
.tablewrap.more-r { box-shadow: inset -18px 0 14px -14px rgba(12,13,12,.22); }
.tablewrap.more-l.more-r { box-shadow: inset 18px 0 14px -14px rgba(12,13,12,.22), inset -18px 0 14px -14px rgba(12,13,12,.22); }
table.grid { width: 100%; border-collapse: collapse; font-size: 15.5px; }
table.grid th { text-align: start; font-size: 13.5px; color: var(--muted); font-weight: 700; padding: 8px 8px; background: var(--sunk); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.grid td { padding: 8px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; height: 46px; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover td { background: var(--hover); }
table.grid td.wrap { white-space: normal; }
table.grid tr.hot td { background: var(--hot-row); }
table.grid tr.hot td.st { color: var(--bad); font-weight: 800; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--fg); }
.sort-ind { font-size: 10px; margin-inline-start: 4px; color: var(--ember); }

/* one-line text with "read more" */
.clip { display: flex; align-items: baseline; gap: 6px; max-width: 200px; min-width: 110px; }
.clip > .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clip.open { align-items: flex-start; }
.clip.open > .t { white-space: normal; }
.more-btn { flex: none; border: 0; background: none; color: var(--ember-ink); font-weight: 800; font-size: 12.5px; cursor: pointer; padding: 0; white-space: nowrap; }
.clip:not(.over):not(.open) .more-btn { display: none; }
td .sub { display: block; font-size: 13px; color: var(--muted); line-height: 1.2; }
.cust { display: flex; align-items: center; gap: 2px; }
.cust .nm { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust .badge { margin-inline-start: 4px; }
.chip.app { display: inline-block; vertical-align: middle; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1500px) {
  .clip { max-width: 140px; min-width: 90px; }
  .catcell { max-width: 130px; }
  .chip.app { max-width: 110px; }
  .cust .nm { max-width: 110px; }
  table.grid td, table.grid th { padding-inline: 6px; }
}
@media (max-width: 1280px) {
  table.grid td, table.grid th { padding-inline: 6px; }
  table.grid { font-size: 15px; }
  .clip { max-width: 130px; min-width: 80px; }
  .catcell { max-width: 110px; }
  .cust .nm { max-width: 100px; }
  .chip.app { max-width: 105px; }
}
.oid { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; font-weight: 800; text-decoration: underline; text-decoration-color: var(--ember); text-underline-offset: 3px; }
.oid:hover { color: var(--ember-ink); }
.wa { font-size: 14.5px; font-weight: 700; white-space: nowrap; }
.wa.sent, .wa.called { color: var(--good); }
.wa.waiting, .wa.review { color: var(--warn); }
.wa.no_whatsapp { color: var(--bad); }
.wa.failed, .wa.bad_phone { color: var(--deep); }
.wa.not_sent, .wa.cancelled, .wa.old, .wa.data { color: var(--faint); }
.stars { display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px; border-radius: 999px; font-size: 14px; font-weight: 800; white-space: nowrap; background: var(--warn-bg); color: var(--warn); }
.stars.s1 { background: var(--bad-bg); color: var(--bad); }
.stars.s3 { background: var(--sunk); color: var(--muted); }
.showmore { display: flex; justify-content: center; gap: 10px; align-items: center; padding: 10px; border-top: 1px solid var(--line-2); }

/* category tree (main → sub) */
.cat { display: grid; gap: 2px; margin: 4px 0 10px; }
.cat-legend { margin: 0 0 10px; font-size: 13px; }
.cat-row { display: grid; gap: 5px; font-size: 15px; padding: 2px 0; }
.cat-row .c-top { display: flex; align-items: baseline; gap: 8px; }
.cat-row .c-name { flex: 1; min-width: 0; }
.cat-row .c-sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.cat-row.main { font-weight: 800; cursor: pointer; }
.cat-row.sub { font-size: 13.5px; color: var(--muted); padding-inline-start: 18px; }
.cat-row .track { height: 8px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.cat-row .fill { height: 100%; background: var(--ember); border-radius: 99px; }
.cat-row.sub .fill { background: color-mix(in srgb, var(--ember) 55%, var(--sunk)); }
.cat-row .pct { font-size: 15px; }
.owner { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--sunk); border-radius: 6px; padding: 0 6px; margin-inline-start: 12px; display: inline-block; line-height: 1.6; }

/* side panel */
.ov { position: fixed; inset: 0; background: rgba(12,13,12,.45); display: none; justify-content: flex-start; z-index: 55; }
.ov.show { display: flex; }
.ov-panel.wide { width: min(820px, 100%); }
.ov-panel { background: var(--surface); width: min(560px, 100%); height: 100%; overflow-y: auto; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.ov-head { position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; gap: 10px; align-items: flex-start; z-index: 1; }
.ov-head h3 { margin: 0; font-size: 20px; font-weight: 800; }
.ov-head .meta { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.ov-x { margin-inline-start: auto; background: var(--surface); border: 1px solid var(--line); color: var(--fg); border-radius: 50%; width: 34px; height: 34px; cursor: pointer; font-size: 18px; line-height: 1; flex: none; }
.ov-body { padding: 16px 18px 24px; display: grid; gap: 16px; flex: 1; align-content: start; }
.ov-foot { position: sticky; bottom: 0; background: var(--surface); z-index: 1; }
.ov-foot:has(> :not([hidden])) { border-top: 1px solid var(--line); }
.ov-actions { padding: 12px 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.ov-sec h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); font-weight: 800; }
.ov-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ov-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ov-time { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.ov-time b { display: block; font-size: 16px; }
.ov-time.old { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-bg); }
.ov-quote { font-size: 16.5px; line-height: 1.6; margin: 0; }
.ov-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; margin: 0; }
.ov-kv dt { color: var(--muted); }
.ov-kv dd { margin: 0; font-weight: 700; }
.ov-items { list-style: none; margin: 0; padding: 0; }
.ov-items li { padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.ov-items li:last-child { border-bottom: 0; }
.ov-line { display: flex; gap: 10px; align-items: baseline; }
.ov-qty { flex: none; min-width: 30px; text-align: center; background: var(--sunk); border-radius: 6px; font-weight: 800; }
.ov-name { font-weight: 800; }
.ov-price { margin-inline-start: auto; color: var(--muted); }
.ov-menu { font-size: 12.5px; color: var(--muted); margin-inline-start: 40px; }
.ov-opts { margin: 4px 0 0; padding-inline-start: 40px; font-size: 14px; color: var(--muted); list-style: none; }
.ov-inote { margin: 6px 0 0; margin-inline-start: 40px; background: var(--hl); border-radius: 8px; padding: 5px 10px; font-size: 14.5px; }
.ov-hit .ov-name { color: var(--deep); }
.ov-hit .ov-name::after { content: ' ← اشتكى منه'; font-size: 12px; font-weight: 700; color: var(--ember-ink); }
.ov-onote { background: var(--hl); border-radius: 10px; padding: 10px 12px; }
.ov-total { display: flex; justify-content: space-between; font-weight: 800; padding-top: 8px; }
.ov-raw { white-space: pre-wrap; font-size: 13px; color: var(--muted); background: var(--sunk); border-radius: 8px; padding: 10px; margin-top: 8px; }
.ov-alert { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-weight: 800; }
.ov-done { background: var(--good-bg); color: var(--good); border-radius: 10px; padding: 10px 12px; font-weight: 700; }

/* dialogs */
.overlay { position: fixed; inset: 0; background: rgba(12,13,12,.5); display: none; place-items: center; z-index: 58; padding: 16px; }
.overlay.show { display: grid; }
.modal { background: var(--surface); border-radius: 16px; padding: 20px; width: min(460px, 100%); display: grid; gap: 12px; box-shadow: var(--shadow); }
.modal h3 { margin: 0; font-size: 19px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.checks label { display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.checks input { accent-color: var(--ember); }
.checks .grp { grid-column: 1 / -1; font-size: 12.5px; font-weight: 800; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; }
.toast.err { background: var(--bad); color: #fff; }

@media (max-width: 760px) {
  .lockup { height: 20px; }
  .mark small { display: none; }
  .mark h1 { font-size: 16px; }
  .checks { grid-template-columns: 1fr; }
  .ov-times { grid-template-columns: 1fr; }
}

/* overview (analytics) */

  .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
  .kpi { background: var(--surface); padding: 14px 16px; }
  .kpi h3 { margin: 0 0 2px; font-size: 13.5px; color: var(--muted); font-weight: 700; }
  .kpi .big { font-size: 30px; font-weight: 800; line-height: 40px; height: 40px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kpi .big.txt { font-size: 22px; }
  .kpi .sub { font-size: 13px; color: var(--muted); }
  .kpi.alarm { background: var(--bad-bg); }
  .kpi.alarm .big { color: var(--bad); }
  .delta { font-size: 13.5px; font-weight: 700; }
  .delta.up { color: var(--bad); }
  .delta.down { color: var(--good); }
  .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .trend { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 180px; padding-top: 16px; }
  .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
  .col .v { font-size: 12px; color: var(--muted); }
  .col .b { width: 100%; max-width: 44px; background: color-mix(in srgb, var(--ember) 45%, var(--sunk)); border-radius: 5px 5px 0 0; min-height: 2px; }
  .col.cur .b { background: var(--ember); }
  .col .l { font-size: 11px; color: var(--muted); white-space: nowrap; }
  .col.cur .l { color: var(--fg); font-weight: 800; }
  .trend.hours { gap: 3px; }
  .trend-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; scrollbar-width: thin; }
  .trend.tips { height: 290px; padding-top: 92px; }
  .trend.tips .col { position: relative; cursor: default; outline: none; }
  .trend.tips .col .l { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: center; line-height: 1.2; }
  .trend.tips .col .l small { display: block; font-size: 10.5px; color: var(--faint); }
  .trend.tips .col:hover .b, .trend.tips .col:focus .b { background: var(--ember); }
  .col .tip { display: none; position: absolute; top: -88px; left: 50%; transform: translateX(-50%); z-index: 3; background: var(--fg); color: var(--bg); border-radius: 8px; padding: 6px 9px; font-size: 12px; line-height: 1.35; white-space: nowrap; text-align: center; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
  .col .tip b { display: block; font-size: 12.5px; }
  .col .tip .chg { display: block; font-weight: 800; font-size: 13px; }
  .col .tip .chg.up { color: #FF8A7A; } .col .tip .chg.down { color: #7FD6A0; }
  .col .tip .hint { color: inherit; opacity: .75; font-size: 11px; }
  .col:hover .tip, .col:focus .tip { display: block; }
  .trend.tips .col:first-child .tip { left: auto; right: 0; transform: none; }
  .trend.tips .col:last-child .tip { left: 0; transform: none; }
  .trend.hours .col .b { max-width: 30px; }
  .trend.hours .col.peak .b { background: var(--ember); }
  .trend.hours .col.peak .v { color: var(--ember-ink); font-weight: 800; }
  @media (max-width: 820px) { .two { grid-template-columns: 1fr; } }
  @media (max-width: 480px) { .kpi .big { font-size: 24px; } }

/* WhatsApp conversation inside an order (customer on the right, us on the left, like WhatsApp in Arabic) */
.chatlog { display: flex; flex-direction: column; gap: 6px; background: var(--sunk); border-radius: 14px; padding: 12px; max-height: 420px; overflow-y: auto; }
.bub { max-width: 82%; border-radius: 14px; padding: 7px 11px 5px; background: var(--surface); box-shadow: 0 1px 0 rgba(12,13,12,.06); align-self: flex-start; }
.bub.bot, .bub.agent { align-self: flex-end; background: color-mix(in srgb, #25D366 16%, var(--surface)); }
.bub.bot { background: color-mix(in srgb, #25D366 8%, var(--surface)); }
.bub-who { font-size: 12px; font-weight: 800; color: var(--muted); }
.bub.customer .bub-who { color: var(--ember-ink); }
.bub-t { white-space: pre-wrap; word-break: break-word; font-size: 15.5px; line-height: 1.5; }
.bub-media { color: var(--muted); font-weight: 700; }
.bub-m { font-size: 11.5px; color: var(--muted); text-align: end; margin-top: 2px; }
.live { color: #1F9D55; font-size: 12px; font-weight: 800; margin-inline-start: 4px; }
.oc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.badge.chat { background: color-mix(in srgb, #25D366 18%, var(--surface)); color: #13703B; margin-inline-start: 4px; }
.badge.oc-retained { background: var(--good-bg); color: var(--good); margin-inline-start: 4px; }
.badge.oc-no_reply { background: var(--sunk); color: var(--muted); margin-inline-start: 4px; }
.badge.oc-refused { background: var(--bad-bg); color: var(--bad); margin-inline-start: 4px; }
:root[data-theme="dark"] .badge.chat { color: #6EE7A0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.chat { color: #6EE7A0; } }
.m2 .m-c2 { font-weight: 700; color: var(--fg); max-width: 32%; overflow: hidden; text-overflow: ellipsis; flex: 0 0 auto; }
.m2 > span:not(.m-c2):not(.m-n) { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.m2 .badge, .m1 .badge { white-space: nowrap; flex: none; }

/* phones: the order / customer details slide up from the bottom (after the panel rules on purpose) */
@media (max-width: 640px) {
  .ov { align-items: flex-end; justify-content: stretch; }
  .ov-panel, .ov-panel.wide { width: 100%; height: auto; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; animation: sheet-up .22s ease-out; }
  .ov-head { border-radius: 22px 22px 0 0; padding-top: 20px; }
  .ov-head::before { content: ''; position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 9px; background: var(--line); }
  .ov-actions { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: 10px; }
  .ov-actions .btn { min-height: 46px; justify-content: center; font-size: 16px; }
  #ovNav { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* phones: 24 hour bars fit without the labels running into each other — every 3rd hour labelled */
@media (max-width: 640px) {
  .trend.hours { gap: 2px; height: 170px; }
  .trend.hours .col .v { font-size: 10.5px; }
  .trend.hours .col .b { border-radius: 3px 3px 0 0; }
  .trend.hours .col .l { font-size: 11px; overflow: visible; }
  .trend.hours .col:not(:nth-child(3n+1)) .l { visibility: hidden; }
}
.m-flag { flex: none; font-size: 12.5px; font-weight: 800; border-radius: 999px; padding: 1px 8px; }
.m-flag.bad { background: var(--bad-bg); color: var(--bad); }
.m-flag.warn { background: var(--warn-bg); color: var(--warn); }
.m2 .m-n { color: var(--muted); }
.mrow .m1 b { font-weight: 800; }

/* overview on phones: 2×2 numbers, hour list instead of 24 thin bars */
.hourlist { display: grid; gap: 7px; }
.hl { display: grid; grid-template-columns: 96px 1fr 28px; gap: 10px; align-items: center; font-size: 14.5px; }
.hl .hl-h { color: var(--muted); }
.hl .track { height: 10px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.hl .fill { height: 100%; border-radius: 99px; background: color-mix(in srgb, var(--ember) 55%, var(--sunk)); }
.hl.peak .fill { background: var(--ember); }
.hl.peak .hl-h, .hl.peak b { color: var(--ember-ink); font-weight: 800; }
.hl b { text-align: end; }
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr !important; }
  .kpi { padding: 10px 12px !important; }
  .kpi h3 { font-size: 12.5px !important; }
  .kpi .big { font-size: 24px !important; line-height: 30px !important; height: 30px !important; }
  .kpi .big.txt { font-size: 15.5px !important; white-space: normal !important; height: auto !important; line-height: 1.3 !important; min-height: 30px; }
  .kpi .sub { font-size: 12px !important; }
}
.m2 .m-code { color: var(--muted); font-size: 12.5px; letter-spacing: .02em; }
.m2 .m-rpt { color: var(--bad); font-weight: 800; }

/* order sheet: clear blocks */
.ov-card { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--surface); margin-bottom: 10px; }
.ov-card > h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 800; }
.ov-card .ov-quote { margin: 8px 0 4px; font-size: 17px; line-height: 1.55; }
.ov-card .ov-cats { font-size: 15.5px; }
.ov-line2 { margin-top: 6px; font-size: 14px; }
.ov-fold > summary { cursor: pointer; font-weight: 800; font-size: 15.5px; list-style: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ov-fold > summary::-webkit-details-marker { display: none; }
.ov-fold > summary::after { content: '▾'; margin-inline-start: auto; color: var(--muted); transition: transform .15s; }
.ov-fold[open] > summary::after { transform: rotate(180deg); }
.ov-fold[open] > summary { margin-bottom: 10px; }
.ov-fold .live { margin: 0 0 8px; }
.ov-onote { margin-top: 8px; font-size: 14px; }
/* phones: the filter's period choices stay on one line */
@media (max-width: 640px) {
  .fbar .seg { flex-wrap: nowrap !important; display: flex; border-radius: 999px; }
  .fbar .seg button { white-space: nowrap; }
  .panel-head .btn.sm { padding-inline: 10px; }
}
.hl .track, .cat-row .track { display: flex; justify-content: flex-start; }
.hl .fill, .cat-row .fill { flex: none; }
.ov-code { font-size: 12px; opacity: .6; }

/* customers' photos */
.badge.pic { background: var(--sunk); color: var(--fg); margin-inline-start: 4px; }
.ov-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.ov-pic { border: 0; padding: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--sunk); cursor: zoom-in; }
.ov-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picview { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; }
.picview.show { display: flex; }
.picview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.picview .pv-x { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 20px; cursor: pointer; }
.picview .pv-n { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 32px; cursor: pointer; border-radius: 12px; }
.picview .pv-prev { right: 10px; } .picview .pv-next { left: 10px; }
.picview .pv-c { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #fff; font-size: 15px; }
