/* HOW · калькулятор стендів — мінімалізм, чорний на білому */

:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --line-strong: #111111;
  --accent: #000000;
  --chip-bg: #f5f5f5;
  --chip-bg-hover: #eeeeee;
  --chip-active-bg: #000000;
  --chip-active-fg: #ffffff;
  --radius: 4px;
  --radius-lg: 8px;
  --maxw: 1100px;
  --gap: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #f5f5f5;
    --muted: #9a9a9a;
    --line: #222222;
    --line-strong: #f5f5f5;
    --chip-bg: #161616;
    --chip-bg-hover: #1f1f1f;
    --chip-active-bg: #f5f5f5;
    --chip-active-fg: #0a0a0a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: var(--fg);
}
.brand-mark {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.lang { display: flex; gap: 2px; }
.lang-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all .12s;
}
.lang-btn:hover { color: var(--fg); }
.lang-btn.is-active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

/* WRAP */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 32px 80px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: start;
}

@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; gap: 32px; padding: 24px 20px 60px; }
  .topbar { padding: 16px 20px; }
}

/* HERO */
.hero { grid-column: 1 / -1; margin-bottom: 8px; }
.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 12px;
}
.hero .lede {
  color: var(--muted);
  font-size: 17px;
  max-width: 640px;
  margin: 0;
}

/* FORM */
.calc { display: flex; flex-direction: column; gap: 32px; margin: 0; }
.step {
  border: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.step legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  padding: 0;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 13px;
  font-weight: 700;
  background: var(--fg);
  color: var(--bg);
  border-radius: 50%;
}

/* CHIPS */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--chip-bg);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.chip:hover { background: var(--chip-bg-hover); }
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip:has(input:checked) {
  background: var(--chip-active-bg);
  color: var(--chip-active-fg);
}
.chip:has(input:focus-visible) { outline: 2px solid var(--fg); outline-offset: 2px; }
.chip-sm { padding: 8px 14px; font-size: 13px; }

/* NUMBER FIELDS */
.row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.field {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field input {
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  transition: border-color .12s;
}
.field input:focus {
  outline: none;
  border-color: var(--line-strong);
}

.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
}

/* RESULT */
.result {
  position: sticky;
  top: 80px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
@media (max-width: 900px) {
  .result { position: static; }
}

.result-head { border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.result-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.result-total {
  font-size: clamp(36px, 4vw, 48px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-total .ccy {
  font-size: 0.5em;
  font-weight: 600;
  color: var(--muted);
}
.result-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.result-breakdown summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 0;
  list-style: none;
}
.result-breakdown summary::-webkit-details-marker { display: none; }
.result-breakdown summary::after {
  content: '+';
  float: right;
  font-weight: 400;
}
.result-breakdown[open] summary::after { content: '−'; }

.breakdown { margin-top: 16px; }
.bd-group { margin-bottom: 16px; }
.bd-group-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.bd-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
  font-variant-numeric: tabular-nums;
}
.bd-item:last-child { border-bottom: none; }
.bd-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-qty { color: var(--muted); font-size: 12px; }
.bd-price { color: var(--muted); font-size: 12px; }
.bd-sum { font-weight: 600; min-width: 72px; text-align: right; }

.breakdown-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bf-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.bf-total {
  font-size: 16px;
  font-weight: 700;
  padding-top: 6px;
  border-top: 1px solid var(--line-strong);
  margin-top: 4px;
}

.result-actions { display: flex; gap: 8px; }
.btn {
  flex: 1;
  padding: 12px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity .12s;
}
.btn:hover { opacity: 0.85; }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--chip-bg); opacity: 1; }
.btn.is-ok { background: #0a7a3a; border-color: #0a7a3a; color: #fff; }

.disclaimer {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* FOOT */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--fg); }
@media (max-width: 900px) {
  .foot { padding: 20px; flex-direction: column; gap: 8px; }
}

/* PRINT */
@media print {
  .topbar, .lang, .result-actions, .foot, .hint, .step-num { display: none !important; }
  .wrap { grid-template-columns: 1fr; padding: 0; gap: 16px; }
  body { font-size: 12px; }
  .result { position: static; border: none; padding: 0; }
  .chip { border: 1px solid #000; background: transparent; color: #000; }
  .chip:has(input:checked) { background: #000; color: #fff; }
}
