/* ══════════════════════════════════════════════════════════════════
   AXON Data Room — Admin console (section internals: tree, tables,
   group cards, permission matrix). Runs inside the Phase-2 shell.

   COMPAT: admin.html no longer loads room.css, so this block maps the
   legacy tokens + button/tag classes that the render code still emits
   onto the design system. Section internals keep working & look right.
   ══════════════════════════════════════════════════════════════════ */

/* legacy brand tokens (were in room.css) → design-system equivalents */
:root {
  --white: #ffffff;
  --ink: var(--gray-900);
  --muted: var(--gray-600);
  --soft: var(--gray-400);
  --line: var(--border);
  --green: var(--mint);
  --mint-soft: var(--mint-050);
}

/* legacy space-separated button classes → design-system button */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px;
  height:34px; padding:0 14px; font-size:14px; font-weight:600; line-height:1;
  border:1px solid transparent; border-radius:var(--r-sm); cursor:pointer;
  background:var(--navy); color:#fff; white-space:nowrap;
  transition:filter var(--dur-1), background var(--dur-1), border-color var(--dur-1); }
.btn:hover { filter:brightness(1.06); }
/* Accept both the plain (.secondary) and BEM (.btn--secondary) variants —
   the file-manager toolbar markup uses the BEM names, so without these
   they fell through to the solid-navy base and every button looked the
   same. Only the primary action stays filled; the rest are light. */
