@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── СВЕТЛАЯ ТЕМА (по умолчанию) ────────────────────── */
:root {
  --bg:       #f1f5f9;
  --panel:    #ffffff;
  --surface:  #f8fafc;
  --surface2: #f1f5f9;
  --border:   rgba(15,23,42,0.1);
  --border2:  rgba(15,23,42,0.18);
  --accent:   #0891b2;
  --accent2:  #7c3aed;
  --accent3:  #6d28d9;
  --text:     #0f172a;
  --muted:    #64748b;
  --muted2:   #475569;
  --danger:   #e11d48;
  --success:  #059669;
  --warn:     #d97706;
  --sidebar-w: 220px;
  --sidebar-collapsed-w: 60px;
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
  --btn-text:   #ffffff;
  --btn-shadow: rgba(8,145,178,0.30);
}

/* ── ТЁМНАЯ ТЕМА ─────────────────────────────────────── */
:root[data-theme="dark"], body.dark {
  --bg:       #080d16;
  --panel:    #0d1424;
  --surface:  #111c2e;
  --surface2: #162035;
  --border:   rgba(99,130,185,0.12);
  --border2:  rgba(99,130,185,0.22);
  --accent:   #22d3ee;
  --accent2:  #7c3aed;
  --accent3:  #a78bfa;
  --text:     #e2e8f0;
  --muted:    #64748b;
  --muted2:   #94a3b8;
  --danger:   #f43f5e;
  --success:  #10b981;
  --warn:     #f59e0b;
  --btn-text:   #05090f;
  --btn-shadow: rgba(34,211,238,0.25);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}
:root[data-theme="dark"], :root[data-theme="dark"] body, body.dark {
  background-image:
    radial-gradient(ellipse 60% 40% at 10% 0%, rgba(34,211,238,0.055) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 90% 10%, rgba(124,58,237,0.06) 0%, transparent 55%);
}

a { color: var(--accent); text-decoration: none; }

/* ── LAYOUT ─────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--transition);
}
.layout.collapsed { grid-template-columns: var(--sidebar-collapsed-w) 1fr; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 100;
  transition: padding var(--transition);
}
.layout.collapsed .sidebar { padding: 14px 8px 12px; }

.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 6px 14px;
  font-weight: 800; font-size: 15px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  flex-shrink: 0;
  overflow: hidden;
}
.brand-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--btn-text);
}
.brand-text {
  white-space: nowrap; overflow: hidden;
  transition: opacity var(--transition), max-width var(--transition);
  max-width: 140px;
}
.layout.collapsed .brand-text { opacity: 0; max-width: 0; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-spacer { flex: 1; }
.sidebar-bottom {
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
  flex-shrink: 0;
}

/* Все интерактивные элементы сайдбара — одинаковый стиль */
.nav a,
.nav-link-logout,
.sidebar-toggle {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 10px;
  border-radius: 10px;
  color: var(--muted2);
  font-size: 13.5px; font-weight: 500;
  font-family: 'Manrope', sans-serif;
  transition: all var(--transition);
  white-space: nowrap; overflow: hidden;
  position: relative;
  width: 100%;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.nav a svg,
.nav-link-logout svg,
.sidebar-toggle svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-label { transition: opacity var(--transition), max-width var(--transition); max-width: 140px; overflow: hidden; }
.layout.collapsed .nav-label { opacity: 0; max-width: 0; }

.nav a:hover, .nav-link-logout:hover, .sidebar-toggle:hover { background: var(--surface); color: var(--text); }
.nav a.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.nav a.active svg { stroke: var(--accent); }

/* Иконка стрелки разворачивается при сворачивании */
.icon-collapse { transition: transform var(--transition); }
.layout.collapsed .icon-collapse { transform: rotate(180deg); }

.nav-tooltip {
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) + 8px);
  top: 50%; transform: translateY(-50%);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 12px; font-weight: 500;
  padding: 5px 10px;
  border-radius: 7px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
}
.layout.collapsed .nav a:hover .nav-tooltip,
.layout.collapsed .nav-link-logout:hover .nav-tooltip,
.layout.collapsed .sidebar-toggle:hover .nav-tooltip { opacity: 1; }

/* ── CONTENT ─────────────────────────────────────────── */
.content { padding: 24px 28px; min-width: 0; }

