/* Сгенерировано scripts/build_calcs.py — не править руками. */
.calc-mv {
& {
  --mv-red: #e2062c;
  --mv-red-d: #b8001f;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #128a3a;
  --red: #d21c1c;
  --radius: 10px;
}

* { box-sizing: border-box; }
/* атрибут hidden должен реально прятать элемент, даже если у него есть .row (display:flex) */
[hidden] { display: none !important; }

& {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}

& { max-width: 430px; }
/* когда открыто в отдельной вкладке — центрируем */
@media (min-width: 700px) {
  & { width: auto; }
  .wrap { max-width: 480px; margin: 0 auto; }
}

.hdr {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--mv-red);
  color: #fff;
  padding: 10px 14px;
}
.hdr-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: #fff; color: var(--mv-red); font-weight: 800; font-size: 14px;
}

.wrap { padding: 12px; display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.row:last-child { margin-bottom: 0; }
.row.small { font-size: 13px; }
.row label { color: var(--ink); flex: 0 0 auto; }

input[type="text"], select {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  width: 150px;
  text-align: right;
  outline: none;
}
select { text-align: left; width: 100%; max-width: 250px; }
input[type="text"]:focus, select:focus { border-color: var(--mv-red); box-shadow: 0 0 0 2px rgba(226,6,44,.12); }

.input-with-btn { display: flex; gap: 6px; align-items: center; }
.input-with-btn input { width: 110px; }

.mini-btn {
  font: inherit; font-size: 12px;
  border: 1px solid var(--line);
  background: #f8f8f8;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: #444;
  white-space: nowrap;
}
.mini-btn:hover { background: #eee; border-color: #ccc; }

.dims { display: flex; align-items: flex-end; gap: 6px; margin-bottom: 8px; }
.dim { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.dim label { font-size: 11px; color: var(--muted); }
.dim input { width: 100%; text-align: center; padding: 7px 4px; }
.mul { color: var(--muted); padding-bottom: 8px; }

.storage2 { display: flex; align-items: center; gap: 6px; }
.storage2 input { width: 84px; text-align: right; }
.storage2 .mul { padding-bottom: 0; }

.ro { color: var(--ink); font-variant-numeric: tabular-nums; }
.ro.strong { font-weight: 700; font-size: 15px; }
.ro.pos { color: var(--green); }
.ro.neg { color: var(--red); }

.hint { margin: 8px 0 0; font-size: 11px; color: var(--muted); line-height: 1.4; }

/* результат */
.result { border: 1px solid #f2c9cf; background: #fff; }
.profit-big {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0 12px; border-bottom: 1px dashed var(--line); margin-bottom: 10px;
}
.pb-label { font-size: 12px; color: var(--muted); }
.pb-value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pb-value.pos { color: var(--green); }
.pb-value.neg { color: var(--red); }

.kpis { display: flex; gap: 8px; margin-bottom: 12px; }
.kpi {
  flex: 1; background: var(--bg); border-radius: 8px; padding: 8px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.kpi-l { font-size: 11px; color: var(--muted); }
.kpi-v { font-weight: 700; font-variant-numeric: tabular-nums; }

.breakdown { width: 100%; border-collapse: collapse; font-size: 13px; }
.breakdown td { padding: 5px 0; border-bottom: 1px solid #f1f1f1; }
.breakdown td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.breakdown tr.total td { font-weight: 800; border-bottom: none; padding-top: 8px; font-size: 15px; }
.tpct { color: var(--muted); font-size: 11px; }

.foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 2px 8px;
}
.link-btn {
  background: none; border: none; color: #fff; cursor: pointer;
  font: inherit; font-size: 12px; text-decoration: underline; opacity: .95;
}
.foot .link-btn { color: var(--mv-red); }
.link-btn.danger { color: var(--red); }
.ver { font-size: 10px; color: var(--muted); }

/* ===== Поиск группы (автодополнение) ===== */
.ac-field { margin-bottom: 4px; }
.ac-field > label { display: block; margin-bottom: 5px; color: var(--ink); }
.ac { position: relative; }
.ac > input {
  width: 100%;
  text-align: left;
}
.ac-list {
  position: absolute;
  top: calc(100% + 3px);
  left: 0; right: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f4f4f4;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active { background: #fdeaed; }
.ac-item .g-name { flex: 1; color: var(--ink); }
.ac-item .g-comm { color: var(--mv-red); font-weight: 600; white-space: nowrap; }

/* ===== Хедер: действия и тема ===== */
.hdr-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  background: rgba(255, 255, 255, .15);
  border: none; border-radius: 6px;
  width: 28px; height: 26px; cursor: pointer; font-size: 14px; line-height: 1;
}
.icon-btn:hover { background: rgba(255, 255, 255, .3); }

/* ===== Кнопки во всю ширину ===== */
.full-btn {
  width: 100%; padding: 9px 10px; margin-bottom: 10px;
  font: inherit; font-weight: 600; color: #fff;
  background: var(--mv-red); border: none; border-radius: 8px; cursor: pointer;
}
.full-btn:hover { background: var(--mv-red-d); }
.full-btn.ghost { background: transparent; color: var(--mv-red); border: 1px solid var(--mv-red); margin: 10px 0 0; }
.full-btn.ghost:hover { background: rgba(226, 6, 44, .08); }

/* ===== Таблица сравнения ===== */
.cmp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cmp-head h2 { margin: 0; }
.cmp-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.cmp-table th, .cmp-table td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; white-space: normal; max-width: 130px; }
.cmp-table th { color: var(--muted); font-weight: 600; }
.cmp-del { background: none; border: none; color: var(--red); cursor: pointer; font-size: 14px; padding: 0 2px; }

/* ===== Тёмная тема ===== */
.hdr, #autofill { display: none; }
.card { margin: 0; }
.row input { min-width: 0; }

}
