/* Risk Manager — styled to match the BIDS / Beneficient visual language:
   light theme, navy header, Segoe UI, white cards, ben-blue accents. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ben-navy:   #0a2240;
  --ben-blue:   #1a4f8a;
  --ben-accent: #2e80ce;
  --ben-light:  #e8f0f8;
  --green:      #1a7a4a;  --green-bg:  #e6f4ed;
  --amber:      #b45309;  --amber-bg:  #fef3c7;
  --orange:     #c2410c;  --orange-bg: #ffedd5;
  --red:        #b91c1c;  --red-bg:    #fee2e2;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-600:   #475569;
  --gray-800:   #1e293b;
  --radius:     8px;
  --shadow:     0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
}
.hidden { display: none !important; }
a { color: var(--ben-accent); }
.muted { color: var(--gray-600); }
.spacer { flex: 1; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Header ──────────────────────────────────────────────────── */
.app-header {
  background: var(--ben-navy); color: #fff; padding: 0 24px; height: 56px;
  display: flex; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.25);
  position: sticky; top: 0; z-index: 100;
}
.header-inner { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.header-title { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 500; }
.logo { font-weight: 800; font-size: 18px; color: #60aeff; letter-spacing: .08em; }
.header-sep { color: #3a5f8a; }
.header-nav { display: flex; gap: 8px; }
.btn-nav {
  font-size: 12px; font-weight: 600; color: #a8d4ff; background: transparent;
  padding: 6px 14px; border: 1px solid rgba(168,212,255,.3); border-radius: 6px;
  letter-spacing: .02em; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.btn-nav:hover { color: #fff; border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.08); }
.btn-nav.active { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.12); }
.header-right { display: flex; align-items: center; gap: 14px; }
.user-pill {
  display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12); border-radius: 99px; padding: 4px 12px 4px 4px;
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--ben-accent); color: #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 13px; color: #d0e8ff; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout {
  font-size: 12px; color: #8ab4d8; text-decoration: none; border-left: 1px solid rgba(255,255,255,.15);
  padding-left: 12px; cursor: pointer; transition: color .15s;
}
.btn-logout:hover { color: #fff; }

main { max-width: 1600px; margin: 0 auto; padding: 24px 24px 48px; display: flex; flex-direction: column; gap: 20px; }

/* ── Login (navy screen, white card) ─────────────────────────── */
.login-view {
  background: var(--ben-navy); min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px; padding: 24px;
}
.login-card {
  background: #fff; border-radius: 12px; box-shadow: 0 8px 40px rgba(0,0,0,.35);
  padding: 40px 36px 36px; width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center;
}
.login-logo { font-size: 32px; font-weight: 800; letter-spacing: .1em; color: var(--ben-navy); }
.login-subtitle { font-size: 13px; color: var(--gray-600); margin-bottom: 22px; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.login-footer { font-size: 12px; color: rgba(255,255,255,.45); }
.error-msg { background: var(--red-bg); color: var(--red); border: 1px solid #fca5a5; border-radius: 6px; padding: 10px 14px; font-size: 13px; font-weight: 500; }

/* ── Fields / inputs ─────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-600); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input, select, textarea {
  height: 40px; padding: 0 12px; border: 1px solid var(--gray-200); border-radius: 7px;
  font: inherit; font-size: 14px; color: var(--gray-800); background: var(--gray-50); outline: none;
  width: 100%; transition: border-color .15s, background .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ben-accent); background: #fff; box-shadow: 0 0 0 3px rgba(46,128,206,.12); }
input:disabled, select:disabled { background: var(--gray-100); color: var(--gray-600); cursor: not-allowed; }
.login-form .field { margin-bottom: 0; }
.login-form input { height: 42px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn, .btn-primary, .btn-ghost, .btn-danger, .btn-signin {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 6px; transition: all .15s;
}
.btn, .btn-ghost { height: 34px; padding: 0 14px; background: #fff; border: 1px solid var(--gray-200); color: var(--gray-600); font-size: 13px; }
.btn:hover, .btn-ghost:hover { background: var(--gray-100); border-color: var(--gray-400); }
.btn-primary { height: 36px; padding: 0 20px; background: var(--ben-blue); color: #fff; border: none; font-size: 13px; }
.btn-primary:hover { background: var(--ben-accent); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; background: var(--ben-blue); }
.btn-danger { height: 34px; padding: 0 14px; background: #fff; border: 1px solid #fca5a5; color: var(--red); font-size: 13px; }
.btn-danger:hover { background: var(--red-bg); }
.btn-block { width: 100%; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
/* Quiet icon buttons for row actions (RM.PENCIL_ICON / RM.TRASH_ICON); delete turns red on hover */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--gray-400); cursor: pointer; vertical-align: middle;
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-800); }
.icon-btn-del:hover { background: var(--red-bg); color: var(--red); }
.btn-signin { margin-top: 4px; height: 44px; width: 100%; background: var(--ben-blue); color: #fff; border: none; border-radius: 7px; font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.btn-signin:hover:not(:disabled) { background: var(--ben-accent); }
.btn-signin:disabled { opacity: .65; cursor: not-allowed; }
.btn-sso { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #fff; color: #1f2937; border: 1px solid var(--gray-200); text-decoration: none; }
.btn-sso:hover { background: var(--gray-100); }
.login-or { font-size: 12px; color: var(--gray-400); text-align: center; margin: 14px 0; }

/* ── Page head ───────────────────────────────────────────────── */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; color: var(--ben-navy); }

/* ── Cards / stats ───────────────────────────────────────────── */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-200); padding: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-200); padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat .n { font-size: 24px; font-weight: 700; color: var(--ben-navy); letter-spacing: -.01em; }
.stat .l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-600); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-600); margin-bottom: 12px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-200); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--gray-50); text-align: left; padding: 11px 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); border-bottom: 2px solid var(--gray-200);
}
td { padding: 11px 14px; color: var(--gray-800); }
/* Sortable list tables (RM.dataTable): headings set off from the rows — tinted,
   navy and bold — and each one a button that sorts by its column. */
