:root {
  --bg: #f3f6f5;
  --card: #ffffff;
  --surface-subtle: #edf2f1;
  --surface-selected: #e5eff0;
  --text: #18282f;
  --muted: #5d6c72;
  --primary: #356d78;
  --primary-hover: #285a64;
  --danger: #a64048;
  --success: #3f705f;
  --warning: #8a671f;
  --info: #466f80;
  --border: #d8e1df;
  --border-strong: #bccbc8;
  --bs-primary: #356d78;
  --bs-primary-rgb: 53, 109, 120;
  --bs-link-color: #356d78;
  --bs-link-hover-color: #285a64;
}
html, body { background: var(--bg); color: var(--text); }
.navbar { background: #fbfcfc !important; border-bottom: 1px solid var(--border); }
.navbar .navbar-brand, .navbar .nav-link { color: var(--text) !important; }
.navbar .nav-link:hover, .navbar .nav-link:focus { color: var(--primary) !important; text-decoration: none; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 5px 14px rgba(31, 52, 58, .055); }
.card-title { color: var(--text); }
.table { color: var(--text); --bs-table-color: var(--text); --bs-table-bg: transparent; --bs-table-striped-bg: #f5f8f7; --bs-table-hover-bg: #eaf1f0; border-color: var(--border); }
.table > thead { color: #455960; }
.form-control, .form-select { background: #fff; border: 1px solid var(--border); color: var(--text); }
.form-control::placeholder { color: #7a898e; }
.form-control:focus, .form-select:focus { border-color: #79a3aa; box-shadow: 0 0 0 .2rem rgba(53, 109, 120, .14); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover, .btn-success:focus { background: #335e4f; border-color: #335e4f; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-outline-secondary { color: #506269; border-color: #aab9b6; }
.btn-outline-secondary:hover { background: #52676d; border-color: #52676d; }
.btn-outline-danger { color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn { border-radius: 12px; }
.footer { color: var(--muted); font-size: 0.9rem; }

.text-muted { color: var(--muted) !important; }
.list-group-item { background-color: var(--card); border-color: var(--border); color: var(--text); }
.list-group-item-action:hover, .list-group-item-action:focus { background-color: #eaf1f0; color: var(--text); }
.accordion-item { border-color: var(--border); }
.accordion-button:not(.collapsed) { background: var(--surface-selected); color: #244f58; box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--border); }
.accordion-button:focus { border-color: #79a3aa; box-shadow: 0 0 0 .2rem rgba(53, 109, 120, .14); }
.nav-tabs { --bs-nav-tabs-border-color: var(--border); }
.nav-tabs .nav-link { color: var(--muted); }
.nav-tabs .nav-link.active { color: var(--text); border-color: var(--border) var(--border) #fff; }
.pagination { --bs-pagination-color: var(--primary); --bs-pagination-hover-color: var(--primary-hover); --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); }

/* Calm, low-saturation workflow states used consistently across the app. */
.text-bg-success { color: #285344 !important; background-color: #dcebe5 !important; }
.text-bg-warning { color: #6f5318 !important; background-color: #f5e9c9 !important; }
.text-bg-info { color: #315e70 !important; background-color: #dceaf0 !important; }
.text-bg-primary { color: #2b5963 !important; background-color: #dcebed !important; }
.text-bg-secondary { color: #526268 !important; background-color: #e5e9e8 !important; }

.upload-dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  color: var(--muted);
  background: #f7f9f8;
  cursor: pointer;
  transition: all .15s ease;
}
.upload-dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--surface-selected);
  color: #285a64;
}
.upload-selected-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.upload-thumb {
  min-width: 82px;
  max-width: 82px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.upload-thumb-img {
  width: 100%;
  height: 58px;
  object-fit: cover;
  display: block;
}
.upload-thumb-ext {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  background: #f1f5f9;
}
.upload-thumb-name {
  font-size: 11px;
  line-height: 1.2;
  padding: 6px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-file-list {
  display: grid;
  gap: 8px;
}
.upload-file-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}
.upload-file-top, .upload-file-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.upload-file-name {
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: #1f2937;
}
.upload-file-size, .upload-file-status, .upload-file-pct {
  font-size: 12px;
  color: #6b7280;
}
.report-bars {
  display: grid;
  gap: 8px;
}
.report-bar-row {
  display: grid;
  grid-template-columns: 82px 1fr 32px;
  gap: 8px;
  align-items: center;
}
.report-bar-label, .report-bar-value {
  font-size: 12px;
  color: #334155;
}
.report-bar-track {
  height: 10px;
  background: #dfe7e5;
  border-radius: 999px;
  overflow: hidden;
}
.report-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a7f89, #356d78);
}
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.report-kpi-grid .report-kpi-card .card-body {
  min-height: 68px;
}
.report-kpi-grid .report-kpi-card small {
  line-height: 1.2;
  white-space: normal;
}
.report-kpi-value {
  font-size: 1.25rem;
  line-height: 1.1;
}
.reports-page {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.reports-page .row {
  margin-left: 0;
  margin-right: 0;
}
.reports-page .row > [class*="col-"] {
  padding-left: 0.375rem;
  padding-right: 0.375rem;
}
.reports-page .table-mobile-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.reports-page .table-mobile-wrap table {
  width: max-content;
  min-width: 100%;
}
@media (min-width: 768px) {
  .report-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .report-kpi-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
.attachment-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.attachment-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.attachment-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border: 0;
  background: #f1f5f9;
}
.attachment-file-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  font-weight: 700;
  letter-spacing: .06em;
}
.attachment-meta {
  padding: 8px;
}
.attachment-name {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-date, .attachment-note {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 8px 8px 8px;
}
.attachment-actions form {
  margin: 0;
}
.attachment-preview-wrap {
  min-height: 58vh;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}
.attachment-preview-image {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
}
.attachment-preview-pdf {
  width: 100%;
  height: 72vh;
  border: 0;
  border-radius: 8px;
}
.attachment-preview-fallback {
  color: #6b7280;
  font-size: 14px;
}
.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.case-actions form {
  margin: 0;
}
.case-page-header {
  padding-top: 1.5rem;
}
.case-back-link {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}
.case-back-link:hover {
  color: var(--primary);
}
.case-decedent-name {
  color: var(--text);
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -.025em;
}
.case-number-label {
  color: #4d6269;
  font-size: 1rem;
  font-weight: 600;
}
.case-status-form {
  margin: 0;
}
.case-status-select {
  background-color: #e3eee9;
  border-color: #a9c8bc;
  color: #2d5b4b;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
  min-width: 112px;
  padding-bottom: .25rem;
  padding-top: .25rem;
}
.case-status-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(53, 109, 120, .14);
}
.case-status-select.status-pending-tox {
  background-color: #f7edd3;
  border-color: #d9c17e;
  color: #72551a;
}
.case-status-select.status-pending-autopsy {
  background-color: #e4edf1;
  border-color: #aac5cf;
  color: #345e6e;
}
.case-status-select.status-pending-records {
  background-color: #e1ecee;
  border-color: #a5c4c9;
  color: #2f5f68;
}
.case-status-select.status-closed {
  background-color: #e8eceb;
  border-color: #c5cfcc;
  color: #536369;
}
.case-updated-label {
  color: #64748b;
  font-size: .82rem;
  margin-top: .15rem;
}
.case-overview-card,
.case-narrative-card {
  box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
}
.case-section-title {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}
.case-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.35rem 2rem;
}
.case-detail-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.case-detail-label {
  color: #64748b;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .055em;
  margin-bottom: .3rem;
  text-transform: uppercase;
}
.case-detail-value {
  color: var(--text);
  font-size: .96rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.case-detail-note {
  color: #64748b;
  font-size: .84rem;
  line-height: 1.35;
  margin-top: .2rem;
}
.case-narrative-text {
  color: #30434a;
  font-family: inherit;
  font-size: .96rem;
  line-height: 1.75;
  max-width: 92ch;
  white-space: pre-wrap;
}
.case-narrative-text.is-empty {
  color: #94a3b8;
  font-style: italic;
}
.case-workspace-card {
  box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
}
.case-workspace-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.case-section-edit {
  color: var(--primary);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
}
.case-section-edit:hover {
  text-decoration: underline;
}
.case-workspace-grid {
  display: grid;
  gap: 1.25rem 2rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.case-workspace-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.case-workspace-field.is-wide {
  grid-column: span 2;
}
.case-workspace-value {
  color: #30434a;
  font-size: .94rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.case-workspace-flags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.case-workspace-flag {
  align-items: center;
  background: var(--surface-selected);
  border: 1px solid #bfd2d4;
  border-radius: 999px;
  color: #2c5e67;
  display: inline-flex;
  font-size: .78rem;
  font-weight: 700;
  padding: .3rem .65rem;
}
.case-workspace-flag::before {
  content: "\2713";
  margin-right: .35rem;
}
.case-section-count {
  background: #f1f5f9;
  border-radius: 999px;
  color: #475569;
  display: inline-block;
  font-size: .72rem;
  margin-left: .35rem;
  padding: .15rem .45rem;
  vertical-align: .1rem;
}
@media (max-width: 991.98px) {
  .case-overview-grid,
  .case-workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 575.98px) {
  .case-overview-grid,
  .case-workspace-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .case-workspace-field.is-wide {
    grid-column: auto;
  }
  .case-page-header .case-actions {
    width: 100%;
  }
}

/* User administration list */
.users-existing-card .card-body { padding: 1.25rem; }
.users-existing-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 1rem; }
.users-existing-heading p { font-size: .75rem; }
.users-existing-heading > span { background: #edf3f2; border-radius: 999px; color: #597076; font-size: .68rem; font-weight: 750; padding: .3rem .6rem; }
.users-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.users-list-item { background: #fff; border-bottom: 1px solid var(--border); display: grid; gap: 1rem; grid-template-columns: minmax(180px, 1.1fr) minmax(280px, 1.5fr); padding: 1rem; }
.users-list-item:last-child { border-bottom: 0; }
.users-person { align-items: center; display: flex; gap: .7rem; min-width: 0; }
.users-avatar { align-items: center; background: #e1eded; border: 1px solid #c8dada; border-radius: 9px; color: #2f6570; display: inline-flex; flex: 0 0 auto; font-size: .78rem; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.users-person > div { display: flex; flex-direction: column; min-width: 0; }
.users-person strong { color: #263e45; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-person a { color: #6e8186; font-size: .7rem; margin-top: .15rem; overflow: hidden; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.users-person a:hover { color: var(--primary); text-decoration: underline; }
.users-meta { display: grid; gap: .75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.users-meta > div { display: flex; flex-direction: column; min-width: 0; }
.users-meta > div > span { color: #829196; font-size: .61rem; font-weight: 750; letter-spacing: .045em; margin-bottom: .22rem; text-transform: uppercase; }
.users-meta > div > strong, .users-roles > div > strong { color: #455c63; font-size: .72rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-roles > div { display: flex; flex-wrap: wrap; gap: .25rem; }
.users-roles .badge { font-size: .62rem; }
.users-actions { align-items: center; border-top: 1px solid #edf1f0; display: flex; gap: 1rem; grid-column: 1 / -1; justify-content: space-between; padding-top: .8rem; }
.users-primary-actions, .users-password-form { align-items: center; display: flex; gap: .45rem; }
.users-primary-actions form { margin: 0; }
.users-actions .btn { border-radius: 8px; font-size: .7rem; min-height: 31px; white-space: nowrap; }
.users-password-form { margin: 0; }
.users-password-form .form-control { border-radius: 8px; font-size: .72rem; height: 31px; min-width: 190px; width: 210px; }
.users-empty { color: var(--muted); font-size: .8rem; padding: 2rem; text-align: center; }

@media (max-width: 767.98px) {
  .users-list-item { grid-template-columns: 1fr; }
  .users-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .users-actions { align-items: stretch; flex-direction: column; grid-column: auto; }
  .users-password-form .form-control { flex: 1; width: auto; }
}
@media (max-width: 479.98px) {
  .users-meta { grid-template-columns: 1fr 1fr; }
  .users-roles { grid-column: 1 / -1; }
  .users-primary-actions .btn, .users-primary-actions form { flex: 1; }
  .users-primary-actions form .btn { width: 100%; }
  .users-password-form { align-items: stretch; flex-direction: column; }
  .users-password-form .form-control, .users-password-form .btn { width: 100%; }
}

/* Dashboard workspace */
.dashboard-page { --dashboard-ink: #152c34; --dashboard-muted: #64777d; max-width: 1320px; margin: 0 auto; }
.dashboard-page svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.dashboard-hero { align-items: flex-end; display: flex; gap: 2rem; justify-content: space-between; margin-bottom: 2rem; }
.dashboard-eyebrow, .dashboard-panel-kicker { color: var(--primary); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.dashboard-hero h1 { color: var(--dashboard-ink); font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 750; letter-spacing: -.045em; margin: .15rem 0 .3rem; }
.dashboard-hero p { color: var(--dashboard-muted); font-size: 1rem; margin: 0; }
.dashboard-new-case { align-items: center; display: inline-flex; font-size: .86rem; font-weight: 700; gap: .5rem; padding: .68rem 1rem; white-space: nowrap; }
.dashboard-new-case svg { height: 17px; width: 17px; }
.dashboard-section-heading { align-items: flex-end; display: flex; justify-content: space-between; margin-bottom: .85rem; }
.dashboard-section-heading h2, .dashboard-panel-header h2 { color: var(--dashboard-ink); font-size: 1.05rem; font-weight: 750; letter-spacing: -.015em; margin: 0; }
.dashboard-section-heading p, .dashboard-panel-header p { color: var(--dashboard-muted); font-size: .76rem; margin: .16rem 0 0; }
.dashboard-section-heading > a, .dashboard-panel-header > a { color: var(--primary); font-size: .75rem; font-weight: 700; text-decoration: none; }
.dashboard-section-heading > a:hover, .dashboard-panel-header > a:hover { text-decoration: underline; }
.dashboard-kpi-grid { display: grid; gap: .8rem; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 1.75rem; }
.dashboard-kpi { align-items: flex-start; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 5px 18px rgba(25, 52, 58, .04); display: flex; gap: .75rem; min-height: 138px; padding: 1rem; transition: box-shadow .15s ease, transform .15s ease; }
.dashboard-kpi:hover { box-shadow: 0 10px 24px rgba(25, 52, 58, .08); transform: translateY(-2px); }
.dashboard-kpi-icon { align-items: center; background: #e5efef; border-radius: 8px; color: #356d78; display: inline-flex; flex: 0 0 auto; height: 32px; justify-content: center; width: 32px; }
.dashboard-kpi-icon svg { height: 17px; width: 17px; }
.dashboard-kpi > div { display: flex; flex-direction: column; min-width: 0; }
.dashboard-kpi > div > span { color: #52676d; font-size: .72rem; font-weight: 700; line-height: 1.15; min-height: 1.7em; }
.dashboard-kpi strong { color: var(--dashboard-ink); font-size: 1.85rem; font-weight: 750; letter-spacing: -.04em; line-height: 1; margin: .7rem 0 .25rem; }
.dashboard-kpi small { color: #849398; font-size: .64rem; white-space: nowrap; }
.dashboard-kpi.is-open .dashboard-kpi-icon { background: #dff0e9; color: #34705d; }
.dashboard-kpi.is-tox .dashboard-kpi-icon { background: #f7edcf; color: #8a671f; }
.dashboard-kpi.is-autopsy .dashboard-kpi-icon { background: #e4edf2; color: #466f80; }
.dashboard-kpi.is-records .dashboard-kpi-icon { background: #e1ecee; color: #356d78; }
.dashboard-kpi.is-closed .dashboard-kpi-icon { background: #eaeeee; color: #637277; }
.dashboard-cases-panel { background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 24px rgba(25, 52, 58, .045); overflow: hidden; }
.dashboard-panel-header { align-items: center; display: flex; justify-content: space-between; padding: 1.3rem 1.35rem 1rem; }
.dashboard-panel-header h2 { font-size: 1.1rem; margin-top: .15rem; }
.dashboard-search { align-items: center; background: #f7f9f8; border-block: 1px solid var(--border); display: grid; gap: .6rem; grid-template-columns: minmax(260px, 1fr) 190px auto auto; padding: .8rem 1.35rem; }
.dashboard-search-input { position: relative; }
.dashboard-search-input svg { color: #789095; height: 17px; left: .8rem; position: absolute; top: 50%; transform: translateY(-50%); width: 17px; }
.dashboard-search .form-control { padding-left: 2.35rem; }
.dashboard-search .form-control, .dashboard-search .form-select { border-radius: 9px; font-size: .8rem; height: 39px; }
.dashboard-search .btn { border-radius: 9px; font-size: .76rem; font-weight: 700; height: 39px; padding-inline: 1rem; }
.dashboard-clear { color: #687c81; font-size: .72rem; font-weight: 700; padding: .5rem; text-decoration: none; }
.dashboard-clear:hover { color: var(--primary); text-decoration: underline; }
.dashboard-case-list { width: 100%; }
.dashboard-case-row { align-items: center; border-bottom: 1px solid #edf1f0; color: inherit; display: grid; gap: 1rem; grid-template-columns: 38px minmax(180px, 1.3fr) minmax(130px, .8fr) minmax(110px, auto) 110px 30px; padding: .9rem 1.35rem; text-decoration: none; transition: background .12s ease; }
.dashboard-case-row:last-child { border-bottom: 0; }
.dashboard-case-row:hover { background: #f6f9f8; color: inherit; }
.dashboard-case-avatar { align-items: center; background: #e4eeee; border: 1px solid #ccdddd; border-radius: 9px; color: #356d78; display: inline-flex; font-size: .72rem; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.dashboard-case-identity, .dashboard-case-manner, .dashboard-case-row time { display: flex; flex-direction: column; min-width: 0; }
.dashboard-case-identity strong { color: #263f46; font-size: .81rem; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-case-identity > span { color: #718388; font-size: .68rem; margin-top: .2rem; }
.dashboard-case-manner small, .dashboard-case-row time small { color: #87969a; font-size: .59rem; font-weight: 750; letter-spacing: .045em; margin-bottom: .2rem; text-transform: uppercase; }
.dashboard-case-manner strong, .dashboard-case-row time strong { color: #52676d; font-size: .7rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-case-arrow { align-items: center; border: 1px solid #d5dfdd; border-radius: 7px; color: #547078; display: inline-flex; height: 27px; justify-content: center; width: 27px; }
.dashboard-case-row:hover .dashboard-case-arrow { background: var(--primary); border-color: var(--primary); color: #fff; }
.dashboard-empty { align-items: center; color: #839398; display: flex; flex-direction: column; justify-content: center; min-height: 260px; padding: 2rem; text-align: center; }
.dashboard-empty > span { align-items: center; background: #edf3f2; border-radius: 50%; color: #58757b; display: flex; height: 42px; justify-content: center; margin-bottom: .75rem; width: 42px; }
.dashboard-empty > span svg { height: 20px; width: 20px; }
.dashboard-empty strong { color: #40585f; font-size: .9rem; }
.dashboard-empty p { font-size: .75rem; margin: .25rem 0 .8rem; }

@media (max-width: 1199.98px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-kpi { min-height: 120px; }
}
@media (max-width: 767.98px) {
  .dashboard-hero { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .dashboard-new-case { justify-content: center; width: 100%; }
  .dashboard-search { grid-template-columns: 1fr 150px auto; }
  .dashboard-search-input { grid-column: 1 / -1; }
  .dashboard-case-row { grid-template-columns: 38px minmax(0, 1fr) auto 28px; }
  .dashboard-case-manner { display: none; }
  .dashboard-case-row time { display: none; }
}
@media (max-width: 519.98px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-kpi { display: block; min-height: 145px; padding: .85rem; }
  .dashboard-kpi > div > span { margin-top: .55rem; min-height: auto; }
  .dashboard-kpi strong { margin-top: .45rem; }
  .dashboard-panel-header { align-items: flex-start; gap: .75rem; }
  .dashboard-panel-header > a { white-space: nowrap; }
  .dashboard-search { grid-template-columns: 1fr; }
  .dashboard-search-input { grid-column: auto; }
  .dashboard-search .btn { width: 100%; }
  .dashboard-clear { text-align: center; }
  .dashboard-case-row { gap: .7rem; padding-inline: .85rem; }
  .dashboard-case-row .reports-status { font-size: 0; gap: 0; padding: .48rem; }
}
.table-mobile-wrap {
  width: 100%;
  overflow-x: auto;
}
.table-mobile-wrap table {
  min-width: 720px;
}
.sticky-save-bar {
  position: static;
  background: transparent;
  border-top: 0;
  padding-top: 0;
}
.case-edit-header {
  align-items: end;
  display: flex;
  justify-content: space-between;
}
.case-edit-layout {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: 230px minmax(0, 1fr);
}
.case-section-nav {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .65rem;
  position: sticky;
  top: 1rem;
}
.case-section-nav-title {
  color: #64748b;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .35rem .55rem .55rem;
  text-transform: uppercase;
}
.case-section-nav-link {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #334155;
  display: block;
  padding: .55rem;
  text-align: left;
  width: 100%;
}
.case-section-nav-link:hover,
.case-section-nav-link.active {
  background: var(--surface-selected);
  color: #285a64;
}
.case-section-nav-link > span:first-child {
  display: block;
  font-size: .86rem;
  font-weight: 650;
}
.case-section-progress {
  color: #94a3b8;
  display: block;
  font-size: .7rem;
  margin-top: .1rem;
}
.case-section-progress.has-information { color: var(--success); }
.case-section-progress.needs-attention { color: var(--warning); font-weight: 700; }
.case-section-progress.is-complete { color: var(--success); font-weight: 700; }
.case-required-marker,
.case-requirement-condition {
  color: #64748b;
  font-size: .72rem;
  font-weight: 500;
}
.case-required-marker { margin-left: .25rem; }
.case-requirements-grid { display: grid; gap: .7rem; }
.case-edit-accordion { min-width: 0; }
.case-edit-accordion .accordion-item:target { scroll-margin-top: 1rem; }
@media (max-width: 991.98px) {
  .case-edit-layout { grid-template-columns: 1fr; }
  .case-section-nav {
    display: flex;
    gap: .35rem;
    overflow-x: auto;
    position: static;
  }
  .case-section-nav-title { display: none; }
  .case-section-nav-link { flex: 0 0 180px; }
}

/* Mobile header/button safety nets */
.d-grid .btn{min-width:0}
@media (max-width:576px){
  .d-grid.gap-2 .btn{width:100%}
  .container, .container-xxl {
    padding-left: 10px;
    padding-right: 10px;
  }
  .card {
    border-radius: 12px;
  }
  .btn {
    min-height: 40px;
  }
  .case-actions .btn,
  .case-actions form,
  .case-actions a {
    width: 100%;
  }
  .case-actions .btn {
    margin-right: 0 !important;
  }
  .input-group {
    flex-direction: column;
    gap: 6px;
  }
  .input-group > .form-control,
  .input-group > .btn {
    width: 100%;
    border-radius: 10px !important;
  }
  .accordion .accordion-button {
    font-size: 0.95rem;
    padding: 0.75rem 0.85rem;
  }
  .accordion .accordion-body {
    padding: 0.85rem;
  }
  .table-mobile-wrap table {
    min-width: 620px;
  }
  .sticky-save-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding-top: 10px;
    padding-bottom: 10px;
    margin-top: 14px;
  }
  .sticky-save-bar .btn {
    width: 100%;
  }
}

/* Reports workspace */
.reports-page {
  --report-ink: #152c34;
  --report-soft: #64777d;
  --report-line: #dbe5e3;
  max-width: 1320px;
  margin: 0 auto;
  padding: 2.25rem 0 1rem;
  overflow: visible;
}
.reports-page svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.reports-hero { align-items: flex-end; display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 1.75rem; }
.reports-eyebrow, .reports-panel-kicker { color: var(--primary); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.reports-hero h1 { color: var(--report-ink); font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 750; letter-spacing: -.045em; margin: .15rem 0 .3rem; }
.reports-hero p { color: var(--report-soft); font-size: 1rem; margin: 0; }
.reports-export-btn { align-items: center; background: #fff; border: 1px solid #cbd8d6; border-radius: 10px; color: #2f5962; display: inline-flex; font-size: .88rem; font-weight: 700; gap: .55rem; padding: .65rem .9rem; white-space: nowrap; }
.reports-export-btn:hover { background: #f6f9f8; border-color: #9fb7b3; color: #244b53; }
.reports-export-btn svg, .reports-run-btn svg { height: 17px; width: 17px; }
.reports-filter-card, .reports-panel { background: #fff; border: 1px solid var(--report-line); border-radius: 16px; box-shadow: 0 8px 24px rgba(25, 52, 58, .045); }
.reports-filter-card { margin-bottom: 2rem; padding: 1.25rem 1.35rem 1.35rem; }
.reports-section-heading, .reports-section-heading > div { align-items: center; display: flex; }
.reports-section-heading { justify-content: space-between; }
.reports-section-heading > div { gap: .75rem; }
.reports-section-heading h2, .reports-panel-header h2, .reports-section-title-row h2 { color: var(--report-ink); font-size: 1.02rem; font-weight: 750; letter-spacing: -.015em; margin: 0; }
.reports-section-heading p, .reports-panel-header p, .reports-section-title-row p { color: var(--report-soft); font-size: .78rem; margin: .15rem 0 0; }
.reports-heading-icon { align-items: center; background: #e7f0f1; border-radius: 9px; color: var(--primary); display: inline-flex; height: 36px; justify-content: center; width: 36px; }
.reports-heading-icon svg { height: 19px; width: 19px; }
.reports-clear-link { color: var(--primary); font-size: .8rem; font-weight: 700; text-decoration: none; }
.reports-clear-link:hover { text-decoration: underline; }
.reports-filter-grid { align-items: end; display: grid; gap: .75rem; grid-template-columns: minmax(220px, 1.7fr) repeat(4, minmax(130px, 1fr)) auto; margin-top: 1.1rem; }
.reports-filter-grid:has(#report-county) { grid-template-columns: minmax(220px, 1.7fr) repeat(5, minmax(120px, 1fr)) auto; }
.reports-field { min-width: 0; }
.reports-field label { color: #486068; display: block; font-size: .7rem; font-weight: 750; letter-spacing: .025em; margin: 0 0 .35rem .1rem; text-transform: uppercase; }
.reports-field .form-control, .reports-field .form-select { border-radius: 9px; font-size: .84rem; height: 42px; }
.reports-input-icon { position: relative; }
.reports-input-icon svg { color: #789095; height: 17px; left: .78rem; position: absolute; top: 50%; transform: translateY(-50%); width: 17px; }
.reports-input-icon input { padding-left: 2.35rem; }
.reports-run-btn { align-items: center; border-radius: 9px; display: inline-flex; font-size: .84rem; font-weight: 700; gap: .45rem; height: 42px; justify-content: center; padding-inline: 1rem; white-space: nowrap; }
.reports-section-title-row { align-items: flex-end; display: flex; justify-content: space-between; margin-bottom: .9rem; }
.reports-result-count { background: #e7efee; border-radius: 999px; color: #50686e; font-size: .72rem; font-weight: 700; padding: .35rem .7rem; }
.reports-page .report-kpi-grid { display: grid; gap: .8rem; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 1.75rem; }
.reports-page .report-kpi-card { background: #fff; border: 1px solid var(--report-line); border-radius: 14px; box-shadow: 0 5px 18px rgba(25, 52, 58, .04); min-height: 145px; padding: 1rem; position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.reports-page .report-kpi-card:hover { box-shadow: 0 10px 24px rgba(25, 52, 58, .08); transform: translateY(-2px); }
.report-kpi-top { align-items: center; display: flex; gap: .55rem; }
.report-kpi-icon { align-items: center; background: #e5efef; border-radius: 8px; color: #356d78; display: inline-flex; height: 31px; justify-content: center; width: 31px; }
.report-kpi-icon svg { height: 17px; width: 17px; }
.report-kpi-label { color: #52676d; font-size: .75rem; font-weight: 700; line-height: 1.15; }
.reports-page .report-kpi-value { color: var(--report-ink); display: block; font-size: 2rem; font-weight: 750; letter-spacing: -.04em; line-height: 1; margin: 1rem 0 .3rem; }
.report-kpi-caption { color: #849398; font-size: .68rem; }
.report-kpi-card.is-open .report-kpi-icon { background: #dff0e9; color: #34705d; }
.report-kpi-card.is-tox .report-kpi-icon { background: #f7edcf; color: #8a671f; }
.report-kpi-card.is-autopsy .report-kpi-icon { background: #e4edf2; color: #466f80; }
.report-kpi-card.is-records .report-kpi-icon { background: #e1ecee; color: #356d78; }
.report-kpi-card.is-closed .report-kpi-icon { background: #eaeeee; color: #637277; }
.reports-insights-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr); margin-bottom: 1rem; }
.reports-breakdown-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1rem; }
.reports-panel { min-width: 0; padding: 1.25rem; }
.reports-panel-header { align-items: flex-start; border-bottom: 1px solid #edf1f0; display: flex; justify-content: space-between; margin-bottom: 1rem; padding-bottom: .9rem; }
.reports-panel-header h2 { font-size: 1.08rem; margin-top: .15rem; }
.reports-page .report-bars { display: grid; gap: .9rem; padding: .15rem 0; }
.reports-page .report-bar-row { display: block; }
.report-bar-meta { align-items: center; display: flex; justify-content: space-between; margin-bottom: .38rem; }
.report-bar-meta span { color: #536970; font-size: .76rem; font-weight: 650; }
.report-bar-meta strong { color: #2d4b53; font-size: .76rem; }
.reports-page .report-bar-track { background: #edf2f1; border-radius: 999px; height: 8px; overflow: hidden; }
.reports-page .report-bar-fill { background: linear-gradient(90deg, #5f9198, #356d78); border-radius: inherit; min-width: 3px; }
.reports-ranked-list { list-style: none; margin: 0; padding: 0; }
.reports-ranked-list li { align-items: center; border-bottom: 1px solid #edf1f0; display: grid; gap: .65rem; grid-template-columns: 24px minmax(0, 1fr) auto; min-height: 39px; }
.reports-ranked-list li:last-child { border-bottom: 0; }
.reports-rank { align-items: center; background: #eef3f2; border-radius: 6px; color: #667b80; display: inline-flex; font-size: .65rem; font-weight: 800; height: 22px; justify-content: center; width: 22px; }
.reports-ranked-list li:first-child .reports-rank { background: #dfecec; color: #2f6872; }
.reports-rank-label { color: #354e55; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reports-ranked-list strong { background: #f1f5f4; border-radius: 999px; color: #405a61; font-size: .68rem; min-width: 27px; padding: .22rem .4rem; text-align: center; }
.reports-empty { align-items: center; color: #839398; display: flex; flex-direction: column; justify-content: center; min-height: 180px; text-align: center; }
.reports-empty > span { align-items: center; background: #f0f4f3; border-radius: 50%; display: flex; height: 34px; justify-content: center; margin-bottom: .6rem; width: 34px; }
.reports-empty strong { color: #52676d; font-size: .85rem; }
.reports-empty p { font-size: .75rem; margin: .2rem 0 0; }
.reports-empty.compact { min-height: 130px; }
.reports-cases-panel { margin-top: 1rem; padding: 0; overflow: hidden; }
.reports-table-header { margin: 0; padding: 1.25rem 1.25rem 1rem; }
.reports-table-header > a { color: var(--primary); font-size: .78rem; font-weight: 700; margin-top: .6rem; text-decoration: none; }
.reports-case-table { min-width: 900px !important; }
.reports-case-table thead th { background: #f7f9f8; border-bottom: 1px solid var(--report-line); color: #6c7e83; font-size: .65rem; font-weight: 800; letter-spacing: .06em; padding: .7rem 1rem; text-transform: uppercase; }
.reports-case-table tbody td { border-color: #edf1f0; color: #52676d; font-size: .78rem; padding: .82rem 1rem; vertical-align: middle; }
.reports-case-table tbody tr:last-child td { border-bottom: 0; }
.reports-case-number { color: #2f6872; font-weight: 750; text-decoration: none; }
.reports-case-number:hover { text-decoration: underline; }
.reports-decedent { color: #263f46; font-weight: 700; }
.reports-cause-cell { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reports-status { align-items: center; background: #e2eee8; border-radius: 999px; color: #34614f; display: inline-flex; font-size: .67rem; font-weight: 750; gap: .35rem; padding: .3rem .55rem; white-space: nowrap; }
.reports-status i { background: currentColor; border-radius: 50%; height: 5px; width: 5px; }
.reports-status.status-pending-tox { background: #f6eccf; color: #775a1c; }
.reports-status.status-pending-autopsy { background: #e1ecf0; color: #3d6574; }
.reports-status.status-pending-records { background: #e0ecee; color: #35626b; }
.reports-status.status-closed { background: #e9edec; color: #5c6c71; }
.reports-row-link { align-items: center; border: 1px solid #d5dfdd; border-radius: 7px; color: #547078; display: inline-flex; height: 27px; justify-content: center; text-decoration: none; width: 27px; }
.reports-row-link:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

@media (max-width: 1199.98px) {
  .reports-filter-grid, .reports-filter-grid:has(#report-county) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reports-search-field { grid-column: span 2; }
  .reports-page .report-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  .reports-page { padding-top: 1.4rem; }
  .reports-hero { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .reports-export-btn { width: 100%; justify-content: center; }
  .reports-filter-grid, .reports-filter-grid:has(#report-county) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-search-field { grid-column: 1 / -1; }
  .reports-run-btn { grid-column: 1 / -1; }
  .reports-insights-grid, .reports-breakdown-grid { grid-template-columns: 1fr; }
  .reports-page .report-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-section-title-row { align-items: flex-start; flex-direction: column; gap: .65rem; }
}
@media (max-width: 419.98px) {
  .reports-filter-card, .reports-panel { border-radius: 12px; }
  .reports-filter-grid, .reports-filter-grid:has(#report-county) { grid-template-columns: 1fr; }
  .reports-search-field { grid-column: auto; }
  .reports-page .report-kpi-card { min-height: 132px; padding: .85rem; }
  .report-kpi-label { font-size: .7rem; }
  .reports-page .report-kpi-value { font-size: 1.7rem; }
}

/* Global application shell */
.app-shell-container {
  margin-inline: auto;
  max-width: 1380px;
  padding-inline: clamp(1rem, 2.6vw, 2.25rem);
  width: 100%;
}
.app-navbar {
  background: rgba(251, 252, 252, .96) !important;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(24, 40, 47, .035);
  min-height: 72px;
  padding: 0;
  backdrop-filter: blur(12px);
}
.app-navbar > .app-shell-container { align-items: center; display: flex; }
.app-brand { align-items: center; display: inline-flex; gap: .7rem; margin-right: 2rem; padding: .8rem 0; text-decoration: none; }
.app-brand-mark { align-items: center; background: #356d78; border-radius: 10px; color: #fff; display: inline-flex; flex: 0 0 auto; height: 38px; justify-content: center; overflow: hidden; width: 38px; }
.app-brand-mark svg { fill: none; height: 20px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; width: 20px; }
.app-brand-mark.has-logo { background: #fff; border: 1px solid var(--border); }
.app-brand-mark img { height: 100%; object-fit: contain; width: 100%; }
.app-brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.app-brand-copy strong { color: #1a3139; font-size: .91rem; font-weight: 750; letter-spacing: -.015em; }
.app-brand-copy small { color: #7a898e; font-size: .62rem; letter-spacing: .035em; margin-top: .2rem; text-transform: uppercase; }
.app-primary-nav { align-items: center; gap: .18rem; }
.app-navbar .app-primary-nav .nav-link { border-radius: 8px; color: #52666c !important; font-size: .8rem; font-weight: 700; padding: .48rem .72rem; position: relative; }
.app-navbar .app-primary-nav .nav-link:hover { background: #f0f5f4; color: #285a64 !important; }
.app-navbar .app-primary-nav .nav-link.active { background: #e5eff0; color: #285a64 !important; }
.app-account-menu { margin-left: 1.5rem; }
.app-account-button { align-items: center; background: transparent; border: 0; border-radius: 10px; color: #253d44; display: flex; gap: .58rem; padding: .38rem .45rem; text-align: left; }
.app-account-button:hover, .app-account-button[aria-expanded="true"] { background: #f0f5f4; }
.app-account-button::after { color: #819095; margin-left: .25rem; }
.app-account-avatar { align-items: center; background: #dce9e9; border: 1px solid #c5d9d9; border-radius: 9px; color: #2d626b; display: inline-flex; font-size: .78rem; font-weight: 800; height: 34px; justify-content: center; width: 34px; }
.app-account-copy { display: flex; flex-direction: column; line-height: 1.1; max-width: 135px; }
.app-account-copy strong { font-size: .73rem; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-account-copy small { color: #7b8b90; font-size: .61rem; margin-top: .18rem; }
.app-account-dropdown { border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(24, 40, 47, .12); margin-top: .55rem !important; min-width: 230px; padding: .45rem; }
.app-account-dropdown .dropdown-item { border-radius: 7px; color: #3e555c; font-size: .78rem; font-weight: 600; padding: .55rem .65rem; }
.app-account-dropdown .dropdown-item:hover { background: #edf3f2; color: #285a64; }
.app-dropdown-identity { display: flex; flex-direction: column; padding: .45rem .65rem .2rem; }
.app-dropdown-identity strong { color: #263e45; font-size: .78rem; }
.app-dropdown-identity span { color: #7b8b90; font-size: .68rem; margin-top: .15rem; overflow: hidden; text-overflow: ellipsis; }
.app-account-dropdown .dropdown-divider { border-color: var(--border); margin: .35rem 0; }
.app-account-dropdown form { margin: 0; }
.app-account-dropdown .app-logout-item { color: #8e3d44; width: 100%; }
.app-nav-toggler { border: 1px solid var(--border); border-radius: 9px; box-shadow: none !important; padding: .38rem .5rem; }
.app-nav-toggler .navbar-toggler-icon { height: 1.2em; width: 1.2em; }
.app-main { min-height: calc(100vh - 150px); padding-block: 2rem 1rem; }
.app-main .reports-page { padding-top: 0; }
.app-alert { border-radius: 10px; font-size: .84rem; margin: -1rem 0 1rem; }
.app-footer { color: #73858a; font-size: .72rem; padding: 1.5rem 0 2rem; text-align: center; }
.app-footer .app-shell-container { border-top: 1px solid var(--border); padding-top: 1.25rem; }

@media (max-width: 991.98px) {
  .app-navbar { min-height: 64px; }
  .app-brand { padding: .65rem 0; }
  .app-brand-mark { border-radius: 9px; height: 35px; width: 35px; }
  .app-navbar .navbar-collapse { border-top: 1px solid var(--border); margin-top: .25rem; padding: .65rem 0 .9rem; width: 100%; }
  .app-navbar > .app-shell-container { flex-wrap: wrap; }
  .app-primary-nav { align-items: stretch; gap: .15rem; }
  .app-navbar .app-primary-nav .nav-link { padding: .65rem .75rem; }
  .app-account-menu { border-top: 1px solid var(--border); margin: .5rem 0 0; padding-top: .65rem; }
  .app-account-button { width: 100%; }
  .app-account-copy { max-width: none; }
  .app-account-button::after { margin-left: auto; }
  .app-account-dropdown { width: 100%; }
}
@media (max-width: 575.98px) {
  .app-shell-container { padding-inline: .8rem; }
  .app-brand-copy small { display: none; }
  .app-main { padding-top: 1.25rem; }
  .app-alert { margin-top: -.5rem; }
}
