/*
 * dashboard.css — Budget Dashboard Plugin
 *
 * Wraps inside the active theme's shell. The theme handles the site
 * header, footer, and global nav. This file styles:
 *   1. The budget page header strip (FY title + year nav)
 *   2. The full-width dashboard area
 *   3. All dashboard UI components
 *
 * Edit --rusd-primary to match the district's brand color.
 */

/* ── Brand tokens ────────────────────────────────────────────────── */
:root {
  --rusd-primary:     #1B3A6B;
  --rusd-primary-lt:  #e8edf5;
  --rusd-accent:      #D97706;
  --rusd-text:        #0f172a;
  --rusd-text-muted:  #475569;
  --rusd-text-faint:  #94a3b8;
  --rusd-border:      rgba(0,0,0,0.1);
  --rusd-bg:          #ffffff;
  --rusd-bg-page:     #f1f5f9;
  --rusd-radius:      8px;
  --rusd-shadow:      0 1px 3px rgba(0,0,0,0.08);

  --d-text:           var(--rusd-text);
  --d-text-muted:     var(--rusd-text-muted);
  --d-text-faint:     var(--rusd-text-faint);
  --d-bg:             var(--rusd-bg);
  --d-bg2:            #f1f5f9;
  --d-border:         var(--rusd-border);
  --d-radius:         var(--rusd-radius);
}

/* ── Budget page scroll behaviour ───────────────────────────────── */
body.single-budget_year {
  overflow-x: clip;
  background: var(--rusd-bg-page);
}

/* ── Outer wrap ──────────────────────────────────────────────────── */

.rusd-budget-wrap {
  width: 100%;
  background: var(--rusd-bg-page);
  min-height: 60vh;
  overflow-x: hidden;
}

/* ════════════════════════════════════════════════════════════════════
   BUDGET PAGE HEADER STRIP
   ════════════════════════════════════════════════════════════════════ */

.rusd-page-header {
  background: #363636; /* matches theme's dark section color */
  border-bottom: 3px solid var(--primary-color, #9D2235);
  color: #fff;
  padding: 0;
}

.rusd-ph-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-family: "DM Sans", "Noto Sans", system-ui, sans-serif;
}

.rusd-ph-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rusd-ph-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .75;
}

.rusd-ph-fy {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.15;
}

/* ── Year nav (inside page header strip) ─────────────────────────── */

.rusd-year-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.rusd-year-nav-label {
  font-size: 11px;
  opacity: .6;
  margin-right: 2px;
  white-space: nowrap;
}

.rusd-year-link {
  color: #fff;
  opacity: .7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.25);
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.rusd-year-link:hover  { background: rgba(255,255,255,.15); opacity: 1; }
.rusd-year-link.active { background: rgba(255,255,255,.2); opacity: 1; border-color: rgba(255,255,255,.55); font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════
   DASHBOARD AREA
   ════════════════════════════════════════════════════════════════════ */

.rusd-dashboard-area {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
  box-sizing: border-box;
}

/* ── Error state ─────────────────────────────────────────────────── */

.rusd-error {
  background: #fff1f2;
  border: 1px solid #fca5a5;
  border-radius: var(--rusd-radius);
  padding: 1rem 1.25rem;
  color: #7f1d1d;
  font-size: 13px;
  margin: 1rem 0;
}

/* ════════════════════════════════════════════════════════════════════
   DASHBOARD SHELL
   ════════════════════════════════════════════════════════════════════ */

#rusd-dashboard { width: 100%; }

.d-shell {
  display: flex;
  background: var(--d-bg);
  border: 0.5px solid var(--d-border);
  border-radius: var(--rusd-radius);
  overflow: hidden;
  box-shadow: var(--rusd-shadow);
  min-height: 640px;
  width: 100%;

  /* Match theme fonts (theme loads DM Sans / Noto Sans via Google Fonts) */
  font-family: "DM Sans", "Noto Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--d-text);
  box-sizing: border-box;
}

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

/* ── Nav sidebar ─────────────────────────────────────────────────── */

.d-nav {
  width: 190px;
  flex-shrink: 0;
  border-right: 0.5px solid var(--d-border);
  padding: .625rem 0;
  display: flex;
  flex-direction: column;
  background: var(--d-bg);
}

.d-nav-brand {
  padding: 0 .875rem .625rem;
  border-bottom: 0.5px solid var(--d-border);
  margin-bottom: 4px;
}

.d-nav-year {
  font-size: 11px;
  color: var(--d-text-faint);
  letter-spacing: .07em;
  margin-bottom: 2px;
}

.d-nav-district {
  font-size: 13px;
  font-weight: 500;
  color: var(--d-text);
  line-height: 1.4;
}

.d-nav-sep {
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--d-text-faint);
  padding: 7px 1rem 2px;
  text-transform: uppercase;
}

