:root {
  --ref-font: 'Outfit', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  --ref-font-title: 'Orbitron', sans-serif;
  --ref-mono: 'JetBrains Mono', "SF Mono", "Cascadia Code", ui-monospace, monospace;
  --ref-bg: #05050a;
  --ref-surface: rgba(13, 13, 26, 0.6);
  --ref-header-bg: rgba(13, 13, 26, 0.82);
  --ref-border: rgba(0, 242, 255, 0.12);
  --ref-border-strong: rgba(0, 242, 255, 0.25);
  --ref-text: #fdfdff;
  --ref-dim: rgba(200, 200, 255, 0.55);
  --ref-blue: #00f2ff;
  --ref-pink: var(--ref-blue);
  --ref-green: #39ff14;
  --ref-orange: #ff9f0a;
  --ref-purple: #bc13fe;
  --ref-blur: saturate(200%) blur(24px);
  --ref-radius-lg: 16px;
  --ref-radius: 12px;
  --ref-radius-sm: 8px;
  --ref-radius-inner: 12px;
  --ref-shadow: 0 0 20px rgba(0, 0, 0, 0.6), 0 0 4px rgba(0, 242, 255, 0.1);
  --ref-input-bg: rgba(0, 0, 0, 0.35);
  --ref-table-head: rgba(22, 22, 40, 0.95);
}

[data-theme="light"] {
  --ref-bg: #f5f7ff;
  --ref-surface: rgba(255, 255, 255, 0.85);
  --ref-header-bg: rgba(255, 255, 255, 0.9);
  --ref-border: rgba(0, 150, 255, 0.15);
  --ref-border-strong: rgba(255, 0, 255, 0.15);
  --ref-text: #1a1a2e;
  --ref-dim: #4a5568;
  --ref-shadow: 0 10px 30px rgba(0, 150, 255, 0.06);
  --ref-blue: #0084ff;
  --ref-pink: #e91e63;
  --ref-green: #1b9e3e;
  --ref-blur: saturate(160%) blur(20px);
  --ref-input-bg: #ffffff;
  --ref-table-head: rgba(200, 220, 255, 0.95);
}

body.management-ui {
  font-family: var(--ref-font);
  background: var(--ref-bg);
  position: relative !important;
  min-height: 100vh !important;
}

body.management-ui::before {
  content: "" !important;
  position: fixed !important;
  top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important;
  background-image: 
    linear-gradient(rgba(0, 242, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 242, 255, 0.04) 1px, transparent 1px) !important;
  background-size: 30px 30px !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

.ref-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #0f0f1a;
}

[data-theme="light"] .ref-bg {
  background: #eef2ff;
}

.ref-bg::before,
.ref-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
}

.ref-bg::before {
  width: 700px;
  height: 700px;
  top: -20%;
  left: -10%;
  background: radial-gradient(circle, rgba(255, 0, 255, 0.15) 0%, transparent 70%);
}

.ref-bg::after {
  width: 600px;
  height: 600px;
  bottom: -15%;
  right: -10%;
  background: radial-gradient(circle, rgba(0, 242, 255, 0.12) 0%, transparent 70%);
}

.ref-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.ref-sidebar {
  width: 260px;
  background: var(--ref-surface);
  backdrop-filter: var(--ref-blur);
  -webkit-backdrop-filter: var(--ref-blur);
  border-right: 1px solid var(--ref-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: var(--transition-smooth);
}

[data-theme="light"] .ref-sidebar {
  background: rgba(255, 255, 255, 0.4);
}

.ref-sidebar-brand {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.ref-sidebar-brand i {
  color: #a29bfe;
  width: 22px;
  height: 22px;
}

.ref-sidebar-brand span {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(120deg, #fff 30%, #a29bfe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .ref-sidebar-brand span {
  background: linear-gradient(120deg, #1e293b 30%, #4f46e5);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ref-side-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ref-side-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  color: var(--ref-dim);
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.ref-side-item i {
  width: 18px;
  height: 18px;
}

.ref-side-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ref-text);
}

.ref-side-item.active {
  background: rgba(162, 155, 254, 0.1);
  color: #a29bfe;
  border-color: rgba(162, 155, 254, 0.2);
}

.ref-sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--ref-border);
}

/* Sidebar Settings Groups (Static) */
.ref-sidebar-group {
  margin-bottom: 20px;
  background: var(--ref-surface);
  border: 1px solid var(--ref-border);
  border-radius: var(--ref-radius-inner);
  overflow: hidden;
  position: relative;
  box-shadow: var(--ref-shadow);
}

.ref-sidebar-group .card-head {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--ref-border);
}

