/* AAMOS Pro / Wavult Group — UNIFIED Design System
   ALL roles use these tokens. Same theme everywhere.
   CTO/Johan gets the same Warm Enterprise look — just with more advanced tools.
*/

:root {
  /* === Surfaces === */
  --bg: #FAF9F6;
  --card: #FFFFFF;
  --surface: #F4F1EC;
  --surface-deep: #EDE8E0;
  --border: #E8E3DC;
  --border-strong: #D5CFC4;
  
  /* === Text === */
  --text: #001E50;
  --text-soft: #6B7280;
  --text-dim: #9aa3b0;
  
  /* === Brand === */
  --accent: #C8763A;
  --accent-deep: #A55F2C;
  --accent-soft: rgba(200,118,58,.10);
  --navy: #001E50;
  --navy-deep: #000F33;
  
  /* === Semantic colors === */
  --green: #16a34a;
  --green-soft: rgba(22,163,74,.1);
  --red: #dc2626;
  --red-soft: rgba(220,38,38,.1);
  --amber: #d97706;
  --amber-soft: rgba(217,119,6,.1);
  --blue: #2563eb;
  --blue-soft: rgba(37,99,235,.1);
  
  /* === Visual === */
  --shadow-sm: 0 1px 2px rgba(0,30,80,.04);
  --shadow: 0 2px 8px rgba(0,30,80,.06), 0 1px 2px rgba(0,30,80,.04);
  --shadow-lg: 0 8px 24px rgba(0,30,80,.08);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  
  /* === Type === */
  --sans: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --type-heading: var(--sans);
  --type-body: var(--sans);
  --type-num: var(--mono);
  --type-code: var(--mono);
}

/* Engineering tools (CTO views) — same theme but denser typography for code/data */
[data-density="dense"] {
  --type-body: var(--mono);
  --radius: 6px;
  --radius-sm: 4px;
}

