:root {
    --bg: #0b1018;
    --bg2: #101722;
    --surface: rgba(255,255,255,0.04);
    --surface2: rgba(255,255,255,0.065);
    --border: rgba(148, 163, 184, 0.12);
    --border-h: rgba(94,234,212,0.32);
    --text: #e4eaf2;
    --muted: #8b9aab;
    --teal: #5eead4;
    --cyan: #22d3ee;
    --violet: #a78bfa;
    --amber: #fbbf24;
    --red: #f87171;
    --green: #34d399;
    --radius: 16px;
    --radius-sm: 10px;
    --font: 'Outfit', system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --shadow: 0 24px 80px rgba(0,0,0,0.45);
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

.hidden-section { display: none !important; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 0.85rem; letter-spacing: -0.02em; }

/* ===== LANG SWITCH ===== */
.lang-switch {
    display: inline-flex; gap: 2px; padding: 3px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: 999px;
}
.lang-switch-login {
    position: fixed; top: 14px; right: 14px; z-index: 200;
    background: rgba(12, 18, 28, 0.82); backdrop-filter: blur(12px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}
.lang-switch-side {
    width: 100%;
    justify-content: stretch;
    margin-bottom: 8px;
}
.lang-switch-side .lang-btn {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
}
.lang-btn {
    border: 0; background: transparent; color: var(--muted);
    font-family: var(--font); font-weight: 600; font-size: 0.72rem;
    letter-spacing: 0.04em; padding: 6px 11px; border-radius: 999px;
    cursor: pointer; line-height: 1;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
    background: rgba(94, 234, 212, 0.16); color: var(--teal);
}
.pg-composer.is-busy,
.pg-suggestions.is-busy {
    opacity: 0.55;
    pointer-events: none;
}
.pg-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.pg-chats-search {
    padding: 0 10px 8px;
}
.pg-chats-search input {
    width: 100%;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(148,163,184,0.12);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.78rem;
    padding: 8px 10px;
    outline: 0;
}
.pg-chats-search input:focus {
    border-color: rgba(94,234,212,0.35);
}
.pg-composer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}
.pg-action-btn {
    border: 1px solid rgba(148,163,184,0.16);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 6px 11px;
    border-radius: 999px;
    cursor: pointer;
}
.pg-action-btn:hover:not(:disabled) {
    border-color: rgba(94,234,212,0.35);
    color: var(--teal);
}
.pg-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pg-action-btn.ghost {
    background: transparent;
    color: var(--muted);
}
.pg-action-btn.hidden { display: none !important; }
#stopBtn {
    border-color: rgba(248,113,113,0.35);
    color: #fca5a5;
    background: rgba(248,113,113,0.1);
}
.pg-msg-acts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    opacity: 0;
    transition: opacity .15s ease;
}
.pg-msg:hover .pg-msg-acts,
.pg-msg:focus-within .pg-msg-acts {
    opacity: 1;
}
.pg-msg-act {
    border: 1px solid rgba(148,163,184,0.14);
    background: rgba(0,0,0,0.2);
    color: var(--muted);
    font-family: var(--font);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
}
.pg-msg-act:hover {
    color: var(--teal);
    border-color: rgba(94,234,212,0.3);
}
.pg-msg-act.ok { color: #6ee7b7; }
.pg-edit-area {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(94,234,212,0.28);
    border-radius: 12px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.92rem;
    line-height: 1.55;
    padding: 10px 12px;
    outline: 0;
}
.pg-edit-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 8px;
}
.pg-edit-hint {
    font-size: 0.7rem;
    color: var(--muted);
    margin-right: auto;
}

