:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --ink: #0f172a;
    --ink-soft: #475569;
    --muted: #6b7a90;
    --line: #e6eaf0;
    --primary: #cc1e45;
    --primary-d: #a81839;
    --primary-soft: #fce8ed;
    --danger: #dc2626;
    --danger-soft: #fde8e8;
    --ok: #0f9d6b;
    --ok-soft: #d1fae5;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --violet: #cc1e45;
    --violet-soft: #fce8ed;
    --blue: #2563eb;
    --blue-soft: #dbeafe;
    --sb: #2b3a4a;
    --sb-2: #38495b;
    --sb-ink: #c6d2de;
    --sb-muted: #7c8da0;
    --radius: 16px;
    --radius-sm: 11px;
    --shadow: 0 12px 34px rgba(15,23,42,.10);
    --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow-x: clip; }
body {
    font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
    background: var(--bg); color: var(--ink);
    font-size: 14.5px; line-height: 1.65; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; }
code { font-family: "Vazirmatn", ui-monospace, monospace; direction: ltr; }
.muted { color: var(--ink-soft); font-size: 12.5px; margin: 2px 0 0; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.hint.center { text-align: center; }
.mt { margin-top: 14px; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer;
    transition: .15s ease; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(204,30,69,.30); }
.btn-primary:hover:not(:disabled) { background: var(--primary-d); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fecdd3; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-ghost .spinner { border-color: rgba(204,30,69,.3); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-top: 12px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- Logo ---------- */
.logo { display: inline-grid; place-items: center; flex: none; }
.logo svg { display: block; }
.logo-lg svg { width: 56px; height: 56px; }
.logo-sm svg { width: 46px; height: 46px; }
.logo-sb svg { width: 38px; height: 38px; }

/* ---------- Login (split) ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1000px 600px at 80% -5%, #3a4d61, #202b38); }
.login-shell { width: 100%; max-width: 880px; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--surface); border-radius: 26px; overflow: hidden; box-shadow: 0 34px 90px rgba(2,6,23,.5); }
.login-hero { position: relative; padding: 44px 36px; color: #fff; background: linear-gradient(155deg, #cc1e45 0%, #a3163a 55%, #7d1330 100%); overflow: hidden; display: flex; flex-direction: column; gap: 28px; }
.login-hero > * { position: relative; z-index: 2; }
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-top h1 { font-size: 21px; }
.hero-top p { color: rgba(255,255,255,.82); font-size: 12.5px; margin: 3px 0 0; }
.hero-mid h2 { font-size: 25px; line-height: 1.55; }
.hero-mid p { color: rgba(255,255,255,.85); margin-top: 10px; font-size: 13.5px; }
.hero-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.hero-points li { display: flex; align-items: center; gap: 11px; font-size: 13px; color: rgba(255,255,255,.94); }
.hero-points li::before { content: "✓"; width: 23px; height: 23px; border-radius: 8px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.hero-deco { position: absolute; inset: 0; z-index: 1; background: radial-gradient(340px 340px at 12% 92%, rgba(255,255,255,.16), transparent 60%), radial-gradient(260px 260px at 92% 6%, rgba(255,255,255,.12), transparent 60%); }
.login-form-side { padding: 46px 42px; display: flex; flex-direction: column; justify-content: center; }
.logo-sm { display: none; margin-bottom: 16px; }
.lf-title { font-size: 23px; }
.lf-sub { color: var(--ink-soft); font-size: 13px; margin: 7px 0 24px; }
.code-input { width: 100%; text-align: center; letter-spacing: 14px; font-size: 30px; font-weight: 700; padding: 13px 10px; border: 1.5px solid var(--line); border-radius: 13px; background: var(--surface-2); color: var(--ink); direction: ltr; transition: .15s; }
.code-input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
#loginForm .btn { margin-top: 16px; }
.login-foot { text-align: center; color: var(--muted); font-size: 11.5px; margin: 22px 0 0; }
@media (max-width: 760px) {
    .login-shell { grid-template-columns: 1fr; max-width: 420px; }
    .login-hero { display: none; }
    .logo-sm { display: inline-grid; }
    .login-form-side { padding: 38px 30px; text-align: center; align-items: center; }
    #loginForm, .login-foot { width: 100%; }
}

/* ---------- App shell ---------- */
.app { min-height: 100vh; display: flex; }
.scrim { position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 39; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w); flex: none; background: var(--sb); color: var(--sb-ink);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sb-title { display: flex; flex-direction: column; line-height: 1.35; }
.sb-title b { color: #fff; font-size: 15px; }
.sb-title span { color: var(--sb-muted); font-size: 11.5px; }
.sidebar-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    background: transparent; border: none; color: var(--sb-ink);
    font: inherit; font-weight: 600; text-align: right; cursor: pointer;
    padding: 9px 13px; border-radius: 10px; transition: .15s; font-size: 13.5px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, #e23a5f, var(--primary-d)); color: #fff; box-shadow: 0 8px 20px rgba(204,30,69,.38); }
.nav-item .ico { width: 20px; height: 20px; fill: currentColor; flex: none; opacity: .95; }
.nav-sep { height: 1px; background: rgba(255,255,255,.07); margin: 10px 8px; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.06); }
.op { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.op-avatar { width: 38px; height: 38px; border-radius: 11px; background: var(--sb-2); color: #fff; display: grid; place-items: center; font-weight: 700; }
.op-info { display: flex; flex-direction: column; line-height: 1.35; }
.op-info b { color: #fff; font-size: 13px; }
.op-info span { color: var(--sb-muted); font-size: 11px; }
.sidebar-foot .btn-ghost { color: var(--sb-ink); border-color: rgba(255,255,255,.14); }
.sidebar-foot .btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-version { text-align: center; font-size: 11px; color: var(--sb-muted); opacity: .8; margin-top: 10px; letter-spacing: .2px; }

/* ---------- Main + topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 14px 26px; }
.topbar-title h1 { font-size: 19px; }
.crumb { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; }
.clock { color: var(--ink-soft); font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); padding: 7px 14px; border-radius: 999px; }
.menu-toggle { display: none; background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 7px; cursor: pointer; }
.menu-toggle svg { width: 20px; height: 20px; fill: var(--ink-soft); display: block; }

.content { flex: 1; padding: 22px 26px; max-width: 1720px; width: 100%; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Dashboard ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.sc-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.sc-ico svg { width: 26px; height: 26px; }
.sc-body { display: flex; flex-direction: column; }
.sc-val { font-size: 26px; font-weight: 800; line-height: 1.1; }
.sc-label { color: var(--ink-soft); font-size: 12.5px; }
.sc-blue .sc-ico { background: var(--blue-soft); } .sc-blue .sc-ico svg { fill: var(--blue); }
.sc-green .sc-ico { background: var(--ok-soft); } .sc-green .sc-ico svg { fill: var(--ok); }
.sc-violet .sc-ico { background: var(--violet-soft); } .sc-violet .sc-ico svg { fill: var(--violet); }
.sc-amber .sc-ico { background: var(--amber-soft); } .sc-amber .sc-ico svg { fill: var(--amber); }

.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 18px; }
/* let grid-item panels shrink so inner content (e.g. the bar chart) scrolls instead of forcing the card wider than the screen */
.dash-grid > .panel { min-width: 0; }
.status-bars { display: flex; flex-direction: column; gap: 16px; padding-top: 6px; }
.sbar-row { display: flex; flex-direction: column; gap: 6px; }
.sbar-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.sbar-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.sbar-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.sbar-fill.on { background: linear-gradient(90deg, var(--ok), #34d399); }
.sbar-fill.off { background: linear-gradient(90deg, var(--muted), #cbd5e1); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 4px; }
.quick-btn { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; transition: .15s; }
.quick-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.q-ico { width: 30px; height: 30px; border-radius: 9px; background: #fff; display: grid; place-items: center; font-size: 15px; box-shadow: var(--shadow-sm); }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; }
.panel + .panel, .dash-grid + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-size: 16px; }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.customers-panel { position: sticky; top: 92px; }

.search { width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font: inherit; margin-bottom: 12px; }
.search:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.scroll { overflow: auto; }
.customers-panel .list { max-height: calc(100vh - 300px); }

/* ---------- Customer list ---------- */
.list { display: flex; flex-direction: column; gap: 6px; }
.cust { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; transition: .12s; }
.cust:hover { background: var(--surface-2); }
.cust.active { background: var(--primary-soft); border-color: #c7d2fe; }
.cust .avatar { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; color: var(--ink-soft); font-size: 13px; }
.cust.active .avatar { background: #fff; color: var(--primary); }
.cust .cust-main { min-width: 0; } .cust .cust-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust .cust-id { font-size: 11.5px; color: var(--muted); }
.cust .dot { width: 8px; height: 8px; border-radius: 50%; margin-inline-start: auto; flex: none; }
.dot.on { background: var(--ok); } .dot.off { background: var(--muted); }

/* ---------- Table ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th { text-align: center; background: var(--surface-2); color: var(--ink-soft); font-weight: 700; padding: 12px 14px; position: sticky; top: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: center; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.licenses-panel .table-wrap { max-height: calc(100vh - 300px); }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.ro { background: var(--amber-soft); color: var(--amber); }
.badge.rw { background: var(--ok-soft); color: var(--ok); }
.cell-actions { display: flex; gap: 6px; justify-content: center; }
.cust-link { color: inherit; cursor: pointer; text-decoration: none; border-bottom: 1px dotted var(--line); }
.cust-link:hover { color: var(--primary); border-bottom-color: var(--primary); }
.mono { direction: ltr; font-size: 12px; color: var(--ink-soft); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 14px 4px 2px; flex-wrap: wrap; }
.pager:empty { display: none; }
.pager button { min-width: 36px; height: 36px; padding: 0 11px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; font: inherit; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.pager button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.pager button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager .pager-info { color: var(--muted); font-size: 12px; margin: 0 6px; }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,6,23,.55); backdrop-filter: blur(3px); }
.modal { position: relative; width: 100%; max-width: 580px; max-height: 90vh; overflow: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); animation: pop .2s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-start; gap: 10px; padding: 0 22px 20px; }
#modalError { margin: 0 22px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: 13px; }
.field label .req { color: var(--danger); }
.field input[type=text], .field input[type=number], .field select { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font: inherit; width: 100%; }
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.field .fhint { font-size: 11.5px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; padding: 8px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- Enroll ---------- */
.enroll-intro { max-width: 640px; margin-bottom: 18px; }
.enroll-grid { display: grid; grid-template-columns: 1fr 240px; gap: 26px; align-items: start; }
.field-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.secret-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; }
.secret-box code { flex: 1; font-size: 15px; letter-spacing: 1px; word-break: break-all; }
.secret-box code.uri { font-size: 11.5px; letter-spacing: 0; }
.qr-side { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr { width: 210px; height: 210px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.bank-select { margin-bottom: 0; min-width: 240px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 13px 17px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; animation: toastIn .2s ease; max-width: 360px; border-inline-start: 4px solid var(--primary); }
.toast.ok { border-inline-start-color: var(--ok); }
.toast.err { border-inline-start-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) { .stats-grid { grid-template-columns: 1fr 1fr; } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } .customers-panel { position: static; } .customers-panel .list { max-height: 300px; } }
@media (max-width: 860px) {
    .sidebar { position: fixed; right: 0; top: 0; transform: translateX(100%); transition: transform .25s ease; box-shadow: -10px 0 40px rgba(2,6,23,.35); }
    .app.nav-open .sidebar { transform: translateX(0); }
    .menu-toggle { display: inline-flex; }
    .content { padding: 18px; }
    .modal-body { grid-template-columns: 1fr; }
    .enroll-grid { grid-template-columns: 1fr; }
    .clock { display: none; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } .quick { grid-template-columns: 1fr; } }

/* ---------- Charts ---------- */
.chart-donut { display: flex; align-items: center; gap: 22px; padding: 8px 4px; flex-wrap: wrap; }
.donut { position: relative; width: 150px; height: 150px; border-radius: 50%; background: conic-gradient(var(--line) 0 100%); flex: none; }
.donut::after { content: ""; position: absolute; inset: 24%; background: var(--surface); border-radius: 50%; box-shadow: inset 0 1px 3px rgba(15,23,42,.06); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2; }
.donut-center b { font-size: 26px; font-weight: 800; line-height: 1; }
.donut-center small { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
/* راهنما کنارِ نمودار و جمع‌وجور؛ عدد کنارِ برچسب، نه آن سرِ پنل */
.legend { display: flex; flex-direction: column; gap: 10px; flex: 0 1 260px; min-width: 150px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend-row .lg-label { color: var(--ink-soft); }
.legend-row .lg-val { margin-inline-start: auto; font-weight: 700; }

.barchart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 14px 6px 0; overflow-x: auto; }
.bc-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 34px; height: 100%; justify-content: flex-end; }
.bc-bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, #e23a5f, var(--primary)); border-radius: 8px 8px 4px 4px; min-height: 4px; transition: height .6s ease; position: relative; }
.bc-bar span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.bc-label { font-size: 11px; color: var(--muted); white-space: nowrap; direction: ltr; }
.barchart .empty { margin: auto; }

/* ---------- Jalali date picker ---------- */
.jdate-wrap { position: relative; }
.jdate-wrap input { padding-left: 40px; }
.jdate-btn { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: none; cursor: pointer; padding: 5px; color: var(--ink-soft); border-radius: 7px; }
.jdate-btn:hover { background: var(--surface-2); color: var(--primary); }
.jdate-btn svg { width: 18px; height: 18px; fill: currentColor; display: block; }
.jcal { position: fixed; z-index: 70; width: 268px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; }
.jcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.jcal-head button { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 15px; color: var(--ink); }
.jcal-head button:hover { background: var(--primary-soft); }
.jcal-title { font-weight: 700; font-size: 13.5px; }
.jcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.jcal-dow { text-align: center; font-size: 10.5px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.jcal-day { text-align: center; padding: 7px 0; border-radius: 8px; cursor: pointer; font-size: 12.5px; border: 1px solid transparent; }
.jcal-day:hover { background: var(--surface-2); }
.jcal-day.today { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.jcal-day.sel { background: var(--primary); color: #fff; }
.jcal-day.empty { visibility: hidden; cursor: default; }
.jcal-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.jcal-foot button { background: transparent; border: none; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; font-size: 12.5px; }

/* ---------- Recent issued licenses ---------- */
.lic-type { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.lic-type.sw { background: var(--blue-soft); color: var(--blue); }
.lic-type.bank { background: var(--violet-soft); color: var(--violet); }
.code-cell { direction: ltr; font-size: 11.5px; color: var(--ink-soft); }

/* ---------- Icon buttons ---------- */
.icon-btn { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; cursor: pointer; color: var(--ink-soft); transition: .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--primary); border-color: #f3c9d4; }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; display: block; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: #f5c2c2; }
.icon-btn.mini { width: 24px; height: 24px; border: none; background: transparent; border-radius: 6px; color: var(--muted); }
.icon-btn.mini:hover { color: var(--primary); background: var(--surface-2); }
.icon-btn.mini svg { width: 14px; height: 14px; }
.cell-actions { display: flex; gap: 6px; align-items: center; }
.code-cell { display: flex; align-items: center; gap: 6px; }
.code-cell .code-txt { direction: ltr; font-size: 11.5px; color: var(--ink-soft); }
.q-ico svg { width: 17px; height: 17px; fill: var(--primary); }

/* ---------- SVG inside buttons / pager arrows ---------- */
.btn svg { width: 15px; height: 15px; fill: currentColor; display: block; }
.pager button.pg-arrow { display: inline-grid; place-items: center; padding: 0; }
.pager .pg-arrow svg { width: 16px; height: 16px; fill: currentColor; display: block; }

/* ---------- Offline bar ---------- */
.offline-bar { display: flex; align-items: center; gap: 8px; background: var(--amber-soft); color: var(--amber); border-bottom: 1px solid #f2e2b6; padding: 9px 26px; font-size: 12.5px; font-weight: 600; }
.offline-bar svg { width: 16px; height: 16px; fill: currentColor; flex: none; }

/* ---------- Admin controls (enroll) ---------- */
.admin-controls { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.ac-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ac-row b { font-size: 14px; }
.ac-row .hint { max-width: 460px; }

/* ---------- Customers: two stacked license cards ---------- */
.lic-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.lic-col .table-wrap.scroll { max-height: 420px; }
.customers-panel .list { max-height: calc(100vh - 250px); }
.cust .cust-id { font-size: 12px; color: var(--muted); }

/* ---------- Readability + sync badge + LTR values (v2) ---------- */
body { font-size: 15px; }
.table { font-size: 14.5px; }
.table thead th { font-size: 13.5px; }
.nav-item { font-size: 14.5px; }
.muted { font-size: 13px; }
.hint { font-size: 12.5px; }
.cust .cust-name { font-size: 15px; }
.cust .cust-id { font-size: 13px; }
.badge, .lic-type { font-size: 12.5px; }
.panel-head h2 { font-size: 17px; }
.sc-val { font-size: 28px; }
.sc-label { font-size: 13.5px; }
.topbar-title h1 { font-size: 20px; }
.btn { font-size: 14.5px; }
.btn-sm { font-size: 13px; }
.field label { font-size: 14px; }
.field input[type=text], .field input[type=number], .field select { font-size: 14.5px; }

/* LTR technical values (database, codes, MAC, IP) align naturally */
.mono, td.mono { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.code-cell .code-txt { direction: ltr; unicode-bidi: plaintext; }

/* last-update indicator */
.sync-badge { color: var(--ink-soft); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }

/* larger on wide monitors, unchanged on small screens */
@media (min-width: 1600px) {
    body { font-size: 15.5px; }
    .table { font-size: 15px; }
    .nav-item { font-size: 15px; }
    .panel-head h2 { font-size: 18px; }
    .sc-val { font-size: 30px; }
}
@media (max-width: 860px) { .sync-badge { display: none; } }

/* ---------- v3: center LTR values, activity badges, avatar icon ---------- */
.mono, td.mono { text-align: center; }
.code-cell { justify-content: center; }

.act-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.act-badge.ok { background: var(--ok-soft); color: var(--ok); }
.act-badge.info { background: var(--blue-soft); color: var(--blue); }
.act-badge.del { background: var(--danger-soft); color: var(--danger); }
.act-badge.warn { background: var(--amber-soft); color: var(--amber); }
.act-badge.n { background: var(--surface-2); color: var(--ink-soft); }

.op-avatar svg { width: 21px; height: 21px; fill: #fff; }

/* ---------- v4: jdate icon fix, providers list, calendar year-nav ---------- */
.jdate-wrap input { padding-left: 12px; padding-right: 42px; text-align: left; }
.jdate-btn { left: auto; right: 6px; }

.providers-list { display: flex; flex-direction: column; gap: 6px; max-height: 230px; padding-top: 4px; }
.prov-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13.5px; font-weight: 600; }
.prov-status { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; flex: none; }
.prov-status.on { background: var(--ok-soft); color: var(--ok); }
.prov-status.off { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }

.jcal { width: 284px; }
.jcal-nav { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; width: 28px; height: 30px; cursor: pointer; color: var(--ink); font-size: 14px; }
.jcal-nav:hover { background: var(--primary-soft); color: var(--primary); }

/* v4.1: ensure jdate padding beats .field input[type=text] */
.jdate-wrap input[type=text] { padding-right: 42px; padding-left: 12px; text-align: left; }

/* v4.2: header alignment matches centered technical values */
.table thead th.c { text-align: center; }

/* v4.3: stat-card label wraps fully (no truncation) */
.sc-body { min-width: 0; }
.sc-label { white-space: normal; line-height: 1.3; }

/* v5: stats range selector + provider bar labels */
.range-select { padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font: inherit; font-size: 13px; min-width: 130px; cursor: pointer; }
.range-select:focus { outline: none; border-color: var(--primary); background: #fff; }
#posProviderChart .bc-label { direction: rtl; max-width: 72px; overflow: hidden; text-overflow: ellipsis; }

/* v6: redesigned topbar chips (clock + sync) */
.topbar-actions { gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; border-radius: 13px; box-shadow: var(--shadow-sm); }
.chip-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.chip-ico svg { width: 17px; height: 17px; }
.chip-text { display: flex; flex-direction: column; line-height: 1.2; }
.chip-text b { font-size: 13px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.chip-text small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.chip-clock .chip-ico { background: var(--primary-soft); }
.chip-clock .chip-ico svg { fill: var(--primary); }
.chip-sync .chip-ico { background: var(--ok-soft); }
.chip-sync .chip-ico svg { fill: var(--ok); }
@media (max-width: 980px) { .chip-sync { display: none; } }
@media (max-width: 720px) { .chip-clock .chip-text small { display: none; } }

/* v7: bigger clock + header operator chip */
.chip-clock { padding: 7px 15px; }
.chip-clock .chip-ico { width: 38px; height: 38px; }
.chip-clock .chip-ico svg { width: 20px; height: 20px; }
.chip-clock .chip-text b { font-size: 18px; }
.chip-clock .chip-text small { font-size: 11px; }
.chip-op .chip-ico { background: var(--sb); }
.chip-op .chip-ico svg { fill: #fff; width: 18px; height: 18px; }
@media (max-width: 720px) { .chip-op .chip-text { display: none; } }

/* v8: uniform dashboard spacing + mobile responsiveness */
#tab-dashboard.active { display: flex; flex-direction: column; gap: 18px; }
#tab-dashboard .stats-grid, #tab-dashboard .dash-grid { margin-bottom: 0; }

@media (max-width: 680px) {
    .content { padding: 16px; }
    .panel { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .chart-donut { flex-direction: column; align-items: center; gap: 14px; }
    .chart-donut .legend { width: 100%; max-width: 260px; min-width: 0; }
    .barchart { height: 170px; }
    .quick { grid-template-columns: 1fr 1fr; }
    .topbar { padding: 12px 16px; gap: 10px; }
    .topbar-title h1 { font-size: 17px; }
    .panel-head { flex-wrap: wrap; }
}
@media (max-width: 430px) {
    .stats-grid { grid-template-columns: 1fr; }
    .quick { grid-template-columns: 1fr; }
}

/* ---------- idle auto-logout warning ---------- */
.idle-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(2, 6, 23, .55); backdrop-filter: blur(4px); animation: idleFade .18s ease; }
@keyframes idleFade { from { opacity: 0; } to { opacity: 1; } }
.idle-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 26px 24px; text-align: center; animation: idlePop .22s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes idlePop { from { transform: translateY(8px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.idle-ring { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft, rgba(204, 30, 69, .10)); color: var(--primary); }
.idle-ring svg { width: 34px; height: 34px; fill: currentColor; }
.idle-title { margin: 0 0 8px; font-size: 18px; font-weight: 800; color: var(--ink); }
.idle-text { margin: 0 0 20px; font-size: 14px; line-height: 1.9; color: var(--ink-soft); }
.idle-secs { display: inline-block; min-width: 2.2em; font-weight: 800; font-size: 17px; color: var(--primary); font-variant-numeric: tabular-nums; }
.idle-actions { display: flex; gap: 10px; }
.idle-actions .btn { flex: 1; justify-content: center; }

/* ---------- mobile: wide tables become stacked cards ---------- */
@media (max-width: 640px) {
    .table-wrap { border: none; border-radius: 0; }
    .table thead { display: none; }
    .table, .table > tbody { display: block; width: 100%; }
    .table > tbody > tr {
        display: block;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: var(--shadow-sm);
        padding: 2px 12px;
        margin-bottom: 10px;
    }
    .table > tbody > tr > td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 14px;
        border: none;
        padding: 9px 0;
        text-align: left;
        white-space: normal;
        word-break: break-word;
    }
    .table > tbody > tr > td:not(:last-child) { border-bottom: 1px dashed var(--line); }
    .table > tbody > tr > td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-weight: 700;
        color: var(--ink-soft);
        font-size: 12px;
        white-space: nowrap;
    }
    .table > tbody > tr > td[colspan] { display: block; text-align: center; padding: 16px 0; }
    .table .cell-actions { justify-content: flex-end; }
    /* keep the payment-provider bar labels from overlapping */
    .bc-label { font-size: 10px; max-width: 58px; overflow: hidden; text-overflow: ellipsis; }
    /* give small stat cards a touch more breathing room */
    .stat-card { padding: 14px 13px; }
    .sc-label { font-size: 12px; }
    /* inputs must be >=16px so iOS Safari does NOT auto-zoom (and break the layout) on focus */
    .search,
    .range-select,
    .bank-select,
    .field input[type=text],
    .field input[type=number],
    .field select,
    input[type=text],
    input[type=number],
    input[type=search],
    select,
    textarea { font-size: 16px !important; }
}

/* ===================== لایسنس مودیان ===================== */
.nav-count { margin-inline-start: auto; font-style: normal; font-size: 11px; font-weight: 800; background: #fff; color: var(--primary); border-radius: 999px; padding: 1px 8px; }
.nav-item.active .nav-count { background: rgba(255,255,255,.92); }
.tl-seg { display: inline-flex; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.tl-seg button { font: inherit; font-size: 13px; border: 0; background: none; padding: 7px 14px; border-radius: 9px; color: var(--ink-soft); cursor: pointer; }
.tl-seg button.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tl-seg em { font-style: normal; color: var(--primary); font-weight: 800; }
.tl-filter { font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.tl-mems { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tl-mem { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); }
.tl-mem.transfer { background: var(--amber-soft); }
.tl-decide { display: grid; gap: 12px; }
.tl-decide > p { margin: 0; }
.tl-row { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.tl-row.transfer { border-color: #f5c46b; background: #fffbeb; }
.tl-row-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.tl-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 10px; align-items: start; }
.tl-field { display: grid; gap: 5px; }
.tl-field[hidden] { display: none; }
.tl-field label { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.tl-field select, .tl-field input { font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
.fhint.ok { color: var(--ok); font-weight: 600; }
@media (max-width: 860px) { .tl-grid { grid-template-columns: 1fr; } }
.tl-customer { display: grid; gap: 6px; }
.tl-search { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---------- لایسنس مودیان: خلاصه + کارت‌ها ---------- */
.tl-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tl-stat { display: flex; align-items: center; gap: 12px; text-align: start; font: inherit; color: inherit; cursor: pointer; padding: 14px 16px;
           border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s; }
.tl-stat:hover { border-color: var(--primary); transform: translateY(-1px); }
.tl-stat .sc-ico { width: 44px; height: 44px; border-radius: 12px; }
.tl-stat .sc-ico svg { width: 22px; height: 22px; }
.tl-stat-body { display: grid; gap: 0; min-width: 0; }
.tl-stat b { font-size: 24px; font-weight: 800; line-height: 1.2; }
.tl-stat-body > span { color: var(--ink-soft); font-size: 12.5px; }
/* درخواستِ در انتظار: کارت قرمزِ برند؛ نیاز به توجهِ صفر: سبز */
.tl-stat.is-hot { background: var(--primary-soft); border-color: #f4b5c3; }
.tl-stat.is-hot b { color: var(--primary); }
.tl-stat.is-hot .sc-ico { background: var(--primary); } .tl-stat.is-hot .sc-ico svg { fill: #fff; }
.tl-stat.sc-amber b { color: var(--amber); }
.tl-stat.sc-amber.is-zero b { color: var(--ok); }
.tl-stat.sc-amber.is-zero .sc-ico { background: var(--ok-soft); } .tl-stat.sc-amber.is-zero .sc-ico svg { fill: var(--ok); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-search--main { min-width: 230px; }
.tl-filter-chip { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 4px 6px 4px 12px; border-radius: 999px;
                  background: var(--amber-soft); color: var(--amber); font-size: 12.5px; font-weight: 700; }
.tl-filter-chip[hidden] { display: none; }
.tl-filter-chip button { border: 0; background: rgba(0,0,0,.06); color: inherit; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1; }
.tl-cards { display: grid; gap: 12px; }
.tl-cards[hidden], .tl-timeline[hidden] { display: none; }
.tl-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.tl-card--open { border-color: #9ec0fb; box-shadow: 0 0 0 3px var(--blue-soft); }
.tl-card--bad { border-color: #f5b5b5; }
.tl-card--off { opacity: .65; }
.tl-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; }
.tl-card-act { margin-inline-start: auto; }
.tl-code { font-weight: 800; font-size: 15px; }
.tl-time { color: var(--muted); font-size: 12.5px; }
.tl-id { display: grid; gap: 0; min-width: 0; width: 260px; }
.tl-mid-lg { font-size: 18px; font-weight: 800; letter-spacing: 1.5px; }
.tl-mname { font-weight: 600; color: var(--ink-soft); }
.tl-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-install { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; background: var(--surface-2); border-block: 1px solid var(--line); font-size: 13px; }
.tl-mlist { list-style: none; margin: 0; padding: 4px 16px 8px; }
.tl-mlist li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tl-mlist li:last-child { border-bottom: 0; }
.tl-mlist li.transfer { background: #fffbeb; margin: 0 -16px; padding-inline: 16px; }
.tl-mid { font-size: 14px; letter-spacing: 1px; min-width: 64px; }
.tl-who { display: grid; flex: 1; min-width: 0; }
.tl-sub { color: var(--muted); font-size: 12px; }
/* شش ستونِ هم‌عرض تا ستون‌های کارت‌های پشتِ هم زیرِ هم بیفتند */
.tl-facts { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr) var(--tl-inst, minmax(0, 2fr)) minmax(0, .6fr); gap: 10px 16px; margin: 0; padding: 12px 16px;
            background: var(--surface-2); border-top: 1px solid var(--line); }
.tl-fact { display: grid; gap: 1px; min-width: 0; }
.tl-fact dt { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.tl-fact dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
/* برچسب و مقدار هر دو راست‌چین؛ .mono (شناسه ملی، نصب) در پنل وسط‌چین است و باید اینجا کنار برچسبش بنشیند */
.tl-fact dt, .tl-fact dd, .tl-fact dd.mono { text-align: right; }
.tl-fact dd.mono { font-size: 13px; color: var(--ink); }
/* «نصب» (ماشین / دیتابیس) در یک خط: ستونش به اندازهٔ همین متن است؛ در عرضِ کم (سه یا دو ستون) اگر جا نشد با … کوتاه می‌شود و متنِ کامل در title است */
.tl-fact dd.tl-one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.tl-note { margin: 0; padding: 8px 16px; font-size: 12.5px; color: var(--ink-soft); border-top: 1px dashed var(--line); }
.tl-timeline { list-style: none; margin: 0; padding: 0 14px 0 0; border-inline-start: 2px solid var(--line); display: grid; gap: 10px; }
.tl-ev { position: relative; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.tl-ev::before { content: ""; position: absolute; inset-inline-start: -21px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); border: 2px solid var(--surface); }
.tl-ev--del::before { background: var(--danger); }
.tl-ev--warn::before { background: var(--amber); }
.tl-ev--info::before { background: var(--blue); }
.tl-ev-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-ev-top .tl-time { margin-inline-start: auto; }
.tl-ev-detail { margin: 6px 0 2px; font-size: 13px; }
@media (max-width: 1200px) {
    .tl-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .tl-stats { grid-template-columns: 1fr 1fr; }
    .tl-id { width: auto; }
    .tl-tools { width: 100%; }
    .tl-search--main { flex: 1; min-width: 0; }
}
@media (max-width: 560px) {
    .tl-stat { padding: 10px; gap: 8px; }
    .tl-stat .sc-ico { width: 36px; height: 36px; border-radius: 10px; }
    .tl-stat .sc-ico svg { width: 18px; height: 18px; }
    .tl-stat b { font-size: 20px; }
    .tl-seg { width: 100%; }
    .tl-seg button { flex: 1; padding: 7px 6px; }
    .tl-refresh-text { display: none; }
    .tl-search--main { flex-basis: 100%; }
    .tl-filter { flex: 1; }
    .tl-card-head { padding: 10px 12px; }
    .tl-card-act { width: 100%; margin-inline-start: 0; }
    .tl-install, .tl-facts, .tl-note { padding-inline: 12px; }
    .tl-mlist { padding-inline: 12px; }
    .tl-mlist li { flex-wrap: wrap; gap: 4px 10px; }
    .tl-mlist li.transfer { margin: 0 -12px; padding-inline: 12px; }
    .tl-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- مشتریان و لایسنس‌ها: فهرست با شمارنده، سرِ مشتری، سه زبانه، کارت ---------- */
.cu-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.cu-chips button { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer; }
.cu-chips button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.cu-chips em { font-style: normal; font-weight: 800; }
.cu-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.cu-meta span { font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 0 6px; }
.cust.active .cu-meta span { background: rgba(255,255,255,.7); }
.cust .dot.red { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.cust .dot.amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.cu-back { display: none; font: inherit; font-weight: 700; color: var(--primary); background: none; border: 0; padding: 0 0 10px; cursor: pointer; }
.cu-head { display: flex; align-items: center; gap: 14px; }
.cu-avatar { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); font-size: 20px; font-weight: 800; }
.cu-title { min-width: 0; }
.cu-title h2 { font-size: 19px; }
.cu-ids { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 12.5px; }
.cu-ids b { color: var(--ink); font-weight: 600; font-size: 12.5px; }
.cu-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
/* ویجت‌ها میان‌بُرِ زبانه‌اند؛ زبانهٔ بازِ هر کدام حاشیهٔ رنگی می‌گیرد */
.cu-stat.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.cu-stat small { color: var(--muted); font-size: 11.5px; }
.cu-stat.sc-amber b { color: var(--ink); font-size: 18px; }
.cu-stat.sc-amber.is-warn b { color: var(--amber); }
.cu-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.cu-tabs .tl-seg em { font-style: normal; color: var(--muted); font-weight: 700; }
.cu-add { margin-inline-start: auto; }
.cu-add[hidden] { display: none; }
.cu-name { font-size: 15px; }
.cu-card--soon { border-color: #fcd38d; }
.cu-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.cu-copy { background: var(--blue-soft); color: var(--blue); border: 0; font-weight: 700; }
.cu-del { color: var(--danger); }
.cu-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1200px) { .cu-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
    /* موبایل و تبلت: یا فهرست، یا جزئیات */
    .cu-split.cu-open .customers-panel { display: none; }
    .cu-split:not(.cu-open) .lic-col { display: none; }
    .cu-back { display: inline-block; }
}
@media (max-width: 560px) {
    .cu-head { gap: 10px; }
    .cu-avatar { width: 44px; height: 44px; font-size: 17px; }
    .cu-title h2 { font-size: 16px; }
    .cu-tabs .tl-seg { width: 100%; }
    .cu-tabs .tl-seg button { flex: 1; padding: 7px 4px; }
    .cu-add { width: 100%; margin-inline-start: 0; }
    .cu-acts { width: 100%; margin-inline-start: 0; }
    .cu-acts .btn { flex: 1; }
    .cu-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cu-stat b { font-size: 18px; }
}

/* ---------- لیست سفید ---------- */
.sc-red .sc-ico { background: var(--danger-soft); } .sc-red .sc-ico svg { fill: var(--danger); }
.wl-stat.sc-amber b { color: var(--amber); }
.wl-stat.sc-red b { color: var(--danger); }
.wl-stat.is-zero.sc-amber b, .wl-stat.is-zero.sc-red b { color: var(--ink); }
.wl-stat.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
/* کارت‌ها کوچک‌اند؛ در عرضِ زیاد دو ستون */
.wl-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wl-id { display: grid; gap: 0; min-width: 0; flex: 1; }
.wl-mac { font-size: 16px; font-weight: 800; letter-spacing: 1px; color: var(--ink); text-align: right; white-space: nowrap; }
.wl-id .tl-mname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-facts { grid-template-columns: minmax(0, .6fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .wl-cards { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
    .wl-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    /* مک‌آدرس یک خطِ کامل؛ نشانِ انقضا زیرش */
    .wl-id { flex-basis: 100%; }
}

/* ---------- داشبورد: ویجت‌های میان‌بُر، فهرستِ فعالیت‌ها ---------- */
.dash-stat { font: inherit; color: inherit; text-align: start; cursor: pointer; width: 100%; transition: border-color .15s, transform .15s; }
.dash-stat:hover { border-color: var(--primary); transform: translateY(-1px); }
/* نوارِ بالای صفحه ثابت است؛ پرش به این پنل نباید سرش را زیرِ نوار ببرد */
#dashProviders { scroll-margin-top: 90px; }
.act-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.act-item { display: grid; gap: 4px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.act-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.act-cust { font-weight: 700; }
.act-time { margin-inline-start: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.act-mid { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; }
.act-code { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 10px; border-radius: 8px; background: var(--surface-2); }
.act-code .mono { font-size: 12px; color: var(--ink); text-align: left; }
.act-detail { color: var(--ink-soft); }
.act-meta { color: var(--muted); font-size: 12px; }
.act-all { max-height: 62vh; overflow: auto; padding: 2px; }
@media (max-width: 560px) {
    .act-item { padding: 10px 12px; }
    .act-time { margin-inline-start: 0; flex-basis: 100%; }
    .act-code .mono { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- راه‌اندازی Authenticator ---------- */
.en-steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.en-steps li { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.en-steps .sc-ico { width: 42px; height: 42px; border-radius: 12px; }
.en-steps .sc-ico svg { width: 21px; height: 21px; }
.en-steps li > div { display: grid; gap: 2px; }
.en-steps li span:not(.sc-ico) { color: var(--ink-soft); font-size: 12.5px; line-height: 1.8; }
.en-blue { background: var(--blue-soft); } .en-blue svg { fill: var(--blue); }
.en-violet { background: var(--primary-soft); } .en-violet svg { fill: var(--primary); }
.en-green { background: var(--ok-soft); } .en-green svg { fill: var(--ok); }
.en-red { background: var(--danger-soft); } .en-red svg { fill: var(--danger); }
.en-key .secret-box code { font-size: 17px; font-weight: 700; letter-spacing: 1.5px; word-break: normal; overflow-wrap: anywhere; text-align: left; }
.en-uri { margin-top: 12px; }
.en-uri summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.en-uri .secret-box code.uri { text-align: left; }
.en-danger { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-top: 22px; padding: 14px; border: 1px solid #f5c2c2; border-radius: 14px; background: #fff8f8; }
.en-danger[hidden] { display: none; }
.en-danger .sc-ico { width: 42px; height: 42px; border-radius: 12px; }
.en-danger .sc-ico svg { width: 21px; height: 21px; }
.en-danger-text { flex: 1; min-width: 220px; }
.en-danger-text .hint { margin: 2px 0 0; max-width: 520px; }
@media (max-width: 860px) {
    .en-steps { grid-template-columns: 1fr; }
    .enroll .qr-side { order: -1; }
}
@media (max-width: 560px) {
    .en-danger-acts { width: 100%; }
    .en-danger-acts .btn { flex: 1; }
}
