:root {
  --page: #f3f7f5;
  --sidebar: #fbfcfd;
  --surface: #ffffff;
  --surface-muted: #f7faf9;
  --text: #17324d;
  --muted: #536772;
  --border: #cbd9df;
  --border-strong: #aebfc7;
  --primary: #245d78;
  --primary-hover: #194b64;
  --primary-soft: #dceef6;
  --green: #2e654c;
  --green-soft: #e5f2e9;
  --yellow: #735609;
  --yellow-soft: #fff3c9;
  --coral: #87423d;
  --coral-soft: #f8dcd9;
  --red: #913a3a;
  --red-soft: #f9dddd;
  --shadow: 0 10px 24px rgba(31, 59, 69, 0.08);
  --radius: 8px;
  --sidebar-width: 248px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--page);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--page); color: var(--text); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: 0; }
h1 { font-size: 24px; line-height: 1.2; margin-bottom: 0; }
h2 { font-size: 18px; line-height: 1.25; margin-bottom: 0; }
h3 { font-size: 14px; line-height: 1.3; margin-bottom: 0; }
p { color: var(--muted); line-height: 1.5; }
svg { width: 18px; height: 18px; stroke-width: 2; flex: 0 0 auto; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 6px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 19px;
  font-weight: 800;
}
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 19px; }
.brand small { color: var(--muted); font-size: 12px; }

.main-nav { display: grid; gap: 6px; margin-top: 34px; }
.nav-button {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.nav-button.module-link { margin-top: 10px; border-top-color: var(--border); }
.nav-button:hover { background: var(--surface-muted); border-color: var(--border); }
.nav-button.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.institution-summary {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 18px 7px 0;
  display: grid;
  gap: 5px;
}
.institution-summary span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 700; }
.institution-summary strong { font-size: 13px; line-height: 1.35; }
.institution-summary small { color: var(--muted); font-size: 11px; }

