/* ============================================================
   Exam Normalizer — Admin UI
   Dark theme matching the application admin shell.
   ============================================================ */

/* Ensure the HTML `hidden` attribute works even when a display rule is set
   via a class (e.g. .suggest-status-badge { display: inline-flex }).
   Without this, author CSS overrides the UA stylesheet's display:none. */
[hidden] { display: none !important; }

:root {
  --bg:          #0d0f10;
  --surface:     #1a1c1e;
  --surface-2:   #212427;
  --border:      #2d3035;
  --text:        #e8eaed;
  --muted:       #9aa0a6;
  --accent:      #1a73e8;
  --accent-hover:#1557b0;
  --accent-bg:   rgba(26, 115, 232, 0.12);
  --green:       #34a853;
  --amber:       #fbbc04;
  --red:         #ea4335;

  --topbar-h:    64px;
  --tabbar-h:    40px;
  --toolbar-h:   48px;
  --footer-h:    44px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Back arrow button — teal rounded square matching app style */
.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #1a8a87;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.back-btn:hover { background: #147070; }

.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.health-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.3s;
}
.health-dot.ok  { background: var(--green); }
.health-dot.err { background: var(--red); }

/* ── User access ───────────────────────────────────────────── */
.user-access-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px;
}

.user-id-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.user-id-input {
  width: 130px !important;
}

.user-access-text {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-access-text.ok  { color: var(--green); }
.user-access-text.err { color: var(--red); }

.action-bar-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  cursor: default;
}

