/* ── Reset & tokens ─────────────────────────────────────────────────── */
:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  background: #07101b;
  color: #e8eef7;

  --topbar-h: 3.5rem;
  --sidenav-w: 13rem;
  --surface: rgba(10, 19, 31, 0.84);
  --border: rgba(148, 163, 184, 0.16);
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --muted: #9fb2ca;
  --eyebrow: #8bb8ff;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(61, 130, 246, 0.12), transparent 40%),
    linear-gradient(180deg, #0b1523 0%, #07101b 100%);
}

/* ── Utility ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.stack { display: flex; flex-direction: column; gap: 1rem; }

.row.between,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.muted { color: var(--muted); }
.small-text { font-size: 0.88rem; }

.eyebrow {
  color: var(--eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  margin: 0 0 0.4rem;
}

/* ── Card ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.4rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

/* ── Form elements ───────────────────────────────────────────────────── */
input, button, textarea { font: inherit; }

input {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #101b2b;
  color: #e8eef7;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

button {
  padding: 0.8rem 1.1rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.26);
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.secondary {
  background: rgba(30, 41, 59, 0.9);
  box-shadow: none;
}

button.small {
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  border-radius: 10px;
}

.icon-button {
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.9);
  box-shadow: none;
  font-size: 1.2rem;
  line-height: 1;
}

.form-status {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.92);
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.5;
}

.form-status.is-error {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.3);
  border-color: rgba(248, 113, 113, 0.45);
}

.form-status.is-success {
  color: #bfdbfe;
  background: rgba(30, 64, 175, 0.28);
  border-color: rgba(96, 165, 250, 0.38);
}

.forgot-link {
  text-align: center;
  margin: 0;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent, #60a5fa);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover { color: #93c5fd; }

.form-hint {
  margin: 0;
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.5;
}

/* ── Password reset overlay ──────────────────────────────────────────── */
.reset-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(59, 130, 246, 0.18), transparent),
    linear-gradient(180deg, #0b1523 0%, #07101b 100%);
}

.reset-card {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 2rem;
}

/* ── Auth gate (signed-out state) ────────────────────────────────────── */
.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(59, 130, 246, 0.18), transparent),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(56, 189, 248, 0.08), transparent),
    linear-gradient(180deg, #0b1523 0%, #07101b 100%);
}

.auth-gate-card {
  width: min(100%, 400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  padding: 2.5rem 2rem 2rem;
  background: rgba(10, 19, 31, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 28px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(59, 130, 246, 0.07);
  backdrop-filter: blur(20px);
}

.auth-gate-logo {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.15));
  border: 1px solid rgba(96, 165, 250, 0.3);
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
}

.auth-gate-logo-mark {
  font-size: 1.5rem;
  line-height: 1;
  color: #93c5fd;
}

.auth-gate-brand {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--eyebrow);
  margin: 0 0 0.5rem;
}

.auth-gate-title {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.auth-gate-copy {
  color: var(--muted);
  margin: 0 0 1.75rem;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* ── App context block (shown when coming from another app) ──────────── */
.app-context {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  margin-bottom: 1.1rem;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.app-context-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.app-context-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-context-label {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.3;
}

.app-context-name {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0;
  line-height: 1.3;
}

/* UP2 — verified / unregistered badge */
.app-context-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  border: 1px solid;
  margin-top: 0.2rem;
  width: fit-content;
}
.app-context-badge.verified {
  color: #86efac;
  border-color: rgba(134,239,172,0.4);
  background: rgba(134,239,172,0.08);
}
.app-context-badge.unverified {
  color: #fbbf24;
  border-color: rgba(251,191,36,0.4);
  background: rgba(251,191,36,0.08);
}

/* UP4 — escape hatch links between modals */
.escape-hatch {
  text-align: center;
  font-size: 0.83rem;
  color: #64748b;
  margin: 0.4rem 0 0;
}
.escape-hatch .link-btn {
  color: #818cf8;
}
.escape-hatch .link-btn:hover {
  color: #a5b4fc;
}

.auth-gate-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  width: 100%;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-gate-actions button {
  flex: 1;
  min-width: 7rem;
}

.status-copy {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.5;
}

/* ── App shell ───────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Admin panel (separate full-screen shell) ────────────────────────── */
.admin-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  border-bottom-color: rgba(239, 68, 68, 0.25);
  background: rgba(25, 10, 10, 0.94);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.admin-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.admin-back-btn:hover {
  color: #e8eef7;
  background: rgba(255, 255, 255, 0.1);
}

.sidenav-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem 0.9rem 0.25rem;
  margin: 0;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(7, 16, 27, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.topbar-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--eyebrow);
  letter-spacing: 0.04em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-identity {
  font-size: 0.9rem;
  color: var(--muted);
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(74, 222, 128, 0.28);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.risk-badge::before {
  content: "●";
  font-size: 0.6rem;
}

.risk-badge.is-watch {
  border-color: rgba(250, 204, 21, 0.3);
  background: rgba(250, 204, 21, 0.12);
  color: #fde68a;
}

.risk-badge.is-alert {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

/* Layout */
.layout {
  display: flex;
  flex: 1;
}

/* Side nav */
.sidenav {
  width: var(--sidenav-w);
  flex-shrink: 0;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-right: 1px solid var(--border);
  background: rgba(7, 16, 27, 0.6);
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #e8eef7;
  transform: none;
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.18);
  color: #e8eef7;
  box-shadow: none;
}

/* Content area */
.content {
  flex: 1;
  padding: 2rem 2rem 3rem;
  overflow-y: auto;
}

.page { display: none; }
.page.active { display: block; }

.page-title {
  margin: 0 0 1.5rem;
  font-size: 1.4rem;
  font-weight: 700;
}

/* ── Page header row ──────────────────────────────────────────────────── */
.page-header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header-row .page-title { margin-bottom: 0; }

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.14);
  color: #fde68a;
  border: 1px solid rgba(253, 224, 71, 0.3);
}

.platform-badge::before { content: "★"; font-size: 0.65rem; }

.count-badge {
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 1.6rem;
  text-align: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.28);
}