.data-table thead th { padding: 12px 14px; background: #e8eef6; color: var(--ben-navy); font-weight: 700; border-bottom: 2px solid #c5d2e3; }
.data-table thead th[aria-sort] { padding: 0; } /* the sort button carries the padding */
.th-sort {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 12px 14px; border: 0; background: none;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; cursor: pointer;
}
.th-sort:hover { background: #dbe4f0; }
.th-sort:focus-visible { outline: 2px solid var(--ben-accent); outline-offset: -2px; }
.th-arrow { font-size: 10px; color: #9fb0c6; }
.th-sort:hover .th-arrow { color: var(--ben-navy); }
.th-sort.on .th-arrow { color: var(--ben-blue); }
.data-table tbody tr { cursor: default; }
.data-table.rows-clickable tbody tr { cursor: pointer; } /* only rows that open something */
tbody tr { transition: background .1s; cursor: pointer; }
tbody tr:hover { background: var(--ben-light); }
tbody tr:not(:last-child) td { border-bottom: 1px solid var(--gray-200); }

/* ── Badges / pills ──────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.badge-Low      { background: var(--green-bg);  color: var(--green); }
.badge-Medium   { background: var(--amber-bg);  color: var(--amber); }
.badge-High     { background: var(--orange-bg); color: var(--orange); }
.badge-Critical { background: var(--red-bg);    color: var(--red); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: var(--gray-100); border: 1px solid var(--gray-200); color: var(--gray-600); }
.score-chip { display: inline-flex; min-width: 26px; justify-content: center; padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 12px; }

/* ── Heat map ────────────────────────────────────────────────── */
.heat-wrap { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.heat { display: grid; grid-template-columns: auto repeat(5, 1fr); gap: 4px; }
.heat .cell { aspect-ratio: 1 / 1; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 15px; }
.heat .axis-y, .heat .axis-x { color: var(--gray-600); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.axis-label { text-align: center; color: var(--gray-600); font-size: 12px; font-weight: 600; margin-top: 6px; }
.axis-label-y { writing-mode: vertical-rl; transform: rotate(180deg); color: var(--gray-600); font-size: 12px; font-weight: 600; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-root { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,34,64,.5); }
.modal { position: relative; background: #fff; border-radius: 12px; width: 100%; max-width: 640px; box-shadow: 0 8px 40px rgba(0,0,0,.35); }
#modal-body { padding: 24px; }
.modal.modal-wide { max-width: 1100px; }
.modal h2 { font-size: 18px; font-weight: 700; color: var(--ben-navy); margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; align-items: center; }

/* In-page confirm dialog (RM.confirm) — centered, above any open modal */
.confirm-root { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 16px; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(10,34,64,.35); }
.confirm-box { position: relative; width: 100%; max-width: 440px; background: #fff; border-radius: 12px; padding: 22px 24px 20px; box-shadow: 0 8px 40px rgba(0,0,0,.35); }
.confirm-box h3 { font-size: 16px; font-weight: 700; color: var(--ben-navy); margin-bottom: 8px; }
.confirm-box p { font-size: 14px; line-height: 1.5; color: var(--gray-600); margin-bottom: 18px; }
.confirm-box button:focus-visible { outline: 2px solid var(--ben-blue); outline-offset: 2px; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ben-navy); color: #fff; padding: 12px 20px; border-radius: 8px; box-shadow: var(--shadow); z-index: 300; font-size: 13px; }
.toast.err { background: var(--red); }

.empty { text-align: center; color: var(--gray-600); padding: 40px; }

/* ── Report ──────────────────────────────────────────────────── */
#report-doc { background: #fff; }
.report-section { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.report-section h2 { font-size: 16px; color: var(--ben-navy); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--ben-light); }
.report-cover { text-align: center; padding: 48px 24px; }
.report-doc-title { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--gray-400); }
.report-cover h1 { font-size: 26px; color: var(--ben-navy); margin: 8px 0 24px; }
.cover-meta { display: inline-grid; grid-template-columns: auto auto; gap: 10px 40px; text-align: left; }
.cover-meta .k { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); }
.rpt-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rpt-table th { background: var(--gray-50); text-align: left; padding: 8px 10px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); border-bottom: 2px solid var(--gray-200); }
.rpt-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-200); vertical-align: top; }
.rpt-table th.num, .rpt-table td.num { text-align: right; }
.rpt-table tbody tr:hover { background: transparent; cursor: default; }
.rpt-total td { font-weight: 700; background: var(--ben-light); border-top: 2px solid var(--gray-200); }
.rpt-risk td:nth-child(4), .rpt-risk td:nth-child(5), .rpt-risk td:nth-child(6) { text-align: center; font-weight: 600; }
.mit-list { margin: 0; padding-left: 16px; }
.mit-list li { margin: 1px 0; }
.mit-desc { font-size: 11px; margin-top: 3px; }

/* ── Vendors (tier tree + detail) ────────────────────────────── */
main:has(> .vendors-layout) { max-width: none; } /* Vendors uses the full window width (keeping main's 24px side padding) */
.vendor-title { font-size: 32px; font-weight: 700; line-height: 1.2; color: var(--ben-navy); }
.vendors-layout { display: grid; grid-template-columns: 500px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .vendors-layout { grid-template-columns: 1fr; } }
.vendor-nav { padding: 16px; position: sticky; top: 80px; max-height: calc(100vh - 104px); display: flex; flex-direction: column; gap: 12px; }
.vendor-nav-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; border-bottom: 2px solid var(--ben-navy); }
.vendor-nav-head h1 { font-size: 20px; font-weight: 700; color: var(--ben-navy); }
.vendor-nav-btns { display: flex; gap: 6px; }

/* Vendor Documents tab (vendor-documents.js) */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--ben-accent); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.vd-toolbar { margin-bottom: 14px; }
#vd-search { width: 280px; height: 34px; }
.vd-progress { font-size: 12px; }
.vd-crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 10px; }
.vd-crumbs .link-btn { font-weight: 600; }
.vd-sep { color: var(--gray-400); font-weight: 400; }
.vd-name { display: inline-flex; align-items: center; gap: 8px; }
.vd-name .link-btn { font-weight: 500; }
.vd-folder-icon { color: var(--ben-accent); flex: none; }
.vd-file-icon { color: var(--gray-400); flex: none; }
.vd-table td.vd-actions { white-space: nowrap; text-align: right; width: 1%; }
.vd-dropzone { border-radius: var(--radius); outline: 2px dashed transparent; outline-offset: 4px; transition: outline-color .15s; }
.vd-dropzone.vd-drop-over { outline-color: var(--ben-accent); }
.vd-table tr.vd-drop-over td { background: var(--ben-light); }

