/* Harbor — design tokens + primitives.
   System: Data-Dense Dashboard × OLED dark (ui-ux-pro-max), trust-blue accent,
   Lexend display / Source Sans 3 body, conservative status colors. */

@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/fonts/lexend-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin.woff2') format('woff2');
}

:root {
  /* Surfaces — true-black AMOLED ladder */
  --page: #000000;
  --surface-1: #0a0a0c;
  --surface-2: #121216;
  --surface-3: #1a1a20;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* Ink */
  --ink: #f4f5f7;
  --ink-2: #a6abb8;
  --ink-3: #6c7280;

  /* Brand (trust blue) */
  --brand: #3b82f6;
  --brand-hover: #60a5fa;
  --brand-soft: rgba(59, 130, 246, 0.14);

  /* Status — icon + label always accompany color */
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.13);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.13);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.13);

  /* Data series */
  --chart-1: #3b82f6;
  --chart-2: #22c55e;
  --chart-grid: rgba(255, 255, 255, 0.06);

  /* Geometry */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.7);
  --shadow-2: 0 8px 32px rgba(0, 0, 0, 0.65);

  /* Z scale */
  --z-nav: 10;
  --z-drawer: 30;
  --z-modal: 40;
  --z-toast: 50;

  /* Type */
  --font-display: 'Lexend', system-ui, sans-serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, .display { font-family: var(--font-display); }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.07em; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--brand); text-decoration: none; cursor: pointer; }
a:hover { color: var(--brand-hover); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 16px;
  font: 600 14px/1 var(--font-body);
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background 180ms, border-color 180ms, color 180ms, opacity 180ms;
}
.btn:hover { background: var(--surface-3); border-color: rgba(255, 255, 255, 0.24); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--brand); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: transparent; }
.btn-danger { background: transparent; border-color: rgba(239, 68, 68, 0.4); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { min-height: 30px; padding: 5px 11px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn.loading { pointer-events: none; opacity: 0.7; }
.btn.loading::before {
  content: ""; width: 14px; height: 14px; flex: none;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
label { display: block; margin: 14px 0 6px; font: 600 12.5px/1 var(--font-body); color: var(--ink-2); }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  font: 400 14px/1.4 var(--font-body); color: var(--ink);
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color 180ms;
}
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.26); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea { font-family: var(--font-mono); font-size: 12.5px; min-height: 120px; resize: vertical; }
select { cursor: pointer; }
.field-err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 8px; }

/* ---------- Badges (dot + label — color never alone) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font: 600 11.5px/1.4 var(--font-body); letter-spacing: 0.02em; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--ink-3); flex: none; }
.badge-ok { background: var(--ok-soft); border-color: transparent; color: #4ade80; }
.badge-ok::before { background: var(--ok); }
.badge-warn { background: var(--warn-soft); border-color: transparent; color: #fbbf24; }
.badge-warn::before { background: var(--warn); }
.badge-danger { background: var(--danger-soft); border-color: transparent; color: #f87171; }
.badge-danger::before { background: var(--danger); }
.badge-brand { background: var(--brand-soft); border-color: transparent; color: var(--brand-hover); }
.badge-brand::before { background: var(--brand); }
.badge.pulse::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.2; } }

/* ---------- Tag chips ---------- */
.chip {
  display: inline-block; padding: 2px 8px; margin-inline-start: 4px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink-2);
  font: 500 11px/1.4 var(--font-body); letter-spacing: 0.02em;
  vertical-align: 1px; white-space: nowrap;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 18px 20px; }

/* ---------- Skeletons ---------- */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-2); border-radius: var(--r-sm);
  min-height: 14px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- Empty state ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 44px 20px; text-align: center; color: var(--ink-3);
}
.empty-state svg { width: 34px; height: 34px; opacity: 0.5; }
.empty-state p { font-size: 14px; max-width: 42ch; }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; border: 2px solid var(--page); }
::-webkit-scrollbar-track { background: transparent; }
