:root {
  --navy: #203366;
  --navy-deep: #162548;
  --orange: #f37321;
  --sky: #47b3e6;
  --light-blue: #d2dfea;
  --paper: #ffffff;
  --canvas: #eef2f6;
  --ink: #17233f;
  --muted: #6e7b91;
  --line: #dfe5ec;
  --green: #187a67;
  --amber: #b8671c;
  --red: #9c2f2f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, select, input, textarea { font: inherit; }
button { cursor: pointer; }

.topbar { align-items: center; background: var(--navy-deep); color: #fff; display: flex; justify-content: space-between; min-height: 68px; padding: 0 4vw; }
.brand { align-items: center; color: #fff; display: flex; gap: 12px; text-decoration: none; }
.brand-logo { height: 30px; }
.brand-context { border-left: 1px solid rgba(255,255,255,.25); font-size: 13px; font-weight: 700; letter-spacing: .04em; padding-left: 12px; }
.topbar-actions { align-items: center; display: flex; gap: 10px; }
.environment-badge { align-items: center; color: #dce6f6; display: inline-flex; font-size: 12px; gap: 7px; margin-right: 6px; }
.status-dot { background: #f5bc62; border-radius: 50%; box-shadow: 0 0 0 4px rgba(245,188,98,.14); height: 7px; width: 7px; }
.button { border: 0; border-radius: 7px; font-size: 12px; font-weight: 700; padding: 9px 14px; }
.button-quiet { background: rgba(255,255,255,.12); color: #fff; }
.button-quiet:hover { background: rgba(255,255,255,.2); }
.button-solid { background: var(--navy); color: #fff; }
.button-solid:hover { background: var(--navy-deep); }
.button-line { background: #fff; border: 1px solid var(--line); color: var(--navy); }
.button-line:hover { border-color: var(--navy); }
.button:disabled { cursor: not-allowed; opacity: .45; }

.app-shell { margin: 0 auto; max-width: 1500px; padding: 32px 4vw 72px; }
.workspace-header { align-items: end; display: flex; gap: 24px; justify-content: space-between; margin-bottom: 18px; }
.kicker { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin: 0 0 8px; text-transform: uppercase; }
h1 { color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 3.4vw, 2.8rem); letter-spacing: -.03em; line-height: 1.05; margin: 0 0 8px; }
h2 { color: var(--navy); font-size: 18px; margin: 0; }
h3 { color: var(--navy); font-size: 14px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.55; }
.workspace-header .muted { font-size: 14px; margin: 0; }
.acting-as { display: flex; flex-direction: column; gap: 6px; }
.acting-as label { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.acting-as select, .filter-row select, .filter-row input, .answer input, .answer select, .answer textarea { background: #fff; border: 1px solid var(--line); border-radius: 7px; color: var(--navy); padding: 9px 11px; }
.acting-as select { font-weight: 700; min-width: 240px; }

.banner { background: #fff6ea; border: 1px solid #f3d7b4; border-radius: 10px; color: #7a4b12; font-size: 13px; line-height: 1.5; margin-bottom: 18px; padding: 12px 16px; }
.workspace-grid { align-items: start; display: grid; gap: 24px; grid-template-columns: 270px minmax(0, 1fr); }
.side-panel { display: grid; gap: 14px; position: sticky; top: 16px; }
.panel-card { background: rgba(255,255,255,.82); border: 1px solid rgba(210,223,234,.9); border-radius: 12px; padding: 16px; }
.panel-card-heading { align-items: center; color: var(--navy); display: flex; font-size: 12px; font-weight: 800; justify-content: space-between; }
.panel-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; margin: 0 0 10px; text-transform: uppercase; }
.pill { border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 4px 8px; text-transform: uppercase; white-space: nowrap; }
.pill-amber { background: #fff1df; color: var(--amber); }
.pill-green { background: #e5f4ef; color: var(--green); }
.pill-sky { background: #e7f5fb; color: #1d6f96; }
.pill-muted { background: #eef1f5; color: var(--muted); }
.readiness-score { align-items: baseline; color: var(--navy); display: flex; gap: 5px; margin: 14px 0 2px; }
.readiness-score strong { font-family: Georgia, serif; font-size: 40px; letter-spacing: -.04em; }
.readiness-score span { color: var(--muted); font-size: 12px; }
.progress { background: #e7ecf2; border-radius: 99px; height: 5px; margin-top: 12px; overflow: hidden; }
.progress span { background: linear-gradient(90deg, var(--orange), var(--sky)); display: block; height: 100%; }

.section-nav { display: grid; gap: 4px; }
.section-tab { align-items: center; background: transparent; border: 0; border-radius: 8px; color: var(--ink); display: grid; gap: 8px; grid-template-columns: 1fr auto; padding: 9px 10px; text-align: left; }
.section-tab strong { display: block; font-size: 13px; }
.section-tab small { color: var(--muted); font-size: 11px; }
.section-tab:hover, .section-tab.active { background: #fff; }
.section-tab.active { box-shadow: inset 3px 0 0 var(--orange); }
.count-badge { background: #eef1f5; border-radius: 99px; color: var(--navy); font-size: 11px; font-weight: 800; min-width: 22px; padding: 2px 7px; text-align: center; }
.count-badge.warn { background: #fff1df; color: var(--amber); }

.workspace { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.filter-row { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.filter-row input { flex: 1; min-width: 180px; }
.group-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 18px 4px; }
.group-head { align-items: baseline; display: flex; gap: 10px; justify-content: space-between; padding: 12px 0 4px; }
.group-head .domain-tag { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.field { border-top: 1px solid var(--line); padding: 14px 0; }
.field:first-of-type { border-top: 0; }
.field-head { align-items: flex-start; display: flex; gap: 12px; justify-content: space-between; }
.field-label { font-size: 14px; font-weight: 650; line-height: 1.4; }
.field-meta { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.src { color: var(--muted); font-size: 11px; }
.hint { background: #f6f8fb; border-radius: 8px; color: #41506b; font-size: 12px; line-height: 1.5; margin: 8px 0 0; padding: 8px 10px; }
.answer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.answer input[type="text"], .answer input[type="number"], .answer input[type="date"], .answer select, .answer textarea { flex: 1; min-width: 220px; }
.answer textarea { min-height: 64px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 99px; color: var(--navy); font-size: 12px; padding: 5px 11px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.field-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.approval-line { color: var(--green); font-size: 12px; font-weight: 650; margin-top: 8px; }
.provenance { color: var(--muted); font-size: 12px; margin-top: 6px; }
.provenance b { color: var(--ink); font-weight: 650; }
.history { margin-top: 6px; }
.history summary { color: var(--muted); cursor: pointer; font-size: 12px; }
.history li { color: var(--muted); font-size: 12px; line-height: 1.5; }
.inactive-note { color: var(--muted); font-size: 12px; font-style: italic; margin-top: 6px; }

.table-wrap { margin-top: 10px; max-width: 100%; overflow-x: auto; }
table.data { border-collapse: collapse; font-size: 12px; min-width: 640px; width: 100%; }
table.data th { background: #f6f8fb; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; padding: 7px 8px; text-align: left; text-transform: uppercase; }
table.data td { border-top: 1px solid var(--line); padding: 5px 6px; vertical-align: top; }
table.data input, table.data select { border: 1px solid transparent; border-radius: 5px; padding: 5px 6px; width: 100%; }
table.data input:focus, table.data select:focus { border-color: var(--sky); outline: none; }
tr.suggestion { background: #fffaf3; }
.origin-tag { color: var(--amber); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.add-row { margin-top: 8px; }

.task-list { display: grid; gap: 8px; }
.task { align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; display: flex; gap: 12px; justify-content: space-between; padding: 12px 14px; }
.task .title { font-size: 14px; font-weight: 650; }
.task .detail { color: var(--muted); font-size: 12px; margin-top: 2px; }
.gate-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 8px; padding: 16px; }
.gate-card header { align-items: center; display: flex; justify-content: space-between; }
.blocker-list { color: var(--muted); font-size: 12px; margin: 0; padding-left: 18px; }
.section-intro { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 0; }

.empty { color: var(--muted); font-size: 14px; padding: 24px; text-align: center; }
.error-box { background: #fdecec; border: 1px solid #f3c4c4; border-radius: 10px; color: var(--red); font-size: 13px; padding: 12px 16px; }

@media (max-width: 860px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .side-panel { position: static; }
  .workspace-header { align-items: stretch; flex-direction: column; }
  .workspace { min-width: 0; overflow: hidden; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; }
  .topbar-actions .button { padding: 7px 11px; white-space: nowrap; }
  .environment-badge { display: none; }
  .app-shell { padding: 24px 16px 56px; }
}

/* Sign-in and live-workspace states */
body.signed-out .topbar-actions .button { display: none; }
.signin { background: #fff; border: 1px solid var(--line); border-radius: 14px; display: grid; gap: .6rem; margin: 3rem auto; max-width: 26rem; padding: 22px; }
.signin h2 { color: var(--navy); margin: 0; }
.signin-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; border-top: 4px solid var(--orange); box-shadow: 0 18px 50px rgba(22, 37, 72, .10); margin: clamp(20px, 6vh, 64px) auto; max-width: 32rem; padding: 28px 28px 20px; }
.signin-card h2 { color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: 26px; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 8px; }
.signin-card .kicker { margin-bottom: 10px; }
.signin-form label:not(.persona) { color: var(--navy); display: block; font-size: 12px; font-weight: 700; margin: 16px 0 5px; }
.signin-form input[type="email"], .signin-form input[type="password"], .signin-form input[type="text"], .signin-form input:not([type]) { background: #fff; border: 1px solid var(--line); border-radius: 9px; color: var(--navy); font-size: 16px; min-height: 46px; padding: 10px 12px; width: 100%; }
.signin-form input:focus { border-color: var(--sky); outline: 3px solid rgba(71, 179, 230, .25); }
.signin-go { font-size: 14px; margin-top: 16px; min-height: 48px; width: 100%; }
.persona-list { display: grid; gap: 8px; margin: 14px 0 4px; }
.persona { align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; display: flex; gap: 12px; padding: 12px 14px; }
.persona:hover { border-color: #b8c5d8; }
.persona:has(input:checked) { background: #f3f6fc; border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.persona input { accent-color: var(--navy); flex: 0 0 auto; height: 18px; margin: 2px 0 0; width: 18px; }
.persona-body b { color: var(--navy); display: block; font-size: 14px; }
.persona-body small { color: var(--muted); display: block; font-size: 12px; line-height: 1.5; margin-top: 2px; }
.pw { display: flex; gap: 8px; }
.pw input { flex: 1; }
.pw-toggle { background: #f3f6fa; border: 1px solid var(--line); border-radius: 9px; color: var(--navy); font-size: 13px; font-weight: 700; min-width: 64px; padding: 0 12px; }
.signin-other { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.signin-other summary { color: var(--navy); cursor: pointer; font-size: 13px; font-weight: 700; padding: 6px 0; }
.error-text { color: #a12622; font-size: 13px; margin: 10px 0 0; min-height: 1.2em; }
body.busy { cursor: progress; }
body.busy .workspace { opacity: 0.7; pointer-events: none; }

/* Requested documents (shared by the staff app and the client portal) */
.due { border-radius: 99px; font-size: 11px; font-weight: 700; padding: 2px 9px; white-space: nowrap; }
.due-muted { background: #eef1f5; color: var(--muted); }
.due-amber { background: #fff1df; color: var(--amber); }
.due-red { background: #fdecec; color: #9c2f2f; }
.pill-red { background: #fdecec; color: #9c2f2f; }
.doc-summary { align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 12px 28px; grid-template-columns: minmax(180px, 1fr) auto; margin: 14px 0 12px; padding: 14px 18px; }
.doc-summary .big { color: var(--navy); font-family: Georgia, serif; font-size: 26px; letter-spacing: -.02em; }
.doc-summary .progress { margin-top: 8px; }
.doc-next { font-size: 13px; line-height: 1.6; text-align: right; }
.doc-next strong { color: var(--navy); font-weight: 700; }
.doc-group { margin-bottom: 18px; }
.doc-group-head { align-items: baseline; display: flex; justify-content: space-between; margin: 0 2px 8px; }
.doc-group-head h2, .doc-group-head h3 { color: var(--navy); font-size: 16px; margin: 0; }
@media (max-width: 640px) { .doc-summary { grid-template-columns: minmax(0, 1fr); } .doc-next { text-align: left; } }
