:root {
      --bg: #0d1117;
      --surface: #161b22;
      --surface-border: #30363d;
      --surface-hover: #1f242c;
      --text-main: #e6edf3;
      --text-muted: #8b949e;
      --primary: #238636;
      --primary-hover: #2ea043;
      --accent: #58a6ff;
      --accent-hover: #79c0ff;
      --gold: #d29922;
      --danger: #f85149;
      --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
      --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      background-color: var(--bg);
      color: var(--text-main);
      font-family: var(--font-sans);
      line-height: 1.5;
      padding: 24px;
    }

    header {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 16px;
      margin-bottom: 24px;
      padding-bottom: 20px;
      border-bottom: 1px solid var(--surface-border);
    }

    .title-area h1 {
      font-size: 24px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .title-area p {
      color: var(--text-muted);
      font-size: 14px;
      margin-top: 4px;
    }

    .header-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
    }
    .btn-quiet {
      background: transparent;
      border-color: transparent;
      color: var(--text-muted);
      font-weight: 500;
      padding: 6px 10px;
    }
    .btn-quiet:hover {
      background: var(--surface);
      border-color: var(--surface-border);
      color: var(--text-main);
    }
    .btn.btn-quiet-danger {
      background: rgba(248, 81, 73, 0.12);
      border-color: rgba(248, 81, 73, 0.4);
      color: #ff7b72;
      font-weight: 600;
      padding: 6px 10px;
    }
    .btn.btn-quiet-danger:hover {
      background: rgba(248, 81, 73, 0.22);
      border-color: rgba(248, 81, 73, 0.65);
      color: #ffb1ab;
    }
    .btn-danger {
      background: #da3633;
      border-color: rgba(248, 81, 73, 0.5);
      color: #fff;
    }
    .btn-danger:hover { background: #f85149; }
    .btn-danger:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      background: #6e2b2b;
      border-color: rgba(248, 81, 73, 0.25);
    }
    .danger-modal {
      max-width: 480px;
      border-color: rgba(248, 81, 73, 0.55);
      box-shadow: 0 0 0 1px rgba(248, 81, 73, 0.2), 0 18px 50px rgba(0, 0, 0, 0.55);
    }
    .danger-banner {
      background: rgba(248, 81, 73, 0.12);
      border: 1px solid rgba(248, 81, 73, 0.45);
      border-radius: 8px;
      padding: 12px 14px;
      color: #ffb1ab;
      margin-bottom: 14px;
      font-size: 13px;
      line-height: 1.5;
    }
    .danger-banner strong { color: #ff7b72; }
    th.sortable {
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
    }
    th.sortable:hover { color: var(--accent); }
    th.sortable .sort-ind {
      margin-left: 4px;
      color: var(--text-muted);
      font-size: 10px;
    }
    th.sortable.sorted .sort-ind { color: var(--accent); }

    .btn {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      color: var(--text-main);
      padding: 8px 14px;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
      text-decoration: none;
    }
    .btn:hover { background: var(--surface-hover); border-color: #8b949e; }
    .btn-primary { background: var(--primary); border-color: rgba(240, 246, 252, 0.1); color: #fff; }
    .btn-primary:hover { background: var(--primary-hover); }
    .btn-accent { background: #1f6feb; border-color: rgba(240, 246, 252, 0.1); color: #fff; }
    .btn-accent:hover { background: #388bfd; }
    .btn-yahoo { background: rgba(163, 113, 247, 0.15); border: 1px solid rgba(163, 113, 247, 0.4); color: #d2a8ff; }
    .btn-yahoo:hover { background: rgba(163, 113, 247, 0.25); border-color: #d2a8ff; }

    /* Navigation tabs */
    .tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 20px;
    }
    .tab-btn {
      background: transparent;
      border: none;
      color: var(--text-muted);
      padding: 8px 16px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      border-radius: 6px;
      transition: all 0.15s ease;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      white-space: nowrap;
    }
    .tab-btn.active {
      color: var(--text-main);
      background: var(--surface);
      border: 1px solid var(--surface-border);
    }
    .tab-label {
      white-space: nowrap;
    }
    .pill-count {
      background: rgba(210, 153, 34, 0.2);
      color: var(--gold);
      border-radius: 10px;
      padding: 1px 7px;
      font-size: 11px;
      font-weight: 700;
      display: inline-block;
      white-space: nowrap;
      vertical-align: middle;
    }
    .ticker-with-meta {
      display: inline-flex;
      align-items: center;
      flex-wrap: nowrap;
      gap: 6px;
      white-space: nowrap;
      max-width: 100%;
    }

    /* Metric summary cards */
    .metrics-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }
    .metric-card {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      padding: 16px;
    }
    .metric-label {
      font-size: 12px;
      color: var(--text-muted);
      text-transform: uppercase;
      font-weight: 600;
      letter-spacing: 0.5px;
    }
    .metric-value {
      font-size: 24px;
      font-weight: 700;
      margin-top: 4px;
      font-family: var(--font-mono);
    }
    .metric-sub {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    /* Filters Bar */
    .filter-panel {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      padding: 16px;
      margin-bottom: 24px;
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: center;
    }
    .auto-check-opt {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 12.5px;
      color: var(--text-muted);
      user-select: none;
      white-space: nowrap;
    }
    .auto-check-opt input:disabled + span {
      opacity: 0.55;
    }
    .auto-check-opt .hint-inline {
      color: var(--gold);
      font-size: 11px;
    }
    .search-box {
      flex: 1 1 240px;
      background: var(--bg);
      border: 1px solid var(--surface-border);
      color: var(--text-main);
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 13px;
    }
    .select-filter {
      background: var(--bg);
      border: 1px solid var(--surface-border);
      color: var(--text-main);
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 13px;
      min-width: 140px;
    }
    .queue-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 16px;
      margin-bottom: 16px;
    }
    .queue-toolbar-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
      position: relative;
    }
    .queue-filter-btn {
      position: relative;
      min-width: 40px;
      padding: 8px 10px;
      line-height: 1;
    }
    .queue-filter-btn svg {
      display: block;
      width: 16px;
      height: 16px;
    }
    .queue-filter-btn.has-filters {
      border-color: var(--accent);
      color: var(--accent);
    }
    .queue-filter-badge {
      position: absolute;
      top: -5px;
      right: -5px;
      min-width: 16px;
      height: 16px;
      padding: 0 4px;
      border-radius: 999px;
      background: var(--accent);
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      line-height: 16px;
      text-align: center;
    }
    .queue-filter-popover {
      display: none;
      position: absolute;
      z-index: 40;
      top: calc(100% + 6px);
      right: 0;
      width: min(320px, calc(100vw - 32px));
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
      padding: 12px;
    }
    .queue-filter-popover.open { display: block; }
    .queue-filter-popover-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
    }
    .queue-filter-popover-head strong {
      font-size: 13px;
    }
    .queue-filter-section + .queue-filter-section {
      margin-top: 8px;
    }
    .queue-filter-section-toggle {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      background: transparent;
      border: 1px solid var(--surface-border);
      border-radius: 6px;
      color: var(--text-main);
      padding: 8px 10px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 600;
      text-align: left;
    }
    .queue-filter-section-toggle:hover {
      border-color: var(--accent);
      color: var(--accent);
    }
    .queue-filter-section-toggle .chevron {
      width: 12px;
      height: 12px;
      flex-shrink: 0;
      transition: transform 0.15s ease;
      opacity: 0.75;
    }
    .queue-filter-section.open .queue-filter-section-toggle .chevron {
      transform: rotate(90deg);
    }
    .queue-filter-section-meta {
      color: var(--text-muted);
      font-weight: 500;
      font-size: 11px;
      margin-left: auto;
      margin-right: 4px;
    }
    .queue-filter-section-toggle:hover .queue-filter-section-meta {
      color: inherit;
    }
    .queue-filter-list {
      display: none;
      max-height: 180px;
      overflow-y: auto;
      border: 1px solid var(--surface-border);
      border-top: none;
      border-radius: 0 0 6px 6px;
      background: var(--bg);
      padding: 4px;
      margin-top: -1px;
    }
    .queue-filter-section.open .queue-filter-section-toggle {
      border-radius: 6px 6px 0 0;
    }
    .queue-filter-section.open .queue-filter-list {
      display: block;
    }
    .queue-filter-list.visible {
      display: block;
      border-radius: 6px;
      margin-top: 0;
    }
    .filings-header-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
      align-items: center;
      position: relative;
    }
    .multi-select-option {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 8px;
      border-radius: 4px;
      cursor: pointer;
      font-size: 12px;
      color: var(--text-main);
      user-select: none;
    }
    .multi-select-option:hover { background: rgba(255, 255, 255, 0.04); }
    .multi-select-option input {
      margin: 0;
      accent-color: var(--accent);
    }
    .multi-select-option .mono {
      font-family: var(--font-mono);
      color: var(--accent);
    }
    .multi-select-empty {
      padding: 10px 8px;
      font-size: 12px;
      color: var(--text-muted);
    }
    .queue-filter-status {
      margin: -4px 0 16px;
      min-height: 1.2em;
    }

    /* Table view */
    .table-container {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      overflow-x: auto;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      text-align: left;
      font-size: 13px;
    }
    th {
      background: #1c2128;
      color: var(--text-muted);
      font-weight: 600;
      padding: 12px 14px;
      border-bottom: 1px solid var(--surface-border);
      white-space: nowrap;
    }
    td {
      padding: 14px;
      border-bottom: 1px solid var(--surface-border);
      vertical-align: middle;
    }
    tbody tr {
      cursor: pointer;
      transition: background 0.12s ease;
    }
    tbody tr:hover td {
      background: var(--surface-hover);
    }

    .ticker-cell {
      font-family: var(--font-mono);
      font-weight: 700;
      color: var(--accent);
      font-size: 14px;
    }
    .badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    .badge-yes { background: rgba(35, 134, 54, 0.2); color: #3fb950; border: 1px solid rgba(35, 134, 54, 0.4); }
    .badge-no { background: rgba(248, 81, 73, 0.2); color: #ff7b72; border: 1px solid rgba(248, 81, 73, 0.4); }
    .badge-allcash { background: rgba(88, 166, 255, 0.2); color: #79c0ff; border: 1px solid rgba(88, 166, 255, 0.4); }
    .badge-imported { background: rgba(139, 148, 158, 0.2); color: var(--text-muted); border: 1px solid var(--surface-border); }
    .badge-updated { background: rgba(210, 153, 34, 0.2); color: var(--gold); border: 1px solid rgba(210, 153, 34, 0.4); }
    .badge-sec { background: rgba(31, 111, 235, 0.18); color: #58a6ff; border: 1px solid rgba(56, 139, 253, 0.4); font-size: 10px; }
    .badge-high { background: rgba(35, 134, 54, 0.2); color: #3fb950; border: 1px solid rgba(35, 134, 54, 0.45); }
    .badge-mid { background: rgba(210, 153, 34, 0.18); color: var(--gold); border: 1px solid rgba(210, 153, 34, 0.45); }
    .badge-low { background: rgba(139, 148, 158, 0.16); color: var(--text-muted); border: 1px solid var(--surface-border); }
    .badge-pr { background: rgba(163, 113, 247, 0.18); color: #d2a8ff; border: 1px solid rgba(163, 113, 247, 0.4); font-size: 10px; }
    .badge-tender { background: rgba(210, 153, 34, 0.18); color: var(--gold); border: 1px solid rgba(210, 153, 34, 0.45); }
    .badge-item {
      background: rgba(88, 166, 255, 0.14);
      color: #79c0ff;
      border: 1px solid rgba(88, 166, 255, 0.35);
      font-size: 10px;
      font-family: var(--font-mono);
      font-weight: 600;
    }
    .badge-item.hot {
      background: rgba(210, 153, 34, 0.16);
      color: var(--gold);
      border-color: rgba(210, 153, 34, 0.45);
    }
    .filing-insight-row {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-top: 4px;
    }
    .reader-highlights {
      background: var(--bg);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      padding: 12px 14px;
      margin-bottom: 12px;
    }
    .reader-highlights h3 {
      margin: 0 0 8px;
      font-size: 13px;
      font-weight: 700;
    }
    .reader-highlights dl {
      margin: 0;
      display: grid;
      grid-template-columns: 120px 1fr;
      gap: 4px 10px;
      font-size: 12px;
    }
    .reader-highlights dt {
      color: var(--text-muted);
      font-weight: 600;
    }
    .reader-highlights dd {
      margin: 0;
      color: var(--text-main);
    }
    .section-pills .btn.active {
      border-color: var(--accent);
      color: var(--accent);
    }
    .quote-stack { font-family: var(--font-mono); font-size: 12px; line-height: 1.45; }
    .quote-stack .hint { font-family: var(--font-sans); }
    .tender-link-card {
      background: rgba(210, 153, 34, 0.08);
      border: 1px solid rgba(210, 153, 34, 0.35);
      border-radius: 8px;
      padding: 12px 14px;
      margin-bottom: 16px;
    }
    .research-panel {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      padding: 14px 16px;
      margin-bottom: 16px;
    }
    .research-panel h3 {
      font-size: 14px;
      font-weight: 700;
      margin: 0 0 4px;
    }
    .research-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 10px;
    }
    .research-row {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: flex-start;
      flex-wrap: wrap;
      padding: 10px 12px;
      border: 1px solid var(--surface-border);
      border-radius: 6px;
      background: var(--bg);
    }
    .research-row strong {
      font-size: 13px;
    }
    .badge-research {
      background: rgba(63, 185, 80, 0.14);
      color: #3fb950;
      border: 1px solid rgba(63, 185, 80, 0.4);
      font-size: 10px;
    }

    /* Calculator Tab */
    .calc-container {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 24px;
    }
    @media (max-width: 860px) {
      .calc-container { grid-template-columns: 1fr; }
    }
    .calc-box {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      padding: 24px;
    }
    .calc-box h2 {
      font-size: 18px;
      font-weight: 700;
      margin-bottom: 16px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--surface-border);
    }
    .form-group {
      margin-bottom: 14px;
    }
    .form-group label {
      display: block;
      font-size: 12px;
      color: var(--text-muted);
      font-weight: 600;
      margin-bottom: 6px;
    }
    .form-group input, .form-group textarea {
      width: 100%;
      background: var(--bg);
      border: 1px solid var(--surface-border);
      color: var(--text-main);
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 14px;
      font-family: var(--font-mono);
    }
    .calc-result-row {
      display: flex;
      justify-content: space-between;
      padding: 10px 0;
      border-bottom: 1px solid rgba(48, 54, 61, 0.5);
      font-size: 14px;
    }
    .calc-result-row.total {
      font-size: 18px;
      font-weight: 700;
      color: #3fb950;
      border-top: 1px solid var(--surface-border);
      border-bottom: none;
      padding-top: 16px;
      margin-top: 8px;
    }

    /* Modals & Drawers */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.75);
      display: none;
      justify-content: center;
      align-items: center;
      z-index: 1000;
    }
    .modal-overlay.stack-front {
      z-index: 1100;
    }
    #readerModal.modal-overlay {
      z-index: 1200;
    }
    /* Pricing must sit above Fidelity import / other modals */
    #plansModal.modal-overlay {
      z-index: 1300;
    }
    .modal {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      width: 90%;
      max-width: 860px;
      max-height: 90vh;
      overflow-y: auto;
      padding: 24px;
    }
    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--surface-border);
    }
    .modal-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      margin-top: 20px;
      padding-top: 16px;
      border-top: 1px solid var(--surface-border);
    }

    /* Detail View Specifics */
    .detail-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-bottom: 20px;
    }
    @media (max-width: 640px) {
      .detail-grid { grid-template-columns: 1fr; }
    }
    .detail-card {
      background: rgba(22, 27, 34, 0.7);
      border: 1px solid var(--surface-border);
      border-radius: 6px;
      padding: 14px;
    }
    .detail-item {
      margin-bottom: 10px;
    }
    .detail-item:last-child { margin-bottom: 0; }
    .detail-label {
      font-size: 11px;
      text-transform: uppercase;
      color: var(--text-muted);
      font-weight: 600;
    }
    .detail-val {
      font-size: 14px;
      color: var(--text-main);
      margin-top: 2px;
    }

    /* Filings Timeline / Table */
    .filings-section {
      margin-top: 20px;
      border-top: 1px solid var(--surface-border);
      padding-top: 18px;
    }
    .filings-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }
    .filings-table {
      width: 100%;
      border: 1px solid var(--surface-border);
      border-radius: 6px;
      background: var(--bg);
      font-size: 12.5px;
    }
    .filings-table th {
      padding: 8px 12px;
      background: #1c2128;
    }
    .filings-table td {
      padding: 10px 12px;
    }

    /* Work Queue Container */
    .work-queue-card {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: 8px;
      padding: 18px;
      margin-bottom: 16px;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }
    .work-queue-left {
      flex: 1 1 300px;
    }
    .work-queue-title {
      font-weight: 700;
      font-size: 15px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .work-queue-desc {
      font-size: 13px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    /* Import Dropzone & Feed List */
    .dropzone {
      border: 2px dashed var(--surface-border);
      border-radius: 8px;
      padding: 24px;
      text-align: center;
      background: rgba(22, 27, 34, 0.5);
      cursor: pointer;
      margin-bottom: 16px;
      transition: all 0.15s ease;
    }
    .dropzone:hover {
      border-color: var(--accent);
      background: rgba(31, 111, 235, 0.05);
    }
    .import-feed-list {
      max-height: 380px;
      overflow-y: auto;
      border: 1px solid var(--surface-border);
      border-radius: 6px;
      background: var(--bg);
      margin-top: 14px;
    }
    .import-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 14px;
      border-bottom: 1px solid var(--surface-border);
      transition: background 0.1s ease;
    }
    .import-item:last-child { border-bottom: none; }
    .import-item:hover { background: rgba(255, 255, 255, 0.02); }
    .import-checkbox {
      margin-top: 4px;
      width: 16px;
      height: 16px;
      accent-color: var(--primary);
      cursor: pointer;
    }
    .import-info {
      flex: 1;
    }
    .import-topline {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }
    .import-desc {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
    }
    .import-controls-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 14px;
      margin-bottom: 14px;
      align-items: center;
      background: rgba(22, 27, 34, 0.6);
      padding: 10px 14px;
      border-radius: 6px;
      border: 1px solid var(--surface-border);
    }
    .checkbox-label {
      font-size: 12px;
      color: var(--text-main);
      display: inline-flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      user-select: none;
    }

    /* Diff box showing what changed */
    .diff-box {
      margin-top: 8px;
      background: rgba(210, 153, 34, 0.08);
      border-left: 3px solid var(--gold);
      border-radius: 4px;
      padding: 8px 12px;
      font-size: 12px;
    }
    .diff-header {
      font-weight: 700;
      color: var(--gold);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .diff-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 3px;
      font-family: var(--font-mono);
      font-size: 11.5px;
    }
    .diff-label {
      color: var(--text-muted);
      font-family: var(--font-sans);
      font-weight: 600;
      min-width: 90px;
    }
    .diff-old {
      color: #ff7b72;
      text-decoration: line-through;
      background: rgba(248, 81, 73, 0.1);
      padding: 0 4px;
      border-radius: 3px;
    }
    .diff-new {
      color: #3fb950;
      font-weight: 600;
      background: rgba(56, 139, 253, 0.1);
      padding: 0 4px;
      border-radius: 3px;
    }

    .hint { font-size: 12px; color: var(--text-muted); }
    .status-banner {
      border: 1px solid var(--surface-border);
      background: var(--surface);
      border-radius: 8px;
      padding: 10px 14px;
      margin-bottom: 16px;
      font-size: 13px;
    }
    .status-banner.warn { border-color: rgba(210, 153, 34, 0.6); color: var(--gold); }
    .cusip-line { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
    .identity-line { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
    .identity-line a { color: var(--accent); }
    .reader-modal {
      max-width: 1080px;
      width: 90%;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      overflow: hidden; /* keep footer pinned; content scrolls inside */
      transition: max-width 0.15s ease, width 0.15s ease;
    }
    .reader-modal.wide {
      max-width: min(1680px, 98vw);
      width: 98vw;
    }
    .reader-modal .modal-header {
      flex-shrink: 0;
    }
    .reader-modal #readerBody {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .reader-modal #readerBody > *:not(#readerContent) {
      flex-shrink: 0;
    }
    .reader-modal #readerContent {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .reader-modal #readerContent .reader-more {
      flex-shrink: 0;
    }
    .reader-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .reader-footer {
      flex-shrink: 0;
      flex-wrap: wrap;
      justify-content: flex-end;
      margin-top: 12px;
    }
    .reader-queue-nav {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin-right: auto;
    }
    .reader-queue-nav[hidden] { display: none !important; }
    .reader-queue-pos {
      font-size: 12px;
      color: var(--text-muted);
      margin-right: 4px;
      white-space: nowrap;
    }
    .reader-footer kbd {
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 600;
      padding: 1px 5px;
      border: 1px solid var(--surface-border);
      border-radius: 3px;
      margin-left: 4px;
      color: var(--text-muted);
      background: var(--bg);
    }
    .reader-doc {
      background: var(--bg);
      border: 1px solid var(--surface-border);
      border-radius: 6px;
      padding: 14px 16px;
      max-height: 70vh;
      overflow: auto;
      font-size: 13.5px;
      line-height: 1.45;
    }
    .reader-modal .reader-doc {
      flex: 1 1 auto;
      min-height: 12rem;
      max-height: none; /* fill remaining modal space; footer stays visible */
    }
    .reader-doc.dense {
      font-size: 12.5px;
      line-height: 1.35;
      padding: 10px 12px;
    }
    .reader-doc em {
      font-style: italic;
      color: var(--text-main);
    }
    .reader-doc h1, .reader-doc h2, .reader-doc h3 { margin: 16px 0 8px; line-height: 1.3; }
    .reader-doc h1 { font-size: 22px; }
    .reader-doc h2 { font-size: 18px; }
    .reader-doc h3 { font-size: 15px; }
    .reader-doc.dense h3 {
      margin: 10px 0 4px;
      font-size: 13px;
      font-weight: 700;
      color: var(--accent);
      letter-spacing: 0.01em;
    }
    .reader-doc p { margin: 0 0 8px; }
    .reader-doc.dense p { margin: 0 0 4px; }
    .reader-doc ul, .reader-doc ol { margin: 0 0 10px 1.2em; }
    .reader-doc.dense ul, .reader-doc.dense ol { margin: 0 0 6px 1.1em; }
    .reader-doc li { margin: 2px 0; }
    .reader-doc a { color: var(--accent); }
    .reader-doc code { font-family: var(--font-mono); font-size: 12px; }
    .reader-doc hr { border: none; border-top: 1px solid var(--surface-border); margin: 14px 0; }
    .reader-doc.dense hr { margin: 6px 0; opacity: 0.55; }
    .reader-doc table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 13px; }
    .reader-doc.dense table { margin: 2px 0 8px; font-size: 12px; }
    .reader-doc th, .reader-doc td {
      border: 1px solid var(--surface-border);
      padding: 6px 8px;
      vertical-align: top;
      text-align: left;
    }
    .reader-doc th { background: #1c2128; }
    .reader-doc table.financial-table {
      font-size: 12px;
      width: max-content;
      max-width: 100%;
    }
    .reader-doc table.financial-table th,
    .reader-doc table.financial-table td {
      padding: 3px 8px;
      border-color: rgba(48, 54, 61, 0.85);
    }
    .reader-doc table.financial-table th:first-child,
    .reader-doc table.financial-table td:first-child {
      text-align: left;
      min-width: 14em;
      max-width: 28em;
    }
    .reader-doc table.financial-table th:not(:first-child) {
      text-align: right;
      font-family: var(--font-mono);
      font-variant-numeric: tabular-nums;
      white-space: normal;
      max-width: 5.75rem;
      min-width: 4.5rem;
      line-height: 1.2;
      font-size: 10.5px;
      font-weight: 650;
      vertical-align: bottom;
      hyphens: auto;
    }
    .reader-doc table.financial-table td:not(:first-child) {
      text-align: right;
      font-family: var(--font-mono);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .reader-modal.wide .reader-doc table.financial-table th:not(:first-child) {
      max-width: 8rem;
      min-width: 5.5rem;
      font-size: 11px;
    }
    .reader-doc table.financial-table tr.section-row td {
      font-weight: 700;
      background: rgba(255, 255, 255, 0.02);
      padding-top: 10px;
    }
    .reader-doc table.financial-table tr.total-row td {
      font-weight: 700;
      border-top: 1px solid var(--text-muted);
    }
    .reader-more {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid rgba(48, 54, 61, 0.7);
    }
    .reader-more .hint { margin: 0; flex: 1 1 200px; font-size: 11.5px; }
    .reader-more .btn { padding: 3px 8px; font-size: 11px; }
    .section-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
    .section-pills .btn.active { border-color: var(--accent); color: var(--accent); }

    /* Many-exhibit filings: keep one row by default so the reading pane stays usable. */
    #readerDocPills.reader-doc-pills {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin: 6px 0 10px;
      min-height: 0;
    }
    #readerDocPills .reader-doc-pills-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      width: 100%;
    }
    #readerDocPills .reader-doc-pills-head .hint {
      margin: 0;
      flex: 1 1 auto;
    }
    #readerDocPills .reader-doc-pills-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      min-height: 0;
    }
    #readerDocPills.is-collapsed .reader-doc-pills-row {
      max-height: 2.15em;
      overflow: hidden;
    }
    #readerDocPills.is-expanded .reader-doc-pills-row {
      max-height: min(28vh, 220px);
      overflow-x: hidden;
      overflow-y: auto;
      padding-right: 2px;
    }
    .edgar-grid {
      display: grid;
      grid-template-columns: minmax(260px, 340px) 1fr;
      gap: 16px;
      margin-bottom: 20px;
    }
    @media (max-width: 900px) {
      .edgar-grid { grid-template-columns: 1fr; }
    }
    .edgar-table tbody tr { cursor: default; }
    .position-input {
      width: 96px;
      background: var(--bg);
      border: 1px solid var(--surface-border);
      color: var(--text-main);
      border-radius: 4px;
      padding: 4px 6px;
      font-family: var(--font-mono);
      font-size: 12px;
    }
    .gain-up { color: #3fb950; }
    .gain-down { color: #ff7b72; }
