:root {
  color-scheme: light;
  --ink: #283a40;
  --muted: #74868c;
  --line: #dfe5e7;
  --paper: #ffffff;
  --wash: #eef5f5;
  --background: #f4f7f7;
  --accent: #d70f64;
  --accent-dark: #b70c54;
  --green: #176477;
  --green-dark: #104e5e;
  --green-soft: #e8f2f3;
  --success: #247249;
  --shadow: 0 12px 32px rgba(24, 39, 44, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  color: var(--ink);
  background: var(--background);
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
  padding: 1.15rem 1rem 1rem;
  color: var(--ink);
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: none;
}

.topbar h1 { margin: .12rem 0 0; font-size: 1rem; letter-spacing: -.02em; }
.brand-block { display: grid; gap: .12rem; padding: 0 .65rem .9rem; border-bottom: 1px solid #edf0f1; }
.brand-logo { display: block; width: 100%; max-width: 160px; height: 44px; border-radius: 0; object-fit: cover; object-position: center; }
.eyebrow, .step-label { margin: 0; color: var(--accent-dark); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.topbar .eyebrow { color: var(--muted); font-size: .6rem; }
.environment { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-weight: 600; font-size: .85rem; }
.environment span { width: .65rem; height: .65rem; border-radius: 50%; background: #e0a13a; box-shadow: 0 0 0 .3rem rgba(224, 161, 58, .14); }
.portal-nav { display: grid; gap: .25rem; }
.portal-nav button { position: relative; min-height: 42px; border: 0; border-radius: 10px; padding: .65rem .75rem; color: #6d7d83; background: transparent; font-size: .82rem; font-weight: 600; text-align: left; cursor: pointer; transition: color .18s, background .18s; }
.portal-nav button:hover { color: var(--green-dark); background: #f3f7f7; }
.portal-nav button.active { color: var(--green-dark); background: var(--green-soft); box-shadow: none; }
.portal-nav button.active::before { content: ""; position: absolute; left: -1rem; top: 11px; width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar-footer { display: grid; gap: .9rem; margin-top: auto; }
.topbar .environment { color: var(--muted); }
.topbar .environment span { background: var(--success); box-shadow: 0 0 0 .3rem rgba(36, 114, 73, .11); }
.operator-panel { display: grid; gap: .16rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: #f6f8f8; }
.operator-panel small { color: var(--muted); font-size: .7rem; }
.operator-panel strong { font-size: .88rem; }
.sidebar-logout { border: 1px solid var(--line); border-radius: 10px; padding: .7rem; color: #617077; background: white; font-weight: 650; cursor: pointer; }
.sidebar-logout:hover { color: var(--green-dark); border-color: #9bbbc2; background: var(--green-soft); }

main { width: min(1450px, calc(100% - 2.5rem)); margin: 0 auto; padding: clamp(1.25rem, 2vw, 2rem) 0 3rem; }
.intro { display: grid; grid-template-columns: auto minmax(18rem, 1fr); gap: 1rem; align-items: center; margin-bottom: .65rem; }
.intro h2 { max-width: 780px; margin: .6rem 0 0; font-size: clamp(1.9rem, 3vw, 2.8rem); line-height: 1.08; font-weight: 650; letter-spacing: -.04em; }
.intro > p { max-width: 760px; margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.screening-intro { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.screening-intro-copy { display: grid; gap: .3rem; }
.screening-intro-copy > p:last-child { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.screening-top-actions { display: grid; justify-items: end; gap: .35rem; max-width: 440px; }
.screening-top-actions .secondary-action { min-width: 110px; }
.action-message { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.4; text-align: right; }
.action-message.error-text { color: #a73120; }
.action-message.success-text { color: #165b46; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 1.5rem; align-items: start; }
.card { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.form-card, .handoff-card { padding: clamp(1rem, 2vw, 1.5rem); }
.handoff-card { position: sticky; top: 1.5rem; }
.section-heading { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; }
.section-heading > span { display: grid; place-items: center; flex: 0 0 auto; width: 2.35rem; height: 2.35rem; border-radius: 12px; color: white; background: var(--green); font-size: .78rem; font-weight: 700; }
.section-heading h3 { margin: .05rem 0 .35rem; font-size: 1.25rem; }
.section-heading p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }

.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem .8rem; align-items: start; }
.licence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.identity-grid { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.identity-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 1.1rem; }
.dob-field { display: grid; gap: .48rem; }
.dob-selects { display: grid; grid-template-columns: .8fr 1.15fr 1fr; gap: .35rem; }
.dob-selects select { padding-inline: .35rem; font-size: .78rem; }
.optional-label { color: var(--muted); font-size: .72rem; font-weight: 600; }
.form-section { min-width: 0; margin: 0 0 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfc; }
.form-section legend { padding: 0 .5rem; color: #42575e; font-size: .95rem; font-weight: 650; }
.form-section input, .form-section textarea { background: white; }
.field-help { margin: .75rem 0 0; color: var(--muted); font-size: .78rem; }
label { display: grid; gap: .48rem; color: #566a71; font-size: .82rem; font-weight: 600; }
label strong { color: var(--accent); }
.wide { grid-column: span 2; }
input, textarea, select { width: 100%; border: 1px solid #d5dddf; border-radius: 10px; padding: .68rem .78rem; color: var(--ink); background: #fff; outline: none; transition: border-color .18s, box-shadow .18s, background .18s; }
input:not([type="checkbox"]):not([type="file"]), select { min-height: 44px; height: 44px; }
input:hover, textarea:hover, select:hover { border-color: #b7c6ca; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 100, 119, .13); }
input.rider-field-invalid,
textarea.rider-field-invalid,
select.rider-field-invalid {
  border-color: #b63d32;
  background: #fff5f3;
  box-shadow: 0 0 0 3px rgba(182, 61, 50, .12);
}
.handoff-consent.rider-field-invalid {
  border-color: #b63d32;
  background: #fff5f3;
  box-shadow: 0 0 0 3px rgba(182, 61, 50, .1);
}
.quick-verify-consent.rider-field-invalid {
  border-color: #b63d32;
  background: #fff5f3;
  box-shadow: 0 0 0 3px rgba(182, 61, 50, .1);
}
textarea { resize: vertical; }
.or-divider { display: grid; place-items: center; align-self: end; min-height: 46px; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .12em; }

.notice { display: flex; gap: 1rem; margin: 1.5rem 0; padding: 1.1rem; border: 1px solid #efd9c7; border-radius: 14px; background: #fff9f4; }
.notice-mark { display: grid; place-items: center; flex: 0 0 auto; width: 1.8rem; height: 1.8rem; border-radius: 9px; color: white; background: var(--green); font-weight: 900; }
.notice h4 { margin: .12rem 0 .4rem; }
.notice p { margin: 0 0 .85rem; color: #6e5a4f; font-size: .86rem; line-height: 1.55; }
.consent-confirmation { margin: 1.25rem 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fbfafb; }
.consent { display: flex; grid-template-columns: none; align-items: flex-start; gap: .65rem; line-height: 1.4; }
.consent input { width: 1.05rem; height: 1.05rem; margin-top: .15rem; accent-color: var(--green); }
.handoff-consent { margin: 1rem 0 0; padding: .85rem .9rem; background: var(--green-soft); }
.handoff-consent .consent { color: #50656c; font-size: .8rem; font-weight: 500; }

.primary { width: 100%; border: 0; border-radius: 11px; padding: .95rem 1.15rem; color: white; background: var(--green); font-weight: 700; cursor: pointer; box-shadow: 0 8px 20px rgba(23, 100, 119, .16); transition: background .18s, transform .18s, box-shadow .18s; }
.primary:hover { background: var(--green-dark); box-shadow: 0 10px 24px rgba(23, 100, 119, .24); transform: translateY(-1px); }
.primary:disabled { opacity: .55; cursor: wait; }
.requirement-action.requirements-missing { color: #817b7e; border-color: #d7d2d4; background: #eceaec; box-shadow: none; cursor: pointer; }
.primary.requirement-action.requirements-missing:hover { color: #706b6e; background: #e3e0e2; }
.secondary-action { width: 100%; margin-top: .8rem; border: 1px solid #a9c2c8; border-radius: 11px; padding: .8rem 1rem; color: var(--green-dark); background: white; font-weight: 650; cursor: pointer; transition: background .18s, border-color .18s; }
.secondary-action:hover { border-color: var(--green); background: var(--green-soft); }
.secondary-action:disabled { opacity: .55; cursor: wait; }
.error { color: #a73120; background: #fff0ed; border-radius: 10px; padding: .8rem; font-size: .88rem; }

.empty-state { display: grid; place-items: center; min-height: 360px; color: var(--muted); text-align: center; }
.phone-outline { width: 118px; height: 188px; border: 3px solid #9bbbc2; border-radius: 20px; padding: 12px; }
.phone-outline div { width: 100%; height: 100%; border-radius: 10px; background: repeating-linear-gradient(45deg, #e8f2f3, #e8f2f3 10px, #f7fafa 10px, #f7fafa 20px); }
.candidate-summary { display: grid; gap: .18rem; padding: .9rem 1rem; border-radius: 12px; background: var(--wash); }
.candidate-summary span, .candidate-summary small, .status-panel small { color: var(--muted); font-size: .72rem; }
.candidate-summary strong { font-size: 1.05rem; }
.qr { display: block; width: min(100%, 320px); margin: 1.25rem auto; border-radius: 12px; }
.capture-instructions { margin: 0; padding-left: 1.35rem; color: var(--muted); font-size: .86rem; line-height: 1.65; }
.status-panel { display: flex; align-items: center; gap: .8rem; margin-top: 1.25rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; }
.status-panel div { display: grid; gap: .2rem; }
.status-dot { width: .7rem; height: .7rem; border-radius: 50%; background: #e0a13a; box-shadow: 0 0 0 .3rem rgba(224, 161, 58, .14); }
.status-dot.ready { background: var(--success); box-shadow: 0 0 0 .3rem rgba(36, 114, 73, .14); }
.status-dot.clear { background: var(--success); box-shadow: 0 0 0 .3rem rgba(36, 114, 73, .14); }
.status-dot.possible_match { background: var(--accent); box-shadow: 0 0 0 .3rem rgba(215, 15, 100, .13); }
.status-dot.failed { background: #b63d32; box-shadow: 0 0 0 .3rem rgba(182, 61, 50, .13); }
.expiry { margin: .9rem 0 0; color: var(--muted); text-align: center; font-size: .75rem; }
.match-result-card { display: grid; gap: .4rem; margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #f7fafa; }
.match-result-card h3 { margin: 0; font-size: 1rem; }
.match-result-card > p:not(.step-label) { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.match-result-card.clear { border-color: #b9dbca; background: #f0f8f4; }
.match-result-card.possible-match { border-color: #e8a7c4; background: #fff4f8; }
.match-result-card.failed { border-color: #e3b2ac; background: #fff4f2; }
.match-result-card .secondary-action { justify-self: start; margin-top: .35rem; }
.next-screening { margin-top: .8rem; }
.handoff-actions { display: grid; justify-items: end; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.handoff-actions .primary { width: auto; min-width: 230px; }
.handoff-actions .action-message { max-width: 340px; }

.records-card { padding: clamp(1.25rem, 3vw, 2.25rem); }
.records-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .45fr); gap: 2rem; align-items: end; }
.records-heading h2 { margin: .45rem 0 .35rem; color: #30434a; font-size: clamp(1.55rem, 2.5vw, 2.15rem); font-weight: 650; letter-spacing: -.035em; }
.records-heading p:not(.step-label) { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.5; }
.record-search { display: grid; gap: .45rem; }
.records-status { margin: 1.4rem 0 .7rem; color: var(--muted); font-size: .84rem; }
.records-list { display: grid; gap: .65rem; }
.record-row { width: 100%; display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(140px, .8fr) minmax(130px, .7fr) auto; gap: 1rem; align-items: center; padding: .95rem 1rem; border: 1px solid var(--line); border-radius: 11px; color: inherit; background: #fff; text-align: left; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.record-row:hover { border-color: #8bb2ba; background: #f7fafa; transform: translateY(-1px); }
.record-person { display: grid; gap: .18rem; }
.record-person strong { font-size: .95rem; }
.record-person small, .record-meta { color: var(--muted); font-size: .76rem; }
.record-badge { justify-self: end; border-radius: 999px; padding: .38rem .65rem; color: #765215; background: #fff1cb; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.record-badge.collecting { color: #765215; background: #fff1cb; }
.record-badge.ready { color: #165b46; background: #dff3ea; }
.record-badge.clear, .record-badge.confirmed_new { color: #165b46; background: #dff3ea; }
.record-badge.possible_match, .record-badge.confirmed_returning { color: #a20c4d; background: #fde3ee; }
.record-badge.failed, .record-badge.needs_recapture { color: #913026; background: #fde8e5; }
.records-empty { padding: 2rem; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
.back-link { margin-bottom: 1rem; border: 0; padding: .4rem 0; color: var(--green); background: transparent; font-weight: 650; cursor: pointer; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr); gap: 1.5rem; align-items: start; }
.detail-heading { margin-bottom: 1rem; }
.detail-heading .record-badge { align-self: start; }
.detail-sidebar { position: sticky; top: 1.5rem; display: grid; gap: 1rem; }
#detail-form { padding: clamp(1.2rem, 2vw, 1.7rem); box-shadow: 0 8px 24px rgba(24, 39, 44, .045); }
#detail-form .detail-heading { align-items: center; padding-bottom: .35rem; }
#detail-form .detail-heading h2 { color: #385057; font-weight: 500; }
#detail-form .detail-heading p:not(.step-label) { color: #819096; font-size: .82rem; }
#detail-form .form-section { margin: 0; padding: 1.15rem 0 1.3rem; border: 0; border-top: 1px solid #e7ebec; border-radius: 0; background: transparent; }
#detail-form .form-section:first-child { border-top: 0; }
#detail-form .form-section legend { padding: 0 .65rem 0 0; color: #687b81; font-size: .82rem; font-weight: 500; letter-spacing: .01em; }
#detail-form label { color: #718187; font-weight: 500; }
#detail-form input, #detail-form textarea, #detail-form select { color: #50636a; background: #fbfcfc; font-weight: 400; }
#detail-form .field-help { color: #819096; font-weight: 400; }
#detail-form > .primary { width: auto; min-width: 180px; margin-top: .5rem; padding-inline: 1.5rem; }
.detail-sidebar .card { box-shadow: 0 8px 24px rgba(24, 39, 44, .04); }
.detail-sidebar .step-label { font-weight: 600; }
.detail-sidebar h2 { color: #40565d; font-weight: 550; }
.detail-sidebar label { color: #718187; font-weight: 500; }
.detail-sidebar .settings-help { color: #819096; font-size: .82rem; }
.image-upload-card, .fingerprint-card { padding: 1.25rem; }
.match-detail-card { padding: 1.25rem; border-color: #e8a7c4; background: #fff9fb; }
.match-detail-card.clear { border-color: #b9dbca; background: #f5faf7; }
.match-detail-card.failed { border-color: #e3b2ac; background: #fff7f5; }
.match-detail-card h2 { margin: .35rem 0 .8rem; color: #34484f; font-weight: 650; letter-spacing: -.025em; }
.match-detail-card .secondary-action { margin-top: .2rem; }
.image-upload-card h2, .fingerprint-card h2, .settings-card h2 { margin: .35rem 0 .8rem; color: #34484f; font-weight: 650; letter-spacing: -.025em; }
.image-upload-card label { display: grid; gap: .45rem; color: var(--muted); font-size: .78rem; font-weight: 600; }
.fingerprint-card h3 { margin: 1.25rem 0 .55rem; color: #40545b; font-size: .9rem; font-weight: 650; }
.fingerprint-handoff { margin-top: 1rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.fingerprint-handoff .qr { margin: 0 auto .6rem; }
.fingerprint-handoff p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.fingerprint-history { display: grid; gap: .55rem; color: var(--muted); font-size: .8rem; }
.fingerprint-history > div { display: grid; gap: .2rem; padding: .65rem; border: 1px solid var(--line); border-radius: 10px; background: #fafafa; }
.fingerprint-history strong { color: #40545b; font-size: .82rem; font-weight: 600; }
.fingerprint-history small { line-height: 1.4; }
.image-empty { display: grid; place-items: center; min-height: 180px; margin-bottom: 1rem; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: var(--wash); text-align: center; }
.image-preview { width: 100%; max-height: 280px; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 12px; object-fit: contain; background: white; }
.rider-photo-preview { aspect-ratio: 4 / 5; object-fit: cover; }
.form-message { margin: .8rem 0 0; border-radius: 10px; padding: .75rem; color: #165b46; background: #e2f3ec; }
.form-message.error { color: #a73120; background: #fff0ed; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.settings-card { padding: 1.75rem; }
.reference-settings-card { grid-column: 1 / -1; }
.settings-help { margin: -.45rem 0 1.25rem; color: var(--muted); line-height: 1.5; }
.settings-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.vehicle-settings-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 .75rem; }
.vehicle-settings-heading h3 { margin: 0 0 .25rem; }
.vehicle-settings-heading p { margin: 0; color: var(--muted); font-size: .82rem; }
.compact-action { width: auto; margin: 0; white-space: nowrap; }
.vehicle-settings-list { display: grid; gap: .6rem; margin-bottom: 1.2rem; }
.vehicle-setting-row { display: grid; grid-template-columns: minmax(160px, 1fr) auto auto; gap: .75rem; align-items: center; padding: .7rem; border: 1px solid var(--line); border-radius: 11px; background: var(--wash); }
.vehicle-license-toggle { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.vehicle-license-toggle input { width: 1rem; }
.vehicle-remove { border: 0; color: #a73120; background: transparent; font-weight: 800; cursor: pointer; }
.settings-list { display: grid; gap: .2rem; margin: 0 0 1.25rem; }
.settings-list div { display: grid; grid-template-columns: minmax(120px, .6fr) 1fr; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.settings-list dt { color: var(--muted); font-size: .8rem; }
.settings-list dd { margin: 0; font-weight: 600; }
.download-link { display: inline-block; border-radius: 10px; padding: .8rem 1rem; color: white; background: var(--green); box-shadow: 0 8px 20px rgba(23, 100, 119, .16); font-weight: 700; text-decoration: none; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-heading h2 { margin: .3rem 0 0; font-size: 1.75rem; letter-spacing: -.035em; }
.compact-heading { min-height: 44px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.metric-card { position: relative; display: grid; gap: .45rem; min-height: 108px; padding: 1.05rem 1.1rem; border-radius: 14px; box-shadow: none; }
.metric-card::before { content: ""; position: absolute; top: 1rem; right: 1rem; width: .55rem; height: .55rem; border-radius: 50%; background: #b8c7ca; }
.metric-card.warning::before { background: #d99a33; }
.metric-card.alert::before { background: var(--accent); }
.metric-card span { color: var(--muted); font-size: .74rem; font-weight: 600; }
.metric-card strong { color: var(--ink); font-size: 1.8rem; line-height: 1; }
.metric-card.warning strong { color: #9a6813; }
.metric-card.alert strong { color: var(--ink); }
.dashboard-list-card { padding: 1rem; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.section-title-row h3 { margin: .2rem 0 0; font-size: 1.05rem; }
.text-action { border: 0; padding: .4rem; color: var(--green); background: transparent; font-weight: 650; cursor: pointer; }
.dashboard-record-row { grid-template-columns: minmax(180px, 1.2fr) minmax(130px, .8fr) minmax(130px, .7fr) auto; }

.registration-intro { margin-bottom: .65rem; }
.quick-verify-layout { display: grid; grid-template-columns: minmax(320px, .7fr) minmax(360px, 1fr); gap: 1.25rem; align-items: start; max-width: 1040px; }
.quick-verify-card { display: grid; gap: 1rem; padding: clamp(1.1rem, 2vw, 1.5rem); }
.quick-verify-consent { padding: .8rem; border: 1px solid var(--line); border-radius: 11px; background: #f8fafa; font-weight: 500; }
.quick-verify-card .candidate-summary { margin-bottom: .8rem; }
.quick-verify-card .qr { margin-inline: auto; }
.quick-verify-card > .secondary-action { margin-top: .2rem; }
.compact-empty { min-height: 300px; }
.staff-form-card { width: min(960px, 100%); padding: clamp(1rem, 2vw, 1.5rem); }
.staff-identity-section { margin-top: 1rem; }
.staff-identity-section legend { color: #566a71; font-size: .82rem; font-weight: 600; }
.profile-upload-field { align-content: start; }
.staff-profile-preview { width: 110px; height: 110px; border: 1px solid var(--line); border-radius: 12px; object-fit: cover; background: var(--wash); }
.staff-record-row { grid-template-columns: minmax(170px, 1.1fr) minmax(150px, .8fr) minmax(200px, 1fr) auto; cursor: default; }
.staff-record-row .record-meta { white-space: pre-line; }

.windows-capture-panel { display: grid; gap: .65rem; margin-top: 1rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: #f7fafa; }
.windows-capture-panel strong { font-size: .82rem; }
.windows-capture-panel p { margin: .2rem 0 0; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.windows-capture-panel .secondary-action { margin: 0; }
.windows-browser-capture { display: grid; gap: .75rem; margin-top: .35rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.windows-finger-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.windows-finger-actions .secondary-action:disabled { color: #7e7a7c; border-color: #d6d2d4; background: #ebe9ea; cursor: not-allowed; opacity: 1; }
.windows-capture-progress { display: grid; gap: .35rem; }
.windows-capture-progress progress { width: 100%; height: .65rem; accent-color: var(--accent); }
.windows-capture-progress span { color: var(--muted); font-size: .72rem; }
.windows-browser-capture #windows-capture-instruction { margin: 0; color: #344a51; font-size: .82rem; font-weight: 650; }
.windows-browser-capture .form-message { margin: 0; }
.windows-cancel-capture { justify-self: end; padding: .25rem .1rem; }

dialog { width: min(440px, calc(100% - 2rem)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 30px 90px rgba(8, 28, 22, .26); }
dialog::backdrop { background: rgba(14, 32, 27, .54); backdrop-filter: blur(6px); }
dialog form { display: grid; gap: 1rem; padding: 2rem; }
dialog h2 { margin: 0; font-size: 2rem; letter-spacing: -.04em; }
dialog p { margin: 0; color: var(--muted); line-height: 1.5; }

@media (max-width: 1050px) and (min-width: 641px) {
  body { grid-template-columns: 210px minmax(0, 1fr); }
  .topbar { padding-inline: .85rem; }
  .portal-nav button.active::before { left: -.85rem; }
  .intro, .workspace, .detail-layout, .settings-grid, .quick-verify-layout { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reference-recruiter { grid-column: 1 / -1; }
  .identity-grid, .identity-pair { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .wide { grid-column: auto; }
  .identity-pair.wide { grid-column: 1 / -1; }
  .handoff-card, .detail-sidebar { position: static; }
  .records-heading { grid-template-columns: 1fr; }
  .record-row { grid-template-columns: 1fr 1fr; }
  .record-badge { justify-self: start; }
  .settings-form-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .staff-record-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  body { display: block; }
  .topbar { position: sticky; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .7rem; padding: .65rem .8rem 0; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px rgba(24, 39, 44, .06); }
  .brand-block { display: block; padding: 0; border: 0; }
  .brand-logo { width: 116px; height: 36px; }
  .brand-block .eyebrow, .brand-block h1 { display: none; }
  .portal-nav { order: 3; width: calc(100% + 1.6rem); display: flex; gap: .2rem; margin: 0 -.8rem; padding: 0 .8rem; overflow-x: auto; scrollbar-width: none; }
  .portal-nav::-webkit-scrollbar { display: none; }
  .portal-nav button { flex: 0 0 auto; min-height: 42px; min-width: 112px; border-radius: 8px 8px 0 0; text-align: center; }
  .portal-nav button.active::before { left: 20%; top: auto; bottom: 0; width: 60%; height: 3px; border-radius: 3px 3px 0 0; }
  .sidebar-footer { margin: 0 0 0 auto; }
  .operator-panel, .sidebar-logout, .topbar .environment { display: none; }
  .intro, .workspace { grid-template-columns: 1fr; }
  .screening-top-actions { width: 100%; justify-items: stretch; max-width: none; }
  .screening-top-actions .secondary-action { width: 100%; }
  .action-message { text-align: left; }
  .records-heading { grid-template-columns: 1fr; }
  .detail-layout, .settings-grid, .quick-verify-layout { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
  .settings-form-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-setting-row { grid-template-columns: 1fr; }
  .record-row { grid-template-columns: 1fr 1fr; }
  .record-badge { justify-self: start; }
  .intro { gap: 1rem; }
  .handoff-card { position: static; }
}

@media (max-width: 560px) {
  main { width: min(100% - 1rem, 1240px); padding-top: 1rem; }
  .field-grid { grid-template-columns: 1fr; }
  .identity-grid, .identity-pair { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .form-card, .handoff-card { border-radius: 14px; }
  .record-row { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; }
  .page-heading h2 { font-size: 1.45rem; }
  .section-title-row { align-items: flex-start; }
}