.application { min-width: 0; }
.review-banner {
  min-height: 38px;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--yellow-soft);
  color: var(--yellow);
  border-bottom: 1px solid #e4cd79;
  font-size: 13px;
  font-weight: 700;
}
.review-banner svg { width: 16px; height: 16px; }
.topbar {
  min-height: 84px;
  padding: 17px clamp(20px, 3vw, 38px);
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}
.topbar-heading { min-width: 0; }
.eyebrow { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.save-state { min-width: 110px; text-align: right; color: var(--muted); font-size: 12px; }
.session-menu { position: relative; }
.session-trigger {
  min-height: 42px;
  max-width: 250px;
  padding: 4px 8px 4px 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.session-trigger:hover { border-color: var(--primary); background: var(--surface-muted); }
.session-avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 800; }
.session-copy { min-width: 0; display: grid; gap: 1px; }
.session-copy strong, .session-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-copy strong { font-size: 11px; }
.session-copy small { color: var(--muted); font-size: 9px; }
.session-trigger > svg { width: 14px; height: 14px; color: var(--muted); }
.session-popover { position: absolute; top: calc(100% + 7px); right: 0; z-index: 60; width: 220px; padding: 6px; display: grid; gap: 3px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.session-popover a, .session-popover button { min-height: 38px; padding: 8px 9px; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 5px; background: transparent; color: var(--text); text-decoration: none; cursor: pointer; font-size: 11px; font-weight: 700; text-align: left; }
.session-popover a:hover, .session-popover button:hover { background: var(--surface-muted); color: var(--primary); }
.session-popover svg { width: 16px; height: 16px; }

.main-content { padding: 26px clamp(20px, 3vw, 38px) 40px; }
.view { display: none; }
.view.active { display: block; }

.button, .icon-button {
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: 38px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.button { padding: 8px 14px; font-size: 13px; }
.button.primary { background: var(--primary); color: #ffffff; border-color: var(--primary); }
.button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button.secondary { background: var(--surface); border-color: var(--border-strong); color: var(--primary); }
.button.secondary:hover { background: var(--primary-soft); border-color: var(--primary); }
.button.danger { background: var(--surface); border-color: #d7a9a9; color: var(--red); }
.button.danger:hover { background: var(--red-soft); }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button.full { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.icon-button { width: 38px; padding: 0; background: var(--surface); border-color: var(--border); }
.icon-button:hover { background: var(--primary-soft); }
.icon-button.small { width: 32px; min-height: 32px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card {
  min-height: 116px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 10px;
  box-shadow: var(--shadow);
}
.metric-card .metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; font-size: 28px; margin-top: 10px; }
.metric-icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.metric-card.green .metric-icon { background: var(--green-soft); color: var(--green); }
.metric-card.yellow .metric-icon { background: var(--yellow-soft); color: var(--yellow); }
.metric-card.coral .metric-icon { background: var(--coral-soft); color: var(--coral); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr); gap: 18px; align-items: start; }
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading p { margin: 4px 0 0; font-size: 12px; }
.case-list { display: grid; }
.case-row {
  min-height: 70px;
  padding: 12px 4px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.45fr) auto;
  align-items: center;
  gap: 16px;
}
.case-row:first-child { border-top: 0; }
.case-row button { justify-self: end; }
.case-primary { min-width: 0; }
.case-primary strong { display: block; overflow-wrap: anywhere; }
.case-primary span, .case-meta span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.deadline-overview { min-height: 260px; }
.deadline-item { padding: 11px 0; border-top: 1px solid var(--border); display: grid; gap: 4px; }
.deadline-item:first-child { border-top: 0; }
.deadline-item strong { font-size: 13px; }
.deadline-item span { color: var(--muted); font-size: 12px; }
.deadline-date { color: var(--primary) !important; font-weight: 700; }

.list-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.search-field { flex: 1 1 420px; position: relative; }
.search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; }
.search-field input { padding-left: 38px; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}
textarea { min-height: 108px; resize: vertical; line-height: 1.45; }
textarea.guided-textarea { min-height: 142px; }
input::placeholder, textarea::placeholder {
  color: #66777f;
  font-style: italic;
  font-weight: 400;
  opacity: 1;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36, 93, 120, 0.14); }
input[readonly] { background: var(--surface-muted); color: var(--muted); }
select[multiple] { min-height: 104px; padding: 6px; }
select[multiple] option { padding: 7px 8px; border-radius: 4px; }
label { display: grid; gap: 6px; color: var(--text); font-size: 12px; font-weight: 700; }
.field-help { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.4; }
.field-error { color: var(--red); font-size: 11px; font-weight: 600; }
.invalid { border-color: var(--red) !important; }

.list-surface { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { background: var(--surface-muted); color: var(--muted); font-size: 11px; text-transform: uppercase; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f9fbfb; }
.data-table td.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.data-table th:nth-child(1) { width: 17%; }
.data-table th:nth-child(2) { width: 24%; }
.data-table th:nth-child(3) { width: 10%; }
.data-table th:nth-child(4) { width: 17%; }
.data-table th:nth-child(5) { width: 23%; }
.data-table th:nth-child(6) { width: 9%; }
.empty-state { min-height: 260px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); }
.empty-state svg { width: 34px; height: 34px; }

.workspace-view.active { display: block; }
.case-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 0 0 18px;
}
.case-header-tools { display: flex; align-items: flex-end; gap: 12px; }
.case-header-tools .case-progress-block { flex: 0 0 220px; }
.workspace-locked { margin: 0 0 14px; padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid #b8d8c6; border-left: 5px solid var(--green); border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 12px; line-height: 1.45; }
.workspace-locked svg { width: 17px; height: 17px; margin-top: 1px; }
.control-dialog { width: min(880px, calc(100vw - 28px)); }
.control-dialog-shell { padding: 22px; display: grid; gap: 16px; }
.control-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); }
.control-summary-copy strong, .control-summary-copy span { display: block; }
.control-summary-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.control-summary-copy .control-policy-note { color: var(--yellow); font-weight: 700; }
.control-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.control-section { padding-top: 14px; border-top: 1px solid var(--border); }
.control-section h3 { margin-bottom: 10px; }
.control-list { display: grid; gap: 7px; }
.control-row { min-height: 48px; padding: 9px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.control-row strong, .control-row span { display: block; }
.control-row span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.control-empty { padding: 14px; border: 1px dashed var(--border-strong); border-radius: 6px; color: var(--muted); font-size: 11px; }
.case-code-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.case-header h2 { font-size: 22px; }
.case-header p { margin: 4px 0 0; font-size: 13px; }
.case-progress-block { width: min(300px, 35%); display: grid; gap: 7px; }
.case-progress-block > span { color: var(--muted); font-size: 12px; text-align: right; }
.progress-track { height: 7px; border-radius: 4px; background: #dfe8e5; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--green); border-radius: 4px; transition: width 180ms ease; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; border-radius: 12px; padding: 4px 9px; font-size: 11px; font-weight: 800; }
.status-pill.in-progress { background: var(--primary-soft); color: var(--primary); }
.status-pill.complete { background: var(--green-soft); color: var(--green); }
.status-pill.warning { background: var(--yellow-soft); color: var(--yellow); }
.status-pill.danger { background: var(--red-soft); color: var(--red); }

.workspace-grid {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 286px;
  gap: 16px;
  align-items: start;
}
.stage-nav, .stage-surface, .context-rail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stage-nav { padding: 9px; position: sticky; top: 103px; display: grid; gap: 3px; }
.stage-button {
  min-height: 44px;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  text-align: left;
}
.stage-button:hover { background: var(--surface-muted); }
.stage-button.active { background: var(--primary-soft); color: var(--primary); }
.stage-number { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.stage-button.complete .stage-number { background: var(--green); border-color: var(--green); color: #ffffff; }
.stage-button.active .stage-number { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.stage-name { min-width: 0; font-size: 12px; line-height: 1.25; font-weight: 700; }
.stage-state { width: 15px; height: 15px; color: var(--muted); }
.stage-button.skipped { opacity: 0.58; }
.stage-surface { min-height: 620px; padding: 22px; }
.stage-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 15px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.stage-validation { font-size: 11px; color: var(--muted); text-align: right; }
.context-rail { position: sticky; top: 103px; overflow: hidden; }
.context-section { padding: 15px; border-top: 1px solid var(--border); }
.context-section:first-child { border-top: 0; }
.context-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.context-title svg { width: 16px; color: var(--primary); }
.context-section p { font-size: 12px; margin: 0; }
.context-empty { color: var(--muted); font-size: 12px; line-height: 1.45; }
.context-list { display: grid; gap: 8px; }
.context-list-item { padding-left: 12px; border-left: 3px solid var(--border); font-size: 12px; line-height: 1.4; color: var(--muted); }
.context-list-item.warn { border-left-color: #b18a1e; color: var(--yellow); }
.context-list-item.ok { border-left-color: var(--green); color: var(--green); }
.document-action { display: grid; gap: 7px; padding: 9px 0; border-top: 1px solid var(--border); }
.document-action:first-child { border-top: 0; padding-top: 0; }
.document-action strong { font-size: 12px; }
.document-action .button { width: 100%; }
.document-action-note { color: var(--muted); font-size: 11px; line-height: 1.4; }
.document-action-status { padding-left: 9px; border-left: 3px solid var(--border); font-size: 11px; line-height: 1.4; }
.document-action-status.ready { border-left-color: var(--green); color: var(--green); }
.document-action-status.pending { border-left-color: #b18a1e; color: var(--yellow); }
.context-list-item.context-link {
  width: 100%;
  border: 0;
  border-left: 3px solid #b18a1e;
  border-radius: 0;
  background: transparent;
  padding: 0 0 0 12px;
  color: var(--yellow);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.context-list-item.context-link:hover { text-decoration: underline; }

.workspace-actions {
  position: sticky;
  bottom: 0;
  z-index: 15;
  margin-top: 16px;
  min-height: 66px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 -8px 24px rgba(31, 59, 69, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(8px);
}
.workspace-actions-right { display: flex; gap: 9px; }

.form-section { padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.form-section-heading { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.form-section-heading h3 { font-size: 15px; }
.form-section-heading p { margin: 4px 0 0; font-size: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid .span-2 { grid-column: span 2; }
.field-grid .span-all { grid-column: 1 / -1; }
.field-grid .compact-field { align-self: start; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.check-option {
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: var(--surface-muted);
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
}
.check-option:hover { border-color: var(--primary); }
.check-option input { width: 17px; min-height: 17px; height: 17px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--primary); }
.radio-row { display: flex; flex-wrap: wrap; gap: 9px; }
.radio-option { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); cursor: pointer; }
.radio-option input { width: 16px; height: 16px; min-height: 16px; accent-color: var(--primary); }

.info-callout { border-left: 4px solid var(--primary); background: var(--primary-soft); padding: 12px 14px; border-radius: 0 6px 6px 0; color: var(--text); font-size: 12px; line-height: 1.5; margin-bottom: 14px; }
.info-callout.warning { border-left-color: #b18a1e; background: var(--yellow-soft); color: var(--yellow); }
.info-callout.success { border-left-color: var(--green); background: var(--green-soft); color: var(--green); }
.info-callout.danger { border-left-color: var(--red); background: var(--red-soft); color: var(--red); }

.repeat-list { display: grid; gap: 10px; }
.repeat-item { border: 1px solid var(--border); border-radius: 7px; padding: 13px; background: var(--surface-muted); }
.repeat-item.compact { padding: 11px; }
.repeat-item.record-incomplete { border-left: 4px solid #b18a1e; }
.repeat-item-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.repeat-item-header strong { font-size: 13px; overflow-wrap: anywhere; }
.repeat-item-header span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.repeat-item-actions { display: flex; gap: 6px; }
.subsection-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.subsection-heading strong { display: block; font-size: 13px; }
.subsection-heading span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.nested-record {
  position: relative;
  padding: 11px 48px 11px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
}
.nested-record > .remove-companion { position: absolute; top: 10px; right: 10px; }
.conditional-fields { margin-top: 12px; }
.candidate-origin { padding: 8px 10px; border-left: 3px solid var(--yellow); background: var(--yellow-soft); color: var(--yellow) !important; }
.candidate-list { display: grid; gap: 10px; }
.candidate {
  border: 1px solid var(--border-strong);
  border-left: 5px solid var(--primary);
  border-radius: 6px;
  padding: 13px;
  background: #ffffff;
}
.candidate.grave { border-left-color: #a07a15; }
.candidate.muy_grave { border-left-color: var(--coral); }
.candidate.gravisima { border-left-color: var(--red); }
.candidate-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.candidate-header strong { font-size: 13px; }
.candidate p { margin: 0 0 10px; font-size: 12px; color: var(--text); }
.candidate-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.meta-chip { display: inline-flex; padding: 4px 7px; border-radius: 4px; background: var(--surface-muted); color: var(--muted); font-size: 11px; font-weight: 700; }
.candidate-controls { margin-top: 11px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.candidate-controls .span-all { grid-column: 1 / -1; }
.identity-card-assistant { display: grid; gap: 18px; margin-top: 18px; }
.screening-details > summary { cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 800; }
.screening-details.general-mode > summary { display: none; }
.screening-details.identity-mode > summary { padding: 11px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); }
.screening-details.identity-mode[open] > summary { border-color: var(--primary); background: var(--primary-soft); }
.screening-details-body { padding-top: 14px; }
.screening-details.general-mode .screening-details-body { padding-top: 0; }
.identity-branch { display: grid; gap: 12px; padding-top: 2px; }
.identity-branch .field-grid { grid-template-columns: minmax(0, 1fr); }
.identity-branch .field-grid .span-2,
.identity-branch .field-grid .span-all { grid-column: 1; }
.identity-evidence-block { display: grid; gap: 10px; padding-top: 2px; }
.identity-card-result { min-width: 0; }
.identity-analysis {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border-strong);
  border-left: 5px solid var(--primary);
  border-radius: 6px;
  padding: 15px;
  background: #ffffff;
}
.identity-analysis.direct { border-left-color: var(--green); background: #fbfefc; }
.identity-analysis.review { border-left-color: #b18a1e; background: #fffdf7; }
.identity-analysis.investigate { border-left-color: var(--coral); background: #fffaf8; }
.identity-analysis.administrative { border-left-color: var(--primary); background: #fbfdff; }
.identity-analysis.insufficient { border-left-color: var(--muted); background: var(--surface-muted); }
.identity-analysis.incomplete { border-left-color: var(--border-strong); background: var(--surface-muted); }
.identity-analysis-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.identity-analysis-heading > div { display: grid; gap: 5px; min-width: 0; }
.identity-analysis-heading strong { font-size: 14px; overflow-wrap: anywhere; }
.identity-status { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.identity-finding { display: grid; gap: 9px; padding-top: 12px; border-top: 1px solid var(--border); }
.identity-finding-heading { display: grid; gap: 4px; }
.identity-finding-heading strong { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.identity-finding > p { margin: 0; color: var(--text); font-size: 12px; line-height: 1.55; }
.identity-rule-list { display: grid; gap: 8px; }
.identity-rule-list > div { padding: 10px 11px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-muted); color: var(--text); font-size: 11px; line-height: 1.5; }
.identity-analysis .info-callout { margin-bottom: 0; }
.identity-warning { padding-left: 10px; border-left: 3px solid #b18a1e; color: var(--yellow); font-size: 11px; line-height: 1.45; }
.identity-operational { display: grid; gap: 7px; padding-top: 12px; border-top: 1px solid var(--border); }
.identity-operational strong { font-size: 12px; }
.identity-operational ol { margin: 0; padding-left: 20px; color: var(--text); font-size: 11px; line-height: 1.55; }
.identity-actions { display: flex; justify-content: flex-end; padding-top: 2px; }
.normative-box { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); padding: 13px; color: var(--text); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.65fr); gap: 18px; align-items: start; }
.holiday-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 34px; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); align-items: center; }
.holiday-row:first-child { border-top: 0; }
.calendar-note { display: grid; gap: 10px; }
.rule-row { border-top: 1px solid var(--border); padding: 9px 0; display: grid; gap: 3px; }
.rule-row:first-child { border-top: 0; }
.rule-row strong { font-size: 12px; }
.rule-row span { font-size: 11px; color: var(--muted); }

.login-screen { min-height: 100vh; display: grid; place-items: center; background: var(--page); padding: 20px; }
.login-panel { width: min(410px, 100%); display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.brand-login { padding: 0 0 12px; border-bottom: 1px solid var(--border); }
.login-panel h1 { font-size: 21px; }
.form-error { min-height: 18px; color: var(--red); font-size: 12px; margin: 0; white-space: pre-line; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast { min-height: 48px; display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; background: var(--text); color: #ffffff; border-radius: 7px; box-shadow: 0 10px 28px rgba(0,0,0,0.2); font-size: 12px; line-height: 1.4; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
.toast svg { width: 16px; height: 16px; margin-top: 1px; }
.dialog { width: min(430px, calc(100vw - 28px)); border: 1px solid var(--border); border-radius: 8px; padding: 0; color: var(--text); box-shadow: 0 20px 55px rgba(20, 42, 52, 0.25); }
.dialog::backdrop { background: rgba(18, 35, 45, 0.42); }
.dialog form { padding: 24px; text-align: center; }
.dialog-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--yellow-soft); color: var(--yellow); display: grid; place-items: center; margin: 0 auto 12px; }
.dialog p { font-size: 13px; }
.dialog-actions { display: flex; justify-content: center; gap: 9px; margin-top: 18px; }
.dialog-actions.end { justify-content: flex-end; }
.evidence-dialog { width: min(610px, calc(100vw - 28px)); }
.evidence-dialog form { padding: 22px; text-align: left; display: grid; gap: 15px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.dialog-heading .eyebrow { margin-bottom: 3px; }
.file-picker {
  min-height: 116px;
  padding: 18px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed var(--primary);
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  cursor: pointer;
  text-align: center;
}
.file-picker:hover { background: #dceef3; }
.file-picker svg { width: 24px; height: 24px; }
.file-picker span { color: var(--muted); font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.file-picker input { position: absolute; width: 1px; height: 1px; min-height: 1px; opacity: 0; pointer-events: none; }
.privacy-note { margin: 0; display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.privacy-note svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--green); }

.evidence-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.evidence-summary .meta-chip { min-height: 28px; align-items: center; }
.evidence-list { display: grid; gap: 10px; }
.evidence-item {
  min-height: 126px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 13px;
  background: #ffffff;
}
.evidence-preview {
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--primary);
}
.evidence-preview img { width: 100%; height: 100%; object-fit: cover; }
.evidence-preview svg { width: 27px; height: 27px; }
.evidence-body { min-width: 0; display: grid; gap: 7px; }
.evidence-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.evidence-title strong { font-size: 13px; }
.evidence-description { margin: 0; color: var(--text); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.evidence-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 11px; }
.evidence-meta span { display: inline-flex; align-items: center; gap: 4px; }
.evidence-meta svg { width: 13px; height: 13px; }
.evidence-hash { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.evidence-actions { grid-column: 1 / -1; width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(98px, 1fr)); gap: 7px; padding-top: 2px; }
.evidence-actions .button { width: 100%; }
.evidence-valuation { margin-top: 2px; padding-top: 7px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; line-height: 1.4; }
.evidence-locked { display: flex; align-items: flex-start; gap: 10px; }
.evidence-locked svg { width: 18px; flex: 0 0 auto; margin-top: 1px; }

@media (max-width: 1380px) {
  .workspace-grid { grid-template-columns: 205px minmax(0, 1fr); }
  .context-rail { grid-column: 2; position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .context-section { border-top: 0; border-left: 1px solid var(--border); }
  .context-section:nth-child(odd) { border-left: 0; }
  .context-section:nth-child(n+3) { border-top: 1px solid var(--border); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .mobile-only { display: inline-flex !important; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(286px, 86vw);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: 12px 0 30px rgba(20, 42, 52, 0.18);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(20, 42, 52, 0.38); }
  .topbar { min-height: 72px; padding: 12px 16px; }
  .topbar .button.primary span { display: none; }
  .topbar .button.primary { width: 38px; padding: 0; }
  .save-state { display: none; }
  .main-content { padding: 18px 14px 30px; }
  .dashboard-grid, .calendar-layout { grid-template-columns: 1fr; }
  .workspace-grid { display: block; }
  .stage-nav {
    position: static;
    display: flex;
    overflow-x: auto;
    gap: 6px;
    margin-bottom: 12px;
    scrollbar-width: thin;
  }
  .stage-button { flex: 0 0 158px; }
  .stage-surface { min-height: 500px; padding: 17px; }
  .context-rail { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-header { align-items: flex-end; }
  .case-progress-block { width: 220px; }
  .field-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-table { min-width: 780px; }
}

@media (max-width: 620px) {
  h1 { font-size: 20px; }
  .review-banner { align-items: flex-start; justify-content: flex-start; padding: 9px 13px; font-size: 11px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 94px; }
  .case-row { grid-template-columns: minmax(0, 1fr) auto; }
  .case-meta { display: none; }
  .list-toolbar { align-items: stretch; flex-direction: column; }
  .search-field { flex-basis: auto; }
  .case-header { display: block; }
  .case-header-tools { margin-top: 14px; align-items: stretch; flex-direction: column; }
  .case-header-tools .case-progress-block { width: 100%; flex-basis: auto; margin-top: 0; }
  .case-header-tools .button { width: 100%; }
  .control-row { grid-template-columns: 1fr; }
  .case-header h2 { font-size: 19px; overflow-wrap: anywhere; }
  .case-progress-block { width: 100%; margin-top: 15px; }
  .case-progress-block > span { text-align: left; }
  .stage-heading { display: block; }
  .stage-validation { display: block; text-align: left; margin-top: 7px; }
  .field-grid, .field-grid.three, .checkbox-grid { grid-template-columns: 1fr; }
  .field-grid .span-2 { grid-column: auto; }
  .candidate-controls { grid-template-columns: 1fr; }
  .candidate-controls .span-all { grid-column: auto; }
  .identity-analysis-heading { align-items: stretch; flex-direction: column; }
  .identity-actions, .identity-actions .button { width: 100%; }
  .subsection-heading { align-items: stretch; flex-direction: column; }
  .subsection-heading .button { width: 100%; }
  .nested-record { padding-right: 44px; }
  .context-rail { grid-template-columns: 1fr; }
  .context-section, .context-section:nth-child(odd) { border-left: 0; border-top: 1px solid var(--border); }
  .context-section:first-child { border-top: 0; }
  .workspace-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    padding: 9px;
  }
  .workspace-actions > .button { width: 100%; }
  .workspace-actions-right { display: contents; }
  .holiday-row { grid-template-columns: 1fr 34px; }
  .holiday-row input[type="date"] { grid-column: 1; }
  .holiday-row input[type="text"] { grid-column: 1; }
  .holiday-row button { grid-column: 2; grid-row: 1 / 3; }
  .topbar-heading .eyebrow { display: none; }
  .topbar-actions { margin-left: auto; }
  .session-copy, .session-trigger > svg { display: none; }
  .session-trigger { width: 42px; padding: 4px; justify-content: center; }
  .session-popover { position: fixed; top: 72px; right: 12px; width: min(240px, calc(100vw - 24px)); }
  .surface { padding: 16px; }
  .evidence-item { grid-template-columns: 58px minmax(0, 1fr); align-items: start; }
  .evidence-preview { width: 58px; height: 58px; }
  .evidence-actions { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
  .evidence-actions .button { min-width: 0; padding-inline: 8px; }
  .evidence-dialog form { padding: 17px; }
  .evidence-dialog .field-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .review-banner, .workspace-actions, .context-rail, .stage-nav { display: none !important; }
  .app-shell { display: block; }
  .main-content { padding: 0; }
  .stage-surface, .surface { border: 0; box-shadow: none; padding: 0; }
}
