/* ============================================================
   스마트스토어·쿠팡 마진 계산기 — styles.css
   외부 CDN/폰트 의존 없음. 시스템 폰트만 사용.
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #344054;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #e5e8f0;
  --line-strong: #d3d9e6;

  --brand: #3358f4;
  --brand-2: #6b5cff;
  --brand-soft: #edf1ff;
  --green: #0c9b6e;
  --green-soft: #e6f7f0;
  --red: #e0483b;
  --red-soft: #fdecea;
  --amber: #f59e0b;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 14px 34px -18px rgba(16, 24, 40, .28);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; }

.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;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: #fff; color: var(--ink); padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow); text-decoration: none; font-weight: 700;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: min(1200px, calc(100% - 40px));
  margin-left: auto;
  margin-right: auto;
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 380px at 82% -10%, rgba(107, 92, 255, .55), transparent 62%),
    radial-gradient(700px 320px at 8% 120%, rgba(51, 88, 244, .35), transparent 60%),
    linear-gradient(135deg, #0d1533 0%, #17224f 58%, #221c5c 100%);
  color: #fff;
  padding: 34px 0 30px;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; width: min(1200px, calc(100% - 40px)); margin: 0 auto; }
.hero__top { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 14px; }
.brand__mark {
  width: 48px; height: 48px; flex: 0 0 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,.22), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  color: #fff;
}
.brand__eyebrow {
  font-size: 10px; font-weight: 800; letter-spacing: .22em;
  color: #a9b4ff; margin-bottom: 3px;
}
.brand h1 {
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 800; letter-spacing: -.035em; line-height: 1.2;
}
.hero__pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 12px; font-weight: 700;
  padding: 7px 12px; border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  color: #eef1ff;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.pill--ghost { background: transparent; color: #bcc5e6; }
.hero__desc {
  margin-top: 16px; max-width: 780px;
  color: #c7cff0; font-size: 14.5px; line-height: 1.65;
}
.hero__desc strong { color: #fff; font-weight: 700; }

/* ---------------- Ad slots ---------------- */
.ad-slot {
  display: grid; place-items: center;
  min-height: 84px;
  margin: 16px 0 0;
  border: 1px dashed #e1e6f0;
  border-radius: 14px;
  background: #fafbfe;
  color: #c3cad8;
  font-size: 9px; font-weight: 800; letter-spacing: .28em;
  overflow: hidden;
}
.ad-slot span { opacity: .8; }
.ad-slot--mid { margin: 20px 0 0; min-height: 80px; }
.ad-slot--bottom { margin: 8px 0 22px; min-height: 80px; }