/* ===== BACKGROUND ===== */
.bg-mesh {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 10% -10%, rgba(34,211,238,0.12), transparent 55%),
        radial-gradient(ellipse 70% 50% at 90% 110%, rgba(167,139,250,0.1), transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(94,234,212,0.04), transparent 60%);
}
.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black, transparent);
}
.bg-glow {
    position: fixed; border-radius: 50%; filter: blur(100px); pointer-events: none; z-index: 0;
    animation: drift 22s ease-in-out infinite;
}
.g1 { width: 480px; height: 480px; background: #0d9488; opacity: 0.18; top: -12%; left: -8%; }
.g2 { width: 360px; height: 360px; background: #6366f1; opacity: 0.14; bottom: -10%; right: -5%; animation-delay: -7s; }
.g3 { width: 280px; height: 280px; background: #06b6d4; opacity: 0.1; top: 45%; left: 55%; animation-delay: -14s; }
.bg-noise {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift {
    0%, 100% { transform: translate(0,0) scale(1); }
    40% { transform: translate(40px,-30px) scale(1.08); }
    70% { transform: translate(-25px,20px) scale(0.96); }
}

/* ===== LOGIN ===== */
.screen-login {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; padding: 24px;
}
.login-orbit {
    position: absolute; width: 520px; height: 520px;
    pointer-events: none; opacity: 0.5;
}
.orbit-ring {
    position: absolute; inset: 0; margin: auto;
    border-radius: 50%;
    border: 1px solid rgba(94,234,212,0.12);
    animation: spin 40s linear infinite;
}
.orbit-ring.r1 { width: 100%; height: 100%; }
.orbit-ring.r2 { width: 72%; height: 72%; animation-direction: reverse; animation-duration: 28s; border-color: rgba(34,211,238,0.1); }
.orbit-ring.r3 { width: 44%; height: 44%; animation-duration: 18s; border-color: rgba(167,139,250,0.12); }
.orbit-ring::before {
    content: ''; position: absolute; top: -3px; left: 50%;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--teal); box-shadow: 0 0 12px var(--teal);
    transform: translateX(-50%);
}
.orbit-core {
    position: absolute; inset: 0; margin: auto;
    width: 80px; height: 80px; border-radius: 50%;
    background: radial-gradient(circle, rgba(94,234,212,0.25), transparent 70%);
    filter: blur(8px);
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-card {
    position: relative; z-index: 2;
    width: 100%; max-width: 420px;
    padding: 40px 36px 28px;
    background: linear-gradient(165deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid var(--border);
    border-radius: 24px;
    backdrop-filter: blur(28px);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
    animation: cardIn 0.7s cubic-bezier(0.16,1,0.3,1);
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: none; }
}
.login-brand { text-align: center; margin-bottom: 32px; }
.logo-mark {
    width: 56px; height: 56px; margin: 0 auto 16px;
    filter: drop-shadow(0 0 20px rgba(94,234,212,0.45));
}
.logo-mark svg { width: 100%; height: 100%; }
.logo-mark.sm { width: 36px; height: 36px; margin: 0; filter: drop-shadow(0 0 10px rgba(94,234,212,0.4)); }
.brand-name {
    font-size: 2rem; font-weight: 700; letter-spacing: 0.28em;
    background: linear-gradient(135deg, #fff 20%, var(--teal) 90%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.brand-tag {
    margin-top: 8px; font-size: 0.9rem; color: var(--muted); font-weight: 300;
    letter-spacing: 0.04em;
}

.field-label {
    display: block; font-size: 0.75rem; font-weight: 500;
    color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: 8px;
}
.input-wrap {
    position: relative; margin-bottom: 16px;
}
.input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted); display: flex;
}
.input-wrap input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrap input::placeholder { color: #3d4a5c; }
.input-wrap input:focus {
    border-color: rgba(94,234,212,0.45);
    box-shadow: 0 0 0 3px rgba(94,234,212,0.12);
}

.btn-glow {
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 20px;
    border: none; border-radius: 12px;
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: #041016; font-family: var(--font); font-weight: 600; font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(20,184,166,0.35);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.btn-glow:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 40px rgba(20,184,166,0.5);
    filter: brightness(1.05);
}
.btn-glow:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.login-footer {
    margin-top: 24px; text-align: center;
    font-size: 0.78rem; color: var(--muted);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.dot-live {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 8px var(--green);
    animation: pulse 2s ease infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.alert-error {
    margin-top: 12px; padding: 12px 14px;
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.25);
    border-radius: 10px;
    color: #fca5a5; font-size: 0.85rem;
    animation: shake 0.35s ease;
}
@keyframes shake {
    0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)}
}

/* ===== DASHBOARD ===== */
.screen-dash {
    position: relative; z-index: 1;
    display: flex; height: 100vh; width: 100%;
    overflow: hidden;
    animation: fadeIn 0.45s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sidebar {
    width: 240px; flex-shrink: 0;
    display: flex; flex-direction: column;
    background: rgba(8,12,20,0.75);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
}
.sidebar-top { padding: 22px 20px; border-bottom: 1px solid var(--border); }
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-text {
    font-weight: 700; font-size: 1rem; letter-spacing: 0.2em;
    background: linear-gradient(135deg, #fff, var(--teal));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.logo-sub { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 12px;
    color: var(--muted); text-decoration: none;
    font-size: 0.92rem; font-weight: 500;
    border: none; background: transparent; width: 100%;
    cursor: pointer; font-family: var(--font);
    transition: all 0.18s ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
    background: linear-gradient(135deg, rgba(94,234,212,0.12), rgba(34,211,238,0.06));
    color: var(--teal);
    box-shadow: inset 0 0 0 1px rgba(94,234,212,0.18);
}
.nav-item.active svg { opacity: 1; stroke: var(--teal); }
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); }
.nav-item.logout:hover { color: var(--red); background: rgba(248,113,113,0.08); }

.main-wrap {
    flex: 1; display: flex; flex-direction: column;
    min-width: 0; height: 100vh; overflow: hidden;
}

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(5,7,12,0.6);
    backdrop-filter: blur(16px);
    flex-shrink: 0;
}
.topbar-left { display: flex; flex-direction: column; gap: 2px; }
#pageTitle { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; }
.page-hint { font-size: 0.8rem; color: var(--muted); }
.balance-pill {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.pulse-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 10px var(--green);
    animation: pulse 2s ease infinite;
}
.balance-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.balance-val {
    font-family: var(--mono); font-weight: 600; font-size: 0.95rem;
    background: linear-gradient(135deg, #fff, var(--teal));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.content {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 28px 32px 48px;
}
.section { animation: rise 0.4s cubic-bezier(0.16,1,0.3,1); }
@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* stats */
.stat-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px;
}
.stat-card {
    position: relative; overflow: hidden;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-h);
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}
.stat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.stat-head span { font-size: 0.8rem; color: var(--muted); font-weight: 500; letter-spacing: 0.04em; }
.stat-ico {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.stat-ico svg { width: 18px; height: 18px; }
.accent-teal .stat-ico { background: rgba(94,234,212,0.12); color: var(--teal); }
.accent-cyan .stat-ico { background: rgba(34,211,238,0.12); color: var(--cyan); }
.accent-violet .stat-ico { background: rgba(167,139,250,0.12); color: var(--violet); }
.stat-num {
    font-size: 2rem; font-weight: 700; letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.stat-sub { margin-top: 4px; font-size: 0.8rem; color: var(--muted); }
.meter {
    margin-top: 16px; height: 4px; border-radius: 4px;
    background: rgba(255,255,255,0.06); overflow: hidden;
}
.meter-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--teal), var(--cyan), var(--violet));
    background-size: 200% 100%;
    animation: shimmer 4s ease infinite;
    transition: width 0.6s ease;
}
@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
    backdrop-filter: blur(12px);
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px;
}
.panel-head h3 { font-size: 1rem; font-weight: 600; }
.badge {
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(94,234,212,0.1); color: var(--teal);
    border: 1px solid rgba(94,234,212,0.2);
}

