
  /* CSS CUSTOM PROPERTIES */
  :root {
    --bg-body: #f8fafc;
    --bg-sidebar: #f8fafc;
    --bg-card: #fff;
    --bg-chart: #fafbfc;
    --bg-elevated: #fff;
    --border: #edf0f3;
    --border-light: #f4f6f8;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-on-dark: #fff;
    --accent: #2b5797;
    --accent-hover: #1e3f6f;
    --accent-light: #f0f6ff;
    --node-parent: #1a2e4a;
    --node-sub: #2b5797;
    --node-jv: #8b6914;
    --node-assoc: #566270;
    --node-ext: #d4d8de;
    --severity-high: #dc2626;
    --severity-medium: #d97706;
    --severity-low: #2563eb;
    --severity-info: #64748b;
    --success: #1a7a4c;
  }

  [data-theme="dark"] {
    --bg-body: #0f1117;
    --bg-sidebar: #181b23;
    --bg-card: #1e2330;
    --bg-chart: #141720;
    --bg-elevated: #252a36;
    --border: #2a2f3a;
    --border-light: #232830;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-light: #1a2540;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary); background: var(--bg-body); line-height: 1.5; height: 100vh; overflow: hidden;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  }

  /* TOP BAR */
  .topbar {
    height: 44px; background: var(--bg-elevated); color: var(--text-primary); display: flex; align-items: center;
    justify-content: space-between; padding: 0 16px; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    position: relative; z-index: 5;
    border-bottom: 1px solid var(--border);
  }
  .topbar-left { display: flex; align-items: center; gap: 8px; }
  .topbar-right { display: flex; align-items: center; gap: 4px; }
  .topbar-icon { color: var(--text-muted); }
  .topbar-title { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); letter-spacing: -0.01em; }
  .topbar-sep { width: 1px; height: 16px; background: var(--border); flex-shrink: 0; }
  .topbar-company { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }

  /* APP 3-COL */
  .app { display: flex; height: calc(100vh - 44px); }

  /* COL 1: SIDEBAR */
  .sidebar {
    width: 220px; min-width: 220px; background: var(--bg-sidebar); color: #334155;
    display: flex; flex-direction: column; overflow: hidden;
    border-right: 1px solid var(--border); position: relative;
    transition: width 0.2s ease, min-width 0.2s ease;
  }
  .sidebar.collapsed { width: 36px; min-width: 36px; }
  .sidebar.collapsed .sidebar-inner { display: none; }
  .sidebar-inner { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-width: 0; }
  .sidebar-toggle {
    width: 28px; display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-bottom: 2px solid transparent;
    cursor: pointer; color: var(--text-muted); transition: color 0.12s; flex-shrink: 0;
  }
  .sidebar-toggle:hover { color: var(--text-secondary); }
  .sidebar.collapsed .sidebar-tabs { flex-direction: column; border-bottom: none; }
  .sidebar.collapsed .sidebar-tab { display: none; }
  .sidebar.collapsed .sidebar-toggle { width: 100%; padding: 10px 0; border-bottom: none; }
  .sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }
  .sidebar-tabs { display: flex; flex-shrink: 0; border-bottom: 1px solid var(--border); }
  .sidebar-tab {
    flex: 1; padding: 9px 8px; background: none; border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.72rem; font-weight: 600; color: var(--text-muted); cursor: pointer;
    text-align: center; transition: color 0.12s;
  }
  .sidebar-tab:hover { color: var(--text-secondary); }
  .sidebar-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
  .sidebar-tab-panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
  .sidebar-tab-panel[hidden] { display: none; }
  .sidebar-badge {
    font-size: 0.6rem; font-weight: 700; background: #e8ecf1; color: var(--text-secondary);
    padding: 1px 6px; border-radius: 10px; margin-left: 4px;
  }
  [data-theme="dark"] .sidebar-badge { background: #2a2f3a; }
  .sidebar-filter { padding: 8px 10px; }
  .sidebar-filter input {
    width: 100%; padding: 6px 10px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: 0.78rem; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .sidebar-filter input::placeholder { color: var(--text-muted); }
  .sidebar-filter input:focus { border-color: #93b4d4; box-shadow: 0 0 0 3px rgba(43,87,151,0.08); }
  .sidebar-list { flex: 1; overflow-y: auto; overflow-x: hidden; }
  .sidebar-list::-webkit-scrollbar { width: 4px; }
  .sidebar-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
  [data-theme="dark"] .sidebar-list::-webkit-scrollbar-thumb { background: #3a3f4a; }
  .company-card {
    padding: 9px 12px; cursor: pointer;
    border-left: 3px solid transparent; transition: background 0.1s;
  }
  .company-card + .company-card { border-top: 1px solid var(--border); }
  .company-card:hover { background: var(--accent-light); }
  .company-card.active { background: var(--accent-light); border-left-color: var(--accent); }
  .cc-name { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cc-meta { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }
  .health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
  .health-dot-green { background: #15803d; }
  .health-dot-amber { background: #d97706; }
  .health-dot-red { background: #dc2626; }

  /* COL 2: CENTER (info panel — now right side) */
  .center-col {
    width: 380px; min-width: 340px; max-width: 480px; flex-shrink: 0;
    background: var(--bg-card); position: relative;
    display: flex; flex-direction: column;
    border-left: 1px solid var(--border);
    transition: width 0.25s ease, min-width 0.25s ease, max-width 0.25s ease;
  }
  /* When left sidebar is collapsed, give right panel more room */
  .sidebar.collapsed ~ .center-col:not(.collapsed) {
    width: 440px; min-width: 380px; max-width: 540px;
  }
  .center-col.collapsed { flex: 0; min-width: 36px; width: 36px; max-width: 36px; overflow: hidden; }
  .center-col.collapsed .center-inner { display: none; }
  .center-col.collapsed .center-tabs .center-tab { display: none; }
  .center-col.collapsed .center-tabs { border-bottom: none; }
  .center-col.collapsed .center-toggle { padding: 10px 0; width: 100%; border-bottom: none; }
  .center-col.collapsed .center-toggle svg { transform: rotate(180deg); }
  .center-inner { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
  .center-inner::-webkit-scrollbar { width: 5px; }
  .center-inner::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
  [data-theme="dark"] .center-inner::-webkit-scrollbar-thumb { background: #3a3f4a; }
  .center-tabs { display: flex; flex-shrink: 0; border-bottom: 1px solid var(--border); }
  .center-tab {
    flex: 1; padding: 9px 8px; background: none; border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.72rem; font-weight: 600; color: var(--text-muted); cursor: pointer;
    text-align: center; transition: color 0.12s;
  }
  .center-tab:hover { color: var(--text-secondary); }
  .center-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
  .center-tab-panel { display: flex; flex-direction: column; flex: 1; }
  .center-tab-panel[hidden] { display: none; }
  .center-toggle {
    width: 28px; display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-bottom: 2px solid transparent;
    cursor: pointer; color: var(--text-muted); transition: color 0.12s; flex-shrink: 0;
  }
  .center-toggle:hover { color: var(--text-secondary); }
  .co-stat-bar { padding: 8px 16px; font-size: 0.72rem; color: var(--text-muted); font-family: 'SF Mono', Monaco, 'Courier New', monospace; flex-shrink: 0; }

  /* STATS ROW */
  .stats-row { display: flex; gap: 6px; padding: 10px 16px 14px; flex-wrap: wrap; overflow: hidden; flex-shrink: 0; }
  .stat-chip { display: flex; align-items: baseline; gap: 4px; font-size: 1.05rem; font-weight: 700; color: var(--text-primary); font-family: 'SF Mono', Monaco, 'Courier New', monospace; }
  .stat-chip span { font-size: 0.6rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; margin-right: 10px; }
  .stat-chip.jv { color: #8b6914; }

  /* CARDS */
  .card { padding: 16px 16px; transition: background 0.15s; }
  .card + .card { border-top: 1px solid var(--border-light); }
  .card-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px; }
  .card-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }
  .co-desc { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.65; }
  .co-sources { font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; }
  .co-sources strong { color: var(--text-secondary); }
  .quick-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 12px; }
  .qf { font-size: 0.78rem; color: var(--text-primary); white-space: nowrap; }
  .qf-l { font-size: 0.66rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 4px; }

  /* KPI */
  .kpi-grid { }
  .kpi-hl-row { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
  .kpi-highlight { flex: 1 1 auto; background: var(--accent-light); padding: 12px 10px; text-align: center; border-radius: 8px; min-width: 70px; }
  .kpi-hl-value { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); font-family: 'SF Mono', Monaco, 'Courier New', monospace; }
  .kpi-hl-label { font-size: 0.58rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }
  .kpi-detail { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; gap: 10px; min-width: 0; }
  .kpi-detail + .kpi-detail { border-top: 1px solid var(--border-light); }
  .kpi-dl { font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0; }
  .kpi-dv { font-size: 0.78rem; color: var(--text-primary); font-weight: 500; text-align: right; word-break: break-word; min-width: 0; }

  /* ACCOUNTS TABLE */
  .acct-header { font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 10px; font-family: 'SF Mono', Monaco, 'Courier New', monospace; }
  .acct-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .acct-table td { padding: 7px 4px; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; }
  .acct-table tr + tr td { border-top: 1px solid var(--border-light); }
  .acct-label { color: var(--text-secondary); font-weight: 500; width: 38%; }
  .acct-value { color: var(--text-primary); font-weight: 700; font-family: 'SF Mono', Monaco, 'Courier New', monospace; text-align: right; width: 22%; white-space: nowrap; }
  .acct-value.neg { color: #dc2626; }
  .acct-note { color: var(--text-muted); font-size: 0.68rem; padding-left: 10px; width: 40%; word-break: break-word; }

  /* AI DISCLAIMER */
  .ai-disclaimer { font-size: 0.68rem; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 4px; padding: 6px 10px; margin-bottom: 10px; line-height: 1.4; }
  [data-theme="dark"] .ai-disclaimer { background: #2a2315; border-color: #5c4a1e; color: #fbbf24; }

  /* DEBT TABLE */
  .debt-table { table-layout: fixed; width: 100%; }
  .debt-table th { font-size: 0.64rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 4px 8px; text-align: left; border-bottom: 1px solid var(--border); }
  .debt-table th.dt-facility { width: 42%; }
  .debt-table th.dt-amount { width: 24%; }
  .debt-table th.dt-maturity { width: 18%; }
  .debt-table th.dt-status { width: 16%; }
  .debt-table th.dt-amount, .debt-table th.dt-maturity, .debt-table th.dt-status { text-align: right; }
  .dt-facility { font-size: 0.74rem; color: var(--text-primary); font-weight: 500; overflow-wrap: break-word; hyphens: auto; }
  .dt-amount { font-size: 0.74rem; color: var(--text-primary); font-weight: 700; font-family: 'SF Mono', Monaco, 'Courier New', monospace; text-align: right; white-space: nowrap; }
  .dt-maturity { font-size: 0.72rem; color: var(--text-secondary); text-align: right; white-space: nowrap; }
  .dt-status { font-size: 0.68rem; text-align: right; font-weight: 600; color: #16a34a; }
  .dt-source { font-size: 0.58rem; color: var(--text-muted); font-style: italic; font-weight: 400; margin-top: 1px; line-height: 1.3; word-break: break-word; }
  .dt-undrawn { color: var(--text-muted); }
  .dt-committed { color: #2563eb; }
  .debt-rates { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-light); }
  .debt-rate-item { font-size: 0.68rem; color: var(--text-secondary); }
  .debt-rate-label { color: var(--text-muted); }
  .debt-rate-val { font-weight: 600; color: var(--text-primary); font-family: 'SF Mono', Monaco, 'Courier New', monospace; }

  /* COVENANTS */
  .cov-row { padding: 8px 0; }
  .cov-row + .cov-row { border-top: 1px solid var(--border-light); }
  .cov-header { display: flex; justify-content: space-between; align-items: center; }
  .cov-name { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); }
  .cov-badge { font-size: 0.58rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
  .cov-ok { background: #dcfce7; color: #15803d; }
  .cov-breach { background: #fee2e2; color: #dc2626; }
  .cov-waiver { background: #fef3c7; color: #b45309; }
  [data-theme="dark"] .cov-ok { background: #14332a; color: #4ade80; }
  [data-theme="dark"] .cov-breach { background: #3b1515; color: #f87171; }
  [data-theme="dark"] .cov-waiver { background: #352a14; color: #fbbf24; }
  .cov-detail { display: flex; gap: 16px; margin-top: 4px; }
  .cov-thresh, .cov-actual { font-size: 0.7rem; color: var(--text-secondary); }
  .cov-actual { font-weight: 600; color: var(--text-primary); font-family: 'SF Mono', Monaco, 'Courier New', monospace; }
  .cov-source { font-size: 0.6rem; color: var(--text-muted); font-style: italic; margin-top: 2px; line-height: 1.3; word-break: break-word; }

  /* LEGAL & REGULATORY */
  .legal-row { padding: 8px 0; }
  .legal-row + .legal-row { border-top: 1px solid var(--border-light); }
  .legal-header { display: flex; align-items: center; gap: 6px; }
  .legal-icon { font-size: 0.72rem; flex-shrink: 0; }
  .legal-type { font-size: 0.72rem; font-weight: 700; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.04em; }
  .legal-status { margin-left: auto; font-size: 0.64rem; font-weight: 600; }
  .legal-desc { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.5; margin-top: 3px; padding-left: 18px; }
  .legal-source { font-size: 0.62rem; color: var(--text-muted); padding-left: 18px; margin-top: 2px; font-style: italic; line-height: 1.4; }

  /* NEWS */
  .news-list { display: flex; flex-direction: column; }
  .news-item { display: flex; gap: 10px; padding: 8px 0; }
  .news-item + .news-item { border-top: 1px solid var(--border-light); }
  .news-left { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 62px; }
  .news-date { font-size: 0.68rem; color: var(--text-muted); font-family: 'SF Mono', Monaco, 'Courier New', monospace; }
  .news-tag { font-size: 0.54rem; font-weight: 700; padding: 2px 6px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.05em; }
  .news-body { flex: 1; min-width: 0; }
  .news-title { font-size: 0.78rem; color: var(--text-primary); line-height: 1.45; }
  .news-source { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }

  /* ENTITY LIST */
  .ent-row { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; cursor: pointer; }
  .ent-row + .ent-row { border-top: 1px solid var(--border-light); }
  .ent-row:hover { background: var(--accent-light); }
  .ent-row.ent-active { background: var(--accent-light); border-left: 3px solid var(--accent); padding-left: 5px; }
  .ent-badge { font-size: 0.58rem; font-weight: 700; color: #fff; padding: 2px 7px; border-radius: 3px; white-space: nowrap; margin-top: 2px; flex-shrink: 0; letter-spacing: 0.03em; }
  .ent-info { min-width: 0; }
  .ent-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; word-break: break-word; }
  .ent-meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
  .ent-org { margin-left: 6px; font-family: 'SF Mono', Monaco, 'Courier New', monospace; font-size: 0.68rem; color: var(--text-secondary); }
  .ent-own { margin-left: 6px; font-size: 0.68rem; font-weight: 600; color: var(--accent); font-family: 'SF Mono', Monaco, 'Courier New', monospace; }
  .copy-btn {
    float: right; font-size: 0.62rem; font-weight: 500; padding: 2px 10px;
    background: var(--accent-light); border: none; border-radius: 4px; color: var(--text-secondary);
    cursor: pointer; text-transform: none; letter-spacing: 0; transition: all 0.12s;
  }
  .copy-btn:hover { background: var(--border); color: var(--text-primary); }
  .copy-table { display: none; position: absolute; left: -9999px; }

  /* FLAG OVERLAYS (on chart nodes) */
  .flag-overlays { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
  .flag-badge { position: absolute; width: 14px; height: 14px; font-size: 8px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 3px; transform: translate(-50%, -50%); pointer-events: auto; cursor: default; line-height: 1; letter-spacing: 0; }

  /* FLAG BADGES (entity list) */
  .ent-flags { margin-left: 6px; display: inline-flex; gap: 2px; vertical-align: middle; }
  .ent-flag { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; font-size: 8px; font-weight: 700; color: #fff; border-radius: 3px; line-height: 1; cursor: default; }
  .ent-acct-icon { margin-left: 6px; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; font-size: 9px; font-weight: 700; color: var(--accent); background: var(--accent-light); border-radius: 4px; vertical-align: middle; cursor: pointer; line-height: 1; }
  .ent-detail { padding: 10px 0 10px 36px; animation: ent-detail-in 0.2s ease; }
  .ent-detail + .ent-row { border-top: 1px solid var(--border-light); }
  .ent-detail-header { font-size: 0.68rem; color: var(--text-secondary); margin-bottom: 6px; font-family: 'SF Mono', Monaco, 'Courier New', monospace; }
  .ent-detail .acct-table { max-width: 100%; }
  .ent-detail .acct-table td { padding: 4px 4px; font-size: 0.74rem; }
  @keyframes ent-detail-in { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 200px; } }

  /* LEGEND (chart overlay) */
  .legend-bar {
    position: absolute; bottom: 10px; left: 10px; z-index: 5;
    display: flex; gap: 8px; padding: 6px 10px; flex-wrap: wrap;
    background: rgba(255,255,255,0.92); border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); max-width: calc(100% - 20px);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
  [data-theme="dark"] .legend-bar { background: rgba(30,35,48,0.92); }
  .legend-item { display: flex; align-items: center; gap: 4px; font-size: 0.62rem; color: var(--text-secondary); white-space: nowrap; }
  .legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
  .legend-sep { width: 1px; height: 12px; background: var(--border); flex-shrink: 0; }
  .legend-flag { width: 13px; height: 13px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; font-size: 7px; font-weight: 700; color: #fff; flex-shrink: 0; line-height: 1; }

  /* COL 3: CHART (now center — hero position) */
  .chart-col {
    flex: 1.5; min-width: 400px; position: relative; overflow: hidden; background: var(--bg-chart);
    transition: width 0.25s ease, min-width 0.25s ease, flex 0.25s ease;
  }
  .chart-col.expanded { flex: 10; min-width: 0; }
  .cyto-container { width: 100%; height: 100%; }
  .chart-expand {
    position: absolute; top: 8px; left: 8px; z-index: 6;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-elevated); border: none; border-radius: 6px; cursor: pointer;
    color: var(--text-muted); transition: all 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  }
  .chart-expand:hover { background: var(--accent-light); color: var(--text-secondary); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
  .chart-col.expanded .chart-expand svg { transform: rotate(180deg); }

  /* ZOOM CONTROLS */
  .zoom-controls {
    position: absolute; top: 8px; right: 8px; z-index: 6;
    display: flex; flex-direction: column; gap: 2px;
  }
  .zoom-btn {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-elevated); border: none; border-radius: 6px; cursor: pointer;
    color: var(--text-secondary); font-size: 1rem; font-weight: 600; transition: all 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  }
  .zoom-btn:hover { background: var(--accent-light); color: var(--text-primary); }

  /* CHART SEARCH */
  .chart-search {
    position: absolute; top: 8px; left: 44px; z-index: 6;
    display: flex; align-items: center; gap: 6px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  }
  .chart-search[hidden] { display: none; }
  .chart-search input {
    width: 180px; padding: 3px 6px; background: transparent; border: none;
    color: var(--text-primary); font-size: 0.75rem; outline: none;
  }
  .chart-search input::placeholder { color: var(--text-muted); }
  .chart-search-count { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }
  .chart-search-close {
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    font-size: 0.85rem; padding: 0 2px; line-height: 1;
  }
  .chart-search-close:hover { color: var(--text-primary); }

  /* TOOLBAR */
  .info-group { display: flex; gap: 2px; }
  .info-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
  .tool-btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px;
    font-size: 0.72rem; font-weight: 500; background: transparent; border: none;
    border-radius: 5px; cursor: pointer; color: var(--text-secondary); transition: all 0.12s;
  }
  .tool-btn:hover { background: var(--accent-light); color: var(--text-primary); }
  .tool-btn svg { flex-shrink: 0; }
  .demo-badge {
    font-size: 0.44rem; font-weight: 700; color: var(--text-muted); background: var(--border);
    padding: 1px 3px; border-radius: 2px; letter-spacing: 0.04em;
    vertical-align: middle; line-height: 1; display: inline-block;
    margin-left: 2px; opacity: 0.7;
  }

  /* EXPORT DROPDOWN */
  .export-dropdown { position: relative; }
  .export-menu {
    position: absolute; top: 100%; right: 0; margin-top: 4px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 180px; padding: 4px; z-index: 100;
  }
  .export-menu[hidden] { display: none; }
  .export-item {
    padding: 8px 12px; font-size: 0.78rem; cursor: pointer;
    border-radius: 5px; color: var(--text-primary);
  }
  .export-item:hover { background: var(--accent-light); }

  /* THEME TOGGLE */
  .theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; background: transparent; border: none;
    border-radius: 5px; cursor: pointer; color: var(--text-secondary);
    font-size: 1rem; transition: all 0.12s;
  }
  .theme-toggle:hover { background: var(--accent-light); color: var(--text-primary); }

  /* EDIT MODE */
  .tool-btn-edit.active { background: var(--accent); color: #fff; }
  .tool-btn-edit.active:hover { background: var(--accent-hover); }
  .tool-btn-undo:disabled { opacity: 0.3; cursor: default; }
  .tool-btn-undo:not(:disabled) { color: var(--accent); font-weight: 600; }
  .tool-btn-add { background: var(--accent); color: #fff; font-weight: 600; }
  .tool-btn-add:hover { background: var(--accent-hover); }
  .tool-btn-add[hidden] { display: none; }
  .tool-btn-connect { font-weight: 600; }
  .tool-btn-connect.active { background: #2d6b3f; color: #fff; }
  .tool-btn-connect.active:hover { background: #245a34; }
  .tool-btn-connect[hidden] { display: none; }
  .edit-hint {
    position: absolute; top: 0; left: 0; right: 0; z-index: 5;
    padding: 6px 16px; background: var(--accent-light); font-size: 0.72rem; color: var(--text-primary);
  }
  .edit-hint[hidden] { display: none; }
  .edit-hint span { font-weight: 600; }
  .edit-hint kbd {
    display: inline-block; padding: 1px 5px; background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 3px; font-size: 0.66rem; font-family: inherit; box-shadow: 0 1px 0 var(--border);
  }
  .ctx-menu {
    position: absolute; z-index: 10; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.06);
    min-width: 160px; padding: 4px; overflow: hidden;
  }
  .ctx-menu[hidden] { display: none; }
  .ctx-item { padding: 7px 12px; font-size: 0.78rem; cursor: pointer; color: var(--text-primary); border-radius: 5px; }
  .ctx-item:hover { background: var(--accent-light); }
  .ctx-item.ctx-danger { color: #dc2626; }
  .ctx-item.ctx-danger:hover { background: #fef2f2; }
  [data-theme="dark"] .ctx-item.ctx-danger:hover { background: #3b1515; }

  /* DRAG LINE */
  .drag-line { position: absolute; height: 2px; background: #2d6b3f; transform-origin: 0 50%; pointer-events: none; z-index: 15; }
  .drag-line[hidden] { display: none; }
  .edge-handle { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-elevated); box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(0,0,0,0.2); cursor: grab; z-index: 16; transform: translate(-50%, -50%); transition: transform 0.1s; }
  .edge-handle:hover { background: var(--accent-hover); transform: translate(-50%, -50%) scale(1.3); }
  .edge-handle:active { cursor: grabbing; background: #1a2e4a; }
  .edge-handle[hidden] { display: none; }

  /* TOOLTIP */
  .cy-tooltip {
    position: absolute; z-index: 20; background: #1e293b; color: #e2e8f0;
    padding: 8px 12px; border-radius: 6px; font-size: 0.72rem; line-height: 1.45;
    pointer-events: none; max-width: 240px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .cy-tooltip[hidden] { display: none; }
  .cy-tooltip strong { color: #fff; }

  /* FINANCE PANEL */
  .finance-panel {
    position: absolute; top: 0; right: 0; width: 400px; height: 100%;
    background: var(--bg-card); z-index: 10; display: flex; flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.06);
  }
  .finance-panel[hidden] { display: none; }
  .finance-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; font-weight: 600; font-size: 0.85rem; color: var(--text-primary);
  }
  .finance-panel-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 2px 6px; border-radius: 4px; transition: all 0.12s; }
  .finance-panel-close:hover { color: var(--text-primary); background: var(--accent-light); }
  .finance-panel-body { flex: 1; overflow-y: auto; padding: 0 18px 18px; }
  .fin-hint { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; }
  #fin-textarea {
    width: 100%; padding: 10px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: 0.75rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    resize: vertical; min-height: 180px; transition: border-color 0.15s, box-shadow 0.15s;
  }
  #fin-textarea:focus { border-color: #93b4d4; box-shadow: 0 0 0 3px rgba(43,87,151,0.08); outline: none; }
  #fin-textarea::placeholder { color: var(--text-muted); }
  .fin-textarea-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
  .fin-textarea-footer span { font-size: 0.68rem; color: var(--text-muted); }
  .fin-example-btn { background: none; border: none; font-size: 0.68rem; color: var(--accent); cursor: pointer; padding: 0; }
  .fin-example-btn:hover { color: var(--accent-hover); text-decoration: underline; }
  .fin-select-toggle { background: none; border: none; font-size: 0.68rem; color: var(--accent); cursor: pointer; padding: 0; margin-left: auto; display: block; }
  .fin-select-toggle:hover { color: var(--accent-hover); text-decoration: underline; }
  .fin-submit {
    width: 100%; margin-top: 12px; padding: 9px 16px; background: var(--accent); color: #fff;
    border: none; border-radius: 6px; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
  }
  .fin-submit:hover { background: var(--accent-hover); }
  .fin-submit:disabled { opacity: 0.45; cursor: default; }
  .fin-spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: fin-spin 0.7s linear infinite; margin: 40px auto 12px; }
  @keyframes fin-spin { to { transform: rotate(360deg); } }
  .fin-loading-text { text-align: center; font-size: 0.78rem; color: var(--text-secondary); }
  .fin-section-label { font-size: 0.7rem; font-weight: 700; color: var(--text-primary); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: 0.05em; }
  .fin-summary { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.55; margin-bottom: 12px; padding: 10px 12px; background: var(--accent-light); border-radius: 6px; border-left: 3px solid var(--accent); }
  .fin-terms-table { width: 100%; font-size: 0.72rem; border-collapse: collapse; margin-bottom: 8px; }
  .fin-terms-table td { padding: 4px 6px; }
  .fin-terms-table tr + tr td { border-top: 1px solid var(--border-light); }
  .fin-terms-table td:first-child { color: var(--text-secondary); font-style: italic; }
  .fin-terms-table td:last-child { color: var(--text-primary); font-weight: 500; }
  .fin-match { padding: 8px 0; display: flex; align-items: flex-start; gap: 8px; }
  .fin-match + .fin-match { border-top: 1px solid var(--border-light); }
  .fin-match label { display: flex; align-items: flex-start; gap: 8px; flex: 1; cursor: pointer; }
  .fin-match input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--accent); }
  .fin-match-info { flex: 1; }
  .fin-match-name { font-weight: 600; font-size: 0.8rem; color: var(--text-primary); }
  .fin-match-entity { font-size: 0.68rem; color: var(--text-secondary); }
  .fin-match-roles { display: flex; gap: 3px; margin-top: 5px; flex-wrap: wrap; }
  .fin-match-role { display: inline-flex; align-items: center; justify-content: center; padding: 2px 7px; font-size: 0.66rem; font-weight: 600; color: #fff; border-radius: 3px; }
  .fin-match-conf { font-size: 0.68rem; color: var(--text-muted); margin-top: 3px; }
  .fin-role-existing { opacity: 0.45; position: relative; }
  .fin-role-existing::after { content: '\2713'; position: absolute; right: -1px; top: -1px; font-size: 6px; }
  .fin-diff-new { font-size: 0.65rem; color: var(--success); font-weight: 600; vertical-align: middle; }
  .fin-diff-same { font-size: 0.65rem; color: var(--text-muted); font-style: italic; vertical-align: middle; }
  .fin-unmatched { padding: 6px 0; }
  .fin-unmatched + .fin-unmatched { border-top: 1px solid var(--border-light); }
  .fin-unmatched-name { font-size: 0.78rem; color: var(--text-secondary); }
  .fin-unmatched-roles { display: flex; gap: 3px; margin-top: 3px; flex-wrap: wrap; }
  .fin-unmatched select { margin-top: 4px; font-size: 0.72rem; padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px; width: 100%; background: var(--bg-card); color: var(--text-primary); }
  .fin-apply {
    width: 100%; margin-top: 16px; padding: 9px 16px; background: var(--success); color: #fff;
    border: none; border-radius: 6px; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
  }
  .fin-apply:hover { background: #15633e; }
  .fin-applied { text-align: center; padding: 16px; font-size: 0.78rem; color: var(--success); font-weight: 600; }
  .fin-back {
    width: 100%; margin-top: 8px; padding: 7px 16px; background: var(--bg-card); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: 6px; font-size: 0.75rem;
    cursor: pointer; transition: all 0.12s;
  }
  .fin-back:hover { background: var(--bg-body); border-color: var(--text-muted); }
  .fin-error { color: #dc2626; font-size: 0.75rem; margin-top: 8px; }

  /* Extracted items in finance results */
  .fin-extracted-list { display: flex; flex-direction: column; gap: 0; }
  .fin-extracted-item { padding: 8px 0; }
  .fin-extracted-item + .fin-extracted-item { border-top: 1px solid var(--border-light); }
  .fin-ext-header { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
  .fin-ext-name { font-size: 0.76rem; font-weight: 600; color: var(--text-primary); }
  .fin-ext-amount, .fin-ext-threshold { font-size: 0.74rem; font-weight: 700; color: var(--text-primary); font-family: 'SF Mono', Monaco, 'Courier New', monospace; flex-shrink: 0; }
  .fin-ext-detail { display: flex; gap: 10px; margin-top: 3px; flex-wrap: wrap; }
  .fin-ext-detail span { font-size: 0.68rem; color: var(--text-secondary); }
  .fin-ext-type { font-size: 0.74rem; font-weight: 700; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.04em; }
  .fin-ext-badge { font-size: 0.56rem; font-weight: 700; color: #fff; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
  .fin-ext-desc { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.45; margin-top: 3px; }
  .fin-ext-source { font-size: 0.6rem; color: var(--text-muted); font-style: italic; margin-top: 2px; line-height: 1.3; }

  /* DATA SOURCES (in sidebar) */
  .ds-sidebar-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 10px; min-height: 0; }
  #ds-import-view { display: flex; flex-direction: column; min-height: 0; }
  #ds-entity-detail { overflow-y: auto; min-height: 0; }
  #ds-search-results { overflow-y: auto; min-height: 0; max-height: 100%; }
  .ds-sidebar-body::-webkit-scrollbar { width: 4px; }
  .ds-sidebar-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
  [data-theme="dark"] .ds-sidebar-body::-webkit-scrollbar-thumb { background: #3a3f4a; }
  .ds-section-label { font-size: 0.62rem; font-weight: 700; color: var(--text-muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; }
  .ds-section-label:first-child { margin-top: 4px; }
  .ds-source-card { padding: 8px 10px; margin-bottom: 4px; border-radius: 6px; background: var(--bg-card); }
  .ds-source-card.ds-available { background: var(--accent-light); }
  .ds-source-card.ds-limited { opacity: 0.55; }
  .ds-source-head { display: flex; align-items: flex-start; gap: 4px 8px; flex-wrap: wrap; }
  .ds-source-icon { font-size: 1rem; flex-shrink: 0; width: 22px; text-align: center; margin-top: 1px; }
  .ds-source-info { flex: 1 0 calc(100% - 32px); min-width: 0; }
  .ds-source-name { font-weight: 600; font-size: 0.75rem; color: var(--text-primary); line-height: 1.35; }
  .ds-source-meta { font-size: 0.65rem; color: var(--text-muted); margin-top: 1px; }
  .ds-source-desc { font-size: 0.68rem; color: var(--text-secondary); line-height: 1.4; margin-top: 5px; word-break: break-word; }
  .ds-import-btn {
    padding: 4px 10px; background: var(--accent); color: #fff; border: none;
    border-radius: 2px; font-size: 0.68rem; font-weight: 600; cursor: pointer;
    white-space: nowrap; flex-shrink: 0; transition: background 0.15s;
    margin-left: 30px;
  }
  .ds-import-btn:hover { background: var(--accent-hover); }
  .ds-import-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
  .ds-back-btn { background: none; border: none; font-size: 0.78rem; color: var(--accent); cursor: pointer; padding: 0; font-weight: 500; }
  .ds-back-btn:hover { color: var(--accent-hover); text-decoration: underline; }
  .ds-import-source { font-weight: 600; font-size: 0.82rem; color: var(--text-primary); }
  .ds-search-row { display: flex; gap: 6px; margin-bottom: 12px; }
  .ds-search-input {
    flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.78rem; transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--bg-card); color: var(--text-primary);
  }
  .ds-search-input:focus { border-color: #93b4d4; box-shadow: 0 0 0 3px rgba(43,87,151,0.08); outline: none; }
  .ds-search-btn {
    padding: 7px 14px; background: var(--accent); color: #fff; border: none;
    border-radius: 6px; font-size: 0.75rem; font-weight: 600; cursor: pointer;
    transition: background 0.15s;
  }
  .ds-search-btn:hover { background: var(--accent-hover); }
  .ds-result-item {
    padding: 8px 10px; border-radius: 6px; margin-bottom: 4px; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-card); transition: background 0.12s;
  }
  .ds-result-item:hover { background: var(--accent-light); }
  .ds-result-name { font-weight: 600; font-size: 0.78rem; color: var(--text-primary); }
  .ds-result-meta { font-size: 0.68rem; color: var(--text-secondary); margin-top: 1px; }
  .ds-result-arrow { color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }
  .ds-detail-card { padding: 12px; border-radius: 8px; background: var(--accent-light); margin-bottom: 10px; }
  .ds-detail-name { font-weight: 700; font-size: 0.88rem; color: var(--text-primary); margin-bottom: 6px; }
  .ds-detail-row { display: flex; justify-content: space-between; font-size: 0.72rem; padding: 3px 0; }
  .ds-detail-label { color: var(--text-muted); }
  .ds-detail-value { color: var(--text-primary); font-weight: 500; }
  .ds-children-label { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }
  .ds-child-item { padding: 5px 0; font-size: 0.72rem; display: flex; justify-content: space-between; }
  .ds-child-item + .ds-child-item { border-top: 1px solid var(--border); }
  .ds-child-name { color: var(--text-primary); font-weight: 500; }
  .ds-child-meta { color: var(--text-muted); }
  .ds-add-btn {
    width: 100%; margin-top: 12px; padding: 9px 16px; background: var(--success); color: #fff;
    border: none; border-radius: 6px; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
  }
  .ds-add-btn:hover { background: #15633e; }
  .ds-add-btn:disabled { opacity: 0.45; cursor: default; }
  .ds-added { text-align: center; padding: 12px; font-size: 0.78rem; color: var(--success); font-weight: 600; }
  .ds-error { color: #dc2626; font-size: 0.75rem; margin-top: 8px; }
  .ds-no-results { text-align: center; padding: 20px 10px; font-size: 0.78rem; color: var(--text-muted); }
  .ds-fetching-children { text-align: center; padding: 16px; }

  /* ENTITY NOTES */
  .ent-notes-section { margin-top: 8px; }
  .ent-notes-label { font-size: 0.64rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
  .ent-notes-input {
    width: 100%; padding: 5px 8px; background: var(--bg-body); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-primary); font-size: 0.72rem; font-family: inherit;
    resize: vertical; min-height: 40px; max-height: 120px; outline: none;
    transition: border-color 0.15s;
  }
  .ent-notes-input:focus { border-color: #93b4d4; }
  .ent-notes-input::placeholder { color: var(--text-muted); }
  .ent-notes-icon {
    margin-left: 4px; display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; font-size: 9px; color: var(--text-muted);
    vertical-align: middle; cursor: default;
  }
  .note-indicator {
    position: absolute; width: 12px; height: 12px; font-size: 7px;
    color: var(--text-muted); display: flex; align-items: center; justify-content: center;
    transform: translate(-50%, -50%); pointer-events: none; line-height: 1;
  }

  /* JURISDICTION FILTER */
  .jurisdiction-filter {
    position: absolute; bottom: 38px; left: 10px; z-index: 5;
    display: flex; gap: 4px; padding: 5px 8px; flex-wrap: wrap;
    background: rgba(255,255,255,0.92); border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); max-width: calc(100% - 20px);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
  .jurisdiction-filter:empty { display: none; }
  [data-theme="dark"] .jurisdiction-filter { background: rgba(30,35,48,0.92); }
  .jf-chip {
    display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px;
    font-size: 0.62rem; font-weight: 600; color: var(--text-secondary);
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 12px; cursor: pointer; transition: all 0.12s; user-select: none;
  }
  .jf-chip:hover { background: var(--accent-light); border-color: var(--accent); }
  .jf-chip.jf-active { background: var(--accent); color: #fff; border-color: var(--accent); }
  .jf-count {
    font-size: 0.54rem; font-weight: 700; background: var(--border); color: var(--text-muted);
    padding: 0 4px; border-radius: 6px; line-height: 1.4;
  }
  .jf-chip.jf-active .jf-count { background: rgba(255,255,255,0.25); color: #fff; }

  /* OWNERSHIP CHAIN PANEL */
  .chain-panel {
    position: absolute; top: 8px; left: 44px; z-index: 7;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    min-width: 220px; max-width: 320px; max-height: calc(100% - 60px);
    overflow-y: auto;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
  .chain-panel[hidden] { display: none; }
  .chain-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; font-weight: 600; font-size: 0.75rem; color: var(--text-primary);
    border-bottom: 1px solid var(--border); position: sticky; top: 0;
    background: var(--bg-elevated);
  }
  .chain-panel-header button {
    background: none; border: none; font-size: 16px; cursor: pointer;
    color: var(--text-muted); padding: 0 4px; border-radius: 4px; line-height: 1;
  }
  .chain-panel-header button:hover { color: var(--text-primary); }
  #chain-panel-body { padding: 8px 12px; }
  .chain-step {
    padding: 6px 8px; border-radius: 6px; background: var(--accent-light);
    font-size: 0.72rem; font-weight: 600; color: var(--text-primary);
    margin-bottom: 2px;
  }
  .chain-step-target { background: #fef3c7; color: #92400e; }
  [data-theme="dark"] .chain-step-target { background: #352a14; color: #fbbf24; }
  .chain-arrow {
    display: flex; align-items: center; gap: 6px; padding: 2px 8px;
    font-size: 0.68rem; color: var(--text-muted);
  }
  .chain-edge-pct { font-weight: 700; color: var(--accent); font-family: 'SF Mono', Monaco, 'Courier New', monospace; }
  .chain-cumulative { font-size: 0.62rem; color: var(--text-muted); font-style: italic; }

  /* PRINT MODE */
  body.print-mode { background: #fff !important; }
  body.print-mode .topbar { background: #fff; border-bottom-color: #e2e8f0; }
  body.print-mode .sidebar { display: none !important; }
  body.print-mode .center-col { display: none !important; }
  body.print-mode .chart-col {
    flex: 1; width: 100% !important; min-width: 100% !important; background: #fff;
  }
  body.print-mode .legend-bar, body.print-mode .chart-expand,
  body.print-mode .edit-hint, body.print-mode .ctx-menu,
  body.print-mode .finance-panel, body.print-mode .zoom-controls,
  body.print-mode .chart-search, body.print-mode .flag-overlays,
  body.print-mode .jurisdiction-filter, body.print-mode .chain-panel,
  body.print-mode .note-indicator { display: none !important; }
  body.print-mode .topbar-right .tool-btn:not(#btn-print),
  body.print-mode .topbar-right .info-sep,
  body.print-mode .topbar-right .theme-toggle,
  body.print-mode .topbar-right .export-dropdown { display: none !important; }
  body.print-mode #btn-print { background: var(--accent); color: #fff; }
  body.print-mode .cyto-container { background: #fff; }

  /* RESPONSIVE */
  @media (max-width: 1024px) {
    .center-col:not(.collapsed) { min-width: 260px; }
    .chart-col { min-width: 280px; }
  }
  @media (max-width: 768px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; min-width: 100%; max-height: 30vh; border-right: none; border-bottom: 1px solid var(--border); }
    .center-col { width: 100% !important; min-width: 100% !important; max-width: 100% !important; max-height: 40vh; border-left: none; border-bottom: 1px solid var(--border); }
    .chart-col { min-height: 300px; }
  }

  /* LARGE MONITORS */
  @media (min-width: 2000px) {
    .center-col:not(.collapsed) { max-width: 560px; }
    .sidebar.collapsed ~ .center-col:not(.collapsed) { max-width: 620px; }
    .chart-col { flex: 2; }
  }

  /* PRINT */
  @media print {
    .topbar, .sidebar, .legend-bar, .chart-expand, .edit-hint,
    .ctx-menu, .finance-panel, .tool-btn:not(#btn-print), .zoom-controls, .chart-search,
    .export-dropdown, .flag-overlays, .theme-toggle,
    .jurisdiction-filter, .chain-panel, .note-indicator { display: none !important; }
    #btn-print { display: none !important; }
    .app { display: block !important; }
    .center-col { display: none !important; }
    .chart-col {
      width: 100% !important; min-width: 100% !important;
      max-width: 100% !important; flex: none !important;
      height: 70vh !important;
    }
    .card { break-inside: avoid; }
    body { overflow: visible !important; height: auto !important; background: #fff !important; }
    body[data-theme="dark"] { --bg-body: #fff; --text-primary: #1e293b; --bg-card: #fff; --border: #e2e8f0; --bg-chart: #fff; }
    .cyto-container { background: #fff !important; }
  }