.registration-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 8px;
}

.controls-row {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.controls-row .form-row {
  margin-bottom: 0;
  flex: 1;
  min-width: 120px;
}

.registration-controls .btn-group {
  display: flex;
  gap: 12px;
  width: 100%;
}

.registration-controls .btn-group .btn {
  flex: 1;
  justify-content: center;
}

.ref-sidebar-group .card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ref-header {
  height: 80px !important;
  background: var(--ref-header-bg) !important;
  backdrop-filter: var(--ref-blur) !important;
  -webkit-backdrop-filter: var(--ref-blur) !important;
  position: relative !important;
  top: 0 !important;
  z-index: 1000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 32px !important;
  box-sizing: border-box !important;
  width: 96% !important;
  margin: 32px auto 16px !important;
  border-radius: var(--ref-radius-lg) !important;
  border: 1px solid var(--ref-border) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.05) !important;
  transition: all 0.3s !important;
}

.ref-header::after {
  content: "" !important; position: absolute !important; bottom: -1px !important; left: 15% !important; width: 70% !important; height: 1px !important;
  background: linear-gradient(90deg, transparent, var(--ref-blue), transparent) !important;
  filter: blur(1px) !important; opacity: 0.6 !important;
}

.ref-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.ref-brand i {
  flex-shrink: 0;
}

.ref-header-nav {
  display: flex;
  gap: 32px;
}

.ref-header-nav a {
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ref-dim);
  transition: all 0.2s;
  padding: 8px 16px;
  border-radius: 8px;
}

.ref-header-nav a:hover,
.ref-header-nav a.active {
  color: var(--ref-blue);
  background: rgba(0, 242, 255, 0.08);
  border-bottom: 2px solid var(--ref-blue);
  border-radius: 0;
  padding-bottom: 4px;
  position: relative;
}

.ref-header-nav a.active {
  color: var(--ref-blue);
  background: rgba(0, 242, 255, 0.08);
  border-bottom: 2px solid var(--ref-blue);
  border-radius: 0;
  padding-bottom: 4px;
}

.ref-content-horizontal {
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
}

.ref-header-title {
  font-family: var(--ref-font-title) !important;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ref-text);
  letter-spacing: 1px;
}

.ref-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.ref-breadcrumb .muted {
  color: var(--ref-dim);
}

.ref-breadcrumb .sep {
  color: var(--ref-border);
  font-size: 0.8rem;
}

.ref-breadcrumb .current {
  color: var(--ref-text);
  font-weight: 600;
}

.ref-header-ops {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ref-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.ref-content {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.page {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-columns: 340px 1fr;
  height: 100%;
  gap: 0;
  align-items: stretch;
}

.sidebar {
  width: 340px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 24px 16px 100px 32px !important;
  background: rgba(255, 255, 255, 0.02);
  border: none !important;
  border-right: 1px solid var(--ref-border) !important;
  border-radius: 0 !important;
}

/* Cyberpunk Scrollbar - Universal */
::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
  background: transparent !important;
}

::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
  background: var(--ref-border) !important;
  border-radius: 4px !important;
}

::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
  background: var(--ref-blue) !important;
  box-shadow: 0 0 10px var(--ref-blue) !important;
}

.sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--ref-border) transparent;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
  height: 100%;
  overflow-y: auto;
  padding: 24px 32px 40px;
}

.view-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.card {
  background: radial-gradient(circle at center, rgba(0, 242, 255, 0.03), transparent 70%), var(--ref-surface) !important;
  backdrop-filter: var(--ref-blur) !important;
  -webkit-backdrop-filter: var(--ref-blur) !important;
  border: 1px solid var(--ref-border) !important;
  border-radius: var(--ref-radius) !important;
  box-shadow: var(--ref-shadow) !important;
  transition: all 0.3s ease !important;
}

