:root {
  --navy: #0b2241;
  --navy-mid: #132d52;
  --navy-hover: #1a3b69;
  --crimson: #c41230;
  --crimson-hover: #9f0e27;
  --canvas: #f4f6fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #526277;
  --success-bg: #dcfce7;
  --success-fg: #166534;
  --warning-bg: #fef3c7;
  --warning-fg: #92400e;
  --high-bg: #ffedd5;
  --high-fg: #9a3412;
  --danger-bg: #fee2e2;
  --danger-fg: #991b1b;
  --info-bg: #e0f2fe;
  --info-fg: #075985;
  --restricted-bg: #f3e8ff;
  --restricted-fg: #6b21a8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 3px rgba(11, 34, 65, 0.05), 0 4px 16px rgba(11, 34, 65, 0.035);
  --shadow-elevated: 0 18px 48px rgba(7, 17, 34, 0.28);
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  background: var(--navy);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  left: 12px;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--navy);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 2px;
}

.nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.nav-item.active {
  background: var(--crimson);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(196, 18, 48, 0.35);
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.sidebar-footer {
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.license-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.license-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.license-role {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 2px;
}

.sidebar-meta {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 34, 65, 0.5);
  z-index: 35;
}

/* Workspace Column */
.workspace-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 25;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
}

.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 6px 4px 12px;
  width: 100%;
  max-width: 440px;
}

.search-icon {
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.global-search input {
  border: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.role-select {
  background: var(--canvas);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  max-width: 220px;
  cursor: pointer;
}

.welcome-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
}
.welcome-link:hover {
  background: var(--canvas);
  color: var(--navy);
}

.role-tip-banner {
  background: var(--navy-mid);
  color: #ffffff;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.role-tip-banner[hidden] {
  display: none;
}

.tip-dismiss-btn {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tip-dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.toast-region {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  background: var(--navy);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-elevated);
  font-size: 13.5px;
  border-left: 4px solid #38bdf8;
}
.toast.toast-error {
  border-left-color: #f87171;
}
.toast.toast-success {
  border-left-color: #4ade80;
}

/* Main Content */
.main-content {
  padding: 28px 32px 48px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy);
  line-height: 1.2;
}

.page-subtitle {
  margin: 6px 0 0;
  font-size: 14.5px;
  color: var(--ink-secondary);
  max-width: 720px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-primary {
  background: var(--crimson);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--crimson-hover);
}

.btn-navy {
  background: var(--navy);
  color: #ffffff;
}
.btn-navy:hover {
  background: var(--navy-hover);
}

.btn-secondary {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--canvas);
}

.btn-outline-navy {
  background: #ffffff;
  color: var(--navy);
  border-color: var(--navy);
}
.btn-outline-navy:hover {
  background: var(--navy);
  color: #ffffff;
}

.btn-danger {
  background: #991b1b;
  color: #ffffff;
}
.btn-danger:hover {
  background: #7f1d1d;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--navy);
  cursor: pointer;
}

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.card-sub {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--ink-secondary);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--navy);
}

.kpi-card.accent-crimson {
  border-top-color: var(--crimson);
}
.kpi-card.accent-teal {
  border-top-color: #0284c7;
}
.kpi-card.accent-green {
  border-top-color: #15803d;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--navy);
  margin: 6px 0 4px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.kpi-meta {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stack-20 {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero Banner for Public Intake / Dark Panels */
.hero-navy {
  background: linear-gradient(135deg, #0b2241 0%, #153461 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 28px 30px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.hero-navy h1, .hero-navy h2 {
  color: #ffffff;
  margin: 0 0 8px;
}

.hero-navy p {
  color: #e2e8f0;
  margin: 0;
  max-width: 760px;
}

.lang-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 3px;
  gap: 4px;
}

.lang-btn {
  border: 0;
  background: transparent;
  color: #e2e8f0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.lang-btn.active {
  background: #ffffff;
  color: var(--navy);
}

.pathway-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pathway-card:hover {
  border-color: var(--navy);
}
.pathway-card.active {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.12);
}

/* Badges & Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-critical { background: var(--danger-bg); color: var(--danger-fg); }
.pill-high { background: var(--high-bg); color: var(--high-fg); }
.pill-medium { background: var(--warning-bg); color: var(--warning-fg); }
.pill-low, .pill-closed, .pill-approved { background: var(--success-bg); color: var(--success-fg); }
.pill-info { background: var(--info-bg); color: var(--info-fg); }
.pill-restricted { background: var(--restricted-bg); color: var(--restricted-fg); }
.pill-neutral { background: #e2e8f0; color: #1e293b; }

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table th {
  text-align: left;
  padding: 11px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-secondary);
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
}

table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--ink);
}

table.data-table tbody tr:hover {
  background: #f8fafc;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
}

.form-field textarea {
  min-height: 104px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
}

.checkbox-row input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
}

/* Tabs */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  padding-bottom: 10px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
}
.tab-btn:hover {
  background: var(--canvas);
  color: var(--navy);
}
.tab-btn.active {
  background: var(--navy);
  color: #ffffff;
}

/* Alerts & Callouts */
.callout {
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--ink);
}
.callout-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}
.callout-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}
.callout-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.callout-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

