/* ADMIN: request history (local, no auth yet) */
.admin-page { background: var(--background); color: var(--ink); font-family: var(--font-body); }
.admin-tag { margin-left: 6px; padding: 2px 7px; border-radius: 6px; background: #fff3e0; color: #a3560c; font-family: var(--font-body); font-size: 11px; font-weight: 700; vertical-align: middle; }
.admin-page .nav-actions { display: flex; gap: 8px; }
.admin-main { width: min(100% - 32px, 1440px); margin: 18px auto 40px; }
.admin-warning { display: flex; gap: 8px; align-items: center; margin: 0 0 14px; padding: 10px 14px; border: 1px solid #f3d9b1; border-radius: 10px; background: #fffaf2; color: #8a5a12; font-size: 12.5px; }
.admin-warning svg { flex: 0 0 auto; width: 18px; height: 18px; }
.admin-warning code { font-size: 12px; }

.admin-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.admin-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-chip { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 12px; color: var(--muted); }
.stat-chip strong { color: var(--navy); }
.admin-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-filters input[type="search"], .admin-filters select { min-height: 36px; padding: 0 10px; border: 1px solid #dfe8ec; border-radius: 9px; background: #fff; font: 13px var(--font-body); color: var(--ink); }
.admin-filters input[type="search"] { width: 260px; }
.auto-refresh { display: flex; gap: 5px; align-items: center; font-size: 12.5px; color: var(--muted); }

.admin-layout { display: grid; grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 16px; align-items: start; }
.admin-list, .admin-detail { border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--soft-shadow); }
.admin-list { position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow: auto; }
.admin-list-head { position: sticky; top: 0; z-index: 1; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; color: var(--navy); font: 700 14px var(--font-display); }
.admin-list-head span { color: var(--muted); font: 500 12px var(--font-body); }
.request-list { display: grid; }
.request-row { display: grid; gap: 4px; padding: 11px 14px; border: 0; border-bottom: 1px solid #edf1f3; background: #fff; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.request-row:hover { background: color-mix(in srgb, var(--teal) 3.3%, #fefefe); }
.request-row.is-selected { background: color-mix(in srgb, var(--teal) 8.3%, #fefefe); box-shadow: inset 3px 0 0 var(--teal); }
.row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.row-text { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.row-bottom { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

.badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.b-majority, .b-user_selected, .b-ok { background: #e3f4ee; color: #0f5c40; }
.b-clarification_required, .b-needs_user_choice, .b-warn { background: #fff3e0; color: #a3560c; }
.b-none, .b-muted { background: #eef2f5; color: #5d7184; }
.b-bad { background: #fde8e7; color: #9b241b; }
.b-src { background: #edf2fb; color: #2d4f86; }
.b-emergency { background: #fde8e7; color: #9b241b; }

.admin-detail { padding: 18px 20px; min-height: 400px; }
.empty-detail { display: grid; place-items: center; gap: 8px; min-height: 360px; color: var(--muted); text-align: center; }
.empty-detail svg { width: 28px; height: 28px; }
.detail-head h2 { margin: 0 0 4px; color: var(--navy); font: 800 20px var(--font-display); }
.detail-head .ids { color: var(--muted); font-size: 12px; }
.detail-head .ids code { font-size: 12px; }
.detail-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid #edf1f3; }
.detail-section h3 { display: flex; gap: 7px; align-items: center; margin: 0 0 10px; color: var(--navy); font: 700 14.5px var(--font-display); }
.detail-section h3 .badge { font-family: var(--font-body); }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 5px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.patient-text { margin: 0; padding: 10px 12px; border-radius: 9px; background: #f6f9fb; font: 13px/1.55 var(--font-body); white-space: pre-wrap; }
.muted { color: var(--muted); font-size: 12.5px; }

.timeline { display: grid; gap: 4px; }
.tl-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; font-size: 12px; }
.tl-bar { position: relative; height: 12px; border-radius: 4px; background: #eef2f5; }
.tl-bar span { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--teal); }
.tl-bar span.llm { background: #6a5acd; }
.tl-ms { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 3px 8px; border: 1px solid #d5e6ef; border-radius: 999px; background: #f6fbff; font-size: 12px; }
.chip.dropped { border-color: #f3c9c5; background: #fff6f5; text-decoration: line-through; color: #9b241b; }

.votes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vote-card { padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.vote-card.agrees { border-color: color-mix(in srgb, var(--teal) 33.5%, #e8e8e8); background: #f4fbf9; }
.vote-card h4 { margin: 0 0 2px; font: 700 13px var(--font-display); color: var(--navy); }
.vote-card .method { color: var(--muted); font-size: 11.5px; }
.vote-top1 { margin: 8px 0 6px; font-weight: 700; font-size: 14px; }
.vote-card ol { margin: 0 0 6px; padding-left: 18px; font-size: 12px; }
.vote-card .note { color: #a3560c; font-size: 11.5px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td { padding: 5px 7px; border-bottom: 1px solid #edf1f3; text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }

.llm-card { margin-bottom: 10px; padding: 12px; border: 1px solid #ddd8f7; border-radius: 11px; background: #fbfaff; }
.llm-metrics { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.llm-metrics .chip { background: #fff; border-color: #ddd8f7; }
pre.code { max-height: 280px; margin: 6px 0 0; overflow: auto; padding: 10px; border-radius: 8px; background: #0f2233; color: #e6eef5; font: 11.5px/1.5 Consolas, "Courier New", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
details > summary { cursor: pointer; color: var(--teal-dark); font-size: 12.5px; font-weight: 600; }

.served { padding: 12px; border: 1px solid color-mix(in srgb, var(--teal) 16.5%, #f5f5f5); border-radius: 11px; background: color-mix(in srgb, var(--teal) 5%, #ffffff); }
.served .label { margin: 0 0 4px; color: var(--navy); font: 800 16px var(--font-display); }
.hospital-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

@media (max-width: 980px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-list { position: static; max-height: 360px; }
  .votes-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}

/* Step 2 ranking */
/* Step 1 algorithms */
.s1-algos { display: grid; gap: 14px; }
.s1-stage { border: 1.5px solid #dfe8ec; border-left-width: 5px; border-radius: 10px; padding: 12px 14px; background: #fff; }
.s1-llm { border-left-color: #7c6bd6; }
.s1-ml { border-left-color: #3f86d4; }
.s1-code { border-left-color: #3f9a65; }
.s1-stage-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; font-size: 15px; color: var(--navy); }
.s1-num { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 6px; border-radius: 6px; background: #eef3f6; font-weight: 800; font-size: 12.5px; }
.s1-kind { margin-left: auto; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }
.s1-kind-llm { background: #efeafe; color: #5a49b8; }
.s1-kind-ml { background: #e6f1fd; color: #2c6aad; }
.s1-kind-code { background: #e7f5ec; color: #2d7a4e; }
.s1-io { margin: 8px 0; }
.s1-io-label { margin: 10px 0 4px; font-size: 12.5px; font-weight: 700; color: #4f5d6b; }
.s1-steps, .s1-rules { margin: 6px 0 10px; padding-left: 22px; font-size: 13px; line-height: 1.55; }
.s1-rules li { padding: 3px 6px; border-radius: 6px; color: #6b7785; }
.s1-rules li.taken { background: #e7f5ec; color: #1d5c39; font-weight: 700; }
.s1-phrase-head { margin: 12px 0 4px; font-size: 13.5px; }
.s1-table td, .s1-table th { font-size: 12.5px; }
.s1-table td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.s1-added { margin: 4px 0 2px; font-size: 12.5px; color: #1f7a50; font-weight: 600; }
.s1-drop { color: #a8423c; }
.s1-bar { width: 160px; height: 8px; border-radius: 4px; background: #eef3f6; overflow: hidden; }
.s1-bar span { display: block; height: 100%; background: #3f86d4; }

.s2-criteria { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.s2-criteria li { display: grid; gap: 2px; padding: 8px 11px; border: 1px solid #e3edf1; border-radius: 9px; background: #fbfdfe; font-size: 13px; line-height: 1.5; }
.s2-criteria strong { color: var(--navy); }
.s2-table td.num, .s2-table th { white-space: nowrap; }
.s2-table td.num { font-variant-numeric: tabular-nums; text-align: right; }
.s2-plus { color: #1f7a50; font-weight: 600; }
.s2-zero { color: #b3c0c8; }
.s2-final { font-weight: 800; color: var(--navy); }
.s2-group td { padding-top: 10px; color: #8a5a10; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