.card:hover {
  transform: translateY(-8px) !important;
  border-color: rgba(0, 242, 255, 0.3) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 242, 255, 0.1) !important;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.12);
  border-bottom: 1px solid var(--ref-border);
}

.card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ref-text);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: .78rem;
  color: var(--ref-dim);
}

.inp,
.inp-select,
.inp-area {
  width: 100%;
  padding: 9px 13px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--ref-border);
  border-radius: var(--ref-radius-sm);
  color: var(--ref-text);
  transition: all 0.2s ease;
}

.inp:focus,
.inp-select:focus,
.inp-area:focus {
  outline: none;
  border-color: var(--ref-blue);
  background: rgba(0, 242, 255, 0.04);
  box-shadow: 0 0 12px rgba(0, 242, 255, 0.15);
}

[data-theme="light"] .inp,
[data-theme="light"] .inp-select,
[data-theme="light"] .inp-area {
  background: rgba(255, 255, 255, 0.9);
}

.inp-area {
  min-height: 92px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  height: 38px;
  border-radius: var(--ref-radius-sm);
  border: 1px solid var(--ref-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ref-text);
  font-weight: 600;
}

.btn-green {
  background: rgba(57, 255, 20, 0.1);
  border-color: rgba(57, 255, 20, 0.4);
  color: var(--ref-green);
}

.btn-green:hover {
  background: var(--ref-green);
  color: #000;
  box-shadow: 0 0 20px var(--ref-green);
}

.btn-red {
  background: rgba(255, 69, 58, 0.1);
  border-color: rgba(255, 69, 58, 0.4);
  color: #ff453a;
}

.btn-red:hover {
  background: #ff453a;
  color: #fff;
  box-shadow: 0 0 20px #ff453a;
}

.btn-blue {
  background: rgba(0, 242, 255, 0.1) !important;
  border-color: rgba(0, 242, 255, 0.4) !important;
  color: var(--ref-blue) !important;
  position: relative !important;
  overflow: hidden !important;
}

.btn-blue::after {
  content: "" !important;
  position: absolute !important;
  top: -100% !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: linear-gradient(transparent, rgba(0, 242, 255, 0.2), transparent) !important;
  animation: ref-btn-scan 1.8s infinite cubic-bezier(0.4, 0, 0.2, 1) !important;
  pointer-events: none !important;
}

@keyframes ref-btn-scan {
  0% { top: -100%; }
  100% { top: 100%; }
}

.btn-blue:hover {
  background: var(--ref-blue) !important;
  color: #000 !important;
  box-shadow: 0 0 20px var(--ref-blue) !important;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--ref-border);
  color: var(--ref-dim);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ref-text);
  border-color: var(--ref-text);
}

.status-pill.running .btn-blue {
  background: var(--ref-blue);
  color: #000;
  font-weight: 700;
  border: none;
  box-shadow: 0 0 15px var(--ref-blue);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-blue:hover {
  background: #fff;
  color: #000;
  box-shadow: 0 0 25px #fff;
  transform: translateY(-2px);
}

.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
  border-radius: var(--ref-radius-inner);
  padding: 12px;
}

.status-pill {
  font-family: var(--ref-mono) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  position: relative !important;
}

.status-pill::before { content: "[" !important; color: var(--ref-blue) !important; opacity: 0.6 !important; font-weight: 400 !important; margin-right: 2px !important; }
.status-pill::after { content: "]" !important; color: var(--ref-blue) !important; opacity: 0.6 !important; font-weight: 400 !important; margin-left: 2px !important; }

table tr:hover {
  background: rgba(0, 242, 255, 0.05) !important;
  box-shadow: inset 2px 0 0 var(--ref-blue) !important;
}

.status-pill.running .dot {
  background: var(--ref-green) !important;
  box-shadow: 0 0 20px var(--ref-green) !important;
  animation: ref-pulse-glow 2.5s infinite !important;
}

table td, .stat-value, .mini-hint {
  font-family: var(--ref-mono) !important;
  font-size: 0.85rem !important;
  letter-spacing: -0.2px !important;
}

