/* YouTube Downloader (Xurshid.Com) — admin panel. No framework; light & dark themes via CSS variables. */

:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eff2f8;
  --border: #e5e9f2;
  --border-2: #d5dbe8;
  --text: #0d1526;
  --text-2: #4b5670;
  --muted: #8a94ab;
  --accent: #4f63f6;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(79, 99, 246, .10);
  --accent-ring: rgba(79, 99, 246, .28);
  --grad: linear-gradient(135deg, #3b82f6 0%, #6366f1 48%, #8b5cf6 100%);
  --success: #0f9f6e; --success-soft: rgba(16, 185, 129, .12);
  --warning: #d98a00; --warning-soft: rgba(245, 158, 11, .14);
  --danger: #e03b3b; --danger-soft: rgba(239, 68, 68, .11);
  --info: #0b8bd1; --info-soft: rgba(14, 165, 233, .12);
  --muted-soft: rgba(100, 116, 139, .12);
  --sidebar: #0b1120;
  --sidebar-2: #111a2e;
  --sidebar-text: #aab4cb;
  --sidebar-muted: #5f6b86;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -6px rgba(15, 23, 42, .10);
  --shadow-lg: 0 24px 60px -18px rgba(15, 23, 42, .35);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d19;
  --surface: #0f1729;
  --surface-2: #131d33;
  --surface-3: #18233c;
  --border: #1d2943;
  --border-2: #2a3856;
  --text: #e9eef8;
  --text-2: #a4afc6;
  --muted: #6a7693;
  --accent: #7085ff;
  --accent-soft: rgba(112, 133, 255, .14);
  --accent-ring: rgba(112, 133, 255, .35);
  --success: #34d399; --success-soft: rgba(52, 211, 153, .13);
  --warning: #fbbf24; --warning-soft: rgba(251, 191, 36, .13);
  --danger: #f87171; --danger-soft: rgba(248, 113, 113, .13);
  --info: #38bdf8; --info-soft: rgba(56, 189, 248, .13);
  --muted-soft: rgba(148, 163, 184, .12);
  --sidebar: #070b16;
  --sidebar-2: #0d1426;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .7);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
[hidden] { display: none !important; }

.i { width: 18px; height: 18px; flex: none; vertical-align: middle; }

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0;
  width: 264px; height: 100vh; flex: none;
  display: flex; flex-direction: column;
  background: radial-gradient(120% 60% at 0% 0%, rgba(99, 102, 241, .22), transparent 60%), linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, .04);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 8px 24px -6px rgba(99, 102, 241, .7); }
.brand b { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--sidebar-muted); font-size: 12px; font-weight: 500; }

