/* =============================================================
   TuVPN Admin — Linear-style design system
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500;600&display=swap');

/* ===== TOKENS ===== */
:root {
  /* Surfaces — deep, cool, slightly desaturated */
  --bg-0: #08090d;
  --bg-1: #0d0f15;
  --bg-2: #12141c;
  --bg-3: #181b25;
  --bg-4: #1f2330;
  --bg-hover: #1a1d28;

  /* Borders — thin, varied */
  --border: #1e2230;
  --border-hi: #2a2f42;
  --border-focus: #3d4660;

  /* Text — high contrast hierarchy */
  --fg: #f0f2f7;
  --fg-2: #b4b9c8;
  --fg-3: #6e7488;
  --fg-4: #4a4f60;
  --fg-5: #2e3140;

  /* Accent — single confident blue */
  --accent: #5b8def;
  --accent-2: #8aa7f0;
  --accent-dim: #5b8def22;
  --accent-glow: 0 0 0 1px var(--accent), 0 0 20px -4px var(--accent);

  /* Semantic */
  --green: #4ade80;
  --green-dim: #4ade8019;
  --yellow: #facc15;
  --yellow-dim: #facc1519;
  --red: #f87171;
  --red-dim: #f8717119;
  --orange: #fb923c;
  --orange-dim: #fb923c19;
  --purple: #c084fc;
  --purple-dim: #c084fc19;
  --cyan: #67e8f9;
  --cyan-dim: #67e8f919;
  --pink: #f472b6;
  --pink-dim: #f472b619;

  /* Type */
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;

  /* Sizing */
  --side-w: 232px;
  --top-h: 52px;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadows */
  --sh-1: 0 1px 2px rgba(0,0,0,.3);
  --sh-2: 0 4px 12px rgba(0,0,0,.4);
  --sh-3: 0 12px 32px rgba(0,0,0,.5);
  --sh-glow: 0 0 0 1px var(--border-hi), 0 24px 60px -16px rgba(0,0,0,.7);

  /* Motion */
  --t-1: 80ms cubic-bezier(.4,0,.2,1);
  --t-2: 160ms cubic-bezier(.4,0,.2,1);
  --t-3: 280ms cubic-bezier(.32,.72,0,1);
  --t-spring: 400ms cubic-bezier(.34,1.56,.64,1);
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  background: var(--bg-0);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  letter-spacing: -0.005em;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* Subtle ambient gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 100% 0%, rgba(91,141,239,.04), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(192,132,252,.025), transparent 60%);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

/* Selection */
::selection { background: #5b8def55; color: #ffffff; }

/* ===== LAYOUT ===== */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 24px 28px 64px; }

/* ===== SIDEBAR ===== */
.brand {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(140deg, #5b8def, #c084fc);
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 .5px rgba(255,255,255,.18), 0 4px 12px -4px rgba(91,141,239,.6);
}
.brand-mark::after {
  content: 'T';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  letter-spacing: -.02em;
}
.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1;
}
.brand-sub {
  font-size: 10px;
  color: var(--fg-4);
  font-family: var(--font-mono);
  letter-spacing: .04em;
  margin-top: 3px;
}

.cmd-trigger {
  margin: 10px 10px 6px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12.5px;
  color: var(--fg-3);
  cursor: pointer;
  transition: border-color var(--t-2), background var(--t-2);
}
.cmd-trigger:hover { border-color: var(--border-hi); background: var(--bg-3); color: var(--fg-2); }
.cmd-trigger .ico { color: var(--fg-3); display: flex; }
.cmd-trigger .label { flex: 1; text-align: left; }
.cmd-trigger kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--fg-3);
}

.nav { padding: 6px 8px; flex: 1; overflow-y: auto; }
.nav-section {
  padding: 14px 10px 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--fg-4);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
}
.nav-section:first-child { padding-top: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: background var(--t-1), color var(--t-1);
  margin-bottom: 1px;
  position: relative;
}
.nav-item:hover { background: var(--bg-2); color: var(--fg); }
.nav-item.active { background: var(--bg-3); color: var(--fg); }
.nav-item .nav-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  flex-shrink: 0;
}
.nav-item.active .nav-ico { color: var(--accent); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.nav-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-4);
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}
.nav-item.active .nav-count { color: var(--accent); background: var(--accent-dim); }
.nav-kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-4);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity var(--t-2);
}
.nav-item:hover .nav-kbd { opacity: 1; }