/* Global Premium Scrollbars */
::-webkit-scrollbar { width: 4px !important; height: 4px !important; }
::-webkit-scrollbar-track { background: transparent !important; }
::-webkit-scrollbar-thumb { background: var(--ref-border) !important; border-radius: 10px !important; transition: background 0.3s !important; }
::-webkit-scrollbar-thumb:hover { background: var(--ref-blue) !important; box-shadow: 0 0 10px var(--ref-blue) !important; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.toolbar-spacer {
  flex: 1;
}

.terminal {
  height: 300px;
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  background: rgba(2, 6, 23, .82);
  border: 1px solid rgba(255, 255, 255, .05);
  font-family: var(--ref-mono);
  font-size: .8rem;
}

[data-theme="light"] .terminal {
  background: rgba(248, 250, 252, 0.96);
  border-color: rgba(15, 23, 42, .08);
}

.log {
  color: #dbeafe;
  margin-bottom: 6px;
}

.log.meta {
  color: var(--ref-dim);
}

[data-theme="light"] .log {
  color: #0f172a;
}

[data-theme="light"] .log.info {
  color: #1d4ed8;
}

[data-theme="light"] .log.warn {
  color: #b45309;
}

[data-theme="light"] .log.error {
  color: #be123c;
}

.monitor-row {
  display: flex;
  gap: 32px;
  width: 100%;
}

.monitor-row>.card {
  flex: 1;
  margin: 0;
}

@media (max-width: 1100px) {
  .monitor-row {
    flex-direction: column;
    gap: 16px;
  }
}

.tbl-wrap {
  overflow: auto;
  border: 1px solid var(--ref-border);
  border-radius: var(--ref-radius-inner);
  background: var(--ref-surface);
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--ref-radius-inner);
}

.tbl thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ref-table-head);
  backdrop-filter: var(--ref-blur);
  -webkit-backdrop-filter: var(--ref-blur);
}

.tbl th {
  padding: 14px 16px;
  text-align: left;
  color: var(--ref-dim);
  font-size: 0.85rem;
  font-weight: 700;
  border-bottom: 1px solid var(--ref-border);
  white-space: nowrap;
}

.tbl td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ref-border);
  color: var(--ref-text);
  vertical-align: middle;
}

.tbl tr:hover td {
  background: rgba(0, 242, 255, 0.03);
}

[data-theme="light"] .tbl tr:hover td {
  background: rgba(0, 150, 255, 0.03);
}

[data-theme="light"] .tbl th,
[data-theme="light"] .tbl td {
  border-bottom: 1px solid rgba(15, 23, 42, .06);
}

.stat-grid-ref {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.console-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 20px;
}

.monitor-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.table-type {
  width: 100px;
}

.table-status {
  width: 110px;
}

.table-remark {
  min-width: 300px;
}

.metric-card {
  padding: 12px;
  border-radius: var(--ref-radius-inner);
  background: var(--ref-surface);
  border: 1px solid var(--ref-border);
  text-align: left;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  border-color: var(--ref-blue);
  box-shadow: 0 0 10px var(--ref-border);
}

.metric-card .metric-label {
  color: var(--ref-dim);
  font-size: .72rem;
  display: block;
}

.metric-card .metric-value {
  margin-top: 6px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ref-blue);
}

.console-note {
  color: var(--ref-dim);
  font-size: .78rem;
}

.terminal.compact {
  height: 220px;
}

.log.info {
  color: #dbeafe;
}

.log.warn {
  color: #fde68a;
}

.log.error {
  color: #fda4af;
}

.remark-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.remark-main {
  color: var(--ref-text);
}

.remark-sub {
  color: var(--ref-dim);
  font-size: .75rem;
}

.status-soft-ok {
  color: #86efac;
}

.status-soft-warn {
  color: #fde68a;
}

.status-soft-err {
  color: #fda4af;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.status-chip.ok {
  color: #bbf7d0;
  background: rgba(34, 197, 94, .14);
}

.status-chip.warn {
  color: #fde68a;
  background: rgba(245, 158, 11, .14);
}

.status-chip.err {
  color: #fecdd3;
  background: rgba(244, 63, 94, .14);
}

.status-chip.muted {
  color: var(--ref-dim);
  background: rgba(255, 255, 255, .05);
}

.table-email {
  font-family: var(--ref-mono);
  font-size: .82rem;
  color: var(--ref-text);
  min-width: 320px;
  word-break: break-all;
}

.table-type {
  width: 86px;
}

