:root {
  --bg: #071022;
  --panel: #0d1a33;
  --panel-2: #12234a;
  --border: #1c2f57;
  --text: #e8eefc;
  --muted: #8ea3c9;
  --accent: #3b82f6;
  --accent-2: #7c5cff;
  --up: #2fd8a0;
  --down: #ff5d6c;
  --warn: #ffb454;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="light"] {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --border: #dde3ea;
  --text: #1a2130;
  --muted: #62708a;
  --accent: #1c72d6;
  --up: #189a63;
  --down: #d43c3c;
  --warn: #b8720a;
  --accent-2: #6d4be0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  min-height: 100vh;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

/* ---- app shell: fixed-width left sidebar + main column ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0;
  transition: width 0.18s ease, transform 0.18s ease; z-index: 25;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 14px 12px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-toggle {
  background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: 5px 7px; cursor: pointer; display: inline-flex; align-items: center; flex-shrink: 0;
}
.sidebar-toggle:hover { border-color: var(--accent); color: var(--accent); }
.sidebar-toggle-mobile {
  display: none; background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: 5px 7px; cursor: pointer; align-items: center; margin-right: 4px;
}
.topbar-spacer { flex: 1 1 auto; }

.sidebar-nav { padding: 10px 8px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar-group { margin-bottom: 2px; }
.sidebar-group-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--muted); padding: 14px 12px 6px; white-space: nowrap; overflow: hidden;
}
.sidebar-group-title.active { color: var(--accent); }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px;
  color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden;
}
.sidebar-nav a .icon { flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { background: var(--panel-2); color: var(--accent); font-weight: 600; }
/* indented sub-link under a parent item (e.g. Devices -> Routers/Switches/OLTs) --
   no click needed to reveal these, always visible like the rest of the sidebar */
.sidebar-nav a.sub { padding-left: 30px; font-size: 12.5px; }
.app-shell.sidebar-collapsed .sidebar-nav a.sub { display: none; }

.sidebar-backdrop { display: none; }

/* icon-only rail (desktop toggle) */
.app-shell.sidebar-collapsed .sidebar { width: 60px; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 14px 8px; }
.app-shell.sidebar-collapsed .sidebar-brand .brand { display: none; }
.app-shell.sidebar-collapsed .sidebar-group-title,
.app-shell.sidebar-collapsed .sidebar-nav a span { display: none; }
.app-shell.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 10px 0; }

.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: nowrap;
  gap: 10px;
}

.topbar-right { display: flex; align-items: center; flex-shrink: 0; }

.brand {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--up); box-shadow: 0 0 8px var(--up); }
.brand .icon { color: var(--accent); flex-shrink: 0; }
.brand-logo { max-height: 32px; max-width: 180px; object-fit: contain; }
.brand-text { white-space: nowrap; }

.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: 5px 8px; cursor: pointer; display: inline-flex; align-items: center; margin: 0 8px;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon { margin: 0; }
.theme-toggle-sun { display: none; }
.clock { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: 12px; white-space: nowrap; }
:root[data-theme="light"] .theme-toggle-moon { display: none; }
:root[data-theme="light"] .theme-toggle-sun { display: inline-flex; }

.topology-legend { display: flex; gap: 18px; justify-content: center; margin-bottom: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.topology-legend-sep { width: 1px; height: 12px; background: var(--border); }
.topology-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.topology-label { fill: var(--text); font-family: var(--sans); font-size: 12px; font-weight: 600; }
.topology-sublabel { fill: var(--muted); font-family: var(--sans); font-size: 10px; }
.topology-node-glyph { fill: var(--text); font-family: var(--mono); font-size: 10px; font-weight: 600; }
.topology-vendor-badge { fill: #fff; font-family: var(--mono); font-size: 8px; font-weight: 700; pointer-events: none; }
.topology-hub-label { fill: var(--text); font-family: var(--mono); font-size: 13px; font-weight: 700; }
.topology-hub-sublabel { fill: var(--muted); font-family: var(--sans); font-size: 10px; }
svg a { cursor: pointer; }
svg a:hover .topology-label { fill: var(--accent); }

.topology-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 10px; }
.topology-toolbar .topology-legend { margin-bottom: 0; }
.topology-zoom-controls { display: flex; gap: 4px; }
.topology-zoom-controls .btn { min-width: 34px; }

.topology-canvas { position: relative; height: 560px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: grab; }
.topology-canvas:active { cursor: grabbing; }

.topo-node-circle { transition: r 0.12s ease; }
.topo-node-circle-active { r: 28; }
.topo-line { transition: stroke 0.12s ease, stroke-width 0.12s ease; }
.topo-line-active { stroke: var(--accent) !important; stroke-width: 2.5 !important; }

.topo-tooltip {
  display: none; position: absolute; z-index: 5; pointer-events: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: var(--text); min-width: 170px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.topo-tooltip strong { display: block; margin-bottom: 4px; font-size: 13px; }
.topo-tooltip-row { color: var(--muted); margin-top: 2px; }
.topo-tooltip-status { font-weight: 600; margin-top: 6px; }
.topo-tooltip-status.status-up { color: var(--up); }
.topo-tooltip-status.status-down { color: var(--down); }
.topo-tooltip-status.status-unknown { color: var(--muted); }

.wm-canvas { height: 620px; }
.wm-node { cursor: pointer; }
.wm-node-label { fill: var(--text); font-family: var(--sans); font-size: 12px; font-weight: 600; pointer-events: none; }
.wm-node-label-cloud { fill: #fff; font-size: 13px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,0.35); }
.wm-node-device rect {
  fill: var(--panel-2);
  transition: stroke 0.15s ease, filter 0.15s ease;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}
.wm-node-device:hover rect {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3)) drop-shadow(0 0 6px var(--accent));
}
.wm-node-cloud circle:first-child { filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35)); }
.wm-node-delete { opacity: 0; cursor: pointer; transition: opacity 0.12s ease; stroke: var(--panel); stroke-width: 1.5; }
.wm-node-delete-x { fill: #fff; font-size: 10px; font-weight: 700; text-anchor: middle; pointer-events: none; opacity: 0; transition: opacity 0.12s ease; }
.wm-node:hover .wm-node-delete, .wm-node:hover .wm-node-delete-x { opacity: 1; }
.wm-link { stroke-linecap: round; transition: stroke 0.3s ease; }
.wm-link-name { fill: var(--muted); font-family: var(--sans); font-size: 11px; font-weight: 600; pointer-events: none; }
.wm-link-bw { font-family: var(--mono); font-size: 11px; font-weight: 700; pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }
.wm-curve-handle { cursor: ns-resize; opacity: 0; transition: opacity 0.12s ease; }
.wm-canvas:hover .wm-curve-handle { opacity: 0.6; }
.wm-curve-handle:hover { opacity: 1 !important; }

.icon { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 30px; height: 30px; }
h1 .icon, .page-header h1 .icon { width: 20px; height: 20px; margin-right: 8px; color: var(--accent); vertical-align: -3px; }
.admin-menu .dropdown a .icon, .topbar-right a .icon, .admin-menu-toggle .icon { margin-right: 6px; color: currentColor; }
.topbar-right a { display: inline-flex; align-items: center; }
.term-tabs a .icon { margin-right: 6px; }
.stat-tile { display: flex; align-items: center; gap: 12px; }
.stat-tile .icon-xl { color: var(--muted); opacity: 0.6; }
.stat-tile.up .icon-xl { color: var(--up); opacity: 0.8; }
.stat-tile.down .icon-xl { color: var(--down); opacity: 0.8; }
.stat-tile.warn .icon-xl { color: var(--warn); opacity: 0.8; }
.login-card h1 { display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-card h1 .icon { color: var(--up); }

.role-badge {
  font-family: var(--mono); font-size: 10px; padding: 2px 6px; border-radius: 3px;
  border: 1px solid var(--border); margin-left: 6px; text-transform: uppercase;
}
.role-admin { color: var(--accent); border-color: var(--accent); }
.role-operator { color: var(--warn); border-color: var(--warn); }
.role-customer { color: var(--muted); }
.role-superadmin { color: var(--down); border-color: var(--down); }

.user-menu-toggle {
  display: inline-flex !important; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--panel-2); transition: border-color 0.15s ease;
}
.user-menu.open .user-menu-toggle, .user-menu:hover .user-menu-toggle { border-color: var(--accent); }
.user-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent);
  color: #06121f; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.user-menu-name { font-family: var(--mono); font-size: 12px; color: var(--text); }