.sidebar-footer {
  padding: 10px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
}
.avatar-me {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(140deg, #5b8def, #c084fc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.me-meta { flex: 1; min-width: 0; }
.me-name { font-size: 12.5px; font-weight: 600; line-height: 1.1; }
.me-sub { font-size: 10.5px; color: var(--fg-4); font-family: var(--font-mono); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.me-sub::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.icon-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--fg-3);
  transition: background var(--t-1), color var(--t-1);
}
.icon-btn:hover { background: var(--bg-3); color: var(--fg); }

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--top-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(13,15,21,.75);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-3);
}
.crumbs .sep { color: var(--fg-5); }
.crumbs .now { color: var(--fg); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  padding: 4px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.live-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(.85); }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--t-1), border-color var(--t-1), color var(--t-1), transform var(--t-1);
  border: 1px solid transparent;
}
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4c7be5; }
.btn-ghost { background: var(--bg-2); border-color: var(--border); color: var(--fg-2); }
.btn-ghost:hover { background: var(--bg-3); border-color: var(--border-hi); color: var(--fg); }
.btn-danger { background: var(--bg-2); border-color: var(--red-dim); color: var(--red); }
.btn-danger:hover { background: var(--red-dim); border-color: var(--red); }
.btn-success { background: var(--green-dim); border: 1px solid #4ade8033; color: var(--green); }
.btn-success:hover { background: #4ade8025; border-color: var(--green); }
.btn-icon { width: 30px; padding: 0; justify-content: center; }
.btn-sm { height: 24px; font-size: 11.5px; padding: 0 8px; }
.btn-sm.btn-icon { width: 24px; }
.btn-lg { height: 36px; font-size: 13px; padding: 0 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .kbd-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(0,0,0,.25);
  padding: 1px 4px;
  border-radius: 3px;
  opacity: .85;
  margin-left: 4px;
}

/* ===== FORM ===== */
.field { margin-bottom: 12px; }
.label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  margin-bottom: 5px;
  letter-spacing: .01em;
}
.input, .select, textarea.input {
  width: 100%;
  height: 34px;
  padding: 0 11px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--fg);
  font-size: 13px;
  outline: none;
  transition: border-color var(--t-1), background var(--t-1), box-shadow var(--t-1);
}
.input:hover, .select:hover { border-color: var(--border-hi); }
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--accent);
  background: var(--bg-2);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input::placeholder { color: var(--fg-4); }
.input.mono { font-family: var(--font-mono); font-size: 12.5px; }
textarea.input { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236e7488' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.help {
  font-size: 11.5px;
  color: var(--fg-4);
  margin-top: 5px;
  line-height: 1.45;
}

/* search input */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 11px;
  height: 30px;
  flex: 0 0 280px;
  transition: border-color var(--t-1);
}
.search:focus-within { border-color: var(--border-hi); }
.search input {
  background: none;
  border: none;
  outline: none;
  font-size: 12.5px;
  flex: 1;
  color: var(--fg);
  height: 100%;
}
.search input::placeholder { color: var(--fg-4); }
.search .ico { color: var(--fg-4); display: flex; }

/* filters */
.filter {
  height: 30px;
  padding: 0 28px 0 11px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--fg-2);
  font-size: 12.5px;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236e7488' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--t-1), color var(--t-1);
}
.filter:hover { border-color: var(--border-hi); color: var(--fg); }

/* toggle */
.toggle { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--bg-4); border: 1px solid var(--border-hi);
  border-radius: 999px;
  transition: background var(--t-2);
}
.toggle-slider::before {
  content: '';
  position: absolute; left: 2px; top: 2px;
  width: 12px; height: 12px;
  background: var(--fg-3);
  border-radius: 50%;
  transition: transform var(--t-2), background var(--t-2);
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(14px); background: #fff; }

/* ===== TOOLBAR / PAGE ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar-grow { flex: 1; }
.counter { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-3); }
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.015em;
  margin-bottom: 4px;
}
.page-sub {
  font-size: 12.5px;
  color: var(--fg-3);
  margin-bottom: 20px;
}

.page { display: none; animation: pageIn .28s var(--t-3); }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== CARDS ===== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-2);
}
.card-pad { padding: 16px 18px; }
.card-head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-sub { font-size: 11.5px; color: var(--fg-3); font-family: var(--font-mono); }

/* ===== KPI GRID with sparklines ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t-2), transform var(--t-2);
}
.kpi:hover { border-color: var(--border-hi); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpi-label {
  font-size: 11.5px;
  color: var(--fg-3);
  font-weight: 500;
  letter-spacing: .005em;
}
.kpi-ico {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--fg-3);
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1;
  font-feature-settings: 'tnum';
  margin-bottom: 2px;
}
.kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}
.kpi-delta {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.kpi-delta.up { color: var(--green); }
.kpi-delta.dn { color: var(--red); }
.kpi-delta.flat { color: var(--fg-4); }
.kpi-spark { height: 22px; width: 60px; flex-shrink: 0; }

/* ===== TABLES ===== */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  letter-spacing: .02em;
  padding: 10px 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.tbl td {
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background var(--t-1); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tbody tr.clickable:hover td { background: var(--bg-hover); }

/* User cell */
.u-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.u-ava {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.u-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.u-handle { font-size: 11px; color: var(--fg-4); font-family: var(--font-mono); margin-top: 1px; }

.mono { font-family: var(--font-mono); font-size: 12px; color: var(--fg-2); }
.muted { color: var(--fg-4); }
.num { font-feature-settings: 'tnum'; font-variant-numeric: tabular-nums; }

/* ===== BADGES & STATUS ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag.dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.tag-green { background: var(--green-dim); color: var(--green); border-color: #4ade8025; }
.tag-red { background: var(--red-dim); color: var(--red); border-color: #f8717125; }
.tag-yellow { background: var(--yellow-dim); color: var(--yellow); border-color: #facc1525; }
.tag-blue { background: var(--accent-dim); color: var(--accent); border-color: #5b8def25; }
.tag-purple { background: var(--purple-dim); color: var(--purple); border-color: #c084fc25; }
.tag-orange { background: var(--orange-dim); color: var(--orange); border-color: #fb923c25; }
.tag-cyan { background: var(--cyan-dim); color: var(--cyan); border-color: #67e8f925; }
.tag-pink { background: var(--pink-dim); color: var(--pink); border-color: #f472b625; }
.tag-gray { background: var(--bg-3); color: var(--fg-3); border-color: var(--border); }

/* Status dot inline */
.sdot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}
.sdot.up { background: var(--green); box-shadow: 0 0 6px var(--green); }
.sdot.dn { background: var(--red); }
.sdot.idle { background: var(--fg-4); }
.sdot.wait { background: var(--yellow); }

/* row hover actions */
.row-acts {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity var(--t-2);
}
.tbl tr:hover .row-acts { opacity: 1; }
.tbl tr.clickable .row-acts { pointer-events: auto; }

/* ===== EMPTY ===== */
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--fg-3);
}
.empty .emoji {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
  opacity: .5;
}
.empty .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-2);
  margin-bottom: 4px;
}
.empty .sub { font-size: 12px; }

