/* ==========================================================================
   Uniqueness as Capital — Design System
   Concept: a capital-markets ledger applied to organizational diagnostics.
   Ink-navy terminal surfaces, a single brass "capital" accent, scores read
   like tracked instruments rather than generic progress bars.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #0b0f17;
  --surface: #10162a;
  --surface-raised: #171f38;
  --surface-hairline: rgba(155, 166, 187, 0.14);
  --paper: #f6f3ea;
  --brass: #c9a24b;
  --brass-dim: #8a6f2e;
  --brass-soft: rgba(201, 162, 75, 0.14);
  --steel: #6b7c93;
  --text-primary: #edeff4;
  --text-muted: #9ba6bb;
  --text-faint: #63708a;
  --success: #4e9c6e;
  --danger: #b4573f;
  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 264px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(201,162,75,0.06), transparent 60%),
    var(--ink);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------------------------- App shell -------------------------------- */

#app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height: 100vh;
}

.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, var(--surface), var(--ink) 85%);
  border-right: 1px solid var(--surface-hairline);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand-mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  width: 40px; height: 40px;
  border: 1px solid var(--brass-dim);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brass);
  background: var(--brass-soft);
  letter-spacing: 0.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-family: var(--font-display); font-size: 14.5px; font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }

.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.sidenav-item .icon svg { width: 17px; height: 17px; }
.sidenav-item:hover { background: var(--surface-raised); color: var(--text-primary); }
.sidenav-item.is-active {
  background: var(--brass-soft);
  color: var(--brass);
  border-color: rgba(201,162,75,0.35);
}

.org-field { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 0 2px; }
.org-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-faint); }
.org-input {
  background: var(--surface-raised);
  border: 1px solid var(--surface-hairline);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 13px;
}
.org-input:focus { outline: 2px solid var(--brass); outline-offset: 1px; }

.data-ops { display: flex; flex-direction: column; gap: 8px; }
.ghost-btn {
  display: block;
  text-align: left;
  width: 100%;
  background: transparent;
  border: 1px solid var(--surface-hairline);
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.ghost-btn:hover { border-color: var(--brass-dim); color: var(--text-primary); }
.ghost-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--surface-hairline);
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.menu-btn {
  display: none;
  background: transparent; border: 1px solid var(--surface-hairline);
  border-radius: var(--radius-sm); padding: 8px; color: var(--text-primary);
}
.menu-btn .icon svg { width: 18px; height: 18px; display: block; }
.topbar-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; flex: 1; }

.index-badge {
  display: flex; align-items: baseline; gap: 8px;
  border: 1px solid var(--brass-dim);
  background: var(--brass-soft);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--font-mono);
}
.index-label { font-size: 10.5px; color: var(--brass); letter-spacing: 0.08em; }
.index-value { font-size: 16px; font-weight: 600; color: var(--brass); }
.index-meta { font-size: 10.5px; color: var(--text-muted); display: none; }
@media (min-width: 860px) { .index-meta { display: inline; } }

main {
  grid-area: main;
  padding: 28px 32px 64px;
  max-width: 1220px;
}

/* ---------------------------- Typography -------------------------------- */

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
.page-kicker {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--brass); font-family: var(--font-mono); margin: 0 0 6px;
}
.page-title { font-size: 30px; margin: 0 0 10px; }
.page-lede { color: var(--text-muted); max-width: 68ch; margin: 0 0 28px; font-size: 15px; }

/* ---------------------------- Ledger cards ------------------------------ */

.ledger {
  border: 1px solid var(--surface-hairline);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.ledger-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--surface-hairline);
}
.ledger-row:last-child { border-bottom: none; }
.ledger-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brass);
  border: 1px solid var(--brass-dim);
  border-radius: 5px;
  padding: 4px 0;
  text-align: center;
  background: var(--brass-soft);
}
.ledger-name { font-weight: 600; font-size: 14.5px; }
.ledger-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.ledger-score { font-family: var(--font-mono); font-size: 20px; font-weight: 600; text-align: right; }
.ledger-score .of5 { font-size: 12px; color: var(--text-faint); font-weight: 400; }

.tone-gold { color: var(--brass); }
.tone-steel { color: var(--steel); }
.tone-dim { color: var(--text-faint); }
.tone-danger { color: var(--danger); }
.tone-success { color: var(--success); }

/* ---------------------------- Generic cards ------------------------------ */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--surface-hairline);
  border-radius: var(--radius);
  padding: 20px;
}
.card-flush { padding: 0; }
.card-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin: 0 0 12px; }
.card-title.with-icon { display: flex; align-items: center; gap: 8px; }

.stat-value { font-family: var(--font-mono); font-size: 34px; font-weight: 600; color: var(--brass); line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 12.5px; margin-top: 8px; }

.chart-box { position: relative; width: 100%; }
.chart-box.h-260 { height: 260px; }
.chart-box.h-220 { height: 220px; }
.chart-box.h-180 { height: 180px; }

/* ---------------------------- Section blocks ---------------------------- */

