/* ============================================================================
   KOBA42 Mission Control v2 — k42 design system (dark glass)
   ========================================================================== */

:root {
  --bg: #050507;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --hairline: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #86868b;
  --accent: #0071e3;
  --accent-bright: #2997ff;
  --ok: #30d158;
  --warn: #ffd60a;
  --err: #ff453a;
  --radius: 16px;
  --radius-sm: 10px;
  --speed: 180ms;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--panel-strong); padding: 1px 5px; border-radius: 5px; }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 600;
  color: var(--muted);
  background: var(--panel-strong);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 1px 6px;
}

::selection { background: rgba(41, 151, 255, 0.35); }

/* Focus rings — keyboard only */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
  border-radius: 6px;
}

.glass {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 360px;
  padding: 36px 32px;
  text-align: center;
  backdrop-filter: blur(20px);
}
.wordmark {
  font-size: 12px; font-weight: 700; letter-spacing: 0.22em;
  color: var(--accent-bright);
}
.login-card h1 { font-size: 24px; font-weight: 600; margin: 8px 0 4px; }
.login-card p { font-size: 13px; margin-bottom: 22px; }
.login-card input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--speed) ease;
}
.login-card input:focus { border-color: var(--accent); }
.login-card .btn.block { margin-top: 12px; }
.login-error { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--err); }

.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: 216px;
  flex: 0 0 216px;
  display: flex; flex-direction: column;
  padding: 20px 12px;
  border-right: 1px solid var(--hairline);
  position: sticky; top: 0; height: 100vh;
}
.rail-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 20px;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 700;
  flex: 0 0 auto;
}
.brand-text { font-size: 14px; font-weight: 600; white-space: nowrap; }

.rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px; font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  width: 100%;
  position: relative;
  transition: color var(--speed) ease, background var(--speed) ease;
}
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active { color: var(--text); background: var(--panel-strong); }
.nav-item.active svg { color: var(--accent-bright); }
.nav-item svg { flex: 0 0 auto; }
.nav-badge {
  margin-left: auto;
  min-width: 19px; height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.content-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 32px 0;
}
.palette-hint {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px; font-family: var(--font);
  cursor: pointer;
  min-width: 0;
  transition: color var(--speed) ease, border-color var(--speed) ease;
}
.palette-hint:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.18); }
.palette-hint .hint-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }

.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
  transition: background var(--speed) ease, box-shadow var(--speed) ease;
}
.live-dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(48, 209, 88, 0.6); }
.live-dot.warn { background: var(--warn); box-shadow: 0 0 8px rgba(255, 214, 10, 0.5); }
.live-dot.off { background: var(--muted); }