.d-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--d-text-muted);
  border-radius: 0;
  line-height: 1.3;
  border-left: 2.5px solid transparent;
  transition: background .12s;
  font-family: inherit;
}

.d-nav-btn:hover { background: var(--d-bg2); color: var(--d-text); }

.d-nav-btn.active {
  background: var(--d-bg2);
  color: var(--d-text);
  font-weight: 500;
  border-left-color: var(--rusd-primary);
}

/* ── Page body ───────────────────────────────────────────────────── */

.d-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.d-page {
  padding: 1.125rem 1.4rem;
}

/* ════════════════════════════════════════════════════════════════════
   DASHBOARD COMPONENTS
   ════════════════════════════════════════════════════════════════════ */

/* ── Typography ─────────────────────────────────────────────────── */

.d-pt {
  font-size: 16px;
  font-weight: 500;
  color: var(--d-text);
  margin: 0 0 4px;
}

.d-pd {
  font-size: 13px;
  color: var(--d-text-muted);
  margin: 0 0 1rem;
  line-height: 1.65;
}

.d-st {
  font-size: 13px;
  font-weight: 500;
  color: var(--d-text);
  margin: 1rem 0 .5rem;
}

/* ── Two-column responsive grid (charts side by side → stacked) ──── */

.d-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* ── Stat cards ──────────────────────────────────────────────────── */

.d-sg {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 9px;
  margin-bottom: 1rem;
}

.d-sc {
  background: var(--d-bg2);
  border-radius: var(--d-radius);
  padding: .7rem .875rem;
}

.d-sl { font-size: 12px; color: var(--d-text-muted); margin-bottom: 2px; }
.d-sv { font-size: 20px; font-weight: 600; color: var(--d-text); }
.d-sv-pct { margin-left: 5px; font-size: 13px; font-weight: 600; color: var(--d-text); white-space: nowrap; }
.d-ss { font-size: 11px; color: var(--d-text-faint); margin-top: 2px; }

/* ── Legend ──────────────────────────────────────────────────────── */

.d-leg {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-bottom: .6rem;
}

.d-li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--d-text-muted);
}

.d-ls {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Info grid ───────────────────────────────────────────────────── */

.d-ig {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: .75rem;
}

.d-ic {
  background: var(--d-bg2);
  border-radius: var(--d-radius);
  padding: .75rem;
}

.d-ic-title { font-size: 13px; font-weight: 500; color: var(--d-text); margin-bottom: 3px; }
.d-ic-body  { font-size: 13px; color: var(--d-text-muted); line-height: 1.6; }

/* ── Insight box ─────────────────────────────────────────────────── */

.d-insight {
  background: #fefce8;
  border-left: 3px solid var(--rusd-accent);
  border-radius: 0 var(--d-radius) var(--d-radius) 0;
  padding: .875rem 1.125rem;
  margin-top: 1.25rem;
}

.d-insight-title {
  font-size: 10px;
  font-weight: 500;
  color: #92400E;
  margin-bottom: 8px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.d-ii {
  font-size: 13px;
  color: #44403c;
  margin-bottom: 7px;
  padding-left: 14px;
  position: relative;
  line-height: 1.6;
}

.d-ii::before { content: "→"; position: absolute; left: 0; color: var(--rusd-accent); }

/* ── TRS toggle ──────────────────────────────────────────────────── */

.d-ob-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--d-text-muted);
  margin-bottom: .75rem;
  transition: background .12s;
  font-family: inherit;
}

.d-ob-btn:hover { background: var(--d-bg2); }

.d-ob-btn.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}

.d-ob-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .4;
  flex-shrink: 0;
}

