/* ============================================================
   IRIS O&P PLATFORM — shared design system
   Brand: deep indigo + white cards + teal/gold data accents
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Bitter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500&family=IBM+Plex+Sans:ital,wght@0,400;0,450;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --indigo-950: #12127a;
  --indigo-900: #191999;
  --indigo-800: #2323b8;
  --indigo-600: #3838e8;
  --indigo-500: #4646f5;
  --indigo-100: #e4e4fb;
  --indigo-50:  #f0f0fd;
  --heading: #2d1fb8;
  --lavender: #dcd9f9;
  --teal-900: #0d3d42;
  --teal-700: #14555a;
  --teal-500: #2a9d8f;
  --teal-100: #d8efec;
  --gold-500: #e3b341;
  --gold-100: #faf0d7;
  --amber-700: #b97a10;
  --red-600: #c0392b;
  --red-100: #fbe4e0;
  --bg: #eff1f8;
  --card: #ffffff;
  --ink: #1c1f2e;
  --muted: #646b7d;
  --faint: #9aa0b0;
  --border: #e2e5f0;
  --border-dark: #c9cede;
  --shadow: 0 1px 2px rgba(23, 23, 100, .06), 0 8px 24px -12px rgba(23, 23, 100, .18);
  --radius: 10px;
  --serif: 'Bitter', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.32;
  -webkit-font-smoothing: antialiased;
}

/* ---------- App frame ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 218px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--indigo-900), var(--indigo-950));
  color: #fff; padding: 22px 0 18px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .wordmark {
  font-family: var(--serif); font-weight: 800; letter-spacing: .28em;
  font-size: 1.25rem; padding: 0 22px 2px;
}
.sidebar .wordmark span { color: var(--gold-500); }
.sidebar .platform-name {
  font-family: var(--serif); font-weight: 600; font-size: .72rem;
  letter-spacing: .12em; opacity: .85; padding: 0 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.14); margin-bottom: 14px;
}
.nav-group-label {
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase;
  opacity: .5; padding: 12px 22px 5px;
}
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 22px; color: rgba(255,255,255,.82);
  text-decoration: none; font-size: .86rem; font-weight: 450;
  border-left: 3px solid transparent; transition: background .15s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active {
  background: rgba(255,255,255,.14); color: #fff; font-weight: 600;
  border-left-color: var(--gold-500);
}
.nav a.disabled { opacity: .38; pointer-events: none; }
.nav a.sub { padding: 5px 22px 5px 46px; font-size: .76rem; opacity: .85; }
.nav a.sub.active { border-left-color: var(--teal-500); }
.nav a .mod-num {
  font-family: var(--mono); font-size: .64rem; opacity: .6; width: 14px;
}
.sidebar .foot {
  margin-top: auto; padding: 14px 22px 0; font-size: .68rem;
  opacity: .55; border-top: 1px solid rgba(255,255,255,.14);
}

.main { flex: 1; min-width: 0; padding: 26px 34px 60px; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.crumb {
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--indigo-600); font-weight: 600; margin-bottom: 4px;
}
h1.page-title { font-family: var(--serif); font-size: 1.62rem; font-weight: 700; color: var(--heading); line-height: 1.2; }
.page-sub { color: var(--muted); font-size: .9rem; margin-top: 5px; max-width: 760px; }
.topbar .actions { display: flex; gap: 10px; flex-shrink: 0; }

.demo-context {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gold-100); border: 1px solid #ecd9a0; color: #7a5a10;
  font-size: .74rem; font-weight: 500; border-radius: 999px; padding: 4px 12px;
}
.demo-context b { font-weight: 700; }

/* ---------- Cards & layout ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 18px;
}
.card-title {
  font-family: var(--serif); font-weight: 700; font-size: 1.02rem;
  color: var(--ink); margin-bottom: 3px;
}
.card-sub { color: var(--muted); font-size: .8rem; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } .main { padding: 18px; } }

/* ---------- KPI stat tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 16px 11px; box-shadow: var(--shadow);
}
.kpi .k-label { font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi .k-value { font-family: var(--serif); font-size: 1.55rem; font-weight: 800; color: var(--teal-700); margin: 2px 0 0; }
.kpi .k-note { font-size: .7rem; color: var(--faint); }
.kpi .k-note .up { color: var(--teal-500); font-weight: 600; }
.kpi .k-note .warn { color: var(--amber-700); font-weight: 600; }

/* ---------- Chips, badges, tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 500; border-radius: 999px;
  padding: 2.5px 10px; border: 1px solid var(--border-dark);
  background: #fff; color: var(--ink); white-space: nowrap;
}
.chip.indigo { background: var(--indigo-50); border-color: #c9c9f5; color: var(--indigo-800); }
.chip.teal { background: var(--teal-100); border-color: #b2ddd7; color: var(--teal-700); }
.chip.gold { background: var(--gold-100); border-color: #ecd9a0; color: #7a5a10; }
.chip.red { background: var(--red-100); border-color: #f0c4bc; color: var(--red-600); }
.chip.ghost { background: transparent; border-style: dashed; color: var(--muted); }

.badge-crit { color: var(--red-600); font-weight: 700; }
.badge-emerg { color: var(--amber-700); font-weight: 700; }
.badge-ok { color: var(--teal-500); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--sans); font-size: .84rem; font-weight: 600;
  border-radius: 8px; padding: 8px 16px; cursor: pointer;
  border: 1px solid transparent; transition: all .15s; text-decoration: none;
}
.btn-primary { background: var(--indigo-800); color: #fff; }
.btn-primary:hover { background: var(--indigo-600); }
.btn-teal { background: var(--teal-700); color: #fff; }
.btn-teal:hover { background: var(--teal-900); }
.btn-ghost { background: #fff; color: var(--indigo-800); border-color: var(--border-dark); }
.btn-ghost:hover { border-color: var(--indigo-600); background: var(--indigo-50); }
.btn-sm { font-size: .74rem; padding: 5px 12px; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 2px; border-bottom: 2px solid var(--border);
  margin-bottom: 20px; overflow-x: auto;
}
.tab {
  font-size: .84rem; font-weight: 550; color: var(--muted);
  padding: 9px 16px 8px; cursor: pointer; border: none; background: none;
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
  font-family: var(--sans);
}
.tab:hover { color: var(--indigo-800); }
.tab.active { color: var(--heading); font-weight: 700; border-bottom-color: var(--gold-500); }
.tab .tab-num {
  font-family: var(--mono); font-size: .62rem; background: var(--indigo-100);
  color: var(--indigo-800); border-radius: 4px; padding: 1px 5px; margin-right: 6px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Section band (lavender, like deck) ---------- */
