:root {
  --font: "Vazirmatn", "Segoe UI", Tahoma, "Iranian Sans", sans-serif;
  --bg: #f4f5fb;
  --bg-glow-1: rgba(99, 102, 241, 0.14);
  --bg-glow-2: rgba(139, 92, 246, 0.12);
  --card: #ffffff;
  --card-2: #f8f9fd;
  --text: #14161f;
  --text-2: #3d4254;
  --muted: #6f7487;
  --line: #e8eaf3;
  --line-2: #f1f2f8;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --violet: #8b5cf6;
  --violet-bg: rgba(139, 92, 246, 0.12);
  --shadow: 0 1px 2px rgba(18, 22, 40, 0.04), 0 10px 30px -14px rgba(18, 22, 40, 0.14);
  --shadow-lift: 0 2px 4px rgba(18, 22, 40, 0.05), 0 18px 44px -18px rgba(18, 22, 40, 0.22);
  --radius: 18px;
  --radius-sm: 12px;
  --tooltip-bg: #1b1e2c;
}

[data-theme="dark"] {
  --bg: #0b0d13;
  --bg-glow-1: rgba(99, 102, 241, 0.16);
  --bg-glow-2: rgba(139, 92, 246, 0.13);
  --card: #12151f;
  --card-2: #171b28;
  --text: #f2f3f8;
  --text-2: #c6cad8;
  --muted: #8b90a5;
  --line: #232838;
  --line-2: #1b202d;
  --green-bg: rgba(16, 185, 129, 0.16);
  --red-bg: rgba(239, 68, 68, 0.16);
  --amber-bg: rgba(245, 158, 11, 0.16);
  --blue-bg: rgba(59, 130, 246, 0.16);
  --violet-bg: rgba(139, 92, 246, 0.18);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.4), 0 20px 50px -20px rgba(0, 0, 0, 0.75);
  --tooltip-bg: #232838;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  transition: background 0.25s ease, color 0.25s ease;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(620px 340px at 88% -60px, var(--bg-glow-1), transparent 70%),
    radial-gradient(720px 380px at 8% -80px, var(--bg-glow-2), transparent 70%);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 22px 40px;
}

main { display: flex; flex-direction: column; gap: 22px; }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -10px rgba(99, 102, 241, 0.65);
}

.brand-text h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.2px; }
.brand-sub { font-size: 12.5px; color: var(--muted); direction: ltr; display: inline-block; }

.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-accent {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.14));
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--accent);
}

[data-theme="dark"] .chip-accent { color: #a5b4fc; }

.chip-gold {
  background: var(--amber-bg);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--amber);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.icon-btn:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: var(--shadow); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }

/* ---------- Segmented control ---------- */

.seg {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.seg button:hover { color: var(--text); }

.seg button.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* ---------- KPI cards ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.kpi {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: fadeUp 0.5s ease backwards;
}

.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 40%, transparent));
  opacity: 0.9;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--tone) 13%, transparent);
  color: var(--tone);
  margin-bottom: 12px;
}

.kpi-icon svg { width: 21px; height: 21px; }

.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin: 2px 0 8px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.kpi-value .unit { font-size: 14px; font-weight: 600; color: var(--muted); margin-right: 4px; }

.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 26px; }

.kpi-note { font-size: 11.5px; color: var(--muted); }

.kpi-spark { margin-top: 10px; height: 34px; }
.kpi-spark svg { display: block; width: 100%; height: 34px; overflow: visible; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  direction: rtl;
}

.badge svg { width: 13px; height: 13px; }

.badge.up { background: var(--green-bg); color: var(--green); }
.badge.down { background: var(--red-bg); color: var(--red); }
.badge.neutral { background: var(--blue-bg); color: var(--blue); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.5s ease backwards;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-head h2 { margin: 0; font-size: 16.5px; font-weight: 800; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 22px;
}

/* ---------- Trend chart ---------- */

.chart-wrap { position: relative; width: 100%; min-height: 320px; }
.chart-wrap svg { display: block; width: 100%; }

.grid-line { stroke: var(--line-2); stroke-width: 1; }
.axis-label { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.series-installs-area { opacity: 0.85; }
.series-line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.6; }
.series-line.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.hover-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.hover-dot { stroke: var(--card); stroke-width: 2.5; }

.chart-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--tooltip-bg);
  color: #fff;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 12px;
  line-height: 1.9;
  white-space: nowrap;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity 0.12s ease;
}

.chart-tooltip .tt-date { font-weight: 800; margin-bottom: 2px; font-size: 12.5px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 7px; }
.chart-tooltip .tt-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.chart-tooltip .tt-val { font-weight: 700; margin-right: auto; padding-right: 12px; }

.legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-right: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 600;
}

.legend .lg-item { display: inline-flex; align-items: center; gap: 7px; }
.legend .lg-dot { width: 10px; height: 10px; border-radius: 4px; }

/* ---------- Store donut ---------- */

.store-chart {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 300px;
}

.donut-box { position: relative; width: 215px; height: 215px; flex: 0 0 auto; }
.donut-box svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-seg {
  fill: none;
  cursor: pointer;
  transition: stroke-width 0.18s ease, opacity 0.18s ease;
}
.donut-box.dim .donut-seg:not(.hl) { opacity: 0.35; }

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
  padding: 0 34px;
}

.donut-center .dc-value { font-size: 24px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.donut-center .dc-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.store-legend { display: flex; flex-direction: column; gap: 10px; min-width: 210px; flex: 1; }

.store-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: default;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.store-row:hover, .store-row.hl { background: var(--card-2); border-color: var(--line); }
.store-row .sr-dot { width: 11px; height: 11px; border-radius: 4px; flex: 0 0 auto; }
.store-row .sr-name { font-size: 13px; font-weight: 700; color: var(--text-2); }
.store-row .sr-count { margin-right: auto; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.store-row .sr-pct { font-size: 11.5px; color: var(--muted); width: 46px; text-align: left; font-weight: 700; }

/* ---------- Updates timeline ---------- */

.timeline { display: flex; flex-direction: column; }

.tl-item { display: grid; grid-template-columns: 34px 1fr; gap: 14px; }
.tl-item:last-child .tl-rail::after { display: none; }

.tl-rail { position: relative; display: flex; justify-content: center; }
.tl-rail::after {
  content: "";
  position: absolute;
  top: 30px;
  bottom: -14px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}

.tl-dot {
  width: 16px;
  height: 16px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--line);
  z-index: 1;
  flex: 0 0 auto;
}

.tl-item.current .tl-dot {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.15);
}

.tl-card {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tl-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.version-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  direction: ltr;
}

.tl-item:not(.current) .version-pill {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-2);
}

.tl-title { display: flex; flex-direction: column; margin-left: auto; }
.tl-title strong { font-size: 14.5px; }
.tl-date { font-size: 11.5px; color: var(--muted); }

.tl-notes {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 6px 22px;
}

.tl-notes li {
  position: relative;
  padding-right: 20px;
  font-size: 13px;
  color: var(--text-2);
}

.tl-notes li::before {
  content: "";
  position: absolute;
  right: 2px;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
}

.tl-stats {
  display: grid;
  grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
  gap: 12px 26px;
  align-items: end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.tl-stat { display: flex; flex-direction: column; }
.tl-stat span { font-size: 11.5px; color: var(--muted); }
.tl-stat strong { font-size: 16px; font-variant-numeric: tabular-nums; }

.adoption-top { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.adoption-top strong { color: var(--text); font-size: 12.5px; }

.bar {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 75%, transparent);
  overflow: hidden;
  margin-top: 5px;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Social ---------- */

.social-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.social-card {
  position: relative;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.social-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.social-card.selected {
  border-color: color-mix(in srgb, var(--brand) 60%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 45%, transparent), var(--shadow);
}

.social-card.selected::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.social-head { display: flex; align-items: center; gap: 11px; }

.social-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand);
  flex: 0 0 auto;
}

.social-avatar svg { width: 20px; height: 20px; }

.social-head strong { font-size: 14px; display: block; line-height: 1.5; }
.social-handle { font-size: 11.5px; color: var(--muted); direction: ltr; display: inline-block; }

.social-followers {
  margin-top: 13px;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.4px;
}

.social-followers small { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-right: 5px; }

.social-growth { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }

.social-mini { margin-top: 13px; height: 40px; }
.social-mini svg { display: block; width: 100%; height: 40px; }
.social-mini .mini-bar { fill: color-mix(in srgb, var(--brand) 30%, transparent); transition: fill 0.15s ease; }
.social-mini .mini-bar:hover { fill: var(--brand); }

/* ---------- Posts table ---------- */

.posts-block { border-top: 1px solid var(--line); padding-top: 18px; }

.posts-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.posts-head h3 { margin: 0; font-size: 14.5px; font-weight: 800; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }

.posts-table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 13px; }

.posts-table th {
  text-align: right;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  padding: 11px 14px;
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.posts-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
  white-space: nowrap;
}

.posts-table tbody tr:last-child td { border-bottom: 0; }
.posts-table tbody tr { transition: background 0.12s ease; }
.posts-table tbody tr:hover { background: var(--card-2); }