/* ── HEADER ─────────────────────────────────────────── */
.header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px;
}
.page-title {
  font-size: 22px; font-weight: 700; color: var(--text);
  display: flex; align-items: baseline; gap: 10px;
}
.page-title-count {
  font-size: 14px; font-weight: 600;
  color: var(--accent);
  background: rgba(34,211,238,0.1);
  border: 1px solid rgba(34,211,238,0.2);
  padding: 2px 9px; border-radius: 20px;
  font-variant-numeric: tabular-nums;
}
.header-actions { display: flex; gap: 8px; align-items: center; }
.page-intro {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent);
}
.page-subtitle {
  font-size: 13px;
  color: var(--muted2);
  max-width: 720px;
  line-height: 1.5;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.panel-subtitle {
  font-size: 12.5px;
  color: var(--muted2);
  margin-top: 4px;
  line-height: 1.45;
}
.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.form-actions-start,
.form-actions-end {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mono-input {
  font-family: 'JetBrains Mono', monospace;
}
.checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.checkbox-card input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent2);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-card .form-label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--text);
}
.checkbox-card.checkbox-inline {
  justify-content: flex-start;
}
.checkbox-card.checkbox-inline .form-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.helper-note {
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.5;
}
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-strong { font-weight: 600; color: var(--text); }
.mono-text { font-family: 'JetBrains Mono', monospace; }
.mono-text-xs { font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-10 { margin-bottom: 10px; }
.mb-14 { margin-bottom: 14px; }
.mb-18 { margin-bottom: 18px; }
.w-full { width: 100%; }
.grid-span-full { grid-column: 1 / -1; }
.table-meta {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 8px;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 16px;
  color: var(--muted2);
  text-align: center;
}
.empty-state-icon {
  font-size: 30px;
  opacity: 0.3;
}

/* ── SEARCH BAR ─────────────────────────────────────── */
.search-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr) auto;
  gap: 8px;
  margin-bottom: 18px;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: rgba(34,211,238,0.35); }

.search-bar input,
.search-bar select,
.form-control {
  width: 100%;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  font-family: 'Manrope', sans-serif;
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}
.search-bar input:focus,
.search-bar select:focus,
.form-control:focus { border-color: rgba(34,211,238,0.4); background: var(--surface2); }
.search-bar select option { background: var(--surface2); }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: 'Manrope', sans-serif;
}
.btn-primary, .search-bar button, .btn:not(.secondary):not(.danger) {
  background: var(--accent);
  color: var(--btn-text);
}
.btn-primary:hover, .search-bar button:hover, .btn:not(.secondary):not(.danger):hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--btn-shadow);
}
.btn.secondary {
  background: var(--surface);
  color: var(--muted2);
  border: 1px solid var(--border);
}
.btn.secondary:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn.danger {
  background: rgba(244,63,94,0.12);
  color: var(--danger);
  border: 1px solid rgba(244,63,94,0.25);
}
.btn.danger:hover { background: rgba(244,63,94,0.22); border-color: rgba(244,63,94,0.45); }
.btn:active { transform: translateY(0) scale(0.98); }

