/*
 * Waterfall design tokens + component styles.
 *
 * Source of truth for color / spacing / typography. Inspired by
 * marketplace's design language ("Sidecar/Navable universe") but
 * deliberately evolved — see docs/design-tokens.md for the rationale
 * behind specific values and the patterns we deliberately don't replicate.
 *
 * Rules (also in CLAUDE.md):
 *   - All colors / spacing / type sizes via var(--token). No raw hex /
 *     pixel values in component styles below this :root block.
 *   - Component classes compose tokens; never the other way around.
 *   - 4 classes per element max; reach for a new component class
 *     before stacking utilities.
 *   - No inline `style="..."` in templates. Use a class.
 *
 * The :root block uses light values today. A future
 * :root[data-theme="dark"] override can flip the design without
 * touching component classes.
 */

:root {
  /* --- Color: brand --- */
  --color-primary: #5B5BD6;            /* refined purple-blue, anchor */
  --color-primary-hover: #4A4AC4;
  --color-primary-subtle: #EEF0FF;     /* primary tinted for backgrounds */

  /* --- Color: accent (CTA) --- */
  --color-accent: #14B8A6;             /* modern teal, replaces marketplace's #0D8A6A */
  --color-accent-hover: #0F9488;

  /* --- Color: status (semantic) --- */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger:  #EF4444;

  /* --- Color: status pills (bg + text pairs, dark-mode-pair-able later) --- */
  --color-pill-draft-bg:    #FEF3C7;
  --color-pill-draft-text:  #92400E;
  --color-pill-review-bg:   #DBEAFE;
  --color-pill-review-text: #1E40AF;
  --color-pill-approved-bg: #D1FAE5;
  --color-pill-approved-text: #065F46;
  --color-pill-neutral-bg: #E2E8F0;
  --color-pill-neutral-text: #334155;

  /* --- Color: text --- */
  --color-text:        #0F172A;        /* slate-900, primary text */
  --color-text-muted:  #475569;        /* slate-600, secondary */
  --color-text-subtle: #94A3B8;        /* slate-400, hints / placeholders */
  --color-text-on-dark: #F1F5F9;       /* on dark surfaces */

  /* --- Color: links ---
   * Distinct from primary: same purple-blue family but darker/less
   * saturated, since the brand purple is tuned for filled buttons
   * (white text on saturated bg) and reads too vibrant as link text
   * on a white background. */
  --color-link: #4338CA;
  --color-link-hover: #3730A3;

  /* --- Color: surfaces --- */
  --color-bg-page:    #F8FAFC;         /* slate-50 */
  --color-bg-surface: #FFFFFF;         /* cards, table rows */
  --color-bg-subtle:  #F1F5F9;         /* table headers, hover, striped */
  --color-bg-nav:     #0F172A;         /* nav bar */

  /* --- Color: borders --- */
  --color-border:        #E2E8F0;      /* slate-200, default */
  --color-border-strong: #CBD5E1;      /* slate-300, emphasized */

  /* --- Color: GP/LP recipient accents (used in trace tables) --- */
  --color-gp-fg: #B45309;              /* amber-700, GP rows */
  --color-lp-fg: #4338CA;              /* indigo-700, LP rows */

  /* --- Typography --- */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               'Liberation Mono', monospace;

  /* Type scale (15px base — generous-er than marketplace's 14) */
  --text-xs:   12px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   16px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;

  /* Line heights */
  --leading-tight:   1.2;
  --leading-normal:  1.5;
  --leading-relaxed: 1.6;

  /* Weights */
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Letter spacing for caps/labels */
  --tracking-wide: 0.04em;

  /* --- Spacing (4px base) --- */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  12px;
  --space-lg:  16px;
  --space-xl:  24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;

  /* --- Radii --- */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-pill: 999px;

  /* --- Shadows (subtle by design) --- */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.08);

  /* --- Layout --- */
  --container-max: 1200px;
  --container-padding-mobile: var(--space-lg);
  --container-padding-desktop: var(--space-2xl);

  /* --- Focus rings (accessibility — every interactive element) --- */
  --focus-ring-color: var(--color-primary);
  --focus-ring-offset: 2px;
  --focus-ring-width: 2px;
}