/* Plan controls picker (plan-controls.js) */
.pc-pick-list { max-height: 55vh; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 14px; }
.pc-pick { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--gray-100); cursor: pointer; font-size: 14px; }
.pc-pick:last-of-type { border-bottom: none; }
.pc-pick:hover { background: var(--gray-50); }
.pc-pick:has(input:checked) { background: var(--ben-light); }
.pc-pick input[type=checkbox] { width: auto; height: auto; margin: 0; flex: none; } /* undo global input sizing */
.pc-pick .pill { flex: none; }
.pc-pick-title { flex: 1; min-width: 0; color: var(--gray-800); }
.pc-pick-owner { flex: none; max-width: 40%; text-align: right; font-size: 12px; }
.pc-pick-none { padding: 14px 12px; }

/* LogicManager import (lm-import.js) */
.lm-intro { font-size: 13px; margin: -8px 0 14px; line-height: 1.5; }
.lm-drop { display: flex; align-items: center; gap: 12px; padding: 18px; border: 2px dashed var(--gray-200); border-radius: var(--radius); margin-bottom: 14px; }
.lm-drop.over { border-color: var(--ben-blue); background: var(--ben-light); }
.lm-drop[hidden] { display: none; }
.lm-table { margin-bottom: 12px; max-height: 55vh; overflow-y: auto; }
.lm-table td { vertical-align: top; font-size: 13px; }
.lm-table tbody tr { cursor: default; }
.lm-table tbody tr:hover { background: transparent; }
.lm-table select { height: 30px; font-size: 12px; padding: 0 6px; width: auto; }
.lm-file { color: var(--gray-600); word-break: break-word; max-width: 220px; }
.lm-sub { font-size: 12px; margin-top: 2px; }
.lm-flag { color: var(--amber); font-weight: 600; }
.lm-row-btns { white-space: nowrap; text-align: right; }
.lm-row-btns .chip-x { margin-left: 10px; }
.lm-details td { background: var(--gray-50); font-size: 13px; line-height: 1.5; }
.lm-details ul { margin: 2px 0 6px 18px; }
.lm-detail-h { margin-top: 8px; font-weight: 600; }
.vendor-tree { overflow-y: auto; margin: 0 -8px; }
.vt-tier, .vt-item {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: none; border: none;
  font: inherit; color: var(--gray-800); cursor: pointer; border-radius: 6px;
}
.vt-tier { padding: 8px; font-size: 13px; font-weight: 600; }
.vt-item { padding: 6px 8px; font-size: 13px; }
.vt-tier:hover, .vt-item:hover { background: var(--gray-100); }
.vt-item.active { background: var(--ben-light); color: var(--ben-blue); font-weight: 600; }
.vt-caret { width: 12px; font-size: 16px; line-height: 1; text-align: center; color: var(--gray-600); transition: transform .15s; }
.vt-caret.open { transform: rotate(90deg); }
.vt-count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--gray-600); }
.vt-list { list-style: none; padding-left: 18px; }
.vt-num { min-width: 30px; font-size: 12px; color: var(--gray-600); }
.vt-empty { padding: 4px 8px 8px; font-size: 12px; }
.vendor-detail { display: flex; flex-direction: column; gap: 16px; }
.vendor-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--gray-200); }
.vendor-tab {
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 12px;
  font: inherit; font-size: 14px; color: var(--gray-600); cursor: pointer;
}
.vendor-tab:hover { color: var(--gray-800); }
.vendor-tab.active { color: var(--ben-navy); border-bottom-color: var(--ben-accent); font-weight: 600; }
.vendor-tab-body { display: flex; flex-direction: column; gap: 16px; }

