/* Judge app stylesheet on the Art of Evals house tokens.
   Token values match docs/eval-diagrams/diagrams.css. */

/* Variable fonts (wght axis); one file per family covers every weight in use. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(./fonts/Inter-latin.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(./fonts/JetBrainsMono-latin.woff2) format('woff2'); }

:root {
  color-scheme: light;
  --paper: #faf9f5;
  --panel-fill: #f0eee6;
  --card: #ffffff;
  --card-bd: #e7e3d8;
  --hair: #e3ded2;
  --ink: #16140f;
  --ink2: #20242a;
  --label: #2a2722;
  --muted: #73726c;
  --muted2: #8f8e88;
  --mint-fill: #e9f6f2;
  --mint-bd: #cfe9df;
  --mint-node: #aee6d3;
  --mint-stroke: #7cc3a8;
  --green: #1aaf7d;
  --green-fill: #e3f6ee;
  --green-deep: #106a59;
  --coral: #e0876a;
  --coral-soft: #f2cdbe;
  --clay: #e86134;
  --blue: #2b83da;
  --blue-fill: #b6daeb;
  --blue-deep: #1d558e;
  --orange: #f9a72a;
  --peach: #f9dfb8;
  --pink: #e15f8b;
  --pink-fill: #f6dbe5;
  --reject-deep: #a33358;
  --discuss-tint: #fdf6f2;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-feature-settings: "liga" 0, "calt" 0; }

/* ---------- shells ---------- */

.auth-shell,
.page-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 16px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.admin-shell { width: min(100%, 1380px); }
.judge-shell { padding: 12px 16px 96px; } /* bottom space for the vote bar */

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
}

.topbar-title { min-width: 0; }

.topbar h1,
.auth-panel h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.4px;
  line-height: 1.15;
  color: var(--ink);
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--green-deep);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.judge-name {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

/* ---------- panels, buttons, forms ---------- */

.panel {
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 9px;
  padding: 16px;
}

.auth-panel { width: min(100%, 400px); }

.stack { display: grid; gap: 14px; margin-top: 20px; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 6px;
}

textarea { min-height: 100px; resize: vertical; }

.pw-field { position: relative; display: grid; }
.pw-field input { padding-right: 46px; }
/* hide the browser-native reveal control so it doesn't double the custom eye */
.pw-field input::-ms-reveal,
.pw-field input::-ms-clear { display: none; }
.pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 100%;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
}
.pw-toggle:hover { background: transparent; color: var(--ink); }
.pw-toggle svg { width: 20px; height: 20px; }

button {
  min-height: 46px;
  padding: 10px 14px;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 7px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: var(--ink2); }
button:disabled { cursor: not-allowed; opacity: 0.55; }

button, input, select, textarea, a, summary { outline-offset: 3px; }

button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(43, 131, 218, 0.4);
}

.text-button, .ghost-button {
  color: var(--label);
  background: var(--card);
  border: 1px solid var(--card-bd);
  font-weight: 600;
}

.text-button:hover, .ghost-button:hover {
  color: var(--ink);
  background: var(--panel-fill);
}

.text-button { min-height: 38px; white-space: nowrap; font-size: 0.85rem; }
.ghost-button { min-height: 40px; }
.compact-button { min-height: 36px; padding: 7px 12px; font-size: 0.85rem; }

.text-link {
  min-height: 0;
  padding: 6px 0;
  color: var(--muted);
  background: none;
  border: 0;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-link:hover { color: var(--ink); background: none; }
.text-link.next-link { color: var(--green-deep); font-weight: 600; }

.empty-state {
  padding: 16px;
  color: var(--muted);
  background: var(--paper);
  border: 1px dashed var(--hair);
  border-radius: 8px;
  font-size: 0.9rem;
}

.error-area {
  min-height: 22px;
  padding: 8px 10px;
  color: var(--reject-deep);
  background: var(--pink-fill);
  border: 1px solid #ecc7d4;
  border-radius: 6px;
  font-size: 0.88rem;
}

/* ---------- queue ---------- */

.queue-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.queue-heading h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.2px; }