/* ── Overview page ───────────────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.identity-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.identity-avatar {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(59,130,246,0.35), rgba(37,99,235,0.2));
  border: 1px solid rgba(96,165,250,0.3);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #93c5fd;
  flex-shrink: 0;
}

.identity-info { display: flex; flex-direction: column; gap: 0.2rem; }

.identity-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.stat-card { display: flex; flex-direction: column; gap: 0.25rem; }

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  color: var(--blue);
}

/* ── Section block (shared between pages) ────────────────────────────── */
.section-block { margin-top: 0.5rem; }

.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

/* ── Page header ─────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header .page-title { margin-bottom: 0.25rem; }
.page-subtitle { color: var(--muted); font-size: 0.92rem; margin: 0; }

/* ── Security page ────────────────────────────────────────────────────── */
.security-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.security-hero-card,
.security-map-card,
.security-feed-card {
  position: relative;
  overflow: hidden;
}

.security-hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 20rem;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.16), transparent 38%),
    radial-gradient(circle at bottom left, rgba(34, 197, 94, 0.12), transparent 42%),
    var(--surface);
}

.security-hero-title,
.security-map-title,
.security-feed-title {
  margin: 0;
  font-size: 1.15rem;
}

.security-hero-copy,
.security-feed-note {
  margin: 0.65rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.security-stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.security-stat-pill {
  border-radius: 16px;
  border: 1px solid rgba(96, 165, 250, 0.2);
  background: rgba(15, 23, 42, 0.42);
  padding: 0.85rem 0.95rem;
}

.security-stat-pill--alert {
  border-color: rgba(250, 204, 21, 0.24);
  background: rgba(113, 63, 18, 0.12);
}

.security-stat-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.security-stat-pill strong {
  font-size: 1.35rem;
  color: #e2e8f0;
}

.security-map-card {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.15), transparent 32%),
    linear-gradient(180deg, rgba(8, 15, 27, 0.96), rgba(5, 11, 20, 0.96));
}

.security-map-header,
.security-feed-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.security-map-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.22);
  color: #bfdbfe;
  font-size: 0.76rem;
}

.security-map-shell {
  position: relative;
  min-height: 23rem;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(2, 8, 23, 0.78), rgba(7, 20, 38, 0.96));
  border: 1px solid rgba(96, 165, 250, 0.14);
}

.security-map-canvas {
  width: 100%;
  height: 23rem;
  min-height: 23rem;
}

.security-map-shell--leaflet .leaflet-container {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(2, 8, 23, 0.78), rgba(7, 20, 38, 0.96));
  font: inherit;
}

.security-map-shell--leaflet .leaflet-tile {
  filter: saturate(0.92) contrast(0.96) brightness(0.97);
}

.security-map-shell--leaflet .leaflet-control-zoom {
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.28);
  border-radius: 16px;
  overflow: hidden;
}

.security-map-shell--leaflet .leaflet-control-zoom a {
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  border-bottom-color: rgba(148, 163, 184, 0.16);
  width: 2.2rem;
  height: 2.2rem;
  line-height: 2.2rem;
  font-size: 1.1rem;
}

.security-map-shell--leaflet .leaflet-control-zoom a:hover {
  background: rgba(30, 41, 59, 0.96);
  color: #f8fafc;
}

.security-map-shell--leaflet .leaflet-control-attribution {
  background: rgba(2, 6, 23, 0.76);
  color: #cbd5e1;
  padding: 0.12rem 0.4rem;
}

.security-map-shell--leaflet .leaflet-control-attribution a {
  color: #bfdbfe;
}

.security-map-shell--leaflet .leaflet-popup-content-wrapper {
  background: rgba(2, 6, 23, 0.94);
  color: #e2e8f0;
  border: 1px solid rgba(96, 165, 250, 0.2);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.38);
}

.security-map-shell--leaflet .leaflet-popup-tip {
  background: rgba(2, 6, 23, 0.94);
}

.security-map-shell--leaflet .leaflet-popup-close-button {
  color: #cbd5e1;
}

.security-map-shell--leaflet .leaflet-popup-close-button:hover {
  color: #f8fafc;
}

.security-map-svg {
  width: 100%;
  height: 100%;
  min-height: 23rem;
  display: block;
}

.security-map-ocean {
  fill: rgba(5, 11, 22, 0.96);
}

.security-map-grid path {
  stroke: rgba(56, 189, 248, 0.12);
  stroke-width: 1;
}

