/* SHUM Selector – палитра АТАРО (ataro.bg) */
:root {
  --blue: #0093d7;
  --blue-2: #1794d4;
  --blue-dark: #0077b0;
  --blue-light: #e3f3fb;
  --blue-tint: #eef2f8;
  --ink: #303840;
  --ink-2: #363853;
  --muted: #848484;
  --muted-2: #92a1a6;
  --line: #e7e8ea;
  --line-2: #c2c2c2;
  --bg: #f9f9fb;
  --card: #ffffff;
  --card-2: #fbfcfe;
  --red: #d70028;
  --green: #2e9e5b;
  --green-bg: #e6f5ec;
  --amber: #d98b00;
  --amber-bg: #fff4dc;
  --red-bg: #fde8ec;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(48, 56, 64, 0.06);
  --font: "Montserrat", "Segoe UI", Arial, sans-serif;
}

/* Тъмна тема */
[data-theme="dark"] {
  --blue: #33aee6;
  --blue-2: #3fb3e8;
  --blue-dark: #5cc1ee;
  --blue-light: #163446;
  --blue-tint: #1a2733;
  --ink: #e6e9ee;
  --ink-2: #f2f4f7;
  --muted: #98a2ad;
  --muted-2: #7f8a95;
  --line: #2a3340;
  --line-2: #3d4856;
  --bg: #0f1419;
  --card: #171d24;
  --card-2: #1c232b;
  --green: #4cc47a;
  --green-bg: #15301f;
  --amber: #f0a92a;
  --amber-bg: #3a2c0f;
  --red: #ff5c73;
  --red-bg: #3d1620;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
[data-theme="dark"] .field input, [data-theme="dark"] .field select, [data-theme="dark"] .octaves input, [data-theme="dark"] .seg { background: #10161c; color: var(--ink); }
[data-theme="dark"] .btn.secondary { background: transparent; }
[data-theme="dark"] .toast { background: #e6e9ee; color: #0f1419; }
[data-theme="dark"] .dwg {
  --dwg-line: #dfe4ea; --dwg-fill-steel: #2a323c; --dwg-fill-wool: #33404d; --dwg-fill-splitter: #4a5566;
  --dwg-dim: #33aee6; --dwg-flow: #5cc1ee; --dwg-fill-bore: #10161c;
}

/* Разпъната страница */
body.wide .page, body.wide .topbar-inner { max-width: none; }
body.wide .grid { grid-template-columns: 440px 1fr; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
html { font-size: 14px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--ink-2); }
a { color: var(--blue); }
button { font-family: inherit; }
input, select { font-family: inherit; font-size: 13px; color: var(--ink); }

/* ---------- Header ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px;
}
.logo {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink-2);
}
/* Официално лого АТАРО КЛИМА / ATARO CLIMA (PNG с прозрачен фон от „Лога/BG logo“ и „EN logo“, сменя се с езика) */
.logo-img { height: 30px; width: auto; display: block; }
.logo-sub { font-size: 12px; color: var(--muted); display: block; letter-spacing: 0; font-weight: 500; border-left: 1px solid var(--line); padding-left: 14px; line-height: 1.25; }
/* номер на версията до подзаглавието – вдига се при всяко качване */
.logo-ver { font-size: 10.5px; font-weight: 600; color: var(--muted); opacity: .75; letter-spacing: .3px; align-self: center; white-space: nowrap; }
/* Значка „36 години“ (BG/EN според езика) */
.logo-years { height: 44px; width: 44px; display: block; margin-right: -2px; }
.logo-text { font-weight: 700; font-size: 20px; letter-spacing: 1px; color: var(--blue); }
.topbar .spacer { flex: 1; }
.lang {
  display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
}
.lang button {
  border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted);
}
.lang button.active { background: var(--blue); color: #fff; }
.iconbtn {
  border: 1px solid var(--line); background: transparent; color: var(--ink-2); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.iconbtn:hover { background: var(--bg); }
a.iconbtn { text-decoration: none; }
.iconbtn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 600px) { .iconbtn span { display: none; } }

/* ---------- Layout ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 20px; }
.grid { display: grid; grid-template-columns: 420px 1fr; gap: 20px; align-items: start; }
.grid > div { min-width: 0; }
@media (max-width: 1000px) { .grid, body.wide .grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .page { padding: 12px; }
  .card { padding: 14px 12px; }
  /* версията остава във футъра – в хедъра логото се реже на тесен екран */
  .logo-sub, .logo-years, .logo-ver { display: none; }
  /* одит 05.10.2026: на 375 px хедърът свиваше превключвателя BG/EN до 20 px и EN оставаше извън екрана.
     Логото се свива, а езикът и иконите запазват размера си. */
  .logo-img { height: 24px; max-height: 24px; width: auto; max-width: 100%; }
  .topbar .logo { min-width: 0; flex: 0 1 auto; overflow: hidden; }
  .lang, .topbar .iconbtn { flex: 0 0 auto; }
  .topbar .iconbtn { padding: 6px 9px; }
  .lang button { padding: 6px 10px; }
  .topbar-inner { padding: 8px 10px; gap: 6px; }
  /* одит F08: тип на въздуховода и позиция на отделни редове; сегментите не се режат */
  .row.stack-mobile > .field { flex: 1 1 100%; }
  .seg { flex-wrap: wrap; }
  .seg button { flex: 1 1 auto; }
  .octaves-wrap { overflow-x: auto; margin: 0 -4px; }
  .octaves input { min-width: 28px; padding: 5px 0; font-size: 11px; }
  .octaves th { font-size: 10px; }
  .octaves th.lbl, .octaves td.lbl { font-size: 11px; }
  html { font-size: 13px; }
  .spec, .kv { display: block; overflow-x: auto; }
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.card-title {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  font-size: 15px; font-weight: 600;
}
.step-no {
  width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.note {
  font-size: 12px; color: var(--ink-2); background: var(--blue-tint);
  border-left: 3px solid var(--blue); padding: 8px 12px; border-radius: 6px; margin-top: 10px;
}
.note.warn { background: var(--amber-bg); border-color: var(--amber); }
.note.err { background: var(--red-bg); border-color: var(--red); }

/* ---------- Forms ---------- */
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 120px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; background: #fff;
  outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,147,215,.15); }
/* одит 05.10.2026: по подразбиране flex-елемент не се свива под min-content, а <select> мери по най-дългата си
   опция („Центробежен, напред извити лопатки“) – на 320 px това изнасяше страницата с 37 px. */
.field select, .inline select { min-width: 0; max-width: 100%; }
.field input[type=number] { text-align: right; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.unit { font-size: 12px; color: var(--muted); }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; background: #fff; }
.seg button {
  border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.seg button.active { background: var(--blue); color: #fff; }
.seg.small button { padding: 5px 10px; font-size: 11px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
.check input { accent-color: var(--blue); width: 15px; height: 15px; }

.octaves { width: 100%; border-collapse: collapse; margin-top: 8px; }
.octaves th {
  font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding: 3px 2px;
}
.octaves th.lbl, .octaves td.lbl { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; padding-right: 6px; }
.octaves td { padding: 2px; }
.octaves input {
  width: 100%; min-width: 32px; padding: 6px 0; font-size: 12px; text-align: center; border: 1px solid var(--line-2); border-radius: 6px;
}
.octaves input:disabled { background: var(--bg); color: var(--muted-2); }
.octaves td.calc { text-align: center; font-size: 12px; color: var(--ink-2); font-weight: 600; background: var(--bg); border-radius: 6px; }
.octaves .sum { font-weight: 700; color: var(--blue); }

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 10px 20px; cursor: pointer; font-weight: 600; font-size: 13px;
  background: var(--blue); color: #fff; transition: background .15s; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--blue-dark); }
.btn.secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn.secondary:hover { background: var(--blue-light); }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; margin-top: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Results ---------- */
.results-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.results-head .count { color: var(--muted); font-size: 12.5px; }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot.ok { background: var(--green); } .dot.tol { background: var(--amber); } .dot.fail { background: var(--red); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.results { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 900px; }
table.results th {
  background: var(--blue-tint); color: var(--ink-2); font-weight: 600; font-size: 11.5px; text-align: center;
  padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
table.results th.sorted { color: var(--blue); }
table.results th:first-child, table.results td.code { text-align: left; }
table.results td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
table.results tr:hover td { background: var(--card-2); }
table.results tr.selected td { background: var(--blue-light); }
table.results td.code { font-weight: 600; color: var(--ink-2); }
table.results td.num { font-variant-numeric: tabular-nums; }
.status { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.status.ok { background: var(--green); } .status.tol { background: var(--amber); } .status.fail { background: var(--red); }
.status.cond, .dot.cond { background: var(--card); border: 2px solid var(--green); box-sizing: border-box; }
.status.na, .dot.na { background: var(--line-2); }
table.results tr:focus { outline: none; } table.results tr:focus-visible td { box-shadow: inset 0 0 0 2px var(--blue); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hint-inline { font-weight: 400; color: var(--muted); font-size: 11px; }
.note.stale { margin: 0 0 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.bands { display: inline-flex; gap: 2px; }
.band { width: 12px; height: 12px; border-radius: 3px; background: var(--green-bg); border: 1px solid var(--green); }
.band.tol { background: var(--amber-bg); border-color: var(--amber); }
.band.fail { background: var(--red-bg); border-color: var(--red); }
.band.na { background: var(--bg); border-color: var(--line-2); }
.warn-icon { color: var(--amber); font-weight: 700; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.empty ul { text-align: left; display: inline-block; margin: 10px 0 0; }

/* ---------- Detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid > div { min-width: 0; }
.note { overflow-wrap: anywhere; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kv td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.kv td:first-child { color: var(--muted); width: 55%; }
.kv td:last-child { font-weight: 600; text-align: right; }
.order-code {
  font-size: 22px; font-weight: 700; color: var(--blue); letter-spacing: 1px;
  background: var(--blue-tint); border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.spec { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.spec th { background: var(--blue-tint); font-weight: 600; padding: 5px 4px; font-size: 11px; text-align: center; }
.spec td { padding: 5px 4px; text-align: center; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.spec td:first-child, .spec th:first-child { text-align: left; white-space: nowrap; }
.spec td.fail { color: var(--red); font-weight: 600; }
.spec td.tol { color: var(--amber); font-weight: 600; }
.chart { width: 100%; height: auto; display: block; }
.drawing { width: 100%; height: auto; display: block; background: var(--card-2); border-radius: 8px; border: 1px solid var(--line); }
/* ---------- Чертежи (SVG активи) ---------- */
.dwg {
  --dwg-line: #303840; --dwg-fill-steel: #f2f2f3; --dwg-fill-wool: #dce4e8; --dwg-fill-splitter: #c4cad9;
  --dwg-dim: #0093d7; --dwg-flow: #1794d4; --dwg-fill-bore: #ffffff;
  color: var(--dwg-line); font-family: var(--font); font-size: 10px; padding: 4px 0;
}
.dwg .dwg-dim { color: var(--dwg-dim); }
.dwg .dwg-dim text { fill: var(--dwg-dim); font-size: 10px; font-weight: 600; }
.dwg .dwg-dim .dim { stroke: currentColor; stroke-width: 1; }
.dwg .dwg-dim .ext { stroke: currentColor; stroke-width: .6; opacity: .7; }
.dwg .dwg-flow { color: var(--dwg-flow); }
.dwg text.cap { fill: var(--muted); font-size: 10px; }
.dwg .casing { fill: var(--dwg-fill-steel); stroke: var(--dwg-line); stroke-width: 1.5; }
.dwg .wool { fill: var(--dwg-fill-wool); }
.dwg .bore { fill: var(--dwg-fill-bore); }
.dwg .ln { fill: none; stroke: var(--dwg-line); stroke-width: .75; }
.dwg .ln15 { fill: none; stroke: var(--dwg-line); stroke-width: 1.5; }
.dwg .cl { fill: none; stroke: var(--dwg-line); stroke-width: .75; stroke-dasharray: 12 3 2 3; }
/* изометрия: кулиса и засенчване на стените (през --dwg-line, за да работи и тъмната тема) */
.dwg .splitter { fill: var(--dwg-fill-splitter); stroke: var(--dwg-line); stroke-width: 1; }
.dwg .iso-shade { fill: var(--dwg-line); opacity: .07; stroke: none; }
.dwg .iso-shade2 { fill: var(--dwg-line); opacity: .15; stroke: none; }

.subhead { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--blue-tint); color: var(--blue); }
.tag.est { background: var(--amber-bg); color: var(--amber); }

/* ---------- Footer ---------- */
.footer { text-align: center; color: var(--muted); font-size: 11.5px; padding: 20px; }
.footer a { color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 12.5px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50;
}
.toast.show { opacity: 1; }

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .topbar, .no-print, .footer, .lang, #results-card, .actions { display: none !important; }
  .grid { display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  #detail-card:not([hidden]) { display: block !important; }
  .print-only { display: block !important; }
  .print-header { display: flex !important; }
  html { font-size: 12px; }
}
.print-only { display: none; }
.print-header { justify-content: space-between; align-items: center; border-bottom: 2px solid var(--blue); padding-bottom: 8px; margin-bottom: 12px; }
.print-header .logo-img { height: 28px; width: auto; }