/* === Reset === */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* === Card === */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
}
.card-h { font-size: 11px; font-weight: 700; color: var(--text-soft); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px; }
.card-v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; font-family: var(--type-num); }
.card-sub { font-size: 11px; color: var(--text-soft); margin-top: 4px; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card); color: var(--text);
  transition: all .15s;
}
.btn:hover { border-color: var(--accent); background: var(--surface); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-danger { color: var(--red); border-color: var(--red-soft); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }

/* === Status badges === */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-family: var(--mono); }
.badge.live, .badge.ok, .badge.success { background: var(--green-soft); color: var(--green); }
.badge.warn, .badge.pending { background: var(--amber-soft); color: var(--amber); }
.badge.danger, .badge.error, .badge.overdue, .badge.down { background: var(--red-soft); color: var(--red); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.neutral { background: var(--surface); color: var(--text-soft); }

/* === Alert banner === */
.alert {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 12px;
}
.alert.danger { border-left-color: var(--red); background: var(--red-soft); }
.alert.success { border-left-color: var(--green); background: var(--green-soft); }
.alert.info { border-left-color: var(--blue); background: var(--blue-soft); }
.alert-icon { font-size: 18px; flex-shrink: 0; }
.alert-body h4 { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.alert-body p { font-size: 12px; color: var(--text-soft); line-height: 1.5; }

/* === Anatomic flow === */
.flow {
  display: flex; align-items: center; gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
}
.flow-step { flex: 1; text-align: center; padding: 12px; position: relative; min-width: 120px; }
.flow-step:not(:last-child)::after {
  content: '→'; position: absolute; right: -8px; top: 50%;
  transform: translateY(-50%); color: var(--text-dim); font-size: 18px; font-weight: 700;
}
.flow-step-count { font-size: 24px; font-weight: 800; font-family: var(--mono); }
.flow-step-label { font-size: 10px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.flow-step.active .flow-step-count { color: var(--accent); }
.flow-step.warn .flow-step-count { color: var(--amber); }
.flow-step.danger .flow-step-count { color: var(--red); }

/* === Dense data tables (Avanza-style) === */
table.dense, table.data {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: 12px;
}
table.dense th, table.data th {
  text-align: left; padding: 8px 10px;
  background: var(--surface);
  font-size: 10px; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
table.dense td, table.data td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
table.dense tr:hover td, table.data tr:hover td { background: var(--surface); }
table.dense .num, table.data .num { text-align: right; }
table.dense .neg, table.data .neg { color: var(--red); }
table.dense .pos, table.data .pos { color: var(--green); }
table.dense .mono, table.data .mono { font-family: var(--mono); }

/* === Code blocks (engineering view) === */
pre, code {
  font-family: var(--mono);
  background: var(--surface);
  border-radius: var(--radius-sm);
}
pre {
  padding: 14px 16px;
  border: 1px solid var(--border);
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.5;
}
code:not(pre code) {
  padding: 2px 6px;
  font-size: 90%;
  color: var(--accent-deep);
}

/* === Headings unified === */
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
h4 { font-size: 13px; font-weight: 700; }
.heading-eyebrow {
  font-family: var(--mono);
  font-size: 11px; font-weight: 700;
  color: var(--accent); letter-spacing: .15em;
  text-transform: uppercase;
}

/* === Sidebar (consistent across all dashboards) === */
.aamos-sidebar {
  background: var(--navy);
  color: rgba(255,255,255,.85);
  padding: 16px 0;
  display: flex; flex-direction: column;
  height: 100vh;
}
.aamos-sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.7);
  cursor: pointer; text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .12s;
}
.aamos-sidebar-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.aamos-sidebar-item.active {
  background: rgba(200,118,58,.15);
  border-left-color: var(--accent);
  color: #fff;
}

/* === Header === */
.aamos-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.aamos-brand { font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.aamos-brand-pro { color: var(--accent); }

/* === Layout === */
.aamos-app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.aamos-main {
  padding: 32px 40px;
  overflow-y: auto;
}
@media(max-width:900px) {
  .aamos-app { grid-template-columns: 1fr; }
  .aamos-sidebar { display: none; }
  .aamos-main { padding: 20px; }
}

/* ============================================================
   APPLE-NATIVE PRECISION LAYER — added 2026-05-04
   Erik directive: tighter, more Apple-native, custom illustrations
   ============================================================ */

:root {
  /* === Precision shadows === */
  --shadow-precise:  0 0.5px 0 rgba(0,30,80,.06), 0 4px 12px rgba(0,30,80,.04);
  --shadow-elevated: 0 4px 20px rgba(0,30,80,.08), 0 1px 3px rgba(0,30,80,.04);

  /* === Motion === */
  --hover-lift:    translateY(-1px);
  --ease-apple:    cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.15s var(--ease-apple);

  /* === Typography === */
  --font-features: "ss01", "cv01", "tnum";

  /* === Border-radius hierarchy === */
  --radius-xs:   4px;   /* inputs, tags */
  --radius-sm:   6px;   /* small elements */
  --radius:      10px;  /* cards */
  --radius-lg:   14px;  /* modals, dialogs */
  --radius-hero: 20px;  /* hero sections */

  /* === Nested surfaces (never pure white) === */
  --surface-nest: #FAFAFA;

  /* === Status dot sizes === */
  --dot-size: 6px;
}

/* === Body: enable font features globally === */
body {
  font-feature-settings: var(--font-features);
}

/* === Card: precision shadow + hover lift === */
.card {
  box-shadow: var(--shadow-precise);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card:hover {
  transform: var(--hover-lift);
  box-shadow: var(--shadow-elevated);
}

/* === Button: press feel === */
.btn:active { transform: scale(0.98); }

/* === Tabular numbers for stat elements === */
.card-v,
.num, .stat-val, .stat-number, .kpi-val,
[data-num], [class*="metric"], [class*="count"],
table.dense td, table.data td {
  font-variant-numeric: tabular-nums;
  font-feature-settings: var(--font-features);
}

/* ============================================================
   PRECISION COMPONENTS
   ============================================================ */

/* --- Clickable row with hover + disclosure chevron --- */
.row-clickable {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-base);
  position: relative;
  text-decoration: none;
  color: inherit;
}
.row-clickable::after {
  content: '›';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 400;
  color: var(--text-dim);
  transition: color var(--transition-base), transform var(--transition-base);
  line-height: 1;
}
.row-clickable:hover {
  background: var(--surface);
}
.row-clickable:hover::after {
  color: var(--accent);
  transform: translateY(-50%) translateX(2px);
}
.row-clickable + .row-clickable {
  border-top: 1px solid var(--border);
}

/* --- Status dot --- */
.status-dot {
  display: inline-block;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--text-dim);
}
.status-dot.live, .status-dot.ok, .status-dot.success {
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green-soft);
  animation: dot-pulse 2s ease-in-out infinite;
}
.status-dot.warn, .status-dot.pending {
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--amber-soft);
}
.status-dot.danger, .status-dot.error, .status-dot.down {
  background: var(--red);
  box-shadow: 0 0 0 2px var(--red-soft);
}
.status-dot.info { background: var(--blue); }

@keyframes dot-pulse {
  0%,100% { box-shadow: 0 0 0 2px var(--green-soft); }
  50%      { box-shadow: 0 0 0 4px rgba(22,163,74,.05); }
}

/* Status label: dot before text */
.status-label {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
}

/* --- Empty state with illustration --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
  gap: 16px;
  min-height: 220px;
}
.empty-state-img {
  width: 180px;
  height: 135px;
  object-fit: contain;
  opacity: 0.92;
  border-radius: var(--radius);
  pointer-events: none;
}
.empty-state-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.empty-state-desc {
  font-size: 13px;
  color: var(--text-soft);
  max-width: 280px;
  line-height: 1.5;
}

/* --- Module thumbnail card (OUROBOROS Hub grid) --- */
.module-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-precise);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.module-card:hover {
  transform: var(--hover-lift);
  box-shadow: var(--shadow-elevated);
}
.module-card-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--surface);
  display: block;
}
.module-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.module-card-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.module-card-meta {
  font-size: 11px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.module-card-status {
  display: flex;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
}

/* --- Hero illustration block --- */
.hero-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--surface);
  border-radius: var(--radius-hero);
  margin-bottom: 32px;
}
.hero-illustration img {
  max-width: 420px;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
}
