/* ══════════════════════════════════════════════════════════════════════
   THE ADMIN'S ONE STYLESHEET (brief D, 2026-10-29) — loaded by BOTH admins:
   the product admin (public/admin/index.html) and the marketing admin + CRM
   (public/site/admin/index.html, biz.js, crm.js). One rail, one top bar, one
   set of components, so the two read as one product — and that product is
   the one the customers see: the 11 dashboards (public/dashboard/dashboard.css,
   reference screen ניתוח מורחב, 28-categories.js).

   The look, taken from the dashboards as they render (measured 29/10):
     page #f4f6f8 · cards pure white, 1px #e2e7eb, radius 18px, no shadow ·
     ink #16222b, labels #5d6a73 · the system font (Segoe UI on Windows) ·
     icons in the brand blue on #edf2f7 · ORANGE = the house accent: the
     primary button, the active choice, the active menu entry, the focus ring.
   Green and red appear in two places only: a change pill (▲/▼) and a state
   that is genuinely good or bad (a failed sync, a destructive button).
   Everything else — roles, stages, plans, statuses — is neutral, blue or orange.

   THE BINDING RULES HERE (tests/admin-style.test.js pins them):
     · no dark theme: no dark surface token, no dark literal;
     · no text under 13.5px (--fs-min) — headings larger than their rows;
     · ONE SCREEN: the page never scrolls; <main> scrolls inside, and so do
       the tables and panels in it (body is a fixed-height column);
     · every table sorts by its titles (admin-ui.js), rows rise under the
       pointer and take keyboard focus, titles stay on top while it scrolls.
   ══════════════════════════════════════════════════════════════════════ */
:root{
  --font:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Hebrew","Segoe UI Variable","Segoe UI","Heebo",system-ui,sans-serif;
  --bg:#f4f6f8; --surface:#ffffff; --surface-2:#f5f7f8; --surface-3:#eceff2;
  --border:#e2e7eb; --border-2:#d3dae0; --hairline:#eef1f4;
  --text:#16222b; --muted:#5d6a73; --muted-2:#74818a;
  /* the house orange (the dashboards' largest segment, "השבוע" highlight, the marked row's frame) */
  --brand:#e8650d; --brand-dark:#c9560a; --brand-ink:#ffffff;
  /* the old names the pages' scripts still write inline, re-pointed at the light palette */
  --amber:#b8500a; --amber-ink:#ffffff; --amber-soft:#fff2e7; --amber-line:#f5c29c;
  --orange:#b8500a;
  --navy:#1f3a52; --blue:#2a5682; --blue-soft:#edf2f7;
  --teal:#2a5682; --violet:#4b6875;
  /* the dashboards' ONE green and ONE red (--up / --down there) */
  --green:#166534; --red:#991b1b; --green-soft:#e9f5ee; --red-soft:#fdecec;
  --r-ctl:10px; --r-card:18px; --rail-w:224px; --top-h:68px;
  --shadow:0 12px 32px rgba(22,34,43,.14);
  --fs:14px; --fs-min:13.5px;
}