.security-map-land path {
  fill: rgba(37, 99, 235, 0.12);
  stroke: rgba(96, 165, 250, 0.2);
  stroke-width: 2;
}

.security-map-markers {
  position: absolute;
  inset: 0;
}

.security-map-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.security-map-connections line {
  stroke: rgba(96, 165, 250, 0.3);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 7 8;
}

.security-map-connections line.is-watch {
  stroke: rgba(250, 204, 21, 0.55);
}

.security-map-connections line.is-alert {
  stroke: rgba(248, 113, 113, 0.7);
  stroke-width: 4;
}

.security-map-connections circle {
  fill: rgba(148, 197, 255, 0.75);
}

.security-map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  pointer-events: none;
}

.security-map-marker-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: radial-gradient(circle, #38bdf8 0%, #2563eb 65%, rgba(37, 99, 235, 0.1) 100%);
  box-shadow: 0 0 0 8px rgba(56, 189, 248, 0.08), 0 0 18px rgba(56, 189, 248, 0.28);
}

.security-map-marker-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #dbeafe;
  text-transform: uppercase;
}

.security-feed-card {
  margin-top: 1rem;
}

.security-lower-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.security-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.security-activity-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.32);
}

.security-activity-icon {
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(37, 99, 235, 0.16);
  color: #bfdbfe;
  font-size: 1rem;
}

.security-activity-title {
  margin: 0 0 0.2rem;
  font-weight: 600;
}

.security-activity-meta,
.security-activity-time {
  color: var(--muted);
  font-size: 0.8rem;
}

.security-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.security-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.65);
  color: #cbd5e1;
  font-size: 0.72rem;
}

.security-chip.is-alert {
  background: rgba(127, 29, 29, 0.32);
  color: #fecaca;
}

.security-chip.is-watch {
  background: rgba(120, 53, 15, 0.28);
  color: #fde68a;
}

.security-signals-list,
.security-route-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.security-signal-item,
.security-route-item {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.28);
  padding: 0.9rem 1rem;
}

.security-signal-item.is-watch,
.security-route-item.is-watch {
  border-color: rgba(250, 204, 21, 0.22);
  background: rgba(92, 50, 12, 0.14);
}

.security-signal-item.is-alert,
.security-route-item.is-alert {
  border-color: rgba(248, 113, 113, 0.24);
  background: rgba(127, 29, 29, 0.14);
}

.security-signal-head,
.security-route-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.security-signal-title,
.security-route-title {
  margin: 0;
  font-weight: 600;
}

.security-signal-detail,
.security-route-copy {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.security-signal-state {
  flex-shrink: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bfdbfe;
}

.security-route-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.security-route-arrow {
  color: #60a5fa;
}

/* ── Return-to-app banner ────────────────────────────────────────────── */
.return-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.5rem;
  border-radius: 16px;
  background: rgba(30, 64, 175, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.return-banner-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.return-banner-icon {
  font-size: 1.3rem;
  color: #93c5fd;
  line-height: 1;
}

.return-banner-label {
  font-size: 0.78rem;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}

.return-banner-host {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
}

.return-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.return-countdown {
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 6rem;
  text-align: right;
}

/* ── Apps page ───────────────────────────────────────────────────────── */
.apps-list {
  display: grid;
  gap: 0.75rem;
}

.app-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-radius: 16px;
  background: rgba(10, 19, 31, 0.7);
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
}

.app-item:hover {
  background: rgba(16, 28, 46, 0.9);
  border-color: rgba(148, 163, 184, 0.28);
}

/* Offline card state */
.app-item-offline {
  opacity: 0.55;
  border-color: rgba(239, 68, 68, 0.18);
  background: rgba(30, 10, 10, 0.45);
  pointer-events: none; /* block accidental clicks on the whole card */
}
.app-item-offline .leave-app-btn,
.app-item-offline .app-offline-badge {
  pointer-events: auto; /* but keep these clickable */
}
.app-item-icon-offline {
  filter: grayscale(0.7);
}
.app-item-offline-msg {
  font-size: 0.75rem;
  color: #f87171;
  margin-top: 0.1rem;
}
.app-item-degraded-msg {
  font-size: 0.75rem;
  color: #fbbf24;
  margin-top: 0.1rem;
}
.app-offline-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  white-space: nowrap;
  pointer-events: none;
}
.app-launch-degraded {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

.app-item-left { display: flex; align-items: center; gap: 1rem; }

.app-item-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.2);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.app-item-info { display: flex; flex-direction: column; gap: 0.15rem; }
.app-item-name { font-weight: 600; font-size: 0.97rem; }
.app-item-slug { font-size: 0.8rem; color: var(--muted); font-family: monospace; }

.app-item-right { display: flex; align-items: center; gap: 0.75rem; }