.steps { display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step-n {
    font-family: var(--mono); font-size: 0.8rem; font-weight: 600;
    color: var(--teal); opacity: 0.8; min-width: 28px; padding-top: 2px;
}
.step-t { font-weight: 560; font-size: 0.95rem; margin-bottom: 3px; }
.step-d { font-size: 0.85rem; color: var(--muted); }

.warn-card {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 18px 20px;
    background: rgba(251,191,36,0.05);
    border: 1px solid rgba(251,191,36,0.18);
    border-radius: var(--radius);
}
.warn-ico { color: var(--amber); flex-shrink: 0; }
.warn-ico svg { width: 22px; height: 22px; }
.warn-t { font-weight: 600; color: #fcd34d; margin-bottom: 4px; }
.warn-d { font-size: 0.88rem; color: #c4b5a0; line-height: 1.5; }

/* search highlight */
mark.hl, .hl {
    background: rgba(94, 234, 212, 0.22);
    color: #e8fff9;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: inherit;
}
.pg-chat-empty {
    padding: 24px 12px;
    text-align: center;
    color: #4a5a6c;
    font-size: 0.82rem;
}
.pg-picker { max-width: none; width: 100%; }

.pchip {
    padding: 8px 14px; border-radius: 999px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(148, 163, 184, 0.14);
    color: #8b9aab; font-family: var(--font); font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
}
.pchip:hover { color: #e2e8f0; border-color: rgba(255,255,255,0.16); background: rgba(255,255,255,0.06); }
.pchip.active {
    background: rgba(94,234,212,0.14); border-color: rgba(94,234,212,0.38); color: var(--teal);
}
body.picker-open { overflow: hidden; }
.models-count {
    font-size: 0.8rem; color: var(--muted); margin: -6px 0 12px;
    font-family: var(--mono);
}

/* legacy chat shell kept minimal if referenced */
.chat-shell { display: none; }
.chat-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    position: relative; z-index: 20;
}

/* Model picker — big centered modal */
.model-picker { position: relative; flex: 1; min-width: 0; width: 100%; max-width: none; }
.picker-backdrop {
    visibility: hidden;
    pointer-events: none;
    position: fixed; inset: 0; z-index: 400;
    background:
        radial-gradient(ellipse 70% 50% at 50% 40%, rgba(14, 40, 48, 0.55), transparent 70%),
        rgba(2, 6, 12, 0.78);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s;
}
.picker-backdrop.open {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
}
.picker-trigger {
    width: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02));
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    color: var(--text); font-family: var(--font);
    cursor: pointer; text-align: left;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s, transform 0.2s;
}
.picker-trigger:hover, .picker-trigger.open {
    border-color: rgba(94,234,212,0.42);
    box-shadow: 0 0 0 3px rgba(94,234,212,0.1), 0 8px 28px rgba(0,0,0,0.25);
    background: linear-gradient(135deg, rgba(94,234,212,0.1), rgba(34,211,238,0.04));
}
.picker-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.picker-icon {
    width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, rgba(94,234,212,0.18), rgba(34,211,238,0.06));
    color: #7dcdc0; border: 1px solid rgba(94,234,212,0.22);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 12px rgba(94,234,212,0.08);
}
.picker-icon svg { width: 20px; height: 20px; }
.picker-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.picker-name {
    font-weight: 650; font-size: 1.05rem; letter-spacing: -0.02em;
    color: #e8eef5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.picker-sub {
    font-size: 0.8rem; color: #8b9aab;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.picker-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.picker-price {
    font-family: var(--mono); font-size: 0.68rem; color: var(--muted);
    letter-spacing: -0.02em; white-space: nowrap;
}
.picker-chevron { color: var(--muted); transition: transform 0.25s cubic-bezier(0.34,1.2,0.64,1); flex-shrink: 0; width: 18px; height: 18px; }
.picker-trigger.open .picker-chevron { transform: rotate(180deg); color: var(--teal); }

/* ===== MODEL PICKER MODAL ===== */
.picker-dropdown {
    display: flex;
    visibility: hidden;
    pointer-events: none;
    position: fixed;
    z-index: 420;
    left: 50%;
    top: 50%;
    width: min(640px, calc(100vw - 24px));
    height: min(78vh, 700px);
    margin: 0;
    transform: translate(-50%, -48%) scale(0.98);
    opacity: 0;
    background: #0f141c;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    box-shadow: 0 32px 90px rgba(0,0,0,0.6);
    overflow: hidden;
    flex-direction: column;
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.22,1,0.36,1), visibility 0.18s;
}
.picker-dropdown.open {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.picker-dd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 8px;
    flex: 0 0 auto;
}
.picker-dd-title {
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #f1f5f9;
}
.picker-dd-sub {
    margin-top: 3px;
    font-size: 0.72rem;
    color: #64748b;
    font-family: var(--mono);
}
.picker-dd-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(255,255,255,0.03);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: color 0.15s, background 0.15s;
}
.picker-dd-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.07);
}
.picker-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 14px 10px;
    padding: 11px 13px;
    border-radius: 12px;
    background: #0a0e14;
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: #64748b;
    flex: 0 0 auto;
    transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.picker-search-wrap:focus-within {
    border-color: rgba(94,234,212,0.45);
    box-shadow: 0 0 0 3px rgba(94,234,212,0.1);
    color: var(--teal);
}
.picker-search-wrap svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    opacity: 0.8;
}
.picker-search-wrap input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #f1f5f9;
    font-family: var(--font);
    font-size: 0.92rem;
    caret-color: var(--teal);
}
.picker-search-wrap input::placeholder { color: #475569; }
.picker-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 12px;
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}
.picker-filters .pchip {
    padding: 6px 13px;
    font-size: 0.78rem;
    font-family: var(--font);
    border-radius: 999px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.picker-filters .pchip:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.04);
}
.picker-filters .pchip.active {
    background: rgba(94,234,212,0.12);
    border-color: rgba(94,234,212,0.4);
    color: #5eead4;
}

.picker-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148,163,184,0.28) transparent;
}
.picker-list::-webkit-scrollbar { width: 6px; }
.picker-list::-webkit-scrollbar-track { background: transparent; }
.picker-list::-webkit-scrollbar-thumb {
    background: rgba(148,163,184,0.25);
    border-radius: 99px;
}
.picker-empty {
    padding: 48px 16px;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

/* model row — 3 columns: icon | name+meta | prices+check */
.pm-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 118px 28px;
    align-items: center;
    column-gap: 12px;
    width: 100%;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    color: inherit;
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.pm-row:hover {
    background: rgba(255,255,255,0.055);
    border-color: rgba(148, 163, 184, 0.12);
}
.pm-row.active {
    background: rgba(94,234,212,0.08);
    border-color: rgba(94,234,212,0.32);
}
.pm-row:focus-visible {
    outline: 2px solid rgba(94,234,212,0.45);
    outline-offset: 1px;
}

.pm-ico {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(94,234,212,0.08);
    color: #7dcdc0;
    border: 1px solid rgba(94,234,212,0.14);
}
.pm-row.active .pm-ico {
    background: rgba(94,234,212,0.16);
    border-color: rgba(94,234,212,0.35);
    color: #5eead4;
}
.pm-ico svg { width: 17px; height: 17px; }

.pm-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}
.pm-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #f1f5f9;
    letter-spacing: -0.015em;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-row.active .pm-name { color: #fff; }
.pm-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
    line-height: 1.2;
}
.pm-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 7px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    border: 1px solid transparent;
}
.pm-chip.provider {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.28);
    color: #7dd3fc;
}
.pm-chip.ctx {
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 550;
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.22);
    color: #cbd5e1;
    letter-spacing: -0.02em;
}
.pm-chip-ico {
    font-size: 0.62rem;
    opacity: 0.75;
    color: #94a3b8;
}
.pm-row.active .pm-chip.provider {
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.36);
    color: #bae6fd;
}
.pm-row.active .pm-chip.ctx {
    background: rgba(255,255,255,0.08);
    border-color: rgba(148, 163, 184, 0.28);
    color: #e2e8f0;
}
.pm-tag {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 7px;
    line-height: 1.25;
    border: 1px solid transparent;
}
.pm-name mark, .pm-chip mark {
    background: rgba(94,234,212,0.22);
    color: #5eead4;
    border-radius: 3px;
    padding: 0 2px;
}
.pm-tag.best {
    background: rgba(94,234,212,0.14);
    color: #5eead4;
    border-color: rgba(94,234,212,0.22);
}
.pm-tag.vision {
    background: rgba(251,191,36,0.12);
    color: #e0b85c;
    border-color: rgba(251,191,36,0.2);
}
.pm-tag.code {
    background: rgba(167,139,250,0.14);
    color: #c4b5fd;
    border-color: rgba(167,139,250,0.22);
}