/* Diff Redlines */
.diff-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.7;
  font-size: 13.5px;
}
.diff-add {
  background: #dcfce7;
  color: #166534;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}
.diff-del {
  background: #fee2e2;
  color: #991b1b;
  padding: 1px 3px;
  border-radius: 3px;
  text-decoration: line-through;
}

/* Charts */
.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Timeline & Thread */
.timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item {
  border-left: 3px solid var(--navy);
  padding: 6px 0 6px 14px;
}

.message-bubble {
  padding: 12px 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  margin-bottom: 10px;
}
.message-bubble.msg-investigator {
  background: #eff6ff;
  border-color: #bfdbfe;
}

/* WELCOME-06 Choose Your View Modal (Centered on Desktop & Mobile 390x844) */
.view-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(7, 17, 34, 0.8);
  backdrop-filter: blur(6px);
}
.view-modal-backdrop[hidden] {
  display: none;
}

.view-modal-card {
  background: var(--navy);
  color: #ffffff;
  width: 100%;
  max-width: 760px;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  margin: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-elevated);
  padding: 28px;
}

.view-modal-card:focus,
.modal-card:focus,
.main-content:focus {
  outline: none;
}

.view-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.view-modal-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #93c5fd;
}

.view-modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.view-modal-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  color: #cbd5e1;
}

.view-modal-close {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.view-modal-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.view-role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.view-role-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  background: var(--navy-mid);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.view-role-card:hover {
  background: var(--navy-hover);
  border-color: #f87171;
  transform: translateY(-1px);
}

.view-role-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.view-role-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.35;
}

.view-role-tag {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #93c5fd;
  letter-spacing: 0.03em;
}

/* Generic App Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(11, 34, 65, 0.65);
}
.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  background: #ffffff;
  color: var(--ink);
  width: 100%;
  max-width: 680px;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  margin: auto;
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-elevated);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  color: var(--navy);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.filter-bar select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13.5px;
  color: var(--ink);
}

.code-receipt {
  background: var(--navy);
  color: #ffffff;
  padding: 18px;
  border-radius: 12px;
  margin-top: 14px;
}
.code-receipt strong {
  color: #93c5fd;
}

/* Responsive Breakpoints */
@media (max-width: 1080px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .topbar {
    padding: 0 14px;
    gap: 8px;
  }
  .global-search {
    display: none;
  }
  .main-content {
    padding: 18px 14px 36px;
  }
}

@media (max-width: 720px) {
  .kpi-grid, .form-grid {
    grid-template-columns: 1fr;
  }
  .role-select {
    max-width: 135px;
    font-size: 12px;
    padding: 6px 8px;
  }
  /* Compact vertically & horizontally centered Choose Your View modal on phones */
  .view-modal-backdrop {
    align-items: center;
    justify-content: center;
    padding: 16px;
  }
  .view-modal-card {
    padding: 18px 16px;
    max-height: calc(100dvh - 36px);
    border-radius: 14px;
  }
  .view-modal-card:focus,
.modal-card:focus,
.main-content:focus {
  outline: none;
}

.view-modal-header {
    margin-bottom: 12px;
    gap: 10px;
  }
  .view-modal-eyebrow {
    font-size: 10px;
  }
  .view-modal-title {
    font-size: 19px;
  }
  .view-modal-subtitle {
    font-size: 12.5px;
    margin-top: 4px;
  }
  .view-role-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .view-role-card {
    padding: 11px 13px;
    gap: 2px;
  }
  .view-role-title {
    font-size: 14px;
  }
  .view-role-desc {
    font-size: 12px;
  }
  .view-role-tag {
    display: none;
  }
}