.btn.secondary, .btn--secondary { background:#fff; color:var(--text); border-color:var(--border-strong); }
.btn.secondary:hover, .btn--secondary:hover { background:var(--gray-50); filter:none; }
.btn.danger, .btn--danger { background:#fff; color:var(--danger); border-color:#f0c4c4; }
.btn.danger:hover, .btn--danger:hover { background:var(--danger-bg); filter:none; }
.btn--ghost { background:transparent; color:var(--text-2); border-color:transparent; }
.btn--ghost:hover { background:var(--gray-100); filter:none; }
/* .btn--primary keeps the solid-navy base (the admin's primary color). */
.btn.small, .btn--sm { height:28px; padding:0 10px; font-size:12.5px; }

/* legacy tag chips → design-system badge look */
.tag { display:inline-flex; align-items:center; padding:2px 9px; border-radius:var(--r-full);
  font-size:12px; font-weight:600; background:var(--mint-050); color:#0a7f5c; }
.tag.pending { background:var(--warning-bg); color:var(--warning); }
.tag.missing { background:var(--danger-bg); color:var(--danger); }
.tag--info { background:var(--info-bg); color:var(--info); }

/* legacy helpers used by render code */
.small { font-size:13px; }
.muted { color:var(--muted); }
.sub { color:var(--muted); font-size:14px; }
.fm-empty { padding:40px 20px; text-align:center; color:var(--muted); font-size:14px; }
.fm-empty .big { font-size:30px; display:block; margin-bottom:8px; opacity:.5; }

.adm-wrap { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }

/* ---- Tabs ---- */
.adm-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.adm-tab {
  appearance: none; background: transparent; border: 0;
  padding: 12px 18px; font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: flex; align-items: center; gap: 8px;
}
.adm-tab:hover { color: var(--ink); }
.adm-tab.active { color: var(--ink); border-bottom-color: var(--mint); }
.adm-tab .pill {
  font-size: 11px; font-weight: 700; background: var(--mint-soft); color: #0a7f5c;
  border-radius: 999px; padding: 1px 8px;
}
.adm-panel { display: none; }
.adm-panel.active { display: block; }

/* ---- Section header row ---- */
.adm-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.adm-head h2 { margin: 0; font-size: 18px; }
.adm-head .sub { margin: 2px 0 0; }

/* ══ FILE MANAGER (two-pane) ══════════════════════════════════════ */
.fm {
  display: grid; grid-template-columns: 300px 1fr; gap: 0;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--white); min-height: 460px;
  box-shadow: 0 2px 10px rgba(11,20,55,0.05);
}
.fm-tree-col {
  border-right: 1px solid var(--line); background: #fbfcfe;
  display: flex; flex-direction: column; min-height: 0;
}
.fm-tree {
  padding: 10px; overflow-y: auto; max-height: 580px; flex: 1;
}
.fm-main { padding: 0; display: flex; flex-direction: column; min-width: 0; }

/* Internal / VDR tabs — only one tree is visible at a time, so the two
   are never rendered mixed together in the same panel. */
.fm-tree-tabs {
  display: flex; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.fm-tree-tab {
  flex: 1; appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 12px 10px; font-size: 12.5px; font-weight: 700; color: var(--muted);
  white-space: nowrap;
  transition: color 120ms ease, background 120ms ease;
}
.fm-tree-tab:hover { color: var(--ink); }
/* Internal = blue (safe, ordinary team space), Investor VDR = red (this is
   the room investors see — treat every action here with more caution).
   Bold FILLED tabs, not just a tint or underline, and the tree panel below
   picks up a matching wash so the whole column reads as "you are here." */
.fm-tree-tab--internal.is-active { color: #fff; background: var(--info); }
.fm-tree-tab--vdr.is-active { color: #fff; background: var(--danger); }
.fm-tree-col.tree-active--internal .fm-tree { background: var(--info-bg); }
.fm-tree-col.tree-active--vdr .fm-tree { background: var(--danger-bg); }

/* Tree nodes */
.tree-node { user-select: none; }
.tree-row {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: var(--ink); position: relative;
}
.tree-row:hover { background: var(--mint-soft); }
.tree-row.selected { background: rgba(0,217,153,0.16); font-weight: 600; }
.tree-caret {
  width: 16px; height: 16px; display: inline-flex; align-items: center;
  justify-content: center; color: var(--muted); flex-shrink: 0;
  transition: transform 150ms ease; font-size: 10px;
}
.tree-caret.open { transform: rotate(90deg); }
.tree-caret.leaf { visibility: hidden; }
.tree-ico { flex-shrink: 0; font-size: 14px; }
.tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tree-children { margin-left: 14px; border-left: 1px solid var(--line); padding-left: 4px; }
.tree-count { font-size: 11px; color: var(--soft); font-weight: 400; }

/* Main pane: breadcrumb + toolbar + file list */
.fm-bar {
  display: flex; align-items: center;
  gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line);
}
/* A deep subfolder chain scrolls horizontally on its own rather than
   wrapping or overflowing the bar. */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); flex-wrap: nowrap; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs .crumb, .crumbs .sep, .crumbs .badge { flex-shrink: 0; }
.crumbs .crumb { color: var(--ink); cursor: pointer; }
.crumbs .crumb:hover { color: #0a7f5c; text-decoration: underline; }
.crumbs .sep { color: var(--soft); }
/* Folder-scoped actions (Subfolder/Upload/Rename/Delete) live in the page
   header now, not the table bar, so they never compete with the
   breadcrumb trail for space. A divider separates them from the
   page-level Refresh/New folder buttons. */
.fm-folder-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-right: 10px; margin-right: 4px; border-right: 1px solid var(--line); }

.fm-files { padding: 6px; overflow-y: auto; flex: 1; max-height: 540px; }
.fm-empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.fm-empty .big { font-size: 32px; display: block; margin-bottom: 10px; opacity: .5; }

.fm-file {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px; font-size: 14px;
  border: 1px solid transparent;
}
.fm-file:hover { background: #f6f7fb; border-color: var(--line); }
.fm-file .f-ico { font-size: 18px; flex-shrink: 0; }
.fm-file .f-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-file .tag { flex-shrink: 0; }
.fm-file .f-meta { font-size: 12px; color: var(--soft); flex-shrink: 0; min-width: 24px; text-align: right; }
/* Actions sit together on the right; stay visible (not faded) so the row
   never looks half-disabled, but keep them quiet until hover. */
.fm-file .f-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; opacity: 0.6; transition: opacity 120ms ease; }
.fm-file:hover .f-actions,
.fm-file .f-actions:focus-within { opacity: 1; }

/* Drag-drop upload target */
.fm-files.dragover { outline: 2px dashed var(--mint); outline-offset: -8px; background: var(--mint-soft); }

/* ══ ICON BUTTONS ═════════════════════════════════════════════════ */
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--white);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; transition: all 140ms ease;
}
.icon-btn:hover { border-color: var(--mint); color: #0a7f5c; background: var(--mint-soft); }
.icon-btn.danger:hover { border-color: #e88; color: #b30000; background: #ffe9e9; }

/* SignWell embedded editor / signer. It injects a full-screen fixed
   wrapper (#SignWell-Modal-Embedded) with NO z-index, so it stacks at the
   default level and our sidebar (z-index 40) paints over its left edge.
   These are element IDs (set via el.id), NOT classes — confirmed from
   static.signwell.com/assets/embedded.js — so they must be targeted with
   `#`.

   Lift ONLY the outer wrapper and make it a self-contained stacking
   context (z-index + isolation). SignWell's own internal layering
   (overlay behind, iframe/container z-index:100 in front, close button
   100001) then works correctly INSIDE that context — do NOT flatten all
   children to one z-index or the dark overlay paints over the editor
   (the "grayed out" symptom). The wrapper covers the full viewport so
   nothing (e.g. the sidebar) bleeds through at any corner. */
#SignWell-Modal-Embedded {
  z-index: 2147483000 !important;
  isolation: isolate;
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
}
#SignWell-Modal-Embedded-Overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
}

/* ══ MODAL ════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,20,55,0.55);
  display: none; align-items: center; justify-content: center; z-index: 60;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: 16px; width: min(520px, 96vw);
  box-shadow: 0 20px 60px rgba(11,20,55,0.35); overflow: hidden;
  animation: modalPop 160ms cubic-bezier(0.16,1,0.3,1);
}
/* Wider modal for content-heavy dialogs (e.g. branding). admin.css's
   .modal caps width, so re-assert the large size here. */
.modal.modal--lg { width: min(780px, 96vw); }
.modal--lg .modal__body { max-height: 72vh; overflow-y: auto; }
@keyframes modalPop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal header h3 { margin: 0; font-size: 16px; }
.modal .body { padding: 22px; }
.modal .foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--line); background: #fbfcfe;
}
.modal label.field { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.modal .hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.modal .warn-box {
  background: #fff5f5; border: 1px solid #f3caca; border-radius: 10px;
  padding: 12px 14px; font-size: 13px; color: #a12727; margin-top: 4px;
}

/* ══ GROUPS ═══════════════════════════════════════════════════════ */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.group-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  background: var(--white); box-shadow: 0 1px 4px rgba(11,20,55,0.04);
}
.group-card h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.group-card .g-stats { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.group-card .g-actions { display: flex; gap: 8px; }

/* ══ PERMISSION MATRIX ════════════════════════════════════════════ */
.matrix-wrap { border: 1px solid var(--line); border-radius: 14px; overflow: auto; background: var(--white); }
.matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
.matrix th, .matrix td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.matrix thead th {
  position: sticky; top: 0; background: #fbfcfe; z-index: 1;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.matrix .folder-cell { display: flex; align-items: center; gap: 8px; }
.matrix .folder-cell .indent { display: inline-block; }
.matrix .perm-select {
  appearance: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 26px 5px 10px; font-size: 12.5px; cursor: pointer; background: var(--white);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%235b6478' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center;
}
.perm-none { color: var(--soft); }
.perm-view { border-color: rgba(0,217,153,0.5) !important; color: #0a7f5c; }
.perm-download { border-color: var(--green) !important; color: #0a7f5c; background-color: var(--mint-soft) !important; }
.perm-inherited { font-style: italic; color: var(--soft); font-size: 11.5px; }

/* ══ Investors table (refined) ══════════════════════════════════ */
.inv-table select {
  appearance: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 26px 5px 10px; font-size: 12.5px; margin: 0; width: auto; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%235b6478' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center;
}

/* Expired investor row — tinted + left accent so it's unmissable */
.table tbody tr.row-expired { background: #fff7f7; }
.table tbody tr.row-expired:hover { background: #fdeaea; }
.table tbody tr.row-expired td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

/* Audit activity badges */
.tag.audit-info { background: #eef4ff; color: #2f57a6; }

/* Per-permission UI hiding (cosmetic; server enforces). */
.no-content-manage .fm-file .f-actions,
.no-content-manage #fmToolbar .btn:not(#uploadBtn):not(#newSubfolderBtn),
.no-content-manage #newSubfolderBtn,
.no-content-manage #uploadBtn,
.no-content-manage #renameFolderBtn,
.no-content-manage #deleteFolderBtn { display: none !important; }
.no-groups-manage #newGroupBtn,
.no-groups-manage .group-card .g-actions { display: none !important; }
.no-investors-manage #inviteBtn { display: none !important; }

/* ══ ACTIVITY ANALYTICS ═══════════════════════════════════════════ */
.actor-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.actor-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  background: var(--white); box-shadow: 0 1px 4px rgba(11,20,55,0.04);
  display: flex; flex-direction: column; gap: 8px;
  opacity: 0; transform: translateY(8px);
  animation: cardIn 420ms cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes cardIn { to { opacity: 1; transform: none; } }
.actor-card .ac-top { display: flex; align-items: center; gap: 9px; }
.actor-card .ac-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.actor-card .ac-email { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actor-card .ac-big { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.actor-card .ac-sub { font-size: 12px; color: var(--muted); }
.actor-card .ac-spark { height: 34px; margin-top: 2px; }
.actor-card .ac-spark path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chart-card {
  border: 1px solid var(--line); border-radius: 16px; background: var(--white);
  padding: 18px 20px 8px; box-shadow: 0 2px 10px rgba(11,20,55,0.05);
}
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head h3 { margin: 0; font-size: 15px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.chart-legend .lg {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--muted); cursor: pointer; user-select: none;
  padding: 3px 6px; border-radius: 7px; transition: background 120ms ease;
}
.chart-legend .lg:hover { background: #f2f4f9; }
.chart-legend .lg.off { opacity: 0.35; }
.chart-legend .lg .sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.chart-body { position: relative; min-height: 300px; }

/* Time-range toggle */
.range-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.range-toggle button {
  appearance: none; border: 0; background: var(--white); color: var(--muted);
  padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-right: 1px solid var(--line);
}
.range-toggle button:last-child { border-right: 0; }
.range-toggle button:hover { background: #f2f4f9; }
.range-toggle button.active { background: var(--mint-soft); color: #0a7f5c; }

/* Line draw-in animation via stroke-dash */
.chart-line {
  fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: var(--len); stroke-dashoffset: var(--len);
  animation: drawLine 1100ms cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.chart-dot { opacity: 0; animation: dotIn 300ms ease forwards; }
@keyframes dotIn { to { opacity: 1; } }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-axis text { fill: var(--soft); font-size: 10px; }
.chart-area { opacity: 0.08; animation: areaIn 900ms ease forwards; }
@keyframes areaIn { from { opacity: 0; } to { opacity: 0.08; } }

/* ══ COMMAND CENTER (dark, scoped to Audit tab) ═══════════════════ */
.cc {
  --cc-bg: #0a1230;
  --cc-panel: #101a3d;
  --cc-panel-2: #16224a;
  --cc-line: rgba(255,255,255,0.08);
  --cc-text: #eaf0ff;
  --cc-muted: #8a97c4;
  --cc-mint: #00e6a3;
  background:
    radial-gradient(1200px 400px at 15% -10%, rgba(0,217,153,0.14), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(47,111,237,0.16), transparent 55%),
    var(--cc-bg);
  border-radius: 20px; padding: 24px; color: var(--cc-text);
  box-shadow: 0 20px 60px -20px rgba(6,12,40,0.7), inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
}
.cc h2, .cc h3 { color: var(--cc-text); }
.cc .cc-muted, .cc-sub { color: var(--cc-muted); }
.cc-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 14px; }
.cc-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.cc-sub { margin: 4px 0 0; font-size: 13px; }
.cc-live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--cc-mint);
  background: rgba(0,230,163,0.1); border: 1px solid rgba(0,230,163,0.3); padding: 5px 11px; border-radius: 999px; }
.cc-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--cc-mint); box-shadow: 0 0 0 0 rgba(0,230,163,0.6); animation: ccPulse 1.8s infinite; }
@keyframes ccPulse { 0%{box-shadow:0 0 0 0 rgba(0,230,163,0.55);} 70%{box-shadow:0 0 0 8px rgba(0,230,163,0);} 100%{box-shadow:0 0 0 0 rgba(0,230,163,0);} }

.cc-panel { background: linear-gradient(180deg, var(--cc-panel), var(--cc-panel-2));
  border: 1px solid var(--cc-line); border-radius: 16px; padding: 16px 18px; margin-bottom: 18px; }
.cc-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cc-panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.cc-empty { padding: 40px; text-align: center; color: var(--cc-muted); font-size: 13px; }

/* KPI tiles */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: linear-gradient(180deg, var(--cc-panel), var(--cc-panel-2));
  border: 1px solid var(--cc-line); border-radius: 16px; padding: 16px 18px; position: relative; overflow: hidden;
  opacity: 0; transform: translateY(10px); animation: kpiIn 500ms cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes kpiIn { to { opacity:1; transform:none; } }
.kpi::after { content:""; position:absolute; inset:0 auto 0 0; width:3px; background: var(--kpi-accent, var(--cc-mint)); opacity:.9; }
.kpi .k-label { font-size: 11.5px; color: var(--cc-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .k-num { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; line-height: 1; color: #fff; }
.kpi .k-foot { font-size: 12px; color: var(--cc-muted); margin-top: 6px; }
.kpi .k-foot .up { color: var(--cc-mint); }

/* Heatmap (GitHub-style) */
.heatmap { display: flex; gap: 3px; flex-wrap: wrap; align-content: flex-start; }
.heat-cell { width: 15px; height: 15px; border-radius: 3px; background: rgba(255,255,255,0.05);
  transition: transform 120ms ease; opacity: 0; animation: heatIn 400ms ease forwards; }
.heat-cell:hover { transform: scale(1.25); outline: 1px solid rgba(255,255,255,0.4); }
@keyframes heatIn { to { opacity: 1; } }
.heat-l1 { background: rgba(0,230,163,0.25); }
.heat-l2 { background: rgba(0,230,163,0.45); }
.heat-l3 { background: rgba(0,230,163,0.7); }
.heat-l4 { background: rgba(0,230,163,0.95); box-shadow: 0 0 8px rgba(0,230,163,0.5); }
.heat-legend { display: flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 11px; color: var(--cc-muted); }
.heat-legend .hk { width: 12px; height: 12px; border-radius: 3px; }

/* Range toggle on dark */
.cc-toggle { border-color: var(--cc-line); }
.cc-toggle button { background: transparent; color: var(--cc-muted); border-color: var(--cc-line); }
.cc-toggle button:hover { background: rgba(255,255,255,0.05); }
.cc-toggle button.active { background: rgba(0,230,163,0.16); color: var(--cc-mint); }

/* Actor cards on dark */
.cc .actor-card { background: linear-gradient(180deg, var(--cc-panel), var(--cc-panel-2));
  border-color: var(--cc-line); box-shadow: none; }
.cc .actor-card .ac-email { color: var(--cc-text); }
.cc .actor-card .ac-big { color: #fff; }
.cc .actor-card .ac-sub { color: var(--cc-muted); }

/* Event log on dark */
.cc-log { border: 1px solid var(--cc-line); border-radius: 14px; overflow: auto; max-height: 360px; }
.cc-table { color: var(--cc-text); }
.cc-table thead th { background: rgba(255,255,255,0.03); color: var(--cc-muted); border-color: var(--cc-line); }
.cc-table td { border-color: var(--cc-line); }
.cc-table .muted { color: var(--cc-muted); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 13.5px; box-shadow: 0 10px 30px rgba(11,20,55,0.3);
  opacity: 0; pointer-events: none; transition: all 220ms ease; z-index: 80;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #b30000; }

@media (max-width: 760px) {
  .fm { grid-template-columns: 1fr; }
  .fm-tree-col { border-right: 0; border-bottom: 1px solid var(--line); }
  .fm-tree { max-height: 240px; }
}

/* Team grants matrix rows (contributor per-folder access). Grouped by
   tree (Internal / Investor VDR) side by side, with the same blue/red
   heading colors as the Content page tabs — folders in different trees
   can share a name, so the grouping + color is what keeps them from
   being confused. */
.tg-tree-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .tg-tree-cols { grid-template-columns: 1fr; } }
.tg-tree-heading { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 5px 10px; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tg-tree-heading--internal { color: #fff; background: var(--info); }
.tg-tree-heading--vdr { color: #fff; background: var(--danger); }
.tg-tree-group .tg-list { border-radius: 0 0 var(--r-sm) var(--r-sm); max-height: 46vh; }
/* Scroll-shadow cue, not a styled native scrollbar — macOS's OS-level
   auto-hide scrollbar setting silently overrides scrollbar-width and
   ::-webkit-scrollbar CSS, so this fades a shadow at the scrollable edge
   instead (visible regardless of the OS scrollbar setting). See the
   matching .acc-list comment in admin-shell.css for the full rationale. */
.tg-list {
  max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); padding: 4px 0;
  background:
    linear-gradient(#fff 30%, rgba(255,255,255,0)) local,
    linear-gradient(rgba(255,255,255,0), #fff 70%) 0 100% local,
    radial-gradient(farthest-side at 50% 0, rgba(17,30,68,0.12), rgba(17,30,68,0)) 0 0,
    radial-gradient(farthest-side at 50% 100%, rgba(17,30,68,0.12), rgba(17,30,68,0)) 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 30px, 100% 30px, 100% 8px, 100% 8px;
  background-attachment: local, local, scroll, scroll;
}
.tg-row { display: flex; align-items: center; gap: 12px; padding: 5px 12px; }
.tg-row:hover { background: var(--gray-25); }
.tg-name { flex: 1; font-size: 13.5px; }
.tg-empty { padding: 14px 12px; font-size: 13px; color: var(--muted); }

/* File-row e-signature button — clear label + state */
.fm-file .btn[data-act="sign"] { gap: 5px; font-size: 12.5px; padding: 0 10px; height: 28px; }

/* ══ Per-investor branding modal ══════════════════════════════════ */
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 560px){ .brand-grid { grid-template-columns: 1fr; } }
.brand-logo-preview {
  height: 72px; border: 1px dashed var(--border-strong); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: repeating-conic-gradient(#f3f5fa 0% 25%, #fff 0% 50%) 50%/16px 16px;
}
.brand-logo-preview img { max-height: 60px; max-width: 100%; object-fit: contain; }
.brand-swatch {
  width: 38px; height: 34px; padding: 0; border: 1px solid var(--border-strong);
  border-radius: 8px; background: none; cursor: pointer; flex-shrink: 0;
}
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-bg); }

/* Light/dark segmented control */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.seg button {
  border: 0; background: #fff; color: var(--text-2); padding: 7px 16px; cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.seg button.on { background: var(--navy); color: #fff; }

/* Live preview mock — colors injected via style.setProperty (--pv-*). */
.brand-preview { margin-top: 4px; }
.pv-room {
  border: 1px solid var(--pv-border, #e3e6ef); border-radius: 12px; overflow: hidden;
  background: var(--pv-bg, #f5f7fb); color: var(--pv-text, #111e44);
  transition: opacity 140ms ease;
}
.brand-preview.pv-disabled .pv-room { opacity: 0.5; filter: grayscale(0.4); }
.pv-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--pv-surface, #fff);
  border-bottom: 1px solid var(--pv-border, #e3e6ef);
}
.pv-logo { display: inline-flex; align-items: center; height: 26px; }
.pv-logo-img { max-height: 26px; max-width: 150px; object-fit: contain; }
.pv-wordmark { font-weight: 700; letter-spacing: .04em; font-size: 15px; color: var(--pv-text, #111e44); }
.pv-wordmark b { color: var(--pv-primary, #00d999); font-weight: 700; }
.pv-user { font-size: 12px; color: var(--pv-text, #111e44); opacity: .6; }
.pv-body { padding: 14px; display: flex; align-items: center; gap: 16px; }
.pv-card {
  flex: 1; background: var(--pv-surface, #fff); border: 1px solid var(--pv-border, #e3e6ef);
  border-radius: 10px; padding: 12px 14px;
}
.pv-h { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.pv-row { display: flex; align-items: center; gap: 10px; }
.pv-tag {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--pv-primary, #00d999) 16%, transparent);
  color: var(--pv-primary, #00d999);
}
.pv-btn {
  margin-left: auto; border: 0; border-radius: 8px; padding: 7px 16px; cursor: default;
  font-size: 13px; font-weight: 600;
  background: var(--pv-primary, #00d999); color: var(--pv-on-primary, #0b1437);
}
.pv-swatches { display: flex; flex-direction: column; gap: 8px; }
.pv-sw { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.08); }
.pv-sw-primary { background: var(--pv-primary, #00d999); }
.pv-sw-accent { background: var(--pv-accent, #2f6fed); }

/* SignWell test-mode banner (Investors section) */
.esign-testbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px; background: #fbfcfe; font-size: 13.5px;
}

/* ---- Document viewer overlay (Content tree "Open") -----------------
   Same visual design as the investor room / workspace viewer
   (room.css's .viewer-*), reimplemented here rather than loading
   room.css wholesale — that stylesheet's --brand-* variables are for
   per-investor white-labeling and don't belong in the admin shell. */
.viewer-overlay {
  position: fixed; inset: 0; background: rgba(11,20,55,0.9);
  display: none; align-items: stretch; justify-content: stretch; z-index: 200;
}
.viewer-overlay.open { display: flex; }
.viewer-frame {
  width: 100%; height: 100%; background: #fff;
  border-radius: 0; overflow: hidden; display: flex; flex-direction: column;
}
@media (min-width: 1400px) {
  .viewer-overlay { padding: 24px; }
  .viewer-frame { width: min(1500px, 100%); margin: 0 auto; border-radius: 12px; }
}
.viewer-frame header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 16px; background: var(--navy); color: #fff;
}
.viewer-frame header #viewerTitle {
  color: rgba(255,255,255,0.9); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.viewer-frame header .btn {
  background: var(--mint); color: var(--navy); border: 0; font-weight: 600;
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 13.5px;
}
.viewer-frame header .btn:hover { filter: brightness(1.06); }
.viewer-frame header .btn.secondary {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5);
}
.viewer-frame header .btn.secondary:hover {
  background: rgba(255,255,255,0.12); border-color: #fff;
}
.viewer-frame iframe { flex: 1; border: 0; width: 100%; }
.viewer-frame iframe[hidden] { display: none; }
.viewer-pages { flex: 1; overflow-y: auto; background: #525659; padding: 20px 0; }
.viewer-pages[hidden] { display: none; }
.viewer-loading {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: #525659; color: #eee; font-size: 14px; gap: 10px;
}
.viewer-loading[hidden] { display: none; }
.viewer-loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  animation: viewer-spin 0.8s linear infinite;
}
@keyframes viewer-spin { to { transform: rotate(360deg); } }
.viewer-pages .pdf-page { max-width: 1100px; margin: 0 auto 16px; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.35); border-radius: 2px; overflow: hidden; min-height: 40px; }