.pm-price-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    justify-self: stretch;
}
.pm-price-row {
    display: grid;
    grid-template-columns: 38px 1fr;
    align-items: baseline;
    column-gap: 6px;
    line-height: 1.2;
}
.pm-price-row .k {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
}
.pm-price-row .k.in { color: #5eead4; }
.pm-price-row .k.cache { color: #e0b85c; }
.pm-price-row .k.out { color: #c4b5fd; }
.pm-price-row .v {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.02em;
}
.pm-price-row .v.in { color: #9fe8dc; }
.pm-price-row .v.cache { color: #e8d08a; }
.pm-price-row .v.out { color: #d4c8ff; }

.pm-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    background: rgba(94,234,212,0.18);
    color: #5eead4;
    border: 1px solid rgba(94,234,212,0.32);
    flex-shrink: 0;
}
.pm-check.off {
    opacity: 0;
    visibility: hidden;
    border-color: transparent;
    background: transparent;
}


.picker-item { display: none !important; }

@media (max-width: 640px) {
    .picker-dropdown {
        width: calc(100vw - 12px);
        height: min(88vh, 720px);
        border-radius: 14px;
    }
    .picker-dd-head { padding: 14px 12px 6px; }
    .picker-search-wrap { margin: 2px 10px 8px; }
    .picker-filters { padding: 0 10px 10px; }
    .picker-list { padding: 6px 6px 12px; }
    .pm-row {
        grid-template-columns: 36px minmax(0, 1fr) 28px;
        column-gap: 10px;
        padding: 10px;
    }
    .pm-ico { width: 36px; height: 36px; border-radius: 10px; }
    .pm-price-col { display: none; }
}
.btn-ghost {
    display: flex; align-items: center; gap: 6px;
    background: transparent; border: none; color: var(--muted);
    font-family: var(--font); font-size: 0.85rem; cursor: pointer;
    padding: 8px 10px; border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.btn-ghost:hover { color: var(--text); background: var(--surface2); }

.chat-stream {
    flex: 1; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 14px;
    min-height: 0;
    border-top: 1px solid transparent;
}
.msg {
    max-width: 78%;
    padding: 14px 16px;
    border-radius: 14px;
    animation: rise 0.3s ease;
}
.msg-ai {
    align-self: flex-start;
    background: rgba(94,234,212,0.06);
    border: 1px solid rgba(94,234,212,0.12);
    border-bottom-left-radius: 4px;
}
.msg-user {
    align-self: flex-end;
    background: rgba(34,211,238,0.08);
    border: 1px solid rgba(34,211,238,0.15);
    border-bottom-right-radius: 4px;
}
.msg-role {
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em;
    text-transform: uppercase; margin-bottom: 6px;
}
.msg-ai .msg-role { color: var(--teal); }
.msg-user .msg-role { color: var(--cyan); }
.msg-body { font-size: 0.92rem; line-height: 1.55; color: #d1dae6; word-break: break-word; }

.typing { display: flex; gap: 4px; padding: 4px 0; }
.typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--teal); opacity: 0.6;
    animation: bounce 1.2s ease infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-5px); opacity: 1; }
}

.chat-composer {
    display: flex; gap: 10px; align-items: flex-end;
    padding: 14px 16px; border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: rgba(0,0,0,0.15);
}
.chat-composer textarea {
    flex: 1; resize: none; max-height: 120px;
    padding: 12px 14px;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text); font-family: var(--font); font-size: 0.92rem;
    outline: none; line-height: 1.4;
}
.chat-composer textarea:focus {
    border-color: rgba(94,234,212,0.4);
    box-shadow: 0 0 0 3px rgba(94,234,212,0.1);
}
.btn-send {
    width: 44px; height: 44px; flex-shrink: 0;
    border: none; border-radius: 12px;
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: #041016; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(20,184,166,0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-send:hover { transform: scale(1.04); box-shadow: 0 8px 28px rgba(20,184,166,0.45); }
.btn-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* MODELS */
.models-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px;
}
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.models-search-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; min-width: 280px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 999px;
    color: #8b9aab;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s, color 0.18s;
}
.models-search-wrap.focused,
.models-search-wrap:focus-within {
    border-color: rgba(94,234,212,0.42);
    box-shadow: 0 0 0 3px rgba(94,234,212,0.12);
    background: rgba(94,234,212,0.06);
    color: var(--teal);
}
.models-search-wrap.has-query {
    border-color: rgba(94,234,212,0.28);
}
.models-search-wrap input {
    flex: 1; background: transparent; border: none; outline: none;
    color: #e8eef5; font-family: var(--font); font-size: 0.9rem; min-width: 0;
    caret-color: var(--teal);
}
.models-search-wrap input::placeholder { color: #5a6a7c; }
.models-search-wrap input::selection {
    background: rgba(94,234,212,0.28);
    color: #fff;
}

.price-legend {
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
    margin-bottom: 16px; padding: 10px 14px;
    background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 12px;
    font-size: 0.78rem; color: var(--muted);
}
.price-legend span { display: flex; align-items: center; gap: 6px; }
.lg { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg-in { background: var(--teal); box-shadow: 0 0 8px rgba(94,234,212,0.5); }
.lg-out { background: var(--violet); box-shadow: 0 0 8px rgba(167,139,250,0.5); }
.lg-cache { background: var(--amber); box-shadow: 0 0 8px rgba(251,191,36,0.45); }
.legend-note { margin-left: auto; font-family: var(--mono); font-size: 0.7rem; opacity: 0.7; }

.chip {
    padding: 8px 16px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--muted); font-family: var(--font); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all 0.18s;
}
.chip:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.chip.active {
    background: rgba(94,234,212,0.12);
    border-color: rgba(94,234,212,0.35);
    color: var(--teal);
}
.models-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.model-card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.22s ease;
    display: flex; flex-direction: column;
}
.model-card:hover {
    border-color: rgba(94,234,212,0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(0,0,0,0.25);
}
.model-card.selected {
    border-color: rgba(94,234,212,0.5);
    background: rgba(94,234,212,0.06);
    box-shadow: 0 0 0 1px rgba(94,234,212,0.15), 0 12px 40px rgba(20,184,166,0.1);
}
.model-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.model-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.model-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(94,234,212,0.15), rgba(34,211,238,0.08));
    color: var(--teal); border: 1px solid rgba(94,234,212,0.12);
}
.model-icon.vision {
    background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(245,158,11,0.06));
    color: var(--amber); border-color: rgba(251,191,36,0.15);
}
.model-icon.bolt {
    background: linear-gradient(135deg, rgba(34,211,238,0.15), rgba(6,182,212,0.06));
    color: var(--cyan); border-color: rgba(34,211,238,0.15);
}
.model-icon.code {
    background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(139,92,246,0.06));
    color: var(--violet); border-color: rgba(167,139,250,0.15);
}
.model-icon svg { width: 20px; height: 20px; }
.model-rec {
    font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    padding: 4px 8px; border-radius: 6px;
    background: rgba(94,234,212,0.14); color: var(--teal);
    border: 1px solid rgba(94,234,212,0.2);
}
.tag {
    font-size: 0.65rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    padding: 3px 7px; border-radius: 6px;
    background: rgba(255,255,255,0.05); color: var(--muted);
    border: 1px solid rgba(255,255,255,0.06);
}
.tag-vision { background: rgba(251,191,36,0.12); color: #fbbf24; border-color: rgba(251,191,36,0.2); }
.tag-code { background: rgba(167,139,250,0.12); color: #c4b5fd; border-color: rgba(167,139,250,0.2); }
.tag-chat { background: rgba(34,211,238,0.1); color: #67e8f9; border-color: rgba(34,211,238,0.18); }
.model-name { font-weight: 650; font-size: 1.05rem; margin-bottom: 3px; letter-spacing: -0.02em; }
.model-provider { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }
.model-desc { font-size: 0.82rem; color: #8b96a8; line-height: 1.4; margin-bottom: 12px; flex: 1; }
.model-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: 0.75rem; color: #5a6578; margin-bottom: 14px;
}
.model-meta .dot { opacity: 0.4; }

.money-row {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
    margin-top: auto;
}
.money-cell {
    padding: 8px 6px; border-radius: 10px; text-align: center;
    border: 1px solid transparent;
}
.money-cell.in { background: rgba(94,234,212,0.08); border-color: rgba(94,234,212,0.12); }
.money-cell.out { background: rgba(167,139,250,0.08); border-color: rgba(167,139,250,0.12); }
.money-cell.cache { background: rgba(251,191,36,0.08); border-color: rgba(251,191,36,0.12); }
.money-k {
    display: block; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; margin-bottom: 3px; opacity: 0.75;
}
.money-cell.in .money-k { color: var(--teal); }
.money-cell.out .money-k { color: var(--violet); }
.money-cell.cache .money-k { color: var(--amber); }
.money-v {
    font-family: var(--mono); font-size: 0.82rem; font-weight: 600;
    color: var(--text); letter-spacing: -0.02em;
}
.money-unit {
    margin-top: 8px; text-align: center;
    font-size: 0.68rem; color: #4a5568; font-family: var(--mono);
}

/* SETUP */
.setup-lead {
    margin-bottom: 16px;
    color: #c5d0dc;
    font-size: 0.98rem;
    line-height: 1.55;
}
.setup-lead strong { color: #f1f5f9; font-weight: 650; }
.setup-section-title {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    margin: 8px 0 14px;
    font-weight: 700;
}
.creds-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 26px;
}
@media (max-width: 720px) {
    .creds-grid { grid-template-columns: 1fr; }
}
.cred-card {
    padding: 16px;
    background: var(--surface);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: var(--radius);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cred-card-wide { grid-column: 1 / -1; }
.cred-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}
.cred-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #cbd5e1;
    margin: 0;
    font-weight: 700;
}
.cred-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.cred-val {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
    color: #5eead4;
    word-break: break-all;
    line-height: 1.5;
    font-size: 0.95rem;
    font-weight: 500;
    background: rgba(2, 8, 16, 0.65);
    border: 1px solid rgba(94,234,212,0.22);
    border-radius: 12px;
    padding: 12px 14px;
    user-select: all;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.cred-val:hover {
    border-color: rgba(94,234,212,0.5);
    background: rgba(94,234,212,0.08);
    box-shadow: 0 0 0 1px rgba(94,234,212,0.12);
}
.cred-val.copied-flash {
    border-color: rgba(52,211,153,0.65);
    background: rgba(52,211,153,0.12);
}
.cred-bundle {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    color: #e2e8f0;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    background: rgba(2, 8, 16, 0.7);
    border: 1px solid rgba(148,163,184,0.2);
    border-radius: 12px;
    padding: 14px 16px;
    max-height: 180px;
    overflow: auto;
    user-select: all;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.cred-bundle:hover {
    border-color: rgba(94,234,212,0.4);
    background: rgba(94,234,212,0.06);
}
.cred-bundle.copied-flash {
    border-color: rgba(52,211,153,0.6);
    background: rgba(52,211,153,0.1);
}
.copy-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 10px;
    background: rgba(94,234,212,0.14);
    border: 1px solid rgba(94,234,212,0.35);
    color: #99f6e4;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    white-space: nowrap;
    line-height: 1;
}
.copy-btn svg {
    flex: 0 0 auto;
    opacity: 0.95;
}
.copy-btn:hover {
    background: rgba(94,234,212,0.26);
    border-color: rgba(94,234,212,0.6);
    color: #ccfbf1;
}
.copy-btn:active {
    transform: scale(0.97);
}
.copy-btn-solid {
    background: rgba(94,234,212,0.2);
    border-color: rgba(94,234,212,0.45);
    color: #5eead4;
    box-shadow: 0 0 0 1px rgba(94,234,212,0.08);
}
.copy-btn-solid:hover {
    background: rgba(94,234,212,0.34);
    border-color: rgba(94,234,212,0.7);
    color: #a7f3d0;
}
.copy-btn.copied {
    background: rgba(52,211,153,0.28);
    border-color: rgba(52,211,153,0.6);
    color: #6ee7b7;
}

.ide-list { display: flex; flex-direction: column; gap: 12px; }
.ide-card {
    background: var(--surface);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 14px;
    overflow: hidden;
}
.ide-head {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; background: transparent; border: none;
    color: #f1f5f9; font-family: var(--font); cursor: pointer;
    transition: background 0.15s;
    gap: 12px;
    text-align: left;
}
.ide-head:hover { background: rgba(255,255,255,0.03); }
.ide-head-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ide-head-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.ide-ico {
    width: 42px; height: 42px; border-radius: 12px;
    background: rgba(94,234,212,0.1); color: #5eead4;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.ide-ico svg { width: 20px; height: 20px; }
.ide-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #f8fafc;
    letter-spacing: -0.01em;
}
.ide-blurb {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 500;
    line-height: 1.3;
}
.ide-arrow { color: #94a3b8; transition: transform 0.25s; flex: 0 0 auto; }
.ide-arrow.open { transform: rotate(180deg); color: #5eead4; }
.ide-body {
    display: none;
    padding: 0 18px 18px;
    border-top: 1px solid rgba(148,163,184,0.14);
    background: rgba(0,0,0,0.12);
}
.ide-body.open { display: block; padding-top: 16px; }
.ide-steps {
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 16px;
}
.ide-steps li {
    font-size: 0.98rem;
    color: #e2e8f0;
    line-height: 1.5;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-weight: 500;
}
.ide-step-n {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 800;
    color: #042f2e;
    background: #5eead4;
    border: none;
    margin-top: 0;
}
.ide-step-t { flex: 1 1 auto; min-width: 0; padding-top: 2px; }

.ide-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.ide-field {
    background: rgba(2, 8, 16, 0.55);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 12px;
    padding: 12px 12px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ide-field-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ide-field-label {
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #cbd5e1;
}
.ide-field-val {
    display: block;
    width: 100%;
    text-align: left;
    margin: 0;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid rgba(94,234,212,0.28);
    background: rgba(15, 23, 42, 0.85);
    color: #5eead4;
    font-family: var(--mono);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.45;
    word-break: break-all;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.ide-field-val:hover {
    border-color: rgba(94,234,212,0.55);
    background: rgba(94,234,212,0.08);
    box-shadow: 0 0 0 1px rgba(94,234,212,0.1);
}
.ide-field-val.copied,
.ide-field-val.copied-flash {
    border-color: rgba(52,211,153,0.6);
    color: #6ee7b7;
}

.ide-snippet {
    position: relative;
    margin-top: 2px;
    background: rgba(2, 8, 16, 0.72);
    border: 1px solid rgba(148,163,184,0.2);
    border-radius: 12px;
    overflow: hidden;
}
.ide-snippet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148,163,184,0.14);
    background: rgba(255,255,255,0.03);
}
.ide-snippet-head span {
    font-size: 0.76rem;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}
.ide-snippet pre,
.ide-snippet-code {
    display: block;
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    font-family: var(--mono);
    font-size: 0.88rem;
    color: #f1f5f9;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    user-select: all;
    cursor: pointer;
    background: transparent;
    border: 0;
    text-align: left;
}
.ide-snippet-code:hover {
    background: rgba(94,234,212,0.04);
}
.ide-body code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: rgba(94,234,212,0.12);
    color: #99f6e4;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid rgba(94,234,212,0.2);
}

/* USAGE */
.usage-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.usage-list { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; }
.empty { color: var(--muted); font-size: 0.9rem; padding: 12px 0; }
.usage-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px; border-radius: 10px;
    background: rgba(0,0,0,0.25); border: 1px solid var(--border);
}
.usage-row .u-name { font-weight: 500; font-size: 0.88rem; }
.usage-row .u-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.usage-row .u-val { font-family: var(--mono); font-weight: 600; font-size: 0.9rem; text-align: right; }
.usage-row .u-meta { font-size: 0.72rem; color: var(--muted); text-align: right; }
.usage-log {
    padding: 12px 14px; border-radius: 10px;
    background: rgba(0,0,0,0.25);
    border-left: 2px solid var(--green);
}
.usage-log.err { border-left-color: var(--red); }
.usage-log .u-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.usage-log .u-status { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; }
.usage-log .u-status.ok { color: var(--green); }
.usage-log .u-status.bad { color: var(--red); }
.usage-log .u-err { font-size: 0.75rem; color: var(--red); margin-top: 4px; }

/* scrollbar */
.scroll-hide::-webkit-scrollbar { width: 5px; }
.scroll-hide::-webkit-scrollbar-track { background: transparent; }
.scroll-hide::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* responsive */
@media (max-width: 960px) {
    .stat-grid { grid-template-columns: 1fr; }
    .creds-grid, .usage-grid { grid-template-columns: 1fr; }
    .sidebar { width: 72px; }
    .nav-item span, .logo-text, .logo-sub { display: none; }
    .logo-row { justify-content: center; }
    .nav-item { justify-content: center; padding: 12px; }
    .content { padding: 20px 16px 40px; }
    .topbar { padding: 14px 16px; }
}
@media (max-width: 640px) {
    .sidebar { display: none; }
    .pg-composer-wrap { padding: 8px 10px 12px; }
    .models-search-wrap { min-width: 0; width: 100%; }
}

/* ===== PLAYGROUND — PREMIUM REDESIGN ===== */
body.pg-mode .content {
    overflow: hidden;
    padding: 10px 16px 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
body.pg-mode .topbar {
    padding: 10px 24px;
}
.pg-section {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0;
    animation: none;
}
.pg {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: 260px 1fr;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    isolation: isolate;
}
.pg::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(94, 234, 212, 0.35) 0%,
        rgba(34, 211, 238, 0.15) 25%,
        rgba(148, 163, 184, 0.08) 50%,
        rgba(167, 139, 250, 0.15) 75%,
        rgba(94, 234, 212, 0.25) 100%
    );
    background-size: 300% 300%;
    animation: borderShift 8s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
@keyframes borderShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.pg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background:
        radial-gradient(ellipse 70% 50% at 10% 15%, rgba(94, 234, 212, 0.07), transparent 55%),
        radial-gradient(ellipse 50% 40% at 90% 85%, rgba(167, 139, 250, 0.06), transparent 50%),
        radial-gradient(ellipse 40% 35% at 50% 50%, rgba(34, 211, 238, 0.03), transparent 60%),
        linear-gradient(170deg, #0f1620 0%, #0c1219 40%, #0a0f16 100%);
    pointer-events: none;
}
.pg > * { position: relative; z-index: 1; }
.pg-box-shadow {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow:
        0 32px 100px rgba(0, 0, 0, 0.55),
        0 0 80px rgba(94, 234, 212, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* chats sidebar */
.pg-chats {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid rgba(148, 163, 184, 0.08);
    background: rgba(8, 12, 18, 0.6);
    backdrop-filter: blur(24px);
}
.pg-chats-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 14px;
    flex-shrink: 0;
}
.pg-chats-head span {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6b7a8c;
}
.pg-chats-new {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: #7a8b9e;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.pg-chats-new:hover {
    color: var(--teal);
    border-color: rgba(94, 234, 212, 0.4);
    background: rgba(94, 234, 212, 0.1);
    box-shadow: 0 0 20px rgba(94, 234, 212, 0.15);
    transform: rotate(90deg) scale(1.05);
}
.pg-chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(94, 234, 212, 0.15) transparent;
}
.pg-chat-list::-webkit-scrollbar { width: 4px; }
.pg-chat-list::-webkit-scrollbar-track { background: transparent; }
.pg-chat-list::-webkit-scrollbar-thumb { background: rgba(94, 234, 212, 0.15); border-radius: 99px; }
.pg-chat-item {
    display: flex;
    align-items: stretch;
    gap: 2px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}
.pg-chat-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    border-radius: 0 2px 2px 0;
    background: transparent;
    transition: background 0.22s, box-shadow 0.22s;
}
.pg-chat-item:hover {
    background: rgba(255, 255, 255, 0.035);
}
.pg-chat-item.active {
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.08), rgba(34, 211, 238, 0.04));
    border-color: rgba(94, 234, 212, 0.2);
    box-shadow: 0 4px 20px rgba(94, 234, 212, 0.06);
}
.pg-chat-item.active::before {
    background: linear-gradient(180deg, #5eead4, #22d3ee);
    box-shadow: 0 0 10px rgba(94, 234, 212, 0.4);
}
.pg-chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 11px 10px 11px 14px;
    border: none;
    background: transparent;
    color: inherit;
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
    border-radius: 14px;
}
.pg-chat-title {
    font-size: 0.88rem;
    font-weight: 550;
    color: #c5d0dc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}
.pg-chat-item.active .pg-chat-title { color: #f0fdfa; font-weight: 600; }
.pg-chat-sub {
    font-size: 0.72rem;
    color: #556272;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pg-chat-del {
    width: 32px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #4a5a6c;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    opacity: 0;
    transition: all 0.2s ease;
}
.pg-chat-item:hover .pg-chat-del,
.pg-chat-item.active .pg-chat-del { opacity: 1; }
.pg-chat-del:hover {
    color: var(--red);
    background: rgba(248, 113, 113, 0.1);
}

.pg-workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: rgba(6, 10, 16, 0.25);
}

/* top bar */
.pg-top {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.07);
    background: rgba(12, 18, 26, 0.6);
    backdrop-filter: blur(24px);
}
.pg-top-left {
    flex: 1;
    min-width: 0;
    max-width: 480px;
    position: relative;
}
.pg-prices {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}
.pg-price-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.1);
    font-size: 0.78rem;
    transition: all 0.2s ease;
}
.pg-price-pill:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(148, 163, 184, 0.18);
}
.pg-price-pill span {
    color: #6b7a8c;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: 0.72rem;
}
.pg-price-pill b {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.8rem;
    color: #d4e0ec;
}
.pg-price-pill.cache b { color: #f5d78e; }
.pg-price-pill.out b { color: #c4b5fd; }

.pg-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: transparent;
    position: relative;
}
.pg-main::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 50% 30% at 50% 0%, rgba(94, 234, 212, 0.03), transparent 70%);
    z-index: 0;
}
.pg-main > * { position: relative; z-index: 1; }

