/* Train page (admin). Colour tokens come from common/base.css. */
.muted { color: var(--muted); }
.small { font-size: 11px; }
.my { font-family: var(--myanmar); font-weight: 400; }
.hidden { display: none !important; }

#page {
  max-width: 920px;
  margin: 0 auto;
  padding: 22px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { font-size: 13px; color: var(--text2); margin-top: 4px; max-width: 64ch; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 20px;
}
.card h2, .section-h { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
             margin-bottom: 14px; }
.section-h { margin: 6px 0 10px; }
.num-badge {
  width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: 11px; color: var(--accent); border: 1.5px solid var(--accent);
}

/* ── 1 · Data ─────────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tile-v { font-size: 24px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile-v small { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile-k { font-size: 11px; color: var(--text2); }
.tile-s { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.tile-s .up { color: var(--status-complete); font-weight: 600; }
.meter { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.split { margin-top: 18px; }
.split-title { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.split-title .muted { font-weight: 400; }
.split-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--border); gap: 2px; }
.split-bar > i { display: block; height: 100%; min-width: 3px; }
.split-bar.empty { background: repeating-linear-gradient(135deg, var(--border) 0 6px, transparent 6px 12px);
                   border: 1px dashed var(--border2); }
.c-train { background: var(--accent); }
.c-exam { background: var(--status-over); }
.c-rej { background: var(--accent2); }
.legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.legend > div { font-size: 11px; color: var(--text2); line-height: 1.55; }
.legend b { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); margin-bottom: 2px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend .why { color: var(--muted); }

/* ── 2 · Models ───────────────────────────────────────────────────────────── */
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.model { display: flex; flex-direction: column; gap: 12px; }
.model-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.model-name { font-size: 17px; font-weight: 700; }
.model-name .my { color: var(--text2); font-size: 15px; margin-left: 4px; }
.model-reads { font-size: 11px; color: var(--muted); }
.tag { font-size: 11px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
       border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.tag.none { color: var(--muted); background: var(--surface2); }
.metric { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline; }
.metric-v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; grid-row: span 2; }
.metric-k { font-size: 12px; font-weight: 600; }
.metric-s { font-size: 11px; color: var(--text2); line-height: 1.5; }
.metric.small .metric-v { font-size: 18px; }
.empty-model { font-size: 12px; color: var(--text2); line-height: 1.6; background: var(--surface2);
               border: 1px dashed var(--border2); border-radius: 10px; padding: 12px 14px; }
.versions { width: 100%; border-collapse: collapse; font-size: 11px; }
.versions th { text-align: left; font-size: 10px; color: var(--muted); font-weight: 600; padding: 4px 6px 4px 0; }
.versions td { padding: 5px 6px 5px 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.versions .cur td { color: var(--accent); font-weight: 600; }
.num { text-align: right; }
details.recipe summary, details.log summary { font-size: 11px; color: var(--text2); cursor: pointer; }
details.recipe ul { list-style: none; margin-top: 8px; font-size: 11px; color: var(--text2); line-height: 1.6;
                    display: flex; flex-direction: column; gap: 4px; }
details.recipe li b { color: var(--text); font-weight: 600; }

/* ── 3 · Train ────────────────────────────────────────────────────────────── */
.label { font-size: 12px; font-weight: 600; margin: 4px 0 8px; }
.pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.pick-card {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--border2); background: var(--surface2); font-size: 13px; line-height: 1.5;
}
.pick-card .muted { font-size: 11px; }
.pick-card input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.pick-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface2)); }
.pick-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.steps { list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
         gap: 10px; margin-bottom: 14px; }
.steps li { counter-increment: s; font-size: 11px; color: var(--text2); line-height: 1.55;
            border-top: 2px solid var(--border2); padding-top: 8px; }