/* ---------- Main / page scaffolding ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: 22px 32px 60px;
  max-width: 1220px;
  width: 100%;
}
.page-title { font-size: 26px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.01em; }
.page-sub { font-size: 13px; color: var(--muted); margin-bottom: 22px; }

.panel { padding: 20px; margin-bottom: 18px; }
.panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.panel h2 .sub { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 18px; }

/* ---------- KPI cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 16px 18px; transition: border-color var(--speed) ease; }
.stat-card:hover { border-color: rgba(255, 255, 255, 0.14); }
.stat-card .label { font-size: 12px; color: var(--muted); }
.stat-card .value { font-size: 30px; font-weight: 650; margin-top: 2px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-card .hint { font-size: 11px; color: var(--muted); margin-top: 2px; }

.delta-chip {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--panel-strong);
  color: var(--muted);
}
.delta-chip.up { color: var(--ok); background: rgba(48, 209, 88, 0.12); }
.delta-chip.down { color: var(--err); background: rgba(255, 69, 58, 0.12); }
.delta-chip .delta-suffix { font-weight: 400; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--panel-strong);
  color: var(--text);
  font-size: 13px; font-weight: 550; font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background var(--speed) ease, border-color var(--speed) ease, opacity var(--speed) ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-bright); }
.btn.danger { background: rgba(255, 69, 58, 0.14); border-color: rgba(255, 69, 58, 0.4); color: var(--err); }
.btn.danger:hover { background: rgba(255, 69, 58, 0.24); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel); }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }

/* ---------- Inputs & forms ---------- */
input[type="text"], input[type="search"], input[type="password"], input[type="email"],
input[type="date"], input[type="url"], select, textarea {
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: var(--text);
  font-size: 14px; font-family: var(--font);
  outline: none;
  transition: border-color var(--speed) ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2386868b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
select option { background: #101014; color: var(--text); }
textarea { resize: vertical; min-height: 74px; }
input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="date"] { color-scheme: dark; }
label.field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.form-row { margin-bottom: 14px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }

/* Password strength hint */
.strength { display: flex; gap: 4px; margin-top: 7px; }
.strength span { height: 4px; flex: 1; border-radius: 2px; background: var(--panel-strong); transition: background var(--speed) ease; }
.strength.s1 span:nth-child(-n+1) { background: var(--err); }
.strength.s2 span:nth-child(-n+2) { background: var(--warn); }
.strength.s3 span:nth-child(-n+3) { background: var(--accent-bright); }
.strength.s4 span:nth-child(-n+4) { background: var(--ok); }
.strength-note { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ---------- Toolbar / chips ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar input[type="search"] { flex: 1 1 220px; }
.toolbar .spacer { flex: 1; }
.chip {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px; font-weight: 550; font-family: var(--font);
  cursor: pointer;
  transition: color var(--speed) ease, background var(--speed) ease, border-color var(--speed) ease;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Tags (status + legacy stage) ---------- */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px; font-weight: 550;
  background: var(--panel-strong);
  border: 1px solid var(--hairline);
  color: var(--text);
  white-space: nowrap;
}
.tag.learn { color: var(--accent-bright); }
.tag.evaluate { color: #6cb4ff; }
.tag.scope { color: var(--warn); }
.tag.build { color: var(--ok); }
.tag.status-new { color: var(--accent-bright); border-color: rgba(41, 151, 255, 0.35); }
.tag.status-contacted { color: #6cb4ff; border-color: rgba(108, 180, 255, 0.3); }
.tag.status-qualified { color: var(--warn); border-color: rgba(255, 214, 10, 0.35); }
.tag.status-won { color: var(--ok); border-color: rgba(48, 209, 88, 0.4); }
.tag.status-lost { color: var(--err); border-color: rgba(255, 69, 58, 0.4); }

/* Star toggle */
.star {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1;
  padding: 3px; border-radius: 6px;
  transition: color var(--speed) ease, transform var(--speed) ease;
}
.star:hover { color: var(--warn); transform: scale(1.15); }
.star.on { color: var(--warn); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data, table.leads { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.leads th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
table.data th .sort-arrow { margin-left: 4px; font-size: 9px; }
table.data td, table.leads td {
  padding: 10px; border-bottom: 1px solid var(--hairline);
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
table.data tbody tr, table.leads tbody tr { transition: background var(--speed) ease; }
table.data tbody tr.clickable, table.leads tbody tr.clickable { cursor: pointer; }
table.data tbody tr:hover, table.leads tbody tr:hover { background: var(--panel); }
table.data tbody tr.selected { background: rgba(0, 113, 227, 0.12); }
td.checkbox-col, th.checkbox-col { width: 34px; max-width: 34px; }

/* Pagination */
.pagination {
  display: flex; align-items: center; gap: 10px;
  padding-top: 14px;
  font-size: 12.5px; color: var(--muted);
}
.pagination .spacer { flex: 1; }

/* Bulk actions bar */
.bulkbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 113, 227, 0.12);
  border: 1px solid rgba(0, 113, 227, 0.35);
  font-size: 13px;
}

/* ---------- Lists / activity feed ---------- */
.lead-list, .feed { display: flex; flex-direction: column; }
.lead-row, .feed-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 4px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
}
.lead-row { cursor: pointer; }
.lead-row:first-child, .feed-row:first-child { border-top: none; }
.lead-row:hover { background: var(--panel); }
.lead-row .when, .feed-row .when { color: var(--muted); flex: 0 0 70px; font-size: 12px; }
.lead-row .email { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row .tag { margin-left: auto; }
.feed-row.entering { animation: feedIn 0.3s ease; }
@keyframes feedIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

/* ---------- Drawer ---------- */
.drawer-back {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  opacity: 0;
  transition: opacity var(--speed) ease;
}
.drawer-back.shown { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 100vw);
  z-index: 50;
  background: #101014;
  border-left: 1px solid var(--hairline);
  overflow-y: auto;
  padding: 24px;
  transform: translateX(100%);
  transition: transform 220ms ease;
}
.drawer.shown { transform: translateX(0); }
.drawer h2 { font-size: 17px; font-weight: 600; margin-bottom: 2px; word-break: break-all; }
.drawer .close, .modal .close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--panel-strong); color: var(--muted);
  font-size: 15px; cursor: pointer;
  transition: color var(--speed) ease;
}
.drawer .close:hover, .modal .close:hover { color: var(--text); }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; margin: 18px 0; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-word; }

pre.json, pre.output {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 13px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-x: auto;
  color: #c8c8ce;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Notes */
.note-item {
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 13px;
  margin-bottom: 8px;
  position: relative;
}
.note-item .note-meta { font-size: 11px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; }
.note-item .note-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.note-item .note-del:hover { color: var(--err); }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--speed) ease;
}
.modal-back.shown { opacity: 1; }
.modal {
  position: relative;
  width: 100%; max-width: 440px;
  background: #101014;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-pop);
  transform: translateY(10px) scale(0.98);
  transition: transform 200ms ease;
}
.modal-back.shown .modal { transform: none; }
.modal h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.modal p { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Kanban (pipeline) ---------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 10px;
}
.kanban-col {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 180px;
  transition: border-color var(--speed) ease, background var(--speed) ease;
}
.kanban-col.drag-over { border-color: var(--accent-bright); background: rgba(0, 113, 227, 0.08); }
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 600;
  padding: 2px 4px 10px;
}
.kanban-col-head .col-count {
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--panel-strong);
  border-radius: 10px; padding: 1px 8px;
}
.kanban-card {
  background: var(--panel-strong);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 12.5px;
  cursor: grab;
  transition: border-color var(--speed) ease, opacity var(--speed) ease, transform var(--speed) ease;
}
.kanban-card:hover { border-color: rgba(255, 255, 255, 0.18); }
.kanban-card.dragging { opacity: 0.45; cursor: grabbing; }
.kanban-card .card-email { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card .card-meta { display: flex; align-items: center; gap: 7px; margin-top: 6px; color: var(--muted); font-size: 11px; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; right: 18px; bottom: 18px;
  z-index: 100;
  display: flex; flex-direction: column; gap: 9px;
  max-width: min(380px, calc(100vw - 36px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(22, 22, 26, 0.96);
  border: 1px solid var(--hairline);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast.shown { opacity: 1; transform: none; }
.toast.leaving { opacity: 0; transform: translateY(8px); }
.toast-icon { display: inline-flex; flex: 0 0 auto; }
.toast-info .toast-icon { color: var(--accent-bright); }
.toast-success .toast-icon { color: var(--ok); }
.toast-error .toast-icon { color: var(--err); }
.toast-body { flex: 1; min-width: 0; word-break: break-word; }
.toast-action {
  background: none; border: none; cursor: pointer;
  color: var(--accent-bright); font-size: 13px; font-weight: 600; font-family: var(--font);
  padding: 3px 6px; border-radius: 6px;
  flex: 0 0 auto;
}
.toast-action:hover { background: var(--panel-strong); }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 12px; padding: 3px;
  flex: 0 0 auto;
}
.toast-close:hover { color: var(--text); }

/* ---------- Command palette ---------- */
.palette-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  display: flex; justify-content: center;
  padding: 12vh 18px 18px;
  backdrop-filter: blur(3px);
}
.palette {
  width: 100%; max-width: 560px;
  height: fit-content; max-height: 66vh;
  display: flex; flex-direction: column;
  background: rgba(18, 18, 22, 0.98);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: paletteIn 180ms ease;
}
@keyframes paletteIn { from { opacity: 0; transform: translateY(-8px) scale(0.99); } to { opacity: 1; transform: none; } }
.palette-input {
  width: 100%;
  padding: 15px 18px;
  border: none; border-bottom: 1px solid var(--hairline);
  background: none;
  color: var(--text);
  font-size: 15px; font-family: var(--font);
  outline: none;
  border-radius: 0;
}
.palette-list { overflow-y: auto; padding: 7px; flex: 1; }
.palette-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  cursor: pointer;
}
.palette-item.selected { background: var(--accent); color: #fff; }
.palette-item.selected .palette-hint-text { color: rgba(255, 255, 255, 0.7); }
.palette-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint-text { font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.palette-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.palette-foot {
  display: flex; gap: 16px;
  padding: 9px 16px;
  border-top: 1px solid var(--hairline);
  font-size: 11px; color: var(--muted);
}
.palette-foot kbd { margin-right: 3px; }

/* ---------- Skeletons ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border-radius: var(--radius-sm);
}
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-page .sk-title { height: 30px; width: 220px; margin-bottom: 10px; }
.skeleton-page .sk-sub { height: 14px; width: 320px; margin-bottom: 24px; }
.skeleton-page .sk-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.skeleton-page .sk-card { height: 92px; border-radius: var(--radius); }
.skeleton-page .sk-panel { height: 240px; border-radius: var(--radius); margin-bottom: 18px; }
.skeleton-page .sk-panel.short { height: 140px; }
.sk-row { height: 38px; margin-bottom: 8px; }

/* ---------- Empty states ---------- */
.empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty .empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty p { margin: 3px 0; }
.empty .btn { margin-top: 14px; }
.empty .mono-note { font-family: var(--mono); font-size: 11px; }

/* ---------- Charts ---------- */
.chart-wrap { overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; }
svg.chart text { font-family: var(--font); }
svg.spark { display: block; }

/* uPlot dark adjustments (vendored CSS assumes light theme) */
.uplot { width: 100%; font-family: var(--font); }
.u-select { background: rgba(41, 151, 255, 0.15); }
.u-legend { display: none; }

.chart-tip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  background: rgba(18, 18, 22, 0.97);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.chart-tip .tip-date { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.chart-tip .tip-swatch { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.chart-tip .tip-val { margin-left: auto; padding-left: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.donut-wrap .legend { flex-direction: column; gap: 7px; margin-top: 0; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend .swatch, .legend-item .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend-count { color: var(--text); font-weight: 600; }

/* ---------- Systems ---------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.dot.ok { background: var(--ok); box-shadow: 0 0 6px rgba(48, 209, 88, 0.6); }
.dot.warn { background: var(--warn); box-shadow: 0 0 6px rgba(255, 214, 10, 0.5); }
.dot.err { background: var(--err); box-shadow: 0 0 6px rgba(255, 69, 58, 0.6); }
.dot.off { background: var(--muted); }

.health-strip { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13px; }
.health-strip .item { display: flex; align-items: center; }

.meter { margin: 10px 0 16px; }
.meter .meter-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.meter .track { height: 8px; border-radius: 5px; background: var(--panel-strong); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 5px; background: var(--accent); transition: width 250ms ease; }
.meter .fill.warn { background: var(--warn); }
.meter .fill.err { background: var(--err); }

/* Command rows */
.command-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
}
.command-row:first-child { border-top: none; }
.command-status {
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 20px;
  background: var(--panel-strong);
}
.command-status.pending { color: var(--muted); }
.command-status.running { color: var(--accent-bright); }
.command-status.done { color: var(--ok); }
.command-status.error { color: var(--err); }
@keyframes pulse { 50% { opacity: 0.45; } }
.command-status.running { animation: pulse 1.4s ease-in-out infinite; }

/* ---------- Report ---------- */
.report-headline { font-size: 19px; font-weight: 600; margin-bottom: 4px; }
.report-headline .up { color: var(--ok); }
.report-headline .down { color: var(--err); }
.deep-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Content cards ---------- */
.magnet-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.magnet-card .name { font-weight: 600; font-size: 15px; }
.magnet-card .count { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.magnet-card .count small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.magnet-card .links { display: flex; gap: 14px; font-size: 13px; flex-wrap: wrap; }
.magnet-card .note { font-size: 11.5px; color: var(--muted); }

/* Editorial board */
.board-group { margin-bottom: 6px; }
.board-group h3 { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 10px 2px 8px; }
.board-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--panel);
  margin-bottom: 7px;
  font-size: 13px;
}
.board-item .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Misc ---------- */
.loading { color: var(--muted); font-size: 13px; padding: 24px; text-align: center; }
.footer-note { font-size: 11.5px; color: var(--muted); margin-top: 26px; }
.view-missing code { word-break: break-all; }
.mono { font-family: var(--mono); }

/* Settings info cards */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.step-list { margin: 8px 0 0 18px; font-size: 13px; color: var(--muted); }
.step-list li { margin-bottom: 6px; }

/* ---------- Phone: rail becomes bottom tabs ---------- */
@media (max-width: 980px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(5, minmax(200px, 240px)); }
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto;
    flex-direction: row; align-items: center;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--hairline);
    background: rgba(5, 5, 7, 0.92);
    backdrop-filter: blur(20px);
    z-index: 30;
  }
  .rail-brand { display: none; }
  .rail-nav {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .rail-nav::-webkit-scrollbar { display: none; }
  .nav-item { justify-content: center; padding: 10px 13px; flex: 1 0 auto; width: auto; }
  .nav-item .nav-label { display: none; }
  .nav-badge {
    position: absolute; top: 4px; right: 6px;
    margin: 0; min-width: 15px; height: 15px; font-size: 9px;
  }
  .topbar { padding: 12px 16px 0; }
  .palette-hint .hint-text { display: none; }
  .topbar-right .live-label { display: none; }
  #signOutBtn span { display: none; }
  .main { padding: 18px 16px 110px; }
  .cards, .skeleton-page .sk-cards { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 105px 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .toasts { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .palette-overlay { padding-top: 8vh; }
}

@media (max-width: 400px) {
  .cards, .skeleton-page .sk-cards { grid-template-columns: 1fr; }
}

/* ---------- Print (weekly report) ---------- */
@media print {
  html, body { background: #fff; color: #000; font-size: 12px; }
  .rail, .topbar, .toasts, .palette-overlay, .drawer, .drawer-back, .modal-back, .no-print { display: none !important; }
  .main { max-width: none; padding: 0; }
  .glass, .panel {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    break-inside: avoid;
  }
  .muted, .page-sub, .footer-note { color: #555; }
  .page-title { color: #000; }
  .stat-card .value, .report-headline, .panel h2, .empty .empty-title { color: #000; }
  table.data th, table.leads th { color: #555; border-color: #ddd; }
  table.data td, table.leads td { border-color: #eee; color: #000; }
  .tag { border-color: #ccc; color: #333 !important; background: none; }
  a { color: #0053a6; text-decoration: underline; }
  .btn { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .skeleton::after { display: none; }
}
