/* ============================================================
   Document Vault module
   ============================================================ */

/* --- Primary organization bar (top of the Browse view) ---------------- */
.vault-org-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface-2, #f5f6f8);
  border: 1px solid var(--border, #d6dadf);
  border-radius: 10px;
  margin: 0 0 12px;
}
.vault-org-bar label {
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #6b7280);
  font-weight: 700;
  white-space: nowrap;
}
.vault-org-bar select {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 8px 10px;
  border: 1px solid var(--border, #d6dadf);
  border-radius: 8px;
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-weight: 500;
  background: var(--surface, #fff);
  color: inherit;
}
.vault-selection-hint {
  font-size: calc(11px * var(--ui-font-scale, 1));
  color: var(--muted, #6b7280);
}

/* --- Secondary filters ------------------------------------------------- */
.vault-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
}
.vault-filters select,
.vault-filters input[type="month"] {
  padding: 7px 10px;
  border: 1px solid var(--border, #d6dadf);
  border-radius: 8px;
  font-size: calc(12px * var(--ui-font-scale, 1));
  background: var(--surface, #fff);
  color: inherit;
  min-width: 140px;
}
.vault-doc-count {
  margin-left: auto;
  font-size: calc(11px * var(--ui-font-scale, 1));
  color: var(--muted, #6b7280);
}

/* --- Documents table --------------------------------------------------- */
.vault-table-wrap {
  border: 1px solid var(--border, #d6dadf);
  border-radius: 10px;
  overflow: auto;
  background: var(--surface, #fff);
}
.vault-table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(12px * var(--ui-font-scale, 1));
}
.vault-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2, #f5f6f8);
  text-align: left;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #d6dadf);
  white-space: nowrap;
  z-index: 1;
}
.vault-table tbody tr {
  border-bottom: 1px solid var(--border-soft, #eef0f3);
}
.vault-table tbody tr:hover { background: var(--hover, #f8f9fb); }
.vault-table td {
  padding: 10px 12px;
  vertical-align: top;
}
.vault-table .c-num { white-space: nowrap; }
.vault-table .c-date { white-space: nowrap; color: var(--muted, #6b7280); font-size: calc(11px * var(--ui-font-scale, 1)); }
.vault-table .c-actions { text-align: right; white-space: nowrap; width: 260px; }
.vault-table .c-actions .btn + .btn { margin-left: 6px; }
.vault-empty {
  text-align: center;
  padding: 32px 12px !important;
  color: var(--muted, #6b7280);
}
.vault-cat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3, #eef2fb);
  color: var(--text, #2f4478);
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  font-weight: 600;
  white-space: nowrap;
}

/* --- Upload form ------------------------------------------------------- */
.vault-upload-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 780px;
}
@media (max-width: 700px) {
  .vault-upload-form { grid-template-columns: 1fr; }
}
.vault-upload-form .full { grid-column: 1 / -1; }
.vault-upload-form label {
  display: block;
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted, #6b7280);
  font-weight: 600;
  margin-bottom: 4px;
}
.vault-upload-form select,
.vault-upload-form input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border, #d6dadf);
  border-radius: 8px;
  font-size: calc(12px * var(--ui-font-scale, 1));
  font-family: inherit;
  background: var(--surface, #fff);
  color: inherit;
}
.vault-upload-form input[type="file"] { padding: 6px; }
.vault-upload-hint {
  font-size: calc(11px * var(--ui-font-scale, 1));
  color: var(--muted, #6b7280);
  margin-top: 4px;
}
.vault-upload-actions { display: flex; gap: 8px; margin-top: 8px; }

/* --- Manage cards (orgs / facilities / categories / keyword lists) ----
   Stacked vertically — one full-width section per dictionary so each has
   room for its own add-entry form and list. */
.vault-manage-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 860px;
}
.vault-kw-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.vault-kw-form #vaultKwKeywords { grid-column: 1 / -1; }
.vault-kw-form input[type="text"] {
  padding: 6px 8px;
  border: 1px solid var(--border, #d5d9e0);
  border-radius: 6px;
  font: inherit;
}
.vault-kw-billable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: calc(11px * var(--ui-font-scale, 1));
  color: var(--muted, #6b7280);
}
.vault-kw-form button[type="submit"] { justify-self: end; }
.vault-kw-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.vault-kw-actions { display: inline-flex; gap: 4px; flex-shrink: 0; }
.vault-kw-seed {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #22754a;
  color: #fff;
  font-size: calc(9.5px * var(--ui-font-scale, 1));
  font-weight: 700;
  margin-left: 6px;
}

/* Sub-facilities nested under each facility. */
.vault-fac-block {
  display: block !important;
  padding: 8px 10px !important;
  border: 1px solid var(--border-soft, #eef0f3);
  border-radius: 8px;
  background: #fafbfc;
  margin-bottom: 8px;
}
.vault-fac-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.vault-subfac-list {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}
.vault-subfac {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 6px;
  border-top: 1px dashed #e2e8f0;
  font-size: calc(11px * var(--ui-font-scale, 1));
}
.vault-subfac:first-child { border-top: 0; }
.vault-subfac-name { color: #1e293b; font-weight: 500; }
.vault-subfac-inactive .vault-subfac-name {
  color: #94a3b8;
  text-decoration: line-through;
}
.vault-subfac-actions { display: inline-flex; gap: 6px; align-items: center; flex-shrink: 0; }
.vault-subfac-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  color: #475569;
  cursor: pointer;
}
.vault-subfac-empty {
  padding: 4px 6px;
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  color: #94a3b8;
  font-style: italic;
}
.vault-subfac-add {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
}
.vault-subfac-add input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--border, #d6dadf);
  border-radius: 6px;
  font-size: calc(11px * var(--ui-font-scale, 1));
}
.vault-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d6dadf);
  border-radius: 10px;
  padding: 14px 16px;
}
.vault-card h3 {
  margin: 0 0 8px;
  font-size: calc(11px * var(--ui-font-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted, #6b7280);
}
.vault-card form {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.vault-card input,
.vault-card select {
  flex: 1;
  min-width: 100px;
  padding: 7px 9px;
  border: 1px solid var(--border, #d6dadf);
  border-radius: 6px;
  font-size: calc(12px * var(--ui-font-scale, 1));
  background: var(--surface, #fff);
  color: inherit;
}
.vault-inline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
}
.vault-inline-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 0;
  border-top: 1px solid var(--border-soft, #eef0f3);
  font-size: calc(12px * var(--ui-font-scale, 1));
}
.vault-inline-list li:first-child { border-top: 0; }
.vault-item-name { flex: 1; min-width: 0; }
.vault-item-hint {
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  color: var(--muted, #6b7280);
  margin-left: 4px;
}
.vault-empty-inline {
  color: var(--muted, #6b7280);
  font-size: calc(11px * var(--ui-font-scale, 1));
  padding: 6px 0;
}

/* --- Viewer modal ----------------------------------------------------- */
/* The shared .modal-body sets `overflow: hidden`, which was clipping the
   XLSX preview so wide sheets couldn't scroll horizontally. We flip it to
   auto for the vault viewer specifically, and give a stable min-height so
   the inner XLSX flex layout has room to grow. */
.vault-viewer-body {
  padding: 0;
  background: var(--surface-2, #f5f6f8);
  overflow: auto;
  max-height: 82vh;
  min-height: 480px;
}
.vault-viewer-body iframe {
  display: block;
  width: 100%;
  height: 78vh;
  border: 0;
  background: var(--surface, #fff);
}
.vault-viewer-body img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  margin: 0 auto;
}
.vault-viewer-body pre {
  margin: 0;
  padding: 20px;
  max-height: 78vh;
  overflow: auto;
  background: var(--surface, #fff);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: calc(11px * var(--ui-font-scale, 1));
  white-space: pre-wrap;
  word-wrap: break-word;
}
.vault-viewer-fallback {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted, #6b7280);
}
.vault-viewer-actions {
  margin-top: 14px;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* DOCX — mammoth renders semantic HTML, we just give it document-like
   typography inside the modal. */
.vault-viewer-docx {
  padding: 24px 32px;
  max-height: 78vh;
  overflow: auto;
  background: var(--surface, #fff);
  color: var(--text, #1f2937);
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.55;
}
.vault-viewer-docx h1,
.vault-viewer-docx h2,
.vault-viewer-docx h3 { margin: 1em 0 0.4em; font-weight: 600; }
.vault-viewer-docx p { margin: 0.6em 0; }
.vault-viewer-docx table {
  border-collapse: collapse;
  margin: 0.8em 0;
  font-size: calc(12px * var(--ui-font-scale, 1));
}
.vault-viewer-docx th,
.vault-viewer-docx td {
  border: 1px solid var(--border, #d6dadf);
  padding: 5px 8px;
  vertical-align: top;
}

/* XLSX — SheetJS produces its own HTML tables; we frame it with tabs.
   The container fills the modal body so the sheet body's `overflow: auto`
   yields both scroll bars for wide/tall workbooks. */
.vault-viewer-xlsx {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 480px;
  background: var(--surface, #fff);
}
.vault-sheet-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, #d6dadf);
  background: var(--surface-2, #f5f6f8);
  overflow-x: auto;
  flex: 0 0 auto;
}
.vault-sheet-tab {
  border: 1px solid var(--border, #d6dadf);
  background: var(--surface, #fff);
  color: inherit;
  border-radius: 6px 6px 0 0;
  padding: 5px 12px;
  font-size: calc(11px * var(--ui-font-scale, 1));
  cursor: pointer;
  white-space: nowrap;
}
.vault-sheet-tab.active {
  background: var(--primary, #22754a);
  color: #fff;
  border-color: transparent;
}
.vault-sheet-body {
  flex: 1 1 auto;
  min-height: 0;      /* let it shrink so scrollbars appear inside flex */
  overflow-x: auto;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: calc(11px * var(--ui-font-scale, 1));
  background: var(--surface, #fff);
}
.vault-sheet-body table {
  border-collapse: collapse;
  font-size: calc(11px * var(--ui-font-scale, 1));
  /* Force table width to its content so the horizontal scrollbar activates
     when there are many columns. Without this Chrome sometimes collapses
     wide tables to fit the container and drops the horizontal scroll. */
  width: max-content;
  min-width: 100%;
}
.vault-sheet-body td,
.vault-sheet-body th {
  border: 1px solid var(--border, #d6dadf);
  padding: 4px 8px;
  white-space: nowrap;
  vertical-align: top;
  max-width: 320px;   /* extra-wide cells get an ellipsis instead of pushing */
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-sheet-body th {
  position: sticky;
  top: 0;
  background: var(--surface-2, #f5f6f8);
  z-index: 1;
}

/* --- Upload: file-by-patient verification --------------------------- */
.vault-optional { font-weight: 400; color: var(--muted, #9ca3af); font-size: calc(10.5px * var(--ui-font-scale, 1)); }
.vault-patient-verify { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vault-patient-verify input[type="text"] {
  flex: 1; min-width: 200px; padding: 8px 10px;
  border: 1px solid var(--border, #d5d9e0); border-radius: 6px; font: inherit;
}
.vault-patient-status { font-size: calc(11px * var(--ui-font-scale, 1)); font-weight: 600; }
.vault-patient-status.ok { color: #166534; }
.vault-patient-status.err { color: #b91c1c; }
.vault-patient-status.warn { color: #92400e; }

/* Patient-scoped categories (Census / Face Sheets / MAR / TAR) turn the
   Patient ID field into a hard requirement — make that unmissable. */
#vaultPatientField.is-required {
  border: 1px solid #e5c07b;
  background: #fffbeb;
  border-radius: 8px;
  padding: 10px 12px;
}
#vaultPatientField.is-required > label::after {
  content: ' *';
  color: #b91c1c;
  font-weight: 700;
}
.vault-patient-required-hint {
  margin-top: 8px;
  font-size: calc(11px * var(--ui-font-scale, 1));
  line-height: 1.5;
  color: #92400e;
}
.vault-patient-tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #f0faf4; color: #0f3d26; font-size: calc(10.5px * var(--ui-font-scale, 1)); font-weight: 600; white-space: nowrap;
}

/* --- Bulk MAR split toggle (UAT 11) ----------------------------------- */
.vault-bulk-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: calc(12px * var(--ui-font-scale, 1)); cursor: pointer;
}
.vault-bulk-toggle input { margin: 0; }

/* ============================================================
   Bulk upload (vault-bulk)
   ============================================================ */

.vb-card {
  border: 1px solid var(--border, #e2e5ea);
  border-radius: 10px;
  background: var(--surface, #fff);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.vb-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.vb-card-head h3 {
  margin: 0;
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-weight: 600;
}
.vb-card-head code {
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  background: var(--surface-2, #f5f6f8);
  padding: 1px 5px;
  border-radius: 4px;
}

/* --- File-type categories ------------------------------------------- */
.vb-typegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}
.vb-type {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 11px;
  border: 1px solid var(--border, #e2e5ea);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.vb-type:hover { border-color: var(--accent, #4763d0); }
.vb-type.active {
  border-color: var(--accent, #4763d0);
  background: var(--surface-3, #eef2fb);
}
.vb-type-empty { opacity: 0.55; }
.vb-type-icon {
  flex: 0 0 34px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--surface-3, #eef2fb);
  color: var(--text, #2f4478);
  font-size: calc(9.5px * var(--ui-font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.3px;
}
.vb-type-body { flex: 1; min-width: 0; }
.vb-type-label { display: block; font-size: calc(11px * var(--ui-font-scale, 1)); font-weight: 600; }
.vb-type-ext {
  display: block;
  font-size: calc(9.5px * var(--ui-font-scale, 1));
  color: var(--muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vb-type-count {
  flex: 0 0 auto;
  min-width: 22px;
  text-align: center;
  font-size: calc(11px * var(--ui-font-scale, 1));
  font-weight: 700;
  color: var(--muted, #6b7280);
}
.vb-type.active .vb-type-count,
.vb-type:not(.vb-type-empty) .vb-type-count { color: var(--accent, #4763d0); }

/* --- Intake --------------------------------------------------------- */
.vb-intake {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.2fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .vb-intake { grid-template-columns: 1fr; }
}
.vb-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 148px;
  padding: 20px;
  border: 2px dashed var(--border, #d6dadf);
  border-radius: 10px;
  background: var(--surface-2, #fafbfc);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s, background 0.12s;
}
.vb-drop:hover, .vb-drop-over {
  border-color: var(--accent, #4763d0);
  background: var(--surface-3, #eef2fb);
}
.vb-drop-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent, #4763d0);
  color: #fff;
  font-size: calc(17.5px * var(--ui-font-scale, 1));
  line-height: 1;
}
.vb-drop-main { font-size: calc(12px * var(--ui-font-scale, 1)); font-weight: 600; }
.vb-drop-sub { font-size: calc(11px * var(--ui-font-scale, 1)); color: var(--muted, #6b7280); }

.vb-defaults {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.vb-defaults label {
  display: block;
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted, #6b7280);
  font-weight: 600;
  margin-bottom: 4px;
}
.vb-defaults input[type="month"], .vb-defaults select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border, #d6dadf);
  border-radius: 7px;
  font: inherit;
  font-size: calc(12px * var(--ui-font-scale, 1));
  background: var(--surface, #fff);
  color: inherit;
}
.vb-learn-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: calc(12px * var(--ui-font-scale, 1)) !important;
  color: inherit !important;
  cursor: pointer;
}
.vb-learn-toggle input { margin: 0; }
.vb-defaults-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

/* --- Tabs ----------------------------------------------------------- */
.vb-tabs { display: inline-flex; gap: 4px; }
.vb-tab {
  padding: 5px 11px;
  border: 1px solid var(--border, #e2e5ea);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--muted, #6b7280);
  font: inherit;
  font-size: calc(11px * var(--ui-font-scale, 1));
  cursor: pointer;
}
.vb-tab.active {
  border-color: var(--accent, #4763d0);
  background: var(--surface-3, #eef2fb);
  color: var(--text, #2f4478);
  font-weight: 600;
}
.vb-tab-n { font-weight: 700; margin-left: 3px; }

/* --- Plan table ----------------------------------------------------- */
.vb-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #e2e5ea);
  border-radius: 8px;
}
.vb-table { width: 100%; border-collapse: collapse; font-size: calc(11px * var(--ui-font-scale, 1)); }
.vb-table thead th {
  position: sticky; top: 0;
  background: var(--surface-2, #f5f6f8);
  text-align: left;
  padding: 8px 10px;
  font-size: calc(9.5px * var(--ui-font-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #6b7280);
  border-bottom: 1px solid var(--border, #e2e5ea);
  white-space: nowrap;
  z-index: 1;
}
.vb-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-soft, #eef0f3);
  vertical-align: top;
}
.vb-table tbody tr:last-child td { border-bottom: 0; }
.vb-c-status { width: 26px; }
.vb-c-file { min-width: 280px; }
.vb-c-site { min-width: 230px; }
.vb-c-cat, .vb-c-patient { min-width: 165px; }
.vb-c-month { min-width: 135px; }

.vb-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-top: 4px;
}
.vb-row-ok .vb-dot { background: #16a34a; }
.vb-row-review .vb-dot { background: #d97706; }
.vb-row-review { background: #fffdf5; }

.vb-fname {
  font-weight: 600;
  word-break: break-word;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.vb-type-tag {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-3, #eef2fb);
  color: var(--text, #2f4478);
  font-size: calc(9px * var(--ui-font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.3px;
}
/* The parsed segments, colour-coded by the role the matcher gave each one —
   so it is visible *why* a file was filed the way it was. */
.vb-segs { margin-top: 4px; line-height: 1.9; }
.vb-seg {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2, #f2f3f5);
  color: var(--muted, #6b7280);
  font-size: calc(10px * var(--ui-font-scale, 1));
}
.vb-seg-sep { color: var(--muted, #c3c7cf); margin: 0 2px; font-size: calc(9.5px * var(--ui-font-scale, 1)); }
.vb-seg-site  { background: #e0f2fe; color: #075985; }
.vb-seg-org   { background: #ede9fe; color: #5b21b6; }
.vb-seg-cat   { background: #dcfce7; color: #166534; }
.vb-seg-month { background: #fef3c7; color: #92400e; }

.vb-issues {
  margin: 6px 0 0;
  padding-left: 15px;
  color: #92400e;
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  line-height: 1.5;
}

.vb-resolved { line-height: 1.5; }
.vb-resolved strong { font-size: calc(11px * var(--ui-font-scale, 1)); word-break: break-word; }
.vb-sub { color: var(--muted, #6b7280); font-size: calc(10.5px * var(--ui-font-scale, 1)); word-break: break-word; }
.vb-na { font-size: calc(10.5px * var(--ui-font-scale, 1)); color: var(--muted, #9ca3af); }
.vb-change {
  margin-top: 3px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent, #4763d0);
  font: inherit;
  font-size: calc(10.5px * var(--ui-font-scale, 1));
  cursor: pointer;
  text-decoration: underline;
}
/* Source of a match: dictionary hit, exact name, fuzzy guess, fallback. */
.vb-src {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: calc(9.5px * var(--ui-font-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: 1px;
  background: var(--surface-2, #f2f3f5);
  color: var(--muted, #6b7280);
}
.vb-src-alias { background: #ede9fe; color: #5b21b6; }
.vb-src-exact { background: #dcfce7; color: #166534; }
.vb-src-normalized, .vb-src-keyword { background: #e0f2fe; color: #075985; }
.vb-src-contains, .vb-src-similar, .vb-src-derived { background: #fef3c7; color: #92400e; }
.vb-src-default, .vb-src-manual { background: #f1f5f9; color: #475569; }

.vb-fix { display: flex; flex-direction: column; gap: 5px; }
.vb-input {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--border, #d6dadf);
  border-radius: 6px;
  font: inherit;
  font-size: calc(11px * var(--ui-font-scale, 1));
  background: var(--surface, #fff);
  color: inherit;
}
.vb-input-month { max-width: 150px; }
.vb-sugs { display: flex; flex-wrap: wrap; gap: 4px; }
.vb-sug {
  padding: 2px 7px;
  border: 1px dashed var(--accent, #4763d0);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--accent, #4763d0);
  font: inherit;
  font-size: calc(10px * var(--ui-font-scale, 1));
  cursor: pointer;
}
.vb-sug:hover { background: var(--surface-3, #eef2fb); }
.vb-sug-score { opacity: 0.6; margin-left: 3px; }
.vb-pstatus { font-size: calc(10.5px * var(--ui-font-scale, 1)); }
.vb-pstatus.err { color: #b91c1c; }

.vb-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* --- Result log ----------------------------------------------------- */
.vb-log { list-style: none; margin: 0; padding: 0; font-size: calc(11px * var(--ui-font-scale, 1)); }
.vb-log li {
  display: grid;
  grid-template-columns: 84px minmax(160px, 1fr) 2fr;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--border-soft, #eef0f3);
  align-items: baseline;
}
.vb-log li:first-child { border-top: 0; }
.vb-log-status {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: calc(9.5px * var(--ui-font-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
}
.vb-log-filed .vb-log-status { background: #dcfce7; color: #166534; }
.vb-log-duplicate .vb-log-status { background: #fef3c7; color: #92400e; }
.vb-log-rejected .vb-log-status,
.vb-log-missing .vb-log-status { background: #fee2e2; color: #991b1b; }
.vb-log-failed .vb-log-status { background: #fecaca; color: #7f1d1d; }
.vb-log-name { font-weight: 600; word-break: break-word; }
.vb-log-msg { color: var(--muted, #6b7280); word-break: break-word; }

/* --- Filename-alias dictionary card (vault-manage) ------------------- */
.vault-alias-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.vault-alias-form input[type="text"] { grid-column: 1 / -1; }
.vault-alias-form select { min-width: 0; }
.vault-alias-form button[type="submit"] { justify-self: end; }
.vault-alias-text { font-weight: 600; }
.vault-alias-arrow { color: var(--muted, #9ca3af); margin: 0 5px; }
.vault-alias-target { color: var(--text, #2f4478); }
.vb-log-actions { display: inline-flex; gap: 6px; }
/* A file type that carries a default category announces it, so an unlabelled
   workbook coming out as Billing Workflow is never a surprise. */
.vb-type-default {
  display: block;
  margin-top: 2px;
  font-size: calc(9.5px * var(--ui-font-scale, 1));
  line-height: 1.35;
  color: var(--accent, #4763d0);
}
.vb-src-file_type { background: #e0f2fe; color: #075985; }

/* ---- what the file says it is (P-08) ---------------------------------- */
.vault-classify {
  margin-top: 6px;
  font-size: calc(11.5px * var(--ui-font-scale, 1));
  color: var(--text-muted);
  line-height: 1.5;
}
.vault-classify.is-match {
  color: var(--success);
  font-weight: 500;
}