/* =============================================================
 * Base / reset
 * ============================================================= */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-sm) 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
}

h2 {
  font-size: var(--text-lg);
  margin-top: var(--space-2xl);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* Universal focus ring for accessibility — overrides browser defaults
 * and applies to every interactive element. */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* =============================================================
 * Layout
 * ============================================================= */

nav {
  background: var(--color-bg-nav);
  color: var(--color-text-on-dark);
  padding: var(--space-md) var(--space-2xl);
  display: flex;
  gap: var(--space-xl);
  align-items: center;
}

nav a {
  color: var(--color-text-on-dark);
  font-weight: var(--weight-medium);
}

nav a:hover {
  color: var(--color-primary-subtle);
  text-decoration: none;
}

nav .brand {
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  font-size: var(--text-md);
}

nav .spacer {
  flex: 1;
}

nav .nav-user {
  color: var(--color-primary-subtle);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
}

main {
  max-width: var(--container-max);
  margin: var(--space-2xl) auto;
  padding: 0 var(--container-padding-desktop);
}

.meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-xl);
}

.footnote {
  margin-top: var(--space-2xl);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* =============================================================
 * Stat cards (summary tiles)
 * ============================================================= */

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin: var(--space-lg) 0;
}

.stat {
  background: var(--color-bg-surface);
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.stat .label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-weight: var(--weight-semibold);
}

.stat .value {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  margin-top: var(--space-xs);
  font-variant-numeric: tabular-nums;
}

/* =============================================================
 * Tables
 * ============================================================= */

table {
  border-collapse: collapse;
  width: 100%;
  margin-top: var(--space-sm);
  font-variant-numeric: tabular-nums;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

tr:last-child td {
  border-bottom: none;
}

th {
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  background: var(--color-bg-subtle);
}

th.num, td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

th.nowrap, td.nowrap {
  white-space: nowrap;
}

/* Sparse tables (few columns) otherwise spread their columns into even
   thirds, stranding skinny data columns mid-table. Mark the label column
   col-grow so it absorbs the slack and the data columns hug the right. */
th.col-grow, td.col-grow {
  width: 100%;
}

/* Distributions-index headline stats. */
.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xl);
  margin: var(--space-md) 0 var(--space-xl);
}

.summary-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
}

.summary-stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.recon-flag {
  color: var(--color-warning);
  font-weight: var(--weight-medium);
}

.recon-flag-row {
  background: #FFFBEB;
}

.delta-pos {
  color: #065F46;
}

.delta-neg {
  color: #991B1B;
}

/* Member pivot stacks one carry table per Profit Source. Fixed layout with
   shared column widths so every table's columns line up vertically, despite
   each Profit Source showing a different mix of classes. */
.member-carry-table {
  table-layout: fixed;
}

.member-carry-table th:first-child,
.member-carry-table td:first-child {
  width: 46%;
}

.member-carry-table th.num,
.member-carry-table td.num {
  width: 27%;
}

.recipient-gp {
  color: var(--color-gp-fg);
  font-weight: var(--weight-semibold);
}

.recipient-lp {
  color: var(--color-lp-fg);
  font-weight: var(--weight-semibold);
}

.tier-cell, .investment-cell {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Sortable column headers. Render as quiet links inside the <th>;
 * the arrow shows direction on the active column and a muted hint on
 * inactive ones so the affordance is always visible. */
.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-link:hover {
  color: var(--color-text);
  text-decoration: none;
}

.sort-link-active {
  color: var(--color-text);
}

.sort-arrow {
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  line-height: 1;
}

.sort-link-active .sort-arrow {
  color: var(--color-primary);
}

/* =============================================================
 * Filter bar (above tables)
 * ============================================================= */

.filter-bar {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin: var(--space-lg) 0;
  flex-wrap: wrap;
}

.filter-bar input[type="search"],
.filter-bar input[type="text"],
.filter-bar select {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--color-bg-surface);
  color: var(--color-text);
  min-width: 220px;
}

.filter-bar select {
  min-width: 160px;
  /* Replace the native caret (which renders cramped against the border)
     with a custom chevron set in from the right edge. */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='none' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 3.5 5 6.5 8 3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: calc(var(--space-md) * 2 + 10px);
}

