:root {
  color-scheme: light;
  --petrol: #063f5c;
  --petrol-2: #0b6682;
  --cobalt: #145cff;
  --coral: #e9503f;
  --magenta: #ba126f;
  --amber: #c77d00;
  --lime: #648b00;
  --violet: #6745bf;
  --ink: #12263a;
  --muted: #5c6e7e;
  --line: #dce5ed;
  --canvas: #f4f7fb;
  --card: #fff;
  --danger: #a82745;
  --success: #27724c;
  --shadow: 0 18px 55px rgba(7, 43, 70, .1);
  --radius: 22px;
  --sidebar: 264px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
a { color: var(--cobalt); }

:focus-visible { outline: 3px solid #ff9f1c; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 9999; left: 12px; top: 8px; padding: 10px 14px; color: #fff; background: var(--ink); border-radius: 10px; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--petrol-2); font-size: .72rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.eyebrow.light { color: #bce8ff; }

.loading-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 24px; text-align: center; }
.loading-screen img { filter: drop-shadow(0 16px 25px rgba(7,43,70,.16)); }
.loading-screen h1 { margin: 18px 0 4px; }
.loading-screen p { color: var(--muted); }

/* Login */
.login-body { min-height: 100vh; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr); }
.login-visual { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(28px, 5vw, 72px); color: #fff; background: #063f5c; }
.login-visual::before { content: ""; position: absolute; z-index: 1; inset: 0; background: linear-gradient(180deg,rgba(3,29,48,.36),rgba(3,29,48,.82) 86%),linear-gradient(90deg,rgba(6,63,92,.35),transparent 65%); }
.login-visual::after { content: ""; position: absolute; z-index: 1; right: -13vw; bottom: -24vw; width: 52vw; height: 52vw; border: 9vw solid rgba(255,255,255,.08); border-radius: 50%; }
.login-mobilization { position: absolute; z-index: 0; inset: 0; }
.login-mobilization img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.login-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; font-weight: 850; }
.login-brand img { padding: 5px; border-radius: 17px; background: #fff; }
.login-copy { position: relative; z-index: 2; max-width: 720px; }
.login-copy h1 { max-width: 690px; margin: 0; font-size: clamp(2.7rem, 5.6vw, 5.6rem); line-height: .96; letter-spacing: -.055em; }
.login-copy > p:last-child { max-width: 600px; margin: 24px 0 0; color: rgba(255,255,255,.8); font-size: 1.05rem; line-height: 1.65; }
.login-panel { display: grid; place-items: center; padding: clamp(20px, 5vw, 72px); background: #f9fbfd; }
.login-card { width: min(100%, 440px); }
.login-card h2 { margin: 0; font-size: 2rem; letter-spacing: -.035em; }
.login-card form { display: grid; gap: 9px; margin-top: 30px; }
.login-card label { margin-top: 8px; font-size: .82rem; font-weight: 800; }
.login-card input { width: 100%; min-height: 50px; border: 1px solid #cbd7e2; border-radius: 13px; padding: 0 14px; color: var(--ink); background: #fff; }
.password-field { position: relative; }
.password-field input { padding-right: 84px; }
.password-field button { position: absolute; right: 5px; top: 5px; min-height: 40px; border: 0; border-radius: 9px; padding: 0 11px; color: var(--petrol); background: #edf4f8; font-weight: 800; }
.form-error { margin: 7px 0; border-radius: 11px; padding: 11px 13px; color: #7d1731; background: #ffe8ee; font-size: .85rem; }
.login-note { margin: 24px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.55; }
.login-legal { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: .72rem; }
.login-legal a { color: var(--petrol-2); font-weight: 750; text-decoration: none; }
.login-legal a:hover { text-decoration: underline; }

/* Public legal pages */
.legal-body { min-height: 100vh; background: linear-gradient(145deg,#eef5f8,#f8faff); }
.legal-shell { width: min(920px,calc(100% - 28px)); margin: 0 auto; padding: 28px 0 64px; }
.legal-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.legal-header a { display: flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 900; text-decoration: none; }
.legal-header img { width: 48px; height: 48px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.legal-back { min-height: 40px; display: inline-flex; align-items: center; border-radius: 11px; padding: 0 13px; color: var(--petrol) !important; background: #fff; box-shadow: 0 8px 24px rgba(7,54,89,.08); font-size: .78rem; }
.legal-document { border: 1px solid var(--line); border-radius: 26px; padding: clamp(24px,5vw,58px); background: #fff; box-shadow: var(--shadow); }
.legal-document h1 { margin: 0; font-size: clamp(2.2rem,5vw,4rem); line-height: 1; letter-spacing: -.055em; }
.legal-document .legal-updated { margin: 13px 0 32px; color: var(--muted); font-size: .78rem; }
.legal-document h2 { margin: 30px 0 9px; color: var(--petrol); font-size: 1.12rem; }
.legal-document p, .legal-document li { color: #40566a; font-size: .92rem; line-height: 1.75; }
.legal-document ul { padding-left: 22px; }
.legal-document a { overflow-wrap: anywhere; }
.legal-summary { border-left: 5px solid var(--cobalt); border-radius: 12px; padding: 16px 18px; background: #edf4ff; }
.legal-footer { margin-top: 22px; text-align: center; color: var(--muted); font-size: .72rem; }
@media (max-width: 520px) { .legal-header { align-items: flex-start; } .legal-header a:first-child span { display: none; } }

/* Application shell */
.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 50; top: 0; min-height: 72px; display: grid; grid-template-columns: var(--sidebar) 1fr auto; align-items: center; gap: 18px; border-bottom: 1px solid rgba(6,63,92,.1); padding: 10px 22px; background: rgba(255,255,255,.94); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 900; }
.brand img { width: 45px; height: 45px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(7,54,89,.1); }
.scope-switchers { display: flex; align-items: center; gap: 9px; }
.scope-switchers label { display: grid; gap: 2px; color: var(--muted); font-size: .62rem; font-weight: 800; text-transform: uppercase; }
.scope-switchers select { min-width: 180px; height: 40px; border: 1px solid var(--line); border-radius: 11px; padding: 0 34px 0 11px; color: var(--ink); background: #fff; }
.top-actions { display: flex; align-items: center; gap: 7px; }
.icon-button, .logout-button, .menu-button { min-width: 42px; min-height: 42px; border: 1px solid var(--line); border-radius: 12px; color: var(--petrol); background: #fff; font-weight: 800; }
.logout-button { padding: 0 14px; }
.mobile-logout { display: none; }
.menu-button { display: none; font-size: 1.25rem; }
.shell-grid { display: grid; grid-template-columns: var(--sidebar) minmax(0,1fr); }
.sidebar { position: sticky; top: 72px; height: calc(100vh - 72px); overflow-y: auto; border-right: 1px solid var(--line); padding: 20px 14px 94px; background: #fff; }
.profile-card { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 11px; margin: 0 4px 20px; padding: 12px; border-radius: 16px; background: #edf5f8; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--petrol), var(--cobalt)); font-weight: 900; }
.profile-card strong, .profile-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-card small { margin-top: 3px; color: var(--muted); font-size: .69rem; }
.dashboard-nav { display: grid; gap: 5px; }
.dashboard-nav a { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 9px; min-height: 48px; border-radius: 13px; padding: 7px 10px; color: #40566a; text-decoration: none; font-size: .78rem; font-weight: 750; }
.dashboard-nav a:hover { background: #f1f5f8; }
.dashboard-nav a[aria-current="page"] { color: #fff; background: linear-gradient(135deg, var(--petrol), var(--cobalt)); box-shadow: 0 10px 24px rgba(20,92,255,.2); }
.nav-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: currentColor; background: rgba(255,255,255,.14); font-size: 1rem; }
.main-content { min-width: 0; padding: clamp(18px, 3vw, 42px); }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 18px; color: var(--muted); font-size: .72rem; }
.breadcrumbs a { color: var(--petrol-2); text-decoration: none; }
.breadcrumbs span::before { content: "/"; margin-right: 7px; color: #9bacba; }
.mobile-role-nav { display: none; }

.page-hero { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 22px; align-items: center; overflow: hidden; margin-bottom: 22px; border: 1px solid rgba(20,92,255,.1); border-radius: 27px; padding: clamp(22px, 4vw, 38px); background: radial-gradient(circle at 93% 18%, rgba(155,212,0,.15), transparent 23%), linear-gradient(135deg,#fff,#f1f7ff); box-shadow: var(--shadow); }
.page-hero::after { content: ""; position: absolute; right: -58px; bottom: -75px; width: 180px; height: 180px; border: 28px solid rgba(20,92,255,.06); border-radius: 50%; }
.page-hero h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; letter-spacing: -.05em; }
.page-hero p:last-child { max-width: 720px; margin: 13px 0 0; color: var(--muted); line-height: 1.6; }
.candidate-portrait { position: relative; z-index: 1; display: grid; place-items: center; width: 92px; height: 112px; overflow: hidden; border: 5px solid #fff; border-radius: 18px; color: #fff; background: linear-gradient(145deg,var(--petrol),var(--violet)); box-shadow: 0 13px 35px rgba(7,43,70,.2); font-size: 1.5rem; font-weight: 900; }
.candidate-portrait img { width: 100%; height: 100%; object-fit: cover; }

.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.metric { position: relative; min-height: 118px; overflow: hidden; border-radius: 20px; padding: 20px; color: #fff; background: linear-gradient(145deg,var(--petrol),var(--petrol-2)); box-shadow: 0 12px 32px rgba(8,48,76,.12); }
.metric::after { content: ""; position: absolute; right: -38px; bottom: -55px; width: 100px; height: 100px; border: 20px solid rgba(255,255,255,.12); border-radius: 50%; }
.metric[data-tone="violet"] { background: linear-gradient(145deg,#5134aa,#7653d6); }
.metric[data-tone="coral"] { background: linear-gradient(145deg,#b83930,#ed6a4f); }
.metric[data-tone="lime"] { background: linear-gradient(145deg,#3e7100,#78a800); }
.metric strong { position: relative; z-index: 1; display: block; font-size: clamp(1.55rem,3vw,2.25rem); }
.metric span { position: relative; z-index: 1; display: block; margin-top: 8px; color: rgba(255,255,255,.82); font-size: .75rem; }

.launcher-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; }
.launcher { --tone: var(--cobalt); --soft: #eaf1ff; position: relative; min-height: 186px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid color-mix(in srgb,var(--tone) 20%,transparent); border-radius: 22px; padding: 20px; color: var(--ink); text-decoration: none; background: linear-gradient(145deg,var(--soft),#fff 90%); box-shadow: 0 12px 34px rgba(8,48,76,.07); transition: transform .18s ease,box-shadow .18s ease; }
.launcher:hover { transform: translateY(-3px); box-shadow: 0 20px 45px rgba(8,48,76,.13); }
.launcher::after { content: ""; position: absolute; right: -52px; bottom: -68px; width: 120px; height: 120px; border-radius: 50%; background: var(--tone); opacity: .1; }
.launcher[data-tone="petrol"] { --tone: var(--petrol-2); --soft: #e6f6fa; }
.launcher[data-tone="coral"] { --tone: var(--coral); --soft: #fff0eb; }
.launcher[data-tone="magenta"] { --tone: var(--magenta); --soft: #fceaf5; }
.launcher[data-tone="amber"] { --tone: var(--amber); --soft: #fff4d9; }
.launcher[data-tone="lime"] { --tone: var(--lime); --soft: #f1f8dc; }
.launcher[data-tone="violet"] { --tone: var(--violet); --soft: #f0ebfc; }
.launcher[data-tone="slate"] { --tone: #50687c; --soft: #edf2f5; }
.launcher-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 20px; border-radius: 14px; color: #fff; background: var(--tone); font-size: 1.2rem; }
.launcher strong { display: block; margin-bottom: 6px; font-size: .98rem; }
.launcher p { margin: 0; color: var(--muted); font-size: .73rem; line-height: 1.5; }
.launcher small { margin-top: auto; padding-top: 13px; color: var(--tone); font-size: .66rem; font-weight: 850; text-transform: uppercase; }

.section-card { margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(17px,3vw,26px); background: #fff; box-shadow: 0 12px 34px rgba(8,48,76,.055); }
.section-card > header, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-card h2, .section-card h3 { margin: 0; letter-spacing: -.025em; }
.section-card header p { margin: 6px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 18px; }
.toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.toolbar input, .toolbar select { min-height: 42px; border: 1px solid var(--line); border-radius: 11px; padding: 0 11px; background: #fff; }
.primary-button, .secondary-button, .danger-button { min-height: 44px; border: 0; border-radius: 12px; padding: 0 16px; font-weight: 850; }
.primary-button { color: #fff; background: var(--cobalt); }
.secondary-button { color: var(--petrol); background: #eaf3f7; }
.danger-button { color: #fff; background: var(--danger); }
.wide-button { width: 100%; margin-top: 13px; }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; }

.record-list { display: grid; gap: 11px; }
.record-card { border: 1px solid var(--line); border-left: 5px solid var(--cobalt); border-radius: 16px; padding: 16px; background: #fff; }
.record-card[data-priority="critical"] { border-left-color: var(--magenta); }
.record-card[data-priority="high"] { border-left-color: var(--amber); }
.record-card header { display: flex; justify-content: space-between; gap: 12px; }
.record-card h3 { font-size: .96rem; }
.record-card > p { color: var(--muted); font-size: .78rem; line-height: 1.55; white-space: pre-wrap; }
.record-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.access-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; border-radius: 99px; padding: 4px 5px 4px 10px; color: #245d3e; background: #e6f6ed; font-size: .65rem; font-weight: 800; }
.access-chip.inactive { color: #704900; background: #fff0c7; }
.access-chip button { min-height: 25px; border: 0; border-radius: 99px; padding: 0 8px; color: inherit; background: rgba(255,255,255,.72); font-size: .61rem; font-weight: 850; }
.structured-step { display: grid; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: #f7fafb; }
.structured-step > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.structured-step h3, .structured-step p { margin: 0; }
.structured-step p { color: var(--muted); margin-top: .3rem; }
@media (max-width: 700px) { .structured-step > header { flex-direction: column; } }
.chip { display: inline-flex; align-items: center; min-height: 28px; border-radius: 99px; padding: 4px 9px; color: #31566c; background: #edf4f8; font-size: .65rem; font-weight: 800; }
.chip.warning { color: #704900; background: #fff0c7; }
.chip.critical { color: #8b1738; background: #ffe6ed; }
.empty-state, .error-state { border: 1px dashed #bfcbd6; border-radius: 17px; padding: 32px 18px; text-align: center; color: var(--muted); }
.empty-state strong, .error-state strong { display: block; margin-bottom: 6px; color: var(--ink); }
.error-state { border-color: #e3a7b7; color: #86203d; background: #fff5f7; }
.skeleton { min-height: 130px; border-radius: 18px; background: linear-gradient(90deg,#edf2f6,#f8fafb,#edf2f6); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Journey */
.journey-layout { display: grid; grid-template-columns: minmax(230px,300px) minmax(0,1fr); gap: 18px; }
.journey-rail { align-self: start; border: 1px solid var(--line); border-radius: 22px; padding: 14px; background: #fff; box-shadow: 0 12px 34px rgba(8,48,76,.06); }
.journey-progress { margin-bottom: 14px; padding: 13px; border-radius: 14px; color: #fff; background: linear-gradient(135deg,var(--petrol),var(--cobalt)); }
.journey-progress strong { display: block; font-size: 1.6rem; }
.journey-progress progress { width: 100%; height: 10px; margin-top: 9px; accent-color: #a4dd00; }
.step-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.step-button { width: 100%; display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 8px; min-height: 48px; border: 0; border-radius: 12px; padding: 7px; color: #40566a; text-align: left; background: transparent; }
.step-button:hover { background: #f2f6f8; }
.step-button[aria-current="step"] { color: var(--petrol); background: #eaf3f8; }
.step-number { display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid #cdd8e2; border-radius: 50%; font-size: .7rem; font-weight: 900; }
.step-button[data-status="completed"] .step-number { border-color: var(--lime); color: #fff; background: var(--lime); }
.step-button small { display: block; margin-top: 2px; color: var(--muted); font-size: .61rem; }
.journey-panel { min-width: 0; }
.journey-order-picker { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 12px; }
.journey-order-picker label { flex: 1; display: grid; gap: 5px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.journey-order-picker select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; }
.step-form { display: grid; gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { display: grid; gap: 6px; color: #40566a; font-size: .75rem; font-weight: 800; }
.field.full { grid-column: 1/-1; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; border: 1px solid #cbd7e2; border-radius: 12px; padding: 10px 12px; color: var(--ink); background: #fff; }
.field textarea { min-height: 112px; resize: vertical; }
.field small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.portrait-upload { grid-template-columns: 118px 1fr; align-items: center; border: 1px dashed #b9c9d6; border-radius: 16px; padding: 13px; background: #f7fafc; }
.portrait-preview { width: 96px; aspect-ratio: 3/4; overflow: hidden; border: 4px solid #fff; border-radius: 15px; color: #fff; background: linear-gradient(145deg,var(--petrol),var(--violet)); box-shadow: 0 8px 22px rgba(7,43,70,.16); }
.portrait-preview img { width: 100%; height: 100%; object-fit: cover; }
.portrait-upload input[type="file"] { min-height: auto; border: 0; padding: 8px 0; background: transparent; }
.campaign-card-heading { display: flex; align-items: center; gap: 12px; }
.campaign-card-heading .candidate-portrait { width: 58px; height: 74px; border-width: 3px; border-radius: 12px; font-size: .9rem; }
.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice-row label { display: flex; align-items: center; gap: 8px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: .75rem; font-weight: 750; }
.step-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; gap: 10px; margin: 22px -26px -26px; border-top: 1px solid var(--line); padding: 14px 26px calc(14px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.step-actions > div { display: flex; gap: 8px; }
.completed-banner { border-radius: 14px; padding: 13px 15px; color: #245d3e; background: #e6f6ed; font-size: .78rem; font-weight: 800; }

.notification-panel { position: fixed; z-index: 80; top: 72px; right: 14px; width: min(390px,calc(100% - 28px)); max-height: calc(100vh - 90px); overflow: auto; border: 1px solid var(--line); border-radius: 18px; padding: 15px; background: #fff; box-shadow: 0 22px 62px rgba(7,43,70,.2); }
.notification-panel[hidden] { display: none; }
.notification-panel header { display: flex; justify-content: space-between; align-items: center; }
.notification-panel h2 { margin: 0; font-size: 1rem; }
.notification-panel ul { display: grid; gap: 8px; margin: 13px 0 0; padding: 0; list-style: none; }
.notification-panel li { border-radius: 12px; padding: 11px; color: var(--muted); background: #f2f6f8; font-size: .75rem; line-height: 1.45; }
.toast { position: fixed; z-index: 100; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); max-width: min(380px,calc(100% - 36px)); border-radius: 14px; padding: 13px 16px; color: #fff; background: var(--petrol); box-shadow: 0 18px 45px rgba(7,43,70,.24); }

@media (max-width: 1180px) {
  :root { --sidebar: 232px; }
  .launcher-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-visual { min-height: 430px; }
  .topbar { grid-template-columns: auto auto minmax(0,1fr) auto; padding-inline: 12px; }
  .topbar .brand span { display: none; }
  .menu-button { display: inline-grid; place-items: center; }
  .scope-switchers { justify-self: stretch; }
  .scope-switchers label { min-width: 0; flex: 1; }
  .scope-switchers select { width: 100%; min-width: 0; }
  .logout-button { display: none; }
  .shell-grid { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 70; top: 0; left: 0; width: min(86vw,320px); height: 100vh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 25px 0 70px rgba(7,43,70,.25); }
  .sidebar.open { transform: none; }
  .mobile-logout { display: block; }
  .sidebar-scrim { position: fixed; z-index: 60; inset: 0; background: rgba(5,26,45,.52); }
  .sidebar-scrim[hidden] { display: none; }
  .launcher-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .journey-layout { grid-template-columns: 1fr; }
  .journey-rail { position: static; }
  .step-list { display: flex; overflow-x: auto; padding-bottom: 5px; scroll-snap-type: x mandatory; }
  .step-list li { flex: 0 0 190px; scroll-snap-align: start; }
  .mobile-role-nav { display: flex; overflow-x: auto; gap: 8px; margin-bottom: 14px; padding-bottom: 4px; }
  .mobile-role-nav a { flex: 0 0 auto; min-height: 42px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 99px; padding: 0 13px; color: var(--petrol); text-decoration: none; background: #fff; font-size: .72rem; font-weight: 800; }
  .mobile-role-nav a[aria-current="page"] { color: #fff; background: var(--petrol); }
}

@media (max-width: 600px) {
  .login-visual { min-height: 380px; padding: 26px 20px; }
  .login-copy h1 { font-size: 2.6rem; }
  .login-panel { padding: 34px 20px; }
  .topbar { grid-template-columns: auto auto minmax(0,1fr) auto; gap: 8px; }
  .brand img { width: 40px; height: 40px; }
  .scope-switchers label:first-child { display: none; }
  .icon-button { min-width: 40px; }
  .main-content { padding: 15px 13px 90px; }
  .page-hero { grid-template-columns: 1fr auto; gap: 12px; padding: 21px; }
  .page-hero h1 { font-size: 2rem; }
  .candidate-portrait { width: 64px; height: 80px; border-width: 3px; border-radius: 14px; font-size: 1rem; }
  .metric-grid { gap: 9px; }
  .metric { min-height: 100px; padding: 15px; }
  .launcher-grid { grid-template-columns: 1fr; }
  .launcher { min-height: 146px; }
  .form-grid { grid-template-columns: 1fr; }
  .portrait-upload { grid-template-columns: 82px 1fr; }
  .portrait-preview { width: 70px; }
  .field.full { grid-column: auto; }
  .section-card { border-radius: 18px; padding: 17px; }
  .section-card > header { display: grid; }
  .record-card header { display: grid; }
  .step-actions { margin: 18px -17px -17px; padding-inline: 17px; }
  .step-actions .secondary-button span { display: none; }
  .breadcrumbs { margin-bottom: 12px; }
}

@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr; }
  .page-hero { grid-template-columns: 1fr; }
  .candidate-portrait { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.field-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; align-items: end; }
.field-action .secondary-button { min-height: 44px; white-space: nowrap; }
.map-empty { display: grid; min-height: 220px; place-items: center; padding: 1.25rem; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); background: #f7fafb; text-align: center; }
.map-frame { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #f7fafb; }
.map-frame iframe { display: block; width: 100%; min-height: 300px; border: 0; }
.map-frame span { display: block; padding: .65rem .85rem; color: var(--muted); font-size: .82rem; }
.map-frame a { color: var(--cobalt); font-weight: 800; }
.map-viewport { position: relative; }
.map-radius { position: absolute; top: 50%; left: 50%; width: min(42vw,170px); aspect-ratio: 1; transform: translate(-50%,-50%); border: 3px solid rgba(20,92,255,.72); border-radius: 50%; padding: 0 !important; background: rgba(20,92,255,.12); box-shadow: 0 0 0 1px rgba(255,255,255,.8); pointer-events: none; }

/* Specialized modules */
.scope-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; margin: -10px 0 14px; border-left: 4px solid var(--cobalt); border-radius: 0 12px 12px 0; padding: 10px 14px; color: #40566a; background: #f1f7ff; font-size: .73rem; }
.scope-banner strong { color: var(--petrol); }
.scope-banner em { width: 100%; color: #7b5600; font-style: normal; }
.page-tabs { display: flex; overflow-x: auto; gap: 7px; margin: 0 0 20px; padding: 3px 1px 7px; scrollbar-width: thin; }
.page-tabs a { flex: 0 0 auto; min-height: 38px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 99px; padding: 0 12px; color: #40566a; text-decoration: none; background: #fff; font-size: .68rem; font-weight: 800; }
.page-tabs a[aria-current="page"] { border-color: var(--cobalt); color: #fff; background: var(--cobalt); }
.chip.success { color: #235b3d; background: #e2f5e9; }
.callout { display: grid; gap: 4px; margin-bottom: 18px; border: 1px solid #c4d9eb; border-left: 5px solid var(--cobalt); border-radius: 14px; padding: 14px 16px; color: #40566a; background: #f3f8fc; font-size: .78rem; }
.callout.warning { border-color: #efd99e; border-left-color: var(--amber); background: #fff9e9; }
.callout.critical { border-color: #efb2c2; border-left-color: var(--magenta); color: #77223d; background: #fff2f6; }
.callout strong { color: var(--ink); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(155px,1fr)); gap: 8px; margin: 14px 0; }
.detail-grid > div { min-width: 0; border-radius: 12px; padding: 10px 11px; background: #f4f7f9; }
.detail-grid dt { color: var(--muted); font-size: .62rem; font-weight: 850; text-transform: uppercase; }
.detail-grid dd { margin: 4px 0 0; overflow-wrap: anywhere; color: var(--ink); font-size: .76rem; line-height: 1.45; white-space: pre-wrap; }
.entity-table { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; }
.entity-table table { width: 100%; border-collapse: collapse; font-size: .74rem; }
.entity-table th { color: #40566a; background: #eff4f7; text-align: left; font-size: .64rem; text-transform: uppercase; }
.entity-table th, .entity-table td { min-width: 110px; border-bottom: 1px solid var(--line); padding: 11px 12px; vertical-align: top; }
.entity-table tbody tr:last-child td { border-bottom: 0; }
.compact-list, .document-list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.compact-list li, .document-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; }
.compact-list strong, .compact-list span, .document-list strong, .document-list span, .document-list code { display: block; }
.compact-list span, .document-list span { margin-top: 3px; color: var(--muted); font-size: .69rem; }
.document-list code { max-width: 55vw; overflow: hidden; color: #50687c; font-size: .6rem; text-overflow: ellipsis; }
.record-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 13px; }
.split-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.split-actions > form { align-content: start; border: 1px solid var(--line); border-radius: 15px; padding: 15px; }
.dossier-list { display: grid; gap: 16px; }
.dossier-card { border: 1px solid var(--line); border-left: 6px solid var(--cobalt); border-radius: 19px; padding: clamp(15px,2.5vw,22px); background: #fff; box-shadow: 0 10px 28px rgba(8,48,76,.05); }
.dossier-card[data-status="returned"] { border-left-color: var(--magenta); }
.dossier-card[data-status="approved"] { border-left-color: var(--lime); }
.dossier-card > header { display: flex; justify-content: space-between; gap: 15px; }
.dossier-card h3 { margin: 4px 0; }
.dossier-card header p { margin: 4px 0 0; color: var(--muted); }
.dossier-card > progress { width: 100%; height: 10px; margin: 14px 0; accent-color: var(--lime); }
.dossier-state { display: grid; justify-items: end; gap: 7px; }
.dossier-state > strong { color: var(--petrol); font-size: 1.5rem; }
.dossier-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin-bottom: 14px; }
.dossier-summary span { border-radius: 11px; padding: 9px 10px; color: var(--muted); background: #f3f7f9; font-size: .69rem; }
.dossier-details { margin-top: 12px; border: 1px solid var(--line); border-radius: 13px; padding: 12px; }
.dossier-details summary { cursor: pointer; color: var(--petrol); font-size: .77rem; font-weight: 850; }
.review-step-list { display: grid; gap: 9px; margin: 13px 0 0; padding: 0; list-style: none; }
.review-step-list > li { border-left: 4px solid #bdcad4; border-radius: 10px; padding: 10px 12px; background: #f7f9fa; }
.review-step-list > li[data-status="completed"] { border-left-color: var(--lime); }
.review-step-list > li[data-status="needs_attention"] { border-left-color: var(--magenta); }
.review-step-list > li > div:first-child { display: flex; justify-content: space-between; gap: 10px; }
.review-step-list > li span { color: var(--muted); font-size: .66rem; }
.review-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 15px; }
.review-actions form, .professional-review { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #f9fbfc; }
.review-actions h4, .professional-review h4 { grid-column: 1/-1; margin: 0; }
.professional-review { margin-top: 15px; }
.finance-total { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin-top: 14px; }
.finance-total span { display: grid; gap: 4px; border-radius: 12px; padding: 12px; color: var(--muted); background: #eef4f7; font-size: .7rem; }
.finance-total strong { color: var(--petrol); font-size: .95rem; }
.audit-timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.audit-timeline > li { position: relative; display: grid; grid-template-columns: 26px minmax(0,1fr); gap: 10px; padding-bottom: 16px; }
.audit-timeline > li::before { content: ""; position: absolute; top: 18px; bottom: -3px; left: 8px; width: 2px; background: var(--line); }
.audit-timeline > li:last-child::before { display: none; }
.audit-marker { z-index: 1; width: 18px; height: 18px; border: 4px solid #dce9f4; border-radius: 50%; background: var(--cobalt); }
.audit-timeline article { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 13px; }
.audit-timeline article > header { display: flex; justify-content: space-between; gap: 12px; }
.audit-timeline article header strong, .audit-timeline article header span { display: block; }
.audit-timeline article header span { margin-top: 3px; color: var(--muted); font-size: .67rem; }
.audit-timeline article p { color: var(--muted); font-size: .69rem; }
.audit-timeline code { overflow-wrap: anywhere; }
.management-panel { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.management-panel > summary { cursor: pointer; color: var(--cobalt); font-weight: 850; }
.compact-form { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.document-gallery { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 13px; margin: 14px 0; }
.document-tile { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; }
.document-tile > strong, .document-tile > small, .document-tile > code { display: block; margin-top: 7px; overflow-wrap: anywhere; }
.document-tile > small { color: var(--muted); font-size: .68rem; }
.document-tile > code { max-height: 38px; overflow: hidden; color: #526c79; font-size: .58rem; }
.document-preview { display: grid; height: 145px; place-items: center; overflow: hidden; border-radius: 10px; color: var(--petrol); background: #edf4f6; font-size: 1.25rem; font-weight: 900; }
.document-preview img { width: 100%; height: 100%; object-fit: cover; }
.notification-item { display: grid; gap: 5px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.notification-item[data-read="true"] { opacity: .72; }
.notification-item span, .notification-item small { color: var(--muted); font-size: .72rem; }
.integration-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.integration-status .warning-text { flex-basis: 100%; color: #704900; line-height: 1.45; }
.sampling-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 10px; }
.compliance-package { border: 1px solid var(--line); border-left: 5px solid var(--lime); border-radius: 14px; padding: 18px; background: #f6fbf7; }
@media (max-width: 520px) {
  .field-action { grid-template-columns: 1fr; }
  .map-frame iframe { min-height: 250px; }
  .split-actions, .review-actions, .professional-review { grid-template-columns: 1fr; }
  .dossier-card > header, .review-step-list > li > div:first-child { display: grid; }
  .dossier-state { justify-items: start; }
  .dossier-summary, .finance-total { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (prefers-contrast: more) {
  :root { --line: #8293a2; --muted: #3f5060; }
  .launcher, .section-card, .record-card { box-shadow: none; }
}

@media print {
  .topbar, .sidebar, .mobile-role-nav, .breadcrumbs, .toolbar, .step-actions, .toast { display: none !important; }
  .shell-grid { display: block; }
  .main-content { padding: 0; }
  .page-hero, .section-card, .record-card { box-shadow: none; break-inside: avoid; }
}

/* Convite de profissional */
.invite-feedback { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }
.invite-feedback.error { color: var(--coral); }

/* Etapa que reconhece o que já foi anexado */
.hint-text { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }
.structured-step .compact-list { margin: 8px 0 0; padding-left: 18px; font-size: .84rem; color: var(--muted); }
.structured-step .compact-list li { margin-bottom: 3px; }
.structured-step .compact-list small { opacity: .8; }

/* Aviso ao lado do texto padrão da justificativa retroativa. */
.field-hint { display: block; margin-top: 5px; color: #5b707c; font-size: 10px; }

/* Duas portas para o mesmo lugar: senha para quem já tem conta, código por
   e-mail para quem foi convidado e ainda não tem senha nenhuma. */
.login-modes { display: flex; gap: 6px; margin: 0 0 16px; padding: 4px; border-radius: 10px; background: #eef3f6; }
.login-mode { flex: 1; border: 0; border-radius: 7px; padding: 9px 10px; background: transparent; color: #4a626f; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.login-mode.is-active { background: #fff; color: #063f5c; box-shadow: 0 1px 3px #0b2d4126; }
.code-hint { margin: 0 0 12px; font-size: 12px; line-height: 1.5; }
.link-button { margin-top: 8px; border: 0; padding: 0; background: none; color: #09577b; font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.link-button[disabled] { opacity: .5; cursor: progress; }
.form-note { margin: 10px 0 0; padding: 9px 11px; border-radius: 8px; background: #e7f4ea; color: #245c31; font-size: 12px; }
.setup-title { margin: 4px 0 8px; font-size: 22px; }
#password-setup label { display: block; margin-top: 12px; }
#password-setup input { width: 100%; }

/* Trocar a própria senha, ao lado do nome de quem está logado. */
.profile-password { margin-top: 5px; padding: 0; border: 0; background: none; color: #1266d9; font: inherit; font-size: 11px; text-decoration: underline; cursor: pointer; }
.profile-password:hover { color: #0a4a9e; }
/* Remover evidência na lista da etapa da jornada. */
.evidence-drop { margin-left: 6px; border: 0; padding: 0; background: none; color: #9f2417; font: inherit; font-size: 10px; text-decoration: underline; cursor: pointer; }
.evidence-drop[disabled] { opacity: .6; cursor: progress; }