.d-ob-dot.active { opacity: 1; }

.d-ob-panel {
  display: none;
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 0 var(--d-radius) var(--d-radius) 0;
  padding: .75rem 1rem;
  margin-bottom: .875rem;
  font-size: 13px;
  color: var(--d-text-muted);
  line-height: 1.65;
}

.d-ob-panel.show { display: block; }
.d-ob-panel strong { color: var(--d-text); font-weight: 500; }

/* ── Badges ──────────────────────────────────────────────────────── */

.d-badge-board {
  display: inline-block;
  font-size: 10px;
  background: rgba(217,119,6,.15);
  color: #92400E;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
  font-weight: 500;
  letter-spacing: .03em;
}

.d-badge-new {
  display: inline-block;
  font-size: 10px;
  background: rgba(124,58,237,.15);
  color: #5B21B6;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
  font-weight: 500;
}

/* ── Strategic investments ───────────────────────────────────────── */

.d-strat-callout {
  background: rgba(124,58,237,.06);
  border-left: 3px solid #7C3AED;
  border-radius: 0 var(--d-radius) var(--d-radius) 0;
  padding: .875rem 1.125rem;
  margin-top: 1rem;
}

.d-strat-callout-title {
  font-size: 10px;
  font-weight: 500;
  color: #5B21B6;
  margin-bottom: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.d-strat-callout-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  font-size: 12px;
  color: var(--d-text-muted);
}

.d-strat-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--d-text-faint);
}

.d-goal-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.d-goal-tab {
  padding: 5px 11px;
  border-radius: var(--d-radius);
  font-size: 12px;
  cursor: pointer;
  border: 0.5px solid var(--d-border);
  background: none;
  color: var(--d-text-muted);
  transition: background .12s;
  font-family: inherit;
}

.d-goal-tab:hover { background: var(--d-bg2); }
.d-goal-tab.active { font-weight: 500; color: var(--d-text); background: var(--d-bg2); border-color: rgba(0,0,0,0.25); }

.d-si-card {
  border: 0.5px solid var(--d-border);
  border-left: 3px solid #1B3A6B;
  border-radius: var(--d-radius);
  padding: 1rem;
  margin-bottom: .75rem;
}

.d-si-goal {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.d-si-name { font-size: 14px; font-weight: 500; color: var(--d-text); margin-bottom: 4px; }
.d-si-desc { font-size: 13px; color: var(--d-text-muted); line-height: 1.6; margin-bottom: .625rem; }
.d-si-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.d-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(100,116,139,.1);
  color: var(--d-text-muted);
}

.d-tag-green { background: rgba(5,150,105,.1); color: #065F46; }

.d-metric {
  margin-top: .625rem;
  padding: .5rem .75rem;
  background: var(--d-bg2);
  border-radius: var(--d-radius);
  font-size: 12px;
  color: var(--d-text-muted);
}

.d-metric strong { color: var(--d-text); font-weight: 500; }

/* ── Capital projects ────────────────────────────────────────────── */

.d-cp-card {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  padding: .875rem;
  margin-bottom: .625rem;
}

.d-cp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
}

.d-cp-name { font-size: 13px; font-weight: 500; color: var(--d-text); }

