/* ───────────── Fonts (IRANSans, Persian digits) ───────────── */
@font-face { font-family: IRANSans; src: url(/fonts/iransans-300.ttf) format('truetype'); font-weight: 300; font-display: swap; }
@font-face { font-family: IRANSans; src: url(/fonts/iransans-400.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: IRANSans; src: url(/fonts/iransans-500.ttf) format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: IRANSans; src: url(/fonts/iransans-700.ttf) format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: IRANSans; src: url(/fonts/iransans-900.ttf) format('truetype'); font-weight: 900; font-display: swap; }

/* ───────────── Tokens ───────────── */
:root {
  --bg: #f5f5fa; --surface: #fff; --surface-2: #f2f2f8; --surface-3: #e8e8f1; --border: #e6e6ef; --border-strong: #d3d3e2;
  --text: #16162a; --text-2: #3c3c58; --muted: #74749a;
  --brand: #e1306c; --brand-2: #8a3ab9; --brand-3: #5b51d8; --brand-soft: #fdebf2; --brand-ring: rgba(225, 48, 108, .16);
  --grad: linear-gradient(120deg, #ff7a45 0%, #e1306c 34%, #a134c4 68%, #5b51d8 100%);
  --grad-soft: linear-gradient(120deg, #fff1ea 0%, #fde9f1 40%, #f3e9fb 75%, #ecebfd 100%);
  --grad-btn: linear-gradient(120deg, #e1306c 0%, #a134c4 100%);
  --ok: #0f9d63; --ok-soft: #e3f7ee; --warn: #c27803; --warn-soft: #fff4dd; --bad: #dc3545; --bad-soft: #fde8ea; --info: #3d63dd; --info-soft: #e9eefd; --violet: #7c4ddc; --violet-soft: #f1ebfd;
  --side: #11122a; --side-2: #1c1d3d; --side-text: #babcd8; --side-muted: #6d7099;
  --shadow-sm: 0 1px 2px rgba(22, 22, 42, .04), 0 1px 3px rgba(22, 22, 42, .05);
  --shadow: 0 1px 2px rgba(22, 22, 42, .04), 0 10px 28px -10px rgba(22, 22, 42, .12);
  --shadow-lg: 0 24px 60px -12px rgba(22, 22, 42, .3);
  --shadow-brand: 0 10px 24px -10px rgba(225, 48, 108, .55);
  --r-sm: 10px; --r: 14px; --r-lg: 18px;
}
:root[data-theme="dark"] {
  --bg: #0c0c1a; --surface: #15152b; --surface-2: #1b1b35; --surface-3: #25254a; --border: #26264a; --border-strong: #34345e;
  --text: #ededf9; --text-2: #c8c8e2; --muted: #8e8eb2;
  --brand-soft: rgba(225, 48, 108, .15); --brand-ring: rgba(225, 48, 108, .3);
  --grad-soft: linear-gradient(120deg, rgba(255,122,69,.1), rgba(225,48,108,.1) 40%, rgba(161,52,196,.1) 75%, rgba(91,81,216,.1));
  --ok: #3fd18f; --ok-soft: rgba(63, 209, 143, .13); --warn: #f5b84a; --warn-soft: rgba(245, 184, 74, .13);
  --bad: #ff6b7a; --bad-soft: rgba(255, 107, 122, .13); --info: #7c9dff; --info-soft: rgba(124, 157, 255, .14); --violet: #b08cff; --violet-soft: rgba(176, 140, 255, .14);
  --side: #0b0b1c; --side-2: #191a38;
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c1a; --surface: #15152b; --surface-2: #1b1b35; --surface-3: #25254a; --border: #26264a; --border-strong: #34345e;
    --text: #ededf9; --text-2: #c8c8e2; --muted: #8e8eb2;
    --brand-soft: rgba(225, 48, 108, .15); --brand-ring: rgba(225, 48, 108, .3);
    --grad-soft: linear-gradient(120deg, rgba(255,122,69,.1), rgba(225,48,108,.1) 40%, rgba(161,52,196,.1) 75%, rgba(91,81,216,.1));
    --ok: #3fd18f; --ok-soft: rgba(63, 209, 143, .13); --warn: #f5b84a; --warn-soft: rgba(245, 184, 74, .13);
    --bad: #ff6b7a; --bad-soft: rgba(255, 107, 122, .13); --info: #7c9dff; --info-soft: rgba(124, 157, 255, .14); --violet: #b08cff; --violet-soft: rgba(176, 140, 255, .14);
    --side: #0b0b1c; --side-2: #191a38;
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.6);
  }
}

/* ───────────── Base ───────────── */
* { box-sizing: border-box; }
html, body { overflow-x: clip; margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.75 IRANSans, Vazirmatn, Tahoma, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
b, strong { font-weight: 700; }
::selection { background: var(--brand-ring); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.4em; margin: 0; font-size: 13px; }
small { font-size: 12px; }
code, .ltr { direction: ltr; unicode-bidi: isolate; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
i[data-ic] { display: contents; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid var(--bg); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ───────────── Logo ───────────── */
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; box-shadow: var(--shadow-brand); }
.logo svg.ic { width: 20px; height: 20px; stroke-width: 2.2; }
.logo.lg { width: 56px; height: 56px; border-radius: 16px; }
.logo.lg svg.ic { width: 26px; height: 26px; }
.auth-art .logo { width: 72px; height: 72px; border-radius: 22px; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); backdrop-filter: blur(6px); }
.auth-art .logo svg.ic { width: 34px; height: 34px; }

/* ───────────── Auth ───────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1.1fr; }
.auth-art { background: var(--grad); color: #fff; position: relative; overflow: hidden; display: grid; place-items: center; padding: 48px; isolation: isolate; }
.auth-art::before, .auth-art::after { content: ''; position: absolute; border-radius: 50%; z-index: -1; }
.auth-art::before { width: 460px; height: 460px; top: -160px; left: -140px; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 65%); }
.auth-art::after { width: 380px; height: 380px; bottom: -120px; right: -80px; background: radial-gradient(circle, rgba(255,255,255,.14), transparent 65%); }
.auth-art-inner { position: relative; max-width: 380px; display: grid; gap: 14px; }
.auth-art h2 { font-size: 34px; font-weight: 900; margin: 6px 0 0; }
.auth-art p { margin: 0; opacity: .92; font-size: 15px; line-height: 2; }
.auth-art ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.auth-art li { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); padding: 10px 14px; border-radius: 12px; font-weight: 500; backdrop-filter: blur(6px); }
.auth-form-wrap { display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(380px, 100%); display: grid; gap: 14px; }
.auth-card h1 { font-size: 26px; font-weight: 900; margin: 8px 0 0; }
.auth-card p { margin: 0 0 8px; }

/* ───────────── Layout ───────────── */
.layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; isolation: isolate; }
.side::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 220px; z-index: -1; background: radial-gradient(ellipse at 70% 0%, rgba(225, 48, 108, .22), transparent 70%); pointer-events: none; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px; }
.brand b { display: block; color: #fff; font-size: 16px; font-weight: 900; line-height: 1.4; }
.brand small { color: var(--side-muted); }
nav { display: grid; gap: 3px; }
.nav-label { font-size: 11.5px; color: var(--side-muted); padding: 14px 12px 6px; font-weight: 500; }
nav a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; color: var(--side-text); text-decoration: none; cursor: pointer; transition: background .15s, color .15s; position: relative; font-weight: 500; }
nav a:hover { background: var(--side-2); color: #fff; }
nav a.active { background: linear-gradient(120deg, rgba(225, 48, 108, .24), rgba(161, 52, 196, .2)); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
nav a.active::before { content: ''; position: absolute; right: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 4px 0 0 4px; background: var(--grad); }
nav a.active svg.ic { color: #ff86b3; }
nav a span { flex: 1; }
nav a em { font-style: normal; font-size: 11px; background: var(--grad-btn); color: #fff; border-radius: 99px; padding: 0 8px; min-width: 22px; text-align: center; line-height: 20px; }
nav a em:empty { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.acc-card { display: flex; gap: 10px; align-items: center; background: var(--side-2); border-radius: 14px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.05); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; color: #fff; flex: none; }
.acc-meta { min-width: 0; }
.acc-meta b { display: block; color: #fff; font-size: 13.5px; direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-meta small { color: var(--side-muted); display: flex; gap: 6px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--side-muted); display: inline-block; flex: none; }
.dot.on { background: #3fd18f; box-shadow: 0 0 0 3px rgba(63, 209, 143, .2); }
.dot.paused { background: #f5b84a; box-shadow: 0 0 0 3px rgba(245, 184, 74, .2); }
.dot.off { background: #ff6b7a; box-shadow: 0 0 0 3px rgba(255, 107, 122, .18); }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-btn { display: flex; gap: 6px; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.08); background: transparent; color: var(--side-text); border-radius: 10px; padding: 8px; cursor: pointer; font-size: 13px; }
.side-btn:hover { background: var(--side-2); color: #fff; }
.side-btn svg.ic { width: 16px; height: 16px; }

main { padding: 22px 32px 48px; min-width: 0; width: 100%; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.top-title { flex: 1; min-width: 0; }
.top h2 { margin: 0; font-size: 22px; font-weight: 900; line-height: 1.4; }
.top small { display: block; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2); flex: none; }
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.menu { display: none; }
.scrim { display: none; }

/* ───────────── Controls ───────────── */
.btn { display: inline-flex; gap: 7px; align-items: center; justify-content: center; text-decoration: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 16px; border-radius: 11px; cursor: pointer; white-space: nowrap; transition: .15s; font-weight: 500; line-height: 1.6; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn svg.ic { width: 16px; height: 16px; }
.btn.primary { background: var(--grad-btn); border-color: transparent; color: #fff; box-shadow: var(--shadow-brand); }
.btn.primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=url], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
textarea { resize: vertical; min-height: 84px; line-height: 1.9; }
.input-icon { position: relative; display: block; }
.input-icon svg.ic { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding: 12px 44px 12px 14px; font-size: 15px; }
label.f { display: grid; gap: 6px; font-weight: 500; color: var(--text-2); }
label.f > small, .f-hint { font-weight: 400; color: var(--muted); }
.check { display: flex; gap: 9px; align-items: center; cursor: pointer; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ───────────── Cards ───────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; flex: 1; display: flex; gap: 9px; align-items: center; }
.card-head h3 svg.ic { color: var(--brand); }
.card-head a { font-size: 13px; text-decoration: none; }
.cards { display: grid; gap: 14px; }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 26px 28px; color: #fff; background: var(--grad); margin-bottom: 18px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; box-shadow: 0 20px 44px -22px rgba(161, 52, 196, .7); isolation: isolate; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 15% -20%, rgba(255,255,255,.28), transparent 45%), radial-gradient(circle at 90% 130%, rgba(255,255,255,.18), transparent 45%); }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(rgba(255,255,255,.18) 1px, transparent 1px); background-size: 16px 16px; mask-image: linear-gradient(to left, #000, transparent 60%); }
.hero h3 { margin: 0; font-size: 22px; font-weight: 900; }
.hero p { margin: 4px 0 0; opacity: .92; }
.hero .grow { flex: 1; min-width: 220px; }
.hero-next { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.28); border-radius: 16px; padding: 12px 16px; min-width: 240px; backdrop-filter: blur(8px); display: flex; gap: 12px; align-items: center; }
.hero-next .thumb { width: 48px; height: 48px; border-radius: 10px; background: rgba(255,255,255,.2); color: #fff; }
.hero-next small { opacity: .85; display: block; }
.hero-next b { display: block; font-size: 15px; }
.hero .btn { background: #fff; color: #a134c4; border: 0; font-weight: 700; box-shadow: 0 6px 18px -6px rgba(0,0,0,.25); }
.hero .btn:hover { background: #fff; transform: translateY(-1px); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat::after { content: ''; position: absolute; left: -30px; bottom: -30px; width: 90px; height: 90px; border-radius: 50%; background: currentColor; opacity: .05; }
.stat-ic { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; flex: none; }
.stat-ic svg.ic { width: 22px; height: 22px; }
.stat b { font-size: 28px; font-weight: 900; display: block; line-height: 1.25; font-variant-numeric: tabular-nums; color: var(--text); }
.stat span { color: var(--muted); font-size: 13px; }
.stat.c-info { color: var(--info); } .stat.c-ok { color: var(--ok); } .stat.c-brand { color: var(--brand); } .stat.c-warn { color: var(--warn); } .stat.c-bad { color: var(--bad); } .stat.c-violet { color: var(--violet); }
.tone-brand { background: var(--brand-soft); color: var(--brand); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-grad { background: var(--grad); color: #fff; box-shadow: var(--shadow-brand); }
.dash { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.dash > .stack { align-content: start; }

/* chart */
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.chart .line { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: var(--brand-soft); }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 8px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend b { color: var(--text); font-size: 14px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* lists */
.list-item { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.li-main { flex: 1; min-width: 0; }
.li-main b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-main small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 14px; background: var(--grad); }
.mini-avatar.a1 { background: linear-gradient(135deg, #ff7a45, #e1306c); }
.mini-avatar.a2 { background: linear-gradient(135deg, #a134c4, #5b51d8); }
.mini-avatar.a3 { background: linear-gradient(135deg, #10b981, #3d63dd); }
.mini-avatar.a4 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.bar-row { display: grid; gap: 5px; margin-bottom: 13px; }
.bar-row:last-child { margin: 0; }
.bar-row .row { justify-content: space-between; font-size: 13px; }
.bar { display: flex; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad-btn); border-radius: 99px; }

/* badges */
.badge { display: inline-flex; gap: 5px; align-items: center; padding: 1px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; line-height: 1.8; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.acc { background: var(--brand-soft); color: var(--brand); }
.chip { display: inline-flex; gap: 5px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 1px 9px; margin: 2px; font-size: 12.5px; color: var(--text-2); }
.chip svg.ic { width: 13px; height: 13px; }
.chip.kw { background: var(--brand-soft); border-color: transparent; color: var(--brand); font-weight: 500; }

/* alerts */
.alert { padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.alert svg.ic { flex: none; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--grad-soft); color: var(--text-2); border: 1px solid var(--border); }
.alert.info > svg.ic { color: var(--brand-2); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert .spacer { flex: 1; }

/* tabs */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 13px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--grad-btn); color: #fff; box-shadow: 0 4px 12px -4px rgba(225, 48, 108, .5); }
.tabs button em { font-style: normal; font-size: 11px; background: var(--surface-2); color: var(--muted); border-radius: 99px; padding: 0 7px; }
.tabs button.on em { background: rgba(255,255,255,.25); color: #fff; }

/* ───────────── Post grid ───────────── */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pmedia { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.pmedia img, .pmedia video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pmedia .over { position: absolute; inset: 10px 10px auto 10px; display: flex; justify-content: space-between; gap: 6px; }
.pmedia .kind { display: inline-flex; gap: 5px; align-items: center; background: rgba(15, 16, 32, .6); color: #fff; backdrop-filter: blur(8px); border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 500; }
.pmedia .kind svg.ic { width: 14px; height: 14px; }
.pmedia .over .badge { backdrop-filter: blur(8px); background: rgba(255,255,255,.92); }
:root[data-theme="dark"] .pmedia .over .badge { background: rgba(21, 21, 43, .88); }
.pbody { padding: 14px 16px; display: grid; gap: 6px; flex: 1; align-content: start; }
.pbody b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbody .cap { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.pbody .time { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.pbody .time svg.ic { width: 15px; height: 15px; color: var(--muted); }
.pbody .err { font-size: 12.5px; display: flex; gap: 6px; }
.pfoot { display: flex; gap: 4px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.pfoot .btn { flex: 1; padding: 6px 4px; }
.pfoot .btn.icon { flex: 0 0 34px; }

.thumb { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--surface-2); position: relative; display: grid; place-items: center; color: var(--muted); flex: none; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .n { position: absolute; top: 3px; left: 3px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 6px; }

/* ───────────── Rules ───────────── */
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.rcard { display: grid; gap: 12px; align-content: start; position: relative; overflow: hidden; }
.rcard::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); }
.rcard.off { opacity: .62; }
.rcard.off::before { background: var(--surface-3); }
.rcard-head { display: flex; gap: 12px; align-items: center; }
.rcard-head .stat-ic { width: 42px; height: 42px; border-radius: 12px; }
.rcard-head b { font-size: 15px; display: block; line-height: 1.5; }
.rcard-head small { color: var(--muted); }
.rcard .lbl { font-size: 12px; color: var(--muted); margin-left: 4px; }
.rcard .hits { text-align: center; background: var(--surface-2); border-radius: 12px; padding: 4px 12px; }
.rcard .hits b { font-size: 18px; font-weight: 900; display: block; line-height: 1.3; }
.rcard .hits small { color: var(--muted); font-size: 11px; }
.rcard-foot { display: flex; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.tester { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; }
.tester select { width: auto; }
.test-out { margin-top: 10px; font-size: 13.5px; }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; top: 3px; right: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--grad-btn); }
.switch input:checked + span::before { transform: translateX(-18px); }

/* ───────────── Table ───────────── */
.card.flush { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.wrap { max-width: 360px; word-break: break-word; }
.user-cell { display: flex; gap: 10px; align-items: center; }
.user-cell .mini-avatar { width: 30px; height: 30px; font-size: 12px; }

/* ───────────── Modal ───────────── */
dialog { overflow: auto; border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--text); width: min(780px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: var(--shadow-lg); }
dialog[open] { animation: pop .18s ease-out; }
dialog::backdrop { background: rgba(12, 12, 26, .55); backdrop-filter: blur(4px); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal { display: grid; gap: 18px; padding: 0 24px; }
.modal-head { display: flex; gap: 12px; align-items: center; position: sticky; top: 0; background: var(--surface); padding: 20px 0 14px; border-bottom: 1px solid var(--border); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 900; flex: 1; }
.modal-head .stat-ic { width: 40px; height: 40px; border-radius: 12px; }
.modal-foot { display: flex; gap: 8px; position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 14px 0 20px; flex-wrap: wrap; z-index: 2; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.seg label { border: 1.5px solid var(--border); border-radius: 14px; padding: 12px 8px; text-align: center; cursor: pointer; display: grid; gap: 4px; justify-items: center; font-weight: 500; color: var(--text-2); transition: .15s; }
.seg label:hover { border-color: var(--border-strong); }
.seg label svg.ic { width: 22px; height: 22px; }
.seg input { display: none; }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.fieldset { border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: grid; gap: 14px; }
.fieldset > b { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.fieldset > b svg.ic { color: var(--brand); }

.drop { border: 2px dashed var(--border-strong); border-radius: 16px; padding: 22px; text-align: center; cursor: pointer; color: var(--muted); display: grid; gap: 4px; justify-items: center; transition: .15s; background: var(--surface-2); }
.drop .stat-ic { margin-bottom: 4px; }
.drop b { color: var(--text); }
.drop.over, .drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.files { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.files .f { position: relative; width: 96px; }
.files .f .thumb { width: 96px; height: 96px; border-radius: 12px; }
.files .f button { position: absolute; top: 5px; right: 5px; border: 0; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.files .f button svg.ic { width: 14px; height: 14px; }
.files .f small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); margin-top: 3px; }
.counter { font-size: 12px; color: var(--muted); text-align: left; }
.counter.over { color: var(--bad); }

.msgs { display: grid; gap: 10px; }
.msg { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--surface-2); display: grid; gap: 10px; }
.msg-head { display: flex; gap: 8px; align-items: center; }
.msg-head .num { width: 24px; height: 24px; border-radius: 8px; background: var(--grad-btn); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.msg-head b { flex: 1; font-size: 13.5px; display: flex; gap: 6px; align-items: center; }
.msg-head button { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 8px; display: grid; place-items: center; }
.msg-head button:hover { background: var(--surface); color: var(--text); }
.msg-head button svg.ic { width: 16px; height: 16px; }
.msg audio, .msg video, .msg img { max-width: 240px; max-height: 170px; border-radius: 10px; display: block; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.add-row .btn { border-style: dashed; }

.copy { display: flex; gap: 6px; }
.copy input { direction: ltr; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; display: grid; gap: 10px; justify-items: center; }
.empty .stat-ic { width: 60px; height: 60px; border-radius: 18px; }
.empty .stat-ic svg.ic { width: 26px; height: 26px; }
.empty b { color: var(--text); font-size: 15px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.steps li .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--border-strong); flex: none; }
.steps li.done { color: var(--muted); }
.steps li.done .n { background: var(--ok); color: #fff; border-color: transparent; }
.steps li.done span { text-decoration: line-through; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 0 0 14px; display: flex; }
.progress i { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.settings-grid .full { grid-column: 1 / -1; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* toasts */
#toasts { position: fixed; bottom: 20px; left: 20px; display: grid; gap: 8px; z-index: 99; }
.toast { display: flex; gap: 10px; align-items: center; background: #1b1c33; color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); max-width: 380px; animation: up .22s ease-out; font-weight: 500; }
.toast svg.ic { flex: none; color: #ff86b3; }
.toast.bad svg.ic { color: #ff8a96; }
.toast.ok svg.ic { color: #4fe3a0; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

.skeleton { height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border: 1px solid var(--border); }
@keyframes sk { to { background-position: -200% 0; } }
.fade-in { animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* ───────────── Responsive ───────────── */
@media (max-width: 1200px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash, .settings-grid { grid-template-columns: 1fr; } .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 272px; z-index: 50; transform: translateX(100%); visibility: hidden; transition: transform .22s, visibility .22s; }
  .side.open { visibility: visible; transform: none; box-shadow: var(--shadow-lg); }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(12,12,26,.5); z-index: 40; opacity: 0; pointer-events: none; transition: .2s; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .menu { display: grid; }
  main { padding: 14px 16px 40px; }
  .top { flex-wrap: wrap; }
  #topActions { order: 3; width: 100%; }
  #topActions .btn { flex: 1; }
  .stats { gap: 10px; }
  .stat { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat-ic { width: 42px; height: 42px; }
  .seg { grid-template-columns: repeat(2, 1fr); }
  .tester { grid-template-columns: 1fr 1fr; }
  .tester input { grid-column: 1 / -1; }
  .rule-grid { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pfoot { flex-wrap: wrap; }
  .modal { padding: 0 16px; }
  .hero { padding: 20px; }
  .hero-next { min-width: 0; width: 100%; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .post-grid { grid-template-columns: 1fr; } }
