/* ============================================================
   Terra Seek Admin — design tokens + base
   Geist Sans + Geist Mono via Vercel CDN
   Linear-style sidebar, verde moderato (#2c5d3f)
   ============================================================ */

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

:root {
  /* Brand */
  --brand-primary: #2c5d3f;
  --brand-primary-hover: #244c33;
  --brand-primary-soft: #4a7c59;
  --brand-primary-wash: #eef4ef;
  --brand-primary-wash-2: #dfecdf;
  --brand-ring: rgba(44, 93, 63, 0.18);

  /* Neutrals — warm-ish gray, NOT pure */
  --bg: #ffffff;
  --bg-subtle: #fafaf9;
  --bg-muted: #f5f5f4;
  --surface: #ffffff;
  --surface-elev: #ffffff;

  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --border-soft: #efedea;

  --text: #18181b;
  --text-muted: #525258;
  --text-subtle: #71717a;
  --text-faint: #a1a1aa;

  /* Status */
  --success: #16794c;
  --success-bg: #ecfdf3;
  --success-border: #abefc6;

  --warning: #b54708;
  --warning-bg: #fffaeb;
  --warning-border: #fedf89;

  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-border: #fecdca;

  --info: #1849a9;
  --info-bg: #eff8ff;
  --info-border: #b2ddff;

  --neutral-bg: #f4f4f5;
  --neutral-border: #e4e4e7;

  /* Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(16, 24, 40, 0.05), 0 1px 2px 0 rgba(16, 24, 40, 0.04);
  --shadow: 0 4px 8px -2px rgba(16, 24, 40, 0.06), 0 2px 4px -2px rgba(16, 24, 40, 0.04);

  /* Type */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Monaco, monospace;

  /* Density */
  --row-h: 40px;
  --row-pad-y: 10px;
  --row-pad-x: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============== App shell ============== */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ============== Sidebar ============== */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 4px;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 10px;
}
.sb-brand-logo {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--brand-primary);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.sb-brand-logo svg { width: 18px; height: 18px; }
.sb-brand-text {
  display: flex; flex-direction: column; line-height: 1.15;
}
.sb-brand-name { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.sb-brand-env {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-subtle);
  font-weight: 500;
}

.sb-section { margin-top: 12px; }
.sb-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 0 10px 4px;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13.5px;
  position: relative;
  border-left: 2px solid transparent;
  margin-left: -2px; /* compensate for active border */
  transition: background 0.12s ease, color 0.12s ease;
  line-height: 1.3;
}
.sb-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sb-item:hover { background: var(--bg-muted); color: var(--text); }
.sb-item.active {
  background: var(--brand-primary-wash);
  color: var(--brand-primary);
  border-left-color: var(--brand-primary);
  font-weight: 600;
}
.sb-item.active svg { opacity: 1; }
.sb-item .badge-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--neutral-bg);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.sb-item.active .badge-count {
  background: var(--brand-primary);
  color: #fff;
}

.sb-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
}
.sb-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-primary-soft);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.sb-user-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sb-user-name { font-size: 12.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { font-size: 11px; color: var(--text-faint); }
.sb-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  margin-top: 4px;
}
.sb-logout:hover { background: var(--bg-muted); color: var(--danger); }
.sb-logout svg { width: 14px; height: 14px; }

/* ============== Content area ============== */
.content {
  min-width: 0;
  padding: 28px 32px 80px;
  max-width: 1400px;
  width: 100%;
}
.content--wide { max-width: 100%; }

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-header-left { min-width: 0; }
.page-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header .crumb {
  font-size: 12.5px;
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.page-header .crumb a:hover { color: var(--brand-primary); }
.page-header .desc {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text-subtle);
  max-width: 64ch;
}
.page-header-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ============== Buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  line-height: 1.2;
  transition: background 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { background: var(--bg-muted); border-color: var(--border-strong); }
.btn:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; }
.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}
.btn-primary:hover { background: var(--brand-primary-hover); border-color: var(--brand-primary-hover); }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #9b1c12; border-color: #9b1c12; }
.btn-ghost-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--border);
}
.btn-ghost-danger:hover { background: var(--danger-bg); border-color: var(--danger-border); }
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #126641; }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-icon { padding: 6px; }