/* skeleton */
.skel {
  display: inline-block;
  height: 14px;
  background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2));
  background-size: 200% 100%;
  animation: skel 1.4s linear infinite;
  border-radius: 4px;
}
@keyframes skel { 0% { background-position: 0 0; } 100% { background-position: -200% 0; } }

/* ===== GRID HELPERS ===== */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-1-1, .grid-3 { grid-template-columns: 1fr; }
}

/* ===== LIST ROWS (recent payments etc) ===== */
.lst { display: flex; flex-direction: column; }
.lst-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-1);
}
.lst-row:hover { background: var(--bg-2); }
.lst-ico {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  font-size: 12px;
  flex-shrink: 0;
}
.lst-ico.green { background: var(--green-dim); color: var(--green); }
.lst-ico.red { background: var(--red-dim); color: var(--red); }
.lst-ico.yellow { background: var(--yellow-dim); color: var(--yellow); }
.lst-ico.blue { background: var(--accent-dim); color: var(--accent); }
.lst-ico.purple { background: var(--purple-dim); color: var(--purple); }
.lst-main { flex: 1; min-width: 0; }
.lst-title { font-size: 13px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lst-sub { font-size: 11px; color: var(--fg-4); font-family: var(--font-mono); margin-top: 2px; }
.lst-end { text-align: right; flex-shrink: 0; font-weight: 600; font-size: 13px; font-feature-settings: 'tnum'; }

/* ===== MODAL ===== */
.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5,7,12,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 20px 20px;
  overflow-y: auto;
  animation: bgIn .15s linear;
}
.modal-bg.open { display: flex; }
@keyframes bgIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--sh-glow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 84px);
  animation: modalIn .28s var(--t-spring);
}
.modal.lg { max-width: 680px; }
.modal.xl { max-width: 820px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.modal-foot-spread { justify-content: space-between; }

/* Collapsible section in modal */
.fold {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 12px;
  overflow: hidden;
}
.fold-head {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-2);
  user-select: none;
  background: var(--bg-2);
  transition: background var(--t-1);
}
.fold-head:hover { background: var(--bg-3); }
.fold-head .chev {
  margin-left: auto;
  transition: transform var(--t-2);
  color: var(--fg-3);
}
.fold.open .fold-head .chev { transform: rotate(90deg); }
.fold-body {
  display: none;
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.fold.open .fold-body { display: block; }

/* ===== SLIDE SHEET ===== */
.sheet-bg {
  position: fixed;
  inset: 0;
  background: rgba(5,7,12,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  display: none;
}
.sheet-bg.open { display: block; }
.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--bg-1);
  border-left: 1px solid var(--border-hi);
  z-index: 91;
  transform: translateX(100%);
  transition: transform .32s var(--t-3);
  display: flex;
  flex-direction: column;
}
.sheet.open { transform: translateX(0); }
.sheet-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sheet-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.sh-sec { margin-bottom: 22px; }
.sh-sec-title {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--fg-4);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 10px;
}
.info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  gap: 12px;
}
.info:last-child { border-bottom: none; }
.info-k { color: var(--fg-3); font-size: 11.5px; }
.info-v { color: var(--fg); font-weight: 500; text-align: right; word-break: break-all; min-width: 0; }

