/* ============================================================
   Staff-facing admin: content tree + composer, invites, activity.
   ============================================================ */

.ad-body { height: 100dvh; overflow: hidden; }
.ad-app { display: flex; flex-direction: column; height: 100dvh; }

/* ---------- top bar ---------- */

.ad-top {
  height: var(--dr-top-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid rgba(255,255,255,0.09);
  color: #fff;
}
/* Pre-whitened asset rather than an invert filter — see the note on
   .dr-brand img in viewer.css. */
.ad-top img { height: 17px; }
.ad-top .dr-badge { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.7); }
.ad-spacer { flex: 1; }
.ad-top .dr-icon-btn { color: rgba(255,255,255,0.6); }
.ad-top .dr-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.08); border-color: transparent; }

.ad-tabs { display: flex; gap: 2px; }
.ad-tab {
  font-family: var(--mono);
  font-size: 0.70rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 7px 13px;
  border: none;
  border-radius: var(--r);
  background: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
}
.ad-tab:hover { color: #fff; background: rgba(255,255,255,0.07); }
.ad-tab.is-active { color: #fff; background: rgba(74,184,224,0.18); }

/* ---------- panels ---------- */

.ad-panel { flex: 1; min-height: 0; display: none; }
.ad-panel.is-active { display: grid; }

#panel-content { grid-template-columns: 320px 1fr; }
#panel-investors, #panel-activity { grid-template-columns: 1fr; overflow-y: auto; }

/* ---------- content tree ---------- */

.ad-tree {
  border-right: 1px solid var(--rule);
  background: var(--bg-off);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ad-tree-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.ad-tree-head .dr-mono { flex: 1; }
.ad-tree-list { flex: 1; overflow-y: auto; padding: 6px 0 40px; }

.ad-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px calc(8px + var(--depth, 0) * 14px);
  border-left: 2px solid transparent;
  font-size: 0.82rem;
  color: var(--ink-mid);
  cursor: pointer;
}
.ad-node:hover { background: rgba(0,0,0,0.035); }
.ad-node.is-active { background: #fff; border-left-color: var(--blue); color: var(--ink); font-weight: 500; }
.ad-node-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-node-glyph { flex-shrink: 0; color: var(--ink-faint); }
.ad-node.is-active .ad-node-glyph { color: var(--blue); }
.ad-node-chevron {
  flex-shrink: 0;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: var(--r);
  transition: transform 0.16s var(--ease);
}
.ad-node-chevron:hover { color: var(--ink); }
.ad-node-chevron.is-open { transform: rotate(90deg); }
.ad-node-spacer { width: 12px; flex-shrink: 0; }

.ad-node-actions { display: flex; gap: 1px; opacity: 0; }
.ad-node:hover .ad-node-actions, .ad-node.is-active .ad-node-actions { opacity: 1; }
.ad-node-actions button {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: none; background: none;
  color: var(--ink-faint); cursor: pointer; border-radius: var(--r);
}
.ad-node-actions button:hover { background: rgba(0,0,0,0.07); color: var(--ink); }
.ad-node-unpub { opacity: 0.45; }

/* ---------- editor ---------- */

.ad-editor { min-width: 0; overflow-y: auto; background: var(--bg); }

.ad-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(249,249,247,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.ad-toolbar .dr-mono { flex: 1; }
.ad-savehint { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; }
.ad-savehint.is-saving { color: var(--ink-faint); }
.ad-savehint.is-saved { color: #1a7a4a; }
.ad-savehint.is-error { color: #9b1c1c; }

.ad-editor-body { padding: 26px 56px 120px; max-width: 900px; }
.ad-meta { border: 1px solid var(--rule); background: #fff; padding: 18px 20px; margin-bottom: 26px; }
.ad-meta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.ad-meta-row .dr-field { flex: 1; min-width: 180px; }

.ad-cover-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0 0; margin-top: 4px; border-top: 1px solid var(--rule);
}
.ad-cover-thumb {
  width: 88px; height: 50px; object-fit: cover;
  border: 1px solid var(--rule); background: var(--bg-off);
}

/* ---------- folder view ---------- */

.ad-folder-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}
.ad-folder-count { margin-bottom: 12px; }
.ad-folder .blk-file:hover { background: var(--bg-off); }

/* Hosts the same file viewer the investor sees. */
/* Bounded, and a column, for the same reason .dr-main.is-pdf is: the PDF
   viewer measures fit-to-page against its scroller's height and pages by
   scrolling it, so an unbounded stage leaves both with nothing to work
   against. The investor pane gets the viewport; here it is a fixed box. */
.ad-preview {
  border: 1px solid var(--rule);
  background: #fff;
  min-height: 320px;
}
.ad-preview.is-pdf {
  height: 70vh;
  display: flex;
  flex-direction: column;
}
.ad-preview.is-pdf .dr-pdf-toolbar { flex-shrink: 0; position: static; }
.ad-preview.is-pdf .dr-pdf-scroll { flex: 1; min-height: 0; overflow: auto; }
.ad-preview .dr-pdf-scroll { padding: 16px; gap: 16px; }
.ad-preview .dr-pdf-toolbar { border-radius: 0; }

/* ---------- tables ---------- */

.ad-wrap { padding: 26px 28px 80px; max-width: 1240px; width: 100%; }
.ad-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.ad-head h1 { font-size: 1.5rem; font-weight: 200; letter-spacing: -0.02em; flex: 1; }
.ad-head h1 strong { font-weight: 800; }

.ad-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--rule); }
.ad-table th {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.ad-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.84rem;
  color: var(--ink-mid);
  vertical-align: middle;
}
.ad-table tr:last-child td { border-bottom: none; }
.ad-table tbody tr:hover { background: var(--bg-off); }
.ad-table .ad-strong { color: var(--ink); font-weight: 500; }
.ad-table .ad-num { font-family: var(--mono); font-size: 0.76rem; white-space: nowrap; }
.ad-table-wrap { overflow-x: auto; }

.ad-row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------- key reveal ---------- */

.ad-keybox {
  border: 1px solid var(--blue);
  background: #f2f8fc;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.ad-keybox-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-d);
  margin-bottom: 9px;
}
.ad-key {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid var(--rule);
  padding: 9px 11px;
  overflow-wrap: anywhere;
}
.ad-key span { flex: 1; }
.ad-key + .ad-keybox-label { margin-top: 16px; }
.ad-keybox-note { margin-top: 10px; font-size: 0.8rem; color: var(--ink-mid); line-height: 1.6; }
.ad-keybox-warn {
  margin-top: 12px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #8a4b12;
  background: #fdf8ec;
  border: 1px solid #ecdcb4;
  border-radius: var(--r);
  padding: 10px 12px;
}

/* ---------- modal ---------- */

.ad-modal-bg {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(11,20,34,0.45);
  display: grid; place-items: center;
  padding: 24px;
  overflow-y: auto;
}
.ad-modal {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 26px 60px rgba(0,0,0,0.25);
  width: 100%; max-width: 520px;
  padding: 26px 28px;
  max-height: 90dvh;
  overflow-y: auto;
}
.ad-modal h2 { font-size: 1.2rem; font-weight: 300; margin-bottom: 18px; }
.ad-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.ad-scope-list {
  border: 1px solid var(--rule);
  max-height: 200px; overflow-y: auto;
  padding: 6px;
}
.ad-scope-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px calc(6px + var(--depth,0) * 14px);
  font-size: 0.82rem;
}
.ad-scope-item input { width: auto; }

/* ---------- analytics ---------- */

.ad-bar {
  height: 5px;
  background: var(--blue);
  border-radius: 20px;
  min-width: 2px;
}
.ad-bar-track { background: var(--bg-off); border-radius: 20px; width: 100px; }

.ad-heat { display: flex; gap: 1px; align-items: flex-end; height: 44px; }
.ad-heat-col { flex: 1; min-width: 2px; background: var(--blue); opacity: 0.85; }

/* ---------- login ---------- */

.ad-login { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: var(--bg-dark); background-image: var(--dots-dark); background-size: var(--dots-size); }

/* ---------- upload ---------- */

.ad-drop {
  border: 1px dashed var(--rule);
  background: #fff;
  padding: 26px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
  cursor: pointer;
}
.ad-drop.is-over { border-color: var(--blue); background: #f2f8fc; color: var(--blue-d); }
.ad-upload-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 0.82rem; border-bottom: 1px solid var(--rule);
}
.ad-upload-row:last-child { border-bottom: none; }
.ad-upload-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-upload-state { font-family: var(--mono); font-size: 0.70rem; letter-spacing: 0.12em; text-transform: uppercase; }
.ad-upload-state.is-done { color: #1a7a4a; }
.ad-upload-state.is-failed { color: #9b1c1c; }

@media (max-width: 900px) {
  #panel-content { grid-template-columns: 1fr; }
  .ad-tree { display: none; }
  .ad-editor-body { padding: 20px 20px 90px; }
  .ad-wrap { padding: 18px 14px 60px; }
}

/* ---------- pinned fundraising row ---------- */

.ad-node-pinned {
  border-bottom: 1px solid var(--rule);
  margin-bottom: 6px;
  padding-bottom: 7px;
}
.ad-pin-flag {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  flex-shrink: 0;
}
.ad-node-pinned.is-active .ad-pin-flag { color: var(--blue); }

/* ---------- raise editor ---------- */

.ad-section-label { margin-bottom: 12px; }
.ad-meta .ad-section-label:not(:first-child) { margin-top: 20px; }
.ad-hint {
  margin-top: 12px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--ink-faint);
}
.ad-preview-raise {
  border: 1px solid var(--rule);
  background: var(--bg);
  padding: 20px;
}
/* The preview is the investor's panel dropped into a smaller column, so
   it loses the outer frame it would otherwise double up on. */
.ad-preview-raise .dr-raise { border: none; padding: 0; margin-bottom: 0; }
