/* ─── Variables ─────────────────────────────────────────── */
:root {
  --bg-base:    #f2f0eb;
  --bg-panel:   #ffffff;
  --bg-card:    #fdfcf9;
  --bg-hover:   #f5f3ee;
  --bg-input:   #f8f7f3;
  --border:     #e4e0d6;
  --border-hi:  #c8c3b5;
  --shadow:     0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --text-1:     #1c1917;
  --text-2:     #6b6460;
  --text-3:     #a8a099;
  --accent:     #0a6e4f;
  --accent-lt:  #0a6e4f12;
  --accent-md:  #0a6e4f22;
  --green:      #16a34a;
  --green-lt:   #16a34a14;
  --green-bd:   #16a34a30;
  --amber:      #b45309;
  --amber-lt:   #b4530914;
  --amber-bd:   #b4530930;
  --red:        #dc2626;
  --red-lt:     #dc262614;
  --red-bd:     #dc262630;
  --blue:       #1d4ed8;
  --blue-lt:    #1d4ed814;
  --blue-bd:    #1d4ed830;
  --purple:     #7c3aed;
  --purple-lt:  #7c3aed14;
  --purple-bd:  #7c3aed30;
  --font-ui:    'Outfit', sans-serif;
  --font-display:'DM Serif Display', serif;
  --font-mono:  'JetBrains Mono', monospace;
  --nav-h:      58px;
  --sidebar-w:  232px;
  --radius:     10px;
  --radius-sm:  6px;
  --radius-xs:  4px;
}

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-font-smoothing: antialiased; }
body {
  background: var(--bg-base);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 14px;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 5px; }

/* ─── Top Bar ───────────────────────────────────────────── */
.topbar {
  height: var(--nav-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-icon {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.logo-icon svg { width: 16px; height: 16px; }
.logo-wordmark {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--text-1);
  letter-spacing: 0;
  line-height: 1;
}
.topbar-spacer { flex: 1; }

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-lt);
  border: 1px solid var(--green-bd);
  border-radius: 20px;
  padding: 4px 10px 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}
.topbar-status.inactive {
  background: var(--red-lt);
  border-color: var(--red-bd);
  color: var(--red);
}
.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.5s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.topbar-divider {
  width: 1px; height: 24px;
  background: var(--border);
}

.topbar-profile { position: relative; }
.topbar-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
  letter-spacing: 0;
  border: none;
}
.topbar-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 300;
  animation: fadeIn 0.12s;
}
.topbar-dropdown.open { display: block; }
.topbar-dropdown-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-family: var(--font-ui);
}
.topbar-dropdown-item:hover { background: var(--bg-hover); color: var(--text-1); }
.topbar-dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.topbar-dropdown-logout { color: var(--red); }
.topbar-dropdown-logout:hover { background: var(--red-lt); color: var(--red); }
.topbar-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── Shell ─────────────────────────────────────────────── */
.shell {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px 0 0;
}

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 16px 16px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.13s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.active {
  background: var(--accent-lt);
  color: var(--accent);
  font-weight: 600;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  border-radius: 10px;
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.nav-badge.green {
  background: var(--green-lt);
  border-color: var(--green-bd);
  color: var(--green);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--border);
}
.sidebar-gateway-info {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.gw-label { font-family: var(--font-mono); font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.gw-host { font-family: var(--font-mono); font-size: 12px; color: var(--accent); font-weight: 600; }
.gw-wg { font-size: 11px; color: var(--text-2); margin-top: 3px; font-family: var(--font-mono); }

/* ─── Main Content ──────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── Page Header ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--text-1);
  line-height: 1.1;
}
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; font-weight: 400; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.13s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(10,110,79,0.3), 0 1px 1px rgba(10,110,79,0.2);
}
.btn-primary:hover {
  background: #085f43;
  box-shadow: 0 3px 10px rgba(10,110,79,0.3);
  transform: translateY(-1px);
}
.btn-ghost {
  background: var(--bg-panel);
  color: var(--text-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--border-hi); }
.btn svg { width: 14px; height: 14px; }
.btn.is-loading {
  pointer-events: none;
  opacity: 0.65;
  position: relative;
}
.btn.is-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.5s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ─── Stats Grid ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card-stripe {
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  border-radius: var(--radius) 0 0 var(--radius);
}
.stat-icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}
.stat-icon svg { width: 14px; height: 14px; }
.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1;
}
.stat-label {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 4px;
  font-weight: 500;
}
.stat-delta {
  position: absolute;
  top: 14px; right: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* ─── Two / Three Column ────────────────────────────────── */
.two-col   { display: grid; grid-template-columns: 1fr 360px; gap: 14px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ─── Card ──────────────────────────────────────────────── */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.1px;
}
.card-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
  font-family: var(--font-mono);
}
.card-body { padding: 16px 20px; }

/* ─── Layout Grids ──────────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 14px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.chart-area {
  width: 100%;
  height: 180px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}
.chart-area svg { width: 100%; height: 100%; }
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
}

/* ─── Traffic Chart ─────────────────────────────────────── */
.chart-wrap {
  height: 120px;
  position: relative;
  margin-top: 10px;
}
.chart-svg { width: 100%; height: 100%; }
.chart-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-3);
}