/* ===== COMMAND PALETTE ===== */
.cmd-bg {
  position: fixed;
  inset: 0;
  background: rgba(5,7,12,.75);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: bgIn .12s linear;
}
.cmd-bg.open { display: flex; }
.cmd {
  width: 100%;
  max-width: 580px;
  background: var(--bg-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3), 0 0 0 1px rgba(91,141,239,.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  animation: modalIn .22s var(--t-spring);
}
.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.cmd-input-wrap .ico { color: var(--fg-3); }
.cmd-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--fg);
  font-family: var(--font-sans);
}
.cmd-input::placeholder { color: var(--fg-4); }
.cmd-esc {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}
.cmd-list { overflow-y: auto; flex: 1; padding: 6px; }
.cmd-section {
  padding: 8px 10px 4px;
  font-size: 10px;
  color: var(--fg-4);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--fg-2);
}
.cmd-item.active { background: var(--bg-3); color: var(--fg); }
.cmd-item .ico { width: 22px; display: flex; align-items: center; justify-content: center; color: var(--fg-3); }
.cmd-item.active .ico { color: var(--accent); }
.cmd-item .label { flex: 1; }
.cmd-item .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--fg-4);
}
.cmd-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--fg-4);
  font-size: 13px;
}
.cmd-foot {
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10.5px;
  color: var(--fg-4);
  font-family: var(--font-mono);
}
.cmd-foot .k { display: inline-flex; align-items: center; gap: 5px; }
.cmd-foot kbd {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
}

/* ===== TOAST ===== */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  box-shadow: var(--sh-2);
  min-width: 280px;
  max-width: 380px;
  animation: toastIn .25s var(--t-spring);
}
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { border-color: #4ade8055; }
.toast.error { border-color: #f8717155; }
.toast.warning { border-color: #facc1555; }
.toast .ico { flex-shrink: 0; }
.toast.success .ico { color: var(--green); }
.toast.error .ico { color: var(--red); }
.toast.warning .ico { color: var(--yellow); }
.toast .text { flex: 1; }
.toast .undo {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
}
.toast .undo:hover { background: var(--accent-dim); }

/* ===== LOGIN ===== */
.login-bg {
  position: fixed; inset: 0; z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, var(--bg-1), var(--bg-0) 70%);
}
.login-bg.show { display: flex; }
.login-box {
  background: var(--bg-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-xl);
  padding: 32px;
  width: 360px;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--sh-3);
}
.login-box .brand-mark { margin: 0 auto 16px; width: 44px; height: 44px; border-radius: 12px; }
.login-box .brand-mark::after { font-size: 22px; }
.login-box h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.015em;
  margin-bottom: 6px;
}
.login-box p {
  color: var(--fg-3);
  font-size: 12.5px;
  margin-bottom: 22px;
}
.login-box .input {
  text-align: center;
  font-family: var(--font-mono);
  letter-spacing: 4px;
  height: 40px;
  font-size: 15px;
}
.login-box .btn { width: 100%; justify-content: center; height: 36px; margin-top: 12px; }

/* ===== SPECIFIC: SERVERS PAGE ===== */
.srv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  gap: 14px;
  width: 100%;
}
.srv {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: border-color var(--t-2), transform var(--t-2);
}
.srv:hover { border-color: var(--border-hi); }
.srv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.srv-flag {
  font-size: 24px;
  line-height: 1;
}
.srv-name {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.005em;
  margin-bottom: 2px;
}
.srv-code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-4);
}
.srv-info {
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 5px;
  column-gap: 10px;
  font-size: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.srv-info .k { color: var(--fg-4); font-family: var(--font-mono); font-size: 11px; }
.srv-info .v { color: var(--fg-2); font-family: var(--font-mono); font-size: 11.5px; text-align: right; }
.srv-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.srv-acts { display: flex; gap: 4px; margin-left: auto; }
.srv.is-down { border-color: #f8717135; }
.srv.is-down::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--r-lg);
  background: radial-gradient(circle at top left, #f8717108, transparent 60%);
  pointer-events: none;
}

/* ===== PAGINATION ===== */
.tbl-pagination { border-top: 1px solid var(--border); }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
}
.pagination-info {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-3);
  min-width: 110px;
  text-align: center;
}

/* ===== AUX ===== */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.row-center { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kbd-key {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--fg-3);
}

/* HR-separator between table rows that are different groups */
.tbl tr.section-row td {
  background: var(--bg-1);
  padding: 4px 16px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--fg-4);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
  border-top: 1px solid var(--border);
}

/* Progress bar mini */
.progress {
  height: 3px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
  width: 80px;
}
.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 999px;
}

/* segmented chart tabs */
.seg {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 2px;
}
.seg button {
  height: 24px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-3);
  border-radius: 5px;
  transition: background var(--t-1), color var(--t-1);
}
.seg button.on { background: var(--bg-3); color: var(--fg); box-shadow: inset 0 0 0 1px var(--border-hi); }

