/* ── Reset & Variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary:      #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light:#dbeafe;
  --color-surface:      #ffffff;
  --color-bg:           #f1f5f9;
  --color-border:       #e2e8f0;
  --color-text:         #0f172a;
  --color-text-muted:   #64748b;
  --color-danger:       #dc2626;
  --color-danger-light: #fee2e2;
  --color-success:      #16a34a;
  --color-success-light:#dcfce7;
  --color-warning:      #d97706;
  --color-warning-light:#fef3c7;
  --sidebar-width:      240px;
  --radius:             6px;
  --radius-lg:          10px;
  --shadow:             0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:          0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.05);
  --font:               -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:          'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --transition:         0.15s ease;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 15px;
}

.sidebar-nav { flex: 1; padding: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--color-bg); color: var(--color-text); }
.nav-item.active { background: var(--color-primary-light); color: var(--color-primary); }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--color-border); }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.btn-logout:hover { background: var(--color-danger-light); color: var(--color-danger); }

/* Main content */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.content-inner {
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
}

/* ── Login Page ────────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg);
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px;
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header svg { margin-bottom: 12px; }
.login-header h1 { font-size: 22px; font-weight: 700; color: var(--color-text); }
.login-header p { color: var(--color-text-muted); margin-top: 6px; }

/* ── Page Header ────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header .text-muted { margin-top: 2px; }

/* ── Breadcrumb ─────────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.breadcrumb a { color: var(--color-primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.card-header h3 { font-size: 15px; font-weight: 600; }

/* ── Stats Bar ──────────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.stat-item {
  flex: 1;
  background: var(--color-surface);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 12px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--color-text); }

/* ── Spaces Grid ────────────────────────────────────────────────────────────── */
.spaces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.space-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition);
}
.space-card:hover { box-shadow: var(--shadow-md); }
.space-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  min-height: 44px;
  gap: 12px;
}
.space-card-main { min-width: 0; }
.space-card-title {
  min-height: 42px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.space-card-port { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.space-card-description {
  min-height: 40px;
  margin-bottom: 10px;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.space-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
  padding: 14px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.space-stat { display: flex; flex-direction: column; gap: 2px; }
.space-stat-label { font-size: 11px; color: var(--color-text-muted); text-transform: uppercase; }
.space-stat-value { font-size: 15px; font-weight: 600; }
.space-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: auto;
  padding-top: 2px;
}
.space-card-actions .btn {
  justify-content: center;
}

/* ── Toggle Switch ──────────────────────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 20px;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--color-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  background: var(--color-bg);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--color-bg); }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-danger  { background: var(--color-danger-light);  color: var(--color-danger); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge-info    { background: var(--color-primary-light); color: var(--color-primary); }
.badge-port    { background: var(--color-bg); color: var(--color-text-muted); font-size: 13px; border: 1px solid var(--color-border); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover:not(:disabled) { background: var(--color-bg); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13.5px;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.login-form input {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-group input:focus,
.login-form input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.input-disabled {
  background: var(--color-bg) !important;
  color: var(--color-text-muted) !important;
  cursor: not-allowed;
}
.input-sm {
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  background: var(--color-surface);
}
.input-sm:focus { border-color: var(--color-primary); }
.select-sm {
  padding: 5px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--color-surface);
  cursor: pointer;
  outline: none;
}
.help-text { margin-top: 4px; font-size: 12px; color: var(--color-text-muted); }
.required { color: var(--color-danger); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13.5px;
}
.divider { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 12px;
}
.alert-danger { background: var(--color-danger-light); color: var(--color-danger); border: 1px solid #fca5a5; }
.alert-success { background: var(--color-success-light); color: var(--color-success); border: 1px solid #86efac; }

/* ── Toast Notifications ────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: slide-in .2s ease;
  max-width: 360px;
}
.toast-success { background: var(--color-success); color: white; }
.toast-error   { background: var(--color-danger); color: white; }
.toast-info    { background: var(--color-primary); color: white; }
@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-md);
}
.modal h3 { font-size: 17px; margin-bottom: 12px; }
.modal p  { color: var(--color-text-muted); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── Search ─────────────────────────────────────────────────────────────────── */
.search-bar { display: flex; gap: 8px; margin-bottom: 20px; }
.search-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  background: var(--color-surface);
}
.search-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* ── Log Viewer ─────────────────────────────────────────────────────────────── */
.viewer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 16px;
  flex-wrap: wrap;
}
.viewer-controls-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.viewer-controls-right { display: flex; align-items: center; gap: 8px; }
.log-viewer-card {
  background: #0f172a;
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
.log-output {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #e2e8f0;
  padding: 16px 20px;
  overflow-x: auto;
  white-space: pre;
  min-height: 200px;
  max-height: 70vh;
  overflow-y: auto;
  line-height: 1.6;
}

/* ── Settings Page ─────────────────────────────────────────────────────────── */
.settings-alert { margin-bottom: 16px; }
.settings-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 22px;
  padding: 8px;
  background: rgba(241, 245, 249, .94);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
}
.settings-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}
.settings-nav a:hover {
  background: var(--color-surface);
  color: var(--color-text);
}
.settings-page {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.settings-section {
  scroll-margin-top: 82px;
}
.settings-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.settings-section-header h3 {
  font-size: 18px;
  font-weight: 650;
  margin-bottom: 2px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.settings-stack {
  display: grid;
  gap: 16px;
}
.settings-grid > .card,
.settings-stack > .card {
  min-width: 0;
}
.settings-grid > .card + .card,
.settings-stack > .card + .card {
  margin-top: 0;
}
.settings-grid > .card.card-wide {
  grid-column: 1 / -1;
}
.settings-grid .card,
.settings-stack .card,
#settings-alerts > .card {
  padding: 20px 24px;
}
.settings-grid .card-header,
.settings-stack .card-header,
#settings-alerts .card-header {
  padding: 0 0 14px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 18px;
  gap: 8px;
}
.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.settings-form-grid .form-group {
  margin-bottom: 0;
}
.settings-field-wide {
  grid-column: 1 / -1;
}
.settings-actions-left {
  justify-content: flex-start;
}
.settings-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ── Data table (v1.9.0 — audit + sessions) ─────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--color-bg);
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table thead th:last-child { border-right: none; }
.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tbody td:last-child { border-right: none; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--color-bg); }
.data-table tbody tr.row-highlight td,
.data-table tbody tr.row-highlight:hover td {
  background: var(--color-primary-light, #eef4ff);
}
.data-table .col-ua {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
  font-size: 12.5px;
}
.data-table td.col-actions {
  text-align: right;
  white-space: nowrap;
}
.data-table td.col-actions .badge { margin-right: 8px; }
.data-table td.col-details {
  font-size: 12px;
  color: var(--color-text-muted);
  word-break: break-word;
  max-width: 480px;
}
.data-table-scroll { overflow-x: auto; }

.badge-subtle {
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  font-size: 10.5px;
  font-weight: 600;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
}
.audit-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.audit-filters select,
.audit-filters input {
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--color-surface);
}
.audit-filters .help-text { margin: 0; flex: 1; min-width: 180px; }
.audit-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.audit-pagination:empty { display: none; }