.pg-stream {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 28px 32px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(94, 234, 212, 0.12) transparent;
}
.pg-stream::-webkit-scrollbar { width: 5px; }
.pg-stream::-webkit-scrollbar-track { background: transparent; }
.pg-stream::-webkit-scrollbar-thumb { background: rgba(94, 234, 212, 0.12); border-radius: 99px; }

/* empty state */
.pg-empty {
    margin: auto;
    text-align: center;
    max-width: 540px;
    padding: 48px 28px;
    animation: emptyIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes emptyIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: none; }
}
.pg-empty-orb {
    width: 120px;
    height: 120px;
    margin: 0 auto 32px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pg-empty-orb::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(94, 234, 212, 0.3),
        rgba(34, 211, 238, 0.15),
        rgba(167, 139, 250, 0.2),
        rgba(94, 234, 212, 0.1),
        rgba(94, 234, 212, 0.3)
    );
    animation: orbSpin 6s linear infinite;
    filter: blur(12px);
    opacity: 0.6;
}
@keyframes orbSpin {
    to { transform: rotate(360deg); }
}
.pg-empty-orb::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #1a2535, #0c1219);
    border: 1px solid rgba(94, 234, 212, 0.15);
}
.pg-empty-mark {
    width: 48px;
    height: 48px;
    position: relative;
    z-index: 2;
    color: #5eead4;
    filter: drop-shadow(0 0 16px rgba(94, 234, 212, 0.5));
    animation: float 5s ease-in-out infinite;
}
.pg-empty-mark svg { width: 100%; height: 100%; }
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.pg-empty h3 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 10%, #a8d8d0 50%, var(--teal) 90%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.pg-empty p {
    color: #6b7a8c;
    font-size: 0.95rem;
    margin-bottom: 32px;
    line-height: 1.6;
}
.pg-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.pg-sug {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(148, 163, 184, 0.1);
    color: #a0adb8;
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}
.pg-sug::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.08), rgba(34, 211, 238, 0.04));
    opacity: 0;
    transition: opacity 0.25s;
}
.pg-sug-ico {
    color: var(--teal);
    font-size: 0.95rem;
    opacity: 0.8;
    position: relative;
    z-index: 1;
}
.pg-sug:hover {
    border-color: rgba(94, 234, 212, 0.35);
    color: #e8f4f2;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(94, 234, 212, 0.1), 0 0 0 1px rgba(94, 234, 212, 0.08);
}
.pg-sug:hover::before { opacity: 1; }
.pg-sug span { position: relative; z-index: 1; }

