/* Voctiv LLM Judge — tema gelap konsisten */
:root {
  --bg: #0f1420;
  --surface: #161d2e;
  --surface-2: #1d2740;
  --border: #28324a;
  --text: #e2e8f0;
  --text-muted: #8b93a7;
  --accent: #3b82f6;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #d97706;
  font-family: system-ui, "Segoe UI", sans-serif;
  border-radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}
.logo {
  width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; color: #fff;
}
.brand-name { font-weight: 700; }
.brand-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
  display: block; padding: 9px 12px; border-radius: 8px; color: var(--text-muted);
  font-weight: 500;
}
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { background: var(--surface-2); color: var(--accent); }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-meta { display: flex; flex-direction: column; gap: 2px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 18px; font-weight: 650; }
.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* Kartu */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px; margin-bottom: 18px;
}
.card-title { font-weight: 650; margin-bottom: 12px; font-size: 15px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px;
}
.stat-value { font-size: 26px; font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-value.warn { color: var(--warn); }

/* Tombol */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #2f6fe0; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(220, 38, 38, 0.12); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* Form */
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--accent); }
.input::placeholder { color: var(--text-muted); }
textarea.input { resize: vertical; min-height: 70px; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Tabel */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--text-muted); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.table th.no-sort { cursor: default; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:hover td { background: rgba(59, 130, 246, 0.04); }
.table tr.expanded td { background: rgba(59, 130, 246, 0.08); }
.mono { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* Badge */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px;
  font-weight: 600; background: var(--surface-2); color: var(--text-muted);
}
.badge.ok, .badge.completed, .badge.match { background: rgba(22, 163, 74, 0.15); color: var(--success); }
.badge.running, .badge.queued { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge.paused, .badge.warn { background: rgba(217, 119, 6, 0.15); color: var(--warn); }
.badge.failed, .badge.error, .badge.mismatch, .badge.api_error, .badge.parse_error { background: rgba(220, 38, 38, 0.15); color: var(--danger); }
.badge.viewer { background: rgba(139, 147, 167, 0.15); }
.badge.analyst { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge.superadmin { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }

/* Progress bar */
.progress-bar { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; height: 8px; overflow: hidden; min-width: 110px; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.4s; }
.progress-fill.done { background: var(--success); }
.progress-fill.warn { background: var(--warn); }
.progress-fill.err { background: var(--danger); }
.conf-bar { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; height: 6px; overflow: hidden; min-width: 70px; display: inline-block; vertical-align: middle; }
.conf-fill { height: 100%; background: var(--accent); display: block; }

/* Toolbar tabel */
.table-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.table-toolbar .input { width: auto; min-width: 200px; }
.table-toolbar select.input { width: auto; }
.spacer { flex: 1; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; justify-content: flex-end; }
.pager .info { color: var(--text-muted); font-size: 12px; margin-right: auto; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 8, 15, 0.72); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 60px 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  width: 100%; max-width: 560px; padding: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 8px; min-width: 260px; max-width: 420px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); animation: slide-in 0.25s ease;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast .toast-title { font-weight: 650; margin-bottom: 2px; }
.toast .toast-msg { color: var(--text-muted); font-size: 12px; word-break: break-word; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Login */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 34px; width: 380px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .logo { width: 46px; height: 46px; font-size: 22px; }
.login-title { font-size: 18px; font-weight: 700; }
.login-sub { color: var(--text-muted); font-size: 12px; }
.login-error { color: var(--danger); font-size: 12px; margin: 10px 0; min-height: 16px; }

/* Tab */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  padding: 9px 16px; cursor: pointer; color: var(--text-muted); font-weight: 600; font-size: 13px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Chart */
.chart-box { width: 100%; min-height: 240px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.uplot-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px; margin-top: 10px; }

/* Expand detail */
.detail-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 6px 0 14px 0;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-grid .full { grid-column: 1 / -1; }
.kv { margin-bottom: 8px; }
.kv .k { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.kv .v { font-size: 13px; }
.transcript-box {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  font-size: 12.5px; white-space: pre-wrap; max-height: 260px; overflow-y: auto; line-height: 1.55;
  font-family: ui-monospace, "Cascadia Code", monospace;
}
.cx-dim { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.cx-dim:last-child { border-bottom: none; }
.cx-dim .dim-name { width: 190px; font-size: 12px; font-weight: 600; }
.cx-dim .dim-score { width: 44px; text-align: center; font-weight: 700; font-size: 13px; }
.cx-dim .dim-bar { flex: 1; }
.cx-dim .dim-evidence { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; width: 100%; }

/* Upload dropzone */
.dropzone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 26px; text-align: center;
  color: var(--text-muted); cursor: pointer; transition: border-color 0.2s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); color: var(--text); }
.dropzone .dz-icon { font-size: 26px; margin-bottom: 6px; }
.preview-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 11.5px; }
.preview-table th { padding: 5px 8px; color: var(--text-muted); border-bottom: 1px solid var(--border); text-align: left; }
.preview-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Slider */
input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider-val { font-weight: 700; color: var(--accent); }

/* misc */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }
.empty-state .es-icon { font-size: 30px; margin-bottom: 8px; }
.spin {
  display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
code.inline { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 11.5px; }
.footer-note { color: var(--text-muted); font-size: 11px; margin-top: 18px; text-align: center; }
