*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
:root {
  --bg: #09090b;
  --surface: #18181b;
  --border: #27272a;
  --accent: #10b981;
  --accent-dim: #065f46;
  --text: #fafafa;
  --muted: #71717a;
  --subtle: #a1a1aa;
  --red: #ef4444;
  --green: #10b981;
  --yellow: #f59e0b;
  --code-bg: #1e1e2e;
  --radius: 8px;
  --radius-lg: 12px;
  --font:
    -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "Fira Code", "JetBrains Mono", monospace;
}
html,
body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* LOGIN */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 0%,
    rgba(16, 185, 129, 0.06) 0%,
    transparent 60%
  );
  pointer-events: none;
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 1;
}
.login-brand {
  text-align: center;
  margin-bottom: 32px;
}
.login-brand h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.login-brand h1 span {
  color: var(--accent);
}
.login-brand p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.form-group input::placeholder {
  color: var(--muted);
}
.login-btn {
  width: 100%;
  padding: 11px 0;
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}
.login-btn:hover {
  background: #0d9668;
}
.login-btn:active {
  transform: scale(0.98);
}
.login-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 12px;
  text-align: center;
  min-height: 18px;
}

/* APP LAYOUT */
.app-wrap {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.sidebar-brand h2 span {
  color: var(--accent);
}
.sidebar-brand p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* MODEL SELECTOR */
.model-section {
  padding: 16px 16px 12px;
}
.model-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.model-selector {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2310b981'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.model-selector:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.model-selector option {
  background: var(--surface);
  color: var(--text);
  padding: 8px;
}
.model-meta {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.model-meta .meta-desc {
  color: var(--subtle);
  font-weight: 500;
}
.model-meta .meta-price {
  color: var(--muted);
}

/* SIDEBAR NAV */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.nav-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--subtle);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s;
}
.nav-item:hover {
  background: var(--bg);
}
.nav-item.active {
  background: var(--bg);
  color: var(--text);
}
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.logout-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.logout-btn:hover {
  opacity: 1;
  color: var(--red);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header h3 {
  font-size: 14px;
  font-weight: 600;
}
.chat-header .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* MESSAGES */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.messages-area::-webkit-scrollbar {
  width: 6px;
}
.messages-area::-webkit-scrollbar-track {
  background: transparent;
}
.messages-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 16px;
}
.welcome-state h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.welcome-state p {
  color: var(--muted);
  font-size: 14px;
  max-width: 400px;
}
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.chip {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--subtle);
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.msg {
  max-width: 720px;
  animation: msgIn 0.25s ease;
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.msg.user {
  align-self: flex-end;
}
.msg.assistant {
  align-self: flex-start;
}
.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user .msg-bubble {
  background: #1f2937;
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.msg.assistant .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-bottom-left-radius: 4px;
}
.msg-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--code-bg);
  border-radius: 12px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}
.metric-pill .metric-label {
  color: var(--subtle);
}
.streaming-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s infinite;
  margin-left: 4px;
  vertical-align: middle;
}

/* INPUT */
.input-area {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}
.input-row {
  display: flex;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}