/* ── base ──────────────────────────────────────────────────────────────── */
*{box-sizing:border-box; margin:0; padding:0;}
*{scrollbar-width:thin; scrollbar-color:#cfd6dc transparent;}
*::-webkit-scrollbar{width:8px; height:8px;} *::-webkit-scrollbar-thumb{background:#cfd6dc; border-radius:999px;} *::-webkit-scrollbar-track{background:transparent;}
html{-webkit-text-size-adjust:100%; height:100%;}
body{background:var(--bg); color:var(--text); font-family:var(--font); font-size:var(--fs); line-height:1.55; letter-spacing:-.005em; -webkit-font-smoothing:antialiased;}
a{color:inherit; text-decoration:none;}
button,input,select,textarea{font-family:inherit; color:inherit;}
.num{font-family:inherit; font-variant-numeric:tabular-nums;}
code,.mono{font-family:"Cascadia Mono",Consolas,ui-monospace,monospace; font-size:var(--fs-min);}
.hidden{display:none !important;}
[hidden]{display:none !important;}
.dim{color:var(--muted);}
.spacer{flex:1;}
.ico{width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; flex:0 0 auto;}
.ico.sm{width:16px; height:16px;}
::selection{background:#ffe0c7;}
:focus-visible{outline:2px solid var(--brand); outline-offset:2px;}
@media (prefers-reduced-motion:reduce){ *{transition:none !important; animation:none !important;} }

/* ── THE SHELL: rail + top bar + <main>, one screen ────────────────────── */
/* body.adm-app = the product admin; #appView = the marketing admin's app (its body, .adm-site, also holds the sign-in) */
body.adm-app, #appView{height:100vh; height:100dvh; display:flex; flex-direction:column; overflow:hidden; padding-inline-start:var(--rail-w);}
body.adm-app > main, #appView > main{flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; width:100%; max-width:none; margin:0;
  padding:18px max(24px, calc((100% - 1280px) / 2)) 28px;}
body.adm-app, body.adm-site{overflow:hidden; height:100vh; height:100dvh;}
body.adm-site > .login{height:100vh; overflow:auto; margin:0 auto; padding:12vh 16px;}

/* the rail — the dashboards' sidebar: white, quiet, the active entry in the house orange */
.rail{position:fixed; top:0; bottom:0; inset-inline-start:0; width:var(--rail-w); background:var(--surface); border-inline-end:1px solid var(--border);
  display:flex; flex-direction:column; padding:18px 12px 12px; z-index:6; gap:2px; overflow-y:auto;}
.rail .brand{display:flex; flex-direction:column; align-items:flex-start; gap:2px; padding:2px 10px 16px; font-weight:700;}
.rail .brand small{display:block; font-size:var(--fs-min); color:var(--muted); font-weight:500; letter-spacing:0;}
.rail .sec{font-size:var(--fs-min); color:var(--muted-2); font-weight:600; padding:14px 12px 6px;}
.rail a.nav{display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:12px; color:#3f4b53; font-size:14.5px; font-weight:500; border:0;
  transition:background .14s ease, color .14s ease;}
.rail a.nav .ico{color:var(--muted-2); transition:color .14s ease;}
.rail a.nav:hover{background:#f1f4f6; color:var(--text);}
.rail a.nav:hover .ico{color:var(--text);}
.rail a.nav.on{background:var(--amber-soft); color:var(--amber); font-weight:600;}
.rail a.nav.on .ico{color:var(--brand);}
.rail a.nav .cnt{margin-inline-start:auto; font-size:var(--fs-min); font-weight:600; line-height:22px; color:var(--muted); background:#eef1f4; border-radius:999px; padding:0 8px; min-width:24px; text-align:center; font-variant-numeric:tabular-nums;}
.rail a.nav.on .cnt{background:#ffe4cf; color:var(--amber);}
.rail a.nav .cnt.bad{color:#fff; background:var(--brand);}   /* needs attention = the house accent, not a verdict colour */
.rail a.nav .cnt:empty{display:none;}
.rail .foot{margin-top:auto; border-top:1px solid var(--border); padding:12px 6px 0; display:flex; align-items:center; gap:10px;}
.avatar{width:32px; height:32px; border-radius:999px; background:var(--blue-soft); color:var(--blue); display:grid; place-items:center; font-weight:700; font-size:var(--fs-min); flex:0 0 auto;}
.rail .foot .who{font-size:var(--fs-min); color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; direction:ltr; text-align:end; flex:1; min-width:0;}
.rail .foot .ib{background:transparent; border:1px solid transparent; border-radius:10px; width:34px; height:34px; display:grid; place-items:center; color:var(--muted); cursor:pointer;}
.rail .foot .ib:hover{color:var(--text); background:#f1f4f6;}

/* the product mark (the sign-in's own wordmark: the Q drawn, the dotless ı with its blue ring) */
.qb-logo{display:inline-flex; align-items:center; font-weight:800; letter-spacing:-.02em; color:#000; font-size:22px; line-height:1; --qbl-blue:#5aaee8; --qbl-warm:#ff9142; --qbl-warm-op:.32;}
.qb-mark{width:30px; height:30px; flex:0 0 30px;}
.qb-text{white-space:nowrap;}
.qb-i{position:relative; display:inline-block;}
.qb-dot{position:absolute; left:50%; top:-.03em; transform:translateX(-50%); width:max(7px, .27em); height:max(7px, .27em); box-sizing:border-box; border-radius:50%; border:max(1.5px, .05em) solid var(--qbl-blue);}

/* the top bar: what you are looking at, and what you can do (the dashboards' topbar: on the page, not a slab) */
.top{display:flex; align-items:center; gap:10px; padding:10px 24px; min-height:var(--top-h); border-bottom:1px solid var(--border); background:var(--bg); flex-wrap:wrap; flex:none; position:relative; z-index:5;}
.top .brand{display:flex; flex-direction:column; justify-content:center; line-height:1.25; gap:2px; cursor:pointer; min-width:0;}
.top .brand > span:first-child, .top .brand #pageTitle{font-size:19px; font-weight:700; letter-spacing:-.02em; color:var(--text);}
.top .brand small{font-size:var(--fs-min); color:var(--muted); font-weight:400;}
.top .brand .q{display:none;}
.menu-btn{display:none !important;}
@media (max-width:900px){
  :root{--rail-w:0px;}
  .rail{display:none; width:264px;}
  .menu-btn{display:inline-flex !important;}
  body.rail-open .rail{display:flex; z-index:60; box-shadow:0 0 0 100vmax rgba(22,34,43,.35);}
  .top{padding:10px 14px;}
  body.adm-app > main, #appView > main{padding:14px 14px 24px;}
}
body.embedded{padding-inline-start:0;} body.embedded .rail, body.embedded .top{display:none !important;}

/* ── buttons: orange acts, white waits ─────────────────────────────────── */
.btn{background:var(--brand); color:var(--brand-ink); border:1px solid var(--brand); padding:7px 16px; min-height:36px; border-radius:999px; font-weight:600; font-size:var(--fs);
  cursor:pointer; white-space:nowrap; display:inline-flex; align-items:center; justify-content:center; gap:7px; line-height:1.2; text-decoration:none;
  transition:background .14s ease, border-color .14s ease, color .14s ease, transform .08s ease;}
.btn:hover{background:var(--brand-dark); border-color:var(--brand-dark);}
.btn:active{transform:scale(.98);}
.btn.ghost{background:var(--surface); border-color:var(--border); color:var(--text);}
.btn.ghost:hover{background:#f6f8fa; border-color:#cfd6dc; color:var(--text);}
.btn.danger{background:var(--surface); border-color:#efc7c7; color:var(--red);}
.btn.danger:hover{background:var(--red-soft);}
.btn.solid-danger{background:var(--red); border-color:var(--red); color:#fff;} .btn.solid-danger:hover{background:#7f1616;}
.btn.small{padding:4px 12px; min-height:32px; font-size:var(--fs-min);}
.btn.big{padding:11px 22px; min-height:44px; font-size:15px;}
.btn:disabled,.btn[aria-disabled="true"]{opacity:.5; cursor:default; transform:none;}
.no-perm{display:none !important;}   /* a button the signed-in role may not use (applyCan) */
.linkbtn{background:none; border:0; color:var(--amber); cursor:pointer; font:inherit; font-size:var(--fs-min); padding:0; text-decoration:underline;}
kbd{font-family:inherit; font-size:var(--fs-min); line-height:1; border:1px solid var(--border-2); border-bottom-width:2px; border-radius:6px; padding:2px 6px; color:var(--muted); background:var(--surface);}

/* segmented choices (period, tabs): a white track, the chosen one in the house orange */
.seg,.tfilter,.pv-tabs{display:inline-flex; gap:2px; background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:3px;}
.seg button,.tfilter button,.pv-tabs button{background:transparent; border:none; color:var(--muted); padding:5px 14px; font-weight:600; font-size:var(--fs-min); cursor:pointer; border-radius:999px; display:inline-flex; align-items:center; gap:6px; transition:background .14s, color .14s;}
.seg button:hover,.tfilter button:hover,.pv-tabs button:hover{color:var(--text); background:#f1f4f6;}
.seg button.active,.tfilter button.on,.pv-tabs button.on{background:var(--amber-soft); color:var(--amber);}

/* ── surfaces ──────────────────────────────────────────────────────────── */
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); padding:18px 22px; margin-bottom:14px;}
.card h2{font-size:18px; font-weight:700; margin-bottom:4px; letter-spacing:-.02em;}
.card h3{font-size:15.5px; font-weight:700; margin-bottom:4px; display:flex; align-items:center; gap:8px;}
.sub{color:var(--muted); font-size:var(--fs-min); margin-bottom:12px; line-height:1.6; max-width:80ch;}
.card .sub{font-size:var(--fs-min);}
.grid{display:grid; gap:14px;}
.grid.cols-2{grid-template-columns:repeat(2,minmax(0,1fr));}
.grid.cols-3{grid-template-columns:repeat(3,minmax(0,1fr));}
@media (max-width:900px){ .grid.cols-2,.grid.cols-3{grid-template-columns:1fr;} }
.empty{text-align:center; padding:26px 12px; color:var(--muted); font-size:var(--fs); line-height:1.7;}
.empty b{display:block; color:var(--text); font-weight:600; margin-bottom:2px;}
.skel{background:linear-gradient(90deg,#eef1f4 25%,#f7f9fa 50%,#eef1f4 75%); background-size:400% 100%; animation:sh 1.3s infinite; border-radius:8px; height:14px;}
@keyframes sh{0%{background-position:100% 0;} 100%{background-position:0 0;}}

/* ── forms ─────────────────────────────────────────────────────────────── */
.field{display:flex; flex-direction:column; gap:6px; margin-bottom:12px;}
.field label{font-size:var(--fs-min); color:var(--muted); font-weight:500;}
input,select,textarea{background:var(--surface); border:1px solid #d9e0e5; color:var(--text); padding:8px 12px; border-radius:var(--r-ctl); font-size:var(--fs); min-height:38px;
  transition:border-color .14s, box-shadow .14s;}
/* the product admin's fields fill their column (as they always did); the marketing admin's sit inline in its toolbars */
body.adm-app input:not([type=checkbox]):not([type=radio]), body.adm-app select, body.adm-app textarea, .field input, .field select, .field textarea{width:100%;}
input[type=checkbox],input[type=radio]{width:auto; min-height:0; accent-color:var(--brand);}
input::placeholder,textarea::placeholder{color:#97a2aa;}
input:focus,select:focus,textarea:focus{outline:none; border-color:var(--brand); box-shadow:0 0 0 3px #ffe4cf;}
input[readonly],input:disabled,select:disabled,textarea[readonly]{background:var(--surface-2); color:var(--muted);}
select{appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6a73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position:left 11px center; background-size:16px 16px; background-repeat:no-repeat; padding-left:34px; padding-right:12px;}   /* the arrow is drawn at the physical left (the end of a Hebrew line): its room is there */
select[multiple]{background-image:none; padding-left:12px;}
.row{display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap;} .row .field{flex:1; min-width:160px; margin-bottom:0;}
.msg{font-size:var(--fs-min); margin-top:8px; min-height:18px;} .msg.err{color:var(--red);} .msg.ok{color:var(--navy);}
.toolbar{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:10px;}
.toolbar input,.toolbar select{width:auto;} .toolbar input{min-width:220px;}

/* ── pills and chips: neutral by default; orange = needs you; red only for a real failure ── */
.pill{display:inline-flex; align-items:center; gap:6px; padding:1px 10px; border-radius:999px; font-size:var(--fs-min); font-weight:600; line-height:1.6;
  border:1px solid var(--border); background:var(--surface-2); color:#3f4b53; white-space:nowrap;}
.pill.good{color:var(--navy); background:var(--blue-soft); border-color:#d6e1ec;}
.pill.warn{color:var(--amber); background:var(--amber-soft); border-color:var(--amber-line);}
.pill.bad{color:var(--red); background:var(--red-soft); border-color:#f3cfcf;}
.pill.good::before,.pill.warn::before,.pill.bad::before{content:''; width:7px; height:7px; border-radius:50%; background:currentColor; flex:0 0 auto;}
.chip{display:inline-flex; align-items:center; gap:5px; border:1px solid var(--border); border-radius:999px; padding:1px 10px; font-size:var(--fs-min); color:var(--muted); background:var(--surface);}
.chip.on{color:var(--text); border-color:var(--border-2);} .chip.off{opacity:.6; text-decoration:line-through;}
.chip.bad{color:var(--red); border-color:#f3cfcf; background:var(--red-soft);}
/* a change pill — the ONLY green/red outside a real failure (the dashboards' qb-badge) */
.chg{display:inline-flex; align-items:center; gap:3px; padding:1px 8px; border-radius:999px; font-size:var(--fs-min); font-weight:600; direction:ltr; unicode-bidi:isolate; white-space:nowrap; border:1px solid transparent;}
.chg.u{color:var(--green); background:var(--green-soft); border-color:#cfe7d8;}
.chg.d{color:var(--red); background:var(--red-soft); border-color:#f3cfcf;}
.chg.n{color:var(--muted); background:var(--surface-2); border-color:var(--border);}
.chg.new{color:var(--amber); background:var(--amber-soft); border-color:var(--amber-line);}
.na{color:var(--muted); font-weight:500; white-space:nowrap;}

/* ── tables: titles that sort, rows that rise, a header that stays ─────── */
.tbl-wrap{overflow:auto; max-width:100%;}
table{width:100%; border-collapse:separate; border-spacing:0; font-size:var(--fs);}
th{text-align:start; color:var(--muted); font-weight:600; font-size:var(--fs-min); padding:10px 12px; border-bottom:1px solid var(--border); white-space:nowrap;
  position:sticky; top:0; background:var(--surface); z-index:1; user-select:none;}
thead th{cursor:pointer;}
thead th:hover{color:var(--text);}
th[aria-sort]{color:var(--text);}
th .ts-ar{font-style:normal; color:var(--brand); margin-inline-start:4px;}
th:focus-visible{outline:2px solid var(--brand); outline-offset:-2px;}
td{padding:10px 12px; border-bottom:1px solid var(--hairline); vertical-align:middle;}
tbody tr:last-child td{border-bottom:none;}
td.num,th.num{font-variant-numeric:tabular-nums;}
td.dim{color:var(--muted);}
/* THE ROW UNDER THE POINTER — the dashboards' rule (26-row-focus.js): a touch larger, a white ground, a soft shadow; a press marks it in orange */
tbody > tr{position:relative; scale:1; transform-origin:center; transition:scale 240ms cubic-bezier(.22,1,.36,1), box-shadow 240ms ease;}
@media (hover:hover){
  tbody > tr:hover{scale:1.004; box-shadow:0 6px 18px rgba(22,34,43,.10), 0 0 0 1px rgba(22,34,43,.05); transition-duration:90ms;}
  tbody > tr:hover > td{background:#ffffff;}
}
tbody > tr:focus-visible{outline:2px solid var(--brand); outline-offset:-2px;}
tbody > tr:focus-visible > td{background:#fffaf5;}
tr.qb-rf-on{outline:1.5px solid #f39a5c; outline-offset:-3px;}
tr.click{cursor:pointer;}
[data-no-row-focus] tr, [data-no-row-focus] tr:hover, tfoot tr, thead tr{scale:none !important; box-shadow:none !important;}

/* ── dialogs, toasts, the palette ──────────────────────────────────────── */
.ui-backdrop{position:fixed; inset:0; background:rgba(22,34,43,.32); z-index:80; display:flex; align-items:flex-start; justify-content:center; padding:12vh 16px 16px;}
.ui-dialog{background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow); width:min(460px,100%); padding:20px 22px;}
.ui-dialog h3{margin:0 0 8px; font-size:16px; font-weight:700;} .ui-dialog .body{white-space:pre-wrap; color:var(--muted); font-size:var(--fs); line-height:1.65;}
.ui-dialog .acts{display:flex; gap:8px; justify-content:flex-end; margin-top:16px;} .ui-dialog input{margin-top:12px;}
.toasts{position:fixed; bottom:18px; inset-inline-start:calc(var(--rail-w) + 18px); z-index:90; display:flex; flex-direction:column; gap:8px; max-width:min(420px,calc(100vw - 36px));}
.toast{background:var(--surface); border:1px solid var(--border); border-inline-start:4px solid var(--muted-2); border-radius:14px; padding:10px 14px; font-size:var(--fs); box-shadow:var(--shadow); cursor:pointer; animation:toastIn .18s ease-out;}
.toast.err{border-inline-start-color:var(--red);} .toast.ok{border-inline-start-color:var(--navy);}
@keyframes toastIn{from{opacity:0; transform:translateY(8px);} to{opacity:1; transform:none;}}
.pal{background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow); width:min(620px,100%); overflow:hidden;}
.pal input{border:0; border-bottom:1px solid var(--border); border-radius:0; padding:14px 16px; font-size:16px; background:transparent; min-height:0;} .pal input:focus{box-shadow:none;}
.pal-list{max-height:min(60vh,460px); overflow:auto; padding:6px;}
.pal-row{display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:12px; cursor:pointer; font-size:var(--fs);}
.pal-row:hover{background:#f6f8fa;}
.pal-row.on{background:var(--amber-soft); color:var(--amber);} .pal-row small{color:var(--muted); margin-inline-start:auto; font-size:var(--fs-min);}
.pal-sec{font-size:var(--fs-min); color:var(--muted-2); font-weight:600; padding:8px 12px 2px;}
.pal-hint{font-size:var(--fs-min); color:var(--muted); padding:8px 14px; border-top:1px solid var(--border); display:flex; gap:14px; flex-wrap:wrap;}

/* ── the side drawer (a lead, a CRM card) ──────────────────────────────── */
.drawer-bg{position:fixed; inset:0; background:rgba(22,34,43,.32); z-index:20; display:none;}
.drawer-bg.open{display:block;}
/* PHYSICAL right + translateX(+105%): translateX is physical, so an RTL logical anchor would park the "hidden" drawer in view. */
.drawer{position:fixed; top:0; bottom:0; right:0; width:min(560px,96vw); background:var(--surface); border-left:1px solid var(--border); z-index:21; transform:translateX(105%);
  transition:transform .22s cubic-bezier(.22,1,.36,1); overflow:auto; padding:22px; box-shadow:-12px 0 32px rgba(22,34,43,.12);}
.drawer.open{transform:translateX(0);}
.drawer h2{font-size:19px; font-weight:700; margin-bottom:2px;}
.drawer .meta{color:var(--muted); font-size:var(--fs-min); margin-bottom:14px;}
.kv{display:grid; grid-template-columns:130px 1fr; gap:7px 12px; font-size:var(--fs); margin-bottom:14px;}
.kv .k{color:var(--muted);}

/* ── a screen the role may not open ────────────────────────────────────── */
.crm-denied{max-width:520px; margin:12vh auto; text-align:center;}
.crm-denied h2{font-size:20px; margin-bottom:8px;}