/* Pill button - small inline action */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--fg-2);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: background var(--t-1), border-color var(--t-1);
}
.pill:hover { background: var(--bg-3); border-color: var(--border-hi); }

.text-r { text-align: right; }
.text-c { text-align: center; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }

/* ===== MARKETING PAGE ===== */
.organic-row {
  font-weight: 500;
}

.campaign-row {
  cursor: pointer;
  transition: background var(--t-1);
}
.campaign-row:hover {
  background: var(--bg-hover);
}

.status-dot.organic {
  background: var(--green);
  box-shadow: 0 0 6px var(--green-dim);
}

.roi-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}
.roi-badge.success {
  background: var(--green-dim);
  color: var(--green);
}
.roi-badge.warning {
  background: var(--yellow-dim);
  color: var(--yellow);
}
.roi-badge.danger {
  background: var(--red-dim);
  color: var(--red);
}
.roi-badge.muted {
  background: var(--bg-3);
  color: var(--fg-4);
}

.pill-vk { background: #0077ff20; color: #5b9bd5; }
.pill-instagram { background: #e4405f20; color: #f472b6; }
.pill-telegram { background: #0088cc20; color: #67e8f9; }
.pill-youtube { background: #ff000020; color: #f87171; }
.pill-direct { background: var(--bg-3); color: var(--fg-2); }
.pill-other { background: var(--bg-3); color: var(--fg-3); }

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.source-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.source-icon {
  font-size: 24px;
  margin-bottom: 6px;
}
.source-label {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fg);
}
.source-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.source-stat {
  font-size: 12px;
  color: var(--fg-3);
}
.roi-positive {
  color: var(--green);
  font-weight: 600;
}
.roi-negative {
  color: var(--red);
  font-weight: 600;
}

.text-muted {
  color: var(--fg-3);
}

/* ==================== BELL / ALERTS ==================== */
.bell-wrap {
  position: relative;
}
.bell-btn {
  position: relative;
  padding: 5px 8px;
}
.bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red, #e55);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.alerts-drop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  z-index: 200;
  overflow: hidden;
}
.alerts-head {
  padding: 10px 14px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-3);
  border-bottom: 1px solid var(--border);
}
.alerts-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--fg-3);
  text-align: center;
}
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid var(--border);
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--bg-3); }
.alert-ico { font-size: 16px; flex-shrink: 0; }
.alert-title { flex: 1; font-size: 13px; color: var(--fg); }
.alert-arr { color: var(--fg-3); flex-shrink: 0; }