.section { margin-bottom: 40px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.section-head h2 { font-size: 20px; margin: 0; }
.section-head .section-note { color: var(--text-faint); font-size: 12.5px; }

.construct-card, .principle-card, .component-card, .playbook-card {
  background: var(--surface);
  border: 1px solid var(--surface-hairline);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.construct-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.construct-titles { display: flex; align-items: center; gap: 12px; }
.construct-code {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--brass);
  border: 1px solid var(--brass-dim); background: var(--brass-soft);
  border-radius: 6px; padding: 5px 9px;
}
.construct-name { font-size: 17px; font-weight: 600; font-family: var(--font-display); }
.construct-sub { color: var(--text-muted); font-size: 12.5px; }
.objective { color: var(--text-muted); font-size: 13.5px; margin: 6px 0 16px; max-width: 74ch; }

.two-col { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 24px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.qlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.qlist li {
  font-size: 13.5px; color: var(--text-primary);
  padding-left: 18px; position: relative;
}
.qlist li::before {
  content: '\2014';
  position: absolute; left: 0; color: var(--brass-dim);
}

.steps-list { list-style: decimal; padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.steps-list li { padding-left: 4px; }

.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-raised);
  border: 1px solid var(--surface-hairline);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.activity-item input[type="checkbox"] { margin-top: 3px; accent-color: var(--brass); width: 16px; height: 16px; flex-shrink: 0; }
.activity-title { font-weight: 600; font-size: 13.5px; margin-bottom: 3px; }
.activity-desc { font-size: 12.8px; color: var(--text-muted); }

.score-row { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.score-row input[type="range"] { flex: 1; accent-color: var(--brass); }
.score-readout { font-family: var(--font-mono); font-size: 18px; min-width: 46px; text-align: right; color: var(--brass); }
.score-status { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); min-width: 118px; }

textarea.notes {
  width: 100%; min-height: 72px; resize: vertical;
  background: var(--surface-raised); color: var(--text-primary);
  border: 1px solid var(--surface-hairline); border-radius: var(--radius-sm);
  padding: 10px; font-size: 13px;
}
textarea.notes:focus, .org-input:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
.notes-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin: 14px 0 6px; display: block; }

/* ---------------------------- Buttons ------------------------------------ */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brass); color: #1a1406;
  border: none; border-radius: var(--radius-sm);
  padding: 10px 16px; font-weight: 600; font-size: 13px;
}
.btn:hover { background: #d8b262; }
.btn-outline {
  background: transparent; border: 1px solid var(--brass-dim); color: var(--brass);
  border-radius: var(--radius-sm); padding: 9px 15px; font-size: 13px; font-weight: 600;
}
.btn-outline:hover { background: var(--brass-soft); }
.btn-ghost-sm {
  background: transparent; border: 1px solid var(--surface-hairline); color: var(--text-muted);
  border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12px;
}
.btn-ghost-sm:hover { color: var(--danger); border-color: var(--danger); }

/* ---------------------------- Tables (PDCM + Checklist) ------------------ */

.table-wrap { overflow-x: auto; border: 1px solid var(--surface-hairline); border-radius: var(--radius); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
table.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); padding: 12px 14px; border-bottom: 1px solid var(--surface-hairline);
  background: var(--surface-raised); position: sticky; top: 0;
}
table.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--surface-hairline); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table input[type="text"], table.data-table input[type="number"], table.data-table select {
  background: var(--surface-raised); border: 1px solid var(--surface-hairline); color: var(--text-primary);
  border-radius: 5px; padding: 6px 8px; font-size: 12.5px; width: 100%;
}
table.data-table input[type="number"] { width: 56px; text-align: center; }
table.data-table input[type="date"] { width: 132px; }

.pill {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.pill-gold { background: var(--brass-soft); color: var(--brass); border: 1px solid var(--brass-dim); }
.pill-steel { background: rgba(107,124,147,0.16); color: var(--steel); border: 1px solid rgba(107,124,147,0.4); }
.pill-whimsical { background: rgba(124,143,174,0.14); color: #9fb2cf; border: 1px solid rgba(124,143,174,0.4); }
.pill-dead { background: rgba(180,87,63,0.14); color: var(--danger); border: 1px solid rgba(180,87,63,0.4); }

.progress-track {
  width: 100%; height: 8px; border-radius: 999px; background: var(--surface-raised);
  overflow: hidden; border: 1px solid var(--surface-hairline);
}
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brass-dim), var(--brass)); }

/* ---------------------------- Maturity ladder ---------------------------- */

.ladder { display: flex; flex-direction: column-reverse; gap: 8px; }
.rung {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--surface-hairline); background: var(--surface-raised);
  cursor: pointer;
}
.rung.is-current { border-color: var(--brass-dim); background: var(--brass-soft); }
.rung-num {
  font-family: var(--font-mono); font-size: 13px; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; border: 1px solid var(--surface-hairline);
  color: var(--text-muted); flex-shrink: 0;
}
.rung.is-current .rung-num { border-color: var(--brass); color: var(--brass); }
.rung-body { flex: 1; }
.rung-name { font-weight: 600; font-size: 13.5px; }
.rung-q { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ---------------------------- Footer -------------------------------------- */

.page-footer { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--surface-hairline); color: var(--text-faint); font-size: 11.5px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------------------------- Responsive shell ---------------------------- */

@media (max-width: 980px) {
  #app-shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar {
    position: fixed; inset: 0 25% 0 0; z-index: 30; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 20px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.is-open { transform: translateX(0); }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  main { padding: 22px 16px 48px; }
  .topbar { padding: 0 16px; }
}

@media print {
  .sidebar, .topbar, .data-ops, .menu-btn { display: none !important; }
  #app-shell { display: block; }
  body { background: white; color: black; }
}