.status-line {
  margin-top: 3px;
  color: var(--muted2);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.counter-grid {
  display: flex;
  margin: 12px 0 4px;
}

.counter-item {
  flex: 1;
  min-width: 0;
  padding: 2px 0 2px 12px;
  border-left: 1px solid var(--hair);
  background: none;
  border-top: 0; border-right: 0; border-bottom: 0;
  border-radius: 0;
}

.counter-item:first-child { border-left: 0; padding-left: 0; }

.counter-label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.counter-item strong {
  display: block;
  margin-top: 2px;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.queue-controls { display: grid; gap: 10px; margin: 10px 0 12px; }

.segmented-tabs {
  display: flex;
  gap: 18px;
  padding: 0;
  background: none;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
}

.tab-button {
  min-width: 0;
  min-height: 0;
  padding: 6px 0 9px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 0;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
}

.tab-button:hover { color: var(--ink); background: none; }

.tab-button.is-active {
  color: var(--ink);
  font-weight: 600;
  background: none;
  box-shadow: inset 0 -2px 0 var(--ink);
}

.tab-count {
  margin-left: 4px;
  color: var(--green-deep);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 132px);
  gap: 8px;
  align-items: end;
}

.search-field, .sort-field, .comment-field { gap: 5px; font-size: 0.78rem; }

.submission-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.submission-card {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 7px;
  padding: 13px 14px;
  color: var(--ink);
  text-align: left;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 9px;
  font-weight: 400;
}

.submission-card:hover { background: var(--card); border-color: var(--mint-stroke); }

.card-topline, .card-footer, .card-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.card-topline { justify-content: space-between; align-items: flex-start; }

.card-topline strong {
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.card-title {
  display: block;
  color: var(--muted2);
  font-family: var(--mono);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.card-meta { flex-wrap: wrap; color: var(--muted); font-size: 0.76rem; }
.card-meta strong { color: var(--label); font-weight: 600; }

.card-footer {
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--hair);
  color: var(--muted);
  font-size: 0.76rem;
}

.card-footer > span:first-child { color: var(--clay); font-weight: 600; }
.card-footer > span:last-child { color: var(--muted2); font-family: var(--mono); font-size: 0.68rem; }

/* status pills: mono outline, ink color per state */
.status-badge, .status-pill {
  flex: 0 0 auto;
  max-width: 46%;
  padding: 3px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid currentColor;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  line-height: 1.4;
}

.status-pill { max-width: none; min-height: 0; }
.status-submitted { color: var(--muted); background: transparent; }
.status-under_review { color: var(--blue-deep); background: transparent; }
.status-majority_reached, .status-admin_resolved { color: var(--green-deep); background: transparent; }
.status-admin_resolved { background: var(--mint-fill); border-color: var(--mint-stroke); }
.status-needs_discussion { color: var(--clay); background: transparent; }

/* ---------- detail ---------- */

.detail-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-header { padding: 2px 0 12px; border-bottom: 1px solid var(--hair); }

.detail-header .eyebrow { margin-bottom: 5px; }

.detail-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.35px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-subtitle { margin-top: 4px; color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }

.glance {
  margin: 12px 0 0;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 9px;
  padding: 13px 14px;
}

.glance-label {
  margin-bottom: 7px;
  color: var(--muted2);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.glance-agent { font-size: 0.85rem; line-height: 1.45; color: var(--label); overflow-wrap: anywhere; }
.glance-agent strong { color: var(--ink); font-weight: 600; }

.glance-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.chip {
  color: var(--label);
  background: var(--panel-fill);
  border-radius: 5px;
  padding: 3px 7px;
  font-family: var(--mono);
  font-size: 0.64rem;
}

.glance-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--hair);
  color: var(--muted);
  font-size: 0.76rem;
}

.glance-foot b { color: var(--ink); font-weight: 600; }
.grader-code { color: var(--blue-deep); font-weight: 600; }
.grader-model { color: var(--pink); font-weight: 600; }

.saved-state {
  margin-top: 10px;
  padding: 12px 14px;
  color: var(--green-deep);
  background: var(--mint-fill);
  border: 1px solid var(--mint-bd);
  border-radius: 9px;
}

.saved-state h3 { margin: 0 0 4px; font-size: 0.9rem; font-weight: 600; }
.saved-state p { margin: 0; font-size: 0.82rem; line-height: 1.4; }

.usecase-context {
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 9px;
  padding: 0 14px;
}

.usecase-context summary {
  cursor: pointer;
  padding: 11px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.usecase-context p { margin: 0 0 10px; font-size: 0.82rem; line-height: 1.55; color: var(--label); }
.usecase-meta { color: var(--muted); font-size: 0.76rem; }

.detail-sec {
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 9px;
}

.detail-sec > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
}

.detail-sec > summary::-webkit-details-marker { display: none; }
.detail-sec > summary h3 { font-size: 0.85rem; font-weight: 600; letter-spacing: -0.1px; }

.sec-note { color: var(--muted2); font-size: 0.72rem; white-space: nowrap; }
.detail-sec[open] > summary { border-bottom: 1px solid var(--hair); }
.sec-body { padding: 12px 14px; }

.recipe-grid { display: grid; gap: 10px; }
.recipe-row { display: grid; gap: 3px; }
.recipe-row strong {
  color: var(--muted2);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 500;
}
.recipe-row span { font-size: 0.85rem; line-height: 1.5; color: var(--label); overflow-wrap: anywhere; }

.agent-id { font-size: 0.85rem; line-height: 1.45; color: var(--label); overflow-wrap: anywhere; }
.agent-id strong { color: var(--ink); }
.agent-tools { margin-top: 8px; font-size: 0.8rem; color: var(--label); overflow-wrap: anywhere; }
.agent-tools strong { color: var(--muted); font-weight: 600; }

.detail-list { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; }
.detail-list dt {
  color: var(--muted2);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.detail-list dd { margin: 0 0 6px; font-size: 0.85rem; line-height: 1.5; color: var(--label); overflow-wrap: anywhere; }

.task-list { display: grid; gap: 9px; }

.task-detail { background: var(--card); border: 1px solid var(--hair); border-radius: 8px; }

.task-detail summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
}

.task-detail summary span { color: var(--muted2); font-family: var(--mono); font-size: 0.66rem; }
.task-detail summary strong { min-width: 0; font-size: 0.85rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.task-detail .detail-list { padding: 0 12px 12px; }

.task-gr {
  display: inline-flex;
  align-items: center;
  margin: 0 12px 12px;
  padding: 2.5px 7px;
  border: 1.5px solid currentColor;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  line-height: 1.4;
}

.task-gr.gr-code { color: var(--blue-deep); }
.task-gr.gr-model { color: var(--pink); }

.detail-section { padding: 14px 0; }
.detail-section h3 { margin: 0 0 8px; font-size: 0.95rem; font-weight: 600; }
.detail-section p { line-height: 1.5; overflow-wrap: anywhere; }

.aggregate-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.aggregate-grid div {
  min-width: 0;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 8px;
}

.aggregate-grid span { display: block; color: var(--muted); font-size: 0.72rem; }
.aggregate-grid strong { display: block; margin-top: 4px; font-size: 1.25rem; font-weight: 600; }
.aggregate-message, .vote-count { margin-top: 8px; color: var(--muted); font-size: 0.82rem; }

.detail-bottom-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0 4px; }
.detail-bottom-actions .ghost-button { flex: 1 1 140px; }

/* ---------- vote bar + sheet (D1) ---------- */

.vote-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--card-bd);
  box-shadow: 0 -8px 24px rgba(22, 20, 15, 0.08);
}

