/* ProcureOS dashboard — Linear-inspired, golden-ratio scale.
   φ = 1.618. Spacing & type steps follow the Fibonacci sequence
   (4,8,13,21,34,55,89) which converges on φ, so every gap and size
   relates to its neighbours by ~1.618. Nothing is scattered: one shell,
   one card component, one accent, one spacing rhythm. */

:root {
  /* Fibonacci spacing (px) */
  --s1: 4px; --s2: 8px; --s3: 13px; --s4: 21px; --s5: 34px; --s6: 55px; --s7: 89px;
  /* Type scale (Fibonacci-ish, ratio ≈ φ) */
  --t-xs: 11px; --t-sm: 13px; --t-md: 16px; --t-lg: 21px; --t-xl: 34px;
  /* Golden geometry */
  --sidebar: 233px;          /* Fibonacci; sidebar:content reads ~1:φ */
  --content-max: 1220px;
  --radius: 10px;

  /* Palette (dark, Linear-like) */
  /* Chak Hao brand palette (ADR-0005 D3): dark forest surfaces, leaf accent,
     turmeric amber, terracotta red — replaces the pre-brand indigo/slate. */
  --bg: #0f1511;
  --surface: #151d17;
  --surface-2: #1a231c;
  --border: #243026;
  --border-2: #2e3b30;
  --text: #e7eae4;
  --muted: #8ea593;
  --accent: #6fb356;
  --accent-soft: rgba(111, 179, 86, 0.14);
  --green: #6fb356;
  --amber: #e0a12f;
  --red: #d4593f;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--t-sm)/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.muted { color: var(--muted); }
.xs { font-size: var(--t-xs); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  background: #0f1013;
  border-right: 1px solid var(--border);
  padding: var(--s4) var(--s3);
  display: flex; flex-direction: column; gap: var(--s5);
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s2); }
.brand-mark { color: var(--accent); font-size: var(--t-lg); line-height: 1; }
.brand-name { font-weight: 600; letter-spacing: .2px; font-size: var(--t-md); }

.nav { display: flex; flex-direction: column; gap: var(--s1); flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s3); border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: var(--t-sm);
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #c9cffb; }
.nav-ico { width: 18px; text-align: center; opacity: .9; }

.sidebar-foot { display: flex; flex-direction: column; gap: var(--s1); padding: 0 var(--s2); }
.dot-row { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-xs); color: var(--muted); }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(13,14,16,.86); backdrop-filter: blur(8px); z-index: 5;
}
.topbar h1 { margin: 0; font-size: var(--t-lg); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: var(--s3); }

.content { padding: var(--s5); max-width: var(--content-max); width: 100%; }

/* ---------- primitives ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(76,183,130,.16); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(235,87,87,.16); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(245,196,81,.16); }

.pill {
  font-size: var(--t-xs); padding: var(--s1) var(--s3); border-radius: 999px;
  border: 1px solid var(--border-2); color: var(--muted); background: var(--surface);
}
.pill.ok { color: #b8ecd2; border-color: rgba(76,183,130,.4); background: rgba(76,183,130,.1); }
.pill.bad { color: #f6c2c2; border-color: rgba(235,87,87,.4); background: rgba(235,87,87,.1); }

.btn {
  font-size: var(--t-sm); color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-2); border-radius: 8px; padding: var(--s2) var(--s3);
  cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: #23262e; border-color: #363a44; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 var(--s3); font-size: var(--t-sm); font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; }

/* stat card grid — min 233px (golden) cards, even rhythm */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(233px, 1fr)); gap: var(--s4); }
.stat { display: flex; flex-direction: column; gap: var(--s2); }
.stat .val { font-size: var(--t-xl); font-weight: 600; line-height: 1; letter-spacing: -.5px; }
.stat .lab { font-size: var(--t-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.stat .sub { font-size: var(--t-xs); color: var(--muted); }

/* golden two-column: main : side = φ : 1 */
.split { display: grid; grid-template-columns: 1.618fr 1fr; gap: var(--s4); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } .sidebar { display: none; } }

.section-gap { margin-top: var(--s5); }

/* readiness banner */
.banner {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--s5); border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
}
.banner.ready { border-color: rgba(76,183,130,.35); background: linear-gradient(0deg, rgba(76,183,130,.06), transparent); }
.banner.notready { border-color: rgba(245,196,81,.35); background: linear-gradient(0deg, rgba(245,196,81,.06), transparent); }
.banner .big { font-size: var(--t-lg); font-weight: 600; }
.banner .ring { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--border-2); font-size: var(--t-lg); }
.banner.ready .ring { border-color: var(--green); color: var(--green); }
.banner.notready .ring { border-color: var(--amber); color: var(--amber); }

/* checklist */
.check { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.check:last-child { border-bottom: 0; }
.check .lab { flex: 1; }
.check .det { color: var(--muted); font-size: var(--t-xs); }

/* lists / tables */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { font-size: var(--t-xs); padding: var(--s1) var(--s2); border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.chip.role { border-color: rgba(94,106,210,.4); color: #c9cffb; background: var(--accent-soft); }

.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: var(--t-xs);
  text-transform: uppercase; letter-spacing: .5px; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
.tbl td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--t-xs); }
.method { font-family: ui-monospace, monospace; font-size: 10px; padding: 2px 6px; border-radius: 5px;
  background: var(--accent-soft); color: #c9cffb; }

.empty { text-align: center; color: var(--muted); padding: var(--s6) var(--s4); }
.empty .big { font-size: var(--t-lg); color: var(--text); margin-bottom: var(--s2); }

a.link { color: #9aa4f2; text-decoration: none; }
a.link:hover { text-decoration: underline; }
.loading { color: var(--muted); padding: var(--s5); }

/* Settings tab form controls */
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.cfg-in {
  font-size: var(--t-sm); color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-2); border-radius: 6px; padding: 4px 8px; width: 88px;
}
.cfg-in.wide { width: 230px; }
.tgl { cursor: pointer; user-select: none; }
.tgl input { vertical-align: middle; margin-right: 4px; }