/* ── STAT CARDS ──────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}
.card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(34,211,238,0.03), transparent);
  pointer-events: none;
}
.card .label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted); margin-bottom: 8px;
}
.card .value {
  font-size: 26px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.card .delta {
  font-size: 11px; color: var(--muted); margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }
.card .sparkline {
  position: absolute; bottom: 8px; right: 8px;
  opacity: 0.4;
}
.card:hover .sparkline { opacity: 0.7; }

/* ── TABLE ───────────────────────────────────────────── */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; min-width: max-content; border-collapse: collapse; }
thead { background: var(--surface2); }
th {
  padding: 11px 10px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 10px 10px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr {
  transition: background var(--transition);
  position: relative;
}
tbody tr:hover { background: rgba(34,211,238,0.035); }
tbody tr.row-highlighted { box-shadow: inset 3px 0 0 var(--accent); }

.table-actions {
  display: flex; gap: 6px; opacity: 0;
  transition: opacity 0.15s;
}
tbody tr:hover .table-actions { opacity: 1; }
.table-actions-static { opacity: 1; }

/* ── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge.success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.badge.warn    { background: rgba(244,63,94,0.12);  color: #fb7185; border: 1px solid rgba(244,63,94,0.25); }
.badge.muted   { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.badge.operator-beeline { background: rgba(250,204,21,0.15); color: #fbbf24; border: 1px solid rgba(250,204,21,0.3); }
.badge.operator-mts     { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.badge.operator-megafon { background: rgba(34,197,94,0.12);  color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.badge.operator-t2      { background: rgba(167,139,250,0.12);color: var(--accent3); border: 1px solid rgba(167,139,250,0.25); }

/* ── PAGINATION ──────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 12px;
  font-size: 13px;
}
.pagination-controls { display: flex; gap: 8px; align-items: center; }
.pill {
  padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px; color: var(--muted2);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-icon {
  padding: 6px 10px;
  font-size: 12px;
}
.btn-disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ── FORMS & SECTIONS ────────────────────────────────── */
.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
}
.section-title {
  font-size: 15px; font-weight: 700;
  margin-bottom: 16px; color: var(--text);
}
.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
label { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--muted2); text-transform: uppercase; letter-spacing: 0.4px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.table-scroll-y { max-height: 520px; overflow: auto; }
.cell-note { font-size: 12px; max-width: 160px; white-space: normal; }
.cell-note-sm { font-size: 12px; max-width: 140px; white-space: normal; }
.entity-stack { display: flex; flex-direction: column; gap: 2px; }
.entity-stack-main { font-size: 13px; color: var(--text); }
.entity-stack-sub { font-size: 11px; color: var(--muted2); }
.stat-success { color: #34d399; }
.stat-danger { color: #fb7185; }
.checkbox-center { text-align: center; }
.checkbox-compact {
  width: 15px;
  height: 15px;
  accent-color: #7c3aed;
  cursor: pointer;
}
.select-compact {
  width: 90px;
  padding: 6px 10px;
}
.chip-esim {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
  margin-left: 6px;
  vertical-align: middle;
}
.badge-dynamic {
  background: color-mix(in srgb, var(--badge-color, #7c3aed) 18%, transparent);
  color: var(--badge-text, #ffffff);
  border: 1px solid color-mix(in srgb, var(--badge-color, #7c3aed) 32%, transparent);
}
.import-panel {
  overflow: hidden;
}
.import-panel .panel-head {
  margin-bottom: 18px;
}
.import-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}
.import-form-grid label {
  gap: 8px;
}
.import-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.import-field .helper-note,
.import-field .table-meta {
  margin-top: 0;
}
.import-note-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--muted2);
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.import-note-card strong {
  color: var(--text);
}
.import-note-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}
.import-preview-table td,
.import-preview-table th {
  white-space: nowrap;
}
.import-preview-table td {
  vertical-align: top;
}
.import-table-input {
  min-width: 140px;
}
.import-table-input.mono-input {
  min-width: 164px;
}
.import-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -18px -18px;
  padding: 14px 18px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0), var(--panel) 28%);
  backdrop-filter: blur(4px);
}
.import-map-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.import-upload-grid {
  grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr) minmax(300px, 1.2fr);
  align-items: start;
}
.import-upload-grid .import-field {
  gap: 10px;
}
.import-upload-grid .form-control {
  min-height: 42px;
}
.import-upload-grid .helper-note {
  min-height: 36px;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-wrap { width: min(420px, 100%); }
.login-hero { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--btn-text);
  margin: 0 auto 14px;
  box-shadow: 0 12px 36px var(--btn-shadow);
}
.login-title { font-size: 24px; font-weight: 800; color: var(--text); }
.login-subtitle {
  font-size: 13px;
  color: var(--muted2);
  margin-top: 6px;
  line-height: 1.5;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}
.login-error {
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.25);
  border-radius: 10px;
  color: #fb7185;
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.login-submit {
  width: 100%;
  margin-top: 6px;
  min-height: 44px;
  font-size: 14px;
}

.phone-cell { white-space: nowrap; vertical-align: middle; }
.phone-cell-inner {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.esim-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 1px 5px;
  border-radius: 4px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
  flex-shrink: 0;
  vertical-align: middle;
}

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--accent); }
.sort-asc::after { content: ' ↑'; color: var(--accent); }
.sort-desc::after { content: ' ↓'; color: var(--accent); }

