:root {
    --bg: #f7f6f3;
    --surface: #ffffff;
    --surface2: #f0efe9;
    --surface3: #e8e6df;
    --border: #e2e0d8;
    --border-strong: #c8c5ba;
    --text: #1a1916;
    --text2: #6b6860;
    --text3: #9c9a94;
    --accent: #1a1916;
    --accent-fg: #f7f6f3;
    --green: #2d6a4f;
    --green-bg: #d8f3dc;
    --yellow: #b5850a;
    --yellow-bg: #fff3cd;
    --red: #c0392b;
    --red-bg: #fce4e1;
    --blue: #1a5276;
    --blue-bg: #d6eaf8;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.06);
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: 'Geist', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
  }

  /* ─── LAYOUT ─── */
  .app {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 52px 1fr;
    height: 100vh;
    overflow: hidden;
  }
  /* Kein Sidebar wenn nicht eingeloggt */
  .app.no-sidebar {
    grid-template-columns: 1fr;
  }

  /* ─── TOPBAR ─── */
  .topbar {
    grid-column: 1 / -1;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    z-index: 100;
  }

  .logo {
    font-family: 'Instrument Serif', serif;
    font-size: 20px;
    font-weight: 400;
    color: var(--text);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
  }

  .logo-dot {
    width: 8px; height: 8px;
    background: var(--text);
    border-radius: 50%;
    animation: pulse 2.5s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
  }

  .topbar-divider { width: 1px; height: 20px; background: var(--border); }

  .nav-tabs {
    display: flex;
    gap: 2px;
  }

  .nav-tab {
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.15s;
  }

  .nav-tab:hover { background: var(--surface2); color: var(--text); }
  .nav-tab.active { background: var(--text); color: var(--accent-fg); }

  .topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    font-family: inherit;
  }

  .btn-ghost { background: none; color: var(--text2); }
  .btn-ghost:hover { background: var(--surface2); color: var(--text); }
  .btn-outline { background: none; border: 1px solid var(--border-strong); color: var(--text); }
  .btn-outline:hover { background: var(--surface2); }
  .btn-primary { background: var(--text); color: var(--accent-fg); }
  .btn-primary:hover { background: #333; }
  .btn-sm { padding: 4px 10px; font-size: 12px; }

  .role-badge {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(0,0,0,0.08);
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .role-badge[data-role="admin"] { background: rgba(38, 136, 255, 0.14); color: #0b3d91; }
  .role-badge[data-role="premium"] { background: rgba(240, 214, 44, 0.14); color: #7c6200; }
  .role-badge[data-role="user"] { background: rgba(0,0,0,0.08); color: var(--text2); }

  /* ─── SIDEBAR ─── */
  .sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .sidebar-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 8px;
  }

  .model-selector-btn {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s;
    font-family: inherit;
    text-align: left;
  }

  .model-selector-btn:hover { border-color: var(--border-strong); background: var(--surface3); }

  .model-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
  }

  .model-info { flex: 1; min-width: 0; }
  .model-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .model-provider { font-size: 11px; color: var(--text3); }

  .chevron { color: var(--text3); font-size: 12px; }

  /* Sidebar params */
  .param-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
  }

  .param-row:last-child { margin-bottom: 0; }

  .param-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text2);
    font-weight: 500;
  }

  .param-value { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--text3); }

  input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
  }

  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    background: var(--text);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
  }

  input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

  .sidebar-scroll { flex: 1; overflow-y: auto; padding: 16px; }

  /* History */
  .history-item {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
    margin-bottom: 2px;
  }

  .history-item:hover { background: var(--surface2); }
  .history-item.active { background: var(--surface2); }
  .history-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .history-meta { font-size: 11px; color: var(--text3); margin-top: 1px; }

  .model-copy-btn {
    position: absolute;
    top: 7px; right: 7px;
    width: 22px; height: 22px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text3);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    z-index: 2;
  }
  .model-card { position: relative; }
  .model-card:hover .model-copy-btn { opacity: 1; }
  .model-copy-btn:hover { background: var(--text); color: white; border-color: var(--text); }
  .model-copy-btn.copied { background: #dcfce7; color: #15803d; border-color: #86efac; opacity: 1; }

  .model-use-btn {
    position: absolute;
    bottom: 8px; right: 8px;
    padding: 3px 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    z-index: 2;
    white-space: nowrap;
  }
  .model-card:hover .model-use-btn { opacity: 1; }
  .model-use-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

  .model-fav-btn {
    position: absolute;
    top: 7px; left: 7px;
    width: 22px; height: 22px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: var(--text3);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, transform 0.15s;
    z-index: 2;
    padding: 0;
    font-size: 14px;
    line-height: 1;
  }
  .model-card:hover .model-fav-btn { opacity: 1; }
  .model-fav-btn:hover { transform: scale(1.2); }
  .model-fav-btn.is-fav { opacity: 1; color: #f59e0b; }
  .model-fav-btn.is-fav:hover { color: #d97706; }

  /* tester card fav */
  .tester-fav-btn {
    width: 22px; height: 22px;
    border: none; background: transparent;
    cursor: pointer; font-size: 15px; line-height: 1;
    color: var(--text3);
    transition: color 0.15s, transform 0.15s;
    padding: 0; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .tester-fav-btn:hover { transform: scale(1.2); }
  .tester-fav-btn.is-fav { color: #f59e0b; }

  .history-item { position: relative; padding-right: 28px; }
  .history-del {
    position: absolute;
    right: 4px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text3);
    cursor: pointer;
    font-size: 11px;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.12s, background 0.12s;
    padding: 0;
    line-height: 1;
  }
  .history-item:hover .history-del { opacity: 1; }
  .history-del:hover { background: #fee2e2; color: #dc2626; }

  /* ─── MAIN ─── */
  .main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
  }

  /* ─── PAGES ─── */
  .page { display: none; flex-direction: column; height: 100%; overflow: hidden; }
  .page.active { display: flex; }
  .page.active.telemetry-page { overflow: hidden !important; }
  .page.active.telemetry-page .grid-container { overflow-y: auto !important; }
  
  /* Hide telemetry elements on non-telemetry pages */
  .page:not(.telemetry-page) [id^="telemetry-"],
  .page:not(.telemetry-page) [id*="telemetry"],
  .page:not(.telemetry-page) .telemetry-section,
  .page:not(.telemetry-page) canvas[id*="Chart"],
  .page:not(.telemetry-page) .stat-card {
    display: none !important;
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
  }

  .field {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .field label {
    font-size: 12px;
    color: var(--text2);
  }

  .field input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface2);
  }

  .field input:focus {
    outline: none;
    border-color: var(--text);
  }

  /* ─── CHAT PAGE ─── */
  .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .chat-messages::-webkit-scrollbar { width: 6px; }
  .chat-messages::-webkit-scrollbar-track { background: transparent; }
  .chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  .message-wrap {
    width: 100%;
    max-width: 720px;
    padding: 0 24px;
    margin-bottom: 24px;
    animation: fadeUp 0.25s ease;
  }

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

  .message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }

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

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

  .message.assistant .message-avatar { background: var(--text); color: var(--accent-fg); }
  .message.user .message-avatar { background: var(--surface3); color: var(--text); }

  .message-body { max-width: calc(100% - 40px); }

  .message-sender { font-size: 11px; font-weight: 600; color: var(--text3); margin-bottom: 4px; letter-spacing: 0.03em; text-transform: uppercase; }
  .message.user .message-sender { text-align: right; }

  .message-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text);
    box-shadow: var(--shadow);
  }

  .message.user .message-content {
    background: var(--text);
    color: var(--accent-fg);
    border-color: var(--text);
  }

  .message-content pre {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
  }

  .message.user .message-content pre {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
  }

  .message-content code {
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    background: var(--surface2);
    padding: 2px 5px;
    border-radius: 4px;
  }

  .message.user .message-content code {
    background: rgba(255,255,255,0.15);
  }

  .message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text3);
  }

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

  .token-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: var(--surface2);
    border-radius: 4px;
    font-family: 'Geist Mono', monospace;
    font-size: 10px;
  }

  .thinking-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text2);
  }

  .dots { display: flex; gap: 3px; }
  .dot { width: 5px; height: 5px; background: var(--text3); border-radius: 50%; animation: bounce 1.2s ease-in-out infinite; }
  .dot:nth-child(2) { animation-delay: 0.2s; }
  .dot:nth-child(3) { animation-delay: 0.4s; }

  @keyframes bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
  }

  /* Welcome state */
  .welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
  }

  .welcome-title {
    font-family: 'Instrument Serif', serif;
    font-size: 36px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
  }

  .welcome-sub {
    font-size: 15px;
    color: var(--text2);
    margin-bottom: 36px;
    max-width: 400px;
  }

  .suggestion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 520px;
    width: 100%;
  }

  .suggestion-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    font-family: inherit;
  }

  .suggestion-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
  .suggestion-card-icon { font-size: 18px; margin-bottom: 6px; }
  .suggestion-card-title { font-size: 13px; font-weight: 600; color: var(--text); }
  .suggestion-card-desc { font-size: 12px; color: var(--text2); margin-top: 2px; }

  /* ─── INPUT AREA ─── */
  .input-area {
    padding: 16px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--bg);
  }

  .input-container {
    width: 100%;
    max-width: 720px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    transition: border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
  }

  .input-container:focus-within {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(26,25,22,0.06), var(--shadow-md);
  }

  .input-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px 0;
  }

  .input-tool-btn {
    width: 28px; height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text3);
    font-size: 14px;
    transition: all 0.12s;
  }

  .input-tool-btn:hover { background: var(--surface2); color: var(--text); }
  .input-tool-btn.active { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
  .input-tool-btn.active svg { animation: micPulse 1s ease-in-out infinite; }
  @keyframes micPulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

  .attachments-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px 4px;
    border-bottom: 1px solid var(--border);
  }

  .attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text2);
    max-width: 200px;
  }

  .attachment-chip img {
    width: 28px; height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
  }

  .attachment-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
  }

  .attachment-chip-remove {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: none;
    background: var(--text3);
    color: white;
    cursor: pointer;
    font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    transition: background 0.1s;
  }
  .attachment-chip-remove:hover { background: var(--red); }

  .message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
  }

  .message-attachment-img {
    max-width: 260px;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid var(--border);
    object-fit: cover;
    cursor: zoom-in;
  }

  .chat-messages.drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: -4px;
    background: rgba(99,102,241,0.03);
  }

  .message-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text2);
  }

  textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    min-height: 44px;
    max-height: 200px;
  }

  textarea::placeholder { color: var(--text3); }

  .input-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 8px;
  }

  .input-bottom-left { display: flex; align-items: center; gap: 6px; }

  .model-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: var(--surface2);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    border: 1px solid var(--border);
    font-family: inherit;
    transition: all 0.12s;
  }

  .model-chip:hover { background: var(--surface3); color: var(--text); }

  .send-btn {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: var(--text);
    color: var(--accent-fg);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
  }

  .send-btn:hover { background: #333; transform: scale(1.05); }
  .send-btn:disabled { background: var(--border); cursor: not-allowed; transform: none; }

  .input-hint {
    font-size: 11px;
    color: var(--text3);
    text-align: center;
  }

  /* ─── MODELS PAGE ─── */
  .models-page {
    padding: 32px;
    overflow-y: auto;
  }

  .page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
  }

  .page-title {
    font-family: 'Instrument Serif', serif;
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text);
  }

  .page-subtitle { font-size: 14px; color: var(--text2); margin-top: 2px; }

  .provider-section { margin-bottom: 32px; }

  .provider-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }

  .provider-logo {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid var(--border);
    background: var(--surface);
  }

  .provider-info { flex: 1; }
  .provider-name { font-size: 16px; font-weight: 600; color: var(--text); }
  .provider-desc { font-size: 12px; color: var(--text2); margin-top: 1px; }

  .provider-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
  }

  .status-dot { width: 6px; height: 6px; border-radius: 50%; }
  .status-connected { background: var(--green-bg); color: var(--green); }
  .status-connected .status-dot { background: var(--green); }
  .status-disconnected { background: var(--surface2); color: var(--text2); }
  .status-disconnected .status-dot { background: var(--text3); }

  .models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }

  .model-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
  }

  .model-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
  .model-card.selected { border-color: var(--text); }

  .model-card-check {
    position: absolute;
    top: 10px; right: 10px;
    width: 18px; height: 18px;
    background: var(--text);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
  }

  .model-card.selected .model-card-check { display: flex; }

  .model-card-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 10px;
  }

  .model-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
  .model-card-id { font-size: 11px; color: var(--text3); font-family: 'Geist Mono', monospace; margin-top: 2px; }

  .model-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
  }

  .tag {
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .tag-fast { background: var(--yellow-bg); color: var(--yellow); }
  .tag-smart { background: var(--blue-bg); color: var(--blue); }
  .tag-cheap { background: var(--green-bg); color: var(--green); }
  .tag-code { background: #ede9fe; color: #5b21b6; }
  .tag-vision { background: #fce7f3; color: #9d174d; }
  .tag-free { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; font-weight: 700; }

  @keyframes spin { to { transform: rotate(360deg); } }
  .spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--text); border-radius: 50%; animation: spin 0.7s linear infinite; }

  .refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
  }

  .refresh-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface2); }
  .refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .refresh-btn.loading { color: var(--text3); }

  .refresh-icon { transition: transform 0.3s; font-size: 12px; }
  .refresh-btn:hover .refresh-icon { transform: rotate(180deg); }

  .provider-refresh-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    flex-wrap: wrap;
  }

  .refresh-btn-prominent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    box-shadow: var(--shadow);
  }

  .refresh-btn-prominent:hover {
    background: var(--text);
    color: var(--accent-fg);
    border-color: var(--text);
    box-shadow: var(--shadow-md);
  }

  .refresh-btn-prominent:hover .refresh-svg { animation: spin 0.5s linear; }
  .refresh-btn-prominent:disabled { opacity: 0.5; cursor: not-allowed; }
  .refresh-btn-prominent:disabled:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }

  .provider-model-count {
    font-size: 11px;
    color: var(--text3);
    font-family: 'Geist Mono', monospace;
    background: var(--surface2);
    padding: 2px 7px;
    border-radius: 4px;
  }

  .fetch-error {
    font-size: 12px;
    color: var(--red);
    padding: 6px 10px;
    background: var(--red-bg);
    border-radius: var(--radius-sm);
    margin-top: 8px;
  }

  .free-section-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1.5px solid #86efac;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 20px;
  }

  .free-section-banner-icon { font-size: 22px; }
  .free-section-banner-title { font-size: 14px; font-weight: 700; color: #15803d; }
  .free-section-banner-sub { font-size: 12px; color: #166534; margin-top: 1px; }

  .free-section { margin-bottom: 36px; }

  .free-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #86efac;
  }

  .free-badge-header {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #15803d;
  }

  .model-card.free-card {
    border-color: #bbf7d0;
    background: linear-gradient(145deg, #ffffff 0%, #f0fdf4 100%);
  }

  .model-card.free-card:hover { border-color: #4ade80; }
  .model-card.free-card.selected { border-color: #15803d; }

  .modal-free-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #15803d;
    margin-left: auto;
    flex-shrink: 0;
  }

  /* ─── KEYS PAGE ─── */
  .keys-page { padding: 32px; overflow-y: auto; }

  .key-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    transition: border-color 0.15s;
  }

  .key-card:hover { border-color: var(--border-strong); }

  .key-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }

  .key-provider-logo {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 1px solid var(--border);
  }

  .key-card-title { font-size: 15px; font-weight: 600; color: var(--text); }
  .key-card-url { font-size: 12px; color: var(--text3); font-family: 'Geist Mono', monospace; }

  .key-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .key-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
  }
  .key-input-wrap:focus-within {
    border-color: var(--text);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(26,25,22,0.06);
  }

  .key-input {
    flex: 1;
    min-width: 0;
    height: 38px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 8px 0 12px;
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    color: var(--text);
    outline: none;
  }

  .key-eye-btn {
    position: static;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: none;
    cursor: pointer;
    color: var(--text3);
    border-radius: 6px;
    transition: all 0.12s;
    flex-shrink: 0;
    margin-right: 2px;
  }
  .key-eye-btn:hover { background: var(--surface3); color: var(--text); }
  .key-eye-btn.visible { color: var(--text); }

  .key-input:focus { outline: none; }
  .key-input::placeholder { color: var(--text3); font-family: 'Geist', sans-serif; }

  .key-save-btn {
    height: 38px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--text);
    color: var(--accent-fg);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
  }

  .key-save-btn:hover { background: #333; }

  .key-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
  }

  .key-hint { font-size: 12px; color: var(--text3); }

  /* ─── COMPARE PAGE ─── */
  .compare-page { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }

  .compare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .compare-input-area {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
  }

  .compare-input-area textarea {
    width: 100%;
    border: none;
    background: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    resize: none;
    min-height: 80px;
  }

  .compare-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
  }

  .compare-model-picks {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .compare-model-pick {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
  }

  .compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
  }

  .compare-response {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .compare-response-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
  }

  .compare-response-body {
    padding: 16px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text);
    min-height: 120px;
  }

  .compare-response-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
    font-size: 12px;
    color: var(--text3);
    font-family: 'Geist Mono', monospace;
  }

  /* ─── MODAL ─── */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .modal-overlay.open { display: flex; }

  .modal {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.2s ease;
  }

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

  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
  }

  .modal-title { font-size: 16px; font-weight: 600; color: var(--text); }
  .modal-close { background: none; border: none; cursor: pointer; color: var(--text2); font-size: 18px; padding: 2px; border-radius: 4px; }
  .modal-close:hover { background: var(--surface2); color: var(--text); }

  .modal-search {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
  }

  .modal-search input {
    width: 100%;
    height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    outline: none;
  }

  .modal-search input:focus { border-color: var(--text); }

  .modal-body { overflow-y: auto; padding: 12px; }

  .modal-provider-group { margin-bottom: 8px; }
  .modal-provider-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text3);
    padding: 6px 8px 4px;
  }

  .modal-model-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
  }

  .modal-model-item:hover { background: var(--surface2); }
  .modal-model-item.active { background: var(--surface3); }

  .modal-model-name { font-size: 13px; font-weight: 500; color: var(--text); }
  .modal-model-meta { font-size: 11px; color: var(--text3); font-family: 'Geist Mono', monospace; }

  /* ─── TOAST ─── */
  .toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
  }

  .toast {
    background: var(--text);
    color: var(--accent-fg);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  @keyframes toastIn {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
  }

  /* ─── SCROLLBAR ─── */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  /* ─── RESPONSIVE HELPERS ─── */
  .flex { display: flex; }
  .items-center { align-items: center; }
  .gap-2 { gap: 8px; }
  .gap-3 { gap: 12px; }
  .mt-2 { margin-top: 8px; }
  .fw { width: 100%; }

  /* ─── TESTER PAGE ─── */
  .tester-page { padding: 32px; overflow-y: auto; height: 100%; display: flex; flex-direction: column; gap: 20px; }

  /* ─── ARENA ─── */
  .arena-page {
    padding: 24px 32px 32px;
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
  }

  /* Top bar with view toggle */
  .arena-top-bar {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
  }
  .arena-top-bar > div:first-child { flex: 1; }

  .arena-view-toggle {
    display: flex;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
  }
  .avt-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text3);
    font-size: 12px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
  }
  .avt-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
  .avt-btn:hover:not(.active) { color: var(--text2); }

  /* Setup row */
  .arena-setup {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
  }
  .arena-setup-label {
    font-size: 11px; font-weight: 700; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-right: 4px; flex-shrink: 0;
  }
  .arena-participants { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }

  /* Chips */
  .arena-participant-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 8px 5px 6px;
    border-radius: 20px; border: 2px solid;
    font-size: 12px; font-weight: 600;
    background: var(--surface2);
    cursor: grab;
    transition: box-shadow 0.15s, opacity 0.15s, transform 0.15s;
    user-select: none;
  }
  .arena-participant-chip:active { cursor: grabbing; }
  .arena-participant-chip.dragging { opacity: 0.35; transform: scale(0.96); }
  .arena-participant-chip.drag-over { box-shadow: 0 0 0 2px #6366f1, 0 4px 12px rgba(0,0,0,0.15); transform: scale(1.04); }
  .chip-drag-handle { display: flex; flex-direction: column; gap: 2px; opacity: 0.45; flex-shrink: 0; cursor: grab; }
  .chip-drag-handle span { display: block; width: 12px; height: 1.5px; background: currentColor; border-radius: 1px; }
  .chip-order { font-size: 10px; font-weight: 800; opacity: 0.55; min-width: 10px; text-align: center; }
  .arena-participant-chip .chip-icon { font-size: 15px; }
  .arena-participant-chip .chip-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .arena-chip-remove {
    width: 16px; height: 16px; border-radius: 50%; border: none;
    background: rgba(0,0,0,0.1); cursor: pointer; font-size: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0; transition: background 0.1s; flex-shrink: 0;
  }
  .arena-chip-remove:hover { background: rgba(0,0,0,0.25); }

  .arena-add-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px; border-radius: 8px;
    border: 1.5px dashed var(--border); background: none;
    color: var(--text3); font-size: 12px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.12s; flex-shrink: 0;
  }
  .arena-add-btn:hover { border-color: var(--text2); color: var(--text2); background: var(--surface2); }
  .arena-add-btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* Config bar */
  .arena-config { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .arena-config-item { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text2); }
  .arena-select {
    height: 30px; border: 1px solid var(--border); border-radius: 7px;
    background: var(--surface); color: var(--text);
    font-family: inherit; font-size: 12px; padding: 0 10px; outline: none; cursor: pointer;
  }
  .arena-param-ctrl label { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; }
  .arena-slider {
    -webkit-appearance: none; appearance: none;
    width: 80px; height: 4px; border-radius: 2px;
    background: var(--border); outline: none; cursor: pointer;
  }
  .arena-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px;
    border-radius: 50%; background: var(--text); cursor: pointer;
  }
  .arena-param-val { font-size: 12px; font-family: 'Geist Mono', monospace; color: var(--text); min-width: 30px; }

  /* Prompt */
  .arena-prompt-area { display: flex; gap: 10px; align-items: flex-start; }
  .arena-prompt-input {
    flex: 1; border: 1.5px solid var(--border); border-radius: 12px;
    padding: 12px 16px; font-family: inherit; font-size: 14px;
    color: var(--text); background: var(--surface); resize: none; outline: none;
    line-height: 1.6; transition: border-color 0.15s;
  }
  .arena-prompt-input:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(26,25,22,0.06); }
  .arena-start-btn {
    height: 44px; padding: 0 20px; border-radius: 10px; border: none;
    background: var(--text); color: var(--accent-fg);
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; display: flex; align-items: center; gap: 7px;
    transition: all 0.15s; flex-shrink: 0;
  }
  .arena-start-btn:hover { background: #333; transform: translateY(-1px); }
  .arena-start-btn:disabled { background: var(--border); cursor: not-allowed; transform: none; }
  .arena-stop-btn {
    height: 44px; padding: 0 20px; border-radius: 10px; border: none;
    background: #ef4444; color: #fff;
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; display: flex; align-items: center; gap: 7px;
    transition: all 0.15s; flex-shrink: 0;
  }
  .arena-stop-btn:hover { background: #dc2626; transform: translateY(-1px); }

  /* Status */
  .arena-status {
    padding: 9px 14px; background: var(--surface2);
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; color: var(--text2);
    display: flex; align-items: center; gap: 8px;
  }
  .arena-status-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #10b981; flex-shrink: 0;
    animation: arenaPulse 1.2s ease-in-out infinite;
  }
  @keyframes arenaPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.4;transform:scale(0.8)} }

  /* ── ELO BOARD ── */
  .arena-elo-board {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
  }
  .elo-board-title {
    font-size: 11px; font-weight: 700; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
  }
  .elo-board-rows { display: flex; flex-direction: column; gap: 6px; }
  .elo-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px; border-radius: 8px;
    background: var(--surface2); transition: all 0.3s;
  }
  .elo-rank { font-size: 13px; font-weight: 800; min-width: 20px; text-align: center; }
  .elo-icon { font-size: 16px; }
  .elo-name { font-size: 13px; font-weight: 600; flex: 1; }
  .elo-score {
    font-size: 15px; font-weight: 800; font-family: 'Geist Mono', monospace;
    min-width: 50px; text-align: right;
  }
  .elo-delta {
    font-size: 11px; font-weight: 700; min-width: 36px; text-align: right;
    font-family: 'Geist Mono', monospace;
  }
  .elo-delta.pos { color: #10b981; }
  .elo-delta.neg { color: #ef4444; }
  .elo-bar-wrap { width: 80px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
  .elo-bar { height: 100%; border-radius: 3px; transition: width 0.6s cubic-bezier(.4,0,.2,1); }

  /* ── PULSE BARS ── */
  .arena-pulse-row {
    display: flex; gap: 10px; flex-wrap: wrap;
  }
  .pulse-card {
    flex: 1; min-width: 140px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px;
  }
  .pulse-header { display: flex; align-items: center; gap: 7px; }
  .pulse-icon { font-size: 16px; }
  .pulse-name { font-size: 12px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pulse-state { font-size: 10px; padding: 2px 6px; border-radius: 8px; background: var(--surface2); color: var(--text3); font-weight: 600; }
  .pulse-state.running { background: #d1fae5; color: #047857; animation: arenaPulse 1.2s infinite; }
  .pulse-state.done { background: #dcfce7; color: #15803d; }
  .pulse-state.error { background: #fee2e2; color: #b91c1c; }
  .pulse-state.cooldown { background: #ecfeff; color: #0e7490; animation: arenaPulse 1s infinite; }
  .pulse-metrics { display: flex; gap: 12px; }
  .pulse-metric { font-size: 11px; color: var(--text3); display: flex; flex-direction: column; gap: 1px; }
  .pulse-metric-val { font-size: 13px; font-weight: 700; color: var(--text); font-family: 'Geist Mono', monospace; }
  .pulse-bar-wrap { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
  .pulse-bar {
    height: 100%; border-radius: 2px; width: 0%;
    transition: width 0.4s ease;
  }
  .pulse-bar.active { animation: pulseGrow 1.5s ease-in-out infinite alternate; }
  @keyframes pulseGrow { from{opacity:0.6} to{opacity:1} }
  .marathon-stats-bar {
    display: flex; gap: 10px; padding: 5px 10px;
    font-size: 11px; color: var(--text3);
    border-top: 1px solid var(--border);
    background: var(--surface2); border-radius: 0 0 8px 8px;
  }
  .marathon-stats-bar span { display: flex; align-items: center; gap: 3px; }
  .marathon-stats-bar b { color: var(--text); font-family: 'Geist Mono', monospace; }

  /* ── ARENA STREAMS (side-by-side) ── */
  .arena-streams {
    display: grid;
    gap: 12px;
    align-items: start;
  }
  .arena-stream-col {
    display: flex; flex-direction: column; gap: 0;
    border: 1.5px solid var(--border);
    border-radius: 12px; overflow: hidden;
    background: var(--surface);
  }
  .stream-col-header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    font-size: 13px; font-weight: 700;
  }
  .stream-col-body {
    padding: 14px;
    font-size: 13px; line-height: 1.7; color: var(--text);
    min-height: 80px;
    max-height: 420px;
    overflow-y: auto;
  }
  .stream-round-divider {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text3);
    padding: 8px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
  }
  .stream-round-divider:first-child { border-top: none; margin-top: 0; padding-top: 0; }
  .stream-text { white-space: pre-wrap; }

  /* Lab metric overlay */
  .arena-metric-btn {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; padding: 2px 7px; border-radius: 6px;
    border: 1px solid var(--border); background: var(--surface2);
    color: var(--text3); cursor: pointer; font-family: inherit;
    transition: all 0.12s; margin-left: auto;
  }
  .arena-metric-btn:hover { background: var(--surface3); color: var(--text); }
  .arena-metric-overlay {
    background: var(--surface2); border-top: 1px solid var(--border);
    padding: 10px 14px; display: none; flex-wrap: wrap; gap: 14px;
    font-size: 12px;
  }
  .arena-metric-overlay.open { display: flex; }
  .amo-item { display: flex; flex-direction: column; gap: 2px; }
  .amo-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; }
  .amo-val { font-size: 13px; font-weight: 700; font-family: 'Geist Mono', monospace; color: var(--text); }

  /* Classic thread (lab mode) */
  .arena-thread { display: flex; flex-direction: column; gap: 0; }
  .arena-turn {
    display: flex; gap: 14px; padding: 18px 0;
    border-bottom: 1px solid var(--border);
    animation: arenaFadeIn 0.3s ease;
  }
  .arena-turn:last-child { border-bottom: none; }
  @keyframes arenaFadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
  .arena-turn.is-question {
    background: var(--surface2); border-radius: 12px;
    padding: 16px; margin-bottom: 8px;
    border: 1.5px solid var(--border);
  }
  .arena-turn-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0; border: 2px solid; margin-top: 2px;
  }
  .arena-turn-body { flex: 1; min-width: 0; }
  .arena-turn-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 8px; flex-wrap: wrap;
  }
  .arena-turn-name { font-weight: 700; font-size: 13px; }
  .arena-turn-round {
    font-size: 11px; padding: 2px 7px; border-radius: 10px;
    background: var(--surface2); color: var(--text3); font-weight: 600;
  }
  .arena-turn-round.is-final {
    background: linear-gradient(135deg,#fef9c3,#fde68a); color: #92400e;
    border: 1px solid #fcd34d; box-shadow: 0 1px 3px rgba(251,191,36,0.3);
  }
  .arena-turn.is-final-turn {
    background: linear-gradient(to bottom,#fffdf0,var(--surface));
    border-radius: 12px; border: 1.5px solid #fcd34d !important;
    padding: 16px; margin-top: 4px;
  }
  .arena-final-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 16px 0 8px; color: #92400e;
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  }
  .arena-final-divider::before,.arena-final-divider::after {
    content:''; flex:1; height:1px;
    background: linear-gradient(to right,transparent,#fcd34d);
  }
  .arena-final-divider::after { background: linear-gradient(to left,transparent,#fcd34d); }
  .arena-turn-content { font-size: 14px; line-height: 1.7; color: var(--text); }
  .arena-turn-content p { margin: 0 0 8px 0; }
  .arena-turn-content p:last-child { margin-bottom: 0; }
  .arena-turn-thinking { display: flex; align-items: center; gap: 8px; color: var(--text3); font-size: 13px; font-style: italic; }
  .arena-thinking-dots span {
    display: inline-block; width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; margin: 0 1px;
    animation: arenaDot 1.2s ease-in-out infinite;
  }
  .arena-thinking-dots span:nth-child(2){animation-delay:.2s}
  .arena-thinking-dots span:nth-child(3){animation-delay:.4s}
  @keyframes arenaDot{0%,80%,100%{transform:scale(.6);opacity:.4}40%{transform:scale(1);opacity:1}}
  .arena-reply-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--text3); margin-bottom: 6px;
    padding: 2px 8px; background: var(--surface2);
    border-radius: 6px; border: 1px solid var(--border);
  }

  /* Lab metric row in thread */
  .arena-turn-metrics {
    display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap;
  }
  .atm-item { display: flex; flex-direction: column; gap: 1px; }
  .atm-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text3); }
  .atm-val { font-size: 12px; font-weight: 700; font-family: 'Geist Mono', monospace; color: var(--text2); }

  /* Arena model picker modal */
  .arena-picker-modal {
    background: var(--surface);
    border-radius: 16px;
    padding: 0;
    width: 520px;
    max-width: 95vw;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
  }

  .arena-picker-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px;
  }

  .arena-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
  }
  .arena-picker-item:hover { background: var(--surface2); }
  .arena-picker-item.selected { background: var(--surface2); }
  .arena-picker-item .picker-check { margin-left: auto; color: #10b981; font-weight: 700; }

  .tester-prompt-area {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
  }

  .tester-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .tester-summary-inner {
    background: var(--surface);
    padding: 14px 16px;
    text-align: center;
  }

  .tester-stat { font-family: 'Geist Mono', monospace; font-size: 22px; font-weight: 600; }
  .tester-stat-label { font-size: 11px; color: var(--text3); margin-top: 2px; }

  .tester-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
  }

  .tester-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
  }

  .tester-card.status-ok { border-color: #86efac; }
  .tester-card.status-error { border-color: #fca5a5; }
  .tester-card.status-running { border-color: var(--border-strong); }

  .tester-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
  }

  .tester-card-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
  }

  .tester-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
  .tester-card-provider { font-size: 11px; color: var(--text3); }

  .tester-card-status {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
  }

  .tcs-waiting { background: var(--surface3); color: var(--text3); }
  .tcs-running { background: #dbeafe; color: #1d4ed8; }
  .tcs-ok { background: var(--green-bg); color: var(--green); }
  .tcs-error { background: var(--red-bg); color: var(--red); }

  .tester-card-body {
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text2);
    min-height: 60px;
    max-height: 120px;
    overflow: hidden;
    position: relative;
  }

  .tester-card-body.expandable { cursor: pointer; }
  .tester-card-body.expandable::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 32px;
    background: linear-gradient(transparent, var(--surface));
  }
  .tester-card-body.expanded { max-height: none; }
  .tester-card-body.expanded::after { display: none; }

  .tester-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
    font-size: 11px;
    color: var(--text3);
    font-family: 'Geist Mono', monospace;
  }

  /* ─── ENDPOINT PAGE ──────────────────────────────────────────── */

  .endpoint-page { padding: 32px; overflow-y: auto; }

  .ep-info-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
  }

  .ep-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .ep-info-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text3);
    margin-bottom: 4px;
  }

  .ep-info-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    color: var(--text);
  }

  .ep-info-value code {
    background: var(--surface2);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
  }

  .ep-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
  }
  .ep-copy-btn:hover { opacity: 1; }

  .ep-masked { letter-spacing: 2px; }

  .ep-status { font-size: 13px; font-weight: 600; }
  .ep-status-online { color: var(--green); }
  .ep-status-offline { color: var(--text3); }
  .ep-status-error { color: var(--red); }

  /* Sections */
  .ep-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
  }

  .ep-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
  }

  .ep-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
  }

  /* Filter row */
  .ep-filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
  }

  .ep-filter-input {
    flex: 1;
    height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
  }
  .ep-filter-input:focus { border-color: var(--accent); }

  .ep-filter-select {
    height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    outline: none;
    cursor: pointer;
  }

  /* Mappings table */
  .ep-mappings-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
  }

  .ep-mappings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }

  .ep-mappings-table thead th {
    background: var(--surface2);
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text3);
    border-bottom: 1px solid var(--border);
  }

  .ep-mappings-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
  }
  .ep-mappings-table tbody tr:last-child { border-bottom: none; }
  .ep-mappings-table tbody tr:hover { background: var(--surface2); }
  .ep-row-default { background: #faf8f0; }
  .ep-row-default:hover { background: #f5f0e0 !important; }

  .ep-mappings-table td {
    padding: 10px 14px;
    vertical-align: middle;
  }

  .ep-model-id {
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
  }

  .ep-internal-name {
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    color: var(--text2);
  }

  .ep-default-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    background: #fde68a;
    color: #92400e;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
  }

  .ep-provider-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
  }

  .ep-actions {
    display: flex;
    gap: 4px;
  }

  .ep-action-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.15s;
  }
  .ep-action-btn:hover { background: var(--surface2); border-color: var(--border); }
  .ep-action-delete:hover { background: var(--red-bg); }

  .ep-mapping-count {
    font-size: 12px;
    color: var(--text3);
    margin-top: 10px;
  }

  /* Quick test */
  .ep-test-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
  }

  .ep-test-input {
    flex: 1;
    height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    outline: none;
  }
  .ep-test-input:focus { border-color: var(--accent); }

  .ep-test-select {
    width: 200px;
    height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    color: var(--text);
    outline: none;
    cursor: pointer;
  }

  .ep-test-result {
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    transition: border-color 0.2s;
  }

  /* Dialog overlay */
  .ep-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }

  .ep-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  }

  .ep-dialog.ep-dialog-wide {
    width: 780px;
    max-width: 95vw;
  }

  .ep-dialog-columns {
    display: flex;
    gap: 20px;
  }

  .ep-picker-panel {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .ep-picker-search input {
    width: 100%;
    height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    box-sizing: border-box;
    margin-bottom: 8px;
  }
  .ep-picker-search input:focus { border-color: var(--text); }

  .ep-picker-list {
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 8px 0;
  }

  /* Reuse main modal classes inside picker */
  .ep-picker-list .modal-provider-group { margin-bottom: 8px; }
  .ep-picker-list .modal-provider-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text3);
    padding: 6px 8px 4px;
  }
  .ep-picker-list .modal-model-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
    margin: 0 4px;
  }
  .ep-picker-list .modal-model-item:hover { background: var(--surface2); }
  .ep-picker-list .modal-model-item.active { background: var(--surface3); }
  .ep-picker-list .modal-model-name { font-size: 13px; font-weight: 500; color: var(--text); }
  .ep-picker-list .modal-model-meta { font-size: 11px; color: var(--text3); font-family: 'Geist Mono', monospace; }
  .ep-picker-list .modal-free-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #15803d;
    margin-left: auto;
    flex-shrink: 0;
  }
  .ep-picker-list .tag {
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .ep-dialog-form {
    flex: 1;
    min-width: 0;
  }

  .ep-picker-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-bottom: 10px;
  }
  .ep-picker-hint-icon { font-weight: 700; font-size: 14px; }
  .ep-picker-hint .tag { padding: 1px 5px; font-size: 9px; }

  .ep-dialog-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
  }

  .ep-dialog-field {
    margin-bottom: 14px;
  }

  .ep-dialog-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 4px;
  }

  .ep-dialog-field input,
  .ep-dialog-field select {
    width: 100%;
    height: 38px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    color: var(--text);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
  }
  .ep-dialog-field input:focus,
  .ep-dialog-field select:focus { border-color: var(--accent); }

  .ep-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
  }

  .tester-use-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
  }

  .tester-use-btn:hover { background: var(--text); color: var(--accent-fg); border-color: var(--text); }

  @keyframes testerPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
  }
  .tester-loading { animation: testerPulse 1.2s ease-in-out infinite; color: var(--text3); font-style: italic; }

  /* ─── CODE BLOCKS ─── */
  .code-block {
    margin: 10px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-family: 'Geist Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 12.5px;
    background: #1a1b26;
  }

  .code-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: #13141f;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .code-lang {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7c85af;
    font-family: 'Geist Mono', monospace;
  }

  .code-lines {
    font-size: 10px;
    color: #3d4166;
    margin-right: auto;
  }

  .code-actions { display: flex; gap: 4px; }

  .code-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #7c85af;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
    white-space: nowrap;
  }
  .code-btn:hover { background: rgba(255,255,255,0.12); color: #c0caf5; border-color: rgba(255,255,255,0.2); }
  .code-btn-preview { color: #7dcfff; border-color: rgba(125,207,255,0.2); }
  .code-btn-preview:hover { background: rgba(125,207,255,0.1); color: #7dcfff; }
  .code-btn-edit { color: #e0af68; border-color: rgba(224,175,104,0.2); }
  .code-btn-edit:hover { background: rgba(224,175,104,0.1); color: #e0af68; }
  .code-btn-edit.active { background: rgba(224,175,104,0.15); color: #e0af68; border-color: rgba(224,175,104,0.4); }

  .code-editor {
    display: none;
    width: 100%;
    min-height: 120px;
    background: #1a1b26;
    color: #c0caf5;
    font-family: 'Geist Mono', 'Fira Code', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    border: none;
    outline: none;
    resize: vertical;
    padding: 14px 16px 14px 56px;
    box-sizing: border-box;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    caret-color: #7dcfff;
    border-top: 1px solid rgba(255,255,255,0.06);
  }
  .code-editor:focus { outline: none; box-shadow: inset 0 0 0 1px rgba(125,207,255,0.2); }

  .py-output {
    border-top: 1px solid rgba(255,255,255,0.06);
    background: #0f1017;
    padding: 10px 16px;
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #c0caf5;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
  }
  .py-output .py-out-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #565f89;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .py-output .out-stdout { color: #c0caf5; }
  .py-output .out-result { color: #9ece6a; }
  .py-output .out-error  { color: #f7768e; }
  .py-output .out-info   { color: #7aa2f7; font-style: italic; }

  .code-body {
    display: flex;
    overflow-x: auto;
    max-height: 480px;
    overflow-y: auto;
  }

  .code-gutter {
    display: flex;
    flex-direction: column;
    padding: 14px 10px;
    background: rgba(0,0,0,0.2);
    border-right: 1px solid rgba(255,255,255,0.04);
    text-align: right;
    min-width: 40px;
    user-select: none;
    flex-shrink: 0;
  }
  .code-gutter span {
    font-size: 11px;
    line-height: 1.6;
    color: #3d4166;
  }

  .code-pre {
    margin: 0;
    padding: 14px 16px;
    flex: 1;
    white-space: pre;
    line-height: 1.6;
    color: #c0caf5;
    background: transparent;
    overflow: visible;
  }

  /* Syntax colors - Tokyo Night palette */
  .code-pre .kw  { color: #bb9af7; font-weight: 600; }
  .code-pre .str { color: #9ece6a; }
  .code-pre .cmt { color: #565f89; font-style: italic; }
  .code-pre .num { color: #ff9e64; }
  .code-pre .cls { color: #7dcfff; }

  .inline-code {
    background: rgba(125,207,255,0.08);
    border: 1px solid rgba(125,207,255,0.15);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'Geist Mono', monospace;
    font-size: 0.88em;
    color: #7dcfff;
  }

  /* ─── HTML PREVIEW MODAL ─── */
  .preview-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 80vw;
    height: 80vh;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s, height 0.2s;
  }
  .preview-modal.fullscreen { width: 98vw; height: 96vh; }

  .preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    flex-shrink: 0;
  }

  .preview-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
  }
  .api-info-box {
    background: var(--yellow-bg);
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--yellow);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
  }
/* Google OAuth Button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
  background: var(--bg1);
  border: 1px solid var(--border);
  color: var(--text1);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-google:hover { background: var(--bg2); }

/* ─── LANDING & PROFILE PAGE CONTAINERS ──────────────── */
/* Landing page: needs scrolling, not fixed height */
.lmx-landing-page {
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100%;
}
/* Profile page: simple scrollable container */
.lmx-profile-page {
  overflow-y: auto !important;
}
.lmx-profile-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.lmx-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.lmx-profile-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.lmx-profile-name {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  margin-bottom: 4px;
}

/* ─── LANDING PAGE ─────────────────────────────────────── */
.lmx-landing {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* Hero */
.lmx-hero {
  text-align: center;
  margin-bottom: 56px;
}
.lmx-hero-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 20px;
}
.lmx-hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 16px;
}
.lmx-hero-accent {
  color: var(--accent);
}
.lmx-hero-sub {
  font-size: 16px;
  color: var(--text2);
  max-width: 540px;
  margin: 0 auto 28px;
  line-height: 1.6;
}
.lmx-hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.lmx-btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
}
.lmx-btn-primary:hover {
  opacity: 0.88;
}
.lmx-btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
}
.lmx-btn-outline:hover {
  background: var(--surface2);
}
.lmx-footer {
  text-align: center;
  margin-top: 48px;
  font-size: 12px;
  color: var(--text3);
}

/* Feature grid */
.lmx-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}
.lmx-feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s;
}
.lmx-feature-card:hover {
  border-color: var(--border-strong);
}
.lmx-feature-icon {
  font-size: 24px;
  margin-bottom: 10px;
}
.lmx-feature-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}
.lmx-feature-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
}

/* Provider list */
.lmx-providers {
  text-align: center;
  margin-bottom: 48px;
}
.lmx-providers-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 12px;
}
.lmx-providers-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.lmx-providers-list span {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
  background: var(--surface);
}

/* Auth box on landing */
.lmx-auth-box {
  max-width: 400px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
}
.lmx-auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.lmx-auth-tab {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  font-family: inherit;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.lmx-auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.lmx-auth-tab:hover:not(.active) {
  color: var(--text);
}
.lmx-auth-form .field {
  margin-bottom: 12px;
}

/* Auth Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: var(--text3);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