/* ─── Tags ──────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}
.tag-green { background: var(--green-lt); color: var(--green); border: 1px solid var(--green-bd); }
.tag-red   { background: var(--red-lt);   color: var(--red);   border: 1px solid var(--red-bd); }
.tag-amber { background: var(--amber-lt); color: var(--amber); border: 1px solid var(--amber-bd); }
.tag-blue  { background: var(--blue-lt);  color: var(--blue);  border: 1px solid var(--blue-bd); }
.tag-info  { background: var(--bg-hover);    color: var(--text-2); border: 1px solid var(--border); margin-left: 4px; }
.tag-grey  { background: var(--bg-base);  color: var(--text-2);border: 1px solid var(--border); }
.tag-dot   { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* RDP/remote-desktop protocol badges + browser indicator (Phase 3a) */
.proto-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.b-rdp    { background: #13314a; color: #7fc0ff; }
.b-vnc    { background: #3a2a4d; color: #c9a3ff; }
.b-ssh    { background: #13402c; color: #74e0a8; }
.b-telnet { background: #3f2f16; color: #e6c477; }
.browser-ind {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 999px;
}

/* ─── Feature Grid ─────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.feature-cell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.feature-cell:nth-child(odd) {
  border-right: 1px solid var(--border);
}
.feature-cell:nth-last-child(1),
.feature-cell:nth-last-child(2) {
  border-bottom: none;
}

/* ─── Peer Table ────────────────────────────────────────── */
.peer-table { width: 100%; border-collapse: collapse; }
.peer-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.peer-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.peer-table tr:last-child td { border-bottom: none; }
.peer-table tr:hover td { background: var(--bg-hover); }
.peer-name { font-weight: 600; font-size: 13px; }
.peer-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* ─── User/Token table action buttons (flex, not stacked) ─ */
.user-actions {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

/* ─── Users table responsive: cards on mobile ─────────── */
@media (max-width: 768px) {
  #users-table thead { display: none !important; }
  #users-table { display: block !important; }
  #users-table tbody { display: block !important; }
  #users-table tr {
    display: block !important;
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 0 !important;
  }
  #users-table td {
    display: block !important;
    padding: 2px 0 !important;
    border: none !important;
    font-size: 13px !important;
    background: none !important;
    width: 100% !important;
  }
  #users-table td:first-child {
    font-size: 15px !important;
    font-weight: 600 !important;
    margin-bottom: 4px !important;
  }
  #users-table td:empty { display: none !important; }
  #users-table .user-actions {
    justify-content: flex-start !important;
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--border) !important;
  }
}

/* ─── Peer Mobile Cards ────────────────────────────────── */
.peers-mobile { display: none; }
.peer-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.peer-card:last-child { border-bottom: none; }
.peer-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.peer-card-info { flex: 1; min-width: 0; }
.peer-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
}
.peer-card-meta span { white-space: nowrap; }
.peer-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ─── Route Items ───────────────────────────────────────── */
.route-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.route-item:last-child { border-bottom: none; }
.route-icon {
  width: 34px; height: 34px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-2);
}
.route-icon svg { width: 15px; height: 15px; }
.route-domain { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--accent); }
.route-target { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.route-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-basis: 100%; padding-left: 46px; order: 1; }
.route-actions { margin-left: auto; display: flex; gap: 5px; flex-shrink: 0; }

.icon-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.13s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--border-hi); }
.icon-btn svg { width: 12px; height: 12px; }


/* ─── Routes toolbar (search + chips + sort + view toggle) ─ */
.routes-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.routes-toolbar .input-wrap { flex: 0 1 220px; min-width: 160px; }
.filter-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip-sep { width: 1px; height: 18px; background: var(--border-hi, var(--border)); margin: 0 4px; }
.filter-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.13s;
}
.filter-chip:hover { color: var(--text-1); }
.filter-chip.on { background: var(--accent-lt, var(--bg-hover)); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.sort-select {
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-base);
  color: var(--text-2);
}
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-xs); overflow: hidden; }
.view-toggle button {
  border: none;
  background: var(--bg-base);
  color: var(--text-3);
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.view-toggle button.on { background: var(--accent-lt, var(--bg-hover)); color: var(--accent); }
.view-toggle button + button { border-left: 1px solid var(--border); }
.view-toggle svg { width: 15px; height: 15px; }

/* ─── Route groups (service bundles / same domain) ───────── */
.route-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--bg-card);
}
.route-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-base);
}
.route-group-head:hover { background: var(--bg-hover); }
.group-chevron { color: var(--text-3); transition: transform 150ms; flex-shrink: 0; }
.route-group.collapsed .group-chevron { transform: rotate(-90deg); }
.route-group.collapsed .route-group-body { display: none; }
.group-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.group-status-dot.green { background: var(--green); box-shadow: 0 0 0 3px var(--green-lt); }
.group-status-dot.amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-lt); }
.group-status-dot.red { background: var(--red); box-shadow: 0 0 0 3px var(--red-lt); }
.group-label { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--text-1); }
.group-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.group-bundle-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--blue-lt, var(--bg-hover));
  color: var(--blue, var(--accent));
  border: 1px solid var(--blue-bd, var(--border));
}
.group-target-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-base);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.group-spacer { flex: 1; }
.group-actions { display: flex; gap: 4px; }
.icon-btn-danger:hover { background: var(--red-lt); color: var(--red); border-color: var(--red-bd); }
.route-group-body { border-top: 1px solid var(--border); padding: 0 12px; }
.route-item.route-sub-item { padding-left: 24px; }
.route-icon-l4 { color: var(--blue, var(--text-2)); }
.tag-more { cursor: pointer; background: var(--bg-hover); border: 1px dashed var(--border-hi, var(--border)); color: var(--text-2); font-family: var(--font-mono); font-size: 10px; padding: 2px 7px; border-radius: 999px; }
.tag-more:hover { color: var(--text-1); }

