/* TankhahBot admin design system — base tokens (fallback for all themes) */
:root {
  --tb-bg: #050914;
  --tb-surface: rgba(17, 24, 43, .72);
  --tb-surface-2: rgba(23, 32, 56, .72);
  --tb-border: rgba(148, 163, 184, .14);
  --tb-text: #eef2fa;
  --tb-muted: #8f97ad;
  --tb-faint: #5b6376;
  --tb-accent: #a78bfa;
  --tb-accent-soft: rgba(167, 139, 250, .22);
  --tb-accent-ink: #efeaff;
  --tb-accent-glow: rgba(167, 139, 250, .5);
  --tb-radius: 18px;
  /* Chart variables (fallback - dark Glassmorphism defaults) */
  --chart-text: #a8b1c7;
  --chart-grid: rgba(255,255,255,.08);
  --chart-tip-bg: rgba(10,14,28,.92);
  --chart-tip-text: #eef1f8;
  --chart-series: #a78bfa;
  --chart-area-from: rgba(167,139,250,.4);
  --chart-area-to: rgba(167,139,250,0);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.tb-body {
  font-family: 'Vazirmatn', 'Inter', Tahoma, sans-serif;
  background:
    radial-gradient(900px 480px at 85% -5%, rgba(124, 58, 237, .22), transparent 60%),
    radial-gradient(700px 500px at 100% 40%, rgba(37, 99, 235, .14), transparent 65%),
    radial-gradient(800px 520px at 90% 105%, rgba(16, 185, 129, .12), transparent 60%),
    var(--tb-bg);
  color: var(--tb-text);
  min-height: 100vh;
}
.tb-shell { display: flex; min-height: 100vh; gap: 16px; padding: 16px; }
/* Sidebar (right in RTL) */
.tb-sidebar {
  width: 248px; flex: 0 0 248px;
  background: linear-gradient(180deg, rgba(30,27,75,.55), rgba(13,20,38,.85));
  border: 1px solid var(--tb-border);
  border-radius: 20px;
  backdrop-filter: blur(18px);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  position: sticky; top: 16px; height: calc(100vh - 32px);
  box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
}
.tb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; border-bottom: 1px solid var(--tb-border); margin-bottom: 12px; }
.tb-brand-name { font-weight: 700; font-size: 17px; }
.tb-brand-sub { font-size: 11px; color: var(--tb-muted); }
.tb-bot-avatar { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #60a5fa, #a78bfa); display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 6px 18px rgba(96,165,250,.4); }
.tb-nav { display: flex; flex-direction: column; gap: 6px; }
.tb-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--tb-muted); text-decoration: none; font-size: 13.5px; font-weight: 500; border: 1px solid transparent; transition: all .18s ease; }
.tb-nav a:hover { background: rgba(255,255,255,.05); color: var(--tb-text); }
.tb-nav a.tb-active { background: linear-gradient(90deg, rgba(139,92,246,.65), rgba(99,102,241,.28)); color: #fff; border-color: rgba(167,139,250,.45); box-shadow: 0 8px 28px rgba(139,92,246,.5), inset 0 1px 0 rgba(255,255,255,.16); }
.tb-nav .tb-ico { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.06); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; }
.tb-nav a.tb-active .tb-ico { background: rgba(255,255,255,.16); }
.tb-nav .tb-tag { margin-inline-start: auto; font-size: 10px; background: rgba(251,191,36,.16); color: var(--tb-orange, #fbbf24); padding: 2px 8px; border-radius: 999px; }
.tb-promo { margin-top: auto; background: linear-gradient(180deg, rgba(37,99,235,.28), rgba(13,20,38,.7)); border: 1px solid rgba(96,165,250,.25); border-radius: 18px; padding: 22px 14px 16px; text-align: center; box-shadow: 0 14px 34px rgba(37,99,235,.25); }
.tb-promo .tb-promo-bot { font-size: 44px; filter: drop-shadow(0 8px 18px rgba(96,165,250,.5)); }
.tb-promo h3 { margin: 10px 0 4px; font-size: 17px; }
.tb-promo p { margin: 0 0 6px; font-size: 11.5px; color: var(--tb-muted); }
/* Main */
.tb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.tb-topbar { display: flex; align-items: center; gap: 12px; }
.tb-user { display: flex; align-items: center; gap: 10px; }
.tb-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #334155, #64748b); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.tb-user-name { font-size: 13px; font-weight: 600; }
.tb-user-sub { font-size: 11px; color: #4ade80; }
.tb-icon-btn { width: 38px; height: 38px; border-radius: 12px; background: var(--tb-surface); border: 1px solid var(--tb-border); color: var(--tb-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: all .18s; }
.tb-icon-btn:hover { color: var(--tb-text); border-color: rgba(167,139,250,.4); }
.tb-dot { position: absolute; top: 8px; inset-inline-start: 8px; min-width: 16px; height: 16px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.tb-search { flex: 1; max-width: 420px; margin-inline-start: auto; display: flex; align-items: center; gap: 8px; background: var(--tb-surface); border: 1px solid var(--tb-border); border-radius: 12px; padding: 9px 14px; backdrop-filter: blur(14px); }
.tb-search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--tb-text); font-family: inherit; font-size: 13px; }
.tb-search input::placeholder { color: var(--tb-faint); }
/* Status pill + title */
.tb-status-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(16,185,129,.1); border: 1px solid rgba(52,211,153,.3); color: #6ee7b7; border-radius: 999px; padding: 7px 16px; font-size: 12.5px; }
.tb-pulse { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.2); }
.tb-title { font-size: 22px; font-weight: 700; margin: 2px 0 0; }
.tb-subtitle { font-size: 12.5px; color: var(--tb-muted); margin: 2px 0 0; }
/* Cards */
.tb-card { background: var(--tb-surface); border: 1px solid var(--tb-border); border-radius: var(--tb-radius); padding: 20px; backdrop-filter: blur(18px); box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06); }
.tb-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tb-kpi { position: relative; overflow: hidden; }
.tb-kpi::after { content: ""; position: absolute; inset-inline-end: 0; top: 14px; bottom: 14px; width: 3px; background: var(--tb-kpi-accent, var(--tb-accent)); opacity: .8; border-radius: 3px; }
.tb-kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tb-kpi-label { font-size: 13px; color: var(--tb-muted); }
.tb-kpi-ico { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--tb-kpi-bg, rgba(167,139,250,.16)); color: var(--tb-kpi-accent, var(--tb-accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.tb-kpi-num { font-size: 30px; font-weight: 700; line-height: 1.25; letter-spacing: 0; }
.tb-kpi-delta { font-size: 12px; margin-top: 2px; }
.tb-up { color: #4ade80; } .tb-down { color: var(--tb-red, #f87171); } .tb-flat { color: var(--tb-muted); }
.tb-kpi-sub { font-size: 11.5px; color: var(--tb-faint); margin-top: 2px; }
/* Layout rows */
.tb-row-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.tb-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.tb-sec-title { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.tb-link { font-size: 12px; color: var(--tb-accent); text-decoration: none; }
/* Filters */
.tb-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tb-pill { display: inline-block; padding: 7px 14px; border-radius: 10px; background: rgba(255,255,255,.05); color: var(--tb-muted); text-decoration: none; font-size: 12.5px; border: 1px solid transparent; transition: all .15s; }
.tb-pill:hover { color: var(--tb-text); }
.tb-pill.tb-on { background: rgba(139,92,246,.28); color: #ede9fe; border-color: rgba(167,139,250,.35); }
.tb-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.tb-input { background: rgba(255,255,255,.06); border: 1px solid var(--tb-border); border-radius: 10px; padding: 8px 12px; color: var(--tb-text); font-family: inherit; font-size: 13px; }
select.tb-input, select.tb-input option { background-color: #141c33; color: var(--tb-text); }
select.tb-input { appearance: auto; max-width: 100%; }
.tb-input::placeholder { color: var(--tb-faint); opacity: 1; }
.tb-input:focus { outline: none; border-color: rgba(167,139,250,.55); box-shadow: 0 0 0 3px rgba(139,92,246,.18); }
.tb-subscription-form { display: grid; gap: 12px; }
.tb-field { display: grid; gap: 6px; color: var(--tb-muted); font-size: 12px; }
.tb-field textarea { min-height: 86px; resize: vertical; }
.tb-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tb-switch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tb-switch { display: flex; align-items: center; gap: 8px; color: var(--tb-muted); font-size: 12px; cursor: pointer; min-width: 0; }
.tb-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tb-switch-track { width: 38px; height: 22px; flex: 0 0 38px; border-radius: 999px; background: var(--tb-surface-2); border: 1px solid var(--tb-border); position: relative; transition: all .18s; }
.tb-switch-track::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--tb-muted); top: 2px; inset-inline-end: 2px; transition: all .18s; }
.tb-switch input:checked + .tb-switch-track { background: var(--tb-accent-soft); border-color: var(--tb-accent); }
.tb-switch input:checked + .tb-switch-track::after { background: var(--tb-accent); transform: translateX(-16px); }
.tb-switch input:focus-visible + .tb-switch-track { outline: 2px solid var(--tb-accent); outline-offset: 2px; }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 9px 18px; border-radius: 12px; border: 1px solid var(--tb-border); background: var(--tb-accent-soft); color: var(--tb-accent-ink); font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.7; cursor: pointer; text-decoration: none; transition: all .18s; box-shadow: 0 8px 20px var(--tb-accent-glow); max-width: 100%; }
.tb-btn:hover { background: var(--tb-accent); color: white; }
.tb-btn:focus-visible { outline: 2px solid var(--tb-accent); outline-offset: 2px; }
.tb-btn.tb-green { background: rgba(16,185,129,.18); border-color: rgba(52,211,153,.35); color: #a7f3d0; box-shadow: 0 8px 20px rgba(16,185,129,.2); }
.tb-btn.tb-red { background: rgba(239,68,68,.16); border-color: rgba(248,113,113,.35); color: #fecaca; box-shadow: 0 8px 20px rgba(239,68,68,.2); }
.tb-btn.tb-ghost { background: rgba(255,255,255,.05); color: var(--tb-muted); box-shadow: none; }
/* Tables */
.tb-table-wrap { overflow-x: auto; border-radius: 12px; }
table.tb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tb-table thead th { color: var(--tb-faint); font-weight: 500; font-size: 12px; text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--tb-border); white-space: nowrap; }
.tb-table tbody td { padding: 11px 12px; border-bottom: 1px solid rgba(148,163,184,.08); vertical-align: middle; }
.tb-table tbody tr:hover { background: var(--tb-accent-soft); }
.tb-badge { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--tb-accent-soft); color: var(--tb-accent-ink); border: 1px solid var(--tb-accent); }
.tb-badge.tb-green { background: rgba(16,185,129,.18); color: #6ee7b7; border-color: rgba(52,211,153,.3); }
.tb-badge.tb-amber { background: rgba(251,191,36,.14); color: #fcd34d; border-color: rgba(251,191,36,.3); }
.tb-badge.tb-red { background: rgba(239,68,68,.14); color: #fca5a5; border-color: rgba(248,113,113,.3); }
/* Lists */
.tb-item { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid rgba(148,163,184,.08); }
.tb-item:last-child { border-bottom: 0; }
.tb-item-ico { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 38px; }
.tb-item-title { font-size: 13px; font-weight: 600; }
.tb-item-sub { font-size: 11.5px; color: var(--tb-muted); }
.tb-item-time { margin-inline-start: auto; font-size: 11.5px; color: var(--tb-faint); white-space: nowrap; }
/* Alerts / empty */
.tb-alert { border-radius: 12px; padding: 12px 16px; font-size: 13px; margin-bottom: 12px; }
.tb-alert.tb-red { background: rgba(239,68,68,.1); border: 1px solid rgba(248,113,113,.3); color: #fca5a5; }
.tb-alert.tb-amber { background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); color: #fcd34d; }
.tb-empty { text-align: center; color: var(--tb-faint); font-size: 13px; padding: 32px 12px; }
.tb-note { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.28); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; color: #fde68a; }
.tb-mono { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; direction: ltr; }
/* Footer */
.tb-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px 2px; font-size: 11.5px; color: var(--tb-faint); }
.tb-ok { color: #4ade80; }
/* Charts */
.tb-chart { width: 100%; height: 260px; }
/* Responsive */
@media (max-width: 1100px) {
  .tb-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .tb-row-2, .tb-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .tb-shell { padding: 10px; }
  .tb-sidebar { position: fixed; inset-inline-end: 10px; top: 10px; bottom: 10px; z-index: 50; transform: translateX(-110%); transition: transform .22s ease; height: auto; }
  .tb-sidebar.tb-open { transform: translateX(0); }
  .tb-search { display: none; }
  .tb-kpi-grid { grid-template-columns: 1fr; }
  .tb-form-grid, .tb-switch-grid { grid-template-columns: 1fr; }
}
/* Light theme */
[data-theme="light"] body.tb-body, body.tb-body[data-theme="light"] { --tb-text: #0f172a; --tb-muted: #475569; }
[data-theme="light"] .tb-card, [data-theme="light"] .tb-sidebar { background: rgba(255,255,255,.85); color: #0f172a; }
/* Native controls follow the active theme (dark default) */
:root, :root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