/* messages */
.pg-msg {
    display: flex;
    gap: 14px;
    max-width: 820px;
    width: 100%;
    animation: msgIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.pg-user { align-self: flex-end; flex-direction: row-reverse; }
.pg-ai { align-self: flex-start; }
@keyframes msgIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.pg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pg-avatar svg {
    width: 20px;
    height: 20px;
}
.pg-ai .pg-avatar {
    background: linear-gradient(145deg, rgba(94, 234, 212, 0.15), rgba(34, 211, 238, 0.06));
    color: #5eead4;
    border: 1px solid rgba(94, 234, 212, 0.2);
    box-shadow: 0 0 16px rgba(94, 234, 212, 0.12);
}
.pg-user .pg-avatar {
    background: linear-gradient(145deg, rgba(167, 139, 250, 0.15), rgba(139, 92, 246, 0.06));
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.2);
    box-shadow: 0 0 16px rgba(167, 139, 250, 0.12);
}

.pg-bubble {
    padding: 16px 20px;
    border-radius: 20px;
    max-width: 100%;
    position: relative;
}
.pg-ai .pg-bubble {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-top-left-radius: 6px;
    backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}
.pg-user .pg-bubble {
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.1), rgba(34, 211, 238, 0.06));
    border: 1px solid rgba(94, 234, 212, 0.15);
    border-top-right-radius: 6px;
    box-shadow: 0 4px 20px rgba(94, 234, 212, 0.06);
}
.pg-role {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.pg-ai .pg-role { color: #5eead4; opacity: 0.7; }
.pg-user .pg-role { color: #9ec9c4; opacity: 0.7; }
.pg-bubble .msg-body {
    font-size: 0.96rem;
    line-height: 1.75;
    color: #dce4ec;
    white-space: pre-wrap;
    word-break: break-word;
}

/* streaming cursor */
.pg-bubble .msg-body.streaming::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--teal);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s step-end infinite;
    box-shadow: 0 0 8px rgba(94, 234, 212, 0.6);
}
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* token counter during streaming */
.pg-stream-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(94, 234, 212, 0.06);
    border: 1px solid rgba(94, 234, 212, 0.1);
    font-family: var(--mono);
    font-size: 0.68rem;
    color: #5eead4;
    margin-top: 8px;
    opacity: 0.8;
}
.pg-stream-counter svg {
    width: 12px;
    height: 12px;
    animation: spin 2s linear infinite;
}