/* ─── Routes table view ──────────────────────────────────── */
.routes-table-wrap { overflow-x: auto; }
.routes-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.routes-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.routes-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.routes-table tbody tr:last-child td { border-bottom: none; }
.routes-table tbody tr:hover { background: var(--bg-hover); }
.routes-table .mono { font-family: var(--font-mono); font-size: 12px; }
.routes-table-group td {
  background: var(--bg-base);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  padding: 6px 10px;
}
.routes-table-group .group-status-dot { display: inline-block; margin-right: 6px; vertical-align: middle; }
.routes-table .td-actions { white-space: nowrap; text-align: right; }
.routes-table .td-actions .icon-btn { display: inline-grid; margin-left: 4px; }
.routes-table .td-batch { width: 30px; }

@media (max-width: 1023px) {
  .routes-toolbar { align-items: stretch; }
  .routes-toolbar .input-wrap { flex-basis: 100%; }
  .filter-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .route-item.route-sub-item { padding-left: 8px; }
}


.service-step-pill {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.service-step-pill.on { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.service-step-pill.done { color: var(--text-2); border-color: var(--accent); opacity: 0.7; }
.service-mapping-row {
  display: grid;
  grid-template-columns: 90px 1fr 24px 1fr 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.service-mapping-row .arrow { text-align: center; color: var(--text-3); font-family: var(--font-mono); }

/* ─── Activity Feed ─────────────────────────────────────── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-text { font-size: 12.5px; line-height: 1.5; color: var(--text-1); }
.activity-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-top: 2px; }

/* ─── WireGuard Config ──────────────────────────────────── */
.wg-config {
  background: #faf9f5;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-2);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
  white-space: pre-wrap;
  word-break: break-all;
}
.wg-section { color: #0a6e4f; font-weight: 700; }
.wg-key { color: #1d4ed8; }
.wg-val { color: var(--text-1); }
.wg-comment { color: var(--text-3); font-style: italic; }

/* ─── Toggle Switch ─────────────────────────────────────── */
.toggle {
  width: 36px; height: 20px;
  background: var(--border-hi);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle.on::after { transform: translateX(16px); }

/* ─── Toggle Button Group ──────────────────────────────── */
.toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-base);
}
.toggle-btn {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  outline: none;
}
.toggle-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}
.toggle-btn:hover {
  background: var(--bg-hover);
}
.toggle-btn.on {
  background: var(--accent);
  color: #fff;
}
/* Green = effective-active auth method. Scoped to the auth-type group so its
   #id specificity beats the blue .on (green wins when a tab is both active and
   visited) and other toggle-groups stay blue. */
#edit-auth-type-group .toggle-btn.method-active {
  background: var(--green);
  color: #fff;
}

/* ─── Form Select & Hint ───────────────────────────────── */
.form-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-base);
  color: var(--text-1);
  font-size: 13px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s;
}
.form-select:focus {
  border-color: var(--accent);
}
.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-3);
}

/* ─── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.tab {
  padding: 5px 13px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-2);
  transition: all 0.13s;
  border: none;
  background: none;
}
.tab.active {
  background: var(--bg-panel);
  color: var(--text-1);
  box-shadow: var(--shadow);
}
.tab:hover:not(.active) { color: var(--text-1); }

/* ─── Input ─────────────────────────────────────────────── */
.input-wrap { position: relative; }
.input-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-3);
  pointer-events: none;
}
input[type=text], input[type=search], input[type=password], input[type=email], input[type=number], input[type=time], input[type=date], .form-input, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  transition: border-color 0.13s, box-shadow 0.13s;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
input[type=text]:focus, input[type=search]:focus, input[type=password]:focus, input[type=email]:focus, input[type=time]:focus, input[type=date]:focus, .form-input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt), inset 0 1px 2px rgba(0,0,0,0.04);
}
input[type=search] { padding-left: 32px; width: 200px; }

