:root{
  --bg:#0a1220; --panel:#111d33; --panel2:#1a2842; --muted:#93a4c0;
  --text:#e6edf7; --primary:#3b82f6; --primary2:#2563eb; --green:#22c55e;
  --red:#ef4444; --amber:#f59e0b; --purple:#a855f7; --border:#26375234; --radius:14px;
  --border:#28394f; --brand-navy:#0A1B33; --brand-blue:#1E4B8F; --brand-sky:#60A5FA;
}
/* ------------------------------- Fonts ------------------------------- */
/* Persian UI text — self-hosted variable font (one file = every weight). */
@font-face{
  font-family:'Vazirmatn';
  src:url('fonts/v2/Vazirmatn.woff2') format('woff2');
  font-weight:100 900; font-style:normal; font-display:swap;
}
/* Persian headings / key figures. */
@font-face{ font-family:'Estedad'; src:url('fonts/v2/Estedad-700.woff2') format('woff2'); font-weight:700; font-display:swap; }
@font-face{ font-family:'Estedad'; src:url('fonts/v2/Estedad-800.woff2') format('woff2'); font-weight:800; font-display:swap; }
@font-face{ font-family:'Estedad'; src:url('fonts/v2/Estedad-900.woff2') format('woff2'); font-weight:900; font-display:swap; }
/* English/Latin text — native system UI font, restricted to Latin glyphs with
   unicode-range so Persian keeps rendering in Vazirmatn. Uses the OS font (no
   download); if none exist, Latin simply falls back to Vazirmatn. */
@font-face{
  font-family:'LatinUI';
  src:local('Segoe UI'), local('Helvetica Neue'), local('Roboto'), local('Arial');
  font-weight:100 900; font-style:normal; font-display:swap;
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

*{box-sizing:border-box}
/* The HTML `hidden` attribute must win over any component's own display value.
   The browser default (`[hidden]{display:none}`) is a UA rule and loses to any
   class selector that sets `display` — so `.tk-lightbox{display:flex}` (and the
   upload preview) rendered a full-screen overlay ON PAGE LOAD even while carrying
   `hidden`, covering the ticket. The reset never had this line; it does now, so a
   component may style `display` freely and still be hidden by toggling `.hidden`. */
[hidden]{display:none!important}
body{
  margin:0; font-family:'LatinUI','Vazirmatn','Segoe UI',Tahoma,sans-serif;
  background:
    radial-gradient(1200px 620px at 100% -12%, rgba(37,99,235,.20), transparent 60%),
    radial-gradient(1000px 520px at -10% 110%, rgba(30,75,143,.18), transparent 55%),
    var(--bg);
  background-attachment:fixed;
  color:var(--text); direction:rtl; line-height:1.7; font-size:14px;
}
a{color:var(--primary); text-decoration:none}
a:hover{text-decoration:underline}
.container{max-width:1200px; margin:0 auto; padding:20px}

/* Persian display font for headings & key figures (Estedad carries its own
   Latin glyphs, so numbers/Latin inside a heading stay consistent). */
h1,h2,h3,.page-title,.brand,.auth-card h1,.auth-form h1,.auth-hero h2,.card h3,.stat .value,.plan-price{
  font-family:'Estedad','Vazirmatn',sans-serif;
}
.brand small{font-family:'Vazirmatn',sans-serif; font-weight:normal}

/* Auth */
.auth-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px}
.auth-card{background:var(--panel); border:1px solid var(--border); border-radius:16px; padding:32px; width:100%; max-width:400px}
.auth-card h1{margin:0 0 6px; font-size:22px}
.auth-card p.sub{color:var(--muted); margin:0 0 24px; font-size:13px}

/* Layout with sidebar */
.shell{display:flex; min-height:100vh}
.sidebar{width:240px; background:var(--panel); border-left:1px solid var(--border); padding:18px 0; flex-shrink:0}
.brand{display:flex; align-items:center; gap:11px; padding:0 20px 18px; font-size:18px; font-weight:bold; border-bottom:1px solid var(--border); margin-bottom:12px}
.brand .brand-mark{width:32px; height:34px; flex-shrink:0}
.brand .brand-name{display:flex; flex-direction:column; line-height:1.15; min-width:0}
.brand small{display:block; color:var(--muted); font-size:11px; font-weight:normal; margin-top:4px}
.nav a{display:flex; align-items:center; gap:10px; padding:11px 20px; color:var(--text); border-radius:0}
.nav a:hover{background:var(--panel2); text-decoration:none}
.nav a.active{background:var(--primary2); color:#fff}
.nav .sep{padding:14px 20px 6px; font-size:11px; color:var(--muted); text-transform:uppercase}
.main{flex:1; min-width:0; display:flex; flex-direction:column}
.topbar{display:flex; align-items:center; justify-content:space-between; padding:14px 24px; background:var(--panel); border-bottom:1px solid var(--border)}
.topbar .bal{background:var(--panel2); padding:7px 14px; border-radius:20px; font-weight:bold}
.topbar .bal.neg{color:var(--red)}
.content{padding:24px; flex:1}
.page-title{font-size:20px; margin:0 0 20px}

/* Cards */
.grid{display:grid; gap:16px}
.grid.c2{grid-template-columns:repeat(2,1fr)}
.grid.c3{grid-template-columns:repeat(3,1fr)}
.grid.c4{grid-template-columns:repeat(4,1fr)}
.card{background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); padding:18px}
.card h3{margin:0 0 14px; font-size:15px}
.stat{display:flex; flex-direction:column; gap:6px}
.stat .label{color:var(--muted); font-size:12px}
.stat .value{font-size:24px; font-weight:bold}
.stat .value.green{color:var(--green)} .stat .value.amber{color:var(--amber)} .stat .value.red{color:var(--red)}

/* Tables */
table{width:100%; border-collapse:collapse; font-size:13px}
th,td{padding:10px 12px; text-align:right; border-bottom:1px solid var(--border)}
th{color:var(--muted); font-weight:normal; font-size:12px}
tr:hover td{background:var(--panel2)}
.table-card{background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden}
.table-card table th{background:var(--panel2)}

/* Forms */
.form-row{margin-bottom:16px}
label{display:block; margin-bottom:6px; font-size:13px; color:var(--muted)}
input,select,textarea{
  width:100%; padding:10px 12px; background:var(--bg); border:1px solid var(--border);
  border-radius:8px; color:var(--text); font-family:inherit; font-size:14px
}
input:focus,select:focus,textarea:focus{outline:none; border-color:var(--primary)}
textarea{min-height:120px; resize:vertical}
.help{font-size:11px; color:var(--muted); margin-top:5px}