.user-menu-caret { font-size: 10px; color: var(--muted); }
.user-dropdown { left: auto; right: 0; }

.container { max-width: 1180px; margin: 0 auto; padding: 24px; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.page-header h1 { font-size: 19px; font-weight: 600; margin: 0; }
.page-header .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.btn {
  display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 13px; cursor: pointer; font-family: var(--sans);
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
.btn-danger { border-color: var(--down); color: var(--down); }
.btn-danger:hover { background: rgba(255,93,93,0.08); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.usage-bar { height: 5px; border-radius: 3px; background: var(--border); margin-top: 5px; overflow: hidden; }
.usage-bar-fill { height: 100%; background: var(--up); border-radius: 3px; transition: width 0.2s ease; }
.usage-bar-warn { background: var(--warn); }
.usage-bar-crit { background: var(--down); }

.faceplate { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
.faceplate-port {
  width: 46px; height: 46px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 2px solid var(--muted); cursor: pointer; transition: transform 0.1s ease;
}
.faceplate-port:hover { transform: translateY(-2px); }
.faceplate-port-up { border-color: var(--up); background: rgba(62,207,142,0.12); }
.faceplate-port-down { border-color: var(--down); background: rgba(255,93,93,0.12); }
.faceplate-port-unknown { border-color: var(--muted); }
.faceplate-port-disabled { background: var(--border); opacity: 0.6; }
.faceplate-port-label { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--text); pointer-events: none; }
.faceplate-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.faceplate-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

.faceplate-tooltip {
  display: none; position: absolute; z-index: 5; pointer-events: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: var(--text); min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.faceplate-tooltip strong { display: block; margin-bottom: 4px; font-size: 13px; }
.faceplate-tooltip-row { color: var(--muted); margin-top: 2px; }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-tile { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; min-width: 130px; flex: 1; }
.stat-tile .num { font-size: 26px; font-weight: 700; font-family: var(--mono); }
.stat-tile .label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-tile.up .num { color: var(--up); }
.stat-tile.down .num { color: var(--down); }
.stat-tile.warn .num { color: var(--warn); }

button.stat-tile { font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.stat-tile.ports-active-filter { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.ports-util-bar { height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-bottom: 3px; }
.ports-util-fill { height: 100%; background: var(--up); border-radius: 4px; transition: width 0.4s ease; }

.ports-group-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; cursor: pointer; list-style: none; user-select: none;
}
.ports-group-summary::-webkit-details-marker { display: none; }
.ports-group-name { display: flex; align-items: center; gap: 6px; }
.ports-group-name a { font-weight: 600; }
.ports-chevron { display: inline-block; color: var(--muted); transition: transform 0.15s ease; }
.ports-group details[open] > summary .ports-chevron,
.ports-role-group details[open] > summary .ports-chevron { transform: rotate(90deg); }
.ports-group-counts { display: flex; gap: 6px; }
.ports-group details[open] > summary,
.ports-role-group details[open] > summary { border-bottom: 1px solid var(--border); }
.ports-group table { margin: 0; }

.ports-role-summary { padding: 14px 16px; }
.ports-role-summary .ports-group-name { font-size: 15px; font-weight: 700; }
.ports-role-group { border: 1px solid var(--border); }

.ports-compact-table td, .ports-compact-table th { padding: 5px 8px; font-size: 12px; }
.ports-sfp-btn { white-space: nowrap; }
.ports-sfp-val { font-size: 11px; white-space: nowrap; }
.ports-groupby-toggle { display: flex; gap: 8px; flex-shrink: 0; }

.admin-menu { position: relative; display: inline-block; }
.admin-menu > span { cursor: pointer; color: var(--muted); font-size: 13px; user-select: none; }
.admin-menu:hover > span, .admin-menu.active > span, .admin-menu.open > span { color: var(--text); }
.admin-menu .dropdown {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 6px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px; min-width: 160px; z-index: 20;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
/* Click-to-toggle only (not :hover) -- a hover-reveal dropdown with any gap between the
   trigger and the panel is notoriously flaky (the pointer crosses dead space and the
   panel closes before you can reach it). .active only colors the label (you're currently
   on an admin page) -- it must NOT also force the panel open, or it can never be closed
   while browsing any admin page. Only the JS-toggled .open class shows the panel. */
.admin-menu.open .dropdown { display: block; }
.admin-menu .dropdown a { display: block; padding: 7px 10px; border-radius: 5px; color: var(--text); font-size: 13px; }
.admin-menu .dropdown a:hover { background: var(--panel-2); text-decoration: none; }
.admin-menu .dropdown a.active { color: var(--accent); }

/* ---- responsive / mobile ----
   Below 900px the sidebar becomes an off-canvas overlay (hidden via
   translateX, slid in with .open) instead of a fixed permanent column --
   there's no room to keep 240px of sidebar and readable content side by
   side on a phone/small-tablet viewport. The desktop icon-only collapsed
   rail (.sidebar-collapsed) doesn't apply here; the toggle button always
   opens/closes the full overlay instead. */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; left: 0; width: 240px !important; height: 100vh;
    transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 24; }
  .sidebar-toggle { display: none; }
  .sidebar-toggle-mobile { display: inline-flex; }

  .container { padding: 14px; }
  .page-header { flex-wrap: wrap; gap: 10px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-tile { min-width: 45%; }

  .card { padding: 14px; overflow-x: auto; }
  table { min-width: 560px; }

  .login-card { width: 92vw; max-width: 340px; padding: 22px; }

  .range-picker .range-custom { width: 100%; margin-left: 0; margin-top: 6px; }
  .live-numbers { gap: 16px; }
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
tr:hover td { background: rgba(255,255,255,0.015); }

.status-pill { font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-up { color: var(--up); background: rgba(62,207,142,0.08); }
.status-up::before { background: var(--up); box-shadow: 0 0 5px var(--up); }
.status-down { color: var(--down); background: rgba(255,93,93,0.08); }
.status-down::before { background: var(--down); }
.status-unknown { color: var(--muted); background: rgba(136,148,168,0.08); }
.status-unknown::before { background: var(--muted); }
.status-warn { color: var(--warn); background: rgba(255,180,84,0.08); }
.status-warn::before { background: var(--warn); }

.vendor-tag { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border); padding: 2px 7px; border-radius: 4px; text-transform: uppercase; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

form.inline { display: inline; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; margin-top: 12px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: var(--sans); font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; color: var(--text); font-size: 13px; }

.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: rgba(255,93,93,0.08); border: 1px solid var(--down); color: var(--down); }
.alert-info { background: rgba(79,176,255,0.08); border: 1px solid var(--accent); color: var(--accent); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

.term-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.term-tabs button, .term-tabs a { background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); padding: 6px 14px; border-radius: 6px 6px 0 0; cursor: pointer; font-family: var(--mono); font-size: 12px; display: inline-flex; align-items: center; }
.term-tabs a:hover { text-decoration: none; color: var(--text); }
.term-tabs button.active, .term-tabs a.active { color: var(--text); border-bottom-color: var(--panel); background: var(--bg); }

.chart-wrap { position: relative; height: 260px; width: 100%; }
.chart-wrap canvas { max-width: 100%; }

.kv-table td:first-child, .kv-table th { color: var(--muted); width: 220px; }

.range-picker { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.range-picker button[data-hours] {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); padding: 5px 12px;
  border-radius: 6px; cursor: pointer; font-family: var(--mono); font-size: 12px;
}
.range-picker button[data-hours]:hover { color: var(--text); }
.range-picker button[data-hours].active { color: var(--text); border-color: var(--accent); background: var(--bg); }
.range-picker .range-custom { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
.range-picker .range-custom input[type=date] {
  width: auto; padding: 5px 8px; font-size: 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
}

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px; margin-top: 10px; }
.checkbox-grid .checkbox-row { margin-top: 0; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tag-list .tag {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 4px 6px 4px 12px; font-size: 12px; font-family: var(--mono); color: var(--text);
}
.tag-list .tag-remove {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1;
  padding: 2px 6px; border-radius: 50%;
}
.tag-list .tag-remove:hover { color: var(--down); background: rgba(255,93,93,0.1); }

.live-numbers { display: flex; gap: 24px; margin-top: 8px; }
.live-numbers .num { font-size: 22px; font-weight: 700; }
.live-numbers .label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.result-box { background: #000; border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; max-height: 420px; overflow: auto; margin-top: 12px; }
#terminal-container { background: #000; border: 1px solid var(--border); border-radius: 6px; padding: 6px; height: 420px; }

.iface-row td { vertical-align: middle; }
.spark { height: 34px; width: 120px; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; padding: 20px;
}
.login-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(600px circle at 15% 20%, rgba(79,176,255,0.16), transparent 60%),
    radial-gradient(500px circle at 85% 75%, rgba(62,207,142,0.14), transparent 60%),
    radial-gradient(700px circle at 50% 100%, rgba(79,176,255,0.08), transparent 60%),
    var(--bg);
  animation: login-bg-drift 18s ease-in-out infinite alternate;
}
@keyframes login-bg-drift {
  0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0 0; }
  100% { background-position: 4% 6%, -4% -6%, 2% -3%, 0 0; }
}
.login-particles { position: fixed; inset: 0; z-index: 0; opacity: 0.5; pointer-events: none; }
:root[data-theme="light"] .login-particles { opacity: 0.3; }

.login-card {
  position: relative; z-index: 1; width: 360px; max-width: 100%;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 14px; padding: 34px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35), 0 0 0 1px rgba(79,176,255,0.06);
  animation: login-card-in 0.5s cubic-bezier(0.16,1,0.3,1);
}
@keyframes login-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-card h1 {
  font-family: var(--mono); font-size: 19px; text-align: center; margin: 0 0 4px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-card h1 .icon { color: var(--up); filter: drop-shadow(0 0 6px rgba(62,207,142,0.5)); }
.login-card .tag { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 26px; letter-spacing: 0.3px; }
.login-card input[type=text], .login-card input[type=password] {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-card input[type=text]:focus, .login-card input[type=password]:focus {
  box-shadow: 0 0 0 3px rgba(79,176,255,0.15);
}
.login-card .btn-primary {
  background: linear-gradient(135deg, var(--accent), #3b8fd9);
  border: none; font-weight: 600; letter-spacing: 0.2px;
  box-shadow: 0 4px 16px rgba(79,176,255,0.3);
}
.login-card .btn-primary:hover { filter: brightness(1.08); }
.login-footer { position: relative; z-index: 1; text-align: center; margin-top: 18px; color: var(--muted); font-size: 11px; }
@media (prefers-reduced-motion: reduce) {
  .login-bg { animation: none; }
  .login-card { animation: none; }
}

.assign-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.assign-chip { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px 4px 12px; font-size: 12px; }
.assign-chip button { background: none; border: none; color: var(--down); cursor: pointer; font-size: 13px; }

.port-switch { position: relative; display: inline-block; width: 36px; height: 20px; vertical-align: middle; }
.port-switch input { opacity: 0; width: 0; height: 0; }
.port-switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--down); border-radius: 20px; transition: background .15s;
}
.port-switch .slider::before {
  content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .15s;
}
.port-switch input:checked + .slider { background: var(--up); }
.port-switch input:checked + .slider::before { transform: translateX(16px); }
.port-switch input:disabled + .slider { opacity: 0.5; cursor: wait; }

.rack-elevation-frame {
  display: flex; flex-direction: column;
  border: 3px solid var(--muted); border-radius: 4px;
  overflow: hidden; background: var(--bg);
}
.rack-slot {
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 0 8px 0 4px;
  font-size: 12px;
  overflow: hidden;
}
.rack-slot:last-child { border-bottom: none; }
.rack-slot-u {
  width: 30px; flex-shrink: 0; text-align: right;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
}
.rack-slot-empty {
  background: repeating-linear-gradient(135deg, var(--panel) 0 5px, var(--panel-2) 5px 10px);
}
.rack-slot-device { background: rgba(79, 176, 255, 0.16); border-left: 3px solid var(--accent); }
.rack-slot-server { background: rgba(62, 207, 142, 0.16); border-left: 3px solid var(--up); }
.rack-slot-body {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; overflow: hidden;
}
.rack-slot-body a {
  display: inline-flex; align-items: center; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rack-slot-body a .icon { width: 14px; height: 14px; margin-right: 4px; flex-shrink: 0; }
.rack-slot-meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rack-slot-remove { flex-shrink: 0; }
.rack-slot-remove button {
  background: none; border: none; color: var(--down); cursor: pointer;
  font-size: 13px; padding: 2px 4px; line-height: 1;
}
.rack-elevation-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.rack-elevation-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

.rack-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 16px; padding: 0 3px; border-radius: 3px;
  font-family: var(--mono); font-size: 9px; font-weight: 700; color: #fff;
  flex-shrink: 0; letter-spacing: 0.2px;
}

/* ---- popup toast notifications (live alerts + action confirmations) ---- */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  max-width: 380px; pointer-events: none;
}
.toast {
  pointer-events: auto; width: 100%; border-radius: 10px; padding: 12px 14px;
  color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  display: flex; gap: 10px; align-items: flex-start;
  animation: toast-in 0.25s ease-out;
}
.toast-danger { background: var(--down); }
.toast-success { background: var(--up); }
.toast-warn { background: var(--warn); color: #1a1400; }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.toast-message { font-size: 12px; opacity: 0.92; white-space: pre-line; word-break: break-word; }
.toast-close { background: none; border: none; color: inherit; opacity: 0.7; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; flex-shrink: 0; }
.toast-close:hover { opacity: 1; }
.toast.toast-leaving { animation: toast-out 0.2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.toast-leaving { animation: none; }
}

/* =====================================================================
   Visual polish layer -- purely additive overrides of the rules above
   (softer surfaces, depth, motion, focus states). Theme-aware: every
   colour comes from the existing custom properties.
   ===================================================================== */
:root {
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.22);
  --shadow-md: 0 1px 2px rgba(0,0,0,0.20), 0 10px 28px -14px rgba(0,0,0,0.55);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
:root[data-theme="light"] {
  --shadow-sm: 0 1px 2px rgba(20,30,50,0.06);
  --shadow-md: 0 1px 2px rgba(20,30,50,0.05), 0 10px 26px -14px rgba(20,30,50,0.18);
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  background:
    radial-gradient(1100px 420px at 85% -120px, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* surfaces */
.card, .stat-tile {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.stat-tile .num { letter-spacing: -0.5px; }
.stat-tile.up { border-top: 2px solid var(--up); }
.stat-tile.down { border-top: 2px solid var(--down); }
.stat-tile.warn { border-top: 2px solid var(--warn); }

.topbar { background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow-sm); }
.page-header h1 { font-size: 21px; letter-spacing: -0.2px; }

/* sidebar */
.sidebar { box-shadow: 1px 0 0 var(--border), 6px 0 24px -18px rgba(0,0,0,0.6); }
.sidebar-nav a { border-radius: var(--radius-sm); transition: background 0.12s ease, color 0.12s ease, padding 0.12s ease; }
.sidebar-nav a:hover { padding-left: 15px; }
.app-shell.sidebar-collapsed .sidebar-nav a:hover { padding-left: 0; }
.sidebar-nav a.active {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-2));
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-group-title { letter-spacing: 0.9px; opacity: 0.9; }

/* buttons */
.btn { border-radius: var(--radius-sm); transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease; }
.btn:hover { background: color-mix(in srgb, var(--accent) 8%, var(--panel-2)); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); box-shadow: 0 4px 14px -6px var(--accent); }
.btn-danger:hover { box-shadow: 0 0 0 1px var(--down) inset; }

/* forms */
input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
  border-radius: var(--radius-sm); transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus { box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

/* tables */
table { border-collapse: separate; border-spacing: 0; }
tr:last-child > td { border-bottom: none; }
tbody tr, table > tr { transition: background 0.1s ease; }
tbody tr:hover > td, table > tr:hover > td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
th { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.card > table:first-child th:first-child, .card > table th:first-child { border-top-left-radius: 0; }

/* pills / tags / alerts */
.status-pill { padding: 3px 10px; font-weight: 500; letter-spacing: 0.1px; }
.status-up { background: color-mix(in srgb, var(--up) 12%, transparent); }
.status-down { background: color-mix(in srgb, var(--down) 12%, transparent); }
.status-warn { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.status-unknown { background: color-mix(in srgb, var(--muted) 12%, transparent); }
.vendor-tag { border-radius: 6px; }
.alert { border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* content fades in instead of popping */
.main-col > *:not(.topbar) { animation: np-fade 0.18s ease-out both; }
@keyframes np-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}


/* =====================================================================
   NetMiko brand theme: navy surfaces, brand mark + wordmark, gradient
   KPI tiles, panels and hand-rolled charts (see dashboard.html/.js)
   ===================================================================== */
:root { --grad: linear-gradient(135deg, #2f7bff 0%, #6a5cff 100%); }

body {
  background:
    radial-gradient(900px 380px at 82% -140px, rgba(59,130,246,0.16), transparent 70%),
    radial-gradient(700px 500px at -10% 110%, rgba(124,92,255,0.10), transparent 65%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-theme="light"] body { background: var(--bg); }

.sidebar { background: linear-gradient(180deg, #0b1a36 0%, #071022 100%); }
:root[data-theme="light"] .sidebar { background: var(--panel); }

/* brand */
.sidebar-brand { padding: 16px 14px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { height: 38px; width: auto; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(47,123,255,0.35)); }
.brand-word { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.brand-text { font-size: 25px; font-weight: 800; letter-spacing: -0.8px; }
.bw-net { color: var(--text); }
.bw-miko { background: linear-gradient(90deg, #22d3ee, #2f7bff 70%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tag { font-size: 8.5px; letter-spacing: 0.2px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.app-shell.sidebar-collapsed .sidebar-brand { flex-direction: column; gap: 10px; }
.app-shell.sidebar-collapsed .sidebar-brand .brand { display: flex; }
.app-shell.sidebar-collapsed .brand-word { display: none; }
.app-shell.sidebar-collapsed .brand-mark { height: 30px; }

/* nav: filled gradient active pill */
.sidebar-nav a.active {
  background: var(--grad); color: #fff; box-shadow: 0 6px 18px -8px rgba(59,110,255,0.9);
}
.sidebar-nav a.active .icon { color: #fff; }
.sidebar-nav a:hover { padding-left: 12px; }
.app-shell.sidebar-collapsed .sidebar-nav a:hover { padding-left: 0; }
:root[data-theme="light"] .sidebar-nav a.active { color: #fff; }

/* topbar: search, bell */
.topbar { padding: 12px 24px; gap: 14px; }
.topbar-search {
  display: flex; align-items: center; gap: 10px; flex: 0 1 460px; min-width: 160px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; height: 40px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.topbar-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.topbar-search .icon { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.topbar-search input { flex: 1; min-width: 0; background: none !important; border: none !important; box-shadow: none !important; padding: 0 !important; color: var(--text); font-size: 13px; outline: none; }
.topbar-search kbd { font-family: var(--mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.topbar-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; color: var(--text); margin: 0 6px;
}
.topbar-bell:hover { background: var(--panel-2); text-decoration: none; }
.topbar-bell .icon { width: 20px; height: 20px; }
.bell-badge {
  position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--down); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.bell-badge[hidden] { display: none; }
@media (max-width: 760px) { .topbar-search kbd { display: none; } }

/* footer */
.app-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 24px 18px;
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 8px;
}
.app-footer-links { display: flex; gap: 18px; }

/* dashboard hero */
.dash-hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-welcome { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -0.4px; }
.dash-sub { color: var(--muted); margin-top: 6px; font-size: 14px; }
.dash-hero-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 12px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--border); color: var(--text);
  box-shadow: var(--shadow-sm);
}
.hero-card:hover { text-decoration: none; }
.hero-card .icon-lg { width: 26px; height: 26px; color: var(--muted); }
.hero-card-title { font-weight: 700; font-size: 14px; }
.hero-card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hero-status.ok { border-color: color-mix(in srgb, var(--up) 45%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, var(--up) 14%, var(--panel)), var(--panel)); }
.hero-status.ok .hero-card-title { color: var(--up); }
.hero-status.bad { border-color: color-mix(in srgb, var(--down) 50%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, var(--down) 14%, var(--panel)), var(--panel)); }
.hero-status.bad .hero-card-title { color: var(--down); }
.hero-dot { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; background: var(--up); box-shadow: 0 0 0 6px color-mix(in srgb, var(--up) 22%, transparent), 0 0 18px var(--up); }
.hero-status.bad .hero-dot { background: var(--down); box-shadow: 0 0 0 6px color-mix(in srgb, var(--down) 22%, transparent), 0 0 18px var(--down); }

/* KPI tiles */
.kpi-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
@media (max-width: 1250px) { .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border-radius: 14px;
  color: var(--text); border: 1px solid var(--kpi-border); overflow: hidden;
  background: linear-gradient(145deg, var(--kpi-a), var(--kpi-b));
  box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.kpi:hover, .kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--kpi-icon-bg); color: var(--kpi-fg); flex-shrink: 0; }
.kpi-icon .icon-lg { width: 24px; height: 24px; }
.kpi-num { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -0.6px; }
.kpi-label { color: color-mix(in srgb, var(--text) 78%, transparent); font-size: 13px; margin-top: 4px; }
.kpi-foot { flex-basis: 100%; font-size: 11.5px; color: var(--kpi-fg); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi-blue { --kpi-a: #143a86; --kpi-b: #0d2456; --kpi-border: #24509f; --kpi-fg: #6fb0ff; --kpi-icon-bg: rgba(59,130,246,0.22); }
.kpi-green { --kpi-a: #0d4a3f; --kpi-b: #0a2f32; --kpi-border: #1c7a63; --kpi-fg: #43e0aa; --kpi-icon-bg: rgba(47,216,160,0.20); }
.kpi-red { --kpi-a: #5a1c2b; --kpi-b: #34101f; --kpi-border: #92324a; --kpi-fg: #ff7b8a; --kpi-icon-bg: rgba(255,93,108,0.20); }
.kpi-purple { --kpi-a: #3a2a86; --kpi-b: #211a55; --kpi-border: #5b46bd; --kpi-fg: #b8a4ff; --kpi-icon-bg: rgba(124,92,255,0.24); }
.kpi-amber { --kpi-a: #6a4413; --kpi-b: #3d270b; --kpi-border: #a06a1f; --kpi-fg: #ffc46b; --kpi-icon-bg: rgba(255,180,84,0.22); }
:root[data-theme="light"] .kpi { color: #fff; }
:root[data-theme="light"] .kpi-label { color: rgba(255,255,255,0.85); }
.kpi .dot, .donut-legend .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.kpi .dot.up, .donut-legend .dot.up { background: var(--up); } .kpi .dot.down, .donut-legend .dot.down { background: var(--down); } .kpi .dot.unk, .donut-legend .dot.unk { background: var(--muted); }
.kpi-row-sm { grid-template-columns: repeat(2, minmax(0, 260px)); }
.kpi-mini { padding: 12px 16px; background: var(--panel); border-color: var(--border); }
.kpi-mini .icon-lg { color: var(--muted); }
.kpi-mini-down { border-color: color-mix(in srgb, var(--down) 55%, var(--border)); }
.kpi-mini-down .icon-lg, .kpi-mini-down .kpi-num-sm { color: var(--down); }
.kpi-num-sm { font-size: 22px; font-weight: 800; line-height: 1; }

/* panels */
.chart-row { display: grid; grid-template-columns: 1fr 1.25fr 1.25fr; gap: 14px; margin-bottom: 14px; }
.table-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 1250px) { .chart-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .chart-row, .table-row { grid-template-columns: 1fr; } }
.panel {
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 55%, var(--panel)), var(--panel));
  border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-width: 0; box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(59,130,246,0.16); color: #6fb0ff; flex-shrink: 0; }
.panel-icon .icon { width: 20px; height: 20px; }
.panel-icon-red { background: rgba(255,93,108,0.16); color: var(--down); }
.panel-icon-green { background: rgba(47,216,160,0.16); color: var(--up); }
.panel-title { font-weight: 700; font-size: 15px; }
.panel-sub, .panel-sub-inline { color: var(--muted); font-size: 12px; font-weight: 400; }
.panel-action { margin-left: auto; }
.panel-stat { margin-left: auto; text-align: right; display: flex; flex-direction: column; }
.panel-stat b { color: var(--up); font-size: 20px; line-height: 1.1; }
.panel-stat span { color: var(--muted); font-size: 11px; }
.panel table th { background: transparent; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut { width: 150px; height: 150px; flex-shrink: 0; }
.donut-num { font-size: 28px; font-weight: 800; fill: var(--text); }
.donut-label { font-size: 11px; fill: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 13px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.donut-legend b { margin-left: 14px; font-family: var(--mono); font-weight: 500; }

.chart { position: relative; height: 210px; }
.chart-svg { width: 100%; height: 100%; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-tick { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.chart-legend { display: flex; gap: 14px; justify-content: flex-end; font-size: 12px; color: var(--muted); margin: -6px 0 2px; }
.chart-legend .ld { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.ld.in { background: #3b82f6; } .ld.out { background: #a78bfa; }
.chart-tip {
  position: absolute; top: 8px; z-index: 3; pointer-events: none; min-width: 110px; padding: 8px 10px; font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-md);
}
.chart-tip[hidden] { display: none; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* keep the general cards consistent with the panels */
.card { background: linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 40%, var(--panel)), var(--panel)); }
:root[data-theme="light"] .card, :root[data-theme="light"] .panel { background: var(--panel); }

.sidebar-brand { padding: 14px 10px; gap: 8px; }
.brand-mark { height: 34px; }
.brand-text { font-size: 23px; }
.brand-tag { font-size: 7.5px; letter-spacing: 0; }
.nowrap { white-space: nowrap; }

.brand-tag { white-space: normal; line-height: 1.25; font-size: 7.5px; }
.kpi { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 12px; }
.kpi-foot { grid-column: 1 / -1; }
.kpi-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-mini { display: flex; }
.kpi-label { white-space: normal; font-size: 12.5px; overflow: visible; text-overflow: clip; }

/* =====================================================================
   Creative layer (all pages): dotted "network" backdrop, gradient icon
   chips on page titles, glowing card edges, pill tabs, animated
   navigation bar. Everything hangs off classes the templates already use.
   ===================================================================== */
body:not(.lg)::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 22%, transparent) 1px, transparent 1.2px);
  background-size: 28px 28px; opacity: 0.5;
  -webkit-mask-image: radial-gradient(ellipse at 70% 0%, #000 0%, transparent 70%); mask-image: radial-gradient(ellipse at 70% 0%, #000 0%, transparent 70%);
}
.app-shell { position: relative; z-index: 1; }

.container { max-width: 1500px; padding: 26px 30px 34px; }

/* page titles */
.page-header { padding-bottom: 14px; margin-bottom: 20px; position: relative; }
.page-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, var(--accent), var(--accent-2) 35%, transparent 80%); opacity: 0.55; }
.page-header h1 .icon {
  box-sizing: content-box; width: 20px; height: 20px; padding: 8px; margin-right: 12px; vertical-align: -11px;
  color: #fff; background: var(--grad); border-radius: 12px; box-shadow: 0 10px 20px -10px rgba(59,110,255,0.95);
}
.page-header h1 { font-size: 22px; letter-spacing: -0.3px; }
.page-header .sub { margin-top: 6px; }

/* cards */
.card { position: relative; }
.card::before { content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 65%, transparent), transparent); opacity: 0.55; pointer-events: none; }
.card[style*="padding:0"], .card[style*="padding: 0"] { overflow: hidden; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.card > strong:first-child { display: inline-block; font-size: 15px; letter-spacing: -0.1px; }

/* tables */
th { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--panel-2)), transparent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border)); color: color-mix(in srgb, var(--muted) 85%, var(--text)); }
tr:hover > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
td a { font-weight: 500; }

/* buttons & tabs */
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--grad); filter: brightness(1.1); }
.term-tabs { gap: 8px; }
.term-tabs button, .term-tabs a { border-radius: 999px; padding: 6px 14px; transition: all 0.14s ease; }
.term-tabs a:hover, .term-tabs button:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.term-tabs a.active, .term-tabs button.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -10px rgba(59,110,255,0.95); }

/* alerts & empty states */
.alert { border-left-width: 4px; }
.alert-error { border-left-color: var(--down); }
.alert-info { border-left-color: var(--accent); }
.empty-state { padding: 46px 20px; }
.empty-state::before {
  content: ""; display: block; width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--accent) 55%, transparent), color-mix(in srgb, var(--accent-2) 18%, transparent) 70%);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 0 34px -8px var(--accent);
  animation: np-breathe 3.6s ease-in-out infinite;
}
@keyframes np-breathe { 0%,100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.07); opacity: 1; } }

/* stat tiles on inner pages */
.stat-tile { background: linear-gradient(145deg, color-mix(in srgb, var(--panel-2) 70%, var(--panel)), var(--panel)); }
.stat-tile .num { background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 70%, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-tile.up .num { background: none; color: var(--up); } .stat-tile.down .num { background: none; color: var(--down); } .stat-tile.warn .num { background: none; color: var(--warn); }

/* sidebar accents */
.sidebar-group-title::before { content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 8px; vertical-align: middle; border-radius: 2px; background: var(--grad); opacity: 0.8; }
.app-shell.sidebar-collapsed .sidebar-group-title::before { display: none; }
.sidebar-nav a:not(.active):hover .icon { color: var(--accent); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); opacity: 0.5; }

/* navigation progress bar */
#np-bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 9999; pointer-events: none; background: linear-gradient(90deg, #22d3ee, #2f7bff, #7c5cff); box-shadow: 0 0 12px rgba(47,123,255,0.9); opacity: 0; transition: width 0.4s ease, opacity 0.25s ease; }
#np-bar.run { opacity: 1; width: 78%; transition: width 6s cubic-bezier(0.1, 0.6, 0.2, 1); }
.container { width: 100%; }

/* dashboard: everything that looks clickable is */
a.kpi { cursor: pointer; color: var(--text); }
a.kpi:hover { text-decoration: none; }
a.kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a.kpi::after { content: "\203A"; position: absolute; top: 10px; right: 14px; font-size: 20px; line-height: 1; opacity: 0; transform: translateX(-4px); transition: all 0.15s ease; color: var(--kpi-fg); }
a.kpi:hover::after { opacity: 0.9; transform: none; }
.legend-link { display: flex; align-items: center; gap: 8px; color: var(--text); width: 100%; padding: 2px 6px; margin: -2px -6px; border-radius: 8px; }
.legend-link:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); text-decoration: none; }
.panel-link { color: var(--text); }
.panel-link:hover { color: var(--accent); text-decoration: none; }
tr.row-link { cursor: pointer; }
.hero-card { cursor: default; } a.hero-card { cursor: pointer; }
a.hero-card:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ports page, dashboard style */
.kpi-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpi-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
button.kpi { font: inherit; text-align: left; cursor: pointer; width: 100%; }
.stat-tile.kpi { min-width: 0; }
.stat-tile.kpi .num { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--text); font-size: 30px; font-family: var(--sans); }
.kpi.ports-active-filter, button.stat-tile.kpi.ports-active-filter { border-color: #fff; box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); transform: translateY(-2px); }
.seg-toggle { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.seg-toggle a { padding: 8px 16px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; }
.seg-toggle a:hover { text-decoration: none; color: var(--text); }
.seg-toggle a.on { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(59,110,255,0.95); }
.ports-insights { grid-template-columns: 1fr 1.2fr 1.2fr; }
@media (max-width: 1100px) { .ports-insights { grid-template-columns: 1fr; } }
.ports-mini { width: 100%; }
.ports-mini td { padding: 8px 6px; }
.ports-mini-sub { font-size: 11px; margin-top: 2px; }
.ports-mini-alias { font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ports-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 16px; }
.ports-search-box { flex: 0 1 420px; }
.ports-role-group { border-radius: 14px; overflow: hidden; }
.ports-role-summary { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, var(--panel-2)), transparent); }
.ports-role-summary .ports-group-name { font-size: 16px; }
.ports-group { border-radius: 12px; overflow: hidden; }
.ports-group-summary { transition: background 0.12s ease; }
.ports-group-summary:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.ports-chevron { color: var(--accent); }
.ports-util-bar { height: 7px; border-radius: 6px; background: color-mix(in srgb, var(--muted) 18%, transparent); }
.ports-util-fill { background: linear-gradient(90deg, #22d3ee, #2f7bff); border-radius: 6px; box-shadow: 0 0 8px rgba(47,123,255,0.5); }
.ports-compact-table tr.ports-row:hover > td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ports-rename-form input { border-radius: 8px; }

/* devices page */
.seg-count { margin-left: 4px; font-size: 11px; opacity: 0.75; font-family: var(--mono); }
.seg-toggle a.on .seg-count { opacity: 0.95; }
.dev-toolbar { justify-content: space-between; }
.dev-panel { padding: 6px 12px 10px; }
.dev-table th { background: transparent; }
.dev-table td { padding: 11px 10px; }
.dev-name { font-weight: 600; margin-right: 6px; }
.dev-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 10px; vertical-align: middle; background: var(--muted); }
.dev-dot-up { background: var(--up); box-shadow: 0 0 8px var(--up); }
.dev-dot-down { background: var(--down); box-shadow: 0 0 8px var(--down); animation: np-breathe 2s ease-in-out infinite; }
.chip { display: inline-block; font-family: var(--mono); font-size: 10.5px; padding: 2px 8px; margin-right: 4px; border-radius: 999px; color: var(--muted); border: 1px solid var(--border); background: color-mix(in srgb, var(--muted) 8%, transparent); }
.chip-accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Devices: live status */
.live-badge{display:inline-flex;align-items:center;gap:6px;color:var(--up);font-weight:600}
.live-badge .live-dot{width:8px;height:8px;border-radius:50%;background:var(--up);animation:live-pulse 1.6s infinite}
.live-badge.live-off{color:var(--muted)}
.live-badge.live-off .live-dot{background:var(--muted);animation:none}
@keyframes live-pulse{0%{box-shadow:0 0 0 0 rgba(34,197,94,.55)}70%{box-shadow:0 0 0 7px rgba(34,197,94,0)}100%{box-shadow:0 0 0 0 rgba(34,197,94,0)}}
tr.row-flash{animation:row-flash 2.5s ease-out}
@keyframes row-flash{0%{background:rgba(59,130,246,.28)}100%{background:transparent}}
.alert-warn{background:rgba(245,158,11,.1);border:1px solid rgba(245,158,11,.45);color:#fbbf24}
.alert-warn .muted{color:inherit;opacity:.75}

/* Network map header */
.crumbs{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);margin-bottom:10px}
.crumbs a{color:var(--muted);display:inline-flex;align-items:center}
.crumbs a:hover{color:var(--accent)}
.crumbs .icon{width:16px;height:16px}
.crumbs b{color:var(--text);font-weight:600}
.wm-card .topology-toolbar{padding:6px 4px 10px}
.wm-card .topology-legend{display:flex;gap:16px;flex-wrap:wrap;font-size:12.5px;align-items:center}

/* ============ Mockup look: light default, navy sidebar, pastel KPIs ============ */
:root[data-theme="light"] {
  --bg: #eef3fb; --panel: #ffffff; --panel-2: #f3f7fd; --border: #e0e8f4;
  --text: #14213d; --muted: #6b7a99; --accent: #2f6bff; --accent-2: #7c5cff;
  --up: #12b981; --down: #ef4444; --warn: #d98a0b;
  --shadow-sm: 0 1px 2px rgba(30,60,120,0.06), 0 4px 14px -8px rgba(30,60,120,0.12);
  --shadow-md: 0 2px 4px rgba(30,60,120,0.06), 0 14px 30px -14px rgba(30,60,120,0.22);
}
:root[data-theme="light"] body {
  background:
    radial-gradient(900px 360px at 88% -120px, rgba(47,107,255,0.12), transparent 70%),
    linear-gradient(180deg, #f3f7fd 0%, #e9f0fb 100%);
  background-attachment: fixed;
}
/* navy sidebar in both themes */
:root[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #0c1d3f 0%, #071022 100%);
  --text: #e3ecff; --muted: #8ea3c7; --border: rgba(255,255,255,0.08); --panel-2: rgba(255,255,255,0.06);
  color: var(--text);
}
:root[data-theme="light"] .sidebar .bw-net { color: #fff; }
:root[data-theme="light"] .sidebar-nav a { color: #b9c8e6; }
:root[data-theme="light"] .sidebar-nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
:root[data-theme="light"] .sidebar-nav a.active { color: #fff; }
:root[data-theme="light"] .sidebar-group-title { color: #6f86b3; }
:root[data-theme="light"] .sidebar-toggle { color: #cfe0ff; }
:root[data-theme="light"] .topbar { background: rgba(255,255,255,0.85); border-bottom: 1px solid var(--border); }
:root[data-theme="light"] .topbar-search { background: #fff; }
/* pastel KPI tiles */
:root[data-theme="light"] .kpi { color: var(--text); }
:root[data-theme="light"] .kpi-label { color: var(--muted); }
:root[data-theme="light"] .kpi-blue   { --kpi-a: #f4f8ff; --kpi-b: #e6f0ff; --kpi-border: #d3e3ff; --kpi-fg: #2f6bff; --kpi-icon-bg: #d6e6ff; }
:root[data-theme="light"] .kpi-green  { --kpi-a: #f2fcf7; --kpi-b: #e0f7ec; --kpi-border: #c7f0dd; --kpi-fg: #0f9d6b; --kpi-icon-bg: #c9f1de; }
:root[data-theme="light"] .kpi-red    { --kpi-a: #fff6f6; --kpi-b: #fdeaea; --kpi-border: #f8d3d3; --kpi-fg: #e23b3b; --kpi-icon-bg: #fbd6d6; }
:root[data-theme="light"] .kpi-purple { --kpi-a: #f8f5ff; --kpi-b: #eee8ff; --kpi-border: #e0d6ff; --kpi-fg: #6b4be0; --kpi-icon-bg: #e2d9ff; }
:root[data-theme="light"] .kpi-amber  { --kpi-a: #fffaf0; --kpi-b: #fff1d6; --kpi-border: #fbe3b0; --kpi-fg: #c47a05; --kpi-icon-bg: #fde8bd; }
:root[data-theme="light"] .hero-card, :root[data-theme="light"] .panel, :root[data-theme="light"] .card { background: #fff; border-color: var(--border); }
:root[data-theme="light"] .dash-welcome, :root[data-theme="light"] .page-header h1 { color: var(--text); }
:root[data-theme="light"] .dev-panel, :root[data-theme="light"] table th { background: #f6f9ff; }
:root[data-theme="light"] .hero-card:hover { border-color: var(--accent); }
/* sidebar footer card */
.sidebar-promo { position: relative; margin: 10px 14px 6px; padding: 14px; border-radius: 14px; min-height: 96px; overflow: hidden;
  background: linear-gradient(160deg, #10306e, #0a1c45); border: 1px solid #1d3f86; color: #dbe7ff; font-size: 12.5px; line-height: 1.35; }
.sidebar-promo b { color: #fff; font-size: 14px; }
.sidebar-promo-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46px; opacity: .9; }
.sidebar-version { text-align: center; color: #6f86b3; font-size: 11px; padding: 6px 0 14px; }
.app-shell.sidebar-collapsed .sidebar-promo, .app-shell.sidebar-collapsed .sidebar-version { display: none; }
/* topbar clock + theme switch */
.clock-block { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.clock-block .icon { width: 20px; height: 20px; color: var(--accent); }
.clock-text { display: flex; flex-direction: column; line-height: 1.2; }
.clock-text .clock { color: var(--text); font-weight: 600; font-size: 13px; }
.clock-tz { font-size: 10.5px; color: var(--muted); }
.theme-toggle { position: relative; width: 58px; height: 30px; padding: 0; border-radius: 999px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.theme-toggle .theme-toggle-moon, .theme-toggle .theme-toggle-sun { display: inline-flex !important; position: relative; z-index: 1; opacity: .55; }
.theme-toggle .icon { width: 15px; height: 15px; }
.theme-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--grad); transition: transform .18s ease; box-shadow: 0 2px 8px rgba(47,107,255,.5); }
:root[data-theme="light"] .theme-toggle::after { transform: translateX(0); }
:root:not([data-theme="light"]) .theme-toggle::after { transform: translateX(28px); }
:root[data-theme="light"] .theme-toggle-sun { color: #fff; opacity: 1; }
:root:not([data-theme="light"]) .theme-toggle-moon { color: #fff; opacity: 1; }
:root[data-theme="light"] .theme-toggle { background: #e6eefb; }
@media (max-width: 1100px) { .clock-tz { display: none; } }
.theme-toggle { flex-direction: row-reverse; }
.kpi-num { white-space: nowrap; }
.kpi-row:not(.kpi-row-4) .kpi-num { font-size: 26px; }

/* Port flapping badge */
.flap-badge{display:inline-flex;align-items:center;gap:4px;margin-left:6px;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:700;
  color:#b45309;background:rgba(245,158,11,.16);border:1px solid rgba(245,158,11,.5);white-space:nowrap}
.flap-badge::before{content:"";width:6px;height:6px;border-radius:50%;background:#f59e0b;animation:live-pulse 1.4s infinite}
:root:not([data-theme="light"]) .flap-badge{color:#fbbf24}

/* Phones: the top bar (clock + user name + role badge) is wider than a 360px screen and made every page scroll
   sideways. Trim it globally (the per-page copies in portal_simple.css / devpage_simple.css stay harmless). */
@media (max-width: 600px) {
  .topbar .clock-block, .topbar .user-menu-name, .topbar .user-menu .role-badge { display: none; }
  .topbar-right { gap: 8px; }
}