.pg-err { margin: 0 22px 8px; flex-shrink: 0; }

/* composer */
.pg-composer-wrap {
    padding: 12px 20px 16px;
    flex-shrink: 0;
    position: relative;
}
.pg-composer-wrap::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, transparent, rgba(8, 12, 18, 0.5));
    pointer-events: none;
}
.pg-composer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 10px 10px 18px;
    background: rgba(16, 22, 32, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 18px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    backdrop-filter: blur(20px);
}
.pg-composer:focus-within {
    border-color: rgba(94, 234, 212, 0.35);
    box-shadow:
        0 0 0 3px rgba(94, 234, 212, 0.06),
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 0 40px rgba(94, 234, 212, 0.04);
    background: rgba(16, 22, 32, 0.95);
}
.pg-composer textarea {
    flex: 1;
    resize: none;
    max-height: 140px;
    min-height: 26px;
    padding: 12px 0;
    border: none;
    outline: none;
    background: transparent;
    color: #eef2f7;
    font-family: var(--font);
    font-size: 0.96rem;
    line-height: 1.55;
    caret-color: var(--teal);
}
.pg-composer textarea::placeholder { color: #4a5a6c; }
.pg-send {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: none;
    flex-shrink: 0;
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: #041016;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(20, 184, 166, 0.3);
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}
.pg-send::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}
.pg-send svg {
    width: 18px;
    height: 18px;
    position: relative;
    z-index: 1;
}
.pg-send:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 28px rgba(20, 184, 166, 0.45);
}
.pg-send:hover::before { opacity: 1; }
.pg-send:active { transform: translateY(0) scale(0.98); }
.pg-send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.pg-composer-hint {
    text-align: center;
    margin-top: 8px;
    font-size: 0.68rem;
    color: #3d4a5c;
    letter-spacing: 0.03em;
}