/* ── Runtime status dot (launcher) ───────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #475569;
}
.status-dot-online   { background: #4ade80; box-shadow: 0 0 6px rgba(74, 222, 128, 0.5); }
.status-dot-offline  { background: #f87171; }
.status-dot-degraded { background: #fbbf24; box-shadow: 0 0 6px rgba(251, 191, 36, 0.4); }
.status-dot-unknown  { background: #475569; }

.role-badge {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.28);
  white-space: nowrap;
}

.role-badge.manager,
.role-badge.admin {
  background: rgba(234, 179, 8, 0.12);
  color: #fde68a;
  border-color: rgba(253, 224, 71, 0.28);
}

.app-launch-link {
  font-size: 0.82rem;
  color: #93c5fd;
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(96, 165, 250, 0.25);
  transition: background 0.15s;
  white-space: nowrap;
}

.app-launch-link:hover { background: rgba(59, 130, 246, 0.12); }

/* ── Settings page ───────────────────────────────────────────────────── */
.settings-group {
  margin-bottom: 1.75rem;
}

.settings-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.settings-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.95rem 1.3rem;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child { border-bottom: none; }

.settings-field-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-shrink: 0;
}

.settings-label {
  font-size: 0.92rem;
  font-weight: 500;
}

.settings-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.settings-value {
  font-size: 0.92rem;
  color: #cbd5e1;
  text-align: right;
  word-break: break-all;
}

.settings-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  min-width: 0;
}

.settings-edit-btn {
  opacity: 0.65;
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}

.settings-edit-btn:hover { opacity: 1; }

.settings-inline-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-inline-form input {
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  font-size: 0.88rem;
  width: 14rem;
}

.settings-inline-status {
  font-size: 0.82rem;
  margin: 0;
}

.settings-row--discord-link .settings-field-meta {
  max-width: 34rem;
}

.settings-row-right--discord-link {
  gap: 0.65rem;
}

.settings-inline-form--actions {
  justify-content: flex-end;
}

.discord-link-code-card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  padding: 0.7rem 0.85rem;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.3);
}

.discord-link-code-label,
.discord-link-code-meta {
  font-size: 0.82rem;
  color: #94a3b8;
}

.discord-link-code-card strong {
  font-size: 1.2rem;
  letter-spacing: 0.14em;
}

.profile-qr-row,
.profile-qr-preview-row {
  align-items: stretch;
}

.profile-qr-controls {
  width: min(100%, 24rem);
  align-items: stretch;
}

.profile-qr-select,
.profile-qr-input {
  width: 100%;
  padding: 0.68rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.46);
  color: var(--text);
}

.profile-qr-permissions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.26);
}

.profile-qr-permission-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.profile-qr-permission-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.48rem 0.68rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.58);
  color: #dbeafe;
  font-size: 0.82rem;
}

.profile-qr-permission-chip input {
  margin: 0;
}

.profile-qr-preview-card {
  width: min(100%, 16rem);
  padding: 0.85rem;
  border-radius: 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-qr-image {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 0.9rem;
  background: #fff;
}

.profile-qr-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.profile-qr-payload-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.profile-qr-payload {
  display: block;
  padding: 0.75rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.46);
  color: #dbeafe;
  word-break: break-word;
  white-space: pre-wrap;
}

.profile-qr-actions {
  justify-content: flex-start;
}

.settings-inline-status.is-error { color: #fca5a5; }
.settings-inline-status.is-success { color: #86efac; }

/* ── Password change stacked form ────────────────────────────────────── */
.settings-password-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
  max-width: 280px;
}

.settings-password-form input {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid rgba(148,163,184,0.25);
  background: rgba(15,23,42,0.6);
  color: #f1f5f9;
  width: 100%;
  box-sizing: border-box;
}

.settings-password-form .form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

/* ── Danger zone ─────────────────────────────────────────────────────── */
.settings-group--danger { margin-top: 2.5rem; }

.settings-group-title--danger { color: #f87171; }

.settings-card--danger {
  border-color: rgba(248,113,113,0.22);
  background: rgba(127,29,29,0.06);
}

.danger-btn {
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(248,113,113,0.35);
  font-size: 0.82rem;
  padding: 0.38rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.danger-btn:hover {
  background: rgba(248,113,113,0.12);
  border-color: rgba(248,113,113,0.6);
}

/* ── Delete account confirmation modal ───────────────────────────────── */
.delete-confirm-card {
  width: min(100%, 480px);
  padding: 2.25rem 2rem 1.75rem;
  text-align: center;
  border-color: rgba(248,113,113,0.28);
  background: rgba(10, 4, 4, 0.82);
}

.delete-confirm-icon {
  font-size: 3rem;
  line-height: 1;
  color: #f87171;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 18px rgba(248,113,113,0.45));
}

.delete-confirm-card h2 {
  color: #fca5a5;
  font-size: 1.35rem;
  margin: 0 0 0.85rem;
}

.delete-confirm-body {
  color: #94a3b8;
  font-size: 0.93rem;
  line-height: 1.65;
  margin: 0 0 1.25rem;
}

.delete-confirm-body strong { color: #f1f5f9; }

.delete-confirm-checklist {
  background: rgba(248,113,113,0.07);
  border: 1px solid rgba(248,113,113,0.18);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.delete-confirm-check {
  font-size: 0.85rem;
  color: #fca5a5;
}

.delete-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-delete-confirm {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 11px;
  border: 1px solid rgba(248,113,113,0.5);
  background: rgba(153,27,27,0.35);
  color: #fca5a5;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-delete-confirm:hover {
  background: rgba(185,28,28,0.55);
  border-color: rgba(248,113,113,0.75);
  color: #fff;
}

.btn-delete-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  padding: 1.35rem;
}

.modal-card h2 { margin: 0; line-height: 1.1; }

/* ── Admin page ──────────────────────────────────────────────────────── */
.admin-stats-grid {
  grid-template-columns: repeat(3, 1fr) !important;
}

.admin-activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-activity-map-card,
.admin-activity-feed-card {
  position: relative;
  overflow: hidden;
}

.admin-activity-map-card {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(8, 15, 27, 0.96), rgba(5, 11, 20, 0.94));
}

.admin-activity-stat-strip {
  margin: 0 0 1rem;
}

.admin-activity-map-shell {
  min-height: 21rem;
}

.admin-activity-feed-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-activity-usage {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.admin-usage-block {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.22);
  padding: 0.85rem 0.95rem;
}

.admin-usage-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.admin-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-activity-item {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.26);
  padding: 0.95rem 1rem;
}

.admin-activity-item.is-watch {
  border-color: rgba(250, 204, 21, 0.22);
  background: rgba(92, 50, 12, 0.14);
}

.admin-activity-item.is-alert {
  border-color: rgba(248, 113, 113, 0.24);
  background: rgba(127, 29, 29, 0.14);
}

.admin-activity-item-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.admin-activity-title {
  margin: 0;
  font-weight: 600;
}

.admin-activity-copy {
  margin: 0.32rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.admin-stats-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.admin-stats-location-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: -0.2rem 0 1rem;
}

.admin-stats-location-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.35);
  color: #cbd5e1;
  font-size: 0.86rem;
}