.input-row textarea {
  flex: 1;
  resize: none;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  min-height: 44px;
  max-height: 160px;
  transition: border-color 0.2s;
}
.input-row textarea:focus {
  border-color: var(--accent);
}
.input-row textarea::placeholder {
  color: var(--muted);
}
.send-btn {
  padding: 0 18px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.send-btn:hover {
  background: #0d9668;
}
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* EVALUATION TAB */
.eval-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}
.eval-wrap h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}
.eval-wrap .eval-desc {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}
.eval-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.eval-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.eval-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--subtle);
}
.eval-table tr:hover td {
  background: rgba(16, 185, 129, 0.03);
}
.eval-table .model-name {
  color: var(--text);
  font-weight: 500;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.badge-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--green);
}
.badge-yellow {
  background: rgba(245, 158, 11, 0.12);
  color: var(--yellow);
}
.badge-red {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
}
.eval-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.eval-run-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}
.eval-run-btn:hover {
  background: #0d9668;
}
.eval-run-btn:active {
  transform: scale(0.97);
}
.eval-run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.eval-status {
  font-size: 12px;
  color: var(--muted);
}
.eval-progress {
  margin-bottom: 20px;
}
.eval-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.eval-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.eval-progress-text {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.eval-timestamp {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
}
.eval-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.eval-summary-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.eval-summary-card .card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.eval-summary-card .card-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.eval-summary-card .card-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.eval-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.eval-detail-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.eval-detail-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--subtle);
}
.eval-detail-table tr:hover td {
  background: rgba(16, 185, 129, 0.03);
}
.eval-detail-table .model-name {
  color: var(--text);
  font-weight: 500;
}
.eval-detail-table .winner-row td {
  background: rgba(16, 185, 129, 0.06);
}
.eval-detail-table .winner-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
}
.eval-query-section {
  margin-top: 24px;
}
.eval-query-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}
.eval-query-toggle {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s;
}
.eval-query-toggle:hover {
  background: var(--bg);
}
.eval-query-toggle .toggle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.eval-query-toggle .toggle-prompt {
  font-size: 12px;
  color: var(--subtle);
  font-weight: 500;
}
.eval-query-toggle .toggle-arrow {
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s;
}
.eval-query-toggle.open .toggle-arrow {
  transform: rotate(180deg);
}
.eval-query-detail {
  display: none;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: -9px;
  margin-bottom: 8px;
}
.eval-query-detail.open {
  display: block;
}
.eval-query-detail table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.eval-query-detail th {
  text-align: left;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.eval-query-detail td {
  padding: 6px 10px;
  color: var(--subtle);
  border-top: 1px solid var(--border);
}
.eval-note {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* EVAL PROGRESS LOG (TERMINAL) */
.eval-progress-log {
  margin-bottom: 24px;
}
.eval-progress-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.eval-progress-bar-v2 {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.eval-progress-fill-v2 {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}
.eval-progress-step {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}
.eval-log-body {
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  max-height: 400px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
}
.eval-log-body::-webkit-scrollbar {
  width: 6px;
}
.eval-log-body::-webkit-scrollbar-track {
  background: transparent;
}
.eval-log-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.eval-log-line {
  color: #a1a1aa;
  white-space: pre-wrap;
  word-break: break-word;
}
.eval-log-line.log-success {
  color: #10b981;
}
.eval-log-line.log-pending {
  color: #f59e0b;
  animation: logPulse 1.5s ease-in-out infinite;
}
.eval-log-line.log-error {
  color: #ef4444;
}
.eval-log-line.log-header {
  color: #e4e4e7;
  font-weight: 500;
}
.eval-log-animate {
  animation: logSlideIn 0.2s ease-out;
}
@keyframes logSlideIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes logPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* SCORE BADGES */
.score-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
}
.score-green {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.score-yellow {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.score-red {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.score-na {
  color: var(--muted);
  font-size: 11px;
}

/* EVAL WINNER CARD HIGHLIGHT */
.eval-card-winner {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.04);
}

/* EVAL RESPONSE PREVIEWS */
.eval-responses-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.eval-response-block {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.eval-response-model {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.eval-response-text {
  font-size: 12px;
  color: var(--subtle);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.eval-response-expand {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}
.eval-response-expand:hover {
  text-decoration: underline;
}

/* EVAL RE-RUN LINK */
.eval-rerun-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}
.eval-rerun-link:hover {
  text-decoration: underline;
}

/* HIDDEN */
.hidden {
  display: none !important;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: left 0.2s;
  }
  .sidebar.open {
    left: 0;
  }
  .mobile-toggle {
    display: block;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 50;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
  }
  .messages-area {
    padding: 16px;
  }
  .input-area {
    padding: 12px 16px;
  }
}
@media (min-width: 769px) {
  .mobile-toggle {
    display: none;
  }
}

/* Export button */
.eval-export{margin-top:20px;text-align:center}
.eval-export-btn{background:#10b981;color:#fff;border:none;padding:12px 24px;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;transition:all .15s}
.eval-export-btn:hover{background:#059669;transform:translateY(-1px)}