.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-label { padding: 18px 12px 8px; color: var(--sidebar-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 11px;
  color: var(--sidebar-text); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .05); color: #fff; text-decoration: none; }
.nav-link.active { background: linear-gradient(135deg, rgba(59, 130, 246, .9), rgba(139, 92, 246, .9)); color: #fff; box-shadow: 0 10px 26px -10px rgba(99, 102, 241, .9); }
.nav-link .i { width: 19px; height: 19px; opacity: .9; }
.nav-count { margin-left: auto; color: var(--sidebar-muted); font-size: 12px; font-weight: 600; }
.nav-link.active .nav-count { color: rgba(255, 255, 255, .8); }
.nav-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: #f59e0b; color: #1a1200; font-size: 11.5px; font-weight: 700; text-align: center; }

.sidebar-foot { display: flex; align-items: center; gap: 10px; margin: 12px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .05); }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who b { display: block; color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { color: var(--sidebar-muted); font-size: 12px; }
.sidebar-foot form { margin: 0; }
.sidebar-foot .icon-btn { color: var(--sidebar-text); border-color: transparent; background: transparent; }
.sidebar-foot .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.sidebar-backdrop { display: none; }

.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;
  min-height: 72px; padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { color: var(--muted); font-size: 13px; margin-top: 1px; }
.topbar-search { position: relative; width: 300px; }
.topbar-search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.topbar-search input[type=search] { padding-left: 38px; height: 40px; border-radius: 12px; background: var(--surface); }
.bell { position: relative; }
.bell .dot { position: absolute; top: 7px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 2px var(--surface); }

.content { padding: 28px 32px 48px; max-width: 1480px; width: 100%; }

/* ------------------------------------------------------------ building blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 9px; }
.card-head h2 .i, .card-head h3 .i { color: var(--accent); }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 20px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) 380px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-3 { margin-bottom: 20px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.strong { font-weight: 650; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* stat cards */
.stat { position: relative; overflow: hidden; padding: 20px 22px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--text-2); font-size: 13px; font-weight: 550; }
.stat-value { margin-top: 10px; font-size: 28px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-foot { margin-top: 6px; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat-foot .up { color: var(--success); font-weight: 650; }
.stat-foot .down { color: var(--danger); font-weight: 650; }
.tile { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tile .i { width: 20px; height: 20px; }
.tile-accent { background: var(--accent-soft); color: var(--accent); }
.tile-success { background: var(--success-soft); color: var(--success); }
.tile-warning { background: var(--warning-soft); color: var(--warning); }
.tile-danger { background: var(--danger-soft); color: var(--danger); }
.tile-info { background: var(--info-soft); color: var(--info); }
.tile-muted { background: var(--muted-soft); color: var(--muted); }
.tile-grad { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .8); }
.stat.highlight { background: var(--grad); color: #fff; border: 0; box-shadow: 0 18px 40px -18px rgba(79, 70, 229, .8); }
.stat.highlight .stat-label, .stat.highlight .stat-foot { color: rgba(255, 255, 255, .82); }
.stat.highlight .tile { background: rgba(255, 255, 255, .18); color: #fff; }
.stat.highlight::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .1); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-muted { background: var(--muted-soft); color: var(--text-2); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 550; }
.tag .i { width: 14px; height: 14px; }

.online-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }

/* avatars */
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; font-weight: 700; font-size: 13.5px; letter-spacing: .02em; position: relative; }
.avatar-lg { width: 72px; height: 72px; border-radius: 22px; font-size: 24px; }
.avatar-sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11.5px; }
.tone-0 { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.tone-1 { background: linear-gradient(135deg, #8b5cf6, #d946ef); }
.tone-2 { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.tone-3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.tone-4 { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.tone-5 { background: linear-gradient(135deg, #ec4899, #f97316); }
.avatar .online-dot { position: absolute; right: -2px; bottom: -2px; box-shadow: 0 0 0 2.5px var(--surface); }
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); }
.user-cell:hover { text-decoration: none; }
.user-cell:hover b { color: var(--accent); }
.user-cell b { display: block; font-weight: 650; }
.user-cell > span:last-child > span { display: block; color: var(--muted); font-size: 12.5px; }
.user-cell > span:last-child { min-width: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: 11px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text);
  font: 600 13.5px/1 var(--font);
  cursor: pointer; white-space: nowrap;
  transition: transform .06s, box-shadow .15s, background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }
.btn .i { width: 17px; height: 17px; }
.btn-primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .75); }
.btn-primary:hover { box-shadow: 0 12px 26px -8px rgba(79, 70, 229, .9); filter: brightness(1.05); }
.btn-success { background: linear-gradient(135deg, #16c784, #0ea86e); color: #fff; border: 0; box-shadow: 0 8px 20px -8px rgba(16, 185, 129, .8); }
.btn-success:hover { filter: brightness(1.05); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: transparent; }
.btn-soft { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn-soft:hover { background: var(--accent); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); border-color: transparent; }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; border-radius: 13px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.inline-form { display: inline; margin: 0; }

/* forms */
label.label, .label { display: block; margin-bottom: 7px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.input, .select, .textarea, input:not([type]), input[type=text], input[type=password], input[type=number], input[type=search], input[type=url], input[type=email], input[type=datetime-local], input[type=tel], select, textarea {
  width: 100%;
  height: 42px; padding: 0 13px;
  border: 1px solid var(--border-2); border-radius: 11px;
  background: var(--surface-2); color: var(--text);
  font: 14px/1.4 var(--font);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea, .textarea { height: auto; min-height: 92px; padding: 11px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94ab' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.hint { margin-top: 6px; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.input-icon > input { padding-left: 42px; }
.input-icon > .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; display: grid; place-items: center; }
.input-icon > .reveal:hover { color: var(--text); background: var(--surface-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.input-group { display: flex; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; height: 42px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 44px; height: 26px; border-radius: 99px; background: var(--border-2); position: relative; transition: background .18s; flex: none; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s; }
.switch input:checked + .track { background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--accent-ring); }

/* segmented tabs */
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); flex-wrap: wrap; }
.segmented a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.segmented a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.segmented a.active { background: var(--text); color: var(--surface); }
:root[data-theme="dark"] .segmented a.active { background: var(--accent); color: #fff; }
.segmented .count { padding: 0 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; }
.segmented a.active .count { background: rgba(255, 255, 255, .2); color: inherit; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { padding: 0 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0; }
.toolbar .search { position: relative; width: 280px; }
.toolbar .search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.toolbar .search input[type=search] { padding-left: 38px; background: var(--surface); }
.toolbar select { width: auto; min-width: 170px; background-color: var(--surface); }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { padding: 11px 16px; text-align: left; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .actions { text-align: right; white-space: nowrap; }
.card > .table-wrap:first-child table th:first-child { border-top-left-radius: var(--radius); }
.card > .table-wrap:first-child table th:last-child { border-top-right-radius: var(--radius); }
.cell-title { font-weight: 600; color: var(--text); max-width: 420px; }
.cell-sub { color: var(--muted); font-size: 12.5px; }

/* key/value lists */
.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 0; }
.kv > div { padding: 10px 0; border-bottom: 1px dashed var(--border); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.kv .k { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kv .k .i { width: 16px; height: 16px; }
.kv .v { font-weight: 550; }

/* list rows */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.list-item { color: inherit; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }

/* timeline */
.timeline { position: relative; padding: 6px 22px 10px; }
.tl-item { position: relative; display: flex; gap: 14px; padding: 12px 0; }
.tl-item::before { content: ""; position: absolute; left: 17px; top: 46px; bottom: -6px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.tl-icon .i { width: 17px; height: 17px; }
.tl-body { min-width: 0; flex: 1; padding-top: 1px; }
.tl-title { font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-title a { color: var(--text); }
.tl-msg { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.tl-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tl-day { margin: 14px 0 2px; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* empty state */
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty .tile { margin: 0 auto 14px; width: 56px; height: 56px; border-radius: 16px; }
.empty .tile .i { width: 26px; height: 26px; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span.cur { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); color: var(--text-2); font-weight: 600; font-size: 13px; }
.pagination a:hover { background: var(--surface-3); text-decoration: none; }
.pagination span.cur { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .gap { color: var(--muted); padding: 0 4px; align-self: center; }

/* charts (server-side SVG / CSS bars) */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 210px; padding: 8px 0 0; border-bottom: 1px solid var(--border); }
.chart .bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.chart .bar span { display: block; width: 100%; max-width: 22px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); opacity: .85; transition: opacity .15s; }
.chart .bar.zero span { background: var(--surface-3); opacity: 1; }
.chart .bar:hover span { opacity: 1; filter: brightness(1.1); }
.chart .bar .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 6px 9px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; z-index: 2; }
.chart .bar:hover .tip { display: block; }
.chart .bar:nth-child(-n+4) .tip { left: 0; transform: none; }
.chart .bar:nth-last-child(-n+4) .tip { left: auto; right: 0; transform: none; }
.chart-axis span:first-child { justify-content: flex-start; }
.chart-axis span:last-child { justify-content: flex-end; }
.chart-axis { display: flex; gap: 4px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.chart-axis span { flex: 1; text-align: center; min-width: 0; white-space: nowrap; display: flex; justify-content: center; }
.chart-total { display: flex; align-items: baseline; gap: 10px; }
.chart-total b { font-size: 24px; letter-spacing: -.02em; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 54px; }
.mini-bars span { flex: 1; border-radius: 3px 3px 0 0; background: var(--accent); opacity: .85; min-height: 2px; }
.mini-bars span.zero { background: var(--surface-3); opacity: 1; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--grad); }
.progress.success > span { background: linear-gradient(90deg, #10b981, #34d399); }
.progress.warning > span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress.danger > span { background: linear-gradient(90deg, #ef4444, #f87171); }

/* subscription hero (user page) */
.sub-hero { position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius); color: #fff; background: var(--grad); box-shadow: 0 20px 44px -20px rgba(79, 70, 229, .85); }
.sub-hero.expired { background: linear-gradient(135deg, #475569, #1e293b); box-shadow: 0 20px 44px -22px rgba(15, 23, 42, .8); }
.sub-hero.blocked { background: linear-gradient(135deg, #ef4444, #9f1239); }
.sub-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.sub-hero .label { color: rgba(255, 255, 255, .8); margin: 0; font-weight: 600; }
.sub-hero .big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-top: 6px; }
.sub-hero .big small { font-size: 16px; font-weight: 600; opacity: .85; margin-left: 4px; letter-spacing: 0; }
.sub-hero .until { margin-top: 4px; color: rgba(255, 255, 255, .88); }
.sub-hero .progress { background: rgba(255, 255, 255, .22); margin-top: 16px; }
.sub-hero .progress > span { background: #fff; }

.profile-head { display: flex; align-items: center; gap: 18px; padding: 22px; flex-wrap: wrap; }
.profile-head .grow { flex: 1; min-width: 200px; }
.profile-head h2 { font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-head .meta { color: var(--muted); margin-top: 4px; display: flex; gap: 16px; flex-wrap: wrap; }
.profile-head .meta span { display: inline-flex; align-items: center; gap: 6px; }
.profile-head .meta .i { width: 15px; height: 15px; }

/* device cards */
.device { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.device.revoked { opacity: .6; }
.device-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.device-head .grow { flex: 1; min-width: 0; }
.device-head b { display: block; }
.device .kv > div { padding: 7px 0; }

/* receipts / payment cards */
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.pay-card { display: flex; flex-direction: column; overflow: hidden; }
.receipt-thumb { position: relative; display: block; height: 220px; background: var(--surface-3); border-bottom: 1px solid var(--border); overflow: hidden; cursor: zoom-in; }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .3s; }
.receipt-thumb:hover img { transform: scale(1.03); }
.receipt-thumb .pdf { height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center; }
.receipt-thumb .pdf .i { width: 42px; height: 42px; }
.receipt-thumb .zoom { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; background: rgba(15, 23, 42, .72); color: #fff; font-size: 12px; font-weight: 600; backdrop-filter: blur(6px); }
.receipt-thumb .zoom .i { width: 15px; height: 15px; }
.pay-body { padding: 16px 18px; flex: 1; }
.pay-amount { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.pay-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px 18px; }
.receipt-mini { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); background: var(--surface-3); display: grid; place-items: center; color: var(--muted); cursor: zoom-in; }

/* tariffs */
.tariff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.tariff { position: relative; display: flex; flex-direction: column; padding: 22px; }
.tariff.inactive { opacity: .62; }
.tariff .badge-top { position: absolute; top: 16px; right: 16px; }
.tariff h3 { font-size: 17px; }
.tariff .price { margin-top: 14px; font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.tariff .price small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.tariff .old { color: var(--muted); text-decoration: line-through; font-size: 14px; }
.tariff .desc { margin-top: 10px; color: var(--text-2); flex: 1; }
.tariff .per-day { margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.tariff-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.tariff-new { display: grid; place-items: center; min-height: 260px; border: 2px dashed var(--border-2); background: transparent; box-shadow: none; color: var(--text-2); cursor: pointer; font: inherit; border-radius: var(--radius); transition: border-color .15s, color .15s, background .15s; }
.tariff-new:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tariff-new .tile { margin: 0 auto 10px; }

/* notice boxes */
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 13px; border: 1px solid; font-size: 13.5px; }
.notice .i { margin-top: 1px; }
.notice b { font-weight: 650; }
.notice-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); color: var(--text); }
.notice-info > .i { color: var(--info); }
.notice-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--text); }
.notice-warning > .i { color: var(--warning); }
.notice-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--text); }
.notice-success > .i { color: var(--success); }
.notice-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--text); }
.notice-danger > .i { color: var(--danger); }

/* steps (telegram page) */
.steps { counter-reset: step; }
.step { position: relative; padding-left: 52px; }
.step + .step { margin-top: 26px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 750; }
.step.done::before { content: "✓"; background: var(--success-soft); color: var(--success); }
.step h3 { font-size: 15px; margin: 6px 0 6px; }
.step p { color: var(--text-2); }

.copy-field { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--surface-2); }
.copy-field code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* settings layout */
.settings-nav { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; }
.settings-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-title h2 { font-size: 16px; }
.section-title p { color: var(--muted); font-size: 13px; }

/* app modal preview */
.preview { position: sticky; top: 92px; }
.app-preview { padding: 22px; border-radius: 20px; background: #0f1729; color: #e6ebf5; border: 1px solid #1f2b44; box-shadow: var(--shadow-lg); font-size: 13px; }
.app-preview .ap-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid #1f2b44; }
.app-preview .ap-head img { width: 44px; height: 44px; border-radius: 12px; }
.app-preview .ap-head b { font-size: 16px; display: block; }
.app-preview .ap-head span { color: #8f9bb6; font-size: 12.5px; }
.app-preview .ap-warn { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #0a1120; border: 1px solid #1f2b44; color: #fbbf24; }
.app-preview .ap-warn b { display: block; color: #fcd34d; margin-bottom: 3px; }
.app-preview .ap-contact { margin-top: 14px; padding: 14px; border-radius: 12px; background: #131d33; border: 1px solid #1f2b44; }
.app-preview .ap-contact .t { color: #8f9bb6; font-size: 11px; font-weight: 700; letter-spacing: .08em; margin-bottom: 8px; }
.app-preview .ap-contact div.r { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.app-preview .ap-contact .i { width: 16px; height: 16px; color: #8f9bb6; }
.app-preview .ap-contact .tg { color: #60a5fa; }
.app-preview .ap-btns { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 16px; }
.app-preview .ap-btns span { display: grid; place-items: center; height: 40px; border-radius: 11px; border: 1px solid #1f2b44; font-weight: 650; }
.app-preview .ap-btns span.go { background: linear-gradient(135deg, #22c55e, #16a34a); border: 0; color: #fff; }

/* toasts */
.toasts { position: fixed; right: 24px; top: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toast-in .28s cubic-bezier(.2, .9, .3, 1.2); }
.toast .tile { width: 32px; height: 32px; border-radius: 10px; }
.toast .tile .i { width: 17px; height: 17px; }
.toast .msg { flex: 1; padding-top: 5px; font-weight: 550; }
.toast .close { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.toast.out { animation: toast-out .25s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

/* modals */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(8, 12, 24, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fade .18s; }
.modal[hidden] { display: none; }
.modal-box { width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .9, .3, 1.15); }
.modal-box.wide { width: min(640px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 16px 22px 4px; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { padding: 6px 11px; border-radius: 99px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } }

.lightbox { position: fixed; inset: 0; z-index: 95; display: grid; grid-template-rows: auto 1fr auto; background: rgba(5, 8, 16, .92); animation: fade .18s; }
.lightbox[hidden] { display: none; }
.lightbox-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; color: #fff; }
.lightbox-top .icon-btn { background: rgba(255, 255, 255, .08); border-color: transparent; color: #fff; }
.lightbox-img { display: grid; place-items: center; overflow: auto; padding: 0 18px; min-height: 0; }
.lightbox-img img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); background: #fff; }
.lightbox-actions { display: flex; justify-content: center; gap: 12px; padding: 16px; }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(900px 500px at 10% 0%, rgba(59, 130, 246, .28), transparent 60%),
  radial-gradient(800px 500px at 100% 100%, rgba(139, 92, 246, .26), transparent 60%),
  #070b16; }
.auth-card { width: min(430px, 100%); padding: 34px 32px 28px; border-radius: 24px; background: rgba(15, 23, 41, .82); border: 1px solid rgba(255, 255, 255, .07); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .9); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); color: #e9eef8;
  --surface: #0f1729; --surface-2: #0b1222; --surface-3: #18233c; --border: #1d2943; --border-2: #26334f; --text: #e9eef8; --text-2: #a4afc6; --muted: #6a7693; --accent: #7085ff; --accent-ring: rgba(112, 133, 255, .35); }
.auth-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-logo img { width: 54px; height: 54px; border-radius: 16px; box-shadow: 0 12px 30px -8px rgba(99, 102, 241, .8); }
.auth-logo b { display: block; font-size: 18px; letter-spacing: -.01em; }
.auth-logo span { color: var(--muted); font-size: 13px; }
.auth h1 { font-size: 24px; letter-spacing: -.02em; }
.auth .lead { color: var(--text-2); margin: 6px 0 22px; }
.auth .foot { margin-top: 22px; color: var(--muted); font-size: 12.5px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }
.auth .foot .i { width: 15px; height: 15px; }
.error-page { text-align: center; }
.error-page .code { font-size: 64px; font-weight: 800; letter-spacing: -.04em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1080px) {
  .grid-main, .grid-side, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .preview, .settings-nav { position: static; }
  .topbar-search { width: 220px; }
}
@media (min-width: 901px) {
  .only-mobile { display: none !important; }
}
@media (max-width: 900px) {
  .toasts { right: 16px; top: 16px; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(5, 8, 16, .5); }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 40px; }
  .topbar-search { display: none; }
  .only-mobile { display: inline-grid !important; }
}
@media (max-width: 640px) {
  .grid-2, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .toolbar .search, .toolbar select { width: 100%; }
  .toolbar form { width: 100%; }
  .topbar-title h1 { font-size: 18px; }
  .topbar-title p { display: none; }
  .table th, .table td { padding: 11px 12px; }
  .hide-sm { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv > div { border-bottom: 0; padding: 2px 0; }
  .kv .v { padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
  .auth-card { padding: 28px 22px 24px; }
  .stat-value { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.receipt-mini { overflow: hidden; }
.receipt-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* theme toggle shows the icon of the theme it switches to */
:root[data-theme="dark"] .only-light, :root:not([data-theme="dark"]) .only-dark { display: none; }

.me-link { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: inherit; border-radius: 10px; }
.me-link:hover { text-decoration: none; }
.me-link:hover .who b { color: #c7d2fe; }
.maint { display: flex; flex-direction: column; }
.maint .card-body { flex: 1; }
.table th.right, .table td.right { text-align: right; }
