/* ─────────────────────────────────────────────
   ДограмаКалк — стилове
   ───────────────────────────────────────────── */
:root {
  --ink: #16232e;
  --ink-soft: #51616e;
  --bg: #eef1f4;
  --card: #ffffff;
  --line: #dde4ea;
  --brand: #0e3a5d;
  --brand-2: #155a8a;
  --accent: #e8a020;
  --accent-soft: #fdf3e0;
  --glass: #cfe6f5;
  --ok: #1c7c4c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 35, 46, .06), 0 8px 24px rgba(16, 35, 46, .07);
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; min-width: 0; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background:
    radial-gradient(1200px 400px at 80% -100px, #dcecf7 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: 1840px; margin: 0 auto; padding: 0 28px; }

/* ── Хедър ── */
.site-header {
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 70%, #1d6ea8 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-top: 18px; padding-bottom: 18px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 14px; }
.logo svg { background: #fff; border-radius: 10px; padding: 3px; }
.logo-name { font-size: 1.5rem; font-weight: 800; letter-spacing: .3px; display: block; }
.logo-name em { font-style: normal; color: #ffd582; }
.logo-sub { font-size: .8rem; opacity: .75; }
.header-badge {
  font-size: .78rem; background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 6px 12px; border-radius: 99px;
}

/* ── Рекламни слотове ── */
.ad-slot {
  display: block; text-decoration: none; color: var(--ink-soft);
  border: 2px dashed #c3ad84; background: var(--accent-soft);
  border-radius: var(--radius); position: relative;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ad-slot:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ad-slot strong { color: var(--ink); display: block; }
.ad-tag {
  position: absolute; top: -10px; left: 14px;
  background: var(--accent); color: #fff;
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  padding: 2px 10px; border-radius: 99px;
}
.ad-banner {
  margin: 22px 0; padding: 18px 24px; text-align: center;
}
.ad-banner strong { font-size: 1.05rem; margin-bottom: 2px; }
.ad-box { padding: 20px 22px; }
.ad-box strong { font-size: 1rem; margin-bottom: 6px; }
.ad-size {
  display: block; margin-top: 8px; font-size: .72rem; color: #9a854f;
}
.ad-size b { font-weight: 700; }

/* ── Оформление ── */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 500px;
  gap: 22px; align-items: start; padding-bottom: 10px;
}
.controls {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px; align-items: start;
}
.card.wide { grid-column: 1 / -1; }
.result { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 16px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px;
  border: 1px solid var(--line);
}
.card h2 {
  font-size: 1rem; font-weight: 700; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: .8rem; flex-shrink: 0;
}

/* ── Опции (карти-бутони) ── */
.option-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.option {
  font: inherit; font-size: .85rem; font-weight: 600; color: var(--ink-soft);
  background: #f6f8fa; border: 2px solid var(--line); border-radius: 12px;
  padding: 12px 8px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .12s, background .12s, color .12s;
}
.option small { font-weight: 400; font-size: .72rem; color: var(--ink-soft); }
.option svg {
  width: 34px; height: 34px; fill: none;
  stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}
.option:hover { border-color: #b9c9d6; }
.option.active {
  border-color: var(--brand-2); background: #eaf3fa; color: var(--brand);
}
.option-grid.small .option { padding: 10px 6px; }

/* ── Сегментиран превключвател ── */
.segmented {
  display: flex; background: #f0f3f6; border-radius: 10px; padding: 4px; gap: 4px;
  margin-bottom: 14px;
}
.segmented button {
  flex: 1; font: inherit; font-size: .85rem; font-weight: 600;
  border: 0; background: transparent; color: var(--ink-soft);
  padding: 9px 6px; border-radius: 8px; cursor: pointer;
  transition: background .12s, color .12s;
}
.segmented button.active { background: var(--brand); color: #fff; }

/* ── Полета ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field select, .field input[type="number"] {
  font: inherit; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); width: 100%;
}
.field select:focus, .field input:focus { outline: 2px solid #9cc4e0; border-color: var(--brand-2); }
.hint { font-size: .8rem; color: var(--ink-soft); margin-top: 8px; }
.muted { color: #8b99a5; }

.dim-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input[type="range"] {
  width: 100%; accent-color: var(--brand-2); height: 26px; cursor: pointer;
}

/* ── Степер за крила ── */
.stepper {
  display: inline-flex; align-items: center; gap: 0;
  border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden;
}
.stepper button {
  font-size: 1.2rem; width: 44px; height: 42px; border: 0;
  background: #f0f3f6; color: var(--brand); cursor: pointer; font-weight: 700;
}
.stepper button:hover { background: #e2e9ef; }
.stepper span {
  width: 56px; text-align: center; font-weight: 700; font-size: 1.05rem;
}

/* ── Настройка на отделните крила ── */
#sashConfig { display: flex; flex-direction: column; gap: 8px; }
.sash-row {
  display: flex; align-items: center; gap: 12px;
  background: #f6f8fa; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px;
}
.sash-row .sash-name { font-size: .84rem; font-weight: 700; color: var(--brand); min-width: 62px; }
.sash-row .segmented { margin: 0; flex: 1; background: #e9eef2; }
.sash-row .segmented button { padding: 7px 4px; font-size: .78rem; }
.sash-note { font-size: .76rem; color: var(--ink-soft); margin-top: 6px; }
.entry-note { margin-bottom: 0; }

/* ── Бутон за сваляне на скицата ── */
.download-btn {
  font: inherit; font-size: .88rem; font-weight: 700;
  width: 100%; margin-top: 12px; padding: 11px;
  border: 0; border-radius: 10px; cursor: pointer;
  background: var(--brand); color: #fff;
  transition: background .12s;
}
.download-btn:hover { background: var(--brand-2); }
.download-btn:disabled { opacity: .55; cursor: wait; }

/* ── Изпращане по имейл ── */
.email-row { display: flex; gap: 8px; margin-top: 10px; }
.email-row input {
  font: inherit; flex: 1; min-width: 0;
  padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
.email-row input:focus { outline: 2px solid #9cc4e0; border-color: var(--brand-2); }
.email-btn { width: auto; margin-top: 0; padding: 11px 16px; background: var(--accent); }
.email-btn:hover { background: #d18f14; }
.email-hint { margin-top: 6px; }

/* ── Чекбокси ── */
.check-col { display: flex; flex-direction: column; gap: 9px; }
.check-row { margin-top: 12px; }
.check {
  display: flex; align-items: center; gap: 9px;
  font-size: .88rem; cursor: pointer; color: var(--ink);
}
.check input { width: 17px; height: 17px; accent-color: var(--brand-2); cursor: pointer; }
.check.disabled { opacity: .45; cursor: not-allowed; }
.check.disabled input { cursor: not-allowed; }
.qty-field { margin-top: 14px; max-width: 160px; }
#extraScreenBlock { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.screen-sash { display: flex; flex-direction: column; gap: 5px; }
.screen-radios {
  display: flex; gap: 18px; margin: 0 0 4px 27px; font-size: .84rem; color: var(--ink);
}
.screen-radios label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.screen-radios input { accent-color: var(--brand-2); cursor: pointer; }

/* ── Надбавка ── */
.markup-card { border-left: 4px solid var(--accent); }
.markup-row { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.markup-row output {
  font-weight: 800; font-size: 1.15rem; color: var(--accent);
  min-width: 58px; text-align: right;
}

/* ── Скица ── */
.sketch-wrap { background: #f7fafc; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.sketch-wrap svg { display: block; width: 100%; height: auto; }
.sketch-legend { font-size: .76rem; color: var(--ink-soft); margin-top: 10px; }

/* ── Цена ── */
.price-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.price-table td { padding: 7px 2px; border-bottom: 1px dashed var(--line); }
.price-table td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-table tr.sub td { color: var(--ink-soft); font-size: .82rem; }
.price-table tr.markup-line td { color: var(--accent); font-weight: 600; }

.total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding: 14px 16px;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  border-radius: 12px; color: #fff;
}
.total-label { font-size: .82rem; opacity: .85; display: block; }
.total-note { font-size: .72rem; opacity: .6; }
.total-values { text-align: right; }
.total-values strong { font-size: 1.55rem; display: block; letter-spacing: .3px; }
.total-values span { font-size: .85rem; opacity: .8; }

.disclaimer {
  margin-top: 12px; font-size: .76rem; color: #8a6d1f;
  background: #fdf6e3; border: 1px solid #f0e2b6;
  padding: 10px 12px; border-radius: 10px;
}

/* ── Футър ── */
.site-footer {
  margin-top: 10px; padding: 26px 0 34px;
  border-top: 1px solid var(--line);
  text-align: center; font-size: .85rem; color: var(--ink-soft);
}
.site-footer a { color: var(--brand-2); }

/* ── Мобилни ── */
@media (max-width: 1150px) {
  .controls { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .result { position: static; }
}
@media (max-width: 520px) {
  .container { padding: 0 14px; }
  .dim-row { grid-template-columns: 1fr; }
  .header-inner { justify-content: center; text-align: center; }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .option-grid.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 16px 14px; }
  .ad-slot { overflow-wrap: anywhere; }
  .sash-row { flex-wrap: wrap; }
  .total-values strong { font-size: 1.25rem; }
  .price-table td:last-child { white-space: normal; }
}