.operators-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.operator-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.operator-filter-input { width: 220px; }
.operator-list-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.operator-form-grid { grid-template-columns: minmax(0, 1fr) 96px 96px; }
.operator-color-input { padding: 4px; min-height: 42px; }
.operator-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px 12px;
}
.operator-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.operator-swatch {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.operator-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.operator-name { font-size: 14px; font-weight: 700; color: var(--text); }
.operator-preview {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.operator-meta { font-size: 12px; color: var(--muted2); margin-top: 3px; }
.operator-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.operator-hidden-state { padding: 6px 2px 2px; }

.org-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}
.org-modal.open { display: flex; }
.org-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2,6,23,0.55);
  backdrop-filter: blur(6px);
}
.org-modal-dialog {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--border2);
  border-radius: 18px;
  background: var(--panel);
  padding: 20px;
  box-shadow: 0 24px 80px rgba(2,6,23,0.35);
}
.operator-modal-dialog { width: min(560px, calc(100vw - 32px)); }
.operator-manager-modal { width: min(880px, calc(100vw - 32px)); }
.org-edit-modal-dialog { width: min(1080px, calc(100vw - 32px)); }
.sim-edit-modal-dialog { width: min(960px, calc(100vw - 32px)); }
.operator-modal-head { margin-bottom: 12px; }
.operator-toolbar-full { width: 100%; justify-content: stretch; }
.operator-list-modal { margin-bottom: 16px; }
.org-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.org-modal-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.org-modal-actions { display: flex; gap: 8px; margin-top: 16px; }

.lk-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--lk-color, var(--accent));
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.2s;
}
.lk-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.lk-type-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.lk-name-input { flex: 1; min-width: 0; }
.lk-type-select { width: 150px; flex-shrink: 0; }
.lk-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 12px;
}
.pw-wrap { display: flex; gap: 6px; align-items: center; }
.pw-wrap input { flex: 1; }
.lk-table-list { display: flex; flex-direction: column; gap: 5px; }
.lk-strip {
  display: flex;
  align-items: stretch;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--lk-c) 35%, transparent);
  overflow: hidden;
  height: 34px;
}
.lk-strip-label {
  width: 88px;
  flex-shrink: 0;
  background: var(--lk-c);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  gap: 1px;
}
.lk-strip-type {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--lk-t);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
  text-align: center;
}
.lk-strip-name {
  font-size: 9px;
  color: var(--lk-t);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}
