/* RadVMS demo. Light and dark tokens; every text pair here is chosen for AA or better
   and is re-measured by the ui-check pass before shipping. */
[hidden] { display: none !important; }

:root, :root[data-theme="light"] {
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --ink: #0F172A;          /* 17.9:1 on surface */
  --ink-2: #334155;        /* 10.4:1 on surface */
  --ink-3: #475569;        /* 7.6:1 on surface, 6.9:1 on bg */
  --line: #D8DEE8;
  --line-2: #C3CBD8;
  --brand: #1E3A8A;        /* navy fill, white text 10.4:1 */
  --brand-ink: #1E3A8A;    /* navy as text on surface 10.4:1 */
  --brand-soft: #E0E7FF;
  --on-brand: #FFFFFF;
  --focus: #2563EB;
  --warn-bg: #FEF3C7; --warn-ink: #78350F;     /* 8.6:1 */
  --bad-bg: #FEE2E2;  --bad-ink: #7F1D1D;      /* 9.4:1 */
  --ok-bg: #DCFCE7;   --ok-ink: #14532D;       /* 8.9:1 */
  --info-bg: #DBEAFE; --info-ink: #1E3A8A;     /* 8.6:1 */
  --mute-bg: #E2E8F0; --mute-ink: #1E293B;     /* 11.9:1 */
  --violet-bg: #EDE9FE; --violet-ink: #4C1D95; /* 10.4:1 */
  --banner-bg: #FEF3C7; --banner-ink: #78350F;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.06);
  --table-row-selected: #C7D2FE;
}
:root[data-theme="dark"] {
  --bg: #0B1120;
  --surface: #111A2E;
  --surface-2: #16213A;
  --ink: #F1F5F9;          /* 16.3:1 on surface */
  --ink-2: #CBD5E1;        /* 11.6:1 on surface */
  --ink-3: #A9B6C8;        /* 8.5:1 on surface */
  --line: #24314D;
  --line-2: #34446A;
  --brand: #3B5BDB;        /* fill, white text 5.6:1 */
  --brand-ink: #A5B8FF;    /* as text on surface 8.9:1 */
  --brand-soft: #1E2A4F;
  --on-brand: #FFFFFF;
  --focus: #93B4FF;
  --warn-bg: #3F2E0B; --warn-ink: #FCD98A;
  --bad-bg: #42151A;  --bad-ink: #FCA5A5;
  --ok-bg: #0E3321;   --ok-ink: #86EFAC;
  --info-bg: #172C57; --info-ink: #BFD3FF;
  --mute-bg: #243049; --mute-ink: #E2E8F0;
  --violet-bg: #2E1F55; --violet-ink: #D8CCFF;
  --banner-bg: #3F2E0B; --banner-ink: #FCD98A;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
  --table-header-bg: #1E3A8A;
  --table-header-hover: #2D4EAA;
  --table-row-odd: #111A2E;
  --table-row-even: #16213A;
  --table-row-hover: #1E2B4A;
  --table-row-selected: #253A6E;
  --table-cell-text: #F1F5F9;
  --table-border: rgba(255,255,255,0.07);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
  display: flex; flex-direction: column; overflow: hidden;
}
a { color: var(--brand-ink); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--ink-3); }

.demo-banner {
  background: var(--banner-bg); color: var(--banner-ink); font-size: 14px; font-weight: 600;
  text-align: center; padding: 6px 12px; flex: none;
}