/* ============== Cards ============== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 18px; }
.card-pad-lg { padding: 22px; }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2, .card-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px;
}
.card-header .meta { font-size: 12.5px; color: var(--text-subtle); }
.card-body { padding: 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============== Stat cards ============== */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  position: relative;
}
.stat-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-label svg { width: 12px; height: 12px; opacity: 0.7; }
.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.stat-trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 500; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend svg { width: 12px; height: 12px; }
.stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.stat-dot.ok { background: var(--success); box-shadow: 0 0 0 3px rgba(22, 121, 76, 0.12); }
.stat-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(181, 71, 8, 0.12); }
.stat-dot.err { background: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12); }

.grid { display: grid; gap: 14px; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1280px) {
  .grid-cols-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ============== Pills ============== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.pill svg { width: 11px; height: 11px; }
.pill-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.pill-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.pill-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.pill-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.pill-neutral { background: var(--neutral-bg); color: var(--text-muted); border-color: var(--neutral-border); }
.pill-brand { background: var(--brand-primary-wash); color: var(--brand-primary); border-color: var(--brand-primary-wash-2); }
.pill-dot::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ============== Tables ============== */
.tbl-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tbl thead th {
  background: var(--bg-subtle);
  text-align: left;
  font-weight: 500;
  color: var(--text-subtle);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg-subtle); }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .mono { font-family: var(--font-mono); font-size: 13px; }
.tbl .col-actions { text-align: right; white-space: nowrap; }
.tbl .col-id { color: var(--text-faint); font-family: var(--font-mono); font-size: 12.5px; width: 60px; }
.tbl-link { color: var(--brand-primary); font-weight: 500; }
.tbl-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tbl-secondary { color: var(--text-muted); font-size: 12.5px; }
.tbl-time { color: var(--text-subtle); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ============== Forms ============== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.field .hint { font-size: 11.5px; color: var(--text-faint); }
.input, .textarea, .select {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.1s, box-shadow 0.1s;
  font-family: var(--font-sans);
}
.input.mono, .textarea.mono { font-family: var(--font-mono); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.textarea { min-height: 80px; resize: vertical; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.checkbox input { accent-color: var(--brand-primary); width: 14px; height: 14px; }

/* Search input with icon */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: 10px;
  width: 14px; height: 14px;
  color: var(--text-faint);
  pointer-events: none;
}
.search input {
  padding-left: 32px;
}

/* Toggle */
.toggle {
  position: relative;
  width: 32px; height: 18px;
  background: var(--neutral-bg);
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.15s;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 1px; left: 1px;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.toggle.on { background: var(--brand-primary); border-color: var(--brand-primary); }
.toggle.on::after { transform: translateX(14px); }

/* ============== Empty state ============== */
.empty {
  text-align: center;
  padding: 36px 24px;
  color: var(--text-subtle);
}
.empty-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--brand-primary-wash);
  color: var(--brand-primary);
  display: inline-grid;
  place-items: center;
  margin-bottom: 12px;
}
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { margin: 0 0 4px; color: var(--text); font-size: 14px; font-weight: 600; }
.empty p { margin: 0; font-size: 13px; max-width: 40ch; margin-inline: auto; }

/* ============== Banners (flash) ============== */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 13px;
  margin-bottom: 16px;
  position: relative;
}
.banner svg.icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.banner-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.banner-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.banner-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.banner-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.banner strong { font-weight: 600; }
.banner-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  display: flex;
}
.banner-close:hover { opacity: 1; }

/* ============== Section header (within page) ============== */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 12px;
}
.section-header:first-child { margin-top: 0; }
.section-header h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px;
}
.section-header .count {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.section-header .actions { display: flex; gap: 8px; }

/* ============== Quick links / shortcut cards ============== */
.shortcut {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
  position: relative;
}
.shortcut:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}
.shortcut:hover .shortcut-arrow { transform: translateX(2px); opacity: 1; }
.shortcut-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand-primary-wash);
  color: var(--brand-primary);
  display: grid; place-items: center;
  margin-bottom: 8px;
}
.shortcut-icon svg { width: 16px; height: 16px; }
.shortcut-title { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.005em; }
.shortcut-desc { font-size: 12.5px; color: var(--text-subtle); line-height: 1.4; }
.shortcut-arrow {
  position: absolute;
  top: 16px; right: 16px;
  color: var(--text-faint);
  opacity: 0.5;
  transition: transform 0.15s, opacity 0.15s;
}
.shortcut-arrow svg { width: 14px; height: 14px; }