/* ==================== TODAY ROW ==================== */
.today-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.today-row-loading {
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
}
.today-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fg-3);
  min-width: 54px;
}
.today-kpi {
  display: flex;
  gap: 0;
  flex: 1;
  flex-wrap: wrap;
}
.today-cell {
  flex: 1;
  min-width: 90px;
  padding: 4px 12px;
  border-left: 1px solid var(--border);
}
.today-cell:first-child { border-left: none; }
.today-val {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  line-height: 1.2;
}
.today-sub {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.today-cell-warn .today-val { color: var(--yellow, #f59e0b); }
.today-cell-err .today-val { color: var(--red, #e55); }
.kpi-delta-sm {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
}
.kpi-delta-sm.up { color: var(--green); background: rgba(34,197,94,.12); }
.kpi-delta-sm.dn { color: var(--red); background: rgba(239,68,68,.12); }
.kpi-delta-sm.flat { color: var(--fg-3); }

/* ==================== NAV ALERT BADGE ==================== */
.nav-count-alert { transition: color .2s, background .2s; }
.nav-count-alert-active {
  background: rgba(239,68,68,.18) !important;
  color: var(--red, #e55) !important;
  font-weight: 700;
}

/* ==================== MOBILE SIDEBAR ==================== */
.mobile-burger {
  display: none;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  transition: background var(--t-1);
  flex-shrink: 0;
}
.mobile-burger:hover { background: var(--bg-3); }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  .mobile-burger { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 80;
    transform: translateX(-100%);
    transition: transform .32s var(--t-3);
    box-shadow: var(--sh-3);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 79;
    background: rgba(5,7,12,.6);
    backdrop-filter: blur(4px);
  }
  .content { padding: 16px 16px 48px; }
  .topbar { padding: 0 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-1-1, .grid-3 { grid-template-columns: 1fr; }
  .label-desktop { display: none; }
}

/* ==================== PAGE HEAD ==================== */
.page-head {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.lb-page-head {
  margin-bottom: 20px;
}
.lb-page-head h2 {
  font-size: 20px; font-weight: 700;
  letter-spacing: -.015em; margin-bottom: 4px;
}
.lb-page-sub {
  font-size: 12.5px; color: var(--fg-3);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  padding: 48px 24px; text-align: center;
  color: var(--fg-3); font-size: 13px;
}

/* ==================== DATA TABLE (generic fallback) ==================== */
.data-table {
  width: 100%; border-collapse: collapse;
}
.data-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--fg-3); letter-spacing: .02em;
  padding: 10px 14px; background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 9px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

/* ==================== TABLE EXTRAS ==================== */
.table-container { overflow-x: auto; }
.table-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ==================== KPI CARD (marketing) ==================== */
.kpi-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}
.kpi-card .kpi-val {
  font-size: 26px; font-weight: 700;
  letter-spacing: -.025em; line-height: 1;
  font-feature-settings: 'tnum'; margin-bottom: 4px;
}
.kpi-card .kpi-label {
  font-size: 11.5px; color: var(--fg-3); font-weight: 500;
}
.kpi-card .kpi-note {
  font-size: 11px; color: var(--fg-4); margin-top: 2px;
}
.kpi-card.success .kpi-val { color: var(--green); }
.kpi-card.danger .kpi-val { color: var(--red); }

/* ==================== TEXTAREA ==================== */
.textarea {
  width: 100%; min-height: 90px; padding: 9px 11px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--fg); font-size: 13px;
  outline: none; resize: vertical; font-family: var(--font-sans);
  transition: border-color var(--t-1), box-shadow var(--t-1);
  line-height: 1.5;
}
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.textarea::placeholder { color: var(--fg-4); }

/* ==================== MONITOR PAGE ==================== */
.mon-ctl {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--fg-3);
}
.mon-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.mon-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color var(--t-2);
}
.mon-card:hover { border-color: var(--border-hi); }
.mon-card-down { border-color: #f8717135 !important; }
.mon-card-head {
  display: flex; align-items: center; gap: 8px;
}
.mon-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.mon-dot-up { background: var(--green); box-shadow: 0 0 6px var(--green); animation: livePulse 2s infinite; }
.mon-dot-down { background: var(--red); }
.mon-card-name { font-size: 14px; font-weight: 700; flex: 1; }
.mon-card-status { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); }
.mon-card-ip { font-size: 11px; color: var(--fg-4); font-family: var(--font-mono); }
.mon-card-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.mon-metric {
  display: flex; flex-direction: column; gap: 2px;
}
.mon-metric span { font-size: 10.5px; color: var(--fg-4); }
.mon-metric b { font-size: 13px; color: var(--fg); font-weight: 600; }
.mon-sni { font-size: 10.5px !important; font-family: var(--font-mono); }
.mon-card-foot { font-size: 11px; color: var(--fg-4); }
.mon-charts {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-top: 8px;
}
.mon-chart-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
}
.mon-chart-title {
  font-size: 12px; font-weight: 600;
  color: var(--fg-2); margin-bottom: 10px;
}
.mon-chart-wrap { height: 160px; position: relative; }
@media (max-width: 900px) {
  .mon-charts { grid-template-columns: 1fr; }
  .mon-cards { grid-template-columns: 1fr; }
}

/* ==================== BROADCAST HISTORY ==================== */
.bc-hist-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.bc-hist-table { width: 100%; border-collapse: collapse; }
.bc-hist-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--fg-3); letter-spacing: .02em;
  padding: 10px 14px; background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bc-hist-table td {
  padding: 10px 14px; font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.bc-hist-table tbody tr:last-child td { border-bottom: none; }
.bc-hist-table tbody tr:hover { background: var(--bg-hover); }
.bc-hist-date { white-space: nowrap; }
.bc-hist-time { font-size: 11px; color: var(--fg-4); font-family: var(--font-mono); margin-top: 2px; }
.bc-hist-msg {
  max-width: 320px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  color: var(--fg-2);
}
.bc-hist-delivered { min-width: 100px; }
.bc-hist-bonus { text-align: center; }
.bc-deliv-num { font-size: 12px; font-family: var(--font-mono); color: var(--fg-2); margin-bottom: 4px; }
.bc-deliv-bar { height: 4px; background: var(--bg-4); border-radius: 2px; overflow: hidden; }
.bc-deliv-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple)); border-radius: 2px; transition: width .3s; }
.bc-aud-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-mono); white-space: nowrap;
  border: 1px solid transparent;
}
.bc-aud-all { background: var(--accent-dim); color: var(--accent); border-color: #5b8def25; }
.bc-aud-active { background: var(--green-dim); color: var(--green); border-color: #4ade8025; }
.bc-aud-inactive { background: var(--orange-dim); color: var(--orange); border-color: #fb923c25; }
.bc-aud-single { background: var(--purple-dim); color: var(--purple); border-color: #c084fc25; }
.bc-st {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.bc-st-ok { background: var(--green-dim); color: var(--green); }
.bc-st-partial { background: var(--yellow-dim); color: var(--yellow); }
.bc-st-fail { background: var(--red-dim); color: var(--red); }
.bc-bonus-badge {
  display: inline-flex; padding: 2px 6px;
  background: var(--purple-dim); color: var(--purple);
  border-radius: 4px; font-size: 11px; font-weight: 700;
  font-family: var(--font-mono);
}

/* ==================== BROADCAST MODAL ==================== */
.aud-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 12px;
}
@media (max-width: 640px) {
  .aud-grid { grid-template-columns: 1fr 1fr; }
}
.aud-card {
  cursor: pointer; position: relative;
}
.aud-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.aud-card-body {
  padding: 10px 12px; border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--bg-2);
  transition: border-color var(--t-1), background var(--t-1);
  text-align: center;
}
.aud-card:hover .aud-card-body { border-color: var(--border-hi); background: var(--bg-3); }
.aud-card input:checked + .aud-card-body {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent);
}
.aud-card-ico { font-size: 20px; line-height: 1; margin-bottom: 4px; }
.aud-card-title { font-size: 12px; font-weight: 600; color: var(--fg); margin-bottom: 2px; }
.aud-card-sub { font-size: 10.5px; color: var(--fg-3); line-height: 1.3; }
.aud-extra {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px; margin-bottom: 12px;
}

/* Broadcast preview */
.bc-preview-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px; margin-bottom: 14px;
}
.bc-preview-label { font-size: 10.5px; font-weight: 600; color: var(--fg-4); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.bc-preview-text { font-size: 13px; color: var(--fg); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.bc-preview-meta { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: 12px; }
.bc-meta-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.bc-meta-row:last-child { border-bottom: none; }
.bc-meta-row span { color: var(--fg-3); font-size: 12px; }
.bc-warn {
  padding: 10px 14px; background: rgba(250,204,21,.07);
  border: 1px solid rgba(250,204,21,.2); border-radius: var(--r-md);
  font-size: 12.5px; color: var(--yellow); line-height: 1.4;
}

/* User search in broadcast */
.bc-user-list {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; margin-top: 6px;
  max-height: 180px; overflow-y: auto;
}
.bc-user-item {
  padding: 8px 12px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background var(--t-1);
}
.bc-user-item:last-child { border-bottom: none; }
.bc-user-item:hover { background: var(--bg-3); }
.bc-user-empty { padding: 12px; font-size: 12px; color: var(--fg-4); text-align: center; }
.bc-selected {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px;
  min-height: 28px;
}
.bc-sel-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; background: var(--accent-dim);
  color: var(--accent); border-radius: 999px;
  font-size: 11px; font-family: var(--font-mono);
}
.bc-sel-tag button { background: none; border: none; color: inherit; cursor: pointer; font-size: 12px; line-height: 1; padding: 0 0 0 2px; opacity: .7; }
.bc-sel-tag button:hover { opacity: 1; }

/* ==================== ANALYTICS ==================== */
.funnel-bars { display: flex; flex-direction: column; gap: 10px; }
.funnel-step { display: flex; flex-direction: column; gap: 4px; }
.funnel-step-info {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
}
.funnel-step-label { font-size: 13px; font-weight: 500; color: var(--fg); }
.funnel-step-vals { font-size: 12px; font-family: var(--font-mono); color: var(--fg-3); white-space: nowrap; }
.funnel-step-vals b { color: var(--fg); }
.funnel-bar-track {
  height: 8px; background: var(--bg-3);
  border-radius: 4px; overflow: hidden;
}
.funnel-bar-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }
.funnel-drop { font-size: 11px; color: var(--fg-4); font-family: var(--font-mono); }

/* Calendar */
.renewal-cal { display: flex; flex-direction: column; gap: 8px; }
.cal-day {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.cal-day.soon { border-color: rgba(250,204,21,.3); }
.cal-day.urgent { border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.04); }
.cal-day-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}
.cal-day-date { font-size: 12px; font-weight: 600; color: var(--fg-2); }
.cal-day-count {
  font-size: 11px; font-family: var(--font-mono);
  background: var(--bg-3); color: var(--fg-3);
  padding: 1px 7px; border-radius: 10px;
}
.cal-day.urgent .cal-day-count { background: var(--red-dim); color: var(--red); }
.cal-day.soon .cal-day-count { background: var(--yellow-dim); color: var(--yellow); }
.cal-day-users {
  padding: 6px 12px; display: flex;
  flex-direction: column; gap: 4px;
}
.cal-user {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0; cursor: pointer; font-size: 12.5px;
  transition: color var(--t-1);
}
.cal-user:hover .cal-user-name { color: var(--accent); }
.cal-user:not(:last-child) { border-bottom: 1px solid var(--border); }
.cal-user-name { color: var(--fg-2); }
.cal-user-dev { font-size: 11px; color: var(--fg-4); }