.action-bar-select {
  height: 26px;
  padding: 0 6px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  width: 64px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.action-bar-select:focus { border-color: var(--accent); outline: none; }
.action-bar-select.ai-working {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(52,168,83,0.2);
}

/* ── Tab bar ───────────────────────────────────────────────── */
.tabbar {
  height: var(--tabbar-h);
  display: flex;
  align-items: flex-end;
  padding: 0 20px;
  gap: 2px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab {
  height: 36px;
  padding: 0 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover       { color: var(--text); }
.tab.active      { color: var(--text); border-bottom-color: var(--accent); }

/* ── Action bar (upload / refresh / pending) ───────────────── */
.action-bar {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.action-bar-spacer { flex: 1; }

/* ── Filter toolbar ────────────────────────────────────────── */
.toolbar {
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.toolbar-spacer { flex: 1; }

.toolbar-input,
.toolbar-select {
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 0 10px;
  outline: none;
  transition: border-color 0.15s;
}
.toolbar-input          { width: 200px; }
.toolbar-input::placeholder { color: var(--muted); }
.toolbar-date           { width: 130px; padding: 0 6px; }
.toolbar-select         { cursor: pointer; padding-right: 6px; }
#groupFilter,
#facilityFilter         { max-width: 162px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar-input:focus,
.toolbar-select:focus   { border-color: var(--accent); }
.toolbar-select option  { background: var(--surface-2); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  height: 30px;
  padding: 0 14px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s;
}
.btn.btn-sm      { height: 26px; padding: 0 10px; font-size: 11px; }
.btn:disabled    { opacity: 0.4; cursor: default; }

.btn-primary                    { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:not(:disabled):hover { background: var(--border); }
.btn.btn-active,
.btn.btn-active:hover               { background: var(--accent); color: #fff; }

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-icon:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-2);
}

/* Pending count badge on Apply button */
.badge {
  display: inline-block;
  background: var(--amber);
  color: #000;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Table container ───────────────────────────────────────── */
.table-wrap {
  flex: 1;
  overflow: auto;
  /* Guarantees genuine scrollable room below the last row for the CPT combo's
     dropdown (.cpt-combo-list, max-height: 240px) to open into. Without this,
     the last row sits flush with table-wrap's own scroll boundary, leaving no
     real space below it — forcing the dropdown to rely on a window.innerHeight
     flip calculation that can miscalculate right at that exact edge. */
  padding-bottom: 240px;
}

.table-wrap::-webkit-scrollbar        { width: 6px; height: 6px; }
.table-wrap::-webkit-scrollbar-track  { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }

/* ── Data table ────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover td { background: var(--surface-2); }

/* Column widths */
.col-facility { width: 160px; }
.col-raw      { width: 230px; }
.col-current  { width: 190px; }
.col-oprid    { width: 110px; }
.col-mapto    { width: 210px; }
.col-ignore   { width: 54px; text-align: center; vertical-align: middle; }
.col-actions  { width: 96px; text-align: center; }

/* Ignored rows */
.row-ignored td { opacity: 0.45; }
.row-ignored:hover td { opacity: 0.65; background: var(--surface-2); }

.row-locked td { opacity: 0.45; }
.row-locked:hover td { opacity: 0.65; background: var(--surface-2); }

.suggest-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.suggest-status-badge.processing { background: #fff3cd; color: #856404; }
.suggest-status-badge.ready      { background: #d1e7dd; color: #0f5132; }
.suggest-status-badge.ok         { background: #d1e7dd; color: #0f5132; }
.suggest-status-badge.err        { background: #f8d7da; color: #842029; }

/* Active ignore button — highlighted when ignore=true */
.btn-ignore-active {
  color: var(--red) !important;
  border-color: var(--red) !important;
  background: rgba(234, 67, 53, 0.1);
}

/* Section separator rows (Needs Mapping / Mapped) */
.section-row td {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border-bottom: none;
}
.section-row:hover td { background: var(--bg) !important; }

/* Loading / empty state rows */
.state-row td {
  text-align: center;
  color: var(--muted);
  padding: 48px 12px;
}
.state-row:hover td { background: transparent !important; }

/* Status dots */
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
.dot-ok     { background: var(--green); }
.dot-warn   { background: var(--amber); }
.dot-ignore { background: var(--muted); }

/* Text helpers */
.truncate {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}
.cell-muted {
  color: var(--muted);
  font-style: italic;
}
.opr-id {
  cursor: pointer;
  font-family: monospace;
  font-size: 12px;
  white-space: nowrap;
}
.opr-id:hover {
  text-decoration: underline;
}
.opr-id-label {
  color: var(--muted);
  font-size: 10px;
  margin-right: 4px;
}

/* Inline map-to select */
.map-select {
  width: 100%;
  height: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 0 6px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.map-select:focus           { border-color: var(--accent); }
.map-select.pending         { border-color: var(--amber); }
.map-select option          { background: var(--surface-2); }

/* ── CPT combo box ─────────────────────────────────────────── */
.cpt-combo {
  position: relative;
  width: 100%;
}

.cpt-combo-input {
  width: 100%;
  height: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 0 6px;
  outline: none;
  cursor: text;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.cpt-combo-input:focus         { border-color: var(--accent); }
.cpt-combo-input:disabled      { opacity: 0.45; cursor: default; }
.cpt-combo.pending .cpt-combo-input { border-color: var(--amber); }

.cpt-combo-list {
  display: none;
  position: fixed;
  z-index: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  max-height: 240px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 2px 0;
  min-width: 260px;
}

.cpt-combo-list::-webkit-scrollbar       { width: 5px; }
.cpt-combo-list::-webkit-scrollbar-track { background: transparent; }
.cpt-combo-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.cpt-combo-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.cpt-combo-item:hover,
.cpt-combo-item.active   { background: var(--accent-bg); }
.cpt-combo-item.selected { background: rgba(26,115,232,0.18); }

.cpt-combo-code {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.cpt-combo-name {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.cpt-combo-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ── Pagination footer ─────────────────────────────────────── */
.pagination {
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.page-info {
  font-size: 12px;
  color: var(--muted);
  min-width: 180px;
  text-align: center;
}

.vs-spacer td { padding: 0 !important; border: 0 !important; }

/* ── Upload modal ──────────────────────────────────────────── */
.modal-wide { width: 660px; }

.upload-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.upload-step:last-child { border-bottom: none; }

.upload-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.upload-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.upload-hint code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  color: var(--text);
}

.upload-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-file-name {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}
.upload-file-name.ready { color: var(--green); font-style: normal; }

.upload-preview-scroll {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 6px;
}
.upload-preview-scroll::-webkit-scrollbar       { width: 5px; height: 5px; }
.upload-preview-scroll::-webkit-scrollbar-track { background: transparent; }
.upload-preview-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.upload-preview-table { margin: 0; table-layout: auto; }
.upload-preview-table th { font-size: 10px; white-space: nowrap; }
.upload-preview-table td { font-size: 11px; word-break: break-word; }

.upload-status {
  flex: 1;
  font-size: 12px;
  padding-right: 8px;
}
.upload-status.ok  { color: var(--green); }
.upload-status.err { color: var(--red); }


/* ── Upload validation errors ──────────────────────────────── */
.upload-validation-label {
  color: var(--red) !important;
  display: block;
  margin-bottom: 4px;
}

.upload-validation-scroll {
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--red);
  border-radius: 4px;
  margin-top: 4px;
}
.upload-validation-scroll::-webkit-scrollbar       { width: 5px; height: 5px; }
.upload-validation-scroll::-webkit-scrollbar-track { background: transparent; }
.upload-validation-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Validation table reuses .upload-preview-table sizing */
.upload-validation-table td,
.upload-validation-table th { font-size: 11px; }

/* Value cell — truncate long raw values */
.val-cell-value {
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--amber);
}

/* Error message cell */
.val-cell-msg { color: var(--red); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 500px;
  max-width: 96vw;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 14px;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.form-value {
  font-size: 13px;
  color: var(--text);
  padding: 2px 0;
}

.form-select {
  height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 0 10px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.form-select:focus  { border-color: var(--accent); }
.form-select option { background: var(--surface-2); }

/* ── AI CPT suggestions ──────────────────────────────────────── */
.suggest-spinner { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }

.suggest-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.suggest-item:hover    { border-color: var(--accent); background: var(--surface); }
.suggest-item.selected { border-color: var(--accent); background: var(--accent-bg); }

.suggest-code { font-size: 12px; font-weight: 600; color: var(--accent); min-width: 52px; }
.suggest-name { font-size: 12px; color: var(--text); flex: 1; }

.suggest-conf { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 6px; border-radius: 3px; }
.suggest-conf-high   { background: rgba(52, 168, 83, 0.18);  color: var(--green); }
.suggest-conf-medium { background: rgba(251, 188, 4, 0.18);  color: #c8960a; }
.suggest-conf-low    { background: rgba(128, 128, 128, 0.18); color: var(--muted); }
.suggest-error { font-size: 11px; color: var(--red); font-style: italic; }

/* Inline suggest row (expanded below each unmapped procedure row) */
.suggest-expand-row td {
  padding: 0 12px 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
/* ── CPT group-scope badges ────────────────────────────────── */
.cpt-group-match {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  background: rgba(26, 115, 232, 0.15);
  color: var(--accent);
  vertical-align: middle;
  white-space: nowrap;
}
.cpt-group-mismatch {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  background: rgba(234, 67, 53, 0.15);
  color: var(--red);
  vertical-align: middle;
  white-space: nowrap;
}

.suggest-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
}
.suggest-inline-list .suggest-item {
  flex: 0 1 auto;
  max-width: 380px;
}
.suggest-reason { font-size: 11px; color: var(--muted); flex: 1 1 100%; margin-top: 2px; }

/* Suggest toggle button */
.btn-suggest       { color: var(--accent); margin-left: 4px; }
.btn-suggest-ready { color: var(--green); }

/* Order Processing rule out-of-sync badge -- one per variant (hl7/dicom),
   so the label needs to fit "H⚠"/"D⚠" rather than a single glyph. */
.btn-rule-outofsync { color: var(--red); margin-left: 4px; font-size: 11px; font-weight: 700; }

.form-input {
  height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 0 10px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--accent); }

.form-required { color: var(--danger, #e05); margin-left: 2px; }
.form-hint     { font-size: 11px; color: var(--muted); }

/* ── Stub conflict resolution box ───────────────────────────── */
.conflict-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--danger, #c0392b);
  border-radius: 6px;
  background: color-mix(in srgb, var(--danger, #c0392b) 8%, var(--surface));
}
.conflict-title    { font-weight: 600; font-size: 14px; color: var(--danger, #c0392b); margin: 0; }
.conflict-msg      { font-size: 13px; margin: 0; }
.conflict-existing { font-size: 13px; font-weight: 500; font-style: italic; margin: 0; padding: 8px; background: var(--surface-2); border-radius: 4px; }
.conflict-hint     { font-size: 12px; color: var(--muted); margin: 0; }
.conflict-actions  { display: flex; gap: 10px; }

/* ── Error page ─────────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 70vh;
  gap: 14px;
  text-align: center;
  padding: 32px;
}
.error-page-icon  { font-size: 52px; color: var(--warning, #f59e0b); line-height: 1; }
.error-page-title { font-size: 22px; font-weight: 600; margin: 0; color: var(--text); }
.error-page-body  { font-size: 14px; color: var(--muted); margin: 0; max-width: 420px; }
.error-page-hint  { font-size: 13px; color: var(--muted); margin: 0; }
.error-page-hint code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--border);
}

/* ── Checkbox selection column ─────────────────────────────── */
.col-check { width: 52px; text-align: center; }
.col-check input[type=checkbox] { accent-color: var(--accent); cursor: pointer; }
.sel-all-links { display: flex; justify-content: center; gap: 2px; margin-top: 3px; line-height: 1; }
.sel-all-links span { font-size: 10px; font-weight: normal; color: var(--accent); cursor: pointer; }
.sel-all-links span:hover { text-decoration: underline; }
.sel-link-sep { color: var(--muted) !important; cursor: default !important; }

/* ── Modality name read-only column ────────────────────────── */
.col-modality-name { width: 88px; }

/* ── Selected row highlight ────────────────────────────────── */
.row-selected td { background: rgba(26,115,232,0.10) !important; }

/* ── Bulk action bar ───────────────────────────────────────── */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 38px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.bulk-bar.visible { display: flex; }

.bulk-bar-count {
  font-size: 12px;
  color: var(--muted);
  margin-right: 4px;
  white-space: nowrap;
  min-width: 80px;
}

/* Danger / destructive action button */
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:not(:disabled):hover { background: #c5221f; }

/* Amber / warning action button */
.btn-amber { background: var(--amber); color: #000; }
.btn-amber:not(:disabled):hover { background: #e0a800; }

/* ── Demote facility multiselect ───────────────────────────── */
.multiselect-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}
.multiselect-list::-webkit-scrollbar       { width: 5px; }
.multiselect-list::-webkit-scrollbar-track { background: transparent; }
.multiselect-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}
.multiselect-item:hover { background: var(--accent-bg); }
#float-tooltip {
  position: fixed;
  background: #333;
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  display: none;
}
.multiselect-item input[type=checkbox] {
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.multiselect-select-all {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 10px;
}
.multiselect-select-all button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.multiselect-select-all button:hover { text-decoration: underline; }

/* ── Apply confirm count ───────────────────────────────────── */
.confirm-count {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  padding: 12px 0 2px;
}
.confirm-count-label {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 4px;
}

/* ── Login overlay ─────────────────────────────────────────── */
.login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #08080e;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.login-overlay--visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Background SVG — centred, 60% of overlay */
.login-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 60%;
  object-fit: contain;
  pointer-events: none;
}

/* Subtle dark veil over the background to improve text contrast */
.login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 14, 0.45);
  pointer-events: none;
}

/* Login card */
.login-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 400px;
}

.login-brand { width: 100%; text-align: center; }

.login-logo {
  height: 88px;
  width: auto;
  display: block;
  margin: 0 auto 6px;
  filter: invert(1);
}

.login-step { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.login-title { display: none; }

.login-label {
  font-size: 18px;
  font-weight: 500;
  color: #d7e6f5;
  letter-spacing: 0.03em;
  display: block;
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  background: #37393d;
  border: 1px solid #313131;
  border-radius: 6px;
  color: #d7e6f5;
  font-size: 14px;
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.login-input::placeholder { color: #9da4ab; }
.login-input[readonly] { color: rgba(215, 230, 245, 0.5); cursor: default; }
.login-input:focus { border-color: #9da4ab; }

.login-btn {
  width: 100%;
  background: #1f3c48;
  border: none;
  border-radius: 6px;
  color: #d7e6f5;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  padding: 10px;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.02em;
}
.login-btn:hover { background: #2f5260; }

.login-sub-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.login-text-btn {
  background: none;
  border: none;
  color: rgba(215, 230, 245, 0.55);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.login-text-btn:hover { color: #d7e6f5; }
#loginNewUserBtn { margin-left: auto; }

.login-error {
  width: 100%;
  box-sizing: border-box;
  background: rgba(234, 67, 53, 0.15);
  border: 1px solid rgba(234, 67, 53, 0.4);
  border-radius: 6px;
  color: #ff7b6e;
  font-size: 12px;
  padding: 9px 12px;
}

/* ── Session info (header) ─────────────────────────────────── */
.session-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.session-user {
  font-size: 12px;
  color: var(--muted);
}
