@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --navy: #0F172A;
  --navy-soft: #1E293B;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-soft: #DBEAFE;
  --accent: #06B6D4;
  --accent-soft: #CFFAFE;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #0F172A;
  --muted: #64748B;
  --border: #E2E8F0;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.08);
  --sidebar-w: 260px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-size: 0.85em; background: #F1F5F9; padding: 0.1em 0.35em; border-radius: 4px; }
.muted { color: var(--muted); }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-soft) 0%, var(--navy) 100%);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar .brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
}
.sidebar .brand img.logo-img {
  display: block;
  height: auto;
  width: auto;
  max-height: 36px;
  max-width: 100%;
  object-fit: contain;
}
.sidebar nav { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.65rem 0.75rem; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.62rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #CBD5E1;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sidebar nav a .ico { width: 1.25rem; height: 1.25rem; flex-shrink: 0; opacity: 0.92; }
.sidebar nav a .ico svg { display: block; width: 100%; height: 100%; }
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar nav a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.sidebar nav a .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 0 0.35rem;
}

.nav-tools-wrap { margin-top: auto; padding: 0 0.75rem 0.5rem; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.nav-tools-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  margin-top: 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: #94A3B8;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.nav-tools-toggle:hover { background: rgba(255, 255, 255, 0.08); color: #E2E8F0; }
.nav-tools { display: none; flex-direction: column; gap: 0.05rem; padding-bottom: 0.35rem; }
.nav-tools.open { display: flex; }
.nav-tools a {
  font-size: 0.8rem !important;
  color: #94A3B8 !important;
  padding: 0.45rem 0.75rem !important;
}
.nav-tools a:hover { color: #E2E8F0 !important; }

.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.sidebar-footer .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25); }