/* ==================== TICKETS CHAT ==================== */
.ticket-modal { height: 80vh; }
.ticket-head {
  border-bottom: 1px solid var(--border);
}
.ticket-head-main { flex: 1; min-width: 0; }
.ticket-head-title {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
.ticket-num { font-size: 16px; font-weight: 700; font-family: var(--font-mono); }
.ticket-head-status { }
.ticket-head-user { font-size: 13px; color: var(--fg-2); margin-bottom: 2px; }
.ticket-head-meta { font-size: 11.5px; color: var(--fg-3); display: flex; flex-wrap: wrap; gap: 6px; }
.ticket-body {
  display: flex; flex-direction: column;
  overflow: hidden; padding: 0 !important;
}
.ticket-msgs {
  flex: 1; overflow-y: auto;
  padding: 14px 20px; display: flex; flex-direction: column; gap: 10px;
}
.ticket-foot {
  border-top: 1px solid var(--border);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 8px;
}
.ticket-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ticket-input-wrap { display: flex; align-items: flex-end; gap: 8px; }
.ticket-input {
  flex: 1; min-height: 60px; max-height: 120px;
  padding: 9px 11px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--fg); font-size: 13px; resize: none; outline: none;
  font-family: var(--font-sans); line-height: 1.5;
  transition: border-color var(--t-1);
}
.ticket-input:focus { border-color: var(--accent); }

