    :root {
      color-scheme: light;
      --bg: #f8fafc;
      --panel: #ffffff;
      --panel-alt: #e2e8f0;
      --text: #0f172a;
      --muted: #475569;
      --border: #cbd5e1;
      --ok-bg: rgba(34, 197, 94, 0.10);
      --warn-bg: rgba(245, 158, 11, 0.12);
      --bad-bg: rgba(248, 113, 113, 0.12);
    }
    body[data-theme="dark"] {
      color-scheme: dark;
      --bg: #0f172a;
      --panel: #111827;
      --panel-alt: #1e293b;
      --text: #e2e8f0;
      --muted: #94a3b8;
      --border: #334155;
      --ok-bg: rgba(34, 197, 94, 0.08);
      --warn-bg: rgba(245, 158, 11, 0.10);
      --bad-bg: rgba(248, 113, 113, 0.10);
    }
    body { margin: 0; font-family: Segoe UI, Arial, sans-serif; background: var(--bg); color: var(--text); --sticky-header-offset: 0px; }
    header { padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
    .header-text { min-width: 0; }
    h1 { margin: 0; font-size: 22px; }
    #meta { margin-top: 6px; color: var(--muted); font-size: 13px; }
    main { padding: 20px; display: grid; gap: 20px; }
    .group { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); overflow: visible; }
    .group-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
    .group-title { font-size: 18px; font-weight: 600; }
    .summary { color: var(--muted); font-size: 13px; }
    .section { padding: 14px 16px; }
    .section-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
    .section-note { margin: -4px 0 10px; color: var(--muted); font-size: 12px; }
    table { width: 100%; border-collapse: collapse; }
    .matrix-table { border-collapse: separate; border-spacing: 0; }
    th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: right; font-size: 13px; }
    th:first-child, td:first-child { text-align: left; }
    th { background: var(--panel-alt); }
    .matrix-table thead th { position: sticky; top: var(--sticky-header-offset); z-index: 80; background: var(--panel-alt); }
    .matrix-table tbody th { position: sticky; left: 0; z-index: 70; background: var(--panel-alt); }
    .matrix-table thead th:first-child { left: 0; z-index: 90; }
    .status-ok { color: inherit; }
    .status-stale, .status-lagged { color: #f59e0b; }
    .status-missing, .status-disabled { color: #f87171; }
    .status-unsupported { color: var(--muted); }
    .matrix-cell { min-width: 120px; }
    .matrix-cell .main { font-weight: 600; }
    .matrix-cell .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
    .value-pos { color: #006400; font-weight: 700; }
    .value-neg { color: #64748b; }
    .value-warn { color: #d97706; }
    .value-muted { color: var(--text); }
    .matrix-cell-mt5 { box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.55); border-radius: 6px; padding: 2px 4px; }
    .member-mt5 { color: #2563eb; }
    .member-mt5-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border: 1px solid rgba(37, 99, 235, 0.35); border-radius: 999px; color: #2563eb; font-size: 11px; font-weight: 600; vertical-align: middle; }
    .theme-toggle { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
    .header-actions { display: flex; align-items: center; gap: 8px; }
    .admin-entry-button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--panel-alt); color: var(--text); border-radius: 8px; padding: 8px 12px; text-decoration: none; cursor: pointer; font-size: 13px; }
    .admin-entry-button:hover { border-color: rgba(37, 99, 235, 0.55); color: #2563eb; }
    .group-switcher { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
    .group-switcher-center { color: var(--muted); font-size: 13px; text-align: center; flex: 1; }
    .group-switcher-select { width: min(360px, 100%); border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 13px; text-align: center; }
    .group-switcher-button { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; min-width: 96px; }
    .group-switcher-button:disabled { opacity: 0.45; cursor: not-allowed; }
    .compare-toolbar { position: fixed; right: 18px; bottom: 18px; z-index: 900; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(760px, calc(100vw - 36px)); padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 16px 44px rgba(15, 23, 42, 0.18); }
    .compare-toolbar-empty { display: none; }
    .compare-toolbar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
    .compare-toolbar-button { border: 1px solid var(--border); background: var(--panel-alt); color: var(--text); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
    .compare-toolbar-button:disabled { opacity: 0.45; cursor: not-allowed; }
    .matrix-header { display: block; margin-bottom: 10px; }
    .matrix-cell-wrap { display: grid; gap: 6px; }
    .cell-compare-head { display: flex; justify-content: flex-start; }
    .cell-compare-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; user-select: none; white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px; background: var(--panel-alt); cursor: pointer; }
    .cell-compare-toggle input { width: 12px; height: 12px; margin: 0; }
    .matrix-cell-selected { box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.65); border-radius: 8px; padding: 4px 6px; }
    .js-history-cell { cursor: pointer; }
    .js-history-cell:hover .matrix-cell { background: rgba(148, 163, 184, 0.08); border-radius: 8px; }
    .history-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 23, 42, 0.58); z-index: 1000; }
    .history-modal.show { display: flex; }
    .history-panel { width: min(1480px, calc(100vw - 32px)); height: min(920px, calc(100vh - 32px)); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(15, 23, 42, 0.26); }
    .history-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .history-title { font-size: 18px; font-weight: 600; }
    .history-subtitle, .history-status { color: var(--muted); font-size: 12px; }
    .history-close { border: 1px solid var(--border); background: var(--panel-alt); color: var(--text); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
    .history-body { padding: 12px 16px 16px; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; min-height: 0; flex: 1; }
    .history-chart { min-height: 540px; height: 100%; }
    .matrix-tooltip { position: fixed; left: 0; top: 0; z-index: 1200; display: none; max-width: 420px; pointer-events: none; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22); white-space: pre-line; font-size: 12px; line-height: 1.5; }
    .matrix-tooltip.show { display: block; }
    .trade-panel { border-top: 1px solid var(--border); padding: 14px 16px; display: grid; gap: 10px; background: rgba(148, 163, 184, 0.06); }
    .trade-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
    .trade-actions { display: flex; gap: 8px; flex-wrap: wrap; }
    .trade-button { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
    .trade-button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
    .trade-button.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
    .trade-button:disabled { opacity: 0.5; cursor: not-allowed; }
    .trade-status { color: var(--muted); font-size: 12px; white-space: pre-wrap; }
    .trade-positions { overflow-x: auto; }