/* ─── Meter Bar ─────────────────────────────────────────── */
.meter-bar {
  height: 5px;
  background: var(--bg-base);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.meter-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

/* ─── Flash Messages ────────────────────────────────────── */
.flash {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.flash-success {
  background: var(--green-lt);
  border: 1px solid var(--green-bd);
  color: var(--green);
}
.flash-error {
  background: var(--red-lt);
  border: 1px solid var(--red-bd);
  color: var(--red);
}

/* ─── Bottom Nav (Mobile) ───────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.bottom-nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text-3);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.13s;
  font-size: 10px;
  font-weight: 600;
  min-width: 60px;
}
.bn-item.active { color: var(--accent); }
.bn-item svg { width: 20px; height: 20px; }

/* ─── FAB Speed Dial ────────────────────────────────────── */
.fab-wrap {
  display: none;
  position: fixed;
  bottom: 80px; right: 18px;
  z-index: 102;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.fab {
  width: 50px; height: 50px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 4px 16px rgba(10,110,79,0.35);
  display: grid;
  place-items: center;
  transition: transform 0.2s, box-shadow 0.15s;
}
.fab:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(10,110,79,0.4); }
.fab svg { width: 22px; height: 22px; }
.fab .fab-icon-close { display: none; }
.fab-wrap.open .fab { transform: rotate(0); background: var(--text-2); }
.fab-wrap.open .fab .fab-icon-plus { display: none; }
.fab-wrap.open .fab .fab-icon-close { display: block; }

.fab-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.fab-wrap.open .fab-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.fab-option {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-1);
  cursor: pointer;
}
.fab-option-label {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.fab-option-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(10,110,79,0.3);
}
.fab-option-icon svg { width: 18px; height: 18px; }
.fab-option:hover .fab-option-label { background: var(--bg-hover); }

.fab-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 101;
}
.fab-backdrop.open { display: block; }

/* ─── Animations ────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-card { animation: fadeUp 0.35s ease backwards; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}
.modal.modal-wide {
  width: 1000px;
  animation: slideUp 0.2s ease;
}
.modal.modal-wide .modal-body {
  min-height: 420px;
}
.form-row {
  display: flex;
  gap: 14px;
}
.form-row > .form-group {
  flex: 1;
  min-width: 0;
}
input[type="file"] {
  font-size: 12px;
  padding: 6px 0;
  color: var(--text-2);
}
@media (max-width: 768px) {
  .form-row { flex-direction: column; gap: 0; }
}
.modal-sm { width: 380px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-weight: 700; font-size: 15px; }
.modal-close {
  width: 28px; height: 28px;
  border: none; background: none;
  font-size: 20px; cursor: pointer;
  color: var(--text-3);
  display: grid; place-items: center;
  border-radius: var(--radius-xs);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-1); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.form-group input[type=text], .form-group input[type=email], .form-group input[type=password] { width: 100%; }
.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--red-lt);
  border: 1px solid var(--red-bd);
  border-radius: var(--radius-xs);
}
.field-error {
  font-size: 11px;
  color: var(--red);
  margin-top: 4px;
}
.field-invalid {
  border-color: var(--red) !important;
}
.btn-secondary {
  background: var(--bg-base);
  color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hi);
}
.btn-danger {
  background: var(--red);
  color: #fff;
  box-shadow: 0 1px 3px rgba(220,38,38,0.3);
}
.btn-danger:hover { background: #b91c1c; }

/* ─── Peer Action Buttons ──────────────────────────────── */
.peer-actions { display: flex; gap: 4px; }