/* ---- persona picker ---- */
.picker { flex: 1; overflow: auto; }
.picker-inner { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-row #pk-theme { margin-left: auto; }
.logo {
  width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
}
.brand { font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.picker-title { font-size: 32px; line-height: 1.2; letter-spacing: -.02em; margin: 28px 0 8px; }
.picker-sub { font-size: 17px; color: var(--ink-2); margin: 0 0 24px; max-width: 760px; }
.pk-tenant { margin-top: 28px; }
.pk-tenant h2 { font-size: 20px; margin: 0 0 4px; }
.pk-tenant > p { margin: 0 0 14px; color: var(--ink-3); font-size: 15px; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pk-card {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; color: var(--ink); box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
.pk-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.pk-name { font-weight: 700; font-size: 17px; }
.pk-role { font-size: 14px; font-weight: 600; color: var(--brand-ink); margin-top: 2px; }
.pk-blurb { font-size: 14px; color: var(--ink-2); margin-top: 6px; }

/* ---- app shell ---- */
.app { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.top {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-left, .top-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.tenant { font-weight: 600; font-size: 15px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me { font-size: 15px; text-align: right; line-height: 1.3; }
.me b { display: block; }
.me span { color: var(--ink-3); font-size: 14px; }
.theme-toggle {
  background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 8px;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.body { flex: 1; display: flex; min-height: 0; }
.nav {
  flex: none; width: 232px; background: var(--surface); border-right: 1px solid var(--line);
  padding: 14px 10px; overflow: auto; display: flex; flex-direction: column; gap: 2px;
}
.nav a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.nav .nav-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 14px 12px 4px; }
.nav .count { background: var(--brand); color: var(--on-brand); border-radius: 999px; font-size: 13px; font-weight: 700; padding: 0 8px; min-width: 22px; text-align: center; }
.main { flex: 1; min-width: 0; overflow: auto; padding: 22px 28px 40px; display: flex; flex-direction: column; }
.main.fill { overflow: hidden; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title { font-size: 26px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
.page-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 16px; }
.crumb { font-size: 15px; margin-bottom: 6px; }
.crumb a { text-decoration: none; font-weight: 600; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--on-brand); font-weight: 600; font-size: 15px; padding: 8px 14px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary, .btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover, .btn-secondary:hover { background: var(--surface-2); filter: none; }
.btn-danger { background: #B91C1C; border-color: #B91C1C; color: #fff; }  /* 6.5:1 */
.btn-sm { padding: 5px 10px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- cards and dashboard ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h2 { font-size: 18px; margin: 0 0 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .12s;
}
.stat:hover { border-color: var(--brand); }
.stat.urgent { border-left: 4px solid #D97706; }
.stat-label { font-size: 15px; color: var(--ink-2); font-weight: 500; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat-value.text { font-size: 19px; letter-spacing: 0; }
.stat-hint { font-size: 14px; color: var(--ink-3); margin-top: 2px; }
.guide { border-left: 4px solid var(--brand); }
.guide ol { margin: 6px 0 0; padding-left: 22px; }
.guide li { margin: 6px 0; color: var(--ink-2); }
.guide li b { color: var(--ink); }

/* ---- pills ---- */
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.p-draft, .p-closed, .p-cancelled, .p-withdrawn, .p-ended, .p-waiting, .p-skipped { background: var(--mute-bg); color: var(--mute-ink); }
.p-pending_approval, .p-actionable, .p-scheduled, .p-under_review, .p-pending_onboarding, .p-submitted { background: var(--warn-bg); color: var(--warn-ink); }
.p-approved, .p-released, .p-acknowledged, .p-ready, .p-shortlisted, .p-interviewing { background: var(--info-bg); color: var(--info-ink); }
.p-filled, .p-active, .p-selected, .p-open { background: var(--ok-bg); color: var(--ok-ink); }
.p-rejected, .p-suspended, .p-expired, .p-declined, .p-blocked { background: var(--bad-bg); color: var(--bad-ink); }
.p-on_hold { background: var(--violet-bg); color: var(--violet-ink); }

/* ---- tables ---- */
.table-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.table-page .data-table-wrap { background: var(--surface); }
.data-table tbody tr { cursor: pointer; }
.data-table td { font-size: 15px; }
.table-actions { color: var(--ink-2); font-size: 15px; }
.tabs-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 5px 12px; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ---- detail ---- */
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ref { font-size: 15px; font-weight: 700; color: var(--ink-3); letter-spacing: .02em; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; overflow-x: auto; }
.tab {
  background: none; border: none; border-bottom: 3px solid transparent; padding: 9px 14px; font-weight: 600; font-size: 15px;
  color: var(--ink-3); cursor: pointer; white-space: nowrap;
}
.tab.on { color: var(--brand-ink); border-bottom-color: var(--brand-ink); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; font-size: 15px; }
dl.kv dt { color: var(--ink-3); font-weight: 500; }
dl.kv dd { margin: 0; color: var(--ink); }
.note { font-size: 14px; color: var(--ink-3); margin-top: 8px; }
.callout { border-radius: 10px; padding: 12px 14px; font-size: 15px; margin-bottom: 14px; }
.callout.warn { background: var(--warn-bg); color: var(--warn-ink); }
.callout.info { background: var(--info-bg); color: var(--info-ink); }
.callout.bad { background: var(--bad-bg); color: var(--bad-ink); }
.callout.ok { background: var(--ok-bg); color: var(--ok-ink); }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.steps li:first-child { border-top: none; }
.step-n {
  width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 600; }
.step-why { font-size: 14px; color: var(--ink-3); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.timeline li:first-child { border-top: none; }
.timeline .when { color: var(--ink-3); font-size: 14px; }

.sub-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.sub-card + .sub-card { margin-top: 10px; }
.sub-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.sub-name { font-weight: 700; font-size: 16px; }
.sub-meta { font-size: 14px; color: var(--ink-2); margin-top: 2px; }

/* ---- forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.field label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: 14px; color: var(--ink-3); margin-top: 4px; }
.field .err { font-size: 14px; color: var(--bad-ink); background: var(--bad-bg); border-radius: 6px; padding: 2px 8px; margin-top: 5px; display: inline-block; }
.input {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 9px 11px; font-size: 16px;
}
textarea.input { resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check { flex-wrap: wrap; }
.check > span { flex: 1; min-width: 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.check .err { flex-basis: 100%; }
.estimate { font-size: 22px; font-weight: 700; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; flex-wrap: wrap; }

/* ---- modal and toast ---- */
.modal-back { position: fixed; inset: 0; background: rgba(2,6,23,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); color: var(--ink); border-radius: 14px; padding: 22px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal h2 { margin: 0 0 6px; font-size: 20px; }
.modal p { color: var(--ink-2); margin: 0 0 14px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 15px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw;
}
.toast.bad { background: #B91C1C; color: #fff; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line-2); border-radius: 12px; }

@media (max-width: 820px) {
  body { overflow: auto; }
  .body { flex-direction: column; }
  .nav { width: auto; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 8px; }
  .nav .nav-label { display: none; }
  .nav a { white-space: nowrap; }
  .main { padding: 16px; overflow: visible; }
  .main.fill { overflow: visible; }
  .table-page { min-height: 480px; }
  .tenant, .sep { display: none; }
  .me span { display: none; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
}