.vote-bar-status { color: var(--muted); font-size: 0.8rem; }
.vote-bar-status b { color: var(--ink); font-weight: 600; }

.vote-bar-button { min-height: 42px; padding: 9px 18px; font-size: 0.88rem; white-space: nowrap; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(22, 20, 15, 0.35);
  border: 0;
}

.vote-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  width: min(100%, 760px);
  margin: 0 auto;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 14px 14px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(22, 20, 15, 0.3);
}

.sheet-grab {
  display: block;
  width: 44px;
  min-height: 18px;
  margin: 0 auto 8px;
  padding: 0;
  background: none;
  border: 0;
  position: relative;
}

.sheet-grab::after {
  content: "";
  position: absolute;
  left: 4px; right: 4px; top: 7px;
  height: 4px;
  border-radius: 2px;
  background: var(--hair);
}

.vote-sheet h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 10px; }

.vote-form { display: grid; gap: 10px; }
.score-grid { display: grid; gap: 0; }

/* fieldset cannot be a flex container reliably (long-standing browser bug);
   float the legend and right-align the options instead */
.score-control { min-width: 0; margin: 0; padding: 8px 0; border: 0; border-bottom: 1px solid var(--hair); }
.score-control legend { float: left; margin: 0; padding: 6px 0 0; color: var(--label); font-size: 0.82rem; font-weight: 500; }
.score-options { display: flex; gap: 5px; justify-content: flex-end; }