/* Message bubbles */
.msg { display: flex; margin-bottom: 6px; }
.msg-admin { justify-content: flex-end; }
.msg-user { justify-content: flex-start; }
.msg-bubble {
  max-width: 72%; padding: 9px 13px;
  border-radius: 12px; font-size: 13px; line-height: 1.5;
}
.msg-user .msg-bubble {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px 12px 12px 3px;
}
.msg-admin .msg-bubble {
  background: var(--accent-dim); border: 1px solid #5b8def30;
  border-radius: 12px 12px 3px 12px;
}
.msg-name { font-size: 10.5px; font-weight: 600; color: var(--fg-4); margin-bottom: 3px; }
.msg-admin .msg-name { color: var(--accent); }
.msg-text { color: var(--fg); word-break: break-word; }
.msg-time { font-size: 10px; color: var(--fg-4); margin-top: 4px; font-family: var(--font-mono); }
.msg-admin .msg-time { text-align: right; }

/* ==================== RECEIPT MODAL ==================== */
.receipt-info {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px; margin-bottom: 14px;
  font-size: 13px;
}
.receipt-preview {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px;
  font-size: 13px; color: var(--fg-2);
  white-space: pre-wrap; min-height: 40px;
}

/* ==================== FINANCE MODAL ==================== */
.fund-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.fund-total { font-size: 12px; color: var(--fg-3); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }

/* ==================== MAP MODAL ==================== */
.map-point-sub { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.map-point-body { max-height: 320px; overflow-y: auto; }

/* ==================== RECEIPTS (misc) ==================== */
.log-error { color: var(--red); font-size: 11px; font-family: var(--font-mono); }
.help-text { font-size: 11.5px; color: var(--fg-4); margin-top: 4px; line-height: 1.45; }

/* ==================== ANALYTICS STATE FIX ==================== */
.analyticsState { display: none; } /* placeholder — actual state is JS object */

/* ==================== MONITOR GRID (updated) ==================== */
.mon-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px; margin-bottom: 4px;
}
@media (max-width: 900px) { .mon-cards-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .mon-cards-grid { grid-template-columns: 1fr; } }
.mon-chart-wrap { height: 200px; position: relative; }
.mon-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 0; }
@media (max-width: 900px) { .mon-charts { grid-template-columns: 1fr; } }

/* ==================== FINANCE BARS (redesign) ==================== */
.fin-bars { padding: 10px 18px 14px; display: flex; flex-direction: column; gap: 14px; }
.fin-bar-row { display: flex; align-items: center; gap: 10px; }
.fin-bar-label-wrap {
  display: flex; align-items: center; gap: 5px;
  min-width: 150px; flex-shrink: 0;
}
.fin-bar-ico { font-size: 14px; line-height: 1; }
.fin-bar-name { font-size: 13px; color: var(--fg-2); flex: 1; }
.fin-bar-pct { font-size: 11px; color: var(--fg-4); font-family: var(--font-mono); min-width: 32px; text-align: right; }
.fin-bar-track {
  flex: 1; height: 7px; background: var(--bg-3);
  border-radius: 4px; overflow: hidden;
}
.fin-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.fin-bar-amount { min-width: 80px; text-align: right; font-size: 13px; color: var(--fg); }
.fin-bar-amount b { font-weight: 600; }

/* ==================== BROADCAST HISTORY — AUDIENCE BADGES ==================== */
.bc-aud-expire { background: #f9a82520; color: #f9a825; border-color: #f9a82540; }
.bc-aud-utm    { background: #6366f120; color: #818cf8; border-color: #6366f140; }

/* ==================== SETTINGS PAGE ==================== */
.settings-tariff td { vertical-align: middle; }

/* ==================== SERVER EXTERNAL LINKS ==================== */
.srv-ext-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 10px;
  padding: 16px;
  width: 100%;
}
.srv-ext-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--fg-2);
  text-decoration: none; font-size: 13px;
  transition: all var(--t-1);
}
.srv-ext-link:hover { background: var(--bg-3); border-color: var(--accent); color: var(--accent); }
.srv-ext-link svg { flex-shrink: 0; opacity: 0.6; }