/* ─── Table responsive wrapper ─────────────────────────── */
.table-wrap { overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* ─── Hamburger Toggle Button ──────────────────────────── */
.sidebar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-toggle:hover { background: var(--bg-hover); }
.sidebar-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-toggle svg { color: var(--text-1); }
.sidebar-toggle[aria-expanded="true"] .hamburger-icon { display: none; }
.sidebar-toggle[aria-expanded="true"] .hamburger-close { display: block !important; }

/* ─── Sidebar Overlay ──────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 59;
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  /* Show hamburger toggle */
  .sidebar-toggle { display: flex; }

  /* Sidebar: off-screen by default, slides in */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  .bottom-nav { display: flex; }
  .fab-wrap { display: flex; }
  .main { padding: 16px; padding-bottom: 80px; }
  .page-header { flex-direction: column; }
  .page-header .btn { align-self: flex-start; }
  .three-col { grid-template-columns: 1fr; }
  .peers-desktop { display: none; }
  .peers-mobile { display: block; }
  .card { overflow: visible; }
  .modal { width: calc(100vw - 16px); max-height: calc(100vh - 16px); margin: 8px; }
  .modal-overlay { align-items: flex-start; padding: 8px 0; overflow-y: auto; }
  .modal-head { padding: 12px 16px; position: sticky; top: 0; background: var(--bg-panel); z-index: 1; }
  .modal-foot { padding: 10px 16px; position: sticky; bottom: 0; background: var(--bg-panel); z-index: 1; }
  .modal-body { padding: 16px; }
  .topbar-lang { display: none; }

  /* Route items: stack vertically on mobile */
  .route-item {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    position: relative;
    padding-right: 100px;
  }
  .route-tags {
    width: 100%;
    padding-left: 46px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .route-tags::-webkit-scrollbar { display: none; }
  .route-actions {
    position: absolute;
    right: 0;
    top: 12px;
  }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-cell:nth-child(odd) { border-right: none; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar-status span { display: none; }
  .topbar-divider { display: none; }
}

/* ─── Batch operations bar ───────────────────────────── */
.batch-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 100;
  font-size: 13px;
  font-weight: 500;
  max-width: calc(100vw - 24px);
}
.batch-bar span { white-space: nowrap; }
@media (max-width: 900px) {
  .batch-bar {
    bottom: 76px;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    width: calc(100vw - 24px);
  }
  .batch-bar > div { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
  .batch-bar .btn { font-size: 12px; padding: 6px 10px; }
}
.batch-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.batch-col { text-align: center; }
.route-item.batch-mode { cursor: pointer; }

/* ─── License Feature Lock ────────────────────── */
.feature-locked {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}
.feature-locked .lock-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  vertical-align: middle;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}
.limit-badge {
  font-size: 12px;
  color: var(--text-2);
  margin-left: 8px;
}
.limit-badge.at-limit {
  color: var(--amber);
  font-weight: 600;
}
.route-item.batch-mode .batch-checkbox-wrap { display: flex !important; }

/* ─── Toast Notifications ─────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-visible {
  opacity: 1;
  transform: translateY(0);
}
.toast-success {
  background: var(--green-lt);
  color: var(--green);
  border: 1px solid var(--green-bd);
}
.toast-error {
  background: var(--red-lt);
  color: var(--red);
  border: 1px solid var(--red-bd);
}

/* ── Gateway update toast (pulsing while running, static when terminal) ── */
#gw-update-toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 10001;
  pointer-events: none;
}
.gw-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-panel, #fff);
  color: var(--text-1);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 360px;
  pointer-events: auto;
}
.gw-toast.show { opacity: 1; transform: translateY(0); }
.gw-toast-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-3);
}
.gw-toast-msg { flex: 1 1 auto; }
.gw-toast-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
}
.gw-toast-close:hover { opacity: 1; }
/* running → blue, the whole toast gently pulses, dot pulses stronger */
.gw-toast-updating {
  border-color: var(--blue-bd, rgba(37,99,235,0.4));
  animation: gw-toast-pulse 1.6s ease-in-out infinite;
}
.gw-toast-updating .gw-toast-dot {
  background: var(--blue, #2563eb);
  animation: gw-toast-dot-pulse 1.6s ease-in-out infinite;
}
/* done → green static */
.gw-toast-done {
  background: var(--green-lt);
  color: var(--green);
  border-color: var(--green-bd);
}
.gw-toast-done .gw-toast-dot { background: var(--green, #16a34a); }
/* failed → red static */
.gw-toast-failed {
  background: var(--red-lt);
  color: var(--red);
  border-color: var(--red-bd);
}
.gw-toast-failed .gw-toast-dot { background: var(--red, #dc2626); }
/* unknown → amber static */
.gw-toast-unknown {
  background: var(--amber-lt, rgba(217,119,6,0.1));
  color: var(--amber, #b45309);
  border-color: var(--amber-bd, rgba(217,119,6,0.4));
}
.gw-toast-unknown .gw-toast-dot { background: var(--amber, #b45309); }
@keyframes gw-toast-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 0 0 0 rgba(37,99,235,0.45); }
  50%      { box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 0 0 5px rgba(37,99,235,0); }
}
@keyframes gw-toast-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.78); }
}
@media (prefers-reduced-motion: reduce) {
  .gw-toast { transition: none; }
  .gw-toast-updating, .gw-toast-updating .gw-toast-dot { animation: none; }
}

/* ── RDP Dashboard ────────────────────────────────────── */
.stat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.stat-dot-green { background: var(--green, #16a34a); }
.stat-dot-red { background: var(--red, #dc2626); }
.stat-dot-amber { background: var(--amber, #b45309); }
.stat-dot-blue { background: var(--blue, #2563eb); }
.stat-dot-purple { background: var(--purple, #7c3aed); }

.vm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.vm-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; transition: border-color .15s; }
.vm-card:hover { border-color: var(--accent-bd, var(--accent)); }
.vm-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.vm-name { font-size: 14px; font-weight: 700; color: var(--text-1); }
.vm-host { font-size: 11px; font-family: var(--font-mono); color: var(--text-3); margin-top: 2px; }
.vm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.vm-meta { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-2); }
.vm-meta-row { display: flex; justify-content: space-between; align-items: center; }
.vm-actions { display: flex; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.vm-fav { position: absolute; top: 14px; right: 16px; cursor: pointer; font-size: 16px; color: var(--text-3); background: none; border: none; padding: 0; }
.vm-fav.active { color: var(--amber, #b45309); }

.history-table { width: 100%; border-collapse: collapse; }
.history-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .3px; padding: 8px 12px; border-bottom: 2px solid var(--border); }
.history-table td { padding: 10px 12px; font-size: 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover { background: var(--bg-hover); }

.tag-purple { background: var(--purple-lt, #7c3aed14); color: var(--purple, #7c3aed); border: 1px solid var(--purple-bd, #7c3aed30); }
.tag-neutral { background: var(--bg-base, #f0ede7); color: var(--text-2); border: 1px solid var(--border); }

.btn-green { background: var(--green); color: #fff; } .btn-green:hover { opacity: .9; }

@media (max-width: 1200px) { .vm-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) { .vm-grid { grid-template-columns: 1fr; } }

/* Gateway Pools */
.pool-card { padding: 1rem; border: 1px solid var(--border-color, #ccc); border-radius: 4px; margin-bottom: 0.5rem; }
.pool-mode-badge { padding: 2px 6px; border-radius: 3px; font-size: 0.85em; }
.pool-mode-failover { background: #e0e7ff; }
.pool-mode-load_balancing { background: #d1fae5; }
.feature-locked-lb { opacity: 0.5; pointer-events: none; }

.modal-box {
  background: var(--bg-panel, #fff);
  border-radius: var(--radius, 8px);
  width: 600px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  position: relative;
}
.modal-box.modal-box-wide { width: 920px; }

.pool-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.pool-form-col { min-width: 0; }
.pool-members-col {
  border-left: 1px solid var(--border-color, rgba(0,0,0,0.08));
  padding-left: 24px;
}
@media (max-width: 760px) {
  .modal-box.modal-box-wide { width: 96vw; }
  .pool-form-grid { grid-template-columns: 1fr; }
  .pool-members-col { border-left: none; padding-left: 0; border-top: 1px solid var(--border-color, rgba(0,0,0,0.08)); padding-top: 16px; }
}

.pool-members-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
}
.pool-members-list:empty::before {
  content: attr(data-empty-text);
  display: block;
  color: var(--text-3, #777);
  font-size: 12px;
  padding: 24px 0;
  text-align: center;
  border: 1px dashed var(--border-color, rgba(0,0,0,0.12));
  border-radius: var(--radius, 6px);
}
.pool-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-2, rgba(0,0,0,0.03));
  border-radius: var(--radius, 6px);
  cursor: grab;
  user-select: none;
  transition: background 0.12s ease, opacity 0.12s ease;
}
.pool-member-row:active { cursor: grabbing; }
.pool-member-row.dragging { opacity: 0.4; }
.pool-member-row.drag-over-top { box-shadow: 0 -2px 0 0 var(--accent, #6366f1); }
.pool-member-row.drag-over-bottom { box-shadow: 0 2px 0 0 var(--accent, #6366f1); }
.pool-member-handle {
  font-family: var(--font-mono, monospace);
  color: var(--text-3, #777);
  font-size: 14px;
  line-height: 1;
  padding: 0 4px;
}
.pool-member-position {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-2, #555);
  min-width: 24px;
  text-align: center;
}
.pool-member-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ── Inline-Help Tooltips (gc-tip) ───────────────────────── */
.gc-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 5px;
  color: var(--text-3); cursor: help; vertical-align: middle;
  border-radius: 50%; flex-shrink: 0;
}
.gc-tip:hover, .gc-tip:focus { color: var(--accent); outline: none; }
#gc-tip-bubble {
  position: fixed; display: none; max-width: 280px;
  background: var(--bg-panel); color: var(--text-1);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 12px; line-height: 1.45;
  white-space: pre-line; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 10000; pointer-events: none;
}
.gc-port-error { border-color: var(--red) !important; }
/* Domain-Feld bei L4-none ausgeblendet -> 2-Spalten-Reihe einspaltig kollabieren
   (sonst leere Spalte). Bei flex-basierten .form-row wirkungslos = ok. */
.wiz-row-2.gc-row-collapsed, .form-row.gc-row-collapsed { grid-template-columns: 1fr; }
/* ── Gateway Fleet Dashboard (#2a) — scoped under .gw-fleet to avoid collisions ── */
.gw-fleet .page-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.gw-fleet .page-sub { color: var(--text-3); margin: 0 0 20px; }
.gw-fleet .note { background: var(--amber-lt); border: 1px solid var(--amber-bd); color: var(--amber); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13px; }
.gw-fleet .kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.gw-fleet .kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.gw-fleet .kpi .n { font-size: 26px; font-weight: 700; font-family: var(--font-display); line-height: 1.1; }
.gw-fleet .kpi .l { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.gw-fleet .kpi.ok .n { color: var(--green); }
.gw-fleet .kpi.warn .n { color: var(--amber); }
.gw-fleet .kpi.bad .n { color: var(--red); }
.gw-fleet .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.gw-fleet .gw { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.gw-fleet .gw .top { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.gw-fleet .gw .top h3 { margin: 0 0 2px; font-size: 15px; }
.gw-fleet .gw .host { color: var(--text-3); font-size: 12px; font-family: var(--font-mono); }
.gw-fleet .gw .body { padding: 14px 16px; display: grid; gap: 12px; }
/* Scan / loading indicators (LAN discovery + egress dropdown). Must live in the
   linked stylesheet — a runtime-injected <style> is blocked by our CSP
   (styleSrcElem requires a nonce; no 'unsafe-inline'). grid-column:1/-1 keeps
   the bar full-width inside the .gw .body grid. */
@keyframes gw-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes gw-progress-slide { 0% { left: -35%; } 100% { left: 100%; } }
.gw-progress { height: 5px; width: 100%; grid-column: 1 / -1; background: var(--border); border-radius: 3px; overflow: hidden; margin: 10px 0 4px; position: relative; }
.gw-progress::before { content: ""; position: absolute; left: 0; top: 0; height: 100%; width: 35%; border-radius: 3px; background: var(--accent, #2563eb); animation: gw-progress-slide 1.1s ease-in-out infinite; }
.gw-fleet .gw .kv { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.gw-fleet .gw .kv .k { color: var(--text-3); }
.gw-fleet .gw .kv .v { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.gw-fleet .gw .metric { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.gw-fleet .gw .bar { height: 6px; background: var(--bg-panel); border-radius: 4px; overflow: hidden; }
.gw-fleet .gw .bar .fill { display: block; height: 100%; background: var(--accent); }
.gw-fleet .gw .bar .fill.warn { background: var(--amber); }
.gw-fleet .gw .bar .fill.bad { background: var(--red); }
.gw-fleet .gw .foot { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: 12px; background: var(--bg-panel); }
.gw-fleet .pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; text-transform: capitalize; }
.gw-fleet .pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.gw-fleet .pill.online { color: var(--green); background: var(--green-lt); }
.gw-fleet .pill.degraded { color: var(--amber); background: var(--amber-lt); }
.gw-fleet .pill.offline { color: var(--red); background: var(--red-lt); }
.gw-fleet .pill.pending { color: var(--text-3); background: var(--bg-panel); }
.gw-fleet .badge.drift { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; color: var(--amber); background: var(--amber-lt); }
.gw-fleet .recheck { padding: 4px 10px; font-size: 13px; line-height: 1; background: transparent; border: 1px solid var(--border); color: var(--text-2); border-radius: var(--radius-sm); cursor: pointer; }
.gw-fleet .recheck:hover { border-color: var(--accent); color: var(--accent); }
/* ── Gateway detail view (full-page, mirrors gateway-detail.html mockup) ── */
.gw-fleet #gw-detail-view .gw-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--text-3); font-size: 13px; cursor: pointer; padding: 0; margin-bottom: 16px; font-family: inherit; }
.gw-fleet #gw-detail-view .gw-back:hover { color: var(--accent); }
.gw-fleet .gw-detail .page-h h1 { display: inline-flex; align-items: center; gap: 12px; font-size: 22px; margin: 0; }
.gw-fleet .gw-detail-actions { display: flex; gap: 8px; align-items: center; }
.gw-fleet .gw-update { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 6px 13px; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.gw-fleet .gw-update:hover { filter: brightness(1.06); }
.gw-fleet .grid.two { grid-template-columns: 1fr 1fr; }
.gw-fleet .gw.full { grid-column: 1 / -1; }
.gw-fleet .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; }
.gw-fleet .row3 .kv { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.gw-fleet .gw .kv .v.ok { color: var(--green); }
.gw-fleet .gw .kv .v.bad { color: var(--red); }
.gw-fleet .gw-metrics .bar { margin-bottom: 12px; }
.gw-fleet .gw-metrics .bar:last-child { margin-bottom: 0; }
.gw-fleet .gw-routes { width: 100%; border-collapse: collapse; font-size: 13px; }
.gw-fleet .gw-routes th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 0 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.gw-fleet .gw-routes td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.gw-fleet .gw-routes tr:last-child td { border-bottom: 0; }
.gw-fleet .gw-routes .sub { color: var(--text-3); font-family: var(--font-mono); font-size: 12px; }
.gw-fleet .gw-routes .num { font-family: var(--font-mono); color: var(--text-2); white-space: nowrap; }
.gw-fleet .gw-empty { color: var(--text-3); font-size: 13px; padding: 4px 0; }
.gw-fleet .gw-setup .gw-setup-status { font-size: 12px; font-weight: 600; }
.gw-fleet .gw-setup .gw-setup-status.done { color: var(--green); }
.gw-fleet .gw-setup .gw-setup-status.pending { color: var(--amber); }
.gw-fleet .gw-setup .gw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.gw-fleet .gw-setup details { margin-top: 8px; font-size: 13px; }
.gw-fleet .gw-setup details > summary { cursor: pointer; color: var(--text-2); }
.gw-fleet .gw-setup details[open] > summary { margin-bottom: 8px; }
.gw-fleet .gw-setup details h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.gw-fleet .gw-setup details ol { margin: 0 0 6px; padding-left: 20px; }
.gw-fleet .gw-setup details ol li { margin: 2px 0; }
.gw-fleet .gw-setup .gw-setup-cmd { font-family: var(--font-mono); font-size: 11px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0 0 8px; white-space: pre-wrap; word-break: break-all; color: var(--text-2); }
.gw-fleet .gw-setup .gw-setup-hint { color: var(--text-3); font-size: 12px; margin: 6px 0 0; }
.gw-fleet .gw.gw-setup.done { opacity: .85; }
@media (max-width: 760px) { .gw-fleet .kpis { grid-template-columns: repeat(2, 1fr); } .gw-fleet .grid.two { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .gw-fleet .row3 { grid-template-columns: 1fr 1fr; } }

/* ── Auto-update status (dashboard header) ─────────────── */
.au-pill { display:inline-flex; align-items:center; gap:8px; padding:6px 12px; border-radius:999px;
  font-size:12px; font-weight:600; }
.au-pill .au-dot { width:8px; height:8px; border-radius:50%; flex:0 0 auto; }
.au-active  { background: var(--green-lt); color: var(--green); border:1px solid var(--green-bd); }
.au-active  .au-dot { background: var(--green, #16a34a); }
.au-amber   { background: var(--amber-lt, rgba(217,119,6,0.1)); color: var(--amber, #b45309); border:1px solid var(--amber-bd, rgba(217,119,6,0.4)); }
.au-amber   .au-dot { background: var(--amber, #b45309); }
.au-red     { background: var(--red-lt); color: var(--red); border:1px solid var(--red-bd); }
.au-red     .au-dot { background: var(--red, #dc2626); }
.au-badge   { font-size:11px; font-weight:600; padding:2px 8px; border-radius:999px;
  background: var(--bg-base, #f0ede7); color: var(--text-2); border:1px solid var(--border); }
.au-actions { display:inline-flex; gap:8px; align-items:center; flex-wrap:wrap; }

/* ── Browser RDP Session Player (default theme) ─────────────────────────── */
body.rdp-session-body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}
.rdp-session-page {
  --player-bg:   #0d1117;
  --player-grid: #1a212c;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--player-bg);
}
.rdp-session-display {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--player-bg);
}
/* Slim toolbar */
.rdp-session-toolbar {
  flex: 0 0 auto;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(13,17,23,0.92);
  border-top: 1px solid #232c38;
  backdrop-filter: blur(6px);
}
.rdp-spacer { flex: 1; }
/* Status pill */
.rdp-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
  flex-shrink: 0;
}
.rdp-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.rdp-spin {
  width: 11px; height: 11px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: rdp-spin 0.6s linear infinite;
  flex: 0 0 auto;
}
.rdp-pill--connecting { background: var(--blue-lt);  border-color: var(--blue-bd);  color: #6da0ff; }
.rdp-pill--connecting .rdp-dot { background: var(--blue); animation: rdp-pulse 1s ease-in-out infinite; }
.rdp-pill--connected  { background: var(--green-lt); border-color: var(--green-bd); color: #4ade80; }
.rdp-pill--connected  .rdp-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-lt); }
.rdp-pill--reconnect  { background: var(--amber-lt); border-color: var(--amber-bd); color: #f5b454; }
.rdp-pill--reconnect  .rdp-dot { background: var(--amber); animation: rdp-pulse 0.8s ease-in-out infinite; }
.rdp-pill--disconnect { background: rgba(168,160,153,0.14); border-color: #3a4350; color: #9aa6b2; }
.rdp-pill--disconnect .rdp-dot { background: var(--text-3); }
.rdp-pill--error      { background: var(--red-lt); border-color: var(--red-bd); color: #f87171; }
.rdp-pill--error      .rdp-dot { background: var(--red); }
/* Toolbar buttons (on dark surface) */
.rdp-tbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #2a3340;
  background: #161d27;
  color: #c2ccd6;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
  white-space: nowrap;
  flex-shrink: 0;
}
.rdp-tbtn:hover { background: #1d2632; color: #fff; border-color: #3a4654; }
.rdp-tbtn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.rdp-tbtn[aria-pressed="true"] { background: var(--accent-md); border-color: var(--accent); color: #6ee7b7; }
.rdp-tbtn--danger { background: var(--red-lt); border-color: var(--red-bd); color: #f87171; }
.rdp-tbtn--danger:hover { background: rgba(220,38,38,0.18); color: #fff; border-color: var(--red); }
/* Inline clipboard-unavailable warning pill */
.rdp-clip-warn {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  border: 1px solid var(--amber-bd, rgba(180,83,9,0.19));
  background: var(--amber-lt, rgba(180,83,9,0.08));
  color: var(--amber, #b45309);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}
/* Reconnecting overlay */
.rdp-reconnect-veil {
  position: absolute; inset: 0;
  background: rgba(13,17,23,0.55);
  backdrop-filter: blur(1.5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.rdp-reconnect-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 28px;
  border-radius: var(--radius);
  background: rgba(20,26,34,0.9);
  border: 1px solid #2a3340;
  box-shadow: var(--shadow-md);
}
.rdp-big-spin {
  width: 30px; height: 30px;
  border: 3px solid var(--amber-bd);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: rdp-spin 0.7s linear infinite;
}
.rdp-rc-title { font-size: 13px; font-weight: 600; color: #f5b454; }
.rdp-rc-sub   { font-family: var(--font-mono); font-size: 11px; color: #6b7785; }
/* Error / limit overlay */
.rdp-error-veil {
  position: absolute; inset: 0;
  background: rgba(8,11,16,0.74);
  backdrop-filter: blur(2.5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 11;
}
.rdp-error-modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.rdp-em-bar  { height: 4px; background: var(--red); }
.rdp-em-body { padding: 26px 26px 14px; text-align: center; }
.rdp-em-icon {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red-lt);
  border: 1px solid var(--red-bd);
  color: var(--red);
}
.rdp-em-icon svg { width: 26px; height: 26px; }
.rdp-em-body h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  color: var(--text-1);
}
.rdp-em-cause {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--red-lt);
  border: 1px solid var(--red-bd);
  color: var(--red);
}
.rdp-em-text {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.55;
}
.rdp-em-actions {
  display: flex;
  gap: 10px;
  padding: 18px 26px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
/* Animations (rdp- prefix to avoid conflicts) */
@keyframes rdp-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes rdp-spin  { to { transform: rotate(360deg); } }

/* Settings autosave feedback */
.autosave-status { font-size: 11px; color: var(--text-3); min-height: 14px; transition: filter .15s ease; }
.autosave-status.field-saving { filter: blur(2px); opacity: .7; }
.autosave-status.autosave-error { color: var(--danger, #dc2626); filter: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .autosave-status.field-saving { filter: none; opacity: .5; }
}
