:root {
  color-scheme: light;
  --ink: #183530;
  --muted: #526961;
  --line: #dbe5df;
  --green: #17644e;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --soft: #f7faf8;
  --radius: 14px;
  --shadow: 0 4px 20px #18353005;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
a { color: var(--green); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #278467; outline-offset: 3px; }

/* Workspace shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; padding: 32px 20px 24px; display: flex; flex-direction: column; overflow-y: auto; background: #12362f; color: #edf5f0; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 650; line-height: 1.4; }
.brand small { display: block; margin-top: 4px; color: #bfd2c8; font-size: 12px; font-weight: 400; }
.brand-mark { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; background: #c1e7cf; color: #12362f; font-size: 22px; }
#main-navigation { display: flex; flex-direction: column; gap: 6px; }
.nav-label { margin: 40px 12px 10px; color: #bfd2c8; font-size: 11px; font-weight: 600; letter-spacing: 1.6px; }
.nav-link { display: flex; align-items: center; min-height: 46px; padding: 11px 14px; border: 1px solid transparent; border-radius: 9px; color: #d9e7df; text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-link:hover { background: #20483d; color: white; }
.nav-link.selected { background: #2a5547; border-color: #416b58; color: white; }
.sidebar a:focus-visible { outline-color: #b9e3c7; }
.sidebar-footer { margin-top: auto; padding: 24px 12px 0; border-top: 1px solid #35584b; font-size: 12px; }
.sidebar-footer span { color: #bfd2c8; }
main { margin-left: 248px; max-width: 1592px; padding: 36px 40px 24px; min-width: 0; }
body:not(.signed-in) main { margin: 0 auto; max-width: 744px; padding-top: 64px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: 1.4px; }
h1 { margin: 10px 0 8px; font-size: 28px; font-weight: 700; line-height: 1.25; letter-spacing: -.7px; }
h2 { margin: 6px 0 8px; font-size: 21px; line-height: 1.35; letter-spacing: -.4px; }
h3 { margin: 28px 0 8px; font-size: 17px; line-height: 1.4; letter-spacing: -.2px; }
h4 { margin: 24px 0 8px; font-size: 15px; }
p { margin: 0 0 16px; color: var(--muted); overflow-wrap: anywhere; }
header p { margin-bottom: 0; font-size: 13px; }
.page-heading { margin-bottom: 24px; }
.page-heading h2 { margin: 6px 0 8px; font-size: 30px; letter-spacing: -.7px; }
.page-heading p { max-width: 800px; margin-bottom: 0; }
.sub-navigation { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 28px; padding: 6px; background: #e9f0eb; border: 1px solid #dce6df; border-radius: 11px; }
.sub-navigation a { min-height: 42px; padding: 9px 16px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; }
.sub-navigation a:hover { background: #dce8df; color: var(--ink); }
.sub-navigation a.selected { background: white; color: var(--green); box-shadow: 0 1px 5px #18353014; }
.skip-link { position: absolute; left: -10000px; }
.skip-link:focus { left: 20px; top: 12px; z-index: 10; padding: 10px 16px; background: white; border-radius: 8px; }
body:not(.signed-in) .skip-link { display: none; }

/* Shared content surfaces */
.card { min-width: 0; margin-bottom: 24px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > h3:first-child, [data-subpage] > h3:first-child { margin-top: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-heading p { max-width: 760px; margin-bottom: 0; }
.tag { display: inline-flex; align-items: center; padding: 5px 10px; border: 1px solid #cde2d3; border-radius: 6px; background: #edf6ef; color: #225c44; font-size: 10px; line-height: 1.6; font-weight: 700; letter-spacing: .5px; overflow-wrap: anywhere; }
.section-heading > .tag { flex-shrink: 0; max-width: 240px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stats .card { margin: 0 0 24px; padding: 22px; }
.stat-label { display: block; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .8px; }
.stats strong { display: block; margin: 12px 0 8px; font-size: 28px; line-height: 1.3; letter-spacing: -.6px; overflow-wrap: anywhere; }
.stats small { display: block; color: var(--muted); font-size: 12px; }
.quick-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.quick-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; border: 1px solid #c5d6cc; border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 600; }
.quick-links a:hover { background: var(--soft); }
.provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.provider-card { padding: 22px; border: 1px solid var(--line); border-radius: 10px; }
.provider-card strong { display: block; font-size: 15px; }
.provider-card p { margin: 8px 0 16px; font-size: 13px; }
.future { display: flex; gap: 16px; margin-top: 24px; padding: 22px; background: var(--soft); border: 1px dashed #b7d2c2; border-radius: 10px; }
.future-icon { color: var(--green); font-size: 24px; line-height: 1.4; }
.future p { margin: 6px 0 0; }

/* Forms share a control size and label / helper rhythm. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 24px; margin: 20px 0; }
.form-grid > *, .field { min-width: 0; }
.field.wide { grid-column: 1 / -1; }
label { display: block; margin: 0 0 8px; font-size: 13px; font-weight: 600; line-height: 1.5; }
input, select, textarea { display: block; width: 100%; max-width: 100%; min-width: 0; border: 1px solid #7e9587; border-radius: 8px; background: white; color: var(--ink); font-size: 14px; line-height: 1.5; }
input, select { min-height: 44px; padding: 10px 12px; }
select { padding-right: 30px; text-overflow: ellipsis; }
textarea { padding: 12px 14px; resize: vertical; min-height: 104px; }
textarea[spellcheck="false"], #review-text, #review-details { font: 13px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
input::placeholder, textarea::placeholder { color: #60756a; opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: #587d68; }
input[readonly], textarea[readonly] { background: var(--soft); }
input:disabled, select:disabled, textarea:disabled { background: #edf2ee; color: var(--muted); cursor: not-allowed; }
input[type="file"] { padding: 7px; font-size: 13px; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 7px 12px; border: 0; border-radius: 5px; background: #e9f1eb; color: var(--green); font: inherit; font-weight: 600; cursor: pointer; }
.field small, form > small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.55; }
input + label, select + label, textarea + label, button + label, .header-actions + label { margin-top: 24px; }
.field > button { margin-top: 12px; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; min-height: 24px; margin: 16px 0; font-weight: 500; }
.checkbox input, input[type="checkbox"] { flex-shrink: 0; width: 18px; height: 18px; min-height: 18px; margin: 2px 0 0; padding: 0; accent-color: var(--green); border-radius: 4px; }
.form-section { margin: 24px 0; padding: 24px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; }
.form-section > h3:first-child { margin-top: 0; }
.form-section > .form-grid:last-child, .form-section > .checkbox:last-child { margin-bottom: 0; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-footer p, .form-footer .helper, .form-footer .checkbox { margin: 0; }
.form-footer p { max-width: 680px; font-size: 13px; }
.form-footer button { flex-shrink: 0; }
.helper { margin: 12px 0 20px; font-size: 12px; line-height: 1.6; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--green); border-radius: 8px; background: var(--green); color: white; font-size: 13px; font-weight: 600; line-height: 1.5; text-align: center; cursor: pointer; }
button:hover { background: #10513e; border-color: #10513e; }
button:disabled { opacity: .6; cursor: not-allowed; }
.secondary { background: white; border-color: #7e9587; color: var(--ink); }
.secondary:hover { background: #f0f5f1; border-color: #95b29f; }
.actions, .header-actions, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
header .header-actions { flex-shrink: 0; }
.button-row { margin: 20px 0; }
#learning .header-actions, #document-review .header-actions { margin: 20px 0; }

/* Technical details */
details { margin: 24px 0; padding: 16px 20px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; }
summary { min-height: 28px; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
details[open] > summary { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
details:last-child { margin-bottom: 0; }
pre { margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #f0f5f1; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; max-height: 520px; overflow: auto; font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; }
pre:empty { display: none; }
code { display: block; margin: 12px 0; font: 14px/1.6 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.connection-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.connection-grid > div { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.connection-grid > div > p:last-child { margin-bottom: 0; }
.field-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.field-list li { padding: 6px 9px; border: 1px solid var(--line); border-radius: 5px; background: white; font: 12px/1.5 ui-monospace, Consolas, monospace; }

/* Learning, evidence and intake editors */
[data-subpage] { padding-top: 24px; border-top: 1px solid var(--line); }
#documents [data-subpage] { padding-top: 0; border-top: 0; }
[data-subpage] > p { max-width: 800px; }
.selection-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0; padding: 18px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; }
.selection-bar label { margin: 0; }
.selection-bar select { flex: 1; max-width: 360px; }
.capture-row { display: grid; grid-template-columns: minmax(130px, 2fr) minmax(100px, 1.4fr) minmax(90px, 1fr) minmax(100px, 1.2fr) auto; align-items: end; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.capture-row label { min-width: 0; margin-bottom: 0; font-size: 12px; }
.capture-row label > input, .capture-row label > select { margin-top: 8px; }
.capture-row input[type="checkbox"] { display: block; margin: 14px 0 12px; }
.mapping-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 24px; margin: 0; padding: 18px 0; border-bottom: 1px solid var(--line); }
#mapping-fields, #type-field-summary { margin: 16px 0 24px; }
.template-field { display: flex; justify-content: space-between; gap: 24px; margin: 0; padding: 16px 0; border-bottom: 1px solid var(--line); }
.template-field strong { color: var(--ink); }
.template-field span { text-align: right; }
.evidence-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
.evidence-grid > div { min-width: 0; }
.evidence-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.evidence-row span, .evidence-row strong { overflow-wrap: anywhere; }
.source-card { padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.source-card pre { max-height: 450px; padding: 0; border: 0; background: transparent; }
mark { padding: 2px; border-radius: 3px; background: #fff0b1; color: #263c31; }
.delivery-source { padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.delivery-source > button { justify-self: start; }
#delivery-jobs > p, #delivery-source-health > p, #alert-list > p { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
#delivery-jobs small { display: inline-block; margin-top: 6px; font-size: 12px; }
#delivery-jobs button, #alert-list button { flex-shrink: 0; }
#document-review { margin-top: 24px; padding: 24px; border: 1px solid #b4d3c0; border-radius: 12px; background: #f5faf6; }
#document-review > h3 { margin-top: 0; }
#sample-page-previews { display: flex; gap: 12px; overflow: auto; }
#sample-page-previews figure { min-width: 110px; max-width: 150px; margin: 16px 0; }
#sample-page-previews img { max-height: 120px; max-width: 150px; object-fit: contain; }
#sample-page-previews figcaption { font-size: 12px; overflow-wrap: anywhere; }
#case-count, #learning-summary { padding: 16px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
#learning-summary > p:last-child { margin-bottom: 0; }
#notice { margin-bottom: 24px; padding: 14px 18px; border: 1px solid #c4e0cd; border-radius: 9px; background: #eaf5ed; color: #20523b; font-size: 13px; }
#notice.error { border-color: #ebc8c3; background: #fbeeea; color: #8b3028; }
.login-card { padding: 36px; }
.login-card h2 { margin: 20px 0 10px; font-size: 24px; }
.login-card form { margin-top: 28px; }
.login-card input { margin-bottom: 20px; }
.login-card button { width: 100%; }
.login-card .helper { margin: 20px 0 0; }
footer { padding: 8px 0 20px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

@media (max-width: 1200px) {
  main { padding: 28px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .capture-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .capture-row > button { justify-self: start; }
  .evidence-grid { grid-template-columns: 1fr; }
  .form-footer { align-items: flex-start; flex-wrap: wrap; }
}
@media (max-width: 900px) {
  header { align-items: flex-start; flex-direction: column; }
  .section-heading { flex-wrap: wrap; }
  .form-grid, .provider-grid, .connection-grid { grid-template-columns: 1fr; }
  .selection-bar select { max-width: none; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; padding: 18px 16px; gap: 18px; }
  .nav-label, .sidebar-footer { display: none; }
  #main-navigation { flex-direction: row; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding: 6px; scrollbar-width: thin; scrollbar-color: #668975 transparent; }
  #main-navigation .nav-link { flex-shrink: 0; }
  .nav-link { min-height: 44px; padding: 9px 12px; font-size: 13px; }
  main, body:not(.signed-in) main { margin: 0; padding: 24px 16px; }
  header { gap: 16px; margin-bottom: 24px; padding-bottom: 24px; }
  header .eyebrow, header p { display: none; }
  h1 { margin: 0; font-size: 21px; }
  .page-heading h2 { font-size: 26px; }
  .card { padding: 20px; }
  .login-card { padding: 24px; }
  .section-heading { gap: 16px; margin-bottom: 24px; }
  .sub-navigation { flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding: 6px; margin-bottom: 24px; scrollbar-width: thin; scrollbar-color: #91ad9b transparent; }
  .sub-navigation a { flex-shrink: 0; min-height: 44px; padding: 10px 12px; }
  .stats { gap: 12px; }
  .stats .card { padding: 18px; }
  .stats strong { font-size: 24px; }
  .form-grid { gap: 20px; }
  .form-section, .delivery-source, .connection-grid > div, .source-card { padding: 18px; }
  .selection-bar { align-items: stretch; flex-direction: column; }
  .selection-bar select { width: 100%; }
  .mapping-row { grid-template-columns: 1fr; gap: 10px; }
  .evidence-row { grid-template-columns: 1fr 1fr; }
  .evidence-row button { justify-self: start; }
  .template-field { align-items: flex-start; gap: 16px; }
  #delivery-jobs > p, #alert-list > p { align-items: flex-start; flex-direction: column; padding: 16px; }
  #document-review { padding: 18px; }
  details { padding: 16px; }
}
@media (max-width: 420px) {
  .capture-row { grid-template-columns: 1fr; }
  .capture-row input[type="checkbox"] { margin: 8px 0; }
  .stats { grid-template-columns: 1fr; margin-bottom: 24px; }
  .stats .card { margin-bottom: 0; }
  .section-heading > .tag { max-width: 100%; }
}

.client-field-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(160px, 1fr); gap: 20px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border, #dbe5df); }
.client-field-row select { width: 100%; }
#client-app-types details { margin-bottom: 12px; }
#client-app-types .checkbox { margin: 12px 0; }
@media (max-width: 760px) { .client-field-row { grid-template-columns: minmax(0, 1fr); gap: 8px; } }