/* ---------------- Layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 408px;
  gap: 20px;
  align-items: start;
  margin-top: 22px;
}
.col--inputs { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col--results { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px 18px;
}
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card__head--tight { margin-bottom: 12px; }
.card h2 {
  font-size: 16px; font-weight: 800; letter-spacing: -.025em;
  display: flex; align-items: center; gap: 9px;
}
.card__hint { font-size: 12.5px; color: var(--muted); }
.num {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 800;
}

/* ---------------- Fields ---------------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > .field--wide { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label {
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  display: flex; align-items: baseline; gap: 5px;
}
.unit { font-size: 11px; color: var(--subtle); font-weight: 600; }
.field__wrap { position: relative; display: flex; align-items: center; }
.field__wrap input { padding-right: 38px; }
.suffix {
  position: absolute; right: 12px;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  pointer-events: none;
}
.field__wrap--indent { margin-top: 8px; max-width: 190px; }
.inline-sub { display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.inline-sub > span { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.inline-sub .field__wrap { flex: 0 1 170px; margin-top: 0; }
.inline-sub input { height: 40px; }

input[type="text"], input[type="number"], select {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfcff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5l5-5' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
input:hover, select:hover { border-color: #b9c2d6; }
input:focus, select:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(51, 88, 244, .12);
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.hint { font-size: 11.5px; color: var(--subtle); line-height: 1.45; }
.hint--block { margin-top: 10px; }

/* segmented control */
.seg {
  display: flex; gap: 4px; padding: 3px;
  background: #eef1f7; border-radius: var(--radius-sm);
}
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center;
  padding: 8px 6px; border-radius: 9px;
  font-size: 13px; font-weight: 700; color: var(--muted);
  cursor: pointer; transition: .15s;
}
.seg input:checked + span {
  background: #fff; color: var(--brand);
  box-shadow: 0 1px 3px rgba(16,24,40,.12);
}
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* checkbox */
.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; margin-top: 10px;
}
.check input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.check--inline { margin-top: 0; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11.5px; font-weight: 700;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.mini-result {
  margin-top: 14px; padding: 10px 12px;
  background: #f8f9fd; border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12.5px; color: var(--muted);
}
.mini-result strong { color: var(--ink); font-weight: 800; }

/* ---------------- Channel blocks ---------------- */
.channel { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.channel:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.channel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.channel__title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.channel__title h3 { font-size: 14.5px; font-weight: 800; letter-spacing: -.02em; }
.channel__title p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-size: 15px; font-weight: 900; color: #fff;
  letter-spacing: 0;
}
.logo--sm { background: #03c75a; }
.logo--cp { background: linear-gradient(135deg, #e8482b, #f26a3d); }
.logo--rg { background: linear-gradient(135deg, #1f6feb, #3d9bff); }
.channel__body { padding-left: 45px; }
.channel.is-off .channel__body { opacity: .45; pointer-events: none; }
.note {
  margin: 12px 0 0 45px;
  font-size: 11.5px; line-height: 1.55; color: var(--subtle);
  padding-left: 10px; border-left: 2px solid var(--line);
}
.channel.is-off .note { opacity: .5; }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track {
  width: 44px; height: 26px; border-radius: 999px;
  background: #d5dae6; position: relative; transition: background .18s;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.25);
  transition: transform .18s;
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand); outline-offset: 3px; }

.input-actions { display: flex; gap: 10px; }
.input-actions .btn { flex: 1; }

/* ---------------- Result hero ---------------- */
.card--hero {
  color: #fff; border: 0;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(107, 92, 255, .55), transparent 65%),
    linear-gradient(160deg, #101a3d 0%, #1a2759 62%, #232062 100%);
  box-shadow: 0 24px 50px -24px rgba(16, 26, 61, .65);
  padding: 18px 20px 20px;
}
.chips--channels {
  display: flex; gap: 6px; margin: 0 0 18px;
  overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.chips--channels::-webkit-scrollbar { display: none; }
.chips--channels .chip {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.14);
  color: #c3cbeb;
  font-size: 11.5px;
  padding: 7px 11px;
  flex: 0 0 auto;
}
.chips--channels .chip:hover { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }
.chips--channels .chip.is-active {
  background: #fff; color: #16204a; border-color: #fff;
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.5);
}

.kpi__label { font-size: 12px; font-weight: 700; color: #aab4da; letter-spacing: .02em; }
.kpi__value {
  font-size: clamp(34px, 4.6vw, 44px);
  font-weight: 800; letter-spacing: -.045em; line-height: 1.12;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.kpi__value.is-negative { color: #ff9b8f; }
.kpi__sub { font-size: 12.5px; color: #a7b0d4; margin-top: 5px; min-height: 19px; }

.kpi__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.kpi__box {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  padding: 10px 12px;
}
.kpi__box span { display: block; font-size: 11px; color: #a7b0d4; font-weight: 600; }
.kpi__box span em { font-style: normal; font-size: 10px; opacity: .7; }
.kpi__box strong { display: block; font-size: 19px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; }

.roas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.roas__item {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 13px;
  padding: 10px 12px;
}
.roas__label { display: block; font-size: 10.5px; color: #98a4cf; font-weight: 700; }
.roas__item strong { display: block; font-size: 20px; font-weight: 800; margin-top: 1px; color: #dfe5ff; letter-spacing: -.02em; }
.roas__item small { display: block; font-size: 10px; color: #8c97c2; margin-top: 2px; line-height: 1.35; }
.roas__item small b { color: #c6cff2; }

.insight {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 12px; line-height: 1.55; color: #d3d9f2;
}
.insight strong { color: #fff; }

/* ---------------- Breakdown ---------------- */
.bar {
  display: flex; height: 16px; border-radius: 8px; overflow: hidden;
  background: #eef1f7;
  margin: 4px 0 14px;
}
.bar__seg { height: 100%; min-width: 0; transition: width .25s ease; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; }
.legend li { display: flex; align-items: center; gap: 7px; font-size: 12px; min-width: 0; }
.legend .dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 8px; }
.legend .name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend .val { margin-left: auto; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend .val.is-neg { color: var(--red); }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.compare { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 360px; }
table.compare th {
  text-align: left; font-size: 10.5px; font-weight: 700; color: var(--subtle);
  padding: 7px 6px; border-bottom: 1px solid var(--line);
  white-space: nowrap; line-height: 1.25;
}
table.compare th:first-child { padding-left: 8px; }
table.compare td {
  padding: 9px 6px; border-bottom: 1px solid #f1f3f8;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
table.compare tbody tr:last-child td { border-bottom: 0; }
table.compare tbody tr { cursor: pointer; transition: background .15s; }
table.compare tbody tr:hover { background: #f8f9fe; }
table.compare tbody tr.is-active { background: var(--brand-soft); }
table.compare tbody tr.is-active td { color: var(--ink); }
table.compare td:first-child { font-weight: 700; padding-left: 8px; }
table.compare .t-right, table.compare td.t-right { text-align: right; }
table.compare .sub { display: block; font-size: 10px; color: var(--subtle); font-weight: 600; }
td.pos { color: var(--green); font-weight: 700; }
td.neg { color: var(--red); font-weight: 700; }
.compare__empty { padding: 16px 8px; text-align: center; color: var(--subtle); font-size: 12px; }

.fine { font-size: 11px; color: var(--subtle); line-height: 1.5; margin-top: 10px; }

/* ---------------- Actions ---------------- */
.card--actions h2 { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 44px; padding: 0 15px;
  border-radius: 12px; border: 1px solid transparent;
  font-size: 13px; font-weight: 700; letter-spacing: -.01em;
  cursor: pointer; transition: .15s; text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn--primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 10px 22px -12px rgba(51,88,244,.9); }
.btn--primary:hover { filter: brightness(1.06); }
.btn--line { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn--line:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.btn--ghost:hover { color: var(--ink); border-color: #b9c2d6; background: #fff; }
.btn--soft { background: var(--brand-soft); color: var(--brand); }
.btn--soft:hover { background: #e2e8ff; }
.btn--sm { height: 38px; padding: 0 13px; font-size: 12px; border-radius: 10px; }

/* ---------------- Presets ---------------- */
.presets { margin-top: 20px; }
.presets__row { display: flex; gap: 8px; }
.presets__row .field { flex: 1; }
.presets__row .btn { flex: 0 0 auto; height: 46px; }
.preset-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.preset-list:empty { margin-top: 0; }
.preset {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f7f9fd; border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 4px 2px 12px;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.preset__load {
  border: 0; background: transparent; color: inherit; font: inherit;
  padding: 6px 4px; cursor: pointer; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preset__load:hover { color: var(--brand); }
.preset__del {
  border: 0; background: transparent; color: var(--subtle);
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  font-size: 14px; line-height: 1;
}
.preset__del:hover { background: var(--red-soft); color: var(--red); }
.examples { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.examples__label { font-size: 11.5px; font-weight: 700; color: var(--subtle); margin-right: 2px; }

/* ---------------- Footer ---------------- */
.footer { margin-top: 26px; padding-bottom: 30px; }
.sources {
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255,255,255,.6);
  padding: 14px 16px;
}
.sources summary {
  cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink-2);
  list-style: none;
}
.sources summary::-webkit-details-marker { display: none; }
.sources summary::before { content: "＋"; color: var(--brand); margin-right: 7px; font-weight: 800; }
.sources[open] summary::before { content: "－"; }
.sources__body { padding-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.sources__body h3 { font-size: 12px; color: var(--ink-2); margin: 12px 0 4px; }
.sources__body ul { margin: 0; padding-left: 18px; }
.sources__body li { margin-bottom: 3px; }
.sources__date { margin-top: 12px; font-size: 11.5px; color: var(--subtle); }
.disclaimer { margin-top: 18px; font-size: 11.5px; color: var(--subtle); line-height: 1.65; }
.disclaimer strong { color: var(--muted); }
.copyright { margin-top: 10px; font-size: 11px; color: #b3bccd; }

/* ---------------- Mobile KPI ---------------- */
.mobile-kpi {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px -16px rgba(16,24,40,.4);
}
.mobile-kpi > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mobile-kpi span { font-size: 11px; color: var(--muted); font-weight: 700; }
.mobile-kpi strong { font-size: 19px; font-weight: 800; letter-spacing: -.03em; white-space: nowrap; }
.mobile-kpi em { font-style: normal; font-size: 12px; color: var(--brand); font-weight: 800; }

/* ---------------- Toast / noscript ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  z-index: 60;
  background: #101a3d; color: #fff;
  padding: 12px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 18px 40px -16px rgba(16,26,61,.7);
  opacity: 0; pointer-events: none; transition: .22s ease;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.noscript {
  position: fixed; inset: 0; z-index: 999; display: grid; place-items: center;
  background: #fff; padding: 24px; text-align: center; font-weight: 700;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1120px) {
  .layout { grid-template-columns: minmax(0, 1fr) 370px; }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .col--results { position: static; order: 2; }
  .col--inputs { order: 1; }
  .mobile-kpi { display: flex; }
  body { padding-bottom: 74px; }
  .toast { bottom: 86px; }
  .hero { padding: 26px 0 24px; }
  .hero__desc { font-size: 13.5px; }
}
@media (max-width: 640px) {
  .wrap, .hero__inner { width: calc(100% - 28px); }
  .card { padding: 17px 15px 15px; border-radius: 17px; }
  .hero__top { align-items: flex-start; }
  .hero__pills { margin-top: 4px; }
  .brand__mark { width: 42px; height: 42px; flex-basis: 42px; border-radius: 12px; }
  .brand h1 { font-size: 19px; }
  .grid2 { gap: 12px; }
  .channel__body { padding-left: 0; }
  .note { margin-left: 0; }
  .legend { grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .legend li { font-size: 11.5px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .btn { height: 46px; font-size: 12.5px; }
  .ad-slot { min-height: 60px; }
  .presets__row .btn { padding: 0 14px; }
  .preset__load { max-width: 160px; }
  .card--hero { padding: 16px 16px 17px; }
}
@media (max-width: 430px) {
  .grid2 { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
  .kpi__row, .roas { grid-template-columns: 1fr 1fr; }
  .kpi__value { font-size: 36px; }
  .legend { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .hero__desc { display: none; }
  .chips--channels .chip { font-size: 11px; padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .hero, .mobile-kpi, .ad-slot, .actions, .presets, .input-actions { display: none !important; }
  .layout { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}