/* Buttons */
.btn{display:inline-flex; align-items:center; gap:6px; padding:10px 18px; border:none; border-radius:8px;
  background:var(--primary2); color:#fff; cursor:pointer; font-family:inherit; font-size:14px; font-weight:bold}
.btn:hover{background:var(--primary); text-decoration:none}
.btn.block{width:100%; justify-content:center}
.btn.sm{padding:6px 12px; font-size:12px; font-weight:normal}
.btn.green{background:var(--green)} .btn.red{background:var(--red)} .btn.amber{background:var(--amber); color:#000}
.btn.ghost{background:transparent; border:1px solid var(--border); color:var(--text)}
.btn-group{display:flex; gap:8px; flex-wrap:wrap}

/* Badges */
.badge{display:inline-block; padding:3px 10px; border-radius:20px; font-size:11px}
.badge.green{background:rgba(34,197,94,.15); color:var(--green)}
.badge.red{background:rgba(239,68,68,.15); color:var(--red)}
.badge.amber{background:rgba(245,158,11,.15); color:var(--amber)}
.badge.blue{background:rgba(59,130,246,.15); color:var(--primary)}
.badge.violet{background:rgba(139,92,246,.15); color:#a78bfa}
.badge.gray{background:var(--panel2); color:var(--muted)}

/* Alerts */
.alert{padding:12px 16px; border-radius:8px; margin-bottom:16px; font-size:13px}
.alert.success{background:rgba(34,197,94,.12); border:1px solid var(--green); color:var(--green)}
.alert.error{background:rgba(239,68,68,.12); border:1px solid var(--red); color:#fca5a5}
.alert.info{background:rgba(59,130,246,.12); border:1px solid var(--primary); color:#93c5fd}
.alert.warning{background:rgba(245,158,11,.12); border:1px solid var(--amber); color:#fcd34d}

/* Sidebar unread-count badge */
.nav a .nav-badge{margin-inline-start:auto; background:var(--red); color:#fff; border-radius:20px; min-width:18px; height:18px; padding:0 6px; font-size:11px; font-weight:bold; display:inline-flex; align-items:center; justify-content:center; line-height:1}

/* Chat / tickets */
.msg{padding:14px 16px; border-radius:10px; margin-bottom:12px; border:1px solid var(--border)}
.msg.staff{background:var(--panel2); border-color:var(--primary)}
.msg.user{background:var(--panel)}
.msg .meta{font-size:11px; color:var(--muted); margin-bottom:6px}

.flex{display:flex; gap:12px; align-items:center}
.between{justify-content:space-between}
.right{text-align:left}
.mt{margin-top:18px} .mb{margin-bottom:18px}
.muted{color:var(--muted)}
hr{border:none; border-top:1px solid var(--border); margin:18px 0}

@media(max-width:880px){
  .grid.c4{grid-template-columns:repeat(2,1fr)}
  .grid.c3,.grid.c2{grid-template-columns:1fr}
  .sidebar{position:fixed; right:-240px; top:0; bottom:0; z-index:50; transition:right .2s}
  .sidebar.open{right:0}
  .menu-toggle{display:inline-block!important}
}
.menu-toggle{display:none; background:none; border:none; color:var(--text); font-size:22px; cursor:pointer}

/* ============================ Visual polish v2 ============================ */
.card{transition:transform .15s ease, box-shadow .15s ease, border-color .15s}
.card:hover{box-shadow:0 8px 28px rgba(0,0,0,.28)}
.stat{position:relative; overflow:hidden}
.stat::before{content:""; position:absolute; top:0; right:0; width:4px; height:100%;
  background:linear-gradient(180deg,var(--primary),var(--green)); border-radius:4px}

/* Colour-accented stat cards (dashboard, admin DNS overview, …): a solid side
   bar + a faint diagonal tint + an optional icon chip in the top-left corner. */
.stat.s-green::before {background:var(--green)}
.stat.s-blue::before  {background:var(--primary)}
.stat.s-amber::before {background:var(--amber)}
.stat.s-violet::before{background:var(--purple)}
.stat.s-green {background:linear-gradient(120deg,rgba(34,197,94,.10),transparent 62%)}
.stat.s-blue  {background:linear-gradient(120deg,rgba(59,130,246,.10),transparent 62%)}
.stat.s-amber {background:linear-gradient(120deg,rgba(245,158,11,.10),transparent 62%)}
.stat.s-violet{background:linear-gradient(120deg,rgba(168,85,247,.12),transparent 62%)}
/* Icon sits inline with the label (not corner-absolute) so a long, right-aligned
   value can never overlap it — correct in both RTL and LTR. */
.stat .stat-row{display:flex; align-items:center; gap:9px; margin-bottom:2px}
.stat .stat-ic{flex-shrink:0; width:34px; height:34px; border-radius:10px;
  display:grid; place-items:center; font-size:17px; background:var(--panel2); border:1px solid var(--border)}
.stat.s-green .stat-ic {background:rgba(34,197,94,.14);  border-color:rgba(34,197,94,.30)}
.stat.s-blue .stat-ic  {background:rgba(59,130,246,.14); border-color:rgba(59,130,246,.30)}
.stat.s-amber .stat-ic {background:rgba(245,158,11,.14); border-color:rgba(245,158,11,.30)}
.stat.s-violet .stat-ic{background:rgba(168,85,247,.16); border-color:rgba(168,85,247,.32)}
.stat .value.violet{color:var(--purple)}

.btn{
  background:linear-gradient(180deg,var(--primary),var(--primary2));
  box-shadow:0 4px 14px rgba(37,99,235,.35); transition:transform .12s, box-shadow .12s, filter .12s;
}
.btn:hover{filter:brightness(1.08); transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn.green{background:linear-gradient(180deg,#34d399,#22c55e); box-shadow:0 4px 14px rgba(34,197,94,.35)}
.btn.red{background:linear-gradient(180deg,#f87171,#ef4444); box-shadow:0 4px 14px rgba(239,68,68,.35)}
.btn.amber{background:linear-gradient(180deg,#fbbf24,#f59e0b); color:#1f2937; box-shadow:0 4px 14px rgba(245,158,11,.35)}
.btn.ghost{background:transparent; box-shadow:none}

.sidebar{box-shadow:-2px 0 18px rgba(0,0,0,.18)}
.nav a{position:relative; transition:background .15s, color .15s}
.nav a.active{background:linear-gradient(90deg,var(--primary2),rgba(37,99,235,.35))}
.nav a.active::before{content:""; position:absolute; right:0; top:8px; bottom:8px; width:3px; background:#fff; border-radius:3px}
.brand{background:linear-gradient(135deg,rgba(59,130,246,.18),transparent); }

/* Plan picker cards (server create) */
.plan-card{display:block; cursor:pointer; background:var(--panel); border:2px solid var(--border);
  border-radius:14px; padding:18px; transition:border-color .15s, transform .15s, box-shadow .15s}
.plan-card:hover{transform:translateY(-3px); box-shadow:0 10px 30px rgba(0,0,0,.3)}
.plan-card:has(input:checked){border-color:var(--primary); box-shadow:0 0 0 3px rgba(59,130,246,.25)}
/* «تکمیل ظرفیت» — node is full: cards are shown for information only */
.plan-card.soldout{cursor:default; opacity:.55; filter:grayscale(.4)}
.plan-card.soldout:hover{transform:none; box-shadow:none}
.spec-list{list-style:none; padding:0; margin:10px 0; font-size:13px; color:var(--muted)}
.spec-list li{padding:4px 0; border-bottom:1px dashed var(--border)}
.plan-price{margin-top:6px; font-size:20px; color:var(--text)}
.plan-price b{color:var(--green)}

/* ============================ Auth (login/register) ============================ */
.auth-wrap{
  background:
    radial-gradient(900px 500px at 80% 10%, rgba(59,130,246,.25), transparent 60%),
    radial-gradient(700px 500px at 10% 90%, rgba(34,197,94,.18), transparent 55%),
    var(--bg);
}
.auth-shell{display:flex; width:100%; max-width:880px; background:var(--panel);
  border:1px solid var(--border); border-radius:20px; overflow:hidden; box-shadow:0 24px 60px rgba(0,0,0,.45)}
.auth-hero{flex:1; padding:40px 34px; color:#fff; position:relative; overflow:hidden;
  display:flex; flex-direction:column; justify-content:flex-end; min-height:520px;
  /* A real server-room photo (owner's request, 2026-09-24): Taylor Vick, Unsplash
     License — see assets/img/CREDITS.txt. The scrim darkens the lower part so the
     white copy stays readable on every rack light. */
  background-color:#0b1224;
  background-image:linear-gradient(180deg, rgba(7,11,22,.12) 0%, rgba(7,11,22,.55) 26%, rgba(7,11,22,.90) 52%, #070b16 100%),
                   url('img/auth-racks-900.jpg');
  background-image:linear-gradient(180deg, rgba(7,11,22,.12) 0%, rgba(7,11,22,.55) 26%, rgba(7,11,22,.90) 52%, #070b16 100%),
                   image-set(url('img/auth-racks-900.webp') type('image/webp'), url('img/auth-racks-900.jpg') type('image/jpeg'));
  background-size:cover; background-position:center top}
.auth-hero::after{content:""; position:absolute; inset:0; pointer-events:none;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.04)}
.auth-hero h2{font-size:26px; margin:0 0 14px; position:relative}
.auth-hero p{color:rgba(255,255,255,.85); position:relative; line-height:2}
.auth-hero .feat{display:flex; align-items:center; gap:10px; margin:14px 0; position:relative; font-size:14px}
.auth-hero .feat .ic{width:34px; height:34px; border-radius:10px; background:rgba(255,255,255,.14);
  -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); border:1px solid rgba(255,255,255,.14);
  display:flex; align-items:center; justify-content:center; font-size:17px; flex-shrink:0}
.auth-form{width:380px; max-width:100%; padding:40px 34px}
.auth-form h1{margin:0 0 4px; font-size:24px}
.auth-form p.sub{color:var(--muted); margin:0 0 26px; font-size:13px}
.auth-logo{width:54px; height:54px; border-radius:14px; margin-bottom:18px;
  background:linear-gradient(135deg,var(--primary),var(--green)); display:flex; align-items:center;
  justify-content:center; font-size:26px; box-shadow:0 8px 20px rgba(37,99,235,.4)}
.auth-brand-logo{height:46px; width:auto; max-width:100%; margin-bottom:22px; display:block}
@media(max-width:760px){
  .auth-hero{display:none}
  .auth-form{width:100%}
}

/* ============================ Tabs ============================ */
.tabs{display:flex; gap:6px; border-bottom:1px solid var(--border); margin-bottom:20px;
  overflow-x:auto; -webkit-overflow-scrolling:touch}
.tab{background:transparent; border:none; color:var(--muted); padding:12px 18px; cursor:pointer;
  font-family:inherit; font-size:14px; border-bottom:3px solid transparent; white-space:nowrap; border-radius:0}
.tab:hover{color:var(--text)}
.tab.active{color:var(--primary); border-bottom-color:var(--primary); font-weight:bold}
.tabpane{display:none}
.tabpane.active{display:block; animation:fadein .2s ease}
/* «ptabs» — the shared page-tabs component (app.js). */
.ptab-pane{display:none}
.ptab-pane.active{display:block; animation:fadein .2s ease}
.ptabs > .tabs{position:sticky; top:0; z-index:5; background:var(--bg); margin-bottom:16px}
.tab .tab-n{display:inline-block; min-width:20px; margin-inline-start:6px; padding:1px 7px; border-radius:10px;
  background:var(--panel2); color:var(--muted); font-size:11px; font-weight:600; text-align:center}
.tab.active .tab-n{background:rgba(59,130,246,.15); color:var(--primary)}
.tab .tab-n.warn{background:rgba(245,158,11,.18); color:var(--amber)}
.tab .tab-n.bad{background:rgba(239,68,68,.15); color:var(--red)}
@keyframes fadein{from{opacity:0; transform:translateY(4px)}to{opacity:1; transform:none}}
.scroll-x{overflow-x:auto; -webkit-overflow-scrolling:touch}
.danger-zone{border:1px solid var(--red)}
.wrap-sm{flex-wrap:wrap}

/* ============================ Mobile optimization ============================ */
@media(max-width:600px){
  .content{padding:14px}
  .page-title{font-size:18px}
  .grid{gap:12px}
  .grid.c2,.grid.c3,.grid.c4{grid-template-columns:1fr}
  .card{padding:14px}
  .stat .value{font-size:20px}
  .topbar{padding:12px 14px}
  .topbar .bal{font-size:12px; padding:6px 10px}
  .btn{padding:11px 16px}                 /* larger touch targets */
  .btn.sm{padding:9px 14px; font-size:13px}
  .btn-group{gap:8px}
  .btn-group form,.btn-group .btn{flex:1 1 auto}
  .btn-group .btn{width:100%; justify-content:center}
  table{font-size:12px}
  th,td{padding:8px 8px}
  .auth-form{padding:28px 22px}
  .tab{padding:10px 14px; font-size:13px}
  h1.page-title{margin-bottom:14px}
}
/* Tables never overflow the viewport on small screens */
@media(max-width:760px){
  .table-card{overflow-x:auto}
}

/* ==================== MehranHost sleek refresh (v3) ==================== */
/* Glassy panels with a hairline top highlight + soft depth. */
.card,.table-card,.auth-card{
  background:linear-gradient(180deg,rgba(255,255,255,.028),transparent 40%), var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px -18px rgba(0,0,0,.6);
  backdrop-filter:saturate(1.1) blur(2px);
}
.card:hover{box-shadow:0 1px 0 rgba(255,255,255,.05) inset, 0 16px 40px -20px rgba(2,8,20,.8)}
.page-title{font-family:'Estedad','Vazirmatn',sans-serif; font-weight:800; letter-spacing:-.01em;
  display:inline-block}

/* Sidebar — deeper brand navy with a subtle right divider glow. */
.sidebar{background:linear-gradient(180deg,#0c1a30, var(--panel) 60%);
  border-inline-start:1px solid var(--border)}
.brand{background:linear-gradient(135deg,rgba(37,99,235,.16),transparent 70%)}
.brand .brand-name{font-family:'Estedad','Vazirmatn',sans-serif; letter-spacing:-.01em}
.nav a{margin:1px 8px; padding-inline-start:16px; border-radius:10px}
.nav a:hover{background:rgba(255,255,255,.05)}
.nav a.active{background:linear-gradient(90deg,var(--primary2),rgba(37,99,235,.18)); box-shadow:0 6px 18px -10px var(--primary)}
.nav a.active::before{right:6px}
.nav .sep{letter-spacing:.12em; opacity:.8}

/* Topbar — glass sticky bar. */
.topbar{position:sticky; top:0; z-index:20;
  background:linear-gradient(180deg,rgba(12,20,34,.86),rgba(12,20,34,.68));
  backdrop-filter:blur(12px) saturate(1.1); border-bottom:1px solid var(--border)}
.topbar .bal{background:linear-gradient(135deg,rgba(37,99,235,.22),rgba(37,99,235,.06));
  border:1px solid var(--border)}

/* Inputs — a touch more depth + a soft focus ring. */
input,select,textarea{background:rgba(6,12,24,.6); border-radius:10px; transition:border-color .15s, box-shadow .15s}
input:focus,select:focus,textarea:focus{box-shadow:0 0 0 3px rgba(59,130,246,.22)}
/* Chrome on Windows draws a <select>'s option list on an opaque sheet — white, because
   the select's own background above is translucent — while the options inherit the
   panel's near-white text, so every option but the highlighted one was unreadable.
   Pin the list's colours and tell the browser the control is dark. */
select{color-scheme:dark}
select option,select optgroup{background:var(--panel); color:var(--text)}

/* Tables — cleaner header + gentler row hover. */
.table-card table th{background:rgba(255,255,255,.03); letter-spacing:.02em}
tr:hover td{background:rgba(59,130,246,.06)}

/* Stat cards — slightly larger figure in the brand display font. */
.stat .value{font-family:'Estedad','Vazirmatn',sans-serif; letter-spacing:-.02em}

/* Buttons — keep gradients but round + crisp. */
.btn{border-radius:10px}
.btn.sm{border-radius:8px}

/* Badges — hairline outline for definition on glass. */
.badge{border:1px solid transparent}
.badge.green{border-color:rgba(34,197,94,.3)} .badge.red{border-color:rgba(239,68,68,.3)}
.badge.amber{border-color:rgba(245,158,11,.3)} .badge.blue{border-color:rgba(59,130,246,.3)}
.badge.violet{border-color:rgba(139,92,246,.3)}
.badge.gray{border-color:var(--border)}

/* Respect users who prefer less motion. */
@media(prefers-reduced-motion:reduce){
  .card,.btn,.node-chip{transition:none!important}
  .tabpane.active{animation:none}
  .ptab-pane.active{animation:none}
}

/* ============================ Plan slider (server create) ============================ */
/* Cards mode now uses a .selected class (clickable card, no radio). */
.plan-card.selected{border-color:var(--primary); box-shadow:0 0 0 3px rgba(59,130,246,.25)}

.slider-widget{max-width:680px}
.slider-row{margin:18px 0}
.slider-head{display:flex; justify-content:space-between; align-items:baseline; margin-bottom:8px; font-size:14px}
.slider-head .slider-val{font-family:'Estedad','Vazirmatn',sans-serif; font-weight:700; color:var(--primary)}
/* Bars run left→right (min→max) regardless of RTL. */
input.bar{-webkit-appearance:none; appearance:none; width:100%; height:8px; border-radius:6px; padding:0;
  background:linear-gradient(90deg,var(--primary),var(--green)); direction:ltr; cursor:pointer; outline:none}
input.bar::-webkit-slider-thumb{-webkit-appearance:none; appearance:none; width:22px; height:22px; border-radius:50%;
  background:#fff; border:3px solid var(--primary2); box-shadow:0 2px 8px rgba(0,0,0,.4); cursor:grab}
input.bar::-webkit-slider-thumb:active{cursor:grabbing; transform:scale(1.08)}
input.bar::-moz-range-thumb{width:22px; height:22px; border-radius:50%; background:#fff; border:3px solid var(--primary2);
  box-shadow:0 2px 8px rgba(0,0,0,.4); cursor:grab}
.slider-stops{display:flex; justify-content:space-between; direction:ltr; margin-top:8px; gap:4px; flex-wrap:wrap}
.slider-stops .stop{font-size:11px; color:var(--muted); background:var(--panel2); border:1px solid var(--border);
  border-radius:6px; padding:2px 8px; min-width:26px; text-align:center}
.slider-stops .stop.on{color:#fff; background:var(--primary2); border-color:var(--primary)}
.slider-stops .stop.off{opacity:.35; text-decoration:line-through}

.plan-summary{margin-top:22px; padding:16px; border-radius:12px; background:var(--panel2); border:1px solid var(--border)}
.plan-summary .ps-name{font-family:'Estedad','Vazirmatn',sans-serif; font-weight:800; font-size:16px; margin-bottom:6px}
.plan-summary .ps-specs{color:var(--muted); font-size:13px; margin-bottom:10px}
.plan-summary .ps-price{display:flex; gap:8px; flex-wrap:wrap; align-items:center; font-size:14px}
.plan-summary .ps-price b{color:var(--green); font-size:18px; font-family:'Estedad','Vazirmatn',sans-serif}

/* ============================ Rebuild loading ============================ */
.spinner{
  display:inline-block; width:48px; height:48px; border-radius:50%;
  border:4px solid var(--border); border-top-color:var(--primary);
  animation:spin .9s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.rebuild-wait{padding:36px 24px}

/* ============================ Searchable select ============================ */
/* Progressive enhancement for <select class="js-searchable">: the select is
   hidden and replaced with a text filter + dropdown list, but the original
   select still carries the value that gets submitted. */
.search-select{position:relative}
.search-select-input{margin:0}
.search-select-list{
  display:none; position:absolute; z-index:20; inset-inline:0; top:calc(100% + 4px);
  max-height:260px; overflow-y:auto; background:var(--panel2); border:1px solid var(--border);
  border-radius:8px; box-shadow:0 12px 28px rgba(0,0,0,.35);
}
.search-select-item{padding:9px 12px; font-size:13px; cursor:pointer}
.search-select-item:hover,.search-select-item.active{background:var(--primary)}
.search-select-empty{padding:9px 12px; font-size:12px; color:var(--muted)}

/* ============================ Bulk-action toolbar ============================ */
.bulk-toolbar{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.bulk-toolbar select{width:auto; min-width:160px}
.bulk-toolbar .bulk-count{font-size:12px; color:var(--muted)}
.bulk-row-chk,.bulk-all-chk{width:16px; height:16px; cursor:pointer}
th.bulk-chk-col,td.bulk-chk-col{width:1%; padding-inline-end:4px}
@media(prefers-reduced-motion:reduce){ .spinner{animation:none} }

/* ============================ In-page actions ============================ */
/* Panel actions run without a page reload (assets/app.js), so the feedback a
   reload used to provide — the message, the "something is happening" cue and the
   guard against double-clicking — is rebuilt here. */

/* Toasts: where flash messages land. */
.toast-stack{
  position:fixed; z-index:120; inset-block-end:18px; inset-inline-start:18px;
  display:flex; flex-direction:column; gap:10px; width:min(380px, calc(100vw - 36px));
  pointer-events:none;
}
.toast{
  pointer-events:auto; margin:0; display:flex; align-items:flex-start; gap:10px;
  background:var(--panel2); box-shadow:0 14px 34px rgba(0,0,0,.42);
  animation:toast-in .22s ease-out;
}
.toast .toast-body{flex:1; min-width:0; line-height:1.9; word-break:break-word}
.toast .toast-body a{text-decoration:underline}
.toast .toast-x{
  flex:none; background:none; border:none; color:inherit; opacity:.65; cursor:pointer;
  font-size:19px; line-height:1; padding:0 2px; margin-top:-1px;
}
.toast .toast-x:hover{opacity:1}
.toast.out{animation:toast-out .2s ease-in forwards}
@keyframes toast-in{from{opacity:0; transform:translateY(10px)}to{opacity:1; transform:none}}
@keyframes toast-out{to{opacity:0; transform:translateY(6px)}}

/* Top progress bar for soft navigation / in-flight actions. */
.panel-progress{
  position:fixed; inset-block-start:0; inset-inline-start:0; z-index:130;
  height:2px; width:0; opacity:0; background:var(--primary);
  box-shadow:0 0 8px var(--primary);
  transition:width .35s ease, opacity .2s;
}
.panel-progress.on{opacity:1}

/* A control that is mid-action: dimmed, unclickable, with a spinning marker. */
.btn.is-busy,button.is-busy{position:relative; opacity:.65; cursor:progress}
.btn.is-busy::after,button.is-busy::after{
  content:''; display:inline-block; width:11px; height:11px; margin-inline-start:7px;
  vertical-align:-1px; border:2px solid currentColor; border-top-color:transparent;
  border-radius:50%; animation:spin .7s linear infinite;
}
form.is-busy{opacity:.85}
@media(prefers-reduced-motion:reduce){
  .btn.is-busy::after,button.is-busy::after{animation:none}
  .toast{animation:none}
}
@media(max-width:600px){
  .toast-stack{inset-inline:12px; width:auto; inset-block-end:12px}
}

/* ============================ Depth & gradients ============================ */
/* The panel was a wall of flat #111d33 rectangles: the sidebar, topbar and every
   card painted the same solid colour, so the ambient wash on <body> never showed
   and nothing had a near/far relationship. These give each surface a soft
   top-to-bottom gradient plus a 1px light edge — the standard dark-UI depth cue.
   Everything stays inside the existing navy/blue axis; gold remains reserved for
   the enterprise surfaces on the public site. */
/* The surfaces are deliberately a few percent TRANSLUCENT. Fully opaque cards
   covered the whole viewport and the ambient glow only ever showed in the 24px
   gutters — which is why the first attempt read as pointless. At ~88% the light
   behind them tints the cards themselves, so the gradient is actually visible
   where the eye is, without touching text contrast. */
:root{
  --grad-surface: linear-gradient(165deg, rgba(28,43,71,.88) 0%, rgba(19,32,56,.90) 46%, rgba(15,26,46,.92) 100%);
  --grad-surface-2:linear-gradient(165deg, rgba(35,52,84,.90) 0%, rgba(24,37,65,.92) 100%);
  --grad-rail:    linear-gradient(200deg, rgba(14,24,41,.96) 0%, rgba(17,29,50,.94) 62%, rgba(30,52,92,.90) 100%);
  --edge-light:   inset 0 1px 0 rgba(255,255,255,.06);
}

/* Ambient light source: bottom-LEFT of the viewport — the far corner of the
   content column in this RTL layout — strong enough to be felt, fading up and
   to the right into deep navy. */
body{
  background:
    radial-gradient(1250px 820px at -8% 112%, rgba(59,130,246,.46), transparent 64%),
    radial-gradient(820px 620px at 22% 104%, rgba(168,85,247,.24), transparent 62%),
    radial-gradient(700px 460px at 2% 74%,  rgba(96,165,250,.16), transparent 60%),
    linear-gradient(345deg, #0d1b30 0%, #0a1220 46%, #070d18 100%);
}

/* …and the light itself falls ACROSS the interface, not just behind it: a fixed,
   screen-blended wash anchored to the bottom-left corner. It sits under the
   sidebar drawer (z-50), toasts (z-120) and the progress bar (z-130), so only
   the page body is tinted. pointer-events:none — it never eats a click. */
body::after{
  content:""; position:fixed; inset:0; z-index:2; pointer-events:none;
  mix-blend-mode:screen;
  background:
    radial-gradient(1100px 780px at -6% 112%, rgba(56,120,240,.30), transparent 62%),
    radial-gradient(680px 520px at 20% 106%, rgba(150,86,235,.17), transparent 60%);
}
@media(max-width:880px){
  /* Cheaper on phones: a blended full-viewport layer repaints on every scroll. */
  body::after{background:radial-gradient(760px 560px at -10% 112%, rgba(56,120,240,.26), transparent 62%)}
}

/* Sidebar & topbar — the frame of the panel. */
.sidebar{background:var(--grad-rail); box-shadow:-2px 0 22px rgba(0,0,0,.26)}
.brand{background:linear-gradient(150deg, rgba(59,130,246,.20), rgba(168,85,247,.07) 55%, transparent)}
.topbar{position:relative; background:linear-gradient(180deg, #16243d 0%, #101c31 100%); border-bottom:none}
/* A gradient hairline instead of a flat 1px border, brightest under the sidebar. */
.topbar::after{
  content:""; position:absolute; inset-inline:0; bottom:0; height:1px;
  background:linear-gradient(to left, rgba(59,130,246,.55), rgba(40,57,79,.9) 45%, rgba(40,57,79,.25));
}
.topbar .bal{background:var(--grad-surface-2); box-shadow:var(--edge-light)}
/* Sidebar items: the hover sweep starts at the sidebar's own (right) edge. */
.nav a:hover{background:linear-gradient(to left, rgba(59,130,246,.16), rgba(59,130,246,.03))}
.nav a.active{background:linear-gradient(to left, var(--primary2), rgba(37,99,235,.28))}

/* Card-like surfaces. */
.card,.table-card,.plan-card,.auth-card,.chartbox{
  background:var(--grad-surface); box-shadow:var(--edge-light);
}
.card:hover{box-shadow:var(--edge-light), 0 10px 30px rgba(0,0,0,.30)}
.plan-card:hover{box-shadow:var(--edge-light), 0 10px 30px rgba(0,0,0,.32)}
.table-card table th{background:linear-gradient(180deg, #1d2c49, #172440)}
.msg.staff{background:linear-gradient(165deg, rgba(37,99,235,.16), rgba(26,40,66,.55))}
.msg.user{background:var(--grad-surface)}
.toast{background:var(--grad-surface-2); box-shadow:var(--edge-light), 0 14px 34px rgba(0,0,0,.45)}
.search-select-list{background:var(--grad-surface-2)}

/* The colour-accented stat cards keep their tint, now over the same surface
   gradient as every other card instead of over bare page background. */
.stat.s-green {background:linear-gradient(120deg,rgba(34,197,94,.12),transparent 62%), var(--grad-surface)}
.stat.s-blue  {background:linear-gradient(120deg,rgba(59,130,246,.12),transparent 62%), var(--grad-surface)}
.stat.s-amber {background:linear-gradient(120deg,rgba(245,158,11,.12),transparent 62%), var(--grad-surface)}
.stat.s-violet{background:linear-gradient(120deg,rgba(168,85,247,.14),transparent 62%), var(--grad-surface)}

/* Inputs sit *into* the surface — slightly darker than the card they live on. */
input,select,textarea{background:linear-gradient(180deg, #0c1526, #0a1220)}
input:focus,select:focus,textarea:focus{box-shadow:0 0 0 3px rgba(59,130,246,.14)}

/* Alerts get the same soft vertical lift as the cards. */
.alert.success{background:linear-gradient(165deg, rgba(34,197,94,.17), rgba(34,197,94,.07))}
.alert.error  {background:linear-gradient(165deg, rgba(239,68,68,.17), rgba(239,68,68,.07))}
.alert.info   {background:linear-gradient(165deg, rgba(59,130,246,.17), rgba(59,130,246,.07))}
.alert.warning{background:linear-gradient(165deg, rgba(245,158,11,.17), rgba(245,158,11,.07))}

/* ---- OS picker: one collapsed row per OS family, expanding to versions ---- */
.os-groups{display:flex;flex-direction:column;gap:8px;margin-top:4px}
.os-empty{padding:16px;border:1px dashed var(--border);border-radius:12px;text-align:center;font-size:13px}

.os-acc{border:1.5px solid var(--border);border-radius:13px;background:var(--panel2);overflow:hidden;transition:border-color .15s}
.os-acc:hover{border-color:var(--line2,var(--border))}
.os-acc.has-sel{border-color:var(--primary);background:linear-gradient(180deg,rgba(59,130,246,.10),transparent)}
.os-acc.open{border-color:var(--primary)}

.os-acc-h{display:flex;align-items:center;gap:10px;width:100%;padding:11px 13px;border:0;background:transparent;color:var(--text);font-family:inherit;font-size:14px;font-weight:700;cursor:pointer;text-align:start}
.os-acc-h .os-ico{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex:0 0 auto;border-radius:9px;background:rgba(148,163,184,.12);color:var(--muted)}
.os-acc-h .os-ico svg{width:18px;height:18px}
.os-acc.has-sel .os-acc-h .os-ico,.os-acc.open .os-acc-h .os-ico{background:rgba(59,130,246,.2);color:var(--primary)}
.os-acc-t{flex:0 0 auto}
.os-acc-pick{flex:1 1 auto;font-size:12.5px;font-weight:600;color:var(--primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.os-count{font-style:normal;font-size:11px;font-weight:600;color:var(--muted);background:rgba(148,163,184,.10);border:1px solid var(--border);border-radius:999px;padding:1px 8px;white-space:nowrap;flex:0 0 auto}
.os-chev{flex:0 0 auto;width:9px;height:9px;border-inline-end:2px solid var(--muted);border-block-end:2px solid var(--muted);transform:rotate(45deg);transition:transform .18s;margin-inline-start:2px}
.os-acc.open .os-chev{transform:rotate(-135deg)}

.os-acc-b{display:none;padding:0 13px 13px}
.os-acc.open .os-acc-b{display:block}
.os-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}

.os-box{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:10px 12px;border:1.5px solid var(--border);border-radius:11px;background:var(--panel);color:var(--text);cursor:pointer;font-family:inherit;font-size:13.5px;font-weight:600;text-align:start;transition:.15s}
.os-box:hover{border-color:var(--primary);transform:translateY(-1px)}
.os-box .os-name{flex:1 1 auto}
.os-box.sel{border-color:var(--primary);background:linear-gradient(180deg,rgba(59,130,246,.16),rgba(59,130,246,.05));box-shadow:0 0 0 3px rgba(59,130,246,.14)}
.os-box.sel::after{content:'✓';color:var(--primary);font-weight:800;font-size:12px}
.os-box.opt{border-color:rgba(34,197,94,.45)}

.os-tag{display:inline-block;font-size:10.5px;font-weight:700;line-height:1.8;padding:0 7px;border-radius:999px;border:1px solid transparent;flex:0 0 auto}
.os-tag.opt{background:rgba(34,197,94,.14);border-color:rgba(34,197,94,.4);color:#22c55e}
.os-tag.warn{background:rgba(245,158,11,.14);border-color:rgba(245,158,11,.4);color:#f59e0b}
.os-warn{color:#f59e0b}
@media (max-width:520px){
  .os-grid{grid-template-columns:repeat(auto-fill,minmax(130px,1fr))}
  .os-acc-pick{display:none}
}

/* ---------------------------------------------------------------------------
   Sidebar navigation — grouped, labelled, with a little life in it.
   Layered over the base .nav rules above (same pattern as the rest of this
   file). Shared by the customer panel and the admin panel, so every rule here
   has to survive an item with no icon and an item with a badge.
   --------------------------------------------------------------------------- */
.sidebar{display:flex; flex-direction:column}
.nav{padding-bottom:14px}

/* Section heading: the «سر تیتر» — bigger, heavier, with a gradient tick so the
   eye can find the group boundaries without reading them. */
.nav .sep{
  display:flex; align-items:center; gap:8px;
  margin:16px 14px 6px; padding:0;
  font-family:'Estedad','Vazirmatn',sans-serif;
  font-size:13px; font-weight:800; letter-spacing:0; text-transform:none;
  color:var(--text); opacity:.92;
}
.nav .sep::before{
  content:''; flex:none; width:3px; height:15px; border-radius:3px;
  background:linear-gradient(180deg,var(--brand-sky),var(--primary2));
  box-shadow:0 0 10px -2px var(--primary);
}
/* The heading's icon — items themselves carry no icon (owner's order). */
.nav .sep .ic{flex:none; font-size:15px; line-height:1; filter:saturate(.9)}
/* The bare separator before «خروج» is a rule, not a heading. */
.nav .sep:empty{
  height:1px; min-height:1px; margin:14px 20px; padding:0; opacity:1;
  background:linear-gradient(90deg,transparent,var(--border),transparent);
}
.nav .sep:empty::before{display:none}

/* Collapsible headings — app.js marks each heading `togglable`, adds the
   chevron, and folds the group's items with `.nav-folded` on click. */
.nav .sep.togglable{cursor:pointer; -webkit-user-select:none; user-select:none}
.nav .sep.togglable:hover{opacity:1}
.nav .sep.togglable:focus-visible{outline:2px solid var(--primary); outline-offset:2px; border-radius:6px}
.nav .sep .sep-chev{
  margin-inline-start:auto; font-size:11px; line-height:1;
  color:var(--muted); opacity:.7;
  transition:transform .18s ease;
}
/* Collapsed: the chevron turns toward the reading direction (left, in RTL). */
.nav .sep.collapsed .sep-chev{transform:rotate(90deg)}
.nav a.nav-folded{display:none}
/* A folded section hiding unread badges (تیکت‌ها…) wears a dot on its heading. */
.nav .sep.has-badge::after{
  content:''; flex:none; width:7px; height:7px; border-radius:50%;
  margin-inline-start:5px; background:var(--red);
  box-shadow:0 0 7px -1px var(--red);
}

.nav a{
  gap:10px; margin:2px 10px; padding:10px 12px 10px 12px;
  padding-inline-start:25px; border-radius:11px;
  font-size:13.5px; color:var(--muted);
  transition:background .16s, color .16s, transform .16s, box-shadow .16s;
}
.nav a .tx{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.nav a:hover{background:rgba(255,255,255,.055); color:var(--text)}

.nav a.active{
  color:#fff; font-weight:700;
  background:linear-gradient(90deg,rgba(37,99,235,.42),rgba(37,99,235,.10));
  box-shadow:0 8px 22px -14px var(--primary);
}
/* Active marker sits on the inline-start edge so it works in RTL and LTR.
   ORDER MATTERS: the physical resets must come FIRST — in RTL inset-inline-start
   resolves to `right`, so a later `right:auto` would silently undo it. */
.nav a.active::before{
  content:''; position:absolute; top:9px; bottom:9px;
  left:auto; right:auto; inset-inline-start:4px;
  width:3px; border-radius:3px; background:#fff; opacity:.95;
}
.nav a:focus-visible{outline:2px solid var(--primary); outline-offset:2px}

/* «خروج» reads as an exit, not as another destination. */
.nav a.nav-out{color:#f0a5a5}
.nav a.nav-out:hover{background:rgba(239,68,68,.12); color:#ffc9c9}

@media (prefers-reduced-motion:reduce){
  .nav a{transition:none}
}

/* ---- App picker («نصب خودکار برنامه‌ها»): category tabs + search over a grid ----
   Sibling of the OS picker above, but browsed rather than scanned — see the note
   at the top of assets/app-picker.js for why the two look different. */
.ap-wrap{margin-top:4px}
.ap-empty{padding:16px;border:1px dashed var(--border);border-radius:12px;text-align:center;font-size:13px}

.ap-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:10px}
.ap-tabs{display:flex;flex-wrap:wrap;gap:6px;flex:1 1 auto}
.ap-tab{padding:6px 12px;border:1.5px solid var(--border);border-radius:999px;background:var(--panel);
  color:var(--muted);font-family:inherit;font-size:12.5px;font-weight:700;cursor:pointer;transition:.15s}
.ap-tab:hover{border-color:var(--primary);color:var(--text)}
.ap-tab.sel{border-color:var(--primary);color:#fff;background:linear-gradient(135deg,var(--primary),var(--primary2))}
.ap-search{flex:0 1 240px;min-width:160px;padding:8px 12px;border:1.5px solid var(--border);border-radius:10px;
  background:var(--panel);color:var(--text);font-family:inherit;font-size:13px}
.ap-search:focus{outline:none;border-color:var(--primary)}

.ap-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(215px,1fr));gap:9px}
.ap-card{position:relative;display:flex;align-items:flex-start;gap:10px;padding:11px 12px;text-align:start;
  border:1.5px solid var(--border);border-radius:12px;background:var(--panel);color:var(--text);
  font-family:inherit;cursor:pointer;transition:.15s}
.ap-card:hover{border-color:var(--primary);transform:translateY(-1px)}
.ap-card.sel{border-color:var(--primary);background:linear-gradient(180deg,rgba(59,130,246,.16),rgba(59,130,246,.05));
  box-shadow:0 0 0 3px rgba(59,130,246,.14)}
.ap-card.sel::after{content:'✓';position:absolute;top:8px;inset-inline-end:10px;color:var(--primary);font-weight:800;font-size:12px}
.ap-ico{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:34px;height:34px;
  border-radius:10px;background:rgba(148,163,184,.12);font-size:18px;line-height:1}
.ap-card.sel .ap-ico{background:rgba(59,130,246,.2)}
.ap-body{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 auto}
.ap-name{font-size:13.5px;font-weight:700}
.ap-latin{font-size:11px;color:var(--muted);letter-spacing:.2px}
.ap-desc{font-size:11.5px;color:var(--muted);line-height:1.6;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.ap-tags{display:flex;flex-wrap:wrap;gap:4px;margin-top:3px}
.ap-tag{padding:1px 7px;border-radius:999px;background:rgba(148,163,184,.16);color:var(--muted);font-size:10.5px;font-weight:700}
.ap-tag.warn{background:rgba(245,158,11,.18);color:#fbbf24}
.ap-none{margin-top:9px;font-size:12px}

/* Install status on the server page. */
.ap-jobs{display:flex;flex-direction:column;gap:9px}
.ap-job{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1.5px solid var(--border);border-radius:12px;background:var(--panel2)}
.ap-job .ap-ico{width:30px;height:30px;font-size:16px}
.ap-job-b{flex:1 1 auto;min-width:0}
.ap-job-n{font-size:13px;font-weight:700}
.ap-job-s{font-size:11.5px;color:var(--muted)}
.ap-creds{margin-top:8px;padding:10px 12px;border:1px dashed var(--border);border-radius:10px;background:var(--panel)}
.ap-creds div{display:flex;gap:8px;font-size:12.5px;padding:2px 0}
.ap-creds b{flex:0 0 80px;color:var(--muted);font-weight:600}
.ap-creds span{word-break:break-all}
.ap-log{margin-top:8px;max-height:220px;overflow:auto;padding:10px;border-radius:10px;background:#0b1220;
  color:#cbd5e1;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:11px;line-height:1.65;white-space:pre-wrap;direction:ltr;text-align:left}

@media(max-width:600px){.ap-grid{grid-template-columns:1fr}}
/* A card whose app needs more than the customer picked. Advisory: still selectable. */
.ap-card.ap-tight{border-color:rgba(245,158,11,.5)}
.ap-card.ap-tight .ap-ico{background:rgba(245,158,11,.14)}

/* ==================== Stat cards that are themselves links ==================== */
/* A summary figure the operator can act on: the whole card is the <a>, so the
   number, the label and the empty space around them all navigate. Anchors here
   inherit the card's own colours — a stat card that turned blue-and-underlined
   would stop reading as a card. */
a.stat-link{color:inherit; text-decoration:none}
a.stat-link:hover{text-decoration:none; border-color:rgba(59,130,246,.55); transform:translateY(-1px)}
a.stat-link:focus-visible{outline:2px solid var(--primary); outline-offset:2px}
.stat .go{font-size:11px; color:var(--muted)}
a.stat-link:hover .go{color:var(--primary)}

/* «خوانده‌نشده» state: the desk has something waiting on it. Red accent bar down
   the card edge + a pulsing dot next to the label. The pulse is the only moving
   thing on the dashboard, which is what keeps it readable as an alert rather
   than decoration — and it is dropped entirely under reduced-motion. */
.stat.stat-alert::before{background:var(--red)}
.stat-dot{display:inline-block; width:8px; height:8px; margin-inline-start:6px; border-radius:50%;
  background:var(--red); vertical-align:middle;
  box-shadow:0 0 0 0 rgba(239,68,68,.55); animation:stat-pulse 1.8s ease-out infinite}
@keyframes stat-pulse{70%{box-shadow:0 0 0 7px rgba(239,68,68,0)} 100%{box-shadow:0 0 0 0 rgba(239,68,68,0)}}
.stat .stat-new{font-size:11px; font-weight:700; color:var(--red)}
@media(prefers-reduced-motion:reduce){ .stat-dot{animation:none} }

/* ---------------------------------------------------------------------------
   «پیوست تصویر در تیکت» — attachments on a support thread.

   Three pieces: the thumbnail strip under a message (.tk-files), the picker in
   the reply form (.tk-upload) and the full-size overlay (.tk-lightbox). Sizes
   are fixed in px rather than a fluid grid on purpose: a support thread mixes
   phone screenshots (tall) with desktop ones (wide), and a row of equal tiles
   reads as a set of attachments where a fluid grid reads as a broken layout.
   --------------------------------------------------------------------------- */
.tk-files{display:flex; flex-wrap:wrap; gap:10px; margin-top:10px}
.tk-file{
  display:block; width:132px; border:1px solid var(--border); border-radius:10px;
  overflow:hidden; background:var(--panel2); color:var(--muted); text-decoration:none;
  transition:border-color .15s ease, transform .15s ease;
}
.tk-file:hover{border-color:var(--primary); transform:translateY(-1px); text-decoration:none}
.tk-file:focus-visible{outline:2px solid var(--primary); outline-offset:2px}
/* object-fit keeps a 9:16 phone capture and a 16:9 desktop one the same tile
   size without squashing either — the overlay is where the real shape is seen. */
.tk-file img{display:block; width:100%; height:96px; object-fit:cover; background:#0d1626}
.tk-file-meta{
  display:block; padding:5px 7px; font-size:11px; direction:ltr; text-align:center;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* ---- the picker -------------------------------------------------------- */
.tk-upload input[type=file]{
  width:100%; padding:9px 10px; font-size:13px; color:var(--muted);
  background:var(--panel2); border:1px dashed var(--border); border-radius:10px; cursor:pointer;
}
.tk-upload input[type=file]:hover{border-color:var(--primary)}
.tk-upload-prev{display:flex; flex-wrap:wrap; gap:8px; margin-top:8px}
.tk-upload-item{
  position:relative; width:92px; border:1px solid var(--border); border-radius:9px;
  overflow:hidden; background:var(--panel2);
}
.tk-upload-item img{display:block; width:100%; height:64px; object-fit:cover}
.tk-upload-item span{
  display:block; padding:4px 5px; font-size:10.5px; color:var(--muted);
  text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.tk-upload-item.is-bad{border-color:var(--red)}
.tk-upload-item.is-bad span{color:var(--red)}
.tk-upload-x{
  position:absolute; inset-block-start:3px; inset-inline-end:3px; width:20px; height:20px;
  padding:0; line-height:18px; font-size:15px; border:0; border-radius:50%; cursor:pointer;
  color:#fff; background:rgba(0,0,0,.62);
}
.tk-upload-x:hover{background:var(--red)}
.tk-upload-err{margin-top:8px; font-size:12.5px}

/* ---- the overlay ------------------------------------------------------- */
.tk-lightbox{
  position:fixed; inset:0; z-index:2000; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:12px; padding:24px;
  background:rgba(4,10,20,.88); backdrop-filter:blur(3px);
}
.tk-lightbox img{
  max-width:min(100%,1400px); max-height:calc(100vh - 130px);
  object-fit:contain; border-radius:10px; background:#0d1626;
  box-shadow:0 24px 60px rgba(0,0,0,.55);
}
.tk-lightbox-bar{display:flex; gap:12px; align-items:center; flex-wrap:wrap; justify-content:center}
.tk-lightbox-name{font-size:12.5px; color:var(--muted); max-width:60vw;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.tk-lightbox-x{
  position:absolute; inset-block-start:14px; inset-inline-end:16px;
  width:38px; height:38px; padding:0; line-height:36px; font-size:24px; cursor:pointer;
  color:#fff; background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.18);
  border-radius:50%;
}
.tk-lightbox-x:hover{background:rgba(255,255,255,.20)}
/* The page behind the overlay must not scroll under it on touch. */
body.tk-lightbox-on{overflow:hidden}

/* ---------------------------------------------------------------------------
   The sidebar stays put. On desktop the rail is its own scroll area pinned to
   the viewport, so picking an item never moves the menu — only the content
   region changes (soft navigation, app.js). On phones the drawer scrolls
   inside itself instead of cutting the lower items off. No z-index on
   purpose: the rail stays under the ambient light wash like before.
   --------------------------------------------------------------------------- */
@media (min-width:881px){
  .sidebar{position:sticky; top:0; align-self:flex-start; height:100vh; height:100dvh;
    overflow-y:auto; overscroll-behavior:contain}
}
@media (max-width:880px){
  .sidebar{overflow-y:auto; overscroll-behavior:contain}
}
.sidebar > *{flex-shrink:0}
.sidebar{scrollbar-width:thin; scrollbar-color:rgba(96,165,250,.28) transparent}
.sidebar::-webkit-scrollbar{width:6px}
.sidebar::-webkit-scrollbar-thumb{background:rgba(96,165,250,.25); border-radius:6px}
.sidebar::-webkit-scrollbar-track{background:transparent}

/* ---------------------------------------------------------------------------
   Admin → تنظیمات: tab bar, search, save bar, Shahkar connection test.
   One form underneath — the tabs only show and hide parts of it.
   --------------------------------------------------------------------------- */
.stabs-head{flex-wrap:wrap; gap:10px}
.stabs-tools{gap:8px; align-items:center; flex-wrap:wrap}
.stabs-search{width:250px; max-width:100%; padding:8px 12px; font-size:13px}
.stabs-bar{position:sticky; top:0; z-index:20; margin:0 -24px 18px; padding:0 24px;
  background:linear-gradient(180deg, rgba(10,18,32,.97), rgba(10,18,32,.92));
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px)}
.stabs-bar .tabs{margin-bottom:0}
.stabs .tab{display:inline-flex; align-items:center; gap:6px; text-decoration:none}
.stabs .tab:hover{text-decoration:none}
.stabs .tab.dirty::after{content:''; width:7px; height:7px; border-radius:50%; flex:none;
  background:var(--amber); box-shadow:0 0 8px rgba(245,158,11,.6)}
.stabs .tab.s-none{opacity:.45}
.stab-hits{display:inline-grid; place-items:center; min-width:18px; height:18px; padding:0 5px;
  border-radius:9px; background:rgba(59,130,246,.24); color:#d6e4ff; font-size:11px; font-weight:700}
.stab-hits[hidden]{display:none}
.spane-title{display:none; margin:4px 0 10px; font-size:14px; font-weight:700; color:var(--muted)}
#settingsForm.searching .stabs-pane{display:block; animation:none}
#settingsForm.searching .stabs-pane.s-empty{display:none}
#settingsForm.searching .spane-title{display:block}
#settingsForm.searching .card.s-miss{display:none}
#settingsForm.searching .form-row.s-hit{background:rgba(59,130,246,.08); box-shadow:inset -3px 0 0 var(--primary);
  border-radius:8px; padding:6px 10px}
.stabs-empty{padding:28px 12px; text-align:center; color:var(--muted)}
.stabs-empty[hidden]{display:none}
.stabs-save{position:sticky; bottom:12px; z-index:20; display:flex; align-items:center; justify-content:space-between;
  gap:12px; flex-wrap:wrap; margin-top:6px; padding:10px 14px; border-radius:12px; border:1px solid var(--border);
  background:var(--grad-surface-2); box-shadow:var(--edge-light), 0 12px 30px rgba(0,0,0,.35);
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px)}
.stabs-note{font-size:12px; color:var(--muted)}
.stabs-save.has-changes{border-color:rgba(245,158,11,.55)}
.stabs-save.has-changes .stabs-note{color:#fcd34d}

.shk-stats{display:flex; flex-wrap:wrap; gap:6px 18px; margin:-4px 0 12px; font-size:12px; color:var(--muted)}
.shk-stats b{color:var(--text)}
.shk-stats b.shk-warn{color:var(--amber)}
.shk-test{margin:14px 0; padding:14px; border-radius:12px; border:1px solid var(--border); background:rgba(10,18,32,.35)}
.shk-test-head{display:flex; align-items:flex-start; justify-content:space-between; gap:12px}
.shk-test-head .help{margin-top:4px}
.shk-test-head .btn{flex:none}
.shk-result{margin-top:12px}
.shk-result[hidden]{display:none}
.shk-wait{padding:8px 0; font-size:13px; color:var(--muted)}
.shk-verdict{display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border-radius:10px; border:1px solid; font-size:13px}
.shk-verdict.lvl-ok{border-color:rgba(34,197,94,.5); background:rgba(34,197,94,.08)}
.shk-verdict.lvl-warn{border-color:rgba(245,158,11,.55); background:rgba(245,158,11,.08)}
.shk-verdict.lvl-fail{border-color:rgba(239,68,68,.55); background:rgba(239,68,68,.08)}
.shk-vic{flex:none; display:grid; place-items:center; width:22px; height:22px; border-radius:50%; font-size:13px; font-weight:800}
.lvl-ok .shk-vic{background:var(--green); color:#04120a}
.lvl-warn .shk-vic{background:var(--amber); color:#1a1000}
.lvl-fail .shk-vic{background:var(--red); color:#fff}
.shk-hint{margin-top:4px; line-height:1.9; color:var(--muted)}
.shk-steps{display:grid; gap:4px; margin:10px 0 0; padding:0; list-style:none}
.shk-steps li{display:grid; grid-template-columns:22px minmax(120px,auto) 1fr; gap:8px; align-items:baseline;
  padding:6px 8px; border-radius:8px; background:rgba(255,255,255,.025); font-size:12.5px}
.shk-steps .st-ic{text-align:center; font-weight:800}
.shk-steps .st-ok .st-ic{color:var(--green)}
.shk-steps .st-warn .st-ic{color:var(--amber)}
.shk-steps .st-fail .st-ic{color:var(--red)}
.shk-steps .st-skip .st-ic{color:var(--muted)}
.shk-steps .st-l{font-weight:700}
.shk-steps .st-d{color:var(--muted); overflow-wrap:anywhere}
.shk-meta{margin-top:8px; font-size:11.5px; color:var(--muted); overflow-wrap:anywhere}
.shk-query{margin-top:12px}
.shk-query summary{cursor:pointer; font-size:13px; color:var(--muted)}
.shk-query[open] summary{margin-bottom:6px; color:var(--text)}
.shk-query-row{display:grid; grid-template-columns:1fr 1fr auto; gap:10px; align-items:end}
.shk-query-row .form-row{margin-bottom:0}
/* Shahkar: the three-way service choice (off / Zohal / api.ir) and its token */
.shk-mode{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px}
.shk-opt{display:flex; gap:10px; align-items:flex-start; margin:0; padding:10px 12px; border:1px solid var(--border);
  border-radius:10px; background:rgba(6,12,24,.35); color:var(--text); cursor:pointer; transition:border-color .15s, background .15s}
.shk-opt input{width:auto; flex:none; margin:3px 0 0; padding:0; accent-color:var(--primary)}
.shk-opt b{display:block; font-size:13px}
.shk-opt small{display:block; margin-top:2px; font-size:11px; color:var(--muted)}
.shk-opt:has(input:checked){border-color:var(--primary); background:rgba(59,130,246,.10)}
.shk-opt:has(input[value="off"]:checked){border-color:rgba(245,158,11,.55); background:rgba(245,158,11,.08)}
.shk-opt:focus-within{box-shadow:0 0 0 3px rgba(59,130,246,.22)}
.shk-tok.is-active > label{color:var(--text)}
.shk-tok.is-active > label::after{content:" — سرویس فعال"; color:var(--green); font-size:11px}
.shk-prov{display:inline-flex; align-items:center; gap:6px; margin:0 8px 0 0; font-size:12px; vertical-align:middle}
.shk-prov select{width:auto; padding:3px 8px; font-size:12px}
/* «اولویت درگاه‌ها» — the re-orderable gateway list */
.gw-prio{display:grid; gap:6px; margin:0 0 8px; padding:0; list-style:none}
.gw-prio-item{display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--border);
  border-radius:10px; background:rgba(6,12,24,.35); cursor:grab; user-select:none}
.gw-prio-item.is-off .gw-prio-name{color:var(--muted)}
.gw-prio-item.is-drag{opacity:.55; border-style:dashed; border-color:var(--primary)}
.gw-prio-grip{flex:none; color:var(--muted); font-size:13px; letter-spacing:-3px}
.gw-prio-n{flex:none; display:grid; place-items:center; width:24px; height:24px; border-radius:50%;
  background:var(--panel2); font-size:12px; font-weight:800}
.gw-prio-name{flex:1; min-width:0; font-size:13px; font-weight:700}
.gw-prio-btns{flex:none; display:flex; gap:4px}
.gw-prio-btns .btn{padding:3px 9px; line-height:1.4}
.gw-prio-btns .btn:disabled{opacity:.35; cursor:default}
@media(max-width:600px){
  .stabs-bar{margin:0 -14px 14px; padding:0 14px}
  .stabs-search{width:100%}
  .stabs-tools{width:100%}
  .shk-test-head{flex-direction:column}
  .shk-query-row{grid-template-columns:1fr}
  .shk-steps li{grid-template-columns:22px 1fr}
  .shk-steps .st-d{grid-column:2}
  .shk-mode{grid-template-columns:1fr}
  .gw-prio-item{flex-wrap:wrap}
  .gw-prio-grip{display:none}
}

/* =====================================================================
   «نسخه‌ی انگلیسی» — English (LTR) panel. Everything below is scoped to
   html[lang=en] / html[dir=ltr] — NEVER a bare [dir=ltr] (customer views carry
   hundreds of dir="ltr" cells, and a bare selector would hit them on Persian
   pages). Physical values are mirrored rather than converted to start/end:
   text-align inherits as a keyword and would flip LTR cells in Persian.
   ===================================================================== */
/* English UI face — Inter (OFL), Latin subset only; Persian text inside an
   English page (customer names, stored history) keeps Vazirmatn. */
@font-face{
  font-family:'Inter';
  src:url('fonts/v3/Inter-latin.woff2') format('woff2');
  font-weight:400 900; font-style:normal; font-display:swap;
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
html[lang=en] body{font-family:'Inter','Vazirmatn','Segoe UI',Arial,sans-serif; direction:ltr}
html[lang=en] h1,html[lang=en] h2,html[lang=en] h3,html[lang=en] .page-title,html[lang=en] .brand,
html[lang=en] .auth-card h1,html[lang=en] .auth-form h1,html[lang=en] .auth-hero h2,html[lang=en] .card h3,
html[lang=en] .stat .value,html[lang=en] .plan-price,html[lang=en] .brand small{
  font-family:'Inter','Vazirmatn',sans-serif; letter-spacing:-.01em;
}
html[lang=en] button,html[lang=en] input,html[lang=en] select,html[lang=en] textarea{font-family:inherit}
html[dir=ltr] th,html[dir=ltr] td{text-align:left}
html[dir=ltr] .sidebar{border-left:none; border-right:1px solid var(--border); box-shadow:2px 0 22px rgba(0,0,0,.26)}
html[dir=ltr] .brand{background:linear-gradient(210deg, rgba(59,130,246,.20), rgba(168,85,247,.07) 55%, transparent)}
html[dir=ltr] .stat::before{right:auto; left:0}
html[dir=ltr] .stat.s-green {background:linear-gradient(240deg,rgba(34,197,94,.12),transparent 62%), var(--grad-surface)}
html[dir=ltr] .stat.s-blue  {background:linear-gradient(240deg,rgba(59,130,246,.12),transparent 62%), var(--grad-surface)}
html[dir=ltr] .stat.s-amber {background:linear-gradient(240deg,rgba(245,158,11,.12),transparent 62%), var(--grad-surface)}
html[dir=ltr] .stat.s-violet{background:linear-gradient(240deg,rgba(168,85,247,.14),transparent 62%), var(--grad-surface)}
html[dir=ltr] .nav a.active{background:linear-gradient(270deg,rgba(37,99,235,.42),rgba(37,99,235,.10))}
html[dir=ltr] .nav .sep.collapsed .sep-chev{transform:rotate(-90deg)}
html[dir=ltr] .topbar::after{background:linear-gradient(to right, rgba(59,130,246,.55), rgba(40,57,79,.9) 45%, rgba(40,57,79,.25))}
html[dir=ltr]{--grad-rail:linear-gradient(160deg, rgba(14,24,41,.96) 0%, rgba(17,29,50,.94) 62%, rgba(30,52,92,.90) 100%)}
html[dir=ltr] body{
  background:
    radial-gradient(1250px 820px at 108% 112%, rgba(59,130,246,.46), transparent 64%),
    radial-gradient(820px 620px at 78% 104%, rgba(168,85,247,.24), transparent 62%),
    radial-gradient(700px 460px at 98% 74%,  rgba(96,165,250,.16), transparent 60%),
    linear-gradient(15deg, #0d1b30 0%, #0a1220 46%, #070d18 100%);
  background-attachment:fixed;
}
html[dir=ltr] body::after{
  background:
    radial-gradient(1100px 780px at 106% 112%, rgba(56,120,240,.30), transparent 62%),
    radial-gradient(680px 520px at 80% 106%, rgba(150,86,235,.17), transparent 60%);
}
@media(max-width:880px){
  html[dir=ltr] .sidebar{right:auto; left:-240px; transition:left .2s}
  html[dir=ltr] .sidebar.open{left:0}
  html[dir=ltr] body::after{background:radial-gradient(760px 560px at 110% 112%, rgba(56,120,240,.26), transparent 62%)}
}
/* Topbar end: calendar + language switches sit beside the balance pill. */
.topbar .tb-end{display:flex; align-items:center; gap:8px}
/* «EN / فا»: the language as a round badge (2026-11-05, was the word «English»). */
.topbar .lang-sw{display:inline-flex; align-items:center; justify-content:center; flex:none; width:34px; height:34px; padding:0;
  font-size:12px; font-weight:800; letter-spacing:.3px; border-radius:50%; color:var(--text);
  border:1px solid var(--border); background:rgba(255,255,255,.04); line-height:1}
.topbar .lang-sw:hover{border-color:var(--primary); text-decoration:none}
/* «شمسی | میلادی»: the customer's calendar (app/Calendar.php); the active one is filled. */
.topbar .cal-sw{display:inline-flex; align-items:center; flex:none; gap:2px; padding:3px; border-radius:20px;
  border:1px solid var(--border); background:rgba(255,255,255,.04)}
.topbar .cal-sw a,.topbar .cal-sw span{font-size:12px; font-weight:700; padding:4px 10px; border-radius:16px; color:var(--muted); line-height:1.4; white-space:nowrap}
.topbar .cal-sw a:hover{color:var(--text); text-decoration:none}
.topbar .cal-sw .on{background:var(--primary); color:#fff; cursor:default}
/* The greeting gives way first: it shrinks (ellipsis) before the switches or the balance wrap. */
.topbar > .flex{min-width:0; overflow:hidden}
.topbar > .flex > span{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.topbar .tb-end{min-width:0}
@media(max-width:600px){
  .topbar .tb-end{gap:6px}
  .topbar .cal-sw a,.topbar .cal-sw span{font-size:11.5px; padding:4px 7px}
  .topbar .lang-sw{width:30px; height:30px; font-size:11.5px}
}
@media(max-width:480px){
  .topbar > .flex{display:none}
  .topbar .bal{font-size:11.5px; padding:6px 9px}
}
@media(max-width:360px){
  .topbar{padding:10px 10px}
  .topbar .tb-end{gap:4px}
  .topbar .cal-sw a,.topbar .cal-sw span{font-size:11px; padding:4px 6px}
  .topbar .lang-sw{width:28px; height:28px; font-size:11px}
  .topbar .bal{font-size:11px; padding:5px 7px}
}
.topbar .lang-sw[lang=fa]{font-family:'Vazirmatn',sans-serif}
.topbar .lang-sw[lang=en]{font-family:'Inter','LatinUI',sans-serif}
/* Auth/blank pages: a quiet switch above the card. */
.lang-sw-auth{display:inline-block; margin:0 0 10px; font-size:12.5px; font-weight:700; padding:5px 12px; border-radius:20px;
  color:var(--muted); border:1px solid var(--border); background:rgba(255,255,255,.03)}
.lang-sw-auth:hover{color:var(--text); border-color:var(--primary); text-decoration:none}
.lang-sw-auth[lang=fa]{font-family:'Vazirmatn',sans-serif}
.lang-sw-auth[lang=en]{font-family:'Inter','LatinUI',sans-serif}

/* =====================================================================
   «حالت روشن / تیره» — the day/night switch (views/partials/theme_toggle.php)
   and the CREAM LIGHT THEME (2026-11-12, owner: «کرم مانند، نه خیلی سفید»).

   The choice lives on <html data-theme="light"> (head_common.php sets it before
   the first paint). Dark = NO attribute, so every rule above renders exactly as
   it did; everything light-only below is scoped to html[data-theme="light"].
   Palette (WCAG contrast on the ivory card #fcf8f1 / cream page #f4eee3):
     text #2b2419 ≈14:1 · muted #6b5e4b ≈6.0/5.5:1 · links #1d4ed8 ≈6.3:1 ·
     green #166534 ≈6.6:1 · red #b91c1c ≈6.1:1 · amber #92400e ≈6.7:1 ·
     violet #6d28d9 ≈6.7:1 — all ≥4.5:1 on the tinted badge/alert fills too.
   ===================================================================== */
.theme-sw{display:inline-flex; align-items:center; flex:none; width:auto; margin:0; padding:0; border:0;
  background:none; color:inherit; font:inherit; line-height:1; cursor:pointer; -webkit-tap-highlight-color:transparent}
.theme-sw .ts-track{position:relative; display:inline-flex; align-items:center; justify-content:space-between;
  width:56px; height:30px; padding:0 7px; border-radius:999px; border:1px solid var(--border);
  background:rgba(255,255,255,.04); transition:border-color .2s, background-color .2s}
.theme-sw:hover .ts-track{border-color:var(--primary)}
.theme-sw:focus-visible{outline:none}
.theme-sw:focus-visible .ts-track{outline:2px solid var(--primary); outline-offset:2px}
.theme-sw .ts-ic{position:relative; z-index:1; width:15px; height:15px; flex:none; color:var(--muted); transition:color .2s}
/* Dark (default): the knob sits under the moon (inline-end); light: under the sun (inline-start). */
.theme-sw .ts-knob{position:absolute; top:3px; inset-inline-start:calc(100% - 25px); width:22px; height:22px; border-radius:50%;
  background:linear-gradient(135deg,#1e3a8a,#3730a3); box-shadow:0 2px 6px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.12);
  transition:inset-inline-start .25s ease, background .25s}
.theme-sw .ts-moon{color:#fde68a}
html[data-theme="light"] .theme-sw .ts-knob{inset-inline-start:3px; background:linear-gradient(135deg,#fffdf8,#fbf1dc);
  box-shadow:0 1px 3px rgba(120,90,40,.35), inset 0 -1px 0 rgba(180,140,80,.18)}
html[data-theme="light"] .theme-sw .ts-sun{color:#c2410c}
html[data-theme="light"] .theme-sw .ts-moon{color:#8a7c66}
html[data-theme="light"] .theme-sw .ts-track{background:#ece3d2; border-color:#d6c8ae}
html[data-theme="light"] .theme-sw:hover .ts-track{border-color:var(--primary)}
@media(prefers-reduced-motion:reduce){ .theme-sw .ts-knob{transition:none} }
@media(max-width:600px){ .theme-sw .ts-track{width:50px; height:28px; padding:0 6px} .theme-sw .ts-knob{width:20px; height:20px; inset-inline-start:calc(100% - 23px)}
  html[data-theme="light"] .theme-sw .ts-knob{inset-inline-start:3px} .theme-sw .ts-ic{width:14px; height:14px} }
@media(max-width:360px){ .theme-sw .ts-track{width:46px; height:26px; padding:0 5px} .theme-sw .ts-knob{width:18px; height:18px; inset-inline-start:calc(100% - 21px)}
  html[data-theme="light"] .theme-sw .ts-knob{inset-inline-start:3px} .theme-sw .ts-ic{width:13px; height:13px} }
/* Topbar: as tall as the «EN» badge beside it (30 / 28 / 34px); the knob stays centred. */
@media(max-width:600px){ .topbar .theme-sw .ts-track{height:30px} .topbar .theme-sw .ts-knob{top:4px} }
@media(max-width:360px){ .topbar .theme-sw .ts-track{height:28px} }
@media(min-width:601px){ .topbar .theme-sw .ts-track{height:34px} .topbar .theme-sw .ts-knob{top:5px} }
/* Auth pages: beside «English / فارسی», above the card. */
.theme-sw-auth{vertical-align:middle; margin:0 0 10px; margin-inline-end:8px}

/* ---------------------------- light tokens ---------------------------- */
html[data-theme="light"]{
  color-scheme:light;
  --bg:#f4eee3; --panel:#fcf8f1; --panel2:#f1e9db; --muted:#6b5e4b; --text:#2b2419;
  --primary:#1d4ed8; --primary2:#1e40af; --green:#166534; --red:#b91c1c; --amber:#92400e; --purple:#6d28d9;
  --border:#e2d6c2; --line2:#cdbfa6;
  --brand-navy:#0A1B33; --brand-blue:#1E4B8F; --brand-sky:#3b82f6;
  --grad-surface: linear-gradient(165deg, rgba(255,253,248,.96) 0%, rgba(252,248,241,.96) 46%, rgba(249,244,235,.97) 100%);
  --grad-surface-2:linear-gradient(165deg, #fffbf4 0%, #f7f0e4 100%);
  --grad-rail:    linear-gradient(200deg, #f8f2e7 0%, #f4ecdf 62%, #ede3d2 100%);
  --edge-light:   inset 0 1px 0 rgba(255,255,255,.75);
  --shadow-soft:  0 1px 2px rgba(90,70,40,.06), 0 8px 24px -16px rgba(90,70,40,.22);
}
html[data-theme="light"] ::selection{background:rgba(29,78,216,.18)}

/* ---------------------------- page + frame ---------------------------- */
html[data-theme="light"] body{
  background:
    radial-gradient(1250px 820px at -8% 112%, rgba(59,130,246,.10), transparent 64%),
    radial-gradient(820px 620px at 22% 104%, rgba(168,85,247,.05), transparent 62%),
    radial-gradient(900px 560px at 104% -8%, rgba(214,170,98,.16), transparent 60%),
    linear-gradient(345deg, #eee5d5 0%, #f4eee3 46%, #f8f3ea 100%);
  background-color:var(--bg); background-attachment:fixed;
}
html[data-theme="light"][dir=ltr] body{
  background:
    radial-gradient(1250px 820px at 108% 112%, rgba(59,130,246,.10), transparent 64%),
    radial-gradient(820px 620px at 78% 104%, rgba(168,85,247,.05), transparent 62%),
    radial-gradient(900px 560px at -4% -8%, rgba(214,170,98,.16), transparent 60%),
    linear-gradient(15deg, #eee5d5 0%, #f4eee3 46%, #f8f3ea 100%);
  background-color:var(--bg); background-attachment:fixed;
}
/* The screen-blended light wash would bleach cream to white: off in light. */
html[data-theme="light"] body::after{display:none}

html[data-theme="light"] .sidebar{background:var(--grad-rail); box-shadow:-2px 0 22px rgba(90,70,40,.10)}
html[data-theme="light"][dir=ltr] .sidebar{box-shadow:2px 0 22px rgba(90,70,40,.10)}
html[data-theme="light"] .brand{background:linear-gradient(150deg, rgba(59,130,246,.10), rgba(168,85,247,.04) 55%, transparent)}
html[data-theme="light"][dir=ltr] .brand{background:linear-gradient(210deg, rgba(59,130,246,.10), rgba(168,85,247,.04) 55%, transparent)}
html[data-theme="light"] .brand small{color:var(--muted)}
html[data-theme="light"] .sidebar{scrollbar-color:rgba(120,100,70,.28) transparent}
html[data-theme="light"] .sidebar::-webkit-scrollbar-thumb{background:rgba(120,100,70,.25)}

html[data-theme="light"] .topbar{background:linear-gradient(180deg, #fcf7ee 0%, #f6efe2 100%)}
html[data-theme="light"] .topbar::after{background:linear-gradient(to left, rgba(29,78,216,.40), rgba(205,191,166,.95) 45%, rgba(205,191,166,.35))}
html[data-theme="light"][dir=ltr] .topbar::after{background:linear-gradient(to right, rgba(29,78,216,.40), rgba(205,191,166,.95) 45%, rgba(205,191,166,.35))}
html[data-theme="light"] .topbar .bal{border:1px solid var(--border); box-shadow:var(--edge-light), 0 1px 2px rgba(90,70,40,.06)}
html[data-theme="light"] .topbar .lang-sw,
html[data-theme="light"] .topbar .cal-sw,
html[data-theme="light"] .lang-sw-auth{background:rgba(255,255,255,.55); border-color:#d9ccb5}
html[data-theme="light"] .topbar .lang-sw:hover,
html[data-theme="light"] .lang-sw-auth:hover{border-color:var(--primary)}

/* Sidebar items: a soft blue pill for the active page (white text on a fading
   gradient is unreadable on cream), a warm hover. */
html[data-theme="light"] .nav a:hover{background:rgba(29,78,216,.07); color:var(--text)}
html[data-theme="light"] .nav a.active,
html[data-theme="light"][dir=ltr] .nav a.active{color:#1e3a8a; background:linear-gradient(90deg, rgba(29,78,216,.16), rgba(29,78,216,.07));
  box-shadow:inset 0 0 0 1px rgba(29,78,216,.14)}
html[data-theme="light"] .nav a.active::before{background:#1d4ed8}
html[data-theme="light"] .nav a.nav-out{color:#b91c1c}
html[data-theme="light"] .nav a.nav-out:hover{background:rgba(185,28,28,.08); color:#991b1b}
html[data-theme="light"] .nav .sep::before{box-shadow:none}
html[data-theme="light"] .menu-toggle{color:var(--text)}
@media(max-width:880px){
  html[data-theme="light"] .sidebar.open{box-shadow:-12px 0 36px rgba(90,70,40,.30)}
  html[data-theme="light"][dir=ltr] .sidebar.open{box-shadow:12px 0 36px rgba(90,70,40,.30)}
}

/* ---------------------------- surfaces ---------------------------- */
html[data-theme="light"] .card,
html[data-theme="light"] .table-card,
html[data-theme="light"] .plan-card,
html[data-theme="light"] .auth-card,
html[data-theme="light"] .chartbox{box-shadow:var(--edge-light), var(--shadow-soft)}
html[data-theme="light"] .card:hover{box-shadow:var(--edge-light), 0 2px 4px rgba(90,70,40,.06), 0 14px 30px -14px rgba(90,70,40,.28)}
html[data-theme="light"] .plan-card:hover{box-shadow:var(--edge-light), 0 14px 30px -14px rgba(90,70,40,.30)}
html[data-theme="light"] .table-card table th{background:linear-gradient(180deg, #f4ecdf, #eee4d3); color:#5c5040}
html[data-theme="light"] tr:hover td{background:rgba(29,78,216,.045)}
html[data-theme="light"] .msg.staff{background:linear-gradient(165deg, rgba(29,78,216,.10), rgba(29,78,216,.03))}
html[data-theme="light"] .toast{box-shadow:var(--edge-light), 0 14px 34px -8px rgba(90,70,40,.30)}
html[data-theme="light"] .stabs-save{box-shadow:var(--edge-light), 0 12px 30px -10px rgba(90,70,40,.28)}
html[data-theme="light"] .stabs-bar{background:linear-gradient(180deg, rgba(244,238,227,.97), rgba(244,238,227,.92))}
html[data-theme="light"] .ptabs > .tabs{background:var(--bg)}

/* Inputs: lighter than the card they sit on, with a border that reads. */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea{background:#fffdf9; border-color:#d9ccb5; color:var(--text)}
html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus{border-color:var(--primary); box-shadow:0 0 0 3px rgba(29,78,216,.16)}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder{color:#7d6f59}
html[data-theme="light"] input:disabled,
html[data-theme="light"] select:disabled,
html[data-theme="light"] textarea:disabled{background:#f3ece0; color:#7a6d59}
html[data-theme="light"] select{color-scheme:light}
html[data-theme="light"] input[type=checkbox],
html[data-theme="light"] input[type=radio]{accent-color:var(--primary)}

/* ---------------------------- buttons ---------------------------- */
html[data-theme="light"] .btn{box-shadow:0 4px 12px -2px rgba(29,78,216,.30)}
html[data-theme="light"] .btn.green{background:linear-gradient(180deg,#15803d,#166534); box-shadow:0 4px 12px -2px rgba(21,128,61,.30)}
html[data-theme="light"] .btn.red{background:linear-gradient(180deg,#dc2626,#b91c1c); box-shadow:0 4px 12px -2px rgba(185,28,28,.30)}
html[data-theme="light"] .btn.amber{background:linear-gradient(180deg,#fbbf24,#f59e0b); color:#1c1917; box-shadow:0 4px 12px -2px rgba(217,119,6,.30)}
html[data-theme="light"] .btn.ghost{background:rgba(255,255,255,.5); border-color:#d3c4aa; color:var(--text); box-shadow:none}
html[data-theme="light"] .btn.ghost:hover{background:#fffaf1; border-color:var(--primary)}
html[data-theme="light"] input.bar::-webkit-slider-thumb{box-shadow:0 2px 6px rgba(90,70,40,.35)}
html[data-theme="light"] input.bar::-moz-range-thumb{box-shadow:0 2px 6px rgba(90,70,40,.35)}

/* ---------------------------- status colours ---------------------------- */
html[data-theme="light"] .badge.green{background:rgba(22,163,74,.12)}
html[data-theme="light"] .badge.red{background:rgba(220,38,38,.10)}
html[data-theme="light"] .badge.amber{background:rgba(245,158,11,.16)}
html[data-theme="light"] .badge.blue{background:rgba(29,78,216,.10)}
html[data-theme="light"] .badge.violet{background:rgba(109,40,217,.10); color:#6d28d9}
html[data-theme="light"] .stat .value.amber{color:#b45309}
/* Info is an opaque pale blue: a see-through blue over cream reads as grey. */
html[data-theme="light"] .alert.success{color:#14532d; border-color:#4d9a67; background:linear-gradient(165deg, rgba(22,163,74,.13), rgba(22,163,74,.06))}
html[data-theme="light"] .alert.error  {color:#991b1b; border-color:#d07070; background:linear-gradient(165deg, rgba(220,38,38,.11), rgba(220,38,38,.05))}
html[data-theme="light"] .alert.info   {color:#1e3a8a; border-color:#7d9be0; background:linear-gradient(165deg, #e8eefc, #f0f3fb)}
html[data-theme="light"] .alert.warning{color:#78350f; border-color:#d5a24f; background:linear-gradient(165deg, rgba(245,158,11,.17), rgba(245,158,11,.07))}
/* A toast is an .alert floating over the page: an opaque ivory under its see-through tint. */
html[data-theme="light"] .toast-stack .toast.alert{background-color:#fcf8f1}
html[data-theme="light"] .alert a:not(.btn){color:inherit; text-decoration:underline}
html[data-theme="light"] .nav a .nav-badge{box-shadow:0 1px 3px rgba(185,28,28,.35)}

/* ---------------------------- pickers ---------------------------- */
html[data-theme="light"] .os-tag.opt{background:rgba(22,163,74,.12); border-color:rgba(22,101,52,.35); color:#166534}
html[data-theme="light"] .os-tag.warn{background:rgba(245,158,11,.16); border-color:rgba(146,64,14,.35); color:#92400e}
html[data-theme="light"] .os-warn{color:#92400e}
html[data-theme="light"] .os-acc-h .os-ico,
html[data-theme="light"] .ap-ico{background:rgba(120,100,70,.10)}
html[data-theme="light"] .ap-tag{background:rgba(120,100,70,.12)}
html[data-theme="light"] .ap-tag.warn{background:rgba(245,158,11,.18); color:#92400e}
html[data-theme="light"] .tk-file img{background:#efe6d6}
/* Ticket image overlay: the scrim stays dark, so its caption bar stays light. */
html[data-theme="light"] .tk-lightbox-name{color:#d6cfc2}
html[data-theme="light"] .tk-lightbox .btn.ghost{background:rgba(255,255,255,.08); border-color:rgba(255,255,255,.32); color:#f8f4ec; box-shadow:none}
html[data-theme="light"] .tk-lightbox .btn.ghost:hover{background:rgba(255,255,255,.16); border-color:rgba(255,255,255,.5)}

/* ---------------------------- admin settings ---------------------------- */
html[data-theme="light"] .stab-hits{background:rgba(29,78,216,.14); color:#1e3a8a}
html[data-theme="light"] .stabs-save.has-changes .stabs-note{color:#92400e}
html[data-theme="light"] .shk-test{background:rgba(120,100,70,.05)}
html[data-theme="light"] .shk-steps li{background:rgba(120,100,70,.05)}
html[data-theme="light"] .shk-opt,
html[data-theme="light"] .gw-prio-item{background:#fffdf9}
html[data-theme="light"] .shk-opt:has(input:checked:not([value="off"])){background:#e8eefc}
html[data-theme="light"] .lvl-ok .shk-vic,
html[data-theme="light"] .lvl-warn .shk-vic{color:#fff}

/* ---------------------------- auth ---------------------------- */
html[data-theme="light"] .auth-wrap{
  background:
    radial-gradient(900px 500px at 80% 10%, rgba(214,170,98,.14), transparent 60%),
    radial-gradient(700px 500px at 10% 90%, rgba(214,158,46,.10), transparent 55%),
    var(--bg);
}
html[data-theme="light"] .auth-shell{box-shadow:0 24px 60px -20px rgba(90,70,40,.35)}
/* the 🔑 tile (forgot / reset / verify_phone): the bright blue→green of the dark site, with a tighter glow */
html[data-theme="light"] .auth-logo{background:linear-gradient(135deg,#2563eb,#16a34a);box-shadow:0 8px 20px -6px rgba(29,78,216,.40)}

/* ============================ Searchable pickers (2026-11-12) ============================ */
/* assets/app.js «searchable pickers»: <select class="js-searchable"> becomes a text
   box + ONE floating list on <body> (.pk-pop, position:fixed — never inside a card,
   whose backdrop-filter would trap it under the next card); <input data-user-pick>
   gets the same list from ?r=admin_user_search. The select itself stays in the
   form, visually hidden, so it is still submitted (and still `required`). */
.search-select .pk-native{position:absolute!important; inset-inline-start:0; bottom:0; width:1px!important; height:1px!important;
  min-width:0!important; padding:0!important; margin:0!important; border:0!important; opacity:0!important; pointer-events:none!important; overflow:hidden}
.search-select .search-select-input{padding-inline-end:36px}
.search-select::after{content:''; position:absolute; inset-inline-end:15px; top:50%; width:7px; height:7px; margin-top:-6px;
  border-right:2px solid var(--muted); border-bottom:2px solid var(--muted); transform:rotate(45deg); pointer-events:none; opacity:.75}
.search-select.has-value::after{display:none}
.pk-clear{position:absolute; inset-inline-end:7px; top:50%; transform:translateY(-50%); display:none; align-items:center; justify-content:center;
  width:26px; height:26px; padding:0; border:0; border-radius:50%; background:transparent; color:var(--muted);
  font-family:inherit; font-size:18px; line-height:1; cursor:pointer}
.search-select.has-value .pk-clear{display:inline-flex}
.pk-clear:hover{background:rgba(239,68,68,.14); color:var(--red)}
.pk-clear:focus-visible{outline:2px solid var(--primary); outline-offset:1px}
.search-select.pk-bad .search-select-input{border-color:var(--red); box-shadow:0 0 0 3px rgba(239,68,68,.18)}
.pk-msg{margin-top:5px; font-size:12px; color:var(--red)}
.pk-msg[hidden]{display:none}

.pk-pop{position:fixed; z-index:1500; display:flex; flex-direction:column; overflow:hidden;
  border:1px solid var(--border); border-radius:12px; background-color:var(--panel2); background-image:var(--grad-surface-2);
  box-shadow:var(--edge-light), 0 18px 40px rgba(0,0,0,.48); color:var(--text); font-size:13px; line-height:1.6}
.pk-pop[hidden]{display:none!important}
.pk-head{padding:7px 12px; font-size:11.5px; color:var(--muted); border-bottom:1px solid var(--border)}
.pk-foot{padding:7px 12px; font-size:11.5px; color:var(--muted); border-top:1px solid var(--border)}
.pk-head[hidden],.pk-foot[hidden]{display:none}
.pk-list{overflow-y:auto; overscroll-behavior:contain; padding:4px}
.pk-item{display:flex; flex-wrap:wrap; align-items:baseline; gap:0 10px; padding:8px 10px; border-radius:8px; cursor:pointer}
.pk-item.on{background:rgba(59,130,246,.20)}
.pk-main{flex:1 1 auto; min-width:0; font-weight:600; overflow-wrap:anywhere}
.pk-item.cur .pk-main::after{content:'  ✓'; color:var(--green); font-weight:800}
.pk-tag{flex:none; font-size:11px; color:var(--muted); font-family:ui-monospace,Menlo,Consolas,monospace}
.pk-sub{flex:1 0 100%; font-size:11.5px; color:var(--muted); direction:ltr; text-align:right; overflow-wrap:anywhere}
html[dir=ltr] .pk-sub{text-align:left}
.pk-item mark{background:rgba(250,204,21,.30); color:inherit; border-radius:3px; padding:0 1px}
.pk-none{padding:12px; color:var(--muted); text-align:center}
.pk-who{margin-top:5px; font-size:12px; color:var(--green); overflow-wrap:anywhere}
.pk-who[hidden]{display:none}
html[data-theme="light"] .pk-pop{box-shadow:var(--edge-light), 0 18px 40px -10px rgba(90,70,40,.38)}
html[data-theme="light"] .pk-item.on{background:rgba(29,78,216,.10)}
html[data-theme="light"] .pk-item mark{background:rgba(245,158,11,.32); color:var(--text)}

/* Phones: the day/night switch becomes a round button the size of «EN» beside it. The
   two-icon track pushed a real balance («موجودی: 12,345,678 تومان») onto two lines at
   ≤414px. It shows the mode a tap switches TO — ☀ in dark, ☾ in light — the way «EN»
   names the language a tap switches to; aria-checked still carries the state. */
@media(max-width:600px){
  .topbar .theme-sw .ts-track{width:30px; height:30px; padding:0; justify-content:center; border-radius:50%}
  .topbar .theme-sw .ts-knob,
  .topbar .theme-sw .ts-moon{display:none}
  .topbar .theme-sw .ts-sun{color:#fde68a}
  html[data-theme="light"] .topbar .theme-sw .ts-sun{display:none}
  html[data-theme="light"] .topbar .theme-sw .ts-moon{display:block; color:#3730a3}
}
@media(max-width:360px){ .topbar .theme-sw .ts-track{width:28px; height:28px} }
/* …and the whole topbar uses its ≤360px sizes up to 420px, so the four controls and a
   real balance stay on one line on 375–414px phones too. */
@media(max-width:420px){
  .topbar{padding:10px 10px}
  .topbar .tb-end{gap:4px}
  .topbar .cal-sw a,.topbar .cal-sw span{font-size:11px; padding:4px 6px}
  .topbar .lang-sw{width:28px; height:28px; font-size:11px}
  .topbar .theme-sw .ts-track{width:28px; height:28px}
  .topbar .bal{font-size:11px; padding:5px 7px; white-space:nowrap}
}
@media(max-width:340px){ .topbar .bal{white-space:normal} }   /* a two-line pill beats a page that zooms out */