/* Collapsible Profile sections (LM-style accordion) */
.ps-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.ps-note { margin-right: auto; font-size: 12px; }
.profile-sections { display: flex; flex-direction: column; gap: 8px; }
.profile-section { padding: 0; }
.ps-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 20px; text-align: left;
  background: none; border: none; border-radius: var(--radius); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ben-blue);
}
.ps-head:hover { background: var(--gray-50); }
.ps-caret { display: inline-block; width: 12px; font-size: 18px; line-height: 1; text-align: center; color: var(--gray-600); transition: transform .15s; }
.profile-section.open .ps-caret { transform: rotate(90deg); }
.profile-section.open .ps-head { border-bottom: 1px solid var(--gray-200); border-radius: var(--radius) var(--radius) 0 0; }
.ps-body { padding: 18px 20px 6px; }
.vendor-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.vendor-form .span-2 { grid-column: span 2; }
.vendor-form.align-end .field { justify-content: flex-end; } /* answer boxes line up when labels wrap */
.vendor-form.align-end .field:has(.rich-text-wrap) { justify-content: flex-start; } /* …but a text box growing while edited mustn't move its neighbour */
@media (max-width: 900px) { .vendor-form { grid-template-columns: 1fr; } .vendor-form .span-2 { grid-column: auto; } }
/* Profile questions are long, so labels use normal case instead of the caps style. */
.vendor-form .field > label { font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--gray-800); }
/* Question/answer emphasis (as in LogicManager), on the whole Profile: lighter
   questions, semibold answers — dropdowns, inputs, selected chips and the Primary
   Contact. Rich-text answers are medium weight so bold text inside them still
   stands out; read-only notes (e.g. the document activity panel) are unchanged.
   (Kept after the .vendor-form label rule above, which would otherwise win.) */
