    :root {
      --bg: #0a0a0a;
      --surface: #141414;
      --card: #1a1a1a;
      --card-hover: #222222;
      --border: #2a2a2a;
      --text-primary: #f0f0f0;
      --text-secondary: #888888;
      --text-muted: #555555;
      --accent: #e07a5f;
      --accent-hover: #c96a52;
      --green: #4ade80;
      --green-dim: #22c55e;
      --red: #ef4444;
      --yellow: #f59e0b;
      --blue: #60a5fa;
      --sidebar-width: 200px;
      --topbar-height: 56px;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      background: var(--bg);
      color: var(--text-primary);
      min-height: 100vh;
      font-size: 14px;
      line-height: 1.5;
      overflow-x: hidden;
    }

    /* ─── Top Bar ─────────────────────────────────────────────── */
    .topbar {
      position: fixed; top: 0; left: 0; right: 0;
      height: var(--topbar-height);
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between;
      padding: 0 24px;
      z-index: 100;
    }
    .topbar-left {
      display: flex; align-items: center; gap: 24px;
      font-size: 18px; font-weight: 600; color: var(--text-primary);
      letter-spacing: -0.3px;
    }
    .logo-claude {
      width: 18px; height: 18px;
      color: #D97757;
      flex-shrink: 0;
    }
    .topbar-tabs {
      display: flex; gap: 4px;
    }
    .topbar-tab {
      padding: 6px 16px; border-radius: 6px;
      font-size: 13px; color: var(--text-secondary);
      border: none; background: transparent;
      display: flex; align-items: center; gap: 6px;
      position: relative;
    }
    .topbar-tab .dot {
      display: inline-block; width: 6px; height: 6px; border-radius: 50%;
      vertical-align: middle;
      transition: background .3s;
    }
    .topbar-tab .dot.up   { background: #4ade80; }
    .topbar-tab .dot.warn { background: #f59e0b; }
    .topbar-tab .dot.down { background: #7f1d1d; }
    .topbar-tab[title]:hover::after {
      content: attr(title);
      position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
      background: #1a1a1a; border: 1px solid var(--border);
      color: var(--text-secondary); font-size: 11px;
      padding: 4px 10px; border-radius: 6px;
      white-space: nowrap; z-index: 101;
      pointer-events: none;
    }
    .topbar-right {
      display: flex; align-items: center; gap: 10px;
      position: relative;
    }
    .avatar {
      width: 28px; height: 28px; border-radius: 50%;
      background: #2d2d2d; display: flex; align-items: center; justify-content: center;
      font-size: 11px; font-weight: 600; color: #aaa;
      border: 1px solid var(--border);
    }
    .username { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
    .topbar-menu-btn {
      background: transparent; border: none; color: var(--text-muted);
      cursor: pointer; padding: 2px; display: flex; align-items: center;
      border-radius: 4px; transition: all .15s;
    }
    .topbar-menu-btn:hover { color: var(--text-secondary); background: rgba(255,255,255,0.06); }
    .topbar-menu {
      position: absolute; top: calc(var(--topbar-height) - 4px); right: 16px;
      background: var(--card); border: 1px solid var(--border); border-radius: 10px;
      padding: 6px; min-width: 160px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
      z-index: 200;
    }
    .topbar-menu.hidden { display: none; }
    .menu-item {
      display: flex; align-items: center; gap: 10px;
      padding: 9px 12px; border-radius: 6px; font-size: 13px;
      color: var(--text-secondary); cursor: pointer; transition: all .12s;
    }
    .menu-item:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
    .menu-divider { height: 1px; background: var(--border); margin: 4px 6px; }

    /* ─── Exit IP Banner ──────────────────────────────────────── */
    .exit-ip-banner {
      background: rgba(224,122,95,0.06);
      border: 1px solid rgba(224,122,95,0.15);
      border-radius: 10px;
      padding: 14px 18px;
    }
    .exit-ip-label {
      display: flex; align-items: center; gap: 6px;
      font-size: 12px; color: var(--accent); font-weight: 500;
      margin-bottom: 6px;
    }
    .exit-ip-value {
      display: flex; align-items: center; gap: 10px;
      font-size: 18px; font-weight: 700; color: var(--text-primary);
      font-family: 'SF Mono', 'Consolas', monospace;
      margin-bottom: 6px;
    }
    .exit-ip-value .copy-btn-inline {
      font-size: 11px; padding: 3px 8px;
    }
    .exit-ip-hint {
      font-size: 12px; color: var(--text-muted); line-height: 1.5;
    }

    /* ─── Sidebar ─────────────────────────────────────────────── */
    .sidebar {
      position: fixed; top: var(--topbar-height); left: 0;
      width: var(--sidebar-width); bottom: 0;
      background: var(--surface);
      border-right: 1px solid var(--border);
      padding: 16px 12px;
      z-index: 99;
    }
    .nav-item {
      display: flex; align-items: center; gap: 12px;
      padding: 11px 14px; border-radius: 8px;
      color: var(--text-secondary); font-size: 14px;
      cursor: pointer; transition: all .15s;
      margin-bottom: 2px; border: none; background: transparent; width: 100%; text-align: left;
      font-weight: 500;
    }
    .nav-item:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
    .nav-item.active { background: rgba(224,122,95,0.12); color: var(--accent); }
    .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

    /* ─── Main Layout ─────────────────────────────────────────── */
    .main {
      margin-left: var(--sidebar-width);
      margin-top: var(--topbar-height);
      padding: 28px 32px;
      min-height: calc(100vh - var(--topbar-height));
    }
    .page-title {
      font-size: 22px; font-weight: 600;
      margin-bottom: 24px; color: var(--text-primary);
    }

    /* ─── Cards ───────────────────────────────────────────────── */
    .card-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 16px;
      margin-bottom: 24px;
    }
    .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 22px 24px;
      transition: background .15s;
    }
    .card:hover { background: var(--card-hover); }
    .card-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 16px;
    }
    .card-title {
      font-size: 13px; color: var(--text-secondary); font-weight: 500;
    }
    .card-status-dot {
      width: 8px; height: 8px; border-radius: 50%; background: var(--green);
    }
    .card-body { }
    .status-row {
      display: flex; align-items: center; gap: 8px;
      margin-bottom: 8px; font-size: 13px; color: var(--text-secondary);
    }
    .status-row .dot {
      width: 6px; height: 6px; border-radius: 50%;
    }
    .status-row .dot.running { background: var(--green); }
    .status-row .name { width: 50px; color: var(--text-secondary); }
    .status-row .state { color: var(--text-primary); }
    .big-number {
      font-size: 32px; font-weight: 700; color: var(--text-primary);
      line-height: 1;
    }
    .big-number-label {
      font-size: 12px; color: var(--text-secondary);
      margin-top: 8px;
    }
    .sub-stats {
      display: flex; gap: 16px; margin-top: 12px;
    }
    .sub-stat {
      display: flex; align-items: center; gap: 6px;
      font-size: 12px; color: var(--text-secondary);
    }
    .sub-stat .dot {
      width: 6px; height: 6px; border-radius: 50%;
    }

    /* ─── Account Section ─────────────────────────────────────── */
    .account-section {
      margin-bottom: 24px;
    }
    .account-header {
      display: flex; align-items: center; gap: 10px;
      margin-bottom: 16px;
    }
    .account-header .icon {
      width: 22px; height: 22px; border-radius: 4px;
      background: linear-gradient(135deg, #D97757, #c26a4d);
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; color: white;
    }
    .account-header .name { font-size: 15px; font-weight: 600; }
    .account-header .tag { font-size: 12px; color: var(--text-muted); }
    .account-header .refresh {
      margin-left: auto;
      padding: 5px 12px;
      border-radius: 6px;
      border: 1px solid var(--border);
      background: rgba(255,255,255,0.04);
      color: var(--text-secondary);
      font-size: 12px;
      cursor: pointer;
      transition: all .15s;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .account-header .refresh:hover {
      background: rgba(255,255,255,0.08);
      color: var(--text-primary);
      border-color: rgba(255,255,255,0.12);
    }
    .account-header .refresh:active {
      transform: scale(0.97);
    }
    .balance-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 16px;
      margin-bottom: 16px;
    }
    .balance-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 20px;
    }
    .balance-label {
      font-size: 12px; color: var(--text-secondary);
      margin-bottom: 8px;
    }
    .balance-value {
      font-size: 26px; font-weight: 700; color: var(--text-primary);
    }
    .balance-unit {
      font-size: 12px; color: var(--text-muted); margin-top: 4px;
    }
    .no-position {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 40px;
      text-align: center;
      color: var(--text-muted);
      font-size: 14px;
      margin-bottom: 24px;
    }

    /* ─── Section Header ──────────────────────────────────────── */
    .section-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 16px;
    }
    .section-title {
      font-size: 15px; font-weight: 600; color: var(--text-primary);
    }
    .section-link {
      font-size: 12px; color: var(--text-muted); text-decoration: none;
      cursor: pointer;
    }
    .section-link:hover { color: var(--text-secondary); }

    /* ─── Table ───────────────────────────────────────────────── */
    .table-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
    }
    .table-header {
      display: grid;
      grid-template-columns: 1fr 100px 140px 80px 120px;
      padding: 14px 20px;
      background: rgba(255,255,255,0.02);
      border-bottom: 1px solid var(--border);
      font-size: 12px; color: var(--text-muted); font-weight: 500;
      letter-spacing: 0.2px;
    }
    .table-row {
      display: grid;
      grid-template-columns: 1fr 100px 140px 80px 120px;
      padding: 14px 20px;
      border-bottom: 1px solid var(--border);
      align-items: center;
      font-size: 13px; color: var(--text-primary);
      transition: background .1s;
    }
    .table-row:hover { background: rgba(255,255,255,0.02); }
    .table-row:last-child { border-bottom: none; }
    .table-cell-muted { color: var(--text-secondary); }
    .status-badge {
      display: inline-flex; align-items: center; gap: 6px;
      font-size: 12px;
    }
    .status-badge .dot {
      width: 6px; height: 6px; border-radius: 50%;
    }
    .status-badge.active { color: var(--green-dim); }
    .status-badge.active .dot { background: var(--green-dim); }
    .status-badge.inactive { color: var(--text-muted); }
    .status-badge.inactive .dot { background: var(--text-muted); }
    .table-actions {
      display: flex; gap: 8px;
    }
    .icon-btn {
      width: 30px; height: 30px; border-radius: 6px;
      border: none; background: transparent;
      color: var(--text-muted); cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: all .15s;
    }
    .icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-secondary); }

    /* ─── Buttons (global base) ──────────────────────────────── */
    .btn {
      padding: 10px 18px;
      border-radius: 8px;
      border: none;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all .15s;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      line-height: 1.4;
    }

    /* ─── Quick Actions ───────────────────────────────────────── */
    .quick-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }
    .quick-actions .btn {
      height: 42px;
      padding: 0 16px;
      font-size: 13px;
      line-height: 1;
    }
    .btn-primary {
      background: var(--accent);
      color: white;
    }
    .btn-primary:hover {
      background: var(--accent-hover);
      transform: translateY(-1px);
    }
    .btn-secondary {
      background: #1f1f1f;
      color: var(--text-primary);
      border: none;
    }
    .btn-secondary:hover {
      background: #2a2a2a;
      transform: translateY(-1px);
    }
    .btn-danger {
      background: rgba(239,68,68,0.1);
      color: var(--red);
      border: 1px solid rgba(239,68,68,0.2);
    }
    .btn-danger:hover {
      background: rgba(239,68,68,0.15);
    }

    /* ─── Layout: Content + Sidebar right ─────────────────────── */
    .content-layout {
      display: grid;
      grid-template-columns: 2fr 1fr;
      gap: 24px;
    }
    .content-main { min-width: 0; }
    .content-side {}
    .side-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 16px;
    }
    .side-card-title {
      font-size: 14px; font-weight: 600;
      margin-bottom: 12px; color: var(--text-primary);
    }

    /* ─── Form Elements ───────────────────────────────────────── */
    input, textarea, select {
      width: 100%; padding: 12px 14px;
      background: rgba(255,255,255,0.04);
      border: 1px solid var(--border); border-radius: 8px;
      color: var(--text-primary); font-size: 14px;
      outline: none; transition: border-color .15s, box-shadow .15s;
      line-height: 1.4;
    }
    input:hover, textarea:hover, select:hover { border-color: rgba(255,255,255,0.12); }
    input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224,122,95,0.08); }
    input::placeholder, textarea::placeholder { color: var(--text-muted); }
    .form-row { display: flex; gap: 12px; }
    .form-row input, .form-row select { flex: 1; }
    .form-group { margin-bottom: 16px; }
    label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }

    /* ─── Pagination ──────────────────────────────────────────── */
    .pagination {
      display: flex; gap: 8px; justify-content: center;
      margin-top: 16px; align-items: center;
    }
    .pagination button {
      padding: 6px 12px; border-radius: 6px;
      border: 1px solid var(--border); background: transparent;
      color: var(--text-secondary); font-size: 12px; cursor: pointer;
    }
    .pagination button:hover { background: rgba(255,255,255,0.04); }
    .pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
    .pagination span { font-size: 12px; color: var(--text-muted); }

    /* ─── Modal ───────────────────────────────────────────────── */
    .modal-overlay {
      position: fixed; top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.7);
      display: flex; align-items: center; justify-content: center;
      z-index: 200;
    }
    .modal {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 24px; width: 90%; max-width: 460px;
    }
    .modal h3 { margin-bottom: 16px; font-size: 16px; }
    .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

    /* ─── Secret Box ──────────────────────────────────────────── */
    .secret-box {
      background: rgba(0,0,0,0.3);
      padding: 14px; border-radius: 8px;
      border: 1px solid var(--border);
      font-family: 'SF Mono', Monaco, monospace;
      font-size: 13px; word-break: break-all;
      position: relative;
    }
    .copy-btn-inline {
      position: absolute; top: 10px; right: 10px;
      padding: 4px 10px; font-size: 11px;
      background: rgba(255,255,255,0.08); color: var(--text-secondary);
      border: 1px solid var(--border); border-radius: 4px;
      cursor: pointer;
    }
    .copy-btn-inline:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); }

    /* ─── Auth ────────────────────────────────────────────────── */
    .auth-page {
      display: flex; align-items: center; justify-content: center;
      min-height: 100vh; padding: 24px;
      background: linear-gradient(180deg, var(--bg) 0%, #0f0f0f 100%);
    }
    .auth-card {
      background: var(--card);
      border: 1px solid #2e2e2e;
      border-radius: 20px;
      padding: 48px 40px; width: 100%; max-width: 440px;
      box-shadow: 0 24px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.02);
    }
    .auth-header {
      text-align: center;
      margin-bottom: 32px;
    }
    .auth-logo {
      display: inline-flex; align-items: center; gap: 12px;
      font-size: 24px; font-weight: 700;
      letter-spacing: -0.5px;
      margin-bottom: 8px;
    }
    .auth-logo .logo-claude {
      width: 28px; height: 28px;
    }
    .auth-sub { color: var(--text-muted); font-size: 13px; font-weight: 400; }

    .auth-tabs {
      display: flex;
      margin-bottom: 28px;
      border-bottom: 1px solid var(--border);
      position: relative;
    }
    .auth-tab {
      flex: 1; padding: 12px 8px 14px;
      background: transparent;
      color: var(--text-muted); font-size: 15px; cursor: pointer;
      font-weight: 500; transition: color .2s;
      border: none; position: relative;
    }
    .auth-tab:hover { color: var(--text-secondary); }
    .auth-tab.active { color: var(--text-primary); }
    .auth-tab::after {
      content: '';
      position: absolute; bottom: -1px; left: 0; right: 0;
      height: 2px; background: var(--accent);
      border-radius: 2px 2px 0 0;
      transform: scaleX(0);
      transition: transform .25s cubic-bezier(.4,0,.2,1);
    }
    .auth-tab.active::after { transform: scaleX(1); }

    .auth-form .form-group { margin-bottom: 20px; }
    .auth-form label {
      display: block;
      font-size: 12px; font-weight: 500;
      color: var(--text-secondary);
      margin-bottom: 6px;
      letter-spacing: 0.3px;
    }
    .auth-form input[type="text"],
    .auth-form input[type="email"],
    .auth-form input[type="password"] {
      width: 100%;
      padding: 13px 14px;
      background: rgba(255,255,255,0.03);
      border: 1px solid #2e2e2e;
      border-radius: 10px;
      color: var(--text-primary); font-size: 14px;
      outline: none;
      transition: border-color .2s, box-shadow .2s, background .2s;
    }
    .auth-form input:hover {
      background: rgba(255,255,255,0.04);
      border-color: rgba(255,255,255,0.1);
    }
    .auth-form input:focus {
      background: rgba(255,255,255,0.04);
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(224,122,95,0.08);
    }
    .auth-form input::placeholder { color: #666; }

    .auth-form .password-wrap { position: relative; }
    .auth-form .password-wrap input { padding-right: 42px; }
    .auth-form .password-toggle {
      position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
      background: transparent; border: none;
      color: var(--text-muted); cursor: pointer;
      width: 28px; height: 28px;
      display: flex; align-items: center; justify-content: center;
      border-radius: 6px; transition: all .15s;
    }
    .auth-form .password-toggle:hover {
      color: var(--text-secondary);
      background: rgba(255,255,255,0.06);
    }
    .auth-form .password-toggle svg { width: 16px; height: 16px; }

    .auth-form .checkbox-row {
      display: flex; align-items: center; gap: 8px;
      margin: 4px 0 24px;
    }
    .auth-form .checkbox-row input[type="checkbox"] {
      appearance: none;
      width: 15px; height: 15px;
      border: 1.5px solid rgba(255,255,255,0.08);
      border-radius: 4px;
      background: rgba(255,255,255,0.02);
      cursor: pointer;
      position: relative;
      flex-shrink: 0;
      transition: all .15s;
      margin-top: -1px;
    }
    .auth-form .checkbox-row input[type="checkbox"]:hover {
      border-color: rgba(255,255,255,0.18);
      background: rgba(255,255,255,0.04);
    }
    .auth-form .checkbox-row input[type="checkbox"]:checked {
      background: var(--accent);
      border-color: var(--accent);
    }
    .auth-form .checkbox-row input[type="checkbox"]:checked::after {
      content: '';
      position: absolute; left: 4px; top: 1.5px;
      width: 3.5px; height: 6.5px;
      border: solid white;
      border-width: 0 1.5px 1.5px 0;
      transform: rotate(45deg);
    }
    .auth-form .checkbox-row label {
      font-size: 13px; color: var(--text-secondary);
      margin: 0; cursor: pointer; font-weight: 400;
    }
    .auth-form .checkbox-row .link {
      margin-left: auto;
      font-size: 13px; color: var(--accent);
      text-decoration: none;
      font-weight: 500;
    }
    .auth-form .checkbox-row .link:hover { text-decoration: underline; }

    .auth-form .btn-primary {
      width: 100%;
      padding: 13px;
      font-size: 15px; font-weight: 600;
      border-radius: 10px;
      box-shadow: 0 1px 2px rgba(224,122,95,0.2);
    }
    .auth-form .btn-primary:hover {
      box-shadow: 0 2px 8px rgba(224,122,95,0.25);
      transform: translateY(-1px);
    }
    .auth-form .btn-primary:active {
      transform: translateY(0);
      box-shadow: 0 1px 2px rgba(224,122,95,0.2);
    }

    .auth-error {
      display: flex; align-items: center; gap: 8px;
      padding: 10px 14px;
      background: rgba(239,68,68,0.06);
      border: 1px solid rgba(239,68,68,0.15);
      border-radius: 8px;
      color: var(--red); font-size: 13px;
      margin-top: 16px;
      animation: slideDown .2s ease-out;
    }
    .auth-error::before {
      content: '!';
      width: 16px; height: 16px; border-radius: 50%;
      background: rgba(239,68,68,0.15);
      color: var(--red);
      font-size: 11px; font-weight: 700;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .auth-success {
      display: flex; align-items: center; gap: 8px;
      padding: 10px 14px;
      background: rgba(74,222,128,0.06);
      border: 1px solid rgba(74,222,128,0.15);
      border-radius: 8px;
      color: var(--green); font-size: 13px;
      margin-top: 16px;
      animation: slideDown .2s ease-out;
    }
    @keyframes slideDown {
      from { opacity: 0; transform: translateY(-6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .auth-hint {
      font-size: 12px; color: var(--text-muted);
      margin-top: 8px;
    }

    .auth-divider {
      display: flex; align-items: center;
      gap: 12px;
      margin: 20px 0;
      color: var(--text-muted);
      font-size: 12px;
    }
    .auth-divider::before, .auth-divider::after {
      content: ''; flex: 1; height: 1px; background: var(--border);
    }

    /* Legacy global error / success / hint (used inside app pages) */
    .error { color: var(--red); font-size: 13px; margin-top: 10px; padding: 0 2px; }
    .success { color: var(--green); font-size: 13px; margin-top: 10px; padding: 0 2px; }
    .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; padding: 0 2px; }

    /* ─── Alert Banner ────────────────────────────────────────── */
    .alert-banner {
      background: rgba(239,68,68,0.08);
      border: 1px solid rgba(239,68,68,0.2);
      border-radius: 8px;
      padding: 10px 16px;
      margin-bottom: 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 13px;
      color: var(--red);
    }
    .alert-banner .close { cursor: pointer; color: var(--text-muted); margin-left: 12px; }
    .alert-banner .close:hover { color: var(--text-primary); }
    .alert-banner.warn { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.2); color: var(--yellow); }
    .alert-banner.info { background: rgba(96,165,250,0.08); border-color: rgba(96,165,250,0.2); color: var(--blue); }

    /* ─── Account Cards (Dashboard) ───────────────────────────── */
    .account-card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }
    .account-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 20px;
      transition: background .15s;
    }
    .account-card:hover { background: var(--card-hover); }
    .account-card-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 12px;
    }
    .account-card-name { font-size: 14px; font-weight: 600; }
    .account-card-meta { font-size: 12px; color: var(--text-muted); }
    .account-card-balance { font-size: 20px; font-weight: 700; margin: 8px 0; }
    .account-card-stats { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }
    .account-card-actions { display: flex; gap: 8px; margin-top: 12px; }
    .account-card-actions button { padding: 4px 10px; font-size: 12px; }

    /* ─── Empty State ─────────────────────────────────────────── */
    .empty-state {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 60px 40px;
      text-align: center;
      color: var(--text-muted);
    }
    .empty-state .icon { font-size: 40px; margin-bottom: 16px; }
    .empty-state .title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
    .empty-state .desc { font-size: 13px; margin-bottom: 20px; }

    /* ─── Error Pages ─────────────────────────────────────────── */
    .error-page {
      display: flex; align-items: center; justify-content: center;
      min-height: calc(100vh - var(--topbar-height));
      padding: 40px;
    }
    .error-card {
      text-align: center;
      max-width: 400px;
    }
    .error-code { font-size: 64px; font-weight: 700; color: var(--text-muted); line-height: 1; margin-bottom: 16px; }
    .error-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
    .error-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }

    /* ─── Settings Tabs ───────────────────────────────────────── */
    .settings-tabs {
      display: flex; gap: 8px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 20px;
      padding-bottom: 1px;
    }
    .settings-tab {
      padding: 8px 16px;
      font-size: 13px;
      color: var(--text-secondary);
      background: transparent;
      border: none;
      border-bottom: 2px solid transparent;
      cursor: pointer;
      margin-bottom: -1px;
    }
    .settings-tab:hover { color: var(--text-primary); }
    .settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

    /* ─── Audit Detail Drawer ─────────────────────────────────── */
    .audit-detail {
      background: rgba(255,255,255,0.02);
      padding: 12px 20px;
      border-top: 1px solid var(--border);
      font-size: 12px;
      color: var(--text-secondary);
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }
    .audit-detail.hidden { display: none; }

    /* ─── Password Toggle ─────────────────────────────────────── */
    .password-wrap { position: relative; margin-bottom: 4px; }
    .password-wrap input { padding-right: 40px; }
    .password-toggle {
      position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
      background: transparent; border: none; color: var(--text-muted);
      cursor: pointer; padding: 4px; width: 22px; height: 22px;
      display: flex; align-items: center; justify-content: center;
      border-radius: 4px; transition: all .15s;
    }
    .password-toggle:hover { color: var(--text-secondary); background: rgba(255,255,255,0.06); }
    .password-toggle svg { width: 16px; height: 16px; }

    /* ─── Checkbox ────────────────────────────────────────────── */
    .checkbox-row {
      display: flex; align-items: center; gap: 8px;
      font-size: 13px; color: var(--text-secondary);
      margin: 12px 0;
    }
    .checkbox-row input[type="checkbox"] {
      width: 16px; height: 16px; accent-color: var(--accent);
      cursor: pointer; flex-shrink: 0;
    }
    .checkbox-row label { margin: 0; cursor: pointer; }

    /* ─── Link ────────────────────────────────────────────────── */
    .link { color: var(--accent); text-decoration: none; font-size: 12px; }
    .link:hover { text-decoration: underline; }

    /* ─── Network Offline Banner ──────────────────────────────── */
    .offline-banner {
      position: fixed; top: var(--topbar-height); left: var(--sidebar-width); right: 0;
      background: rgba(239,68,68,0.9); color: white;
      padding: 8px 20px; font-size: 13px; z-index: 98;
      display: flex; align-items: center; justify-content: center; gap: 8px;
    }

    /* ─── Secret Countdown ────────────────────────────────────── */
    .secret-countdown {
      font-size: 11px; color: var(--yellow);
      margin-top: 8px;
    }
    .secret-mask {
      filter: blur(4px); user-select: none;
      transition: filter 0.2s;
    }
    .secret-mask.revealed { filter: none; user-select: text; }

    /* ─── Stats Bar ───────────────────────────────────────────── */
    .stats-bar {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-bottom: 20px;
    }
    .stats-bar .stat-card { text-align: center; padding: 14px; }
    .stats-bar .stat-value { font-size: 20px; font-weight: 700; color: var(--text-primary); }
    .stats-bar .stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

    /* ─── Utilities ───────────────────────────────────────────── */
    .hidden { display: none !important; }
    .password-strength {
      height: 4px; border-radius: 2px; margin-top: 6px; transition: all .3s;
    }
    .strength-weak { background: var(--red); }
    .strength-medium { background: var(--yellow); }
    .strength-strong { background: var(--green); }
    .risk-high { color: var(--red); font-weight: 600; }
    .risk-critical { color: #b91c1c; font-weight: 700; }
    .risk-medium { color: var(--yellow); }
    .risk-low { color: var(--text-secondary); }
    .filters { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
    .filters input, .filters select { width: auto; min-width: 140px; }
    .mt-4 { margin-top: 16px; }
    .mb-4 { margin-bottom: 16px; }
    .flex { display: flex; }
    .items-center { align-items: center; }
    .justify-between { justify-content: space-between; }
    .gap-2 { gap: 8px; }
    .text-xs { font-size: 11px; }
    .text-sm { font-size: 12px; }
    .text-muted { color: var(--text-muted); }

    /* ─── Responsive ──────────────────────────────────────────── */
    @media (max-width: 1024px) {
      .content-layout { flex-direction: column; }
      .content-side { width: 100%; }
      .card-grid { grid-template-columns: 1fr; }
      .balance-grid { grid-template-columns: 1fr; }
    }
    @media (max-width: 768px) {
      .sidebar { transform: translateX(-100%); }
      .main { margin-left: 0; }
      .topbar-tabs { display: none; }
    }

/* ─── Account Tabs ─────────────────────────────────────────── */
.account-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.account-tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}
.account-tab:hover {
  color: var(--text-primary);
  background: var(--card-hover);
}
.account-tab.active {
  background: var(--accent);
  color: white;
}

/* ─── Position Table Fix ───────────────────────────────────── */
.position-table .table-header,
.position-table .table-row {
  grid-template-columns: 2fr 1fr 1.2fr 1.2fr 1.2fr 1.5fr !important;
  gap: 16px;
  align-items: center;
}

.position-table .table-header {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.position-table .table-row {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.position-table .table-row:last-child {
  border-bottom: none;
}

.position-table .table-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card spacing fix */
.account-card {
  padding: 20px;
  margin-bottom: 16px;
}

.account-card-header {
  margin-bottom: 16px;
}

.account-card-balance {
  font-size: 28px;
  font-weight: 700;
  margin: 12px 0;
}

.account-card-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* ─── Binance-style position card ──────────────────────────────── */

.account-metrics-row {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.metric-box {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  min-width: 0;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Position block */
.position-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.position-title-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.position-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.position-side {
  font-size: 13px;
  font-weight: 700;
}

.position-lev {
  font-size: 12px;
  font-weight: 600;
  background: var(--card);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.position-margin-type {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Price row */
.position-row-prices {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.price-col {
  flex: 1;
  text-align: center;
}

.price-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.price-val {
  font-size: 15px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-primary);
}

/* Size row */
.position-row-size {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.size-col {
  flex: 1;
  text-align: center;
}

.size-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.size-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* PnL row */
.position-row-pnl {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.pnl-col {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pnl-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.pnl-val {
  font-size: 14px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Strategy metrics row — totalReturn / projectedAPY / actualAPY / alignment */
.strategy-metrics-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.metric-col {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.metric-val {
  font-size: 13px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* SL/TP row */
.position-row-sl-tp {
  display: flex;
  gap: 12px;
}

.sl-col, .tp-col {
  flex: 1;
  text-align: center;
}

.sl-label, .tp-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.sl-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
}

.tp-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dim);
}

/* Color helpers */
.text-green { color: var(--green-dim); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   AI CHAT STYLES - 左右分栏布局
   ═══════════════════════════════════════════════════════════════ */

/* ─── 整体布局 ──────────────────────────────────────────────── */
.chat-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height) - 32px);
  gap: 16px;
  padding: 0 8px;
}

/* ─── 左侧参数面板 ──────────────────────────────────────────── */
.chat-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.chat-sidebar-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-sidebar-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.chat-param-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-param-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-param-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.chat-param-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'SF Mono', Monaco, monospace;
}

.stat-speed {
  transition: color 0.3s;
}

.stat-fast { color: var(--green) !important; }
.stat-medium { color: var(--yellow) !important; }
.stat-slow { color: var(--red) !important; }

/* ─── 右侧聊天区域 ──────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ─── Chat Container ────────────────────────────────────────── */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  text-align: center;
}

.chat-welcome-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.chat-welcome-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-welcome-desc {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 400px;
}

/* ─── Chat Messages ─────────────────────────────────────────── */
.chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-avatar.user {
  background: var(--accent);
  color: white;
}

.chat-avatar.assistant {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.chat-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-bubble.user {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  align-self: flex-end;
}

.chat-message.user .chat-meta {
  text-align: right;
}

/* ─── Streaming Cursor ──────────────────────────────────────── */
.chat-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ─── Input Area ────────────────────────────────────────────── */
.chat-input-area {
  flex-shrink: 0;
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 4px;
  outline: none;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.chat-send-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-input-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .chat-layout {
    flex-direction: column;
  }
  .chat-sidebar {
    width: 100%;
    max-height: 200px;
  }
}