.d-status {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.d-status-complete { background: rgba(5,150,105,.12);  color: #065F46; }
.d-status-progress { background: rgba(37,99,235,.12);  color: #1E40AF; }
.d-status-planned  { background: rgba(100,116,139,.1); color: #475569; }
.d-status-planning { background: rgba(217,119,6,.12);  color: #92400E; }

.d-phases {
  display: flex;
  gap: 4px;
  margin-top: .5rem;
  flex-wrap: wrap;
}

.d-phase {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--d-bg2);
  color: var(--d-text-faint);
}

.d-phase.done { background: rgba(5,150,105,.1); color: #065F46; }

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE
   Side-by-side layouts hold until actual phone widths.
   The dashboard compresses horizontally rather than stacking early.
   ════════════════════════════════════════════════════════════════════ */

/* ── Tighten spacing on medium screens ───────────────────────────── */
@media (max-width: 1024px) {
  .rusd-dashboard-area { padding: 1rem 1rem 2rem; }
  .d-page              { padding: .875rem 1rem; }
}

/* ── Narrow the page header strip ────────────────────────────────── */
@media (max-width: 768px) {
  .rusd-ph-inner { flex-direction: column; align-items: flex-start; gap: .5rem; padding: .75rem 1rem; }
  .rusd-ph-fy    { font-size: 18px; }
}

/* ── Phone: collapse nav to tab bar, stack layouts ───────────────── */
@media (max-width: 560px) {
  .d-shell              { flex-direction: column; }
  .d-nav                { width: 100%; border-right: none; border-bottom: 0.5px solid var(--d-border); flex-direction: row; flex-wrap: wrap; padding: .25rem .5rem; }
  .d-nav-brand          { display: none; }
  .d-nav-sep            { display: none; }
  .d-nav-btn            { border-left: none; border-bottom: 2px solid transparent; padding: 6px 8px; font-size: 11px; }
  .d-nav-btn.active     { border-bottom-color: var(--rusd-primary); background: none; }
  .d-two-col            { grid-template-columns: 1fr; }
  .d-ig                 { grid-template-columns: 1fr; }
  .d-strat-callout-grid { grid-template-columns: 1fr 1fr; }
  .d-sg                 { grid-template-columns: 1fr 1fr; }
  .rusd-dashboard-area  { padding: .75rem .75rem 1.5rem; }
  .rusd-ph-fy           { font-size: 16px; }
}

/* ── Very small phones ───────────────────────────────────────────── */
@media (max-width: 380px) {
  .d-strat-callout-grid { grid-template-columns: 1fr; }
  .d-sg                 { grid-template-columns: 1fr; }
  .rusd-year-link       { font-size: 11px; padding: 4px 9px; }
}

/* ── Start Here / reader path components ─────────────────────────── */

.d-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  background: var(--d-bg2);
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  padding: .95rem 1.05rem;
  margin-bottom: 1rem;
}

.d-hero-kicker {
  color: var(--d-text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.d-hero-title {
  color: var(--d-text);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}

.d-hero-copy {
  color: var(--d-text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin-top: 6px;
  max-width: 680px;
}

.d-hero-stat {
  background: var(--d-bg);
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  padding: .75rem .9rem;
  min-width: 170px;
  text-align: right;
}

.d-hero-stat span {
  display: block;
  color: var(--d-text-muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.d-hero-stat strong {
  color: var(--d-text);
  font-size: 22px;
  font-weight: 600;
}

.d-path-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: .25rem 0 1rem;
}

.d-path-card {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  background: var(--d-bg);
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  padding: .85rem;
  text-align: left;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}

.d-path-card:hover {
  border-color: rgba(27,58,107,.35);
  box-shadow: 0 8px 20px rgba(15,23,42,.08);
  transform: translateY(-1px);
}

.d-path-card span {
  color: var(--rusd-accent);
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.d-path-card strong {
  color: var(--d-text);
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 4px;
}

.d-path-card em {
  color: var(--d-text-muted);
  display: block;
  font-size: 12px;
  font-style: normal;
  line-height: 1.55;
}

.d-explain-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.d-explain {
  background: var(--d-bg2);
  border-radius: var(--d-radius);
  color: var(--d-text-muted);
  font-size: 12px;
  line-height: 1.6;
  padding: .65rem .75rem;
}

.d-explain summary {
  color: var(--d-text);
  cursor: pointer;
  font-weight: 600;
}

.d-explain div { margin-top: 6px; }

/* ── Major Changes components ────────────────────────────────────── */

.d-note {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 0 var(--d-radius) var(--d-radius) 0;
  color: var(--d-text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 1rem;
  padding: .75rem 1rem;
}

.d-change-grid {
  display: grid;
  gap: 8px;
}

.d-change-card {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  padding: .75rem .85rem;
}

.d-change-label {
  color: var(--d-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 3px;
}

.d-change-value {
  font-size: 18px;
  font-weight: 600;
}

.d-change-value.up { color: #047857; }
.d-change-value.down { color: #b45309; }

.d-change-sub {
  color: var(--d-text-muted);
  font-size: 11px;
  line-height: 1.45;
  margin-top: 2px;
}

@media (max-width: 760px) {
  .d-hero-card { grid-template-columns: 1fr; }
  .d-hero-stat { text-align: left; }
  .d-path-grid { grid-template-columns: 1fr; }
  .d-explain-row { grid-template-columns: 1fr; }
}

/* ── Align budget module to theme content width ──────────────────── */
:root {
  --rusd-content-max: 1200px;
  --rusd-content-pad: 40px;
}

.rusd-ph-inner,
.rusd-dashboard-area {
  max-width: var(--rusd-content-max);
  box-sizing: border-box;
  padding-left: var(--rusd-content-pad);
  padding-right: var(--rusd-content-pad);
}

@media only screen and (max-width: 767px) {
  :root { --rusd-content-pad: 32px; }

  .rusd-ph-inner,
  .rusd-dashboard-area {
    padding-left: var(--rusd-content-pad);
    padding-right: var(--rusd-content-pad);
  }
}

/* ── Fund Detail components ──────────────────────────────────────── */

.d-fund-list {
  display: grid;
  gap: 9px;
}

.d-fund-card {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  background: var(--d-bg);
  overflow: hidden;
}

.d-fund-card summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  padding: .75rem .9rem;
}

.d-fund-card summary span {
  color: var(--d-text);
  font-size: 13px;
  font-weight: 600;
}

.d-fund-card summary strong {
  color: var(--d-text-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.d-fund-body {
  border-top: 0.5px solid var(--d-border);
  padding: .75rem .9rem .9rem;
}

.d-fund-body p {
  color: var(--d-text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 .75rem;
}

.d-fund-metrics {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin-bottom: .75rem;
}

.d-fund-metrics div {
  background: var(--d-bg2);
  border-radius: var(--d-radius);
  padding: .55rem .65rem;
}

.d-fund-metrics span {
  color: var(--d-text-muted);
  display: block;
  font-size: 10px;
  margin-bottom: 2px;
}

.d-fund-metrics strong {
  color: var(--d-text);
  font-size: 14px;
  font-weight: 600;
}

.d-fund-note {
  color: var(--d-text-muted);
  font-size: 12px;
  line-height: 1.55;
  margin-top: 5px;
}

.d-fund-note strong {
  color: var(--d-text);
  font-weight: 600;
}

/* ── Fund Detail financial table view ────────────────────────────── */

.d-fund-tab-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 1rem;
}

.d-fund-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 1rem;
}

.d-fund-tab-stack .d-fund-tabs {
  margin: 0;
}

.d-fund-tabs-aggregate {
  padding-bottom: 2px;
}

.d-fund-tabs-funds {
  padding-top: 2px;
}

.d-fund-tab {
  background: none;
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  color: var(--d-text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  padding: 5px 10px;
}

.d-fund-tab.active,
.d-fund-tab:hover {
  background: var(--d-bg2);
  color: var(--d-text);
  font-weight: 600;
}

.d-detail-section {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  margin-top: 1rem;
  overflow: hidden;
}

.d-detail-heading {
  align-items: center;
  background: var(--d-bg2);
  display: flex;
  justify-content: space-between;
  padding: .65rem .8rem;
}

.d-detail-heading span,
.d-detail-heading strong {
  color: var(--d-text);
  font-size: 13px;
  font-weight: 600;
}

.d-detail-row {
  align-items: start;
  border-top: 0.5px solid var(--d-border);
  display: grid;
  gap: .75rem;
  grid-template-columns: 82px minmax(0, 1fr) 130px;
  padding: .65rem .8rem;
}

.d-detail-code {
  color: var(--d-text-faint);
  font-size: 11px;
  line-height: 1.45;
}

.d-detail-main strong,
.d-detail-amount strong {
  color: var(--d-text);
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.d-detail-main span,
.d-detail-amount span {
  color: var(--d-text-muted);
  display: block;
  font-size: 11px;
  line-height: 1.5;
  margin-top: 2px;
}

.d-detail-amount { text-align: right; }

@media (max-width: 640px) {
  .d-detail-row { grid-template-columns: 1fr; gap: .25rem; }
  .d-detail-amount { text-align: left; }
}


/* ── Redesigned model support: calm, current-style components ────── */

.d-chart-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.d-empty {
  background: var(--d-bg2);
  border: 0.5px dashed rgba(0,0,0,.16);
  border-radius: var(--d-radius);
  color: var(--d-text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 1rem;
  padding: .85rem 1rem;
}

.d-table-wrap {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  margin: .5rem 0 1rem;
  overflow-x: auto;
}

.d-table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

.d-table th,
.d-table td {
  border-bottom: 0.5px solid var(--d-border);
  color: var(--d-text-muted);
  font-size: 12px;
  line-height: 1.5;
  padding: .65rem .75rem;
  text-align: left;
  vertical-align: top;
}

.d-table th {
  background: var(--d-bg2);
  color: var(--d-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.d-table-centered th:not(:first-child),
.d-table-centered td:not(:first-child) {
  text-align: center;
}

.d-table-money th:nth-child(2),
.d-table-money td:nth-child(2),
.d-table-money th:nth-child(3),
.d-table-money td:nth-child(3),
.d-table-money th:nth-child(4),
.d-table-money td:nth-child(4) {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.d-table td strong { color: var(--d-text); font-weight: 600; }

.d-table-sub {
  color: var(--d-text-faint);
  font-size: 11px;
  line-height: 1.45;
  margin-top: 2px;
}

.d-statement-table {
  min-width: 820px;
}

.d-statement-table th:not(:first-child),
.d-statement-table td:not(:first-child) {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.d-statement-section td {
  background: var(--d-bg2);
  color: var(--d-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.d-statement-total td {
  background: #fafafa;
  border-top: 1px solid var(--d-border);
  color: var(--d-text);
  font-weight: 700;
}

.d-negative,
.d-hero-stat strong.d-negative,
.d-statement-table td.d-negative {
  color: #B91C1C;
}

@media (max-width: 760px) {
  .d-shell { min-height: 0; }
  .d-sv { font-size: 18px; }
  .d-table { min-width: 640px; }
}


/* ── Capital dashboard cards ─────────────────────────────────────── */
.d-cap-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-bottom: 1rem;
}

.d-cap-card {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  background: var(--d-bg);
  padding: .85rem;
}

.d-cap-head {
  align-items: flex-start;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  margin-bottom: .45rem;
}

.d-cap-school {
  color: var(--rusd-accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.d-cap-title {
  color: var(--d-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 2px;
}

.d-cap-summary {
  color: var(--d-text-muted);
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: .65rem;
}

.d-cap-metrics {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: .55rem;
}

.d-cap-metrics div {
  background: var(--d-bg2);
  border-radius: var(--d-radius);
  padding: .5rem .6rem;
}

.d-cap-metrics span {
  color: var(--d-text-muted);
  display: block;
  font-size: 10px;
  margin-bottom: 2px;
}

.d-cap-metrics strong {
  color: var(--d-text);
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.d-cap-years {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: .5rem;
}

.d-cap-years span {
  background: rgba(100,116,139,.1);
  border-radius: 3px;
  color: var(--d-text-muted);
  font-size: 10.5px;
  padding: 2px 7px;
}

.d-cap-link {
  color: var(--rusd-primary);
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
  text-decoration: none;
}

.d-cap-link:hover { text-decoration: underline; }

.d-cap-more {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  margin-top: 1rem;
}

.d-cap-more summary {
  color: var(--d-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: .75rem .85rem;
}

.d-cap-list {
  border-top: 0.5px solid var(--d-border);
}

.d-cap-row {
  align-items: flex-start;
  border-bottom: 0.5px solid var(--d-border);
  display: grid;
  gap: .75rem;
  grid-template-columns: minmax(0, 1fr) 100px;
  padding: .65rem .85rem;
}

.d-cap-row:last-child { border-bottom: none; }
.d-cap-row strong { color: var(--d-text); display: block; font-size: 12px; line-height: 1.35; }
.d-cap-row span { color: var(--d-text-faint); display: block; font-size: 11px; line-height: 1.45; margin-top: 2px; }
.d-cap-row > div:last-child { color: var(--d-text); font-size: 12px; font-weight: 600; text-align: right; }

@media (max-width: 640px) {
  .d-cap-row { grid-template-columns: 1fr; }
  .d-cap-row > div:last-child { text-align: left; }
}


/* ── Presentation polish overrides ───────────────────────────────── */
.d-nav-btn {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.d-nav-btn .d-badge-board { flex-shrink: 0; }

.d-chart-wrap canvas {
  display: block;
  height: 100% !important;
  width: 100% !important;
}

@media (max-width: 560px) {
  .d-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .d-nav-btn {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .d-body { overflow-y: visible; }
}


/* ── Simpler fund summary/detail view ────────────────────────────── */
.d-fund-summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 0 0 1rem;
}

.d-fund-summary-card {
  background: var(--d-bg);
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  padding: .85rem;
}

.d-fund-summary-head {
  align-items: flex-start;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  margin-bottom: .45rem;
}

.d-fund-summary-head strong {
  color: var(--d-text);
  font-size: 13px;
  line-height: 1.35;
}

.d-fund-summary-head span {
  color: var(--rusd-primary);
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
}

.d-fund-summary-card p {
  color: var(--d-text-muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 0 0 .6rem;
}

.d-fund-mini-metrics {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 1fr);
}

.d-fund-mini-metrics div {
  background: var(--d-bg2);
  border-radius: var(--d-radius);
  min-width: 0;
  padding: .48rem .55rem;
}

.d-fund-mini-metrics span {
  color: var(--d-text-muted);
  display: block;
  font-size: 9.5px;
  line-height: 1.2;
  margin-bottom: 2px;
}

.d-fund-mini-metrics strong {
  color: var(--d-text);
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.d-fund-detail-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 760px) {
  .d-fund-detail-grid { grid-template-columns: 1fr; }
  .d-fund-mini-metrics { grid-template-columns: 1fr; }
}


/* ── Budget detail readability fixes ─────────────────────────────── */
.d-section-full {
  margin-top: 1rem;
  min-width: 0;
}

.d-change-list {
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  overflow: hidden;
}

.d-change-item {
  align-items: flex-start;
  border-bottom: 0.5px solid var(--d-border);
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) 110px;
  padding: .75rem .85rem;
}

.d-change-item:last-child { border-bottom: none; }

.d-change-main strong {
  color: var(--d-text);
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.d-change-main span,
.d-change-main p {
  color: var(--d-text-muted);
  display: block;
  font-size: 12px;
  line-height: 1.5;
  margin: 3px 0 0;
}

.d-change-main span { color: var(--d-text-faint); }

.d-change-amount {
  color: var(--d-text);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .d-change-item { grid-template-columns: 1fr; gap: .35rem; }
  .d-change-amount { text-align: left; }
}


/* ── Revenue/spending comparison cards ───────────────────────────── */
.d-compare-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 1.1rem;
}

.d-compare-card {
  background: var(--d-bg2);
  border-radius: var(--d-radius);
  min-width: 0;
  padding: .8rem .9rem;
}

.d-compare-card span {
  color: var(--d-text-muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 4px;
}

.d-compare-card strong {
  color: var(--d-text);
  display: block;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.d-compare-card em {
  color: var(--d-text-faint);
  display: block;
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
  margin-top: 4px;
}

@media (max-width: 760px) {
  .d-compare-grid { grid-template-columns: 1fr; }
}


/* ── One-fund summary view ───────────────────────────────────────── */
.d-selected-fund,
.d-operating-card {
  background: var(--d-bg);
  border: 0.5px solid var(--d-border);
  border-radius: var(--d-radius);
  padding: .9rem;
}

.d-selected-fund { margin: 0 0 1rem; }

.d-selected-fund-head,
.d-operating-head {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: .65rem;
}

.d-selected-fund-head span,
.d-operating-head span {
  color: var(--d-text-muted);
  display: block;
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 2px;
}

.d-selected-fund-head strong,
.d-operating-head strong {
  color: var(--d-text);
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.d-selected-fund-head em {
  color: var(--rusd-primary);
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.d-selected-fund p {
  color: var(--d-text-muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 .75rem;
}

.d-operating-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 1rem;
}

@media (max-width: 760px) {
  .d-operating-grid { grid-template-columns: 1fr; }
  .d-selected-fund-head,
  .d-operating-head { display: block; }
  .d-selected-fund-head em { display: block; margin-top: .35rem; }
}
