/* pro.css — "Pro Desktop" executive skin (design_pro). Skylink 11 ONLY (Mujaddad: bespoke
 * best-client skin, not a product tier — see SKYLINK11_PRO_DESKTOP_PROGRESS.md).
 *
 * SCOPE: every rule is prefixed with [data-design="pro"] (shell.js stamps this on <html> only
 * for a shop with the design_pro flag ON — Skylink 11). Flag OFF ⇒ attribute absent ⇒ NONE of
 * this applies ⇒ the app renders v1 byte-for-byte. Rollback = flag off, no deploy. design_pro
 * takes precedence over design_v2 in the stamp, so a pro shop never also gets v2.css.
 *
 * APPROACH (the v2.css lesson): re-point the base CSS variables first — the whole app reads
 * var(--bg)/--ink/--brand/--card/--line/--radius/…, so swapping tokens reskins every surface at
 * the foundation without touching component markup/ids/handlers. Then a few CellPro-specific
 * component touches (dark sidebar, metric cards, tables) layer on top. ZERO logic/data/RPC change;
 * money-core + print/thermal/PNG/WhatsApp output CSS untouched (locked). Loaded AFTER base.css.
 *
 * CellPro reference tokens (skylink11-reference-cellpro-v2.html): ground #f4f7fb · surface #fff ·
 * ink #172033 · muted #718096 · accent blue #2563eb · profit #059669 · loss #dc2626 · line #e8edf5 ·
 * card radius 15 · dark sidebar #111827 / active #1e3a5f · Inter.
 */

/* ---------- 1. Tokens (LIGHT): re-point the base CSS variables to CellPro ---------- */
:root[data-design="pro"] {
  --ink: #172033;
  --ink-2: #2b3650;
  --muted: #718096;
  --brand: #2563eb;          /* CellPro blue (single accent) */
  --brand-2: #1e40af;
  --brand-soft: #e8f1ff;
  --amber: #9a3412;
  --amber-soft: #fff7ed;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --bg: #f4f7fb;             /* cool executive ground */
  --card: #ffffff;
  --surface: #ffffff;
  --soft: #eef3fa;
  --line: #e8edf5;
  --panel: #111827;         /* dark sidebar / panel */
  --on-panel: #e5edff;
  --radius: 15px;
  --radius-field: 10px;
  --shadow: 0 1px 2px rgba(23, 32, 51, .04), 0 5px 18px rgba(23, 32, 51, .07);
}

/* ---------- 1b. Tokens (DARK): proper CellPro dark set (fix #10 — dark mode was broken because
 * the light tokens above were ALSO applied to [data-theme="dark"]). Higher specificity (two attrs)
 * than base.css's [data-theme="dark"], so these win for a pro shop in dark mode. Accents stay on
 * the CellPro family but lightened for legibility on a dark ground. ---------- */
:root[data-design="pro"][data-theme="dark"] {
  --ink: #e6edf7;           /* light text on dark */
  --ink-2: #c3cfe2;
  --muted: #8b97ad;
  --brand: #3b82f6;         /* lighter CellPro blue reads on dark */
  --brand-2: #60a5fa;
  --brand-soft: #16233b;    /* soft blue wash, dark */
  --amber: #fbbf24;
  --amber-soft: #2a2010;
  --red: #f87171;           /* lighter red for dark legibility */
  --red-soft: #3a1b1b;
  --bg: #0b1220;            /* deep executive ground */
  --card: #121c31;          /* raised dark surface */
  --surface: #121c31;
  --soft: #1a2538;
  --line: #243149;
  --panel: #0a0f1a;         /* even darker sidebar than the body */
  --on-panel: #e5edff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
}
/* dark-mode surface touches: sidebar/topbar/cards/tables follow the tokens, but a few pro rules
 * below hardcode light hexes — re-point those for dark so the skin is coherent in both modes. */