.qa-form .field > label { font-weight: 400; color: var(--gray-600); }
.qa-form :is(.field, #vp-state-box) > :is(select, input) { font-weight: 600; }
.qa-form :is(.field, #vp-state-box) > select:has(option[value=""]:checked) { font-weight: 400; color: var(--gray-400); }
.qa-form :is(.field, #vp-state-box) > input::placeholder { font-weight: 400; }
.qa-form .rich-text-wrap .ql-editor { font-weight: 500; }
.qa-form .field .pill { font-weight: 600; color: var(--gray-800); }
.qa-form .is-current:has(.is-icon) .is-label { font-weight: 600; } /* a chosen contact, not "— None —" */
.req { margin-left: 6px; color: var(--red); font-weight: 500; text-transform: none; letter-spacing: 0; }
.hint { color: var(--gray-600); font-weight: 400; }
.field-stamp { font-size: 12px; margin-top: 2px; }
.ok-text { color: var(--green); font-weight: 600; }
.warn-text { color: var(--red); font-weight: 600; }
.field-links { display: flex; gap: 16px; margin-top: 6px; font-size: 12px; }
.field-links a { text-decoration: none; }
.field-links a:hover { text-decoration: underline; }
.form-subhead {
  grid-column: 1 / -1; margin: 6px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--gray-200);
  font-size: 15px; font-weight: 700; color: var(--ben-navy);
}
.field.has-error > label { color: var(--red); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); box-shadow: 0 0 0 3px rgba(185,28,28,.1); }
.vendor-savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; padding: 12px 20px; }

/* Editable grids (RM.gridTable — contacts, contracts). Values read like text, in
   semibold (as in LogicManager); a cell's box shows on row hover and while editing. */