.lk-strip-body {
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--lk-c) 6%, var(--panel));
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  gap: 2px;
}
.lk-strip-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 5px;
  background: transparent;
  border: none;
  color: var(--muted2);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  height: 24px;
}
.lk-strip-btn svg { width: 11px; height: 11px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; opacity: 0.6; }
.lk-strip-val { overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.lk-strip-pw { letter-spacing: 2px; font-size: 10px; }
.lk-strip-copy { opacity: 0; font-size: 11px; flex-shrink: 0; transition: opacity 0.12s; }
.lk-strip-btn:hover { background: color-mix(in srgb, var(--lk-c) 12%, var(--panel)); color: var(--text); }
.lk-strip-btn:hover .lk-strip-copy { opacity: 0.7; }
.lk-strip-btn.copied { color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); }
.lk-strip-divider {
  width: 1px;
  height: 18px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--lk-c) 25%, transparent);
  margin: 0 2px;
}
.lk-strip-url {
  width: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid color-mix(in srgb, var(--lk-c) 25%, transparent);
  background: color-mix(in srgb, var(--lk-c) 8%, var(--panel));
  color: var(--lk-c);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.12s, background 0.12s;
}
.lk-strip-url:hover { opacity: 1; background: color-mix(in srgb, var(--lk-c) 16%, var(--panel)); }
.lk-strip-url svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── FLASH TOAST ─────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(13,20,36,0.85);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid rgba(34,211,238,0.22);
  border-radius: 13px;
  padding: 13px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
  min-width: 280px; max-width: 380px;
  pointer-events: all;
  animation: toast-in 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.toast.toast-out { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in  { from { opacity:0; transform: translateY(16px) scale(0.96); } to { opacity:1; transform: translateY(0) scale(1); } }
@keyframes toast-out { from { opacity:1; transform: translateY(0); } to { opacity:0; transform: translateY(8px); } }
.toast-icon {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.toast-icon.ok  { background: rgba(16,185,129,0.18); }
.toast-icon.err { background: rgba(244,63,94,0.18); }
.toast-icon.info{ background: rgba(34,211,238,0.15); }
.toast-icon svg { width: 15px; height: 15px; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.toast-icon.ok  svg { stroke: #34d399; }
.toast-icon.err svg { stroke: var(--danger); }
.toast-icon.info svg{ stroke: var(--accent); }
.toast-body { flex: 1; }
.toast-msg  { font-size: 13px; font-weight: 600; line-height: 1.3; }
.toast-sub  { font-size: 11.5px; color: var(--muted2); margin-top: 2px; }
.toast-close {
  flex-shrink: 0; cursor: pointer; opacity: 0.4;
  font-size: 14px; color: var(--text); margin-top: 1px;
  transition: opacity 0.15s;
  background: none; border: none; padding: 0;
}
.toast-close:hover { opacity: 1; }

/* ── SKELETON ────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 1200px 100%;
  animation: shimmer 1.6s infinite linear;
}
.skeleton-row { display: flex; gap: 10px; padding: 11px 10px; border-bottom: 1px solid var(--border); }
.skeleton-cell { border-radius: 5px; height: 14px; }

/* ── MISC UTILS ──────────────────────────────────────── */
.muted { color: var(--muted2); }
.flex { display: flex; gap: 12px; align-items: center; }
.space-between { justify-content: space-between; }
.color-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; border: 1px solid rgba(255,255,255,0.12); }
.table-actions form { display: inline; }
.btn-reveal { background: none; border: none; cursor: pointer; padding: 0 3px; opacity: 0.45; font-size: 13px; transition: opacity 0.15s; vertical-align: middle; }
.btn-reveal:hover { opacity: 1; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--sidebar-collapsed-w) 1fr; }
  .layout .brand-text,
  .layout .nav-label { opacity: 0; width: 0; overflow: hidden; }
  .search-bar { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}
@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; height: auto; position: static; }
  .content { padding: 16px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .header,
  .panel-head,
  .form-actions,
  .form-actions-start,
  .form-actions-end {
    flex-direction: column;
    align-items: stretch;
  }
  .header-actions,
  .panel-actions {
    width: 100%;
    justify-content: stretch;
    flex-wrap: wrap;
  }
  .login-page { padding: 16px; }
  .login-card { padding: 22px; }
  .operators-head,
  .operator-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .operator-form-grid { grid-template-columns: 1fr 1fr; }
  .operator-form-grid label:first-child { grid-column: 1 / -1; }
  .operator-item,
  .operator-actions,
  .org-modal-actions { flex-direction: column; align-items: stretch; }
  .operator-filter-input { width: 100%; }
  .org-modal-dialog { width: calc(100vw - 20px); padding: 16px; }
  .lk-card-body { grid-template-columns: 1fr; }
  .lk-card-header { flex-wrap: wrap; }
  .lk-type-select { width: 100%; }
  .import-upload-grid,
  .import-map-grid,
  .import-form-grid { grid-template-columns: 1fr; }
  .import-field .helper-note,
  .import-field .table-meta { min-height: 0; }
  .import-sticky-actions {
    position: static;
    margin: 18px 0 0;
    padding: 0;
    background: none;
    backdrop-filter: none;
  }
}

/* ── COUNTER ANIMATION ───────────────────────────────── */
.count-animate { font-variant-numeric: tabular-nums; }

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ── THEME TOGGLE ────────────────────────────────────── */
.theme-toggle {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 10px;
  border-radius: 10px;
  color: var(--muted2);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  background: none; border: none;
  font-family: 'Manrope', sans-serif;
  width: 100%; text-align: left;
  transition: all var(--transition);
  white-space: nowrap; overflow: hidden;
  position: relative;
}
.theme-toggle:hover { background: var(--surface); color: var(--text); }
.theme-toggle svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle-tooltip {
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) + 8px);
  top: 50%; transform: translateY(-50%);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 12px; font-weight: 500;
  padding: 5px 10px; border-radius: 7px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s; z-index: 200;
}
.layout.collapsed .theme-toggle:hover .theme-toggle-tooltip { opacity: 1; }

:root[data-theme="dark"] .btn:not(.secondary):not(.danger),
body.dark .btn:not(.secondary):not(.danger),
:root[data-theme="dark"] .search-bar button,
body.dark .search-bar button {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
:root[data-theme="dark"] .brand-icon,
body.dark .brand-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