.admin-stats-location-pill.is-active {
  border-color: rgba(96, 165, 250, 0.3);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.68), rgba(15, 23, 42, 0.94));
  color: #eff6ff;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.18);
}

.admin-stats-location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.admin-stats-summary-grid {
  grid-template-columns: repeat(3, 1fr) !important;
  margin-bottom: 1rem;
}

.stat-number--sm {
  font-size: 1.35rem;
  line-height: 1.3;
}

.admin-stats-grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-stats-trend-card,
.admin-stats-map-card,
.admin-stats-breakdown-card,
.admin-stats-users-card {
  overflow: hidden;
}

.admin-stats-trend {
  min-height: 15rem;
  display: flex;
  align-items: stretch;
}

.admin-stats-map-card {
  margin-bottom: 1rem;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(8, 15, 27, 0.98), rgba(5, 11, 20, 0.96));
}

.admin-stats-map-shell {
  min-height: 31rem;
  height: 31rem;
  border: 1px solid rgba(96, 165, 250, 0.16);
  background: linear-gradient(180deg, rgba(2, 8, 23, 0.78), rgba(7, 20, 38, 0.96));
  box-shadow: inset 0 1px 0 rgba(191, 219, 254, 0.08), 0 24px 54px rgba(2, 6, 23, 0.28);
}

.admin-stats-map-canvas {
  width: 100%;
  height: 31rem;
  min-height: 31rem;
}

.admin-stats-map-overlay {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  right: 4.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  z-index: 500;
  pointer-events: none;
}

.admin-stats-map-overlay .security-chip {
  background: rgba(2, 6, 23, 0.68);
  border: 1px solid rgba(96, 165, 250, 0.2);
  color: #dbeafe;
  backdrop-filter: blur(12px);
}

.admin-stats-map-shell .leaflet-container {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(2, 8, 23, 0.78), rgba(7, 20, 38, 0.96));
  font: inherit;
}

.admin-stats-map-shell .leaflet-tile {
  filter: saturate(0.92) contrast(0.96) brightness(0.97);
}

.admin-stats-map-shell .leaflet-control-zoom {
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.28);
  border-radius: 16px;
  overflow: hidden;
}

.admin-stats-map-shell .leaflet-control-zoom a {
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  border-bottom-color: rgba(148, 163, 184, 0.16);
  width: 2.2rem;
  height: 2.2rem;
  line-height: 2.2rem;
  font-size: 1.1rem;
}

.admin-stats-map-shell .leaflet-control-zoom a:hover {
  background: rgba(30, 41, 59, 0.96);
  color: #f8fafc;
}

.admin-stats-map-shell .marker-cluster,
.admin-stats-map-shell .marker-cluster div {
  background: transparent;
  border: 0;
}

.admin-stats-map-shell .leaflet-control-attribution {
  background: rgba(2, 6, 23, 0.76);
  color: #cbd5e1;
  padding: 0.12rem 0.4rem;
  border-top-left-radius: 10px;
}

.admin-stats-map-shell .leaflet-control-attribution a {
  color: #bfdbfe;
}

.admin-stats-map-shell .leaflet-popup-content-wrapper {
  background: rgba(2, 6, 23, 0.94);
  color: #e2e8f0;
  border: 1px solid rgba(96, 165, 250, 0.2);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.38);
}

.admin-stats-map-shell .leaflet-popup-tip {
  background: rgba(2, 6, 23, 0.94);
}

.admin-stats-map-shell .leaflet-popup-close-button {
  color: #cbd5e1;
}

.admin-stats-map-shell .leaflet-popup-close-button:hover {
  color: #f8fafc;
}

.admin-map-popup {
  min-width: 16.5rem;
}

.admin-map-popup strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1rem;
}