:root[data-design="pro"][data-theme="dark"] .sidebar { background: #0a0f1a; border-right-color: #1b2740; }
:root[data-design="pro"][data-theme="dark"] .topbar { background: #0a0f1a; border-bottom-color: #1b2740; }
:root[data-design="pro"][data-theme="dark"] table th { color: #94a3b8; background: #16223a; }
:root[data-design="pro"][data-theme="dark"] table td,
:root[data-design="pro"][data-theme="dark"] table th { border-bottom-color: #243149; }
:root[data-design="pro"][data-theme="dark"] .pro-metric,
:root[data-design="pro"][data-theme="dark"] .pro-dash-panel { background: #121c31; }
:root[data-design="pro"][data-theme="dark"] .pro-metric .label,
:root[data-design="pro"][data-theme="dark"] .pro-metric .sub,
:root[data-design="pro"][data-theme="dark"] .pro-dash-date { color: #8b97ad; }
:root[data-design="pro"][data-theme="dark"] .pro-alert { background: #2a2010; border-color: #4a3310; color: #fbbf24; }
:root[data-design="pro"][data-theme="dark"] a.pro-alert:hover { background: #352817; }
:root[data-design="pro"][data-theme="dark"] .pro-alert-ok { background: #0f2a1e; border-color: #1c5440; color: #4ade80; }

/* ---------- 2. Typeface — Inter, executive feel ---------- */
:root[data-design="pro"] body {
  font-family: Inter, "Segoe UI", Arial, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* ---------- 3. Dark sidebar (CellPro navy) ---------- */
:root[data-design="pro"] .sidebar {
  background: #111827;
  border-right: 1px solid #1f2937;
}
:root[data-design="pro"] .nav-item {
  color: #cbd5e1;
  border-radius: 10px;
}
:root[data-design="pro"] .nav-item .ur { color: rgba(203, 213, 225, .62); }
:root[data-design="pro"] .nav-item:hover { background: #1e3a5f; color: #fff; }
:root[data-design="pro"] .nav-item.active { background: #1e3a5f; color: #fff; }
:root[data-design="pro"] .nav-item.active .ur { color: rgba(255, 255, 255, .8); }
:root[data-design="pro"] .nav-group-head { color: #93a4bd; letter-spacing: .02em; }
:root[data-design="pro"] .nav-group-head:hover { color: #e5edff; }
/* Munshi AI brand mark stays GREEN in pro (Mujaddad: match the green tick, not blue) — the one
 * place pro keeps the brand green instead of the CellPro accent, so the identity reads consistently.
 * The wordmark renders as `.brand-mark` (was picking up --brand-2 blue #1e40af); force it green. */
:root[data-design="pro"] .brand-mark,
:root[data-design="pro"] .topbar .logo b,
:root[data-design="pro"] .sidebar .brand b { color: #34d399 !important; }

/* ---------- 3b. Pro nav: his flat 15-item sidebar (hide the grouped hub nav) ---------- */
.pro-nav { display: none; }   /* hidden for every non-pro shop (plain v1/v2 render the grouped .nav-list) */
:root[data-design="pro"] .nav-list { display: none; }
:root[data-design="pro"] .pro-nav { display: flex; flex-direction: column; gap: 2px; padding: 2px; }
:root[data-design="pro"] .pro-nav-item {
  display: block; padding: 11px 13px; border-radius: 10px; color: #cbd5e1;
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
:root[data-design="pro"] .pro-nav-item:hover { background: #1e3a5f; color: #fff; }
:root[data-design="pro"] .pro-nav-item.active { background: #1e3a5f; color: #fff; }

/* ---------- 3c. #3 Section tab-leak (Mujaddad live-walk): a pro-nav item must land on ONLY its own
 * page — a section's subnav must NOT duplicate a pro-nav destination (clicking "Merchant Ledgers" and
 * seeing Customer/Wholesaler/… as page-tabs was the objection). STRIP any .subnav-tab that points to a
 * pro-nav route; the genuine orphan sub-views (Walk-in · Partner · Salesman · Loan · shop-to-shop ·
 * wholesaler khata — none have a pro-nav home) REMAIN, restyled as a slim SECONDARY FILTER row so they
 * read as "filter this ledger", not primary page navigation. FULL CAPTURE: nothing becomes unreachable
 * (the hidden ones are the pro-nav's own items); only duplication + the big-tab look are removed.
 * Scoped to pro; the grouped nav shops are byte-identical. The same rule generalises to /trade,
 * /exchange, /repairs. In-form toggles (.ex-key-toggle, [data-mm-dir], [data-adj-dir]) are NOT .subnav,
 * so they are untouched. ---------- */
:root[data-design="pro"] .subnav-tab[href="/counter"],
:root[data-design="pro"] .subnav-tab[href="/sell"],
:root[data-design="pro"] .subnav-tab[href="/trace"],
:root[data-design="pro"] .subnav-tab[href="/stock"],
:root[data-design="pro"] .subnav-tab[href="/customers"],
:root[data-design="pro"] .subnav-tab[href="/trade"],
:root[data-design="pro"] .subnav-tab[href="/vendors"],
:root[data-design="pro"] .subnav-tab[href="/exchange"],
:root[data-design="pro"] .subnav-tab[href="/repairs"],
:root[data-design="pro"] .subnav-tab[href="/register"],
:root[data-design="pro"] .subnav-tab[href="/reports"],
:root[data-design="pro"] .subnav-tab[href="/settings"],
/* retail pro-nav remaps these two to top-level items (Suppliers→/resellers, Dealers→/dukan), so the
 * Customers-page filter chips that point there are now duplicates → hide them too (capture via pro-nav). */
:root[data-design="pro"] .subnav-tab[href="/resellers"],
:root[data-design="pro"] .subnav-tab[href="/dukan"] { display: none; }
/* the remaining genuine sub-views → slim secondary filter row (not big page-tabs) */
:root[data-design="pro"] .subnav { gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
:root[data-design="pro"] .subnav-tab { font-size: 12.5px; padding: 5px 12px; border-radius: 999px; color: var(--muted); background: var(--soft); border: 1px solid transparent; font-weight: 600; }
:root[data-design="pro"] .subnav-tab:hover { color: var(--ink); background: var(--brand-soft); }
:root[data-design="pro"] .subnav-tab.active { color: var(--brand); background: var(--brand-soft); border-color: var(--brand); }

/* ---------- 4. Topbar — clean executive bar ---------- */
:root[data-design="pro"] .topbar {
  background: #0f172a;
  color: #e5edff;
  border-bottom: 1px solid #1f2937;
}
:root[data-design="pro"] .topbar .shopname { color: #fff; font-weight: 800; }
:root[data-design="pro"] .topbar .role { color: #93a4bd; }

/* ---------- 5. Cards / panels — white, radius-15, soft executive shadow ---------- */
:root[data-design="pro"] .card,
:root[data-design="pro"] .panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 6. Tables — CellPro header + row lines ---------- */
:root[data-design="pro"] table th {
  color: #64748b;
  background: #f8fafc;
  font-weight: 700;
  text-transform: none;
}
:root[data-design="pro"] table td,
:root[data-design="pro"] table th { border-bottom: 1px solid #edf1f6; }

/* ---------- 7. Buttons — CellPro blue primary, soft secondary ---------- */
:root[data-design="pro"] .btn-primary,
:root[data-design="pro"] .btn.primary {
  background: #2563eb; color: #fff; border-color: #2563eb;
}
:root[data-design="pro"] .btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
:root[data-design="pro"] .btn-ghost,
:root[data-design="pro"] .btn.secondary {
  background: #e8eef8; color: #1e3a5f; border-color: #dbe4f0;
}

/* ---------- 8. Profit / loss semantics (CellPro green/red) ---------- */
:root[data-design="pro"] .pos,
:root[data-design="pro"] .profit,
:root[data-design="pro"] .ctr-v.pos { color: #059669; font-weight: 700; }
:root[data-design="pro"] .neg,
:root[data-design="pro"] .loss,
:root[data-design="pro"] .ctr-v.neg { color: #dc2626; font-weight: 700; }

/* ---------- 9. Executive metric cards (dashboard — rendered by the pro dashboard view) ---------- */
:root[data-design="pro"] .pro-dash-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 20px;
}
:root[data-design="pro"] .pro-metric {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
:root[data-design="pro"] .pro-metric .label { font-size: 13px; color: #718096; }
:root[data-design="pro"] .pro-metric .metric { font-size: 25px; font-weight: 800; margin-top: 8px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
:root[data-design="pro"] .pro-metric .sub { font-size: 12.5px; color: #94a3b8; margin-top: 4px; }
:root[data-design="pro"] .pro-metric .metric.profit { color: #059669; }
:root[data-design="pro"] .pro-alert {
  background: #fff7ed; border: 1px solid #fed7aa; padding: 12px 14px; border-radius: 10px;
  color: #9a3412; font-size: 13.5px; margin-bottom: 10px;
}

/* ---------- 9b. Executive Dashboard view (design_pro counter branch) ---------- */
:root[data-design="pro"] .pro-dash-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px;
}
:root[data-design="pro"] .pro-dash-title { font-size: 24px; font-weight: 800; letter-spacing: -.01em; margin: 0; color: var(--ink); }
:root[data-design="pro"] .pro-dash-date { font-size: 13px; color: #94a3b8; font-weight: 600; }
:root[data-design="pro"] .pro-dash-main {
  display: grid; grid-template-columns: 2fr 1fr; gap: 15px; align-items: start;
}
:root[data-design="pro"] .pro-dash-panel { padding: 18px; }
:root[data-design="pro"] .pro-panel-head {
  font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 12px;
}
:root[data-design="pro"] .pro-dash-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
:root[data-design="pro"] .pro-dash-table th { padding: 8px 6px; }
:root[data-design="pro"] .pro-dash-table td { padding: 10px 6px; color: var(--ink); }
:root[data-design="pro"] .pro-panel-more {
  display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--brand); text-decoration: none;
}
:root[data-design="pro"] .pro-panel-more:hover { text-decoration: underline; }
:root[data-design="pro"] .pro-alerts { display: flex; flex-direction: column; gap: 8px; }
:root[data-design="pro"] a.pro-alert { display: block; text-decoration: none; }
:root[data-design="pro"] a.pro-alert:hover { background: #ffedd5; }
:root[data-design="pro"] .pro-alert-ok {
  background: #ecfdf5; border-color: #a7f3d0; color: #047857;
}

/* ---------- 9b-ii. Pro dash HUB (restored counter entry points: work-date + search/scan + tiles) ---------- */
:root[data-design="pro"] .pro-dash .ctr-datebar { margin-bottom: 16px; }
:root[data-design="pro"] .pro-dash-actions { margin-bottom: 15px; padding: 18px; }
:root[data-design="pro"] .pro-dash-actions .ctr-search { margin-bottom: 12px; }
:root[data-design="pro"] .pro-dash-actions #ctrResults:not(:empty) { margin-bottom: 12px; }
:root[data-design="pro"] .pro-dash-tiles { margin-top: 2px; }

/* ---------- 9c. Pro POS (New Sale): form LEFT + live invoice preview RIGHT ---------- */
:root[data-design="pro"] .pro-sell-grid {
  /* Mujaddad feedback #5: the live invoice preview must be the DOMINANT element ("a proper invoice on a
     bigger size"). Pick + form compress on the left; the preview takes the widest column. */
  display: grid; grid-template-columns: 0.9fr 1fr 1.5fr; gap: 15px;
}
:root[data-design="pro"] .pro-sell-preview {
  position: sticky; top: 14px; align-self: start; padding: 26px 24px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, .1); border: 1px solid var(--line);
  min-width: 340px;   /* stays a prominent "proper invoice" even when the row is space-tight */
}
:root[data-design="pro"] .pro-sell-preview .pro-prev-shop { font-size: 21px; }
:root[data-design="pro"] .pro-sell-preview .pro-prev-items { font-size: 15.5px; }
:root[data-design="pro"] .pro-sell-preview .pro-prev-r { font-size: 15px; padding: 7px 0; }
:root[data-design="pro"] .pro-sell-preview .pro-prev-bal { font-size: 19px; }
:root[data-design="pro"] .pro-prev-head {
  border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 12px;
}
:root[data-design="pro"] .pro-prev-shop { font-size: 17px; font-weight: 800; color: var(--ink); }
:root[data-design="pro"] .pro-prev-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #94a3b8; text-transform: uppercase; margin-top: 2px; }
:root[data-design="pro"] .pro-prev-items { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 10px; }
:root[data-design="pro"] .pro-prev-items th { padding: 6px 4px; }
:root[data-design="pro"] .pro-prev-items td { padding: 10px 4px; vertical-align: top; color: var(--ink); }
:root[data-design="pro"] .pro-prev-imei { color: #94a3b8; font-size: 11.5px; }
:root[data-design="pro"] .pro-prev-rows { border-top: 1px solid var(--line); padding-top: 10px; }
:root[data-design="pro"] .pro-prev-r { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; color: var(--ink); }
:root[data-design="pro"] .pro-prev-bal { font-weight: 800; font-size: 15px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; }
:root[data-design="pro"] .pro-prev-method { color: #64748b; }
:root[data-design="pro"] .pro-prev-note { margin-top: 12px; font-size: 11.5px; color: #94a3b8; }

/* ---------- 9d. Inline LIST-SHEET (Skylink Excel-style row entry; list-sheet.js) ---------- */
:root[data-design="pro"] .lsheet { margin: 4px 0 10px; }
:root[data-design="pro"] .ls-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
:root[data-design="pro"] .ls-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
:root[data-design="pro"] .ls-th { text-align: left; padding: 8px 8px; background: #f8fafc; color: #64748b; font-weight: 700; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap; }
:root[data-design="pro"] .ls-td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
:root[data-design="pro"] .ls-td:last-child { border-right: none; }
:root[data-design="pro"] .ls-committed .ls-td { padding: 8px 8px; color: var(--ink); }
:root[data-design="pro"] .ls-committed { background: #f6fbf7; }
:root[data-design="pro"] .ls-just { animation: ls-flash .6s ease-out; }
@keyframes ls-flash { from { background: #fff4c2; } to { background: #f6fbf7; } }
:root[data-design="pro"] .ls-entry .ls-td { background: #fff; }
:root[data-design="pro"] .ls-in { width: 100%; box-sizing: border-box; border: 0; background: transparent; padding: 9px 8px; font: inherit; color: var(--ink); outline: none; }
:root[data-design="pro"] .ls-in:focus { box-shadow: inset 0 0 0 2px var(--accent, #2563eb); border-radius: 3px; }
:root[data-design="pro"] .ls-sel { -webkit-appearance: none; appearance: none; cursor: pointer; }
:root[data-design="pro"] .ls-ro { padding: 9px 8px; color: #64748b; font-variant-numeric: tabular-nums; }
:root[data-design="pro"] .ls-dash { color: #cbd5e1; }
:root[data-design="pro"] .ls-scan-wrap { display: flex; align-items: stretch; }
:root[data-design="pro"] .ls-scan-wrap .ls-in { flex: 1; }
:root[data-design="pro"] .ls-scan-btn { border: 0; border-left: 1px solid var(--line); background: #f1f5f9; cursor: pointer; padding: 0 8px; font-size: 15px; }
:root[data-design="pro"] .ls-scan-btn:hover { background: #e2e8f0; }
:root[data-design="pro"] .ls-err { background: #fff1f2 !important; box-shadow: inset 0 0 0 2px #ef4444; }
:root[data-design="pro"] .ls-cellmsg { color: #dc2626; font-size: 11px; padding: 0 8px 6px; }
:root[data-design="pro"] .ls-rowerr { color: #dc2626; font-weight: 700; font-size: 13px; margin-top: 8px; padding: 8px 10px; background: #fff1f2; border-radius: 6px; }
:root[data-design="pro"] .ls-busy { opacity: .6; pointer-events: none; }
:root[data-design="pro"] .ls-hint { margin-top: 8px; }

/* ---------- 10. Desktop-first with the ≤900px fallback (CellPro collapses to 2-col) ---------- */
@media (max-width: 900px) {
  /* Mobile fallback: base.css turns .sidebar into a thin top strip and hides .nav-list here (the bottom
     tab bar carries mobile nav). The flat .pro-nav must hide too — otherwise its 15 items render
     full-height on top and push the page below the viewport. Then pro mobile == normal mobile: brand/role
     strip + bottom tabs. (.nav-list stays hidden under pro at every width, so the grouped nav never returns.) */
  :root[data-design="pro"] .pro-nav { display: none; }
  :root[data-design="pro"] .pro-dash-grid { grid-template-columns: repeat(2, 1fr); }
  :root[data-design="pro"] .pro-dash-main { grid-template-columns: 1fr; }
  :root[data-design="pro"] .pro-sell-grid { grid-template-columns: 1fr; }
  :root[data-design="pro"] .pro-sell-preview { position: static; }
}
@media (max-width: 560px) {
  :root[data-design="pro"] .pro-dash-grid { grid-template-columns: 1fr; }
}