.grid-table { overflow-x: auto; }
.grid-table table { min-width: 860px; table-layout: fixed; } /* same column widths in every grid */
.grid-table th:last-child { width: 44px; }
.grid-table td { padding: 3px 4px; vertical-align: top; }
.grid-table tbody tr { cursor: default; }
.grid-table tbody tr:nth-child(even) { background: var(--gray-50); }
.grid-table tbody tr:hover { background: var(--ben-light); }
.grid-table .row-num { width: 40px; text-align: center; color: var(--gray-400); padding-top: 12px; font-size: 12px; }
.grid-table th.row-num { padding-top: 11px; }
.grid-table textarea, .grid-table input, .grid-table select {
  border-color: transparent; background: transparent; font-size: 13.5px; font-weight: 600; color: var(--gray-800);
}
.grid-table textarea { min-height: 34px; padding: 7px 8px; resize: none; field-sizing: content; line-height: 1.4; }
.grid-table input, .grid-table select { height: 34px; padding: 0 8px; }
.grid-table tr:hover :is(textarea, input, select) { border-color: var(--gray-200); background: #fff; }
.grid-table :is(textarea, input, select):focus { border-color: var(--ben-accent); background: #fff; }
.grid-table textarea::placeholder { color: transparent; }
.grid-table textarea:focus::placeholder { color: var(--gray-400); font-weight: 400; }
/* Empty dropdowns / dates: hide "Select…" / "mm/dd/yyyy" until hovered or focused */
.grid-table .is-empty { color: transparent; }
.grid-table .is-empty::-webkit-datetime-edit { color: transparent; }
.grid-table tr:hover .is-empty, .grid-table .is-empty:focus { color: var(--gray-400); font-weight: 400; }
.grid-table tr:hover .is-empty::-webkit-datetime-edit, .grid-table .is-empty:focus::-webkit-datetime-edit { color: var(--gray-400); }
.grid-table select option { color: var(--gray-800); font-weight: 400; }
/* Dropdown arrows and calendar icons only on the hovered row / the cell in use */
.grid-table select { appearance: none; }
.grid-table tr:hover select, .grid-table select:focus { appearance: auto; }
.grid-table input[type=date]::-webkit-calendar-picker-indicator { opacity: 0; }
.grid-table tr:hover input[type=date]::-webkit-calendar-picker-indicator,
.grid-table input[type=date]:focus::-webkit-calendar-picker-indicator { opacity: .6; }
.grid-table .grid-actions { text-align: center; padding-top: 6px; }

/* Rich-text editor (Quill snow theme, restyled to match inputs) */
.rich-text-wrap .ql-toolbar.ql-snow { border: 1px solid var(--gray-200); border-radius: 7px 7px 0 0; background: var(--gray-50); font-family: inherit; }
/* height:auto overrides Quill's height:100%, which counts the toolbar too and spills over the next field */
.rich-text-wrap .ql-container.ql-snow { height: auto; border: 1px solid var(--gray-200); border-top: 0; border-radius: 0 0 7px 7px; background: #fff; font-family: inherit; font-size: 14px; }
.rich-text-wrap .ql-editor { min-height: 140px; padding: 10px 12px; }
.rich-text-wrap.compact .ql-editor { min-height: 90px; }
.rich-text-wrap .ql-editor.ql-blank::before { left: 12px; right: 12px; }
/* Not being edited (no .editing — see RM.richText): no formatting bar, and the box
   looks like the other inputs (gray, one line when empty). Editing shows the bar,
   the full height and the focus ring. */
.rich-text-wrap:not(.editing) .ql-toolbar.ql-snow { display: none; }
.rich-text-wrap:not(.editing) .ql-container.ql-snow { border-top: 1px solid var(--gray-200); border-radius: 7px; background: var(--gray-50); }
.rich-text-wrap:not(.editing) .ql-editor { min-height: 40px; cursor: text; }
.rich-text-wrap.editing { border-radius: 7px; box-shadow: 0 0 0 3px rgba(46,128,206,.12); }
.rich-text-wrap.editing :is(.ql-toolbar.ql-snow, .ql-container.ql-snow) { border-color: var(--ben-accent); }
.rich-text-wrap .ql-snow .ql-tooltip input[type=text] { width: 180px; height: 28px; } /* undo global input sizing */
.field.has-error .ql-toolbar.ql-snow, .field.has-error .ql-container.ql-snow { border-color: var(--red); }

/* Icon dropdown (RM.iconSelect) — styled to match native selects */
.icon-select { position: relative; }
.is-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 12px; text-align: left;
  font: inherit; font-size: 14px; color: var(--gray-800); background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: 7px; cursor: pointer;
}
.is-toggle:focus { outline: none; border-color: var(--ben-accent); background: #fff; box-shadow: 0 0 0 3px rgba(46,128,206,.12); }
.is-current { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.is-caret { color: var(--gray-600); font-size: 12px; }
.is-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; padding: 6px;
  background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: var(--shadow);
}
.is-menu.up { top: auto; bottom: calc(100% + 4px); }
.is-search { height: 34px; margin-bottom: 6px; }
.is-list { list-style: none; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; /* touch scrolling */ }
.is-list li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.is-list li.active { background: var(--ben-light); }
.is-list li.selected { font-weight: 600; color: var(--ben-blue); }
.is-list li.is-empty { color: var(--gray-600); cursor: default; }
.is-icon { display: inline-flex; color: var(--gray-600); }
.is-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-note { color: var(--gray-600); font-size: 12px; font-weight: 400; }

/* Vendor Activity tab */
.act-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.act-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.act-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--gray-200);
  border-radius: 99px; background: #fff; font: inherit; font-size: 12px; color: var(--gray-800); cursor: pointer;
}
.act-chip:hover { border-color: var(--gray-400); }
.act-chip.on { background: var(--ben-blue); border-color: var(--ben-blue); color: #fff; }
.act-n { font-weight: 700; opacity: .7; }
#act-search { width: 240px; height: 34px; }
/* Age groups (Last 6 months / more than 6 months / more than two years): a heading + one card of entries */
.act-group { margin-bottom: 18px; }
.act-group-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 0; background: none; border: 0;
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-600); cursor: pointer;
}
.act-group-head:hover { color: var(--ben-navy); }
.act-group-head.static { cursor: default; }
.act-group-head.static .act-caret { display: none; }
.act-group-head .act-n { letter-spacing: 0; padding: 1px 7px; border-radius: 99px; background: var(--gray-100); }
.act-caret { display: inline-block; transition: transform .15s; font-size: 14px; }
.act-group-head[aria-expanded="true"] .act-caret { transform: rotate(90deg); }
.act-group-body { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.act-group-body > * + * { border-top: 1px solid var(--gray-100); }
.act-group-body .act-form { margin: 0; border: 0; border-radius: 0; box-shadow: none; background: var(--gray-50); }
/* One entry: date column, then category · author, the note and any follow-up */
.act-entry { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 18px; padding: 14px 18px; }
.act-date { display: flex; flex-direction: column; padding-top: 1px; line-height: 1.25; }
.act-day { font-weight: 700; color: var(--ben-navy); font-size: 14px; white-space: nowrap; }
.act-year { font-size: 12px; color: var(--gray-600); }
.act-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; min-height: 24px; }
.act-author { color: var(--gray-600); }
.act-body.clamp .ql-editor { max-height: 5.8em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.act-more { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; }
.act-cat { padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.act-cat-0 { background: var(--ben-light); color: var(--ben-blue); } /* Document Requested */
.act-cat-1 { background: var(--green-bg); color: var(--green); }    /* Document Received */
.act-cat-2 { background: var(--amber-bg); color: var(--amber); }    /* Follow-up */
.act-cat-3 { background: #ede9fe; color: #6d28d9; }                 /* Review */
.act-cat-4 { background: #ccfbf1; color: #0f766e; }                 /* Contract */
.act-cat-5 { background: #fce7f3; color: #be185d; }                 /* General */
.act-cat-6 { background: var(--gray-100); color: var(--gray-600); } /* Other (and unknown) */
.act-body .ql-editor { height: auto; min-height: 0; padding: 0; overflow: visible; font-size: 14px; }
.act-fu {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 3px 10px;
  border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.act-fu input[type=checkbox] { width: auto; height: auto; margin: 0; } /* undo global input sizing */
.act-fu-open { background: var(--amber-bg); color: var(--amber); }
.act-fu-overdue { background: var(--red-bg); color: var(--red); }
.act-fu-done { background: var(--gray-100); color: var(--gray-600); text-decoration: line-through; }
.act-form { margin-bottom: 12px; }

/* Profile › Document Request Confirmation: recent document activity */
.doc-activity { display: flex; flex-direction: column; gap: 10px; }
.doc-activity .act-entry { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); }
.doc-empty { font-size: 13px; }
.doc-archive { margin-top: 4px; font-size: 13px; }
.doc-archive summary { cursor: pointer; color: var(--gray-600); font-weight: 600; }
.doc-archive .act-body { margin-top: 8px; padding: 12px 14px; border: 1px dashed var(--gray-200); border-radius: var(--radius); }
.doc-archive .ql-editor { max-height: 420px; overflow-y: auto; }

/* Profile › Internal Review - SOC Review (recurring reviews) */
.sr-panel { display: flex; flex-direction: column; gap: 10px; }
.sr-card { padding: 14px 18px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); }
.sr-doc { margin: 2px 0 10px; font-size: 13px; color: var(--gray-600); }
.sr-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 20px; font-size: 13px; }
.sr-facts .k { display: block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--gray-600); }
.sr-past-title { margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-600); }
.sr-head { display: flex; align-items: center; gap: 12px; }
.sr-head h2 { margin-bottom: 0 !important; }
.sr-stamp { margin: 4px 0 16px; font-size: 12px; }
.rich-text-wrap.scroll .ql-editor, .sr-readonly.scroll .ql-editor { max-height: 320px; overflow-y: auto; }
/* Review window: navy questions and headers so the long form scans easily */
.sr-form .field > label { color: var(--ben-blue); font-weight: 700; }
.sr-group {
  grid-column: 1 / -1; margin-bottom: 14px; padding: 14px 16px 0; background: var(--gray-50);
  border: 1px solid var(--gray-200); border-left: 4px solid var(--ben-accent); border-radius: var(--radius);
}
.sr-group .field:last-child { margin-bottom: 14px; }
.sr-form .form-subhead { margin-top: 10px; font-size: 16px; color: var(--ben-navy); border-bottom: 2px solid var(--ben-accent); }
.sr-readonly { padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 7px; background: var(--gray-100); }
.sr-readonly .ql-editor { height: auto; min-height: 0; padding: 0; font-size: 14px; }

/* Profile › recurring review logs (Quarterly Review, Performance & Ongoing Due Diligence) */
.rl-status { font-size: 13px; }
.rl-table td { vertical-align: top; }
/* Values in semibold (as in LogicManager); row number, reviewer and unanswered "—" stay light */
.rl-table tbody td { font-weight: 600; color: var(--gray-800); }
.rl-table tbody td.muted, .rl-table .rl-who, .rl-sub td { font-weight: 400; }
.rl-sub .rl-notes { font-weight: 600; color: var(--gray-800); }
.rl-table tbody tr { cursor: default; }
.rl-table tbody tr:hover { background: transparent; }
.rl-date, .rl-who, .rl-actions { white-space: nowrap; }
.rl-notes { white-space: pre-wrap; }
.table-wrap.rl-scroll { overflow-x: auto; } /* wide logs scroll sideways on narrow screens */
.rl-notes-below th, .rl-notes-below td { padding: 9px 10px; }
.rl-notes-below tbody tr[data-review] td { border-bottom: none; }
.rl-sub td { padding-top: 0; font-size: 13px; }
.rl-sub-line { display: flex; justify-content: space-between; gap: 16px; }
.rl-sub-line .rl-who { margin-left: auto; }
.rl-flag { color: var(--red); font-weight: 600; }
.rl-actions { text-align: right; }
.rl-table td.rl-actions { padding-top: 6px; padding-bottom: 0; } /* icons line up with the row text */
.rl-more { font-size: 13px; }
.rl-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.rl-check input[type=checkbox] { width: auto; height: auto; margin: 2px 0 0; } /* undo global input sizing */

/* Attachment fields */
.attach-list { display: flex; flex-direction: column; gap: 4px; }
.attach-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.attach-item a[data-dl] { text-decoration: none; }
.attach-item a[data-dl]:hover { text-decoration: underline; }

/* ── Chip picker (RM.chipPicker) ─────────────────────────────── */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip-x { margin-left: 2px; color: inherit; text-decoration: none; }
.chip-x:hover { color: var(--red); }

/* ── Print (Save as PDF) ─────────────────────────────────────── */
@media print {
  .app-header, #report-toolbar, #approved-versions, .toast, .modal-root { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .report-section { border: none; box-shadow: none; padding: 0 0 12px; margin-bottom: 18px; page-break-inside: avoid; break-inside: avoid; }
  .report-cover { page-break-after: always; }
  .rpt-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-bottom: 18px; }
.detail-grid .k { color: var(--gray-600); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