.band {
  background: var(--lavender); color: var(--heading);
  font-family: var(--serif); font-weight: 700; font-size: .8rem;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 6px; margin: 18px 0 12px;
}

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.data th {
  text-align: left; font-size: .65rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:hover td { background: var(--indigo-50); }

/* ---------- Progress / meter bars ---------- */
.meter { height: 8px; border-radius: 999px; background: #e8eaf3; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--teal-500); }
.meter.slim { height: 5px; }
.meter > i.gold { background: var(--gold-500); }
.meter > i.indigo { background: var(--indigo-600); }
.meter > i.red { background: var(--red-600); }

/* ---------- Heatmap ---------- */
.heatmap { border-collapse: separate; border-spacing: 4px; width: 100%; }
.heatmap th { font-size: .68rem; font-weight: 600; color: var(--muted); padding: 4px 6px; text-align: center; }
.heatmap th.rowh { text-align: right; white-space: nowrap; font-weight: 550; color: var(--ink); padding-right: 10px; }
.heatmap td {
  border-radius: 6px; text-align: center; font-family: var(--mono);
  font-size: .66rem; font-weight: 600; padding: 10px 4px; cursor: pointer;
  transition: transform .12s; min-width: 52px;
}
.heatmap td:hover { transform: scale(1.07); outline: 2px solid var(--indigo-600); }
.hm-crit { background: var(--teal-900); color: #fff; }
.hm-high { background: var(--teal-700); color: #fff; }
.hm-med  { background: var(--gold-500); color: #4d3a05; }
.hm-low  { background: var(--gold-100); color: #7a5a10; }
.hm-ok   { background: #eef3f2; color: #9aa8a5; }

.legend { display: flex; gap: 16px; font-size: .7rem; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Fit score ring ---------- */
.fit-ring { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.fit-ring svg { transform: rotate(-90deg); }
.fit-ring .val {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: .78rem; color: var(--teal-700);
}

/* ---------- Expert cards ---------- */
.expert-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s, transform .15s;
}
.expert-card:hover { border-color: var(--indigo-600); transform: translateY(-2px); }
.expert-head { display: flex; gap: 12px; align-items: flex-start; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: .95rem; color: #fff;
}
.expert-name { font-family: var(--serif); font-weight: 700; font-size: .95rem; line-height: 1.25; }
.expert-title { font-size: .74rem; color: var(--muted); line-height: 1.32; }
.expert-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.expert-meta { display: flex; gap: 14px; font-size: .7rem; color: var(--faint); flex-wrap: wrap; }
.expert-meta b { color: var(--ink); font-weight: 600; }

/* ---------- Filters panel ---------- */
.filters {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow-y: auto;
}
.filter-group { margin-bottom: 16px; }
.filter-label { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 7px; }
.filter-group label.opt {
  display: flex; align-items: center; gap: 8px; font-size: .8rem;
  padding: 3px 0; cursor: pointer; color: var(--ink);
}
.filter-group label.opt input { accent-color: var(--indigo-800); }
.filter-group label.opt .cnt { margin-left: auto; font-family: var(--mono); font-size: .64rem; color: var(--faint); }

select, input[type=text], input[type=search], textarea, input[type=number] {
  font-family: var(--sans); font-size: .84rem; color: var(--ink);
  border: 1px solid var(--border-dark); border-radius: 8px;
  padding: 8px 11px; background: #fff; width: 100%;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--indigo-100); border-color: var(--indigo-600); }
label.fld { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

/* ---------- Wizard / stepper ---------- */
.stepper { display: flex; gap: 0; margin-bottom: 22px; }
.step { flex: 1; text-align: center; position: relative; padding-top: 26px; font-size: .74rem; color: var(--faint); }
.step::before {
  content: attr(data-n); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 22px; border-radius: 50%; background: #e4e6f0; color: var(--muted);
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.step::after {
  content: ''; position: absolute; top: 10px; left: calc(-50% + 12px); right: calc(50% + 12px);
  height: 2px; background: #e4e6f0;
}
.step:first-child::after { display: none; }
.step.done { color: var(--teal-700); }
.step.done::before { background: var(--teal-500); color: #fff; content: '✓'; }
.step.done::after { background: var(--teal-500); }
.step.now { color: var(--heading); font-weight: 700; }
.step.now::before { background: var(--indigo-800); color: #fff; }

/* ---------- AI reveal / typing effect ---------- */
.ai-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--indigo-50); border: 1px solid #d5d5f8; border-radius: 10px;
  padding: 12px 15px; font-size: .82rem; margin: 12px 0;
}
.ai-note .spark { font-size: 1rem; line-height: 1.3; }
.ai-note b { color: var(--indigo-800); }

.pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--teal-500); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(18, 18, 80, .45);
  display: none; align-items: flex-start; justify-content: center; z-index: 50;
  padding: 5vh 20px; overflow-y: auto;
}
.modal-back.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; max-width: 860px; width: 100%;
  padding: 26px 30px; box-shadow: 0 24px 80px rgba(10,10,60,.35);
  animation: fadein .2s ease;
}
.modal .close { float: right; cursor: pointer; font-size: 1.2rem; color: var(--faint); background: none; border: none; }

/* ---------- Compare table ---------- */
.compare-col-best { background: var(--teal-100) !important; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: .76rem; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
hr.soft { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ---------- Organization View shared components ---------- */
.ov-index { display: flex; align-items: center; gap: 14px; }
.ov-score { font-family: var(--serif); font-size: 2.2rem; font-weight: 800; color: var(--teal-700); line-height: 1; }
.ov-dim { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: .74rem; }
.ov-dim .lbl { width: 185px; text-align: right; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-dim .track { flex: 1; position: relative; height: 13px; background: #e8eaf3; border-radius: 4px; }
.ov-dim .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--indigo-600); }
.ov-dim .track .bench { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--amber-700); }
.ov-dim .num { font-family: var(--mono); font-size: .66rem; color: var(--muted); width: 34px; }
.quad { position: relative; border: 1px solid var(--border-dark); border-radius: 10px; height: 260px; background:
  linear-gradient(to right, transparent calc(50% - 1px), var(--border) calc(50% - 1px), var(--border) calc(50% + 0px), transparent calc(50% + 1px)),
  linear-gradient(to bottom, transparent calc(50% - 1px), var(--border) calc(50% - 1px), var(--border) calc(50% + 0px), transparent calc(50% + 1px)); }
.quad .pt { position: absolute; transform: translate(-50%, 50%); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: default; }
.quad .pt .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.quad .pt .plabel { font-size: .6rem; font-weight: 600; color: var(--ink); background: rgba(255,255,255,.85); padding: 0 4px; border-radius: 3px; white-space: nowrap; }
.quad .axis { position: absolute; font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.flowbar { display: flex; align-items: center; gap: 0; margin: 4px 0; }
.flowbar .seg { height: 26px; display: flex; align-items: center; justify-content: center; font-size: .64rem; font-weight: 700; color: #fff; overflow: hidden; white-space: nowrap; }
.flowbar .seg:first-child { border-radius: 6px 0 0 6px; }
.flowbar .seg:last-child { border-radius: 0 6px 6px 0; }
.ona-cell { border-radius: 5px; text-align: center; font-family: var(--mono); font-size: .62rem; font-weight: 700; padding: 7px 3px; min-width: 44px; }
.ov-note { font-size: .68rem; color: var(--faint); font-style: italic; margin-top: 8px; }
.src-chip { display: inline-block; font-size: .6rem; color: var(--indigo-600); background: var(--indigo-50); border: 1px solid #d5d5f8; border-radius: 999px; padding: 1px 8px; margin: 1px 2px; }

/* ---------- Organization View: framework intro & explainers ---------- */
.fw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.fw-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; display: flex; flex-direction: column; gap: 5px; }
.fw-card .fw-num { font-family: var(--mono); font-size: .64rem; font-weight: 700; color: var(--indigo-800); background: var(--indigo-100); border-radius: 5px; padding: 1px 7px; width: fit-content; }
.fw-card h5 { font-family: var(--serif); font-size: .84rem; color: var(--heading); line-height: 1.25; }
.fw-card .fw-what { font-size: .72rem; color: var(--muted); flex: 1; }
.fw-card .fw-dash { font-size: .68rem; color: var(--teal-700); font-weight: 600; }
.fw-levels { display: flex; gap: 3px; }
.fw-levels span { font-size: .56rem; font-weight: 800; letter-spacing: .04em; border-radius: 4px; padding: 1px 6px; }
.fw-levels .l1 { background: #eef0f7; color: var(--muted); }
.fw-levels .l2 { background: var(--gold-100); color: #7a5a10; }
.fw-levels .l3 { background: var(--teal-100); color: var(--teal-900); }
.ov-band { display: flex; align-items: baseline; gap: 14px; background: var(--lavender); border-radius: 8px; padding: 9px 18px; margin: 26px 0 12px; flex-wrap: wrap; }
.ov-band .n { font-family: var(--mono); font-weight: 800; color: var(--indigo-800); font-size: 1.05rem; }
.ov-band h3 { font-family: var(--serif); color: var(--heading); font-size: 1.02rem; font-weight: 700; }
.ov-band .d { font-size: .73rem; color: var(--muted); margin-left: auto; text-align: right; max-width: 46%; }
.explain { background: #f7f8fc; border: 1px solid var(--border); border-left: 3px solid var(--gold-500); border-radius: 0 8px 8px 0; padding: 8px 12px; font-size: .73rem; margin: 8px 0 10px; line-height: 1.32; }
.explain b { color: var(--heading); }
.explain .imp { color: var(--teal-900); }

.callout-foot {
  font-size: .7rem; color: var(--faint); font-style: italic; margin-top: 20px;
  border-top: 1px solid var(--border); padding-top: 10px;
}