/* CSP-Clean Utility Classes */
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.mb-18 { margin-bottom: 18px; }
.mb-20 { margin-bottom: 20px; }
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-22 { margin-top: 22px; }
.flex-wrap-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.flex-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px; }
.flex-between-center { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.flex-row-gap-6 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flex-row-gap-8 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flex-row-gap-10 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.flex-1-min { flex: 1; min-width: 220px; }
.workload-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #e2e8f0; font-size: 13.5px; }
.hero-h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; color: #ffffff; }
.receipt-title { margin: 0 0 8px; color: #ffffff; font-size: 18px; }
.receipt-sub { margin: 0 0 10px; color: #e2e8f0; }
.receipt-coi { margin: 6px 0 0; color: #fde68a; font-size: 13px; }
.pathway-title { font-weight: 700; color: #0b2241; margin-bottom: 4px; }
.msg-meta { display: flex; justify-content: space-between; font-size: 12px; color: #475569; margin-bottom: 4px; }
.cond-label { display: block; font-weight: 700; margin-bottom: 6px; }
.cond-input { width: 100%; padding: 8px 10px; border: 1px solid #93c5fd; border-radius: 6px; background: #ffffff; }
.case-num-strong { font-weight: 700; color: #0b2241; }
.assign-select { flex: 1; min-width: 200px; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; }
.linked-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #e2e8f0; gap: 10px; }
.pre-wrap { white-space: pre-wrap; overflow: auto; }
.meta-line { font-size: 12px; color: #475569; }
.subject-bold { font-weight: 700; margin: 4px 0; }
.body-sm { font-size: 13.5px; }
.body-xs { font-size: 13px; margin: 0 0 8px; }
.sig-stamp { margin-top: 6px; color: #166534; }
.section-label-sm { font-size: 13px; }
.controls-list { padding-left: 18px; font-size: 13.5px; color: #334155; }
.hash-muted { color: #475569; }

.media-preview {
  display: block;
  width: 100%;
  max-height: 460px;
  border-radius: 6px;
  background: #0f172a;
}

.pdf-preview {
  display: block;
  width: 100%;
  height: 480px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

/* ------------------------------------------------------------------
   MOBILE-RESPONSIVE-01 closeout corrections (2026-11-30)
   Phone and tablet: nothing spills, the menu is reachable at 320 px,
   every control is a 44 by 44 px target, tables scroll in their own box.
   ------------------------------------------------------------------ */
.grid-2 > *, .grid-3 > *, .kpi-grid > *, .form-grid > *, .stack-20 > *,
.flex-between > *, .flex-wrap-gap > *, .card, .main-content, .page-header > * {
  min-width: 0;
}
select, input, textarea {
  max-width: 100%;
}
.table-wrap {
  max-width: 100%;
}
.view-modal-eyebrow {
  font-size: 11px;
}

@media (max-width: 1080px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-2, .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .btn, .btn-sm, .tab-btn, .lang-btn, .nav-item, .tip-dismiss-btn, .view-modal-close,
  .role-select, .welcome-link, .icon-btn {
    min-height: 44px;
  }
  .tip-dismiss-btn, .view-modal-close, .lang-btn {
    min-width: 44px;
  }
  .welcome-link {
    display: inline-flex;
    align-items: center;
  }
  .mobile-menu-btn {
    min-width: 44px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
  }
  .topbar-left {
    flex: 0 0 auto;
  }
  .topbar-right {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
  }
  .role-switcher-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
  }
  .role-select {
    width: 100%;
    min-width: 0;
    max-width: 240px;
    font-size: 13px;
  }
  .form-field input[type="text"],
  .form-field input[type="email"],
  .form-field input[type="password"],
  .form-field input[type="number"],
  .form-field input[type="date"],
  .form-field input[type="file"],
  .form-field select,
  .cond-input, .assign-select,
  main select, main input:not([type="checkbox"]):not([type="radio"]) {
    min-height: 44px;
  }
  main input[type="checkbox"], main input[type="radio"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }
  main label:has(> input[type="checkbox"]), main label:has(> input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
  }
  .flex-1-min, .assign-select {
    min-width: 0;
    flex: 1 1 100%;
  }
  .role-tip-banner {
    padding: 8px 14px;
  }
  .toast-region {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }
}

@media (max-width: 720px) {
  .kpi-grid, .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .view-modal-eyebrow {
    font-size: 11px;
  }
  .card {
    padding: 16px;
  }
  .hero-navy {
    padding: 20px 16px;
  }
}

@media (max-width: 480px) {
  /* The role selector in the bar already switches views; the duplicate
     Views button gives its room to the menu button and the selector. */
  #open-role-modal-btn {
    display: none;
  }
  .topbar-right {
    gap: 6px;
  }
  .welcome-link {
    padding: 6px 8px;
  }
}

/* Notifications bell and list; administrator case lists (closeout 2026-11-30) */
.notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 36px;
  flex-shrink: 0;
}
.notif-btn[hidden] {
  display: none;
}
.notif-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #7f1d1d;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.notif-count[hidden] {
  display: none;
}
.notif-list, .config-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notif-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
}
.notif-item.notif-unread {
  border-left: 4px solid #7f1d1d;
  background: #f8fafc;
}
.notif-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.config-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.config-row-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 260px;
  min-width: 0;
}
.config-row-fields input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
}
.config-row-fields input:disabled {
  background: var(--canvas);
  color: var(--ink-secondary);
}
.config-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.config-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 0;
}
.config-fieldset legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  padding: 0 6px;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 14px;
}
.question-row {
  border-top: 1px solid var(--border);
  padding: 12px 0 4px;
}
.question-row:first-of-type {
  border-top: 0;
}
@media (max-width: 900px) {
  .notif-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .config-row-fields input {
    min-height: 44px;
  }
}
@media (max-width: 480px) {
  .check-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Safari draws native selectors at their own height and ignores min-height:
   give every selector one drawn box so the 44 px target holds in every browser. */
select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%230b2241' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
  padding-right: 30px;
  text-overflow: ellipsis;
}
.role-select {
  padding-right: 30px;
}
@media (max-width: 900px) {
  select, .role-select {
    height: 44px;
    line-height: 1.2;
  }
  input[type="file"] {
    min-height: 44px;
  }
}

/* Electronic approvals (F4, Attr 87) */
.approval-path {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
}
.approval-superseded {
  opacity: 0.7;
}
.approval-decided strong {
  color: #0b2241;
}
select[multiple] {
  min-height: 96px;
}

/* Category trend legend (F6) */
.chart-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 8px 0 0;
  padding: 0;
  font-size: 12px;
  color: #334155;
}
.chart-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.legend-swatch[data-color="0"] { background: #0b2241; }
.legend-swatch[data-color="1"] { background: #c41230; }
.legend-swatch[data-color="2"] { background: #0284c7; }
.legend-swatch[data-color="3"] { background: #0f766e; }
.legend-swatch[data-color="4"] { background: #6d28d9; }
.report-builder fieldset {
  min-width: 0;
}

/* F13: the one-time recovery code warning on the receipt */
.receipt-warn { margin: 6px 0 8px; color: #fde68a; font-size: 13px; }
.receipt-warn strong { color: #fde68a; }
.code-receipt:focus { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* F14: administrator logo on the reporter portal */
.portal-logo {
  display: block;
  max-height: 56px;
  max-width: 220px;
  background: #ffffff;
  border-radius: 8px;
  padding: 4px 8px;
}

/* F18: the tip banner wraps on narrow phones so Dismiss is always fully on screen */
.role-tip-banner {
  flex-wrap: wrap;
}
.role-tip-banner > span {
  flex: 1 1 180px;
  min-width: 0;
}
.tip-dismiss-btn {
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .role-tip-banner {
    padding: 10px 16px;
  }
  .tip-dismiss-btn {
    margin-left: auto;
  }
}

/* Attr 84: marking image areas to redact */
.redact-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}