.filter-bar label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-weight: var(--weight-semibold);
}

/* =============================================================
 * Pagination
 * ============================================================= */

.pagination {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  justify-content: flex-end;
  margin: var(--space-lg) 0;
  font-size: var(--text-sm);
}

.page-link {
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  color: var(--color-text);
  background: var(--color-bg-surface);
  text-decoration: none;
}

.page-link:hover {
  background: var(--color-bg-subtle);
  text-decoration: none;
  color: var(--color-text);
}

.page-link-disabled {
  color: var(--color-text-subtle);
  background: var(--color-bg-subtle);
  cursor: not-allowed;
}

.page-link-disabled:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text-subtle);
}

.page-meta {
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.page-meta-count {
  color: var(--color-text-subtle);
}

/* =============================================================
 * Buttons
 * ============================================================= */

button, .btn {
  background: var(--color-primary);
  color: var(--color-bg-surface);
  border: 1px solid var(--color-primary);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: var(--leading-normal);
  transition: background-color 120ms ease, border-color 120ms ease;
}

button:hover, .btn:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-bg-surface);
  text-decoration: none;
}

.btn-secondary {
  background: var(--color-bg-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
}

.btn-secondary:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn-disabled {
  background: var(--color-bg-subtle);
  color: var(--color-text-subtle);
  border-color: var(--color-border);
  cursor: not-allowed;
}

.btn-disabled:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text-subtle);
}

/* =============================================================
 * Pills / badges
 * ============================================================= */

.pill {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: var(--color-pill-neutral-bg);
  color: var(--color-pill-neutral-text);
  letter-spacing: var(--tracking-wide);
  text-transform: capitalize;
}

.pill-draft {
  background: var(--color-pill-draft-bg);
  color: var(--color-pill-draft-text);
}

.pill-review {
  background: var(--color-pill-review-bg);
  color: var(--color-pill-review-text);
}

.pill-approved {
  background: var(--color-pill-approved-bg);
  color: var(--color-pill-approved-text);
}

/* =============================================================
 * Forms
 * ============================================================= */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 540px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-row label {
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--color-bg-surface);
  color: var(--color-text);
  transition: border-color 120ms ease;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--color-primary);
}

.form-row input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.form-row .helptext {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.form-row .errorlist,
.errorlist {
  color: var(--color-danger);
  font-size: var(--text-sm);
  list-style: none;
  padding: 0;
  margin: var(--space-xs) 0 0 0;
}

.form-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.form-actions-top-spacing {
  margin-top: var(--space-lg);
}

.inline-form {
  display: inline-flex;
  gap: var(--space-sm);
  align-items: center;
}

.inline-form input[type="text"] {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: inherit;
}

/* Formset tables (cap table + cash flows) — denser styling than form-stack */
.formset-table input,
.formset-table select {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--color-bg-surface);
}

.formset-table input[type="checkbox"] {
  transform: scale(1.1);
}

/* Money inputs: right-align, tabular numerals. Class is added by
   forms.MoneyDecimalField + the money-input.js enhancement. */
input.money-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* =============================================================
 * Empty / lock states + flash messages
 * ============================================================= */

.empty-state {
  color: var(--color-text-subtle);
  font-style: italic;
  padding: var(--space-lg) 0;
}

.lock-banner {
  background: var(--color-pill-draft-bg);
  color: var(--color-pill-draft-text);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
  border-left: 3px solid var(--color-warning);
}

.gated-note {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-style: italic;
  margin-bottom: var(--space-sm);
}

.messages {
  list-style: none;
  padding: 0;
  margin: var(--space-lg) 0;
}

.messages li {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  font-size: var(--text-sm);
}

.messages .success {
  background: var(--color-pill-approved-bg);
  color: var(--color-pill-approved-text);
}

.messages .error {
  background: #FEE2E2;                 /* one-off: error flash variant of pill */
  color: #991B1B;
}

/* =============================================================
 * Workflow actions row (status-transition buttons + action links)
 * ============================================================= */

.workflow-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin: var(--space-lg) 0;
  flex-wrap: wrap;
}

.workflow-actions form {
  margin: 0;
}