.posts-table .td-title { white-space: normal; min-width: 240px; font-weight: 600; }
.posts-table .td-date { color: var(--muted); font-size: 12px; }
.posts-table .num { font-variant-numeric: tabular-nums; font-weight: 700; }

.type-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: color-mix(in srgb, var(--brand) 13%, transparent);
  color: var(--brand);
}

.engagement { display: flex; align-items: center; gap: 8px; }
.engagement .bar { width: 64px; margin: 0; height: 6px; }
.engagement .bar i { background: var(--brand); }
.engagement b { font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- Footer ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
  font-size: 12px;
  color: var(--muted);
}

.footer code { background: var(--card); border: 1px solid var(--line); padding: 2px 8px; border-radius: 7px; direction: ltr; display: inline-block; }
.footer-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line); }

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(6px);
  text-align: center;
  padding: 20px;
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.overlay p { color: var(--muted); font-size: 13.5px; margin: 0; }

.error-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 34px;
  max-width: 460px;
  box-shadow: var(--shadow-lift);
}

.error-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  background: var(--red-bg);
  color: var(--red);
}

.error-card h2 { margin: 0 0 8px; font-size: 18px; }
.error-card p { color: var(--text-2); font-size: 13.5px; }
.error-hint { color: var(--muted) !important; font-size: 12.5px !important; }
.error-card code { direction: ltr; display: inline-block; }

.btn-primary {
  margin-top: 14px;
  border: 0;
  border-radius: 11px;
  padding: 10px 26px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -10px rgba(99, 102, 241, 0.7); }

/* ---------- Animations ---------- */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes draw { to { stroke-dashoffset: 0; } }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .social-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .page { padding: 18px 14px 32px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 22px; }
  .tl-stats { grid-template-columns: 1fr; }
  .tl-title { margin-left: 0; width: 100%; }
  .topbar { gap: 12px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 14px; }
  .social-grid { grid-template-columns: 1fr; }
  .brand-logo { width: 46px; height: 46px; border-radius: 14px; }
}

::-webkit-scrollbar { height: 9px; width: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 40%, transparent); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- Admin / Auth ---------- */

.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-soft:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: var(--shadow); }
.btn-soft.accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.btn-soft.accent:hover { box-shadow: 0 12px 26px -10px rgba(99, 102, 241, 0.7); }
.btn-soft.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.btn-soft.danger:hover { border-color: var(--red); box-shadow: none; }

.overlay-top { z-index: 60; }

.login-card { max-width: 380px; width: 100%; text-align: right; }
.login-card h2 { margin: 0 0 6px; font-size: 18px; }
.login-card > p { color: var(--text-2); font-size: 13.5px; margin: 0 0 14px; }

.text-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14px;
}

.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

.form-error { color: var(--red) !important; font-size: 12.5px !important; margin: 8px 2px 0 !important; }

.login-actions { display: flex; gap: 10px; margin-top: 16px; }
.login-actions .btn-primary { margin-top: 0; flex: 1; }

.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.admin-head h2 { margin: 0; font-size: 18px; }
.admin-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; }
.admin-h3 { margin: 0 0 14px; font-size: 15px; font-weight: 800; }
.admin-h3.mt { margin-top: 26px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; margin-bottom: 14px; }

.form-grid label, label.full {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
}

.form-grid input,
.form-grid select,
label.full textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  border-radius: 11px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
}

.form-grid input:focus,
.form-grid select:focus,
label.full textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

label.full { margin-bottom: 14px; }
label.full textarea { resize: vertical; line-height: 1.9; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; margin-bottom: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.admin-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 13px;
  font-size: 13px;
  flex-wrap: wrap;
}

.admin-row .ar-main { font-weight: 700; }
.admin-row .ar-sub { color: var(--muted); font-size: 11.5px; }
.admin-row .ar-spacer { margin-right: auto; }

.mini-delete {
  border: 1px solid color-mix(in srgb, var(--red) 30%, var(--line));
  background: transparent;
  color: var(--red);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.mini-delete:hover { background: var(--red-bg); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 70;
  background: var(--tooltip-bg);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5);
  animation: fadeUp 0.3s ease;
  max-width: 80vw;
}

.toast.err { background: var(--red); }

@media (max-width: 700px) {
  .admin-head { align-items: flex-start; flex-direction: column; }
  .toast { left: 14px; right: 14px; bottom: 14px; }
}

.avatar-letter { font-size: 17px; font-weight: 800; line-height: 1; }

.empty-cell { text-align: center !important; color: var(--muted); padding: 24px 10px !important; font-size: 13px; }

.muted-num { color: var(--muted); }