/* ============== Filter chips ============== */
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
}
.chip:hover { background: var(--bg-muted); }
.chip.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}
.chip .count {
  background: rgba(0,0,0,0.06);
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chip.active .count { background: rgba(255,255,255,0.18); color: #fff; }
.chip-label { font-size: 11.5px; color: var(--text-subtle); margin-right: 4px; }

/* ============== Terminal box (logs) ============== */
.terminal {
  background: #0b0f0d;
  color: #d4d4d8;
  border-radius: var(--radius-lg);
  border: 1px solid #1f2421;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 14px 16px;
  overflow: auto;
  max-height: 640px;
}
.terminal-line { white-space: pre; padding: 1px 0; display: flex; gap: 12px; }
.terminal-line .ts { color: #71717a; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.terminal-line .lvl { font-weight: 600; flex-shrink: 0; width: 56px; }
.terminal-line .msg { color: #e4e4e7; min-width: 0; word-break: break-word; white-space: pre-wrap; }
.terminal-line.lvl-error .lvl { color: #f87171; }
.terminal-line.lvl-warning .lvl { color: #fbbf24; }
.terminal-line.lvl-info .lvl { color: #4ade80; }
.terminal-line.lvl-debug .lvl { color: #93c5fd; }
.terminal-line.lvl-error { background: rgba(248, 113, 113, 0.06); }

/* ============== Code/JSON box ============== */
.code-block {
  background: #0b0f0d;
  color: #d4d4d8;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid #1f2421;
  line-height: 1.55;
}
.code-block .k { color: #93c5fd; }
.code-block .s { color: #a7f3d0; }
.code-block .n { color: #fcd34d; }
.code-block .b { color: #f0abfc; }

/* ============== Timeline (audit) ============== */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 11px; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding: 0 0 18px 0;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -28px; top: 2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-muted);
}
.timeline-dot svg { width: 12px; height: 12px; }
.timeline-dot.danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.timeline-dot.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.timeline-dot.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.timeline-dot.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.timeline-dot.brand { background: var(--brand-primary-wash); border-color: var(--brand-primary-wash-2); color: var(--brand-primary); }
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.timeline-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px 8px;
  font-size: 13px;
  margin-bottom: 4px;
  min-width: 0;
}
.timeline-head .who { white-space: nowrap; }
.timeline-head .verb-target {
  display: inline;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-head .who { font-weight: 600; }
.timeline-head .verb { color: var(--text-muted); }
.timeline-head .target { color: var(--brand-primary); font-weight: 500; }
.timeline-meta {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.timeline-meta > span { white-space: nowrap; }
.timeline-meta .dot-sep { color: var(--text-faint); }
.timeline-json {
  margin-top: 10px;
}
.timeline-json summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}
.timeline-json summary:hover { color: var(--text); }
.timeline-json summary svg { width: 11px; height: 11px; transition: transform 0.15s; }
.timeline-json[open] summary svg { transform: rotate(90deg); }
.timeline-json pre {
  margin: 8px 0 0;
  background: var(--bg-muted);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: auto;
  border: 1px solid var(--border-soft);
}

/* ============== Misc ============== */
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--neutral-bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-muted);
}
.divider { height: 1px; background: var(--border-soft); margin: 16px 0; }
.muted { color: var(--text-subtle); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); }
.dot-sep { color: var(--text-faint); margin: 0 4px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; }
.stack-tight { display: flex; flex-direction: column; gap: 2px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.hide-1280 { display: none; }
@media (min-width: 1280px) { .hide-1280 { display: revert; } }

/* Accessibility */
*:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: 3px;
}
.btn:focus-visible, .input:focus-visible, .textarea:focus-visible {
  outline-color: var(--brand-primary);
}

/* Variant-A small overrides - dashboard A vs B */
.variant-tag {
  position: fixed;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  background: #18181b;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  z-index: 100;
}

/* Dashboard variant B specifics */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.kpi-bar > * {
  padding: 16px 18px;
  border-right: 1px solid var(--border-soft);
}
.kpi-bar > *:last-child { border-right: none; }
@media (max-width: 1280px) { .kpi-bar { grid-template-columns: repeat(3, 1fr); } .kpi-bar > * { border-bottom: 1px solid var(--border-soft); } }

/* ============================================================
   DARK MODE
   Toggle: <html data-theme="dark"> via JS, persisted in localStorage
   Brand verde resta identico, neutri ridefiniti
   ============================================================ */
html[data-theme="dark"] {
  --bg: #0f1115;
  --bg-subtle: #0b0d11;
  --bg-muted: #161a20;
  --surface: #14171c;
  --surface-elev: #181c22;

  --border: #262a31;
  --border-strong: #353a42;
  --border-soft: #1f232a;

  --text: #e8e8ea;
  --text-muted: #a1a1aa;
  --text-subtle: #8a8a93;
  --text-faint: #5d5d66;

  --brand-primary-wash: #18382a;
  --brand-primary-wash-2: #1f4634;
  --brand-ring: rgba(106, 180, 138, 0.32);

  --success: #5fd19a;
  --success-bg: #102b1e;
  --success-border: #1f4d35;

  --warning: #f5a524;
  --warning-bg: #2d2008;
  --warning-border: #5a4011;

  --danger: #f87171;
  --danger-bg: #2c1414;
  --danger-border: #5a1f1f;

  --info: #7cc4ff;
  --info-bg: #0f2236;
  --info-border: #1d4368;

  --neutral-bg: #1d2026;
  --neutral-border: #2a2e36;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.55), 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow:    0 4px 12px -2px rgba(0, 0, 0, 0.6), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] body {
  background: var(--bg-subtle);
  color: var(--text);
}

/* Sidebar in dark — leggermente più scura del content */
html[data-theme="dark"] .sidebar { background: #0c0e12; }

/* Sidebar item attivo: verde wash è poco visibile in dark, alziamo contrasto */
html[data-theme="dark"] .sb-item.active {
  background: var(--brand-primary-wash);
  color: #b6e5c9;
}
html[data-theme="dark"] .sb-item:hover { background: var(--bg-muted); }

/* Logo container: meno visibile su dark senza outline */
html[data-theme="dark"] .sb-brand-logo { background: var(--bg-muted); }

/* Code blocks dark restano slate-950 (già scuro) */
html[data-theme="dark"] .code-block {
  background: #07090c;
  border-color: var(--border);
}

/* Input fields */
html[data-theme="dark"] .input,
html[data-theme="dark"] .textarea {
  background: var(--bg-muted);
  border-color: var(--border-strong);
  color: var(--text);
}
html[data-theme="dark"] .input:focus,
html[data-theme="dark"] .textarea:focus {
  background: var(--surface);
}
html[data-theme="dark"] .input::placeholder,
html[data-theme="dark"] .textarea::placeholder {
  color: var(--text-faint);
}

/* Buttons secondary su dark */
html[data-theme="dark"] .btn:not(.btn-primary):not(.btn-ghost-danger) {
  background: var(--bg-muted);
  border-color: var(--border-strong);
  color: var(--text);
}
html[data-theme="dark"] .btn:not(.btn-primary):not(.btn-ghost-danger):hover {
  background: var(--surface-elev);
}

/* Pills neutral più morbidi */
html[data-theme="dark"] .pill-neutral {
  background: var(--neutral-bg);
  color: var(--text-muted);
  border-color: var(--neutral-border);
}

/* Tabelle */
html[data-theme="dark"] .tbl thead th {
  background: var(--bg-muted);
  color: var(--text-muted);
  border-color: var(--border);
}
html[data-theme="dark"] .tbl tbody tr:hover { background: var(--bg-muted); }

/* Cards */
html[data-theme="dark"] .card { background: var(--surface); }

/* Sidebar theme toggle button */
.sb-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sb-theme-toggle:hover {
  background: var(--bg-muted);
  color: var(--text);
}
.sb-theme-toggle svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.sb-theme-toggle .icon-light { display: none; }
.sb-theme-toggle .icon-dark { display: inline-block; }
html[data-theme="dark"] .sb-theme-toggle .icon-light { display: inline-block; }
html[data-theme="dark"] .sb-theme-toggle .icon-dark { display: none; }

/* Sidebar health pill */
.badge-health {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid;
}
.badge-health-ok { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-health-down { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge-health::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  transform: translateY(-1px);
  background: currentColor;
}

/* Dashboard "all green" status banner */
.status-banner {
  background: linear-gradient(135deg, var(--brand-primary-wash) 0%, var(--surface) 100%);
  border: 1px solid var(--brand-primary-wash-2);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 22px;
}
html[data-theme="dark"] .status-banner {
  background: linear-gradient(135deg, var(--brand-primary-wash) 0%, var(--surface) 100%);
  border-color: var(--brand-primary-soft);
}
.status-banner-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.status-banner-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.status-banner-head .status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.status-banner-head .status-icon svg { width: 16px; height: 16px; }
.status-banner-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 0; }
.status-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.status-tile {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-tile-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-tile-dot.ok { background: var(--success); }
.status-tile-dot.err { background: var(--danger); }
.status-tile-label { font-size: 11px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.04em; }
.status-tile-value { font-size: 13px; font-weight: 600; color: var(--text); margin-left: auto; font-family: var(--font-mono); }
@media (max-width: 1280px) { .status-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .status-grid { grid-template-columns: repeat(2, 1fr); } }

/* Avatar circolare nei timeline */
.timeline-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-primary-wash);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  margin-right: 8px;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* ============================================================
   Dashboard Quick Actions list (vb-action-list)
   ============================================================ */
.vb-action-list { padding: 0; }
.vb-action-list .row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
  flex-wrap: nowrap;
}
.vb-action-list .row:last-child { border-bottom: none; }
.vb-action-list .row:hover { background: var(--bg-subtle); }
.vb-action-list .row .icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-primary-wash);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vb-action-list .row .icon svg { width: 16px; height: 16px; }
.vb-action-list .row > div { flex: 1; min-width: 0; }
.vb-action-list .row .ttl {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.vb-action-list .row .desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}
.vb-action-list .row .vb-arrow {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: transform 0.15s, color 0.15s;
  flex-shrink: 0;
}
.vb-action-list .row .vb-arrow svg { width: 14px; height: 14px; }
.vb-action-list .row:hover .vb-arrow {
  transform: translateX(2px);
  color: var(--brand-primary);
}

/* Dark variant */
html[data-theme="dark"] .vb-action-list .row:hover { background: var(--bg-muted); }
html[data-theme="dark"] .vb-action-list .row .icon { background: var(--brand-primary-wash); color: #b6e5c9; }

/* Timeline (activity feed in dashboard + audit) */
.timeline { display: flex; flex-direction: column; gap: 18px; }
.timeline-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 22px;
  position: relative;
  border-left: 2px solid var(--border-soft);
  padding-bottom: 14px;
}
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -9px;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
}
.timeline-dot.brand { border-color: var(--brand-primary); color: var(--brand-primary); }
.timeline-dot.success { border-color: var(--success); color: var(--success); }
.timeline-dot.danger { border-color: var(--danger); color: var(--danger); }
.timeline-dot.warning { border-color: var(--warning); color: var(--warning); }
.timeline-dot svg { width: 8px; height: 8px; }
.timeline-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13.5px;
}
.timeline-head .who { font-weight: 600; color: var(--text); }
.timeline-head .verb { color: var(--text-faint); }
.timeline-head .target { color: var(--text-muted); font-family: var(--font-mono); font-size: 12.5px; }
.timeline-head .muted { color: var(--text-faint); font-size: 12.5px; }
.timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-faint);
}
.timeline-meta .dot-sep { opacity: 0.5; }
.timeline-meta .mono { font-family: var(--font-mono); }
.timeline-json {
  margin-top: 6px;
  font-size: 12px;
}
.timeline-json summary {
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  user-select: none;
}
.timeline-json summary::-webkit-details-marker { display: none; }
.timeline-json summary svg {
  width: 10px;
  height: 10px;
  transition: transform 0.15s;
}
.timeline-json[open] summary svg { transform: rotate(90deg); }
.timeline-json pre {
  margin: 6px 0 0 16px;
  padding: 8px 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow: auto;
  border: 1px solid var(--border-soft);
}

/* ── Pagination (Laravel default Tailwind view) ─────────────────── */
nav[role="navigation"] { display: flex; flex-direction: column; gap: 8px; }
nav[role="navigation"] > div:first-child { font-size: 12px; color: var(--text-muted); }
nav[role="navigation"] span[aria-current="page"] > span,
nav[role="navigation"] a,
nav[role="navigation"] span > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
nav[role="navigation"] a:hover { background: var(--bg-muted); color: var(--text-primary); }
nav[role="navigation"] span[aria-current="page"] > span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
nav[role="navigation"] svg { width: 12px; height: 12px; }
