:root { --bg: #0f111a; --surface: #1e2130; --primary: #3b82f6; --success: #10b981; --danger: #ef4444; --text: #f8fafc; --muted: #94a3b8; --border: #334155; }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

body { background: var(--bg); color: var(--text); overflow-y: auto; overflow-x: hidden; -webkit-font-smoothing: antialiased; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.wrapper { display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: 20px; }

.container { width: 100%; max-width: 450px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 30px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); margin: auto; }
.admin-container { max-width: 1100px; margin: 20px auto; padding: 30px; }
.chat-container { max-width: 1200px; height: 92vh; margin: auto; }

h2 { text-align: center; color: #fff; font-weight: 600; font-size: 20px; }
h3 { color: #fff; font-size: 16px; }

input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 12px 14px; border-radius: 8px; margin-bottom: 8px; outline: none; font-size: 14px; transition: border-color 0.2s; }
input:focus { border-color: var(--primary); }

button { width: 100%; background: var(--primary); color: #fff; border: none; padding: 12px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: opacity 0.2s; font-size: 14px; }
button:hover { opacity: 0.9; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.danger { background: var(--danger); }
button.success { background: var(--success); }
button.small { padding: 6px 12px; width: auto; font-size: 12px; }

/* Model Pills & Web Toggle */
.model-selector-bar { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.selector-row { display: flex; justify-content: space-between; align-items: center; }
.selector-title { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; letter-spacing: 0.5px; }

.web-toggle-checkbox { display: none; }
.web-toggle-btn { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; transition: 0.2s; user-select: none; }
.web-toggle-checkbox:checked + .web-toggle-btn { background: #0284c7; border-color: #38bdf8; color: #fff; }

.pills-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.model-pill-checkbox { display: none; }
.model-pill-label { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 6px 12px; border-radius: 20px; font-size: 12px; cursor: pointer; user-select: none; transition: 0.2s; display: flex; align-items: center; gap: 6px; }
.model-pill-checkbox:checked + .model-pill-label { background: rgba(59, 130, 246, 0.15); border-color: var(--primary); color: #fff; font-weight: 600; }

/* Arena Chat Box */
.chat-box { flex: 1; overflow-y: auto; background: var(--bg); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 16px; border: 1px solid var(--border); min-height: 200px; }
.input-row { display: flex; gap: 10px; }
.input-row input { margin: 0; flex: 1; }
.input-row button { margin: 0; width: 90px; }

.prompt-bubble-row { display: flex; justify-content: flex-end; width: 100%; }
.user-prompt-bubble { background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 16px; border-bottom-right-radius: 4px; max-width: 80%; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

/* Side by Side Grid */
.arena-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; width: 100%; }
.arena-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.arena-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.arena-model-name { font-weight: 700; font-size: 13px; color: #fff; }
.arena-latency { font-size: 11px; color: var(--muted); font-family: monospace; }
.arena-content { font-size: 14px; line-height: 1.5; color: var(--text); flex: 1; white-space: pre-wrap; word-break: break-word; }
.arena-footer { display: flex; justify-content: space-between; align-items: center; font-size: 11px; background: var(--bg); padding: 6px 10px; border-radius: 6px; font-family: monospace; }
.arena-cost { color: var(--success); font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg); border: 1px solid var(--border); padding: 18px; border-radius: 8px; }
.stat-card .label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; font-weight: 600; }
.stat-card .value { display: block; font-size: 24px; font-weight: bold; color: var(--primary); }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.btn-refresh { background: var(--bg); border: 1px solid var(--border); width: auto; padding: 8px 16px; font-size: 13px; }
.exit-row { display: flex; justify-content: flex-end; margin-top: 24px; }
.btn-exit { width: auto; min-width: 200px; }

.table-wrapper { overflow-x: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; min-width: 800px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { background: rgba(30, 33, 48, 0.7); color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }

.limit-inputs { display: flex; gap: 6px; align-items: center; }
.limit-inputs input { width: 85px; padding: 6px 8px; font-size: 12px; margin: 0; font-family: monospace; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.link { color: var(--primary); cursor: pointer; font-weight: 500; transition: 0.2s; }
.link:hover { text-decoration: underline; color: #fff; }
.info-bar { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); background: var(--bg); padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.highlight { color: var(--primary); font-weight: bold; }

.toast { position: fixed; top: 20px; right: 20px; background: var(--surface); color: #fff; border-left: 4px solid var(--primary); padding: 14px 18px; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); z-index: 1000; animation: slideIn 0.3s forwards; font-weight: 500; font-size: 14px; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

@media (max-width: 600px) {
    .container { padding: 16px; border-radius: 0; border: none; }
    .wrapper { padding: 0; }
    .admin-container { padding: 12px; }
    .arena-grid { grid-template-columns: 1fr; }
}

/* Intent Engine UI */
.intent-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.3s all;
    opacity: 0;
    transform: translateY(5px);
}
.intent-badge.visible {
    opacity: 1;
    transform: translateY(0);
}
.intent-badge.web-glow {
    border-color: #38bdf8;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}
.intent-container {
    display: flex;
    justify-content: space-between;
    padding: 0 10px 10px 10px;
    align-items: center;
}
