/* ═══════════════ NAV ═══════════════ */
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 14px; border-radius: var(--radius-xs);
  color: var(--text-dim); font-size: 13px; font-weight: 500;
  width: 100%; text-align: left;
  border: 1px solid transparent; transition: all 0.12s;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--alpha-surface); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft); color: var(--primary);
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; text-align: center; font-size: 14px; line-height: 16px; }
.nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .nav-badge {
  min-width: 15px; height: 15px; border-radius: 8px;
  background: var(--destructive); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 15px;
  text-align: center; padding: 0 4px; pointer-events: none;
}
.sidebar-footer {
  padding: 10px 14px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-mute);
}

/* ═══════════════ CARD ═══════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  min-height: 0;
  box-shadow: 0 2px 16px rgba(0,0,0,0.22);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.card-title { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -0.005em; }
.card-sub { font-size: 11px; color: var(--text-mute); margin-left: 6px; }
.card-body { padding: 12px 14px; flex: 1; overflow-y: auto; min-height: 0; }
.card-body:not(:only-child) { padding-top: 6px; }
.card-chip {
  margin-left: auto;
  font-size: 10.5px; font-weight: 500; color: var(--text-dim);
  background: var(--alpha-surface);
  border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 20px;
}
.card-empty { padding: 36px 20px; text-align: center; color: var(--text-mute); font-size: 12px; }

/* Card entrance stagger */
.card { animation: cardIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 5px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; transition: all 0.12s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-ghost { background: var(--alpha-surface); color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { background: var(--alpha-hover); color: var(--text); }
.btn-primary { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-edge); }
.btn-primary:hover { background: var(--primary-glow); }
.btn-success { background: var(--success-soft); color: var(--success); border-color: var(--success-edge); }
.btn-success:hover { background: var(--primary-glow); }
.btn-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-edge); }
.btn-warning:hover { background: rgba(255,181,71,0.18); }
.btn-destructive { background: var(--destructive-soft); color: var(--destructive); border-color: var(--destructive-edge); }
.btn-destructive:hover { background: rgba(255,80,5,0.18); }

/* ═══════════════ CHIP / STATUS ═══════════════ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 10.5px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip-success  { background: var(--success-soft); color: var(--success); border-color: var(--success-edge); }
.chip-info     { background: var(--info-soft); color: var(--info); border-color: var(--info-edge); }
.chip-warning  { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-edge); }
.chip-destructive { background: var(--destructive-soft); color: var(--destructive); border-color: var(--destructive-edge); }
.chip-default  { background: var(--alpha-surface); color: var(--text-dim); border-color: var(--border); }

/* ═══════════════ TABLE ═══════════════ */
.table-wrap { overflow-x: auto; flex: 1; min-height: 0; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead { position: sticky; top: 0; z-index: 5; }
thead th {
  padding: 8px 12px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-mute); text-align: left;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--primary-soft); }
tbody td {
  padding: 9px 12px; font-size: 12.5px;
  border-bottom: 1px solid var(--border-faint);
  vertical-align: middle;
}
td.mono { font-family: 'Fira Code', monospace; font-size: 11.5px; }
td.muted { color: var(--text-mute); font-size: 11.5px; font-family: 'Fira Code', monospace; }

/* ═══════════════ SEGMENTED CONTROL ═══════════════ */
.seg {
  display: inline-flex; background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px; padding: 2px;
  font-size: 10.5px; font-weight: 600;
  gap: 1px;
}
.seg-btn {
  padding: 2px 7px; border-radius: 4px;
  color: var(--text-mute); transition: all 0.1s;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.seg-btn:hover:not(.on) { color: var(--text-dim); }
.seg-btn.on { background: var(--primary); color: var(--primary-text); }

/* ═══════════════ MODAL ═══════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(4,10,22,0.74); backdrop-filter: blur(8px);
  z-index: 100; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 80vh; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  animation: modalIn 0.18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; }
.modal-x { color: var(--text-mute); font-size: 18px; padding: 2px 7px; border-radius: 5px; line-height: 1; }
.modal-x:hover { color: var(--text); background: var(--alpha-surface); }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-body pre { font-size: 11.5px; color: var(--text-dim); white-space: pre-wrap; word-break: break-all; line-height: 1.65; font-family: 'Fira Code', monospace; }

/* ═══════════════ TOAST ═══════════════ */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text); padding: 10px 14px; border-radius: 9px;
  font-size: 12.5px; z-index: 200;
  display: flex; align-items: center; gap: 9px;
  opacity: 0; transform: translateY(8px);
  transition: all 0.22s ease; pointer-events: none;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45); max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--destructive); }
.toast.info    { border-left: 3px solid var(--info); }