.steps li strong { display: block; font-size: 12px; color: var(--text); margin-bottom: 2px; }
.steps li strong::before { content: counter(s) " · "; color: var(--accent); }
.note { font-size: 11px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.note.test { color: var(--text2); border-left: 3px solid var(--status-over); padding-left: 10px; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn.danger { color: var(--accent2); border-color: color-mix(in srgb, var(--accent2) 55%, transparent); background: none; }
.btn.danger:hover { border-color: var(--accent2); }

.last-run { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 12px; line-height: 1.6;
            background: var(--surface2); border: 1px solid var(--border); }
.last-run h3 { font-size: 12px; margin-bottom: 4px; }
.last-run .row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 4px 0; }

.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.stepper li { font-size: 11px; text-align: center; padding: 7px 4px; border-radius: 8px; color: var(--muted);
              background: var(--surface2); border: 1px solid var(--border); }
.stepper li.done { color: var(--status-complete); border-color: color-mix(in srgb, var(--status-complete) 40%, transparent); }
.stepper li.now { color: var(--accent); border-color: var(--accent); font-weight: 700;
                  background: color-mix(in srgb, var(--accent) 10%, var(--surface2)); }
.job-track { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.job-line { font-size: 12px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bar { height: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); transition: width 0.4s; }
.chart { width: 100%; height: 110px; margin-top: 10px; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .train { stroke: var(--muted); fill: none; stroke-width: 1.5; }
.chart .val { stroke: var(--accent); fill: none; stroke-width: 2; }
.chart .best { fill: var(--accent); }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.chart-legend { font-size: 11px; color: var(--text2); line-height: 1.6; margin-top: 4px; }
.chart-legend .sw { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.explain { font-size: 11px; color: var(--muted); line-height: 1.6; margin-top: 6px; }
.log { margin-top: 14px; }
#job .actions { margin-top: 16px; }
.test-tag { font-size: 10px; color: var(--text2); border: 1px solid var(--status-over); border-radius: 6px;
            padding: 1px 6px; margin-left: 6px; white-space: nowrap; }
#job-log {
  margin-top: 8px; max-height: 260px; overflow: auto; font-size: 10px; line-height: 1.5; font-family: var(--mono);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  white-space: pre-wrap; word-break: break-word;
}

.pill { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase;
        letter-spacing: 0.04em; border: 1px solid var(--border2); color: var(--text2); white-space: nowrap; }
.pill.run { color: var(--accent); border-color: var(--accent); }
.pill.good { color: var(--status-complete); border-color: var(--status-complete); }
.pill.bad { color: var(--accent2); border-color: var(--accent2); }

/* History */
.hist-row { font-size: 12px; padding: 10px 0; border-top: 1px solid var(--border); display: grid;
            grid-template-columns: 170px 1fr; gap: 10px; color: var(--text); }
.hist-row:first-child { border-top: none; padding-top: 0; }
.hist-when { color: var(--muted); font-size: 11px; }
.hist-parts { display: flex; flex-direction: column; gap: 3px; }

/* Glossary */
.glossary summary { list-style: none; cursor: pointer; }
.glossary summary::-webkit-details-marker { display: none; }
.glossary summary h2::after { content: "+"; margin-left: auto; color: var(--muted); font-weight: 400; }
.glossary[open] summary h2::after { content: "−"; }
.glossary dl { display: grid; grid-template-columns: 190px 1fr; gap: 10px 16px; margin-top: 14px; font-size: 12px; }
.glossary dt { font-weight: 600; }
.glossary dd { color: var(--text2); line-height: 1.6; }

#toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 8px 20px;
  border-radius: 20px; opacity: 0; transition: opacity 0.18s, transform 0.18s; pointer-events: none;
  max-width: 90vw; z-index: 80;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--accent2); }

/* ── Smaller screens ──────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model-grid, .legend { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glossary dl { grid-template-columns: 1fr; gap: 2px; }
  .glossary dd { margin-bottom: 8px; }
}
@media (max-width: 480px) {
  .pick { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hist-row { grid-template-columns: 1fr; gap: 2px; }
  .tile-v { font-size: 20px; }
}
