    :root {
      color-scheme: dark;
      --bg: #0d0e10;
      --panel: #18171a;
      --panel2: #111315;
      --line: #333238;
      --text: #eef2f8;
      --muted: #9aa0aa;
      --red: #ff5c77;
      --green: #21c58b;
      --amber: #f3b84c;
      --blue: #58a6ff;
      --violet: #b58cff;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }
    a { color: inherit; }
    .login-page {
      min-height: 100vh;
      display: grid;
      place-items: center;
      padding: 20px;
    }
    .login-panel {
      width: min(100%, 380px);
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      padding: 22px;
    }
    .login-brand {
      margin-bottom: 18px;
      font-size: 21px;
      font-weight: 750;
      text-align: center;
    }
    .login-form {
      display: grid;
      gap: 12px;
    }
    .login-form label {
      display: grid;
      gap: 7px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }
    .login-form input {
      width: 100%;
      height: 40px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel2);
      color: var(--text);
      padding: 0 11px;
      font: inherit;
      outline: none;
    }
    .login-form input:focus {
      border-color: var(--blue);
    }
    .login-form button {
      width: 100%;
      height: 40px;
      margin-top: 2px;
      border-color: var(--blue);
      color: var(--blue);
      font-weight: 750;
    }
    .login-error {
      border: 1px solid rgba(255, 92, 119, 0.44);
      border-radius: 8px;
      background: rgba(255, 92, 119, 0.10);
      color: var(--red);
      padding: 9px 10px;
      text-align: center;
      font-size: 12px;
      font-weight: 700;
    }
    .wrap {
      width: min(1440px, calc(100vw - 32px));
      margin: 0 auto;
      padding: 14px 0 24px;
    }
    header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 10px;
    }
    h1 {
      margin: 0;
      font-size: 20px;
      font-weight: 650;
      letter-spacing: 0;
    }
    .brand-row {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }
    .sub {
      color: var(--muted);
      font-size: 12px;
      margin-top: 2px;
    }
    .status {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .pill {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 5px 8px;
      color: var(--muted);
      background: #12151b;
      white-space: nowrap;
      font-size: 12px;
    }
    .pill.ok { color: var(--green); }
    .pill.bad { color: var(--amber); }
    .pill-link {
      text-decoration: none;
    }
    .logout-form {
      display: inline;
      margin: 0;
    }
    button.pill-link {
      font: inherit;
      cursor: pointer;
    }
    .pill-link:hover {
      border-color: #555762;
      color: var(--text);
    }
    .pair-toolbar {
      display: grid;
      grid-template-columns: minmax(0, 330px) 1fr minmax(0, 330px);
      align-items: center;
      gap: 12px;
      margin: 0 0 10px;
    }
    .pair-selector {
      position: relative;
      width: min(100%, 330px);
      margin: 0;
      z-index: 20;
    }
    .pair-selector-button {
      width: 100%;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 0 12px;
      border-color: var(--green);
      color: var(--green);
      background: rgba(33, 197, 139, 0.08);
      font-weight: 750;
      text-align: left;
    }
    .pair-selector-button span:first-child {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .pair-selector-chevron {
      width: 8px;
      height: 8px;
      flex: 0 0 auto;
      border-right: 2px solid currentColor;
      border-bottom: 2px solid currentColor;
      transform: rotate(45deg) translateY(-2px);
      transition: transform 0.15s ease;
    }
    .pair-selector.open .pair-selector-chevron {
      transform: rotate(225deg) translateY(-2px);
    }
    .pair-selector-menu {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      width: 100%;
      max-height: min(360px, calc(100vh - 180px));
      overflow-y: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #12151b;
      box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
      padding: 6px;
    }
    .pair-selector.open .pair-selector-menu {
      display: grid;
      gap: 4px;
    }
    .pair-selector-search {
      width: 100%;
      height: 34px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel2);
      color: var(--text);
      padding: 0 10px;
      font: inherit;
      outline: none;
    }
    .pair-selector-search:focus {
      border-color: var(--blue);
    }
    .pair-selector-options {
      display: grid;
      gap: 4px;
    }
    .pair-selector-group-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 8px 3px;
      color: var(--text);
      font-size: 12px;
      font-weight: 850;
      line-height: 1.2;
      text-transform: uppercase;
    }
    .pair-selector-group-title span:last-child {
      min-width: 22px;
      height: 18px;
      display: inline-grid;
      place-items: center;
      border: 1px solid var(--line);
      border-radius: 999px;
      color: var(--muted);
      font-size: 10px;
      font-weight: 800;
      background: rgba(255, 255, 255, 0.025);
    }
    .pair-selector-empty {
      color: var(--muted);
      padding: 8px 10px;
      font-size: 12px;
    }
    .pair-selector-category-title {
      padding: 9px 8px 4px;
      color: var(--blue);
      font-size: 11px;
      font-weight: 850;
      letter-spacing: 0;
      text-transform: uppercase;
      border-top: 1px solid rgba(255, 255, 255, 0.055);
    }
    .pair-selector-category-title:first-child {
      border-top: 0;
      padding-top: 3px;
    }
    .pair-tab {
      width: 100%;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-color: transparent;
      color: var(--muted);
      background: transparent;
      font-weight: 700;
      text-align: left;
    }
    .pair-tab:hover {
      border-color: var(--line);
      color: var(--text);
      background: rgba(255, 255, 255, 0.035);
    }
    .pair-tab.active {
      border-color: rgba(33, 197, 139, 0.45);
      color: var(--green);
      background: rgba(33, 197, 139, 0.10);
    }
    .pair-tab-exchange {
      height: 34px;
      gap: 8px;
      padding-left: 14px;
    }
    .pair-tab-exchange-name {
      min-width: 0;
      color: inherit;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .funding-panel[hidden] {
      display: none;
    }
    .page-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin: 0 0 10px;
    }
    .brand-row .page-actions {
      margin: 0;
    }
    .page-action {
      min-height: 32px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #12151b;
      color: var(--text);
      padding: 0 12px;
      text-decoration: none;
      font-weight: 750;
    }
    .all-pairs-actions {
      justify-content: center;
      margin: 0;
    }
    .all-pairs-action {
      min-width: 150px;
      min-height: 36px;
      border-color: rgba(33, 197, 139, 0.68);
      background: rgba(33, 197, 139, 0.12);
      color: var(--green);
      box-shadow: 0 0 0 1px rgba(33, 197, 139, 0.06), 0 10px 24px rgba(0, 0, 0, 0.18);
    }
    .page-action:hover {
      border-color: #555762;
      color: var(--green);
    }
    .page-action.all-pairs-action:hover {
      border-color: var(--green);
      color: var(--text);
      background: rgba(33, 197, 139, 0.18);
    }
    .table-panel {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      padding: 9px;
      margin: 0 0 10px;
      min-width: 0;
    }
    .panel-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 6px;
    }
    .panel-head-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      min-width: 0;
    }
    .panel-head .section-title {
      margin: 0;
    }
    .panel-sub {
      color: var(--muted);
      font-size: 12px;
      text-align: right;
    }
    .panel-sub.align-left {
      text-align: left;
      margin-top: 2px;
    }
    .panel-collapse-button {
      width: 28px;
      min-width: 28px;
      height: 26px;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 6px;
      color: var(--muted);
      line-height: 1;
    }
    .panel-collapse-button:hover {
      color: var(--text);
    }
    .table-panel.collapsed {
      padding-bottom: 7px;
    }
    .table-panel.collapsed .panel-head {
      margin-bottom: 0;
    }
    .table-panel.collapsed .table-scroll {
      display: none;
    }
    .table-scroll {
      width: 100%;
      overflow-x: auto;
    }
    .data-table {
      width: 100%;
      min-width: 860px;
      border-collapse: collapse;
      font-size: 12px;
      font-variant-numeric: tabular-nums;
    }
    .data-table th,
    .data-table td {
      border-bottom: 1px solid var(--line);
      padding: 6px 8px;
      text-align: right;
      white-space: nowrap;
    }
    .data-table th:first-child,
    .data-table td:first-child {
      text-align: left;
    }
    .data-table th {
      color: var(--muted);
      font-weight: 750;
      background: rgba(255, 255, 255, 0.02);
    }
    .data-table tbody tr {
      cursor: pointer;
    }
    .data-table tbody tr:hover {
      background: rgba(255, 255, 255, 0.035);
    }
    .data-table tbody tr.active {
      background: rgba(33, 197, 139, 0.08);
    }
    .data-table tr:last-child td {
      border-bottom: 0;
    }
    .compact-panel {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      padding: 8px;
      margin: 0 0 8px;
      min-width: 0;
    }
    .compact-panel-head {
      margin-bottom: 5px;
    }
    .compact-panel-head .section-title {
      margin: 0;
    }
    .compact-table {
      min-width: 860px;
      font-size: 12px;
    }
    .compact-table th,
    .compact-table td {
      padding: 6px 8px;
      vertical-align: middle;
    }
    .compact-table tbody tr {
      cursor: default;
    }
    .compact-table tbody tr:hover {
      background: transparent;
    }
    .compact-table .compact-main {
      color: var(--text);
      font-weight: 800;
      white-space: nowrap;
    }
    .compact-table .compact-sub {
      color: var(--muted);
      font-size: 11px;
      margin-top: 1px;
      white-space: nowrap;
    }
    .compact-table .strong-value {
      font-weight: 800;
    }
    .compact-table .large-value {
      font-size: 17px;
    }
    .market-summary-table {
      min-width: 820px;
    }
    .market-summary-table th:nth-child(2),
    .market-summary-table td:nth-child(2) {
      text-align: center;
    }
    .hedge-summary-row td {
      background: rgba(88, 166, 255, 0.055);
    }
    .hedge-summary-row td:first-child {
      color: var(--muted);
      font-weight: 750;
    }
    .strategy-summary-panel {
      padding: 7px 8px;
    }
    .strategy-summary-table {
      min-width: 980px;
    }
    .strategy-summary-table td:first-child {
      width: 230px;
    }
    .strategy-summary-table td:not(:first-child),
    .strategy-summary-table th:not(:first-child) {
      text-align: center;
    }
    .market-ribbon {
      display: grid;
      grid-template-columns: minmax(130px, 0.55fr) repeat(2, minmax(0, 2fr));
      gap: 8px;
      margin: 0 0 8px;
      min-width: 0;
    }
    .market-hedge-card,
    .instrument-ribbon,
    .strategy-ribbon {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      min-width: 0;
    }
    .market-hedge-card {
      display: grid;
      align-content: center;
      justify-items: center;
      gap: 3px;
      min-height: 86px;
      padding: 10px;
      text-align: center;
      background: linear-gradient(180deg, rgba(88, 166, 255, 0.07), rgba(24, 23, 26, 0.94));
    }
    .ribbon-label,
    .ribbon-note,
    .instrument-sub,
    .mini-metric span,
    .signal-card span,
    .stat-chip span {
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      line-height: 1.2;
    }
    .ribbon-note {
      display: block;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      text-transform: uppercase;
      white-space: nowrap;
    }
    .ribbon-note.warn {
      color: var(--amber);
    }
    .ribbon-value {
      font-size: 22px;
      font-weight: 830;
      line-height: 1.05;
      overflow-wrap: anywhere;
    }
    .instrument-ribbon {
      display: grid;
      grid-template-columns: minmax(126px, 0.95fr) minmax(96px, 0.72fr) minmax(0, 2.6fr);
      align-items: stretch;
      min-height: 86px;
      overflow: hidden;
    }
    .instrument-title,
    .instrument-quote,
    .mini-metric {
      display: grid;
      align-content: center;
      min-width: 0;
      padding: 8px 10px;
    }
    .instrument-title {
      justify-items: center;
      text-align: center;
      overflow: hidden;
    }
    .instrument-title,
    .instrument-quote {
      border-right: 1px solid var(--line);
    }
    .instrument-symbol {
      color: var(--text);
      font-size: 14px;
      font-weight: 830;
      line-height: 1.25;
      max-width: 100%;
      min-width: 0;
      overflow: hidden;
      text-align: center;
      text-overflow: clip;
      white-space: nowrap;
      overflow-wrap: normal;
      word-break: normal;
      width: 100%;
    }
    .instrument-symbol.compact-symbol {
      font-size: 11px;
      letter-spacing: -0.1px;
    }
    .instrument-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      max-width: 100%;
      min-width: 0;
      text-decoration: none;
      border-radius: 6px;
    }
    .instrument-link:hover {
      color: var(--green);
    }
    .instrument-quote {
      justify-items: center;
      color: var(--text);
      font-size: 15px;
      font-weight: 820;
      text-align: center;
      overflow-wrap: anywhere;
    }
    .instrument-quote.book-stack {
      gap: 3px;
      line-height: 1.1;
    }
    .book-price {
      display: block;
    }
    .instrument-metrics {
      display: grid;
      grid-template-columns: 1.2fr 1.15fr 0.75fr 1.2fr 0.85fr;
      min-width: 0;
    }
    .mini-metric {
      justify-items: center;
      text-align: center;
      border-right: 1px solid var(--line);
    }
    .mini-metric:last-child {
      border-right: 0;
    }
    .mini-metric strong {
      margin-top: 4px;
      color: var(--text);
      font-size: 12px;
      font-weight: 820;
      line-height: 1.1;
      white-space: nowrap;
      overflow-wrap: anywhere;
    }
    .mini-metric.muted-metric strong {
      color: var(--muted);
      font-size: 12px;
    }
    .strategy-ribbon {
      display: grid;
      grid-template-columns: minmax(210px, 0.95fr) minmax(250px, 1.1fr) minmax(0, 2fr);
      align-items: stretch;
      gap: 0;
      margin: 0 0 8px;
      overflow: hidden;
    }
    .chart-stack + .strategy-ribbon {
      margin-top: 8px;
    }
    .strategy-ribbon-title {
      display: flex;
      align-items: center;
      justify-content: center;
      border-right: 1px solid var(--line);
      padding: 8px 10px;
      color: var(--text);
      font-size: 14px;
      font-weight: 830;
      text-align: center;
      min-width: 0;
    }
    .strategy-signal-row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      border-right: 1px solid var(--line);
    }
    .signal-card {
      display: grid;
      place-items: center;
      padding: 7px 10px;
      min-height: 62px;
      border-right: 1px solid var(--line);
      text-align: center;
    }
    .signal-card:last-child {
      border-right: 0;
    }
    .signal-card strong {
      margin-top: 3px;
      font-size: 24px;
      font-weight: 850;
      line-height: 1.1;
      overflow-wrap: anywhere;
    }
    .entry-card {
      background: rgba(33, 197, 139, 0.045);
    }
    .exit-card {
      background: rgba(255, 92, 119, 0.035);
    }
    .strategy-stat-row {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      min-width: 0;
    }
    .stat-chip {
      display: grid;
      align-content: center;
      justify-items: center;
      min-width: 0;
      min-height: 62px;
      padding: 7px 8px;
      border-right: 1px solid var(--line);
      text-align: center;
    }
    .stat-chip:last-child {
      border-right: 0;
    }
    .stat-chip strong {
      margin-top: 4px;
      font-size: 14px;
      font-weight: 820;
      line-height: 1.15;
      overflow-wrap: anywhere;
    }