/* ═══════════════ STATUS DOT ═══════════════ */
.s-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-mute); flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.s-dot.ok  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.s-dot.err { background: var(--destructive); }

/* ═══════════════ LIVE DOT ═══════════════ */
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
  box-shadow: 0 0 0 0 var(--success);
  animation: liveDot 1.8s infinite;
}
@keyframes liveDot {
  0%   { box-shadow: 0 0 0 0 var(--success-edge); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ═══════════════ PILL ═══════════════ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
}
.pill-live { background: var(--success-soft); border-color: var(--success-edge); color: var(--success); }

/* ═══════════════ BREADCRUMB ═══════════════ */
.crumb {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-dim);
}
.crumb .sep { color: var(--text-mute); font-size: 10px; }
.crumb .cur { color: var(--text); font-weight: 600; }

/* ═══════════════ THEME TOGGLE ═══════════════ */
.theme-toggle {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); border: 1px solid var(--border);
  background: var(--alpha-surface);
  transition: all 0.15s; flex-shrink: 0;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary-edge); background: var(--primary-soft); }
.theme-toggle .icon-sun  { display: block; }
.theme-toggle .icon-moon { display: none; }
html.theme-dark .theme-toggle .icon-sun  { display: none; }
html.theme-dark .theme-toggle .icon-moon { display: block; }

/* ═══════════════ HAMBURGER ═══════════════ */
.hamburger {
  display: none;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  border-radius: 7px; color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all 0.15s;
  flex-shrink: 0;
}
.hamburger:hover { color: var(--primary); border-color: var(--primary-edge); background: var(--primary-soft); }
.hamburger:active { transform: scale(0.94); }

/* ═══════════════ TOPBAR RIGHT ═══════════════ */
.topbar-title { font-size: 13px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ═══════════════ SEARCH ═══════════════ */
.search {
  flex: 1; max-width: 340px; position: relative;
  margin-left: 12px;
}
.search input {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 10px 6px 30px;
  font-size: 12.5px; color: var(--text); outline: none;
  transition: border-color 0.13s;
}
.search input::placeholder { color: var(--text-mute); }
.search input:focus { border-color: var(--primary-edge); }
.search svg {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; color: var(--text-mute); pointer-events: none;
}

/* ═══════════════ FILTER ═══════════════ */
.filter-input {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-dim);
  font-size: 11.5px; font-weight: 500; padding: 5px 9px;
  outline: none; transition: border-color 0.12s;
}
.filter-input:focus { border-color: var(--primary-edge); }

/* ═══════════════ KPI CARDS ═══════════════ */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.kpi-card {
  padding: 14px 18px 10px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.kpi-card:last-child { border-right: none; }
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--border-strong);
}
.kpi-card.c-success::before    { background: var(--success);     box-shadow: 0 0 8px var(--success); }
.kpi-card.c-destructive::before { background: var(--destructive); box-shadow: 0 0 8px var(--destructive); }
.kpi-card.c-warning::before    { background: var(--warning);     box-shadow: 0 0 8px var(--warning); }
.kpi-card.c-info::before       { background: var(--info);        box-shadow: 0 0 8px var(--info); }
.kpi-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.kpi-label {
  font-size: 10px; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
}
.kpi-num {
  font-family: 'Fira Code', monospace;
  font-size: 34px; font-weight: 700; line-height: 1.1;
  letter-spacing: -.02em; color: var(--text);
}
.kpi-sub { font-size: 10px; color: var(--text-mute); margin-top: 2px; }

/* ═══════════════ MONOSPACE TEXT HELPERS ═══════════════ */
.mono { font-family: 'Fira Code', monospace; }
.text-mute { color: var(--text-mute); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-destructive { color: var(--destructive); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }

/* Toolbar inside cards */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* JSON display */
.json-display {
  font-family: 'Fira Code', monospace; font-size: 10.5px; color: var(--text-dim);
  white-space: pre-wrap; word-break: break-all;
  max-height: 400px; overflow-y: auto;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 5px; padding: 8px; margin: 0; line-height: 1.65;
}

/* Timeline / log styles */
.log-line {
  font-family: 'Fira Code', monospace;
  font-size: 11px; color: var(--text-dim);
  padding: 3px 0; border-bottom: 1px solid var(--border-faint);
  line-height: 1.5;
}
.log-line .log-ts { color: var(--text-mute); margin-right: 8px; }
.log-line .log-lvl { font-weight: 600; margin-right: 6px; }
.log-line .log-lvl.INFO { color: var(--info); }
.log-line .log-lvl.WARN { color: var(--warning); }
.log-line .log-lvl.ERROR { color: var(--destructive); }
.log-line .log-lvl.DEBUG { color: var(--text-mute); }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.flex-1 { flex: 1; min-height: 0; }
.flex-row { display: flex; gap: 14px; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