.table-status {
  width: 96px;
}

.table-remark {
  min-width: 360px;
  max-width: 500px;
  white-space: normal;
  word-break: break-all;
  line-height: 1.5;
  font-size: 0.82rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: space-between;
}

.simple-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.sidebar .simple-settings-grid,
.sidebar .inline-field-grid {
  grid-template-columns: 1fr;
}

.simple-settings-grid .card-body {
  gap: 12px;
}

.inline-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-hint {
  color: var(--ref-dim);
  font-size: .76rem;
}

.sidebar .btn {
  width: 100%;
}

.sidebar .toolbar-group {
  width: 100%;
}

.sidebar .toolbar-group .btn {
  flex: 1;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ref-text);
}

.settings-divider {
  height: 1px;
  background: var(--ref-border);
  margin: 16px 0;
  opacity: 0.5;
  position: relative;
}

.settings-divider::after {
  content: attr(data-label);
  position: absolute;
  top: -10px;
  left: 12px;
  background: var(--ref-surface);
  padding: 0 8px;
  font-size: 0.72rem;
  color: var(--ref-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

[data-theme="light"] .ref-nav-item {
  background: rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .ref-nav-item.active {
  background: rgba(10, 132, 255, 0.12);
  border-color: rgba(10, 132, 255, 0.28);
}

[data-theme="light"] .status-chip.ok {
  color: #166534;
  background: rgba(34, 197, 94, .12);
}

[data-theme="light"] .status-chip.warn {
  color: #92400e;
  background: rgba(245, 158, 11, .12);
}

[data-theme="light"] .status-chip.err {
  color: #9f1239;
  background: rgba(244, 63, 94, .12);
}

[data-theme="light"] .status-chip.muted {
  color: #475569;
  background: rgba(15, 23, 42, .05);
}

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

  .sidebar {
    position: static;
    max-height: none;
  }

  .stat-grid-ref {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .console-grid-2,
  .monitor-grid-3,
  .simple-settings-grid,
  .inline-field-grid {
    grid-template-columns: 1fr;
  }

  .ref-subnav {
    justify-content: center;
  }
}

@media (max-width: 700px) {
  .stat-grid-ref {
    grid-template-columns: 1fr;
  }
}

/* Modal System */
.ref-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.ref-modal-backdrop.active {
  display: flex !important;
}

.ref-modal {
  background: var(--ref-bg);
  border: 1px solid var(--ref-border);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(162, 155, 254, 0.1);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ref-modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--ref-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ref-modal-head .title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ref-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ref-modal-body {
  padding: 24px;
  overflow-y: auto;
  color: var(--ref-text);
  line-height: 1.6;
}

.ref-modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--ref-border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

.guide-step-box {
  background: rgba(162, 155, 254, 0.05);
  border: 1px dashed var(--ref-primary);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  font-size: 0.9rem;
  color: var(--ref-primary);
}

.permission-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.85rem;
}

.permission-table th {
  text-align: left;
  padding: 8px;
  color: var(--ref-dim);
  border-bottom: 1px solid var(--ref-border);
}

.permission-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.permission-table .cat {
  font-weight: 600;
  color: var(--ref-primary);
  width: 80px;
}

.permission-table .op {
  color: var(--ref-green);
  text-align: right;
}

/* Email Routing Slideshow */
.routing-slideshow {
  margin-bottom: 24px;
  background: var(--ref-input-bg);
  border: 1px solid var(--ref-border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.05);
}

.routing-slideshow .slide-container {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.routing-slideshow img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.routing-slideshow img.active {
  opacity: 1;
  pointer-events: auto;
}

.slide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(13, 13, 26, 0.8);
  border-top: 1px solid var(--ref-border);
}

.slide-nav span {
  font-size: 0.85rem;
  color: var(--ref-blue);
  font-family: var(--ref-mono);
  text-shadow: 0 0 8px var(--ref-blue);
  letter-spacing: 1px;
}

.slide-nav .btn-nav {
  background: transparent;
  border: 1px solid var(--ref-border);
  color: var(--ref-blue);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-nav .btn-nav:hover:not(:disabled) {
  background: rgba(0, 242, 255, 0.1);
  border-color: var(--ref-blue);
  box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.slide-nav .btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}