.admin-map-popup p {
  margin: 0.28rem 0 0;
  color: #cbd5e1;
  line-height: 1.45;
}

.admin-map-popup .eyebrow {
  color: #93c5fd;
  margin-top: 0;
}

.admin-map-popup-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.admin-map-popup-stats > div {
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.16);
  background: rgba(15, 23, 42, 0.5);
  padding: 0.55rem 0.6rem;
}

.admin-map-popup-stats strong {
  margin-top: 0.14rem;
  font-size: 1.05rem;
}

.admin-map-popup-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.admin-map-popup-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  background: rgba(30, 41, 59, 0.58);
  color: #e2e8f0;
  font-size: 0.76rem;
  line-height: 1.2;
}

.admin-map-popup-chip.is-secondary {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
}

.admin-map-popup-meta {
  color: #94a3b8 !important;
  font-size: 0.78rem;
}

.admin-map-pin-wrapper {
  background: transparent;
  border: 0;
}

.admin-map-pin {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.4rem;
  padding: 0.35rem 0.75rem 0.35rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.26);
  background: rgba(8, 15, 27, 0.86);
  box-shadow: 0 16px 28px rgba(2, 6, 23, 0.28);
  color: #eff6ff;
  backdrop-filter: blur(10px);
}

.admin-map-pin.is-watch {
  border-color: rgba(250, 204, 21, 0.38);
}

.admin-map-pin.is-alert {
  border-color: rgba(251, 113, 133, 0.42);
}

.admin-map-pin.is-selected {
  transform: scale(1.04);
  box-shadow: 0 20px 36px rgba(37, 99, 235, 0.28);
}

.admin-map-pin-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  color: #eff6ff;
  font-weight: 800;
  font-size: 0.84rem;
}

.admin-map-pin.is-watch .admin-map-pin-count {
  background: linear-gradient(180deg, #fde68a, #f59e0b);
  color: #1f2937;
}

.admin-map-pin.is-alert .admin-map-pin-count {
  background: linear-gradient(180deg, #fda4af, #ef4444);
}

.admin-map-pin-label {
  max-width: 5.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
}

.admin-map-cluster-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-map-cluster-icon > span {
  display: block;
}

.admin-map-cluster-icon {
  width: 64px !important;
  height: 64px !important;
  margin-left: -32px !important;
  margin-top: -32px !important;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.26);
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.94), rgba(30, 64, 175, 0.96));
  box-shadow: 0 20px 40px rgba(30, 64, 175, 0.3);
  color: #eff6ff;
  text-align: center;
  padding-top: 0.72rem;
}

.admin-map-cluster-total {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
}

.admin-map-cluster-meta {
  margin-top: 0.2rem;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: rgba(239, 246, 255, 0.88);
}

.leaflet-tooltip.admin-map-tooltip {
  background: rgba(2, 6, 23, 0.88);
  border: 1px solid rgba(96, 165, 250, 0.2);
  color: #e2e8f0;
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
  font-weight: 700;
}

.leaflet-tooltip.admin-map-tooltip::before {
  border-top-color: rgba(96, 165, 250, 0.2);
}

.admin-stats-map-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.admin-map-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.22);
  padding: 0.8rem 0.9rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.admin-map-legend-item:hover,
.admin-map-legend-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(30, 41, 59, 0.38);
}

.admin-map-legend-item.is-active {
  border-color: rgba(96, 165, 250, 0.34);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.94));
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.14);
}

.admin-map-legend-item p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-trend-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 0.8rem;
  width: 100%;
  align-items: end;
}

.admin-trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 0.45rem;
  min-height: 14rem;
}

.admin-trend-count {
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-trend-bar {
  width: 100%;
  min-height: 14px;
  border-radius: 999px 999px 12px 12px;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.95), rgba(14, 165, 233, 0.42));
  box-shadow: 0 18px 30px rgba(56, 189, 248, 0.15);
}

.admin-trend-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-stats-breakdowns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.admin-rank-block {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.22);
  padding: 0.9rem;
}

.admin-rank-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.admin-rank-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.admin-rank-item--button {
  width: 100%;
  padding: 0.15rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: 12px;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.admin-rank-item--button:hover,
.admin-rank-item--button:focus-visible {
  background: rgba(30, 41, 59, 0.34);
  transform: translateY(-1px);
}

.admin-rank-item--button.is-active {
  background: rgba(37, 99, 235, 0.16);
}

.admin-rank-item p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-rank-index {
  width: 1.65rem;
  height: 1.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.24);
}

.admin-stats-user-table {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.admin-stats-user-head,
.admin-stats-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr) 90px 140px;
  gap: 0.85rem;
  align-items: center;
}

.admin-stats-user-head {
  padding: 0 0.2rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-stats-user-row {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.26);
  padding: 0.9rem 0.95rem;
}

.admin-stats-user-row.is-watch {
  border-color: rgba(250, 204, 21, 0.2);
}

.admin-stats-user-row.is-alert {
  border-color: rgba(248, 113, 113, 0.24);
}

.admin-stats-user-row strong {
  display: block;
}

