:root {
  --bg: #eef1f6;
  --side: #111827;
  --side-2: #1f2937;
  --ink: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --card: #fff;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --go: #1d4ed8;
  --accent: #2563eb;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 0.95rem; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 13px; }
.kicker { letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; color: var(--accent); margin: 0 0 6px; }
.err { color: var(--bad); font-size: 13px; min-height: 1.2em; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 12px 40px rgba(17, 24, 39, 0.12);
}
.login-card form { margin: 0; }
.login-card .go { width: 100%; margin-top: 4px; }
.login-card label, #page-review label, #page-capture label { display: block; margin: 10px 0 4px; font-size: 13px; }
.login-card input, #page-review input[type="text"], #page-review input[type="file"],
#page-capture input, #page-capture select,
.filters input, .filters select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#page-capture input[type="checkbox"] { width: auto; }
.lab-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.lab.on { border-color: var(--accent); background: #eff6ff; color: #1d4ed8; }
.lab .k { display: block; font-weight: 600; }
.lab .zh { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.rec-console {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  gap: 18px;
  align-items: center;
}
.rec-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 0;
  background: #b91c1c;
  color: #fff;
  font-size: 16px;
}
.rec-btn.on { box-shadow: 0 0 0 8px rgba(185, 28, 28, 0.18); }
.timer { font-variant-numeric: tabular-nums; font-size: 2rem; font-weight: 650; }
.meter { height: 12px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.meter > span { display: block; height: 100%; width: 0%; background: #16a34a; }
label.inline { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); margin-top: 10px; }
label.inline input { width: auto; margin-top: 2px; }
.login-card input, #page-review input[type="text"], #page-review input[type="file"],
.filters input, .filters select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.side {
  background: linear-gradient(180deg, var(--side), #0b1220);
  color: #e5e7eb;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand strong { display: block; font-size: 16px; color: #fff; }
.brand span { font-size: 12px; color: #9ca3af; }
.side nav { display: flex; flex-direction: column; gap: 6px; }
.nav {
  text-align: left;
  border: 0;
  background: transparent;
  color: #d1d5db;
  padding: 10px 12px;
  border-radius: 8px;
}
.nav.on, .nav:hover { background: var(--side-2); color: #fff; }
.nav-sub { margin-left: 10px; font-size: 13px; opacity: 0.95; }
.side-foot { margin-top: auto; font-size: 12px; color: #9ca3af; }
.side-foot-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.side-foot-actions .ghost { margin-top: 0; }
.pwd-dialog::backdrop { background: rgba(17, 24, 39, 0.45); }
.pwd-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: min(420px, 92vw);
  box-shadow: 0 16px 48px rgba(17, 24, 39, 0.2);
}
.pwd-dialog-inner {
  padding: 24px;
  display: grid;
  gap: 10px;
}
.pwd-dialog-inner label { display: grid; gap: 4px; font-size: 13px; }
.pwd-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.ghost {
  margin-top: 8px;
  background: transparent;
  color: #d1d5db;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 6px 10px;
}

main { padding: 20px 24px 40px; }
.top { margin-bottom: 16px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.kpi span { display: block; font-size: 12px; color: var(--muted); }
.kpi b { font-size: 1.6rem; }
.kpi.warn b { color: var(--warn); }
.kpi.bad b { color: var(--bad); }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
  align-items: start;
}

.bars { display: flex; flex-direction: column; gap: 8px; min-height: 48px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 36px; gap: 8px; align-items: center; font-size: 12px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #374151; }
.bar-track { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.bar-n { text-align: right; color: var(--muted); }

.donut-wrap { display: flex; gap: 18px; align-items: center; min-height: 140px; }
.legend { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.legend li { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.dot { width: 8px; height: 8px; border-radius: 99px; display: inline-block; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f8fafc; }
.table-wrap { overflow-x: auto; }

.chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e8eaef;
}
.chip.ok { background: #dcfce7; color: #166534; }
.chip.warn { background: #ffedd5; color: #9a3412; }
.chip.fail, .chip.bad, .chip.rejected { background: #fee2e2; color: #991b1b; }
.chip.pending { background: #fef3c7; color: #92400e; }
.chip.labeled { background: #dbeafe; color: #1e40af; }

.filters { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr) auto; gap: 10px; align-items: end; }
.filters label { font-size: 12px; color: var(--muted); margin: 0; }
#libFilters .lib-kw { grid-column: span 1; }
.disk .track { height: 10px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.disk .fill { height: 100%; background: #0f766e; }

.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.step { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: #e8eaef; }
.step.on { background: #d9f2e3; }
.step.fail { background: #ffd6d6; }
.step.warn { background: #ffe9c7; }
.review-busy {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid #c5d4e8;
  border-radius: 10px;
  background: #f0f6ff;
}
.review-busy-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #1e3a5f;
  font-weight: 500;
}
.review-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #c5d4e8;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: review-spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes review-spin {
  to { transform: rotate(360deg); }
}
.go:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.go, .ok, .bad, .warn {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  color: #fff;
  margin-right: 8px;
}
.go { background: var(--go); }
.ok { background: var(--ok); }
.bad { background: var(--bad); }
.warn { background: #d97706; }

pre { white-space: pre-wrap; font-size: 12px; background: #f3f4f6; padding: 10px; border-radius: 8px; }
img { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; }

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.result-head h2 { margin: 0; }
.result-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.meta-item {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.meta-item .k {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.meta-item .v {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}
.meta-item .sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.result-qc h3,
.result-plots h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
}
.result-qc {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fcfcfd;
}
.result-qc ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
}
.result-qc li { margin: 2px 0; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.metric-cell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.metric-cell .k { font-size: 11px; color: var(--muted); }
.metric-cell .v { display: block; margin-top: 2px; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.plot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.env-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.env-photo-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.env-photo-card img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #f8fafc;
}
.env-photo-card figcaption {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-env-photos h3,
#page-library #libEnvPhotosWrap h3 {
  margin: 16px 0 8px;
  font-size: 14px;
}
.plot-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.plot-card:hover {
  border-color: #c5d0dc;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.plot-card .cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.plot-card .cap .zoom-hint {
  flex: 0 0 auto;
  font-size: 11px;
  color: #64748b;
}
.plot-card img {
  display: block;
  width: 100%;
  min-height: 160px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #f1f5f9;
  cursor: zoom-in;
}
.plot-card img.plot-img-pending {
  background: linear-gradient(90deg, #f1f5f9 25%, #e8eef4 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: plot-shimmer 1.2s ease-in-out infinite;
}
.plot-card img.plot-img-error {
  min-height: 80px;
  background: #fef2f2;
}
.err-log-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
}
.plot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(2px);
}
.plot-lightbox.open {
  display: flex;
}
.plot-lightbox .lb-inner {
  position: relative;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plot-lightbox .lb-title {
  color: #f8fafc;
  font-size: 13px;
  text-align: center;
}
.plot-lightbox img {
  display: block;
  max-width: 96vw;
  max-height: calc(92vh - 36px);
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  cursor: zoom-out;
}
.plot-lightbox .lb-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.plot-lightbox .lb-close:hover {
  background: #e2e8f0;
}
.lib-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.lib-detail-actions:empty,
.lib-detail-actions [hidden] { display: none; }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.result-actions .go,
.result-actions .ok,
.result-actions .bad,
.result-actions .warn { margin-right: 0; }
.archive-line {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f3f4f6;
  font-size: 12px;
  word-break: break-all;
}
.archive-line:empty { display: none; }
.chip.qc-ok { background: #dcfce7; color: #166534; }
.chip.qc-warn { background: #ffedd5; color: #9a3412; }
.chip.qc-fail { background: #fee2e2; color: #991b1b; }
.chip.qc-skip { background: #e8eaef; color: #4b5563; }

@media (max-width: 1100px) {
  .result-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .result-meta { grid-template-columns: 1fr; }
  .plot-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  #app { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side nav { flex-direction: row; }
  .side-foot { margin: 0 0 0 auto; }
  .kpis, .grid2, .split, .filters { grid-template-columns: 1fr 1fr; }
  .rec-console { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .kpis, .grid2, .split, .filters { grid-template-columns: 1fr; }
}

.prog-list { display: flex; flex-direction: column; gap: 10px; }
.prog-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin: 0;
}
.prog-item > input[type="checkbox"] { margin-top: 10px; width: auto; }
.prog-item .block { display: block; margin-top: 4px; }
.prog-item .chip { margin-left: 0; margin-right: 8px; }
.prog-name-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.prog-pkg-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin: 8px 0;
}
.prog-pkg-row .grow { margin: 0; font-size: 12px; color: var(--muted); }
.prog-sig-row { align-items: center; }
.sig-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}
.sig-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}
.sig-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.sig-check input { width: auto; margin: 0; }
.muted.tiny { font-size: 11px; }
.capture-signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 4px 0 12px;
}
.capture-signal-row .sig-check {
  font-size: 14px;
  color: var(--ink);
}
.prog-pkg-row select,
.prog-pkg-row input[type="file"],
.prog-name-row .prog-name {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.prog-name-row .prog-name { font-weight: 600; color: var(--ink); }
.rename-btn, .reset-name-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
}
.rename-btn { background: var(--go); color: #fff; border-color: var(--go); }
.pkg-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0;
}
.pkg-row .grow { margin: 0; }
.pkg-row select, .pkg-row input[type="file"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-form {
  display: grid;
  grid-template-columns: 1fr 1fr 160px auto;
  gap: 10px;
  align-items: end;
}
.user-form label {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.user-form input, .user-form select {
  width: 100%;
  display: block;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: grid;
  grid-template-columns: 1fr 160px 80px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.user-row .grow { margin: 0; font-size: 12px; color: var(--muted); }
.user-row select {
  width: 100%;
  display: block;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.user-row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.user-row button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
}
.user-row button.danger { color: var(--bad); border-color: #fecaca; }
@media (max-width: 900px) {
  .user-form, .user-row { grid-template-columns: 1fr; }
}

.lib-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 12px;
  align-items: start;
}
.lib-projects { position: sticky; top: 12px; }
.project-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 62vh;
  overflow: auto;
}
.project-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.project-item:hover { border-color: #cbd5e1; background: #f8fafc; }
.project-item.on {
  border-color: #93c5fd;
  background: #eff6ff;
}
.lib-project-admin {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.lib-project-admin label { font-size: 12px; color: var(--muted); margin: 0; }
.lib-project-admin input {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.lib-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}
.lib-manage-actions label { font-size: 12px; color: var(--muted); margin: 0; }
.lib-manage-actions select {
  display: block;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.project-item .pname {
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}
.project-item .pcnt {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.project-item .pactions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
}
.project-item .pactions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}
.project-item .pactions button.danger { color: var(--bad); border-color: #fecaca; }
#reviewProject {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
@media (max-width: 1100px) {
  .lib-layout { grid-template-columns: 1fr; }
  .lib-projects { position: static; }
}

.lib-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.lib-toolbar .muted { margin: 0; }
.lib-toolbar button,
.lib-pager button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
}
.lib-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.lib-list-head h2 { margin: 0; }
.lib-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
#libFilters input,
#libFilters select {
  width: 100%;
  display: block;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
#libTable tr.selected { background: #eff6ff; }

.algo-table th, .algo-table td { padding: 10px 8px; }
.algo-table tbody td { color: var(--ink); font-size: 13px; vertical-align: middle; }
.algo-table tbody td:first-child { font-family: Consolas, "Courier New", monospace; font-weight: 600; }
.algo-table tbody tr:nth-child(even) { background: #f8fafc; }
.algo-table .algo-param-input {
  width: 7rem;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
}
.algo-result {
  margin-top: 12px;
  padding: 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  overflow: auto;
  max-height: 420px;
}

.algo-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.algo-subtab {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
}
.algo-subtab.on {
  border-color: var(--accent);
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}
.inline-field {
  display: grid;
  gap: 4px;
  max-width: 12rem;
  font-size: 13px;
  color: var(--muted);
}
.inline-field input {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}
.empty-fit-summary {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.empty-fit-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.empty-fit-kpis .k {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.empty-fit-kpis strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .empty-fit-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