/* =============================================================
 * Drill-in list (fund-detail navigation to subpages)
 * ============================================================= */

.drill-list {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.drill-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.drill-list li:last-child {
  border-bottom: none;
}

.drill-list a {
  font-weight: 500;
}

.drill-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* =============================================================
 * Code (inline)
 * ============================================================= */

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-subtle);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

/* =============================================================
 * Responsive
 *
 * Three breakpoints. mobile = under tablet; tablet / desktop are the
 * inflection points where the layout changes shape.
 * --bp-mobile and --bp-desktop are exposed as tokens for future JS use,
 * but media queries can't read CSS variables — the values below must
 * stay in sync with :root.
 * ============================================================= */

@media (max-width: 767px) {
  main {
    padding: 0 var(--container-padding-mobile);
    margin: var(--space-lg) auto;
  }

  .summary {
    grid-template-columns: 1fr 1fr;
  }

  nav {
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-md);
  }
}

@media (max-width: 480px) {
  .summary {
    grid-template-columns: 1fr;
  }
}

/* Customer-app distribution views */
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.back-link {
  display: inline-block;
  margin-bottom: var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.meta-inline {
  font-weight: var(--weight-normal, 400);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.table-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-sm);
}

.rules-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-xl);
  display: grid;
  gap: var(--space-md);
}

.rule-item {
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.rule-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
}

.rule-detail {
  margin-top: var(--space-xs, 4px);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.rule-applies {
  margin-top: var(--space-xs, 4px);
  font-size: var(--text-sm);
}

/* Per-member allocation ledger (Anna QA tool). Exceptions (unplaced grants,
   pending assumptions, movements) surface in panels up top; the full
   per-(fund, class) event trail is collapsed below to tame big holders. */
.ledger-panel {
  border: 1px solid var(--color-warning);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-md);
  background: #FEF3C7;
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  color: #78350F;
}

.ledger-panel-title {
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-sm);
}

.ledger-flags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-xs);
  font-size: var(--text-sm);
}

.ledger-empty {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-xl);
}

.ledger-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
}

.ledger-summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  font-weight: var(--weight-medium);
}

.ledger-summary-net {
  font-family: var(--font-mono);
  color: var(--color-text-muted);
}

.ledger-event-table {
  width: 100%;
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
}

.ledger-event-table th,
.ledger-event-table td {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
}

.ledger-event-table .num {
  text-align: right;
  font-family: var(--font-mono);
}

.ledger-neg {
  color: var(--color-warning);
}

.ledger-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* OA citation tooltips (customer app) */
.cited {
  border-bottom: 1px dotted var(--color-border-strong);
  cursor: help;
}

.cite-marker {
  font-size: 0.7em;
  color: var(--color-primary);
  margin-left: 1px;
  vertical-align: super;
}

.cite-marker-caveat {
  color: var(--color-warning);
}

/* Tooltip body (rendered inside Tippy via the hidden <template>). */
.cite-tip {
  display: block;
  text-align: left;
}

.cite-row {
  display: block;
}

.cite-row + .cite-row {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.cite-ref {
  opacity: 0.75;
  font-style: italic;
}

/* OA reference rendered as a deep-link into the /oa viewer. */
.oa-link {
  opacity: 1;
  color: var(--color-primary);
  text-decoration: underline;
}

/* Same link inside the dark Tippy citation card needs a light, legible colour. */
.tippy-box[data-theme~="oa"] .oa-link {
  color: #93C5FD;
}

.cite-row-caveat strong {
  color: var(--color-warning);
}

/* "oa" Tippy theme: a light, readable card instead of the default dark. */
.tippy-box[data-theme~="oa"] {
  background: var(--color-bg-nav);
  color: var(--color-text-on-dark);
  font-size: var(--text-sm);
  line-height: 1.45;
  border-radius: var(--radius-md, 8px);
}

.tippy-box[data-theme~="oa"] .tippy-arrow {
  color: var(--color-bg-nav);
}

/* Operating Agreement viewer (embedded PDF). */
.oa-viewer {
  width: 100%;
  margin-top: var(--space-md);
}

.oa-frame {
  width: 100%;
  height: 80vh;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: #fff;
}