/* typing indicator */
.typing {
    display: flex;
    gap: 5px;
    padding: 6px 0;
    align-items: center;
}
.typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--teal);
    opacity: 0.5;
    animation: bounce 1.4s ease infinite;
    box-shadow: 0 0 6px rgba(94, 234, 212, 0.3);
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

/* code blocks */
.code-block {
    margin: 14px 0;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}
.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.code-lang {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6b7a8c;
}
.copy-code-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #8b9aab;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.copy-code-btn:hover {
    background: rgba(94, 234, 212, 0.12);
    color: #5eead4;
    border-color: rgba(94, 234, 212, 0.2);
}
.copy-code-btn svg {
    width: 12px;
    height: 12px;
}
.code-block pre {
    padding: 16px 18px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.84rem;
    line-height: 1.7;
    color: #c8d8e8;
    background: transparent;
    margin: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(94, 234, 212, 0.1) transparent;
}
.code-block pre::-webkit-scrollbar { height: 4px; }
.code-block pre::-webkit-scrollbar-track { background: transparent; }
.code-block pre::-webkit-scrollbar-thumb { background: rgba(94, 234, 212, 0.1); border-radius: 99px; }
.code-block code {
    font-family: var(--mono);
    font-size: 0.84rem;
    color: #c8d8e8;
}
.pg-bubble .msg-body code {
    background: rgba(94, 234, 212, 0.08);
    color: #7dcdc0;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.86em;
    border: 1px solid rgba(94, 234, 212, 0.12);
}
.pg-bubble .msg-body pre {
    margin: 12px 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.08);
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.84rem;
    line-height: 1.65;
    color: #c8d8e8;
}

/* strong & emphasis in messages */
.pg-bubble .msg-body strong {
    color: #f0f4f8;
    font-weight: 650;
}
.pg-bubble .msg-body em {
    color: #a8d8d0;
    font-style: italic;
}

@media (max-width: 1100px) {
    .pg { grid-template-columns: 220px 1fr; }
    .pg-prices { display: none; }
}
@media (max-width: 960px) {
    .pg { grid-template-columns: 1fr; }
    .pg-chats {
        max-height: 140px;
        border-right: none;
        border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    }
    .pg-chat-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 6px; padding: 0 10px 10px; }
    .pg-chat-item { min-width: 170px; flex-shrink: 0; }
    .pg-top-left { max-width: none; }
    .pg-stream { padding: 18px 16px 12px; }
    .pg-msg { max-width: 100%; }
    .pg-empty-orb { width: 90px; height: 90px; }
    .pg-empty h3 { font-size: 1.35rem; }
}
@media (max-width: 640px) {
    .pg-stream { padding: 14px 12px 8px; gap: 14px; }
    .pg-composer-wrap { padding: 8px 12px 12px; }
    .pg-bubble { padding: 14px 16px; border-radius: 16px; }
    .pg-empty { padding: 28px 16px; }
    .pg-suggestions { gap: 8px; }
    .pg-sug { padding: 10px 14px; font-size: 0.82rem; }
}