.score-option { position: relative; display: block; }

.score-option input { position: absolute; inset: 0; width: 100%; min-height: 0; opacity: 0; margin: 0; }

.score-option span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--muted2);
  background: var(--card);
  border: 1.5px solid var(--card-bd);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.74rem;
}

.score-option input:checked + span {
  color: var(--green-deep);
  background: var(--mint-node);
  border-color: var(--mint-stroke);
  font-weight: 600;
}

.score-option input:focus-visible + span { outline: 3px solid rgba(43, 131, 218, 0.4); outline-offset: 2px; }

.verdict-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }

.verdict-button {
  min-width: 0;
  min-height: 42px;
  color: var(--muted);
  background: var(--card);
  border: 1.5px solid var(--card-bd);
  font-size: 0.85rem;
  white-space: normal;
}

.verdict-button:hover { color: var(--ink); background: var(--panel-fill); }
.verdict-advance.is-selected { color: var(--green-deep); background: var(--mint-fill); border-color: var(--mint-stroke); }
.verdict-discuss.is-selected { color: #9c3c1d; background: var(--coral-soft); border-color: var(--coral); }
.verdict-reject.is-selected { color: var(--reject-deep); background: var(--pink-fill); border-color: var(--pink); }

.form-error, .locked-note { margin: 0; color: var(--reject-deep); font-size: 0.85rem; font-weight: 500; }

.vote-actions { display: flex; }
.primary-button { width: 100%; }

/* ---------- admin (E1 mission desk) ---------- */

.admin-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.admin-toolbar h2 { font-size: 1.05rem; font-weight: 600; }
.admin-actions, .resolution-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.admin-export-link {
  display: inline-grid;
  min-height: 36px;
  align-items: center;
  padding: 7px 12px;
  text-decoration: none;
  font-size: 0.85rem;
}

.admin-summary-grid { display: flex; flex-wrap: wrap; margin-bottom: 16px; }
.admin-summary-grid .counter-item { flex: 0 1 auto; padding-right: 18px; }
.counter-item.tot-needs_discussion strong { color: var(--clay); }
.counter-item.tot-majority_reached strong, .counter-item.tot-admin_resolved strong { color: var(--green-deep); }
.counter-item.tot-under_review strong { color: var(--blue-deep); }

.admin-grid { display: grid; gap: 14px; align-items: start; }
.desk-main { display: grid; gap: 14px; min-width: 0; }
.desk-rail { display: grid; gap: 14px; align-content: start; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 { font-size: 0.95rem; font-weight: 600; }

.admin-case-list, .coverage-list { display: grid; gap: 10px; }

.admin-case {
  display: grid;
  gap: 12px;
  padding: 13px 14px;
  background: var(--discuss-tint);
  border: 1px solid var(--coral-soft);
  border-radius: 9px;
}

.admin-case-main { display: grid; min-width: 0; gap: 9px; }

.admin-case-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.admin-case-header h3 { margin: 2px 0 0; font-size: 0.92rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }

.admin-contact { color: var(--muted); font-size: 0.76rem; margin: 2px 0 0; }
.admin-biography { font-size: 0.82rem; color: var(--label); margin: 6px 0 0; line-height: 1.5; }

.admin-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.admin-meta strong { color: var(--label); font-weight: 600; }

.admin-vote-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.admin-vote-counts div {
  min-width: 0;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 8px;
}

.admin-vote-counts span, .coverage-row span, .vote-chip small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.admin-vote-counts strong { display: block; margin-top: 3px; font-size: 1.1rem; font-weight: 600; line-height: 1; }

.vote-chip-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }

.vote-chip {
  min-width: 0;
  padding: 9px 11px;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 8px;
}

.vote-chip strong, .vote-chip span { display: block; overflow-wrap: anywhere; }
.vote-chip strong { font-size: 0.82rem; font-weight: 600; }
.vote-chip span { margin-top: 2px; color: var(--green-deep); font-size: 0.78rem; font-weight: 600; }
.vote-chip small { margin-top: 4px; line-height: 1.35; }
.vote-chip p { margin: 6px 0 0; font-size: 0.8rem; line-height: 1.45; color: var(--label); overflow-wrap: anywhere; font-style: italic; }

.resolution-form { display: grid; gap: 10px; align-content: start; }
.resolution-confirm { display: grid; gap: 8px; }
.resolution-actions button { flex: 1 1 110px; }

.resolve-advance { color: var(--green-deep); background: var(--mint-fill); border: 1.5px solid var(--mint-stroke); }
.resolve-advance:hover { color: var(--paper); background: var(--green-deep); }
.resolve-reject { color: var(--reject-deep); background: var(--pink-fill); border: 1.5px solid #dba8bc; }
.resolve-reject:hover { color: var(--paper); background: var(--reject-deep); }

.resolution-summary { margin: 6px 0 0; color: var(--green-deep); font-size: 0.82rem; font-weight: 600; overflow-wrap: anywhere; }
.compact-empty { padding: 10px; }

/* admin submissions table */
.admin-table { width: 100%; border-collapse: collapse; }

.admin-table th {
  padding: 4px 10px 8px;
  border-bottom: 1px solid var(--hair);
  color: var(--muted2);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 1.1px;
  text-align: left;
  text-transform: uppercase;
}

.admin-table td { padding: 10px; border-bottom: 1px solid var(--hair); vertical-align: middle; font-size: 0.82rem; color: var(--label); }
.admin-table tbody tr:last-child td { border-bottom: 0; }

.sub-row { cursor: pointer; }
.sub-row:hover td { background: var(--paper); }
.sub-row.is-discussion td { background: var(--discuss-tint); }

.admin-table .uc { display: block; font-weight: 600; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.admin-table .team { display: block; margin-top: 2px; color: var(--muted2); font-family: var(--mono); font-size: 0.66rem; overflow-wrap: anywhere; }
.admin-table .num { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

.vmini { display: inline-flex; gap: 4px; font-family: var(--mono); font-size: 0.72rem; }
.vmini .va { color: var(--green-deep); }
.vmini .vd { color: var(--clay); }
.vmini .vr { color: var(--reject-deep); }

.sub-expand td { background: var(--paper); padding: 12px 10px; }

/* coverage + verdict mix rail */
.coverage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 8px;
}

.coverage-row strong { display: block; font-size: 0.85rem; font-weight: 600; overflow-wrap: anywhere; }
.coverage-count { text-align: right; }
.coverage-count strong { font-size: 1rem; font-family: var(--mono); font-weight: 500; }

.coverage-meter { grid-column: 1 / -1; height: 5px; overflow: hidden; background: var(--panel-fill); border-radius: 3px; }
.coverage-meter span { display: block; height: 100%; background: var(--mint-stroke); }

.mix-discuss .coverage-meter span { background: var(--coral); }
.mix-reject .coverage-meter span { background: var(--pink); }

/* ---------- responsive ---------- */

@media (min-width: 900px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .admin-case { grid-template-columns: minmax(0, 1fr) minmax(240px, 0.34fr); align-items: start; }
  .admin-case-main:only-child { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .auth-shell, .page-shell { padding-right: 12px; padding-left: 12px; }
  .topbar { padding: 14px 12px; }
  .filter-row { grid-template-columns: minmax(0, 1fr); }
  .status-badge { max-width: 50%; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-actions > *:first-child { grid-column: 1 / -1; }
  .admin-case-header { align-items: stretch; flex-direction: column; }
}

/* ---------- admin console controls (E2) ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.control-panel { margin-bottom: 16px; }
.control { display: flex; align-items: center; justify-content: space-between; gap: 18px 22px; flex-wrap: wrap; }
.control-left { display: flex; align-items: center; gap: 20px; flex: 1 1 320px; min-width: 0; flex-wrap: wrap; }
.control-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clock { display: grid; gap: 5px; }
.clock-num { font-family: var(--mono); font-size: 2.25rem; font-weight: 500; letter-spacing: -1.4px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.clock-num.life-paused { color: var(--clay); }
.clock-num.life-ended, .clock-num.life-setup { color: var(--muted2); }
.life { display: grid; gap: 8px; }
.life-pill { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; padding: 4px 10px; border: 1.5px solid currentColor; border-radius: 7px; font-family: var(--mono); font-size: 0.63rem; font-weight: 500; letter-spacing: 0.6px; text-transform: uppercase; }
.life-pill.life-setup { color: var(--blue-deep); } .life-pill.life-running { color: var(--green-deep); }
.life-pill.life-paused { color: var(--clay); } .life-pill.life-ended { color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.dot.live { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.subwin { display: flex; align-items: center; gap: 7px; font-size: 0.77rem; color: var(--muted); }
.subwin.open { color: var(--green-deep); }
.dur { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.82rem; }
.dur input { width: 50px; min-height: 42px; text-align: center; font-family: var(--mono); padding: 8px; }
.btn-danger { color: var(--reject-deep); background: var(--card); border: 1.5px solid #dba8bc; }
.btn-danger:hover { color: var(--paper); background: var(--reject-deep); }
.btn-go { background: var(--green-deep); } .btn-go:hover { background: #0c5446; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 11px 14px; background: var(--discuss-tint); border: 1px dashed var(--coral-soft); border-radius: 9px; }
.danger-zone p { font-size: 0.77rem; color: var(--muted); flex: 1 1 220px; }
.danger-zone strong { color: var(--label); }
.teams-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.teams-head h2 { font-size: 1.05rem; font-weight: 600; }
.auto-label { font-size: 0.82rem; color: var(--muted); }
.auto-n { width: 54px; min-height: 38px; text-align: center; font-family: var(--mono); padding: 6px; }
.chip-s { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1.5px solid currentColor; border-radius: 7px; font-family: var(--mono); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; white-space: nowrap; }
.chip-s.s-sub { color: var(--green-deep); } .chip-s.s-in { color: var(--blue-deep); }
.chip-s.s-none { color: var(--muted2); } .chip-s.s-off { color: var(--reject-deep); }
.dotc { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.admin-table td.acts { white-space: nowrap; text-align: right; }
.admin-table td.r { text-align: right; white-space: nowrap; }
.rowact { min-height: 0; padding: 5px 9px; font-size: 0.75rem; color: var(--muted); background: none; border: 1px solid var(--card-bd); border-radius: 6px; font-weight: 600; }
.rowact:hover { color: var(--ink); background: var(--panel-fill); }
.rowact.danger { color: var(--reject-deep); border-color: #e6c6d2; }
.medal { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid currentColor; font-family: var(--mono); font-size: 0.7rem; font-weight: 600; }
.medal.m1 { color: #9a6a00; background: var(--peach); border-color: var(--orange); }
.medal.m2 { color: var(--muted); background: var(--panel-fill); border-color: var(--card-bd); }
.medal.m3 { color: #9c3c1d; background: var(--coral-soft); border-color: var(--coral); }
.rk { font-family: var(--mono); color: var(--muted2); font-size: 0.8rem; }
tr.win td { background: #fcf7ec; }
.scorebig { font-family: var(--mono); font-size: 1rem; font-weight: 600; color: var(--ink); }
.ovr { min-height: 34px; padding: 4px 8px; font-size: 0.78rem; width: auto; min-width: 74px; }
.reveal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(22, 20, 15, 0.35); }
.reveal-card { width: min(100%, 440px); }
.reveal-card .eyebrow { color: var(--green-deep); }
.reveal-card h2 { font-size: 1.15rem; font-weight: 600; margin-top: 4px; }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 10px; padding: 14px 16px; background: var(--card); border: 1.5px dashed var(--mint-stroke); border-radius: 10px; }
.code-box .code { font-family: var(--mono); font-size: 1.4rem; font-weight: 500; letter-spacing: 1px; color: var(--ink); }
.reveal-note { font-size: 0.8rem; line-height: 1.5; color: var(--muted); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.modal-foot span { font-size: 0.78rem; color: var(--muted); }

.admin-participants { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.admin-participant {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  color: var(--label);
  background: var(--panel-fill);
  border: 1px solid var(--card-bd);
  border-radius: 7px;
  font-size: 0.78rem;
}
.admin-participant.is-lead { color: var(--green-deep); background: var(--mint-fill); border-color: var(--mint-stroke); }
.admin-participant .lead-tag {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