.badge-geo {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--color-primary-light, #eef4ff);
  color: var(--color-primary, #2563eb);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ── Space Edit Grid — masonry via CSS multicol ─────────────────────────────── */
.space-edit-grid {
  columns: 3 360px;
  column-gap: 20px;
  margin-bottom: 110px; /* room for the floating actions bar */
}
.space-edit-grid > .card {
  display: block;
  margin: 0 0 20px;
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
}
.space-edit-grid .card { padding: 20px 24px; }
.space-edit-grid .card-header {
  padding: 0 0 14px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 18px;
  gap: 8px;
}

/* ── Floating liquid-glass actions bar (appears when form is dirty) ─────────── */
.form-actions-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, calc(100% + 40px));
  width: calc(100% - 60px);
  max-width: 640px;
  z-index: 200;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.18),
    0 2px 8px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  opacity: 0;
  pointer-events: none;
  transition:
    transform .32s cubic-bezier(.2, .8, .2, 1),
    opacity .22s ease;
}
.form-actions-bar.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.form-actions-hint {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.form-actions-hint::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-warning, #f59e0b);
  margin-right: 8px;
  vertical-align: middle;
  animation: dirty-pulse 1.8s ease-in-out infinite;
}
@keyframes dirty-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.25); }
}

/* ── Source row (logs_space.html — with optional Omada enrichment) ──────────── */
.source-main { font-weight: 500; }
.source-sub  { color: var(--color-text-muted); font-size: 12.5px; margin-top: 2px; }

/* ── Live tail (SSE) indicator ─────────────────────────────────────────────── */
#live-toggle { display: inline-flex; align-items: center; gap: 6px; }
.live-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-text-muted);
}
#live-toggle.btn-live-active {
  border-color: var(--color-danger, #ef4444);
  color: var(--color-danger, #ef4444);
}
#live-toggle.btn-live-active .live-dot {
  background: var(--color-danger, #ef4444);
  animation: live-pulse 1.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%,100% { opacity: 1;   transform: scale(1); }
  50%     { opacity: 0.4; transform: scale(1.3); }
}

/* ── Status items ───────────────────────────────────────────────────────────── */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13.5px;
}
.status-row:last-child { border-bottom: none; }
.status-label { color: var(--color-text-muted); }
.status-value { font-weight: 500; }

/* ── Utilities ──────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--color-text-muted); font-size: 13px; }
.text-sm      { font-size: 12.5px; }
.text-center  { text-align: center; }
.loading-placeholder { padding: 32px; text-align: center; color: var(--color-text-muted); }

/* ── View toggle (IP / AP) ──────────────────────────────────────────────────── */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.toggle-btn {
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 500;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.toggle-btn + .toggle-btn { border-left: 1px solid var(--color-border); }
.toggle-btn.active { background: var(--color-primary); color: white; }
.toggle-btn:hover:not(.active) { background: var(--color-bg); }

/* ── Chart ──────────────────────────────────────────────────────────────────── */
.chart-container {
  padding: 16px 20px 8px;
  overflow: hidden;
}
.chart-container canvas { display: block; width: 100%; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
}
.pagination-info {
  font-size: 13px;
  color: var(--color-text-muted);
  min-width: 80px;
  text-align: center;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar-logo span,
  .nav-item span,
  .btn-logout span { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .content-inner { padding: 16px; }
  .page-header { flex-wrap: wrap; gap: 10px; }
  .settings-nav {
    overflow-x: auto;
    white-space: nowrap;
    margin-left: -4px;
    margin-right: -4px;
  }
  .settings-grid,
  .settings-form-grid {
    grid-template-columns: 1fr;
  }
  .settings-field-wide {
    grid-column: auto;
  }
  .settings-grid .card,
  .settings-stack .card,
  #settings-alerts > .card {
    padding: 16px;
  }
  .settings-section-header {
    align-items: flex-start;
  }
  .settings-header-actions {
    justify-content: flex-start;
  }
  .space-edit-grid { columns: 1; }
  .stats-bar { flex-wrap: wrap; }
  .stat-item { min-width: 120px; }
}

/* v2.0.0 — conformité : cartes cliquables */
a.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
a.card-link:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
}