/* Main + topbar */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: var(--text);
}
.search { flex: 1; max-width: 560px; position: relative; }
.search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 5.5rem 0.6rem 2.35rem;
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search input:focus {
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.search .ico {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search .ico svg { width: 18px; height: 18px; display: block; }
.search kbd {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.68rem;
  font-family: var(--font);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 0.65rem; }
.env-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  flex-shrink: 0;
}
.dot.warn { background: var(--warning); }
.dot.danger { background: var(--danger); }
.dot.muted { background: #94A3B8; }
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  min-width: 1rem;
  height: 1rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.user-chip { display: flex; align-items: center; gap: 0.55rem; max-width: 220px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.user-chip .meta { font-size: 0.78rem; line-height: 1.25; min-width: 0; }
.user-chip .meta strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .meta span { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content { padding: 1.25rem 1.5rem 2.5rem; max-width: 1600px; }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.page-title { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; color: var(--navy); }
.page-subtitle { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; max-width: 52rem; }
.page-header-meta { font-size: 0.85rem; }

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem;
  min-height: 104px;
}
.kpi .label { color: var(--muted); font-size: 0.78rem; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.kpi .value { font-size: 1.4rem; font-weight: 700; margin-top: 0.35rem; letter-spacing: -0.02em; color: var(--navy); }
.kpi .sub { color: var(--muted); font-size: 0.76rem; margin-top: 0.25rem; }
.kpi .sub.up { color: var(--success); }
.kpi .sub.down { color: var(--danger); }
.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}
.kpi-icon.blue { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.cyan { background: var(--accent-soft); color: #0891B2; }
.kpi-icon.green { background: #D1FAE5; color: #059669; }
.kpi-icon.red { background: #FEE2E2; color: var(--danger); }
.kpi-icon.orange { background: #FFEDD5; color: #EA580C; }
.kpi-icon.violet { background: #EDE9FE; color: #7C3AED; }

/* Layout grids */
.grid-3 { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 0.85rem; margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1.65fr 1fr; gap: 0.85rem; margin-bottom: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; margin-bottom: 1rem; }
.split-main { display: grid; grid-template-columns: 1fr min(360px, 32%); gap: 1rem; align-items: start; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem;
}
.card h2 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.card h2 a { font-size: 0.82rem; font-weight: 500; }

.empty, .empty-state {
  padding: 1.75rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #F8FAFC;
}
.empty-state-icon { color: #CBD5E1; margin-bottom: 0.5rem; }
.empty-state-title { font-weight: 600; color: var(--text); }
.empty-state-hint { margin: 0.35rem 0 0; font-size: 0.85rem; }

/* Tables */
.tbl-wrap { overflow-x: auto; margin: 0 -0.25rem; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
table.data th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 0.72rem 0.55rem;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}
table.data tbody tr:hover td { background: #F8FAFC; }
table.data tr.row-selected td { background: var(--primary-soft); }

.client-cell { display: flex; align-items: center; gap: 0.55rem; font-weight: 600; color: var(--text); }
.client-cell:hover { color: var(--primary); }
.client-cell .av {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
}
.pill.ok { background: #D1FAE5; color: #047857; }
.pill.warn { background: #FFEDD5; color: #C2410C; }
.pill.crit { background: #FEE2E2; color: #B91C1C; }
.pill.muted { background: #F1F5F9; color: #64748B; }
.pill.info { background: var(--primary-soft); color: #1D4ED8; }
.pill.accent { background: var(--accent-soft); color: #0E7490; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn:hover { background: #F8FAFC; border-color: #CBD5E1; }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.secondary { background: var(--bg); }
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn.block { width: 100%; }

/* Forms & filters */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.85rem; }
.form-field label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-bottom: 0.35rem; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  outline: none;
}
.form-field input:focus, .form-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  padding: 0.85rem 1rem;
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.filters-bar .form-field { flex: 1; min-width: 140px; margin: 0; }

/* Detail panel */
.detail-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  position: sticky;
  top: 5rem;
}
.detail-panel h3 { margin: 0 0 0.75rem; font-size: 0.95rem; color: var(--navy); }
.detail-panel .dl { font-size: 0.85rem; }

/* Progress */
.progress { height: 8px; background: #E2E8F0; border-radius: 999px; overflow: hidden; }
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
}
.progress-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.35rem; }

/* Alerts UI */
.alert-banner {
  display: flex;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  border: 1px solid;
}
.alert-banner.info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.alert-banner.warn { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-banner.success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.flash { padding: 0.65rem 0.85rem; background: #ECFDF5; border: 1px solid #A7F3D0; border-radius: var(--radius-sm); color: #065F46; margin-bottom: 1rem; }

.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.alert-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 0.65rem;
  align-items: start;
  padding: 0.55rem 0.15rem;
  border-bottom: 1px solid #F1F5F9;
}
.alert-item:last-child { border-bottom: 0; }
.alert-ico {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}
.alert-ico.crit { background: #FEE2E2; color: var(--danger); }
.alert-ico.warn { background: #FFEDD5; color: var(--warning); }
.alert-ico.info { background: var(--accent-soft); color: #0891B2; }
.alert-item .t { font-weight: 600; font-size: 0.88rem; }
.alert-item .d { color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
.alert-item .ago { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }

/* Health, charts */
.health-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.health-pill {
  flex: 1 1 110px;
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  min-width: 120px;
}
.health-pill .k { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.health-pill .v { font-weight: 600; font-size: 0.88rem; margin-top: 0.2rem; display: flex; align-items: center; gap: 0.35rem; }

.chart-box { min-height: 200px; }
.chart-empty { min-height: 200px; display: grid; place-items: center; }
.donut-wrap { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.donut {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.donut::after {
  content: attr(data-center);
  position: absolute;
  inset: 28px;
  background: var(--card);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.15;
  padding: 0.25rem;
}
.legend { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; flex: 1; min-width: 140px; }
.legend li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.25rem 0; }
.legend .l { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.quick-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.35rem; }
.cost-card .value { font-size: 1.2rem; font-weight: 700; }
.spark {
  height: 36px;
  margin-top: 0.5rem;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.1), transparent),
    repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(6, 182, 212, 0.12) 8px, rgba(6, 182, 212, 0.12) 9px);
  border-radius: 6px;
  border-bottom: 2px solid rgba(37, 99, 235, 0.25);
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.tabs a, .tabs button {
  border: 0;
  background: transparent;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.875rem;
}
.tabs a.active, .tabs button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tabbed [data-tab-panel][hidden] { display: none !important; }

.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 0.35rem 0.75rem; font-size: 0.88rem; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; font-weight: 500; color: var(--text); }

.host-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.85rem; }
.host-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  background: var(--card);
}
.host-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.65rem; }
.host-card .metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; font-size: 0.8rem; }

.policy-aside {
  background: linear-gradient(135deg, #F0F9FF 0%, #ECFEFF 100%);
  border: 1px solid #BAE6FD;
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.88rem;
}
.policy-aside h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--navy); }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy-soft) 45%, #334155 100%);
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 16px;
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 1.25rem; }
.login-brand img.login-logo { height: auto; width: auto; max-width: 280px; max-height: 72px; object-fit: contain; }
.recovery-codes { font-family: ui-monospace, monospace; columns: 2; }
.qr-wrap { text-align: center; }
.qr-wrap img { background: #fff; padding: 8px; border-radius: 8px; }
.setup-steps { margin: 0 0 1rem 1.2rem; }
a.user-chip { text-decoration: none; color: inherit; }
.login-card h1 { margin: 0.75rem 0 0.25rem; font-size: 1.35rem; text-align: center; color: var(--navy); }
.login-card .muted { text-align: center; margin-bottom: 1.25rem; }
.login-card label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.85rem; color: var(--muted); }
.login-card input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); outline: none; }
.login-card .error { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: 14px;
  width: min(440px, 100%);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
}
.modal h3 { margin: 0 0 0.5rem; color: var(--navy); }
.modal p { margin: 0 0 1rem; color: var(--muted); font-size: 0.92rem; }
.modal .actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 35;
}
.overlay.open { display: block; }

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .split-main { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-grid; place-items: center; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .section-grid { grid-template-columns: 1fr; }
  .user-chip .meta { display: none; }
  .search { max-width: none; }
  .search kbd { display: none; }
}
@media (max-width: 560px) {
  .kpi-grid, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
}

/* LOT14 — navigation groups, stepper, drawer, PWA helpers */
.nav-group { margin-bottom: 0.35rem; }
.nav-group-label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 0.75rem 1rem 0.35rem;
  font-weight: 600;
}
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .kpi-grid-4, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  counter-reset: step;
}
.stepper li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.stepper li span {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  border: 2px solid #CBD5E1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
}
.stepper li.active { color: var(--primary); font-weight: 600; }
.stepper li.active span { border-color: var(--primary); background: rgba(46, 125, 255, 0.12); color: var(--primary); }
.signup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 280px;
  gap: 1rem;
}
.signup-span-2 { grid-column: 1 / span 2; }
.signup-card h2 { font-size: 1rem; margin: 0 0 0.75rem; }
.signup-aside h2 { font-size: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; margin-bottom: 0.65rem; }
.field input, .field select { padding: 0.55rem 0.65rem; border: 1px solid #E2E8F0; border-radius: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.check-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.check-list li { padding: 0.35rem 0 0.35rem 1.5rem; position: relative; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: #16A34A; font-weight: 700; }
.info-box { background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 10px; padding: 0.75rem; margin-bottom: 0.75rem; font-size: 0.85rem; }
.signup-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.checkbox-row { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; }
.hp-field { position: absolute; left: -9999px; opacity: 0; }
.tech-drawer { margin-top: 1.5rem; border: 1px solid #E2E8F0; border-radius: 10px; padding: 0.75rem 1rem; background: #F8FAFC; }
.tech-drawer-panel { margin-top: 1rem; }
.tech-drawer-body { margin-top: 0.75rem; }
.tech-pre { font-size: 0.75rem; max-height: 240px; overflow: auto; background: #0F172A; color: #E2E8F0; padding: 0.75rem; border-radius: 8px; }
.flash-banner { background: #ECFDF5; border-left: 4px solid #16A34A; padding: 0.75rem 1rem; margin-bottom: 1rem; border-radius: 0 8px 8px 0; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th, .data-table td { padding: 0.55rem 0.65rem; border-bottom: 1px solid #E2E8F0; text-align: left; }
.data-table.compact { font-size: 0.78rem; }
.progress > span.ok { background: #16A34A; }
.progress > span.warn { background: #F59E0B; }
.progress > span.crit { background: #DC2626; }
.mode-banner { font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; }
.guard-list strong { color: var(--text); }
.lifecycle-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.lifecycle-stepper li {
  flex: 1;
  min-width: 120px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 0.65rem;
  font-size: 0.8rem;
}
.lifecycle-stepper li.done { border-color: #86EFAC; background: #F0FDF4; }
.lifecycle-stepper li.current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.lifecycle-stepper li small { display: block; color: var(--muted); margin-top: 0.25rem; }
.tab-bar { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid #E2E8F0; padding-bottom: 0.5rem; }
.tab-bar .tab {
  background: transparent;
  border: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
}
.tab-bar .tab.active { background: rgba(46, 125, 255, 0.12); color: var(--primary); font-weight: 600; }
.auto-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.auto-card { border: 1px solid #E2E8F0; border-radius: 10px; padding: 0.75rem; }
.auto-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.toggle-readonly { display: flex; align-items: center; gap: 0.5rem; margin: 0.35rem 0; }
.sensitive-block { border-color: #FECACA; background: #FFFBFB; }
.sensitive-action-btn { width: 100%; margin-top: 0.5rem; }
.inline-form { display: inline-flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
@media (max-width: 960px) {
  .signup-grid { grid-template-columns: 1fr; }
  .signup-span-2 { grid-column: 1; }
  .auto-grid { grid-template-columns: 1fr; }
}

/* LOT15 — chargement et accessibilité de base */
.is-loading { opacity: 0.65; pointer-events: none; }
.skeleton {
  background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
  background-size: 200% 100%;
  animation: aremio-skeleton 1.2s ease-in-out infinite;
  border-radius: 6px;
  min-height: 0.85rem;
}
@keyframes aremio-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.btn:focus-visible,
a:focus-visible,
button:focus-visible,
.menu-toggle:focus-visible,
.nav-tools-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.error-page-card { max-width: 36rem; }
.help-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; margin-left: .2rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--muted); font-size: .72rem; cursor: help;
  vertical-align: middle; padding: 0; line-height: 1;
}
.help-info:hover, .help-info:focus-visible { color: var(--primary); border-color: var(--primary); }
.help-pop {
  position: absolute; z-index: 80; max-width: 18rem;
  background: #fff; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: .65rem .75rem; font-size: .82rem;
  box-shadow: var(--shadow-lg);
}
.help-pop strong { display: block; margin-bottom: .25rem; font-size: .85rem; }
details.card { padding: 1rem 1.15rem; }
details.card summary { cursor: pointer; font-weight: 600; }
@media (max-width: 640px) {
  .data-table th, .data-table td { white-space: nowrap; }
  .topbar .search kbd { display: none; }
}
