/* Card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm); padding: 18px; }
.card.pad-lg { padding: 24px; }
.card h3 { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* KPI */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font-family: var(--font-sans); font-size: 2rem; font-weight: 600; line-height: 1.1; margin-top: 4px; }
.kpi .value.keep { color: var(--keep); }
.kpi .value.reject { color: var(--reject); }
.kpi .value.pending { color: var(--pending); }
.kpi .foot { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: var(--r-sm);
  font: inherit; font-weight: 500; font-size: 0.9rem; transition: all .12s ease; }
.btn:hover { border-color: var(--ink-soft); background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.keep { background: var(--keep); border-color: var(--keep); color: #fff; }
.btn.reject { background: var(--reject); border-color: var(--reject); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 0.84rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 5px; font-weight: 500; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 72px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge.keep { background: var(--keep-soft); color: var(--keep); }
.badge.reject { background: var(--reject-soft); color: var(--reject); }
.badge.undecided { background: var(--undecided-soft); color: var(--undecided); }
.badge.pending_review { background: var(--pending-soft); color: var(--pending); }
.badge.reviewed { background: var(--accent-soft); color: var(--accent-ink); }
.badge.solved { background: var(--keep-soft); color: var(--keep); }
.badge.failed { background: var(--reject-soft); color: var(--reject); }
.badge.error { background: var(--reject-soft); color: var(--reject); }
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.pill-status { font-size: 0.78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pill-status.completed { background: var(--keep-soft); color: var(--keep); }
.pill-status.running { background: var(--pending-soft); color: var(--pending); }
.pill-status.pending { background: var(--undecided-soft); color: var(--undecided); }
.pill-status.failed { background: var(--reject-soft); color: var(--reject); }

/* Provider chip */
.prov { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.85rem; }
.prov::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--p-mock); }
.prov.claude::before { background: var(--p-claude); }
.prov.openai::before { background: var(--p-openai); }
.prov.gemini::before { background: var(--p-gemini); }
.prov.together::before { background: var(--p-together); }
.prov.mock::before { background: var(--p-mock); }

/* Table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; min-width: 560px; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table .clickable { cursor: pointer; }

/* Progress */
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,19,26,0.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; padding: 22px; }

/* Toast */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--ink); color: #fff; padding: 11px 15px; border-radius: var(--r); box-shadow: var(--shadow-lg);
  font-size: 0.9rem; max-width: 360px; animation: toast-in .18s ease; }
.toast.error { background: var(--reject); }
.toast.success { background: var(--keep); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Dropzone */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r); padding: 32px; text-align: center;
  color: var(--muted); cursor: pointer; transition: all .12s ease; background: var(--surface-2); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

/* Model toggle selector (Playground) */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.model-toggle { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); cursor: pointer; transition: all .12s ease; background: var(--surface); user-select: none; }
.model-toggle:hover { border-color: var(--ink-soft); background: var(--surface-2); }
.model-toggle.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.model-toggle input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); cursor: pointer; }
.model-toggle .prov { font-size: 0.92rem; }
.model-toggle .mode { margin-left: auto; }

/* Field hint */
label.field small { display: block; color: var(--muted); margin-top: 5px; font-size: 0.8rem; }

/* Reasoning step list */
.steps { margin: 0; padding-left: 18px; }
.steps li { margin: 3px 0; }
.answer-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }

/* Bilingual reasoning: English question translation + English reasoning block */
.xlate-q { margin: 4px 0 0; font-style: italic; color: var(--ink-soft, var(--muted)); }
.reasoning-en { border-left: 2px solid var(--line); padding-left: 10px; }
.reasoning-en .steps li { color: var(--muted); }

/* Review history (who confirmed/overrode the judge) */
.review-log { list-style: none; margin: 0; padding: 0; }
.review-log-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.review-log-item:last-child { border-bottom: none; }

/* Notifications bell + inbox */
.bell { position: relative; text-decoration: none; font-size: 1.05rem; padding: 4px 6px;
  border-radius: 8px; line-height: 1; }
.bell.active, .bell:hover { background: var(--surface-2); }
.bell-badge { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--reject); color: #fff; border-radius: 999px; font-size: 10px; line-height: 16px;
  text-align: center; font-weight: 700; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { border-left: 3px solid var(--accent); }

/* Empty / loading states */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
