/* Сім-Стомат — режим ОСКІ. Основа: ../assets/base.css, ../assets/sim.css */
.os { display: grid; gap: 20px; }
.os .view { display: grid; gap: 18px; min-width: 0; }
.os .view > * { min-width: 0; }
.os-logo { margin-left: 4px; }

/* налаштування */
.os-setup { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.os-form { display: grid; gap: 14px; }
.os-box { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 14px 16px; display: grid; gap: 10px; margin: 0; min-width: 0; }
.os-box legend { font-family: var(--f-display); font-weight: 500; font-size: 14px; padding: 0 6px; }
.os-box label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.os-box input[type="text"], .os-box select { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px 10px; width: 100%; min-width: 0; }
.os-box .os-check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.os-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.os-stations { display: grid; gap: 12px; min-width: 0; }
.os-st-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.os-list { display: grid; gap: 6px; }
.os-item { display: grid; grid-template-columns: auto 34px minmax(0, 1fr) minmax(0, 260px); gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.os-item.on { border-color: var(--accent); background: var(--accent-soft); }
.os-item.off { opacity: .55; }
.os-item input { accent-color: var(--accent); width: 17px; height: 17px; }
.os-no { font: 600 13px var(--f-mono); color: var(--accent); text-align: center; }
.os-name { display: grid; gap: 1px; font-size: 14.5px; }
.os-name small { color: var(--muted); font-size: 12.5px; }
.os-item select { font: inherit; font-size: 13px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s); padding: 6px 8px; width: 100%; min-width: 0; }
.os-err { color: var(--crit); font-size: 14px; min-height: 1.2em; }

/* проходження */
.os-runbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); position: sticky; top: 64px; z-index: 4; }
.os-runl h2 { font-family: var(--f-display); font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.os-runl .muted { font-size: 13.5px; }
.os-runr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.os-timer { font-size: 34px; font-weight: 600; line-height: 1; padding: 6px 12px; border-radius: var(--r-s); background: var(--surface-2); }
.os-timer.warn { background: var(--warn-soft); color: var(--warn); }
.os-timer.crit { background: var(--crit-soft); color: var(--crit); }
.os-dots { display: flex; gap: 5px; flex-wrap: wrap; max-width: 220px; }
.os-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.os-dots i.cur { background: var(--accent); border-color: var(--accent); }
.os-dots i.pass { background: var(--ok); border-color: var(--ok); }
.os-dots i.fail { background: var(--crit); border-color: var(--crit); }
.os-brief { display: grid; gap: 12px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); max-width: 760px; }
.os-brief h3 { font-family: var(--f-display); font-weight: 600; font-size: 20px; }
.os-brief .big { font-size: 16px; }
.os-brief dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14.5px; }
.os-brief dt { color: var(--muted); }
.os-frame { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.os-frame iframe { display: block; width: 100%; height: calc(100vh - 190px); min-height: 560px; border: 0; }
.os-score { font: 600 40px var(--f-mono); }

/* протокол */
.os-proto { display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.os-proto h1 { font-family: var(--f-display); font-weight: 600; font-size: 22px; }
.os-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 18px; font-size: 14px; }
.os-meta b { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.os-verdict { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: baseline; padding: 14px 16px; border-radius: var(--r-s); }
.os-verdict.pass { background: var(--ok-soft); }
.os-verdict.fail { background: var(--crit-soft); }
.os-verdict strong { font-family: var(--f-display); font-size: 20px; }
.os-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.os-table th, .os-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.os-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.os-table td.num { font-family: var(--f-mono); white-space: nowrap; }
.os-table .pass { color: var(--ok); font-weight: 600; }
.os-table .fail { color: var(--crit); font-weight: 600; }
.os-det { border-top: 1px solid var(--line); padding-top: 10px; }
.os-det summary { cursor: pointer; font-weight: 500; }
.os-det ul { margin: 8px 0 0 18px; font-size: 13.5px; display: grid; gap: 3px; }
.os-det .sev-critical { color: var(--crit); }
.os-sign { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.os-sign span { display: block; border-top: 1px solid var(--ink); padding-top: 4px; margin-top: 34px; }
.os-actions { justify-content: flex-start; }
.table-wrap { overflow-x: auto; }

@media (max-width: 860px) {
  .os-setup { grid-template-columns: minmax(0, 1fr); }
  .os-runbar { grid-template-columns: minmax(0, 1fr); position: static; }
  .os-runr { justify-content: flex-start; }
  .os-item { grid-template-columns: auto 30px minmax(0, 1fr); }
  .os-item select { grid-column: 2 / -1; }
}
/* протокол і список протоколів на телефоні: рядок — картка */
@media screen and (max-width: 640px) {
  .os-table thead, table.hist thead { display: none; }
  .os-table, .os-table tbody, table.hist, table.hist tbody { display: block; }
  table.hist { min-width: 0; }
  table.hist tr:last-child { border-bottom: 0; }
  .os-table tr, table.hist tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.hist tr { padding: 12px; }
  .os-table td, table.hist td { padding: 0; border: 0; }
  .os-table .os-no { font-weight: 600; }
  .os-table .os-stn { flex: 1 1 0; min-width: 0; font-weight: 600; }
  .os-table .os-tsk, .os-table .os-res, table.hist .h-name { flex-basis: 100%; }
  table.hist .h-name { order: -1; font-weight: 600; }
  table.hist .h-date { flex-basis: 100%; font-size: 13px; color: var(--muted); }
  .os-table td[data-l]::before, table.hist td[data-l]::before { content: attr(data-l) ' '; font-family: var(--f-body); color: var(--muted); font-size: 12px; }
}

@media print {
  .topbar, .os-actions, #view-setup, #view-run, #view-history, #osTsv { display: none !important; }
  body { background: var(--paper); }
  .os-proto { border: 0; padding: 0; }
  .os-det { break-inside: avoid; }
  details { display: block; }
  details > summary { list-style: none; }
}