.admin-stats-user-row p {
  margin: 0.22rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* ── Users page ──────────────────────────────────────────────────────── */
.users-search-row {
  margin-bottom: 1rem;
}

.users-search-row input[type="search"] {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(10, 19, 31, 0.84);
  color: #e8eef7;
  font-size: 0.92rem;
}

.users-security-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.users-security-stat {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.32);
  padding: 0.8rem 0.95rem;
}

.users-security-stat.is-watch {
  border-color: rgba(250, 204, 21, 0.2);
}

.users-security-stat.is-alert {
  border-color: rgba(248, 113, 113, 0.24);
}

.users-security-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.users-security-stat strong {
  font-size: 1.2rem;
}

.users-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.users-filter-btn {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.38);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.users-filter-btn.active {
  border-color: rgba(96, 165, 250, 0.34);
  background: rgba(30, 64, 175, 0.22);
  color: #dbeafe;
}

.users-list { display: flex; flex-direction: column; }

.user-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.user-row:last-child { border-bottom: none; }
.user-row:hover { background: rgba(59, 130, 246, 0.06); }

.user-row.user-row--watch {
  box-shadow: inset 3px 0 0 rgba(250, 204, 21, 0.55);
}

.user-row.user-row--alert {
  box-shadow: inset 3px 0 0 rgba(248, 113, 113, 0.68);
}

.user-avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #e8eef7;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 0 0.1rem;
}
.user-email { font-size: 0.78rem; color: var(--muted); margin: 0; }

.user-badges { display: flex; gap: 0.4rem; flex-shrink: 0; }

.user-inline-risk {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}

.badge-admin { background: rgba(253, 230, 138, 0.18); color: #fde68a; border: 1px solid rgba(253, 230, 138, 0.3); }
.badge-banned { background: rgba(252, 165, 165, 0.18); color: #fca5a5; border: 1px solid rgba(252, 165, 165, 0.3); }

.user-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.28); }

.btn-success {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: #86efac;
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-success:hover { background: rgba(74, 222, 128, 0.24); }

.btn-gold {
  background: rgba(253, 230, 138, 0.12);
  border: 1px solid rgba(253, 230, 138, 0.3);
  color: #fde68a;
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-gold:hover { background: rgba(253, 230, 138, 0.24); }

/* ── User detail modal body ──────────────────────────────────────────── */
.detail-section { margin-top: 1rem; }
.detail-section-title { font-size: 0.78rem; color: var(--eyebrow); text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 0.5rem; }

.detail-security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.detail-security-stat {
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  background: rgba(15, 23, 42, 0.32);
  padding: 0.7rem 0.75rem;
}

.detail-security-stat span {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.detail-security-stat strong {
  font-size: 1rem;
}

.detail-security-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.detail-security-item {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.22);
  padding: 0.7rem 0.8rem;
}

.detail-security-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.detail-security-item p {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.detail-security-subtitle {
  margin: 0.9rem 0 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-app-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}
.detail-app-row:last-child { border-bottom: none; }

/* ── Extended settings ───────────────────────────────────────────────── */
.settings-row--tall { align-items: flex-start; padding-top: 0.8rem; }

.settings-inline-form--block {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

.settings-inline-form--block textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #101b2b;
  color: #e8eef7;
  font: inherit;
  font-size: 0.82rem;
  resize: vertical;
}

.form-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .overview-grid .identity-card { grid-column: 1 / -1; }
  .admin-stats-grid { grid-template-columns: 1fr 1fr !important; }
  .admin-stats-summary-grid { grid-template-columns: 1fr 1fr !important; }
  .admin-activity-grid { grid-template-columns: 1fr; }
  .admin-stats-grid-layout { grid-template-columns: 1fr; }
  .admin-stats-map-legend { grid-template-columns: 1fr; }
  .admin-stats-breakdowns { grid-template-columns: 1fr; }
  .admin-stats-map-shell,
  .admin-stats-map-canvas { min-height: 25rem; height: 25rem; }
  .security-grid { grid-template-columns: 1fr; }
  .security-lower-grid { grid-template-columns: 1fr; }
  .detail-security-grid { grid-template-columns: 1fr; }
  .users-security-summary { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  :root { --sidenav-w: 3rem; }

  .sidenav { padding: 0.75rem 0.25rem; }

  .nav-item {
    padding: 0.65rem;
    font-size: 0;
  }

  .nav-item::before { font-size: 1.1rem; }
  [data-page="overview"]::before { content: "⌂"; }
  [data-page="security"]::before { content: "◌"; }
  [data-page="apps"]::before { content: "⬡"; }
  [data-page="settings"]::before { content: "◎"; }
  [data-page="admin"]::before { content: "⚙"; }
  [data-page="users"]::before { content: "👥"; }

  .content { padding: 1.25rem 1rem 2rem; }
  .overview-grid { grid-template-columns: 1fr; }
  .admin-stats-map-shell,
  .admin-stats-map-canvas { min-height: 21.5rem; height: 21.5rem; }
  .overview-grid .identity-card { grid-column: auto; }
  .admin-stats-grid { grid-template-columns: 1fr !important; }
  .page-header-row { flex-wrap: wrap; }
  .security-stat-strip { grid-template-columns: 1fr; }
  .security-map-header, .security-feed-header { flex-direction: column; }
  .security-activity-item { grid-template-columns: auto minmax(0, 1fr); }
  .security-activity-time { grid-column: 2; }
  .security-signal-head, .security-route-head { flex-direction: column; }
  .admin-activity-item-head { flex-direction: column; }
  .admin-stats-summary-grid { grid-template-columns: 1fr !important; }
  .admin-stats-user-head { display: none; }
  .admin-stats-user-row { grid-template-columns: 1fr; }
  .user-row { flex-wrap: wrap; }
  .user-actions { width: 100%; flex-wrap: wrap; }

  .auth-gate-actions { flex-direction: column; }
  .auth-gate-actions button { width: 100%; }

  .row.between, .modal-header { flex-direction: column; align-items: stretch; }

  .settings-inline-form input { width: 100%; }
  .settings-row { flex-direction: column; align-items: stretch; }
  .settings-row-right { align-items: flex-start; }
}

/* ── Docs page ────────────────────────────────────────────────────────── */
.docs-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
}

.docs-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0 0 0.65rem;
  letter-spacing: 0.01em;
}

.docs-body {
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.7;
  margin: 0 0 0.75rem;
}
.docs-body:last-child { margin-bottom: 0; }

.docs-body strong { color: #e2e8f0; }

.docs-list {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.75;
  padding-left: 1.25rem;
  margin: 0 0 0.75rem;
}
.docs-list li { margin-bottom: 0.2rem; }
.docs-list strong { color: #e2e8f0; }

.docs-code {
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  color: #a5b4fc;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
  margin: 0.5rem 0 0.75rem;
}

code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82em;
  color: #a5b4fc;
  background: rgba(99,102,241,0.12);
  border-radius: 5px;
  padding: 0.1em 0.35em;
}

.docs-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.75rem;
}
.docs-flow-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: #cbd5e1;
  background: rgba(99,102,241,0.07);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
}
.docs-flow-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(99,102,241,0.35);
  color: #e0e7ff;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.docs-flow-arrow {
  text-align: center;
  color: rgba(99,102,241,0.5);
  font-size: 1.1rem;
  line-height: 1.2;
  padding: 0.1rem 0;
}
.docs-key-truncated {
  font-size: 0.78em;
  word-break: break-all;
}

/* ── User permission matrix ──────────────────────────────────────────── */
.perm-matrix {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.perm-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: rgba(10, 19, 31, 0.6);
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
}
.perm-row:has(.perm-check:checked) {
  background: rgba(16, 38, 70, 0.55);
  border-color: rgba(96, 165, 250, 0.3);
}

.perm-app-icon {
  font-size: 1.1rem;
  width: 1.6rem;
  text-align: center;
  flex-shrink: 0;
}

.perm-app-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.perm-app-name {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Toggle switch */
.perm-toggle {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 2.4rem;
  height: 1.35rem;
  cursor: pointer;
}
.perm-toggle input { opacity: 0; width: 0; height: 0; }
.perm-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.4);
  border: 1px solid rgba(100, 116, 139, 0.3);
  transition: background 0.2s;
}
.perm-slider::before {
  content: '';
  position: absolute;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: #94a3b8;
  top: 50%;
  left: 0.15rem;
  transform: translateY(-50%);
  transition: transform 0.2s, background 0.2s;
}
.perm-toggle input:checked + .perm-slider {
  background: rgba(59, 130, 246, 0.35);
  border-color: rgba(96, 165, 250, 0.5);
}
.perm-toggle input:checked + .perm-slider::before {
  transform: translate(1.05rem, -50%);
  background: #60a5fa;
}

/* Role select inside perm row */
.perm-role-select {
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  font-size: 0.82rem;
  font-family: inherit;
  flex-shrink: 0;
}
.perm-role-select:disabled { opacity: 0.35; cursor: not-allowed; }

.perm-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.perm-save-status {
  flex: 1;
  font-size: 0.82rem;
  color: #fca5a5;
  margin: 0;
}

/* ── Admin apps management list ──────────────────────────────────────── */
.admin-apps-manage-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.admin-app-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  transition: border-color 0.15s;
}
.admin-app-row:hover { border-color: rgba(99,102,241,0.35); }

.admin-app-row-icon {
  font-size: 1.5rem;
  width: 2.25rem;
  text-align: center;
  flex-shrink: 0;
}

.admin-app-row-info {
  flex: 1;
  min-width: 0;
}
.admin-app-row-name {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.95rem;
}
.admin-app-row-meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-app-row-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-status-badge {
  font-size: 0.72rem;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid;
}
.app-status-badge.active {
  color: #86efac;
  border-color: rgba(134,239,172,0.35);
  background: rgba(134,239,172,0.08);
}
.app-status-badge.inactive {
  color: #64748b;
  border-color: rgba(100,116,139,0.3);
  background: rgba(100,116,139,0.07);
}
.app-status-badge.degraded {
  color: #fbbf24;
  border-color: rgba(251,191,36,0.35);
  background: rgba(251,191,36,0.08);
}

/* ── App form modal extras ────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}
.form-group label {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
}
.form-group input,
.form-group textarea,
.form-group select {
  padding: 0.55rem 0.8rem;
  border-radius: 9px;
  border: 1px solid rgba(99,102,241,0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(99,102,241,0.6);
}
.required-star { color: #f87171; }
.form-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: #94a3b8;
}
.form-checkbox-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #6366f1;
}