/* Barn Feed OS · сайт barnfeed.app. Без шрифтів ззовні й без бібліотек; світла і темна тема (авто + перемикач). */
:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --alt: #f2f1ec;
  --ink: #171715;
  --ink2: #4a4945;
  --muted: #6b6a64;
  --line: #e2e0d8;
  --grid: #ecebe5;
  --brand: #1f6f4a;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1e9;
  --link: #1d5fae;
  --good: #1a7f37;
  --warn: #9a6200;
  --warn-bg: #fff4dc;
  --crit: #c22f2f;
  --s1: #2a78d6;
  --s2: #eb6834;
  --band: rgba(26, 127, 55, .10);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --alt: #161615; --ink: #f0efec; --ink2: #c9c8c0; --muted: #a09f97; --line: #2f2e2b; --grid: #262624;
    --brand: #3fa877; --brand-ink: #0c1a12; --brand-soft: #173325; --link: #7db3f0; --good: #4cc276; --warn: #f0b84a; --warn-bg: #3a2f12; --crit: #f07070;
    --s1: #3987e5; --s2: #d95926; --band: rgba(76, 194, 118, .14); --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --alt: #161615; --ink: #f0efec; --ink2: #c9c8c0; --muted: #a09f97; --line: #2f2e2b; --grid: #262624;
  --brand: #3fa877; --brand-ink: #0c1a12; --brand-soft: #173325; --link: #7db3f0; --good: #4cc276; --warn: #f0b84a; --warn-bg: #3a2f12; --crit: #f07070;
  --s1: #3987e5; --s2: #d95926; --band: rgba(76, 194, 118, .14); --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; overflow-x: hidden; }
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 6vw, 46px); }
h2 { font-size: clamp(24px, 4.2vw, 34px); }
h3 { font-size: 17px; }
p { margin: 0 0 .8em; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 780px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 6px 10px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: default; }

/* шапка */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav { display: none; gap: 18px; margin-left: auto; }
.nav a { color: var(--ink2); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--ink); }
.top-act { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.theme { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 18px; cursor: pointer; }
@media (min-width: 900px) { .nav { display: flex; } .top-act { margin-left: 0; } }

/* головний екран */
.hero { padding: 40px 0 32px; }
.hero-in { display: grid; gap: 28px; align-items: center; }
.eyebrow { color: var(--brand); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.lead { font-size: 18px; color: var(--ink2); max-width: 640px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 10px; }
.cta .btn { flex: 1 1 240px; }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.hc-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
.hc-row span { color: var(--ink2); }
.hc-row b.ok { color: var(--good); }
.hc-row b.warn { color: var(--warn); }
.hc-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
@media (min-width: 900px) { .hero { padding: 72px 0 56px; } .hero-in { grid-template-columns: 1.4fr 1fr; gap: 48px; } .cta .btn { flex: 0 0 auto; } }

/* розділи */
.sec { padding: 48px 0; }
.sec.alt { background: var(--alt); }
.sec-lead { color: var(--ink2); max-width: 720px; margin-bottom: 24px; }
.grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .g2, .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card p:last-child { margin-bottom: 0; }
.card p { color: var(--ink2); }
.role ul { margin: 0; padding-left: 18px; color: var(--ink2); }
.role li { margin-bottom: 4px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; vertical-align: 1px; }
.tag.soon { background: var(--warn-bg); color: var(--warn); }

/* схема */
.flow { margin: 0 0 24px; display: grid; gap: 10px; }
.flow-src { display: grid; gap: 10px; }
.node { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.node span { color: var(--ink2); font-size: 14px; }
.node.core { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.node.core span { color: var(--brand-ink); opacity: .9; }
.node.out { border-color: var(--brand); }
.flow-arrow { height: 22px; position: relative; }
.flow-arrow::before { content: ""; position: absolute; left: 50%; top: 2px; bottom: 6px; border-left: 2px solid var(--muted); }
.flow-arrow::after { content: ""; position: absolute; left: calc(50% - 5px); bottom: 2px; border: 6px solid transparent; border-top-color: var(--muted); border-bottom: 0; }
@media (min-width: 900px) {
  .flow { grid-template-columns: 1fr 40px 1fr 40px 1fr; align-items: center; }
  .flow-arrow { height: 2px; background: var(--muted); }
  .flow-arrow::before { display: none; }
  .flow-arrow::after { left: auto; right: -2px; top: -5px; bottom: auto; border: 6px solid transparent; border-left-color: var(--muted); border-right: 0; }
}
.steps { padding-left: 20px; color: var(--ink2); max-width: 780px; }
.steps li { margin-bottom: 8px; }
.steps b { color: var(--ink); }

/* порівняння */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cmp { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 15px; }
.cmp th, .cmp td { padding: 10px 12px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
.cmp thead th { background: var(--alt); font-size: 14px; color: var(--ink2); }
.cmp thead th:last-child { color: var(--brand); }
.cmp td { color: var(--ink2); }
.cmp td.y { color: var(--ink); font-weight: 600; }
.cmp td.y::before { content: "✓ "; color: var(--good); }
.cmp td.n { color: var(--muted); }
.cmp tbody tr:last-child th, .cmp tbody tr:last-child td { border-bottom: 0; }

/* графіки */
.chart { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 10px; min-width: 0; position: relative; }
.chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; margin-bottom: 6px; }
.synthetic { font-size: 12px; color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 1px 8px; align-self: flex-start; }
.plot { position: relative; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.plot .gl { stroke: var(--grid); stroke-width: 1; }
.plot .ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.plot .lbl { fill: var(--ink2); font-size: 11.5px; }
.plot .s1 { stroke: var(--s1); fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .s2 { stroke: var(--s2); fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .b1 { fill: var(--s1); }
.plot .band { fill: var(--band); }
.plot .ref { stroke: var(--muted); stroke-dasharray: 4 3; stroke-width: 1; }
.plot .mark { stroke: var(--ink2); stroke-dasharray: 2 3; stroke-width: 1; }
.plot .dot { fill: var(--s1); stroke: var(--surface); stroke-width: 2; }
.plot .dot2 { fill: var(--s2); stroke: var(--surface); stroke-width: 2; }
.plot .cross { stroke: var(--ink2); stroke-width: 1; }
.plot .hit { fill: transparent; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 13px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); white-space: nowrap; z-index: 2; }
.tip b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--ink2); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.legend i.s1 { background: var(--s1); }
.legend i.s2 { background: var(--s2); }
.legend i.band { background: var(--band); height: 10px; border: 1px solid var(--good); }
.chart details { margin-top: 6px; font-size: 13px; }
.chart details summary { cursor: pointer; color: var(--ink2); }
.chart table { border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.chart th, .chart td { padding: 2px 10px 2px 0; text-align: left; border-bottom: 1px solid var(--grid); }
.chart .tbl-scroll { max-height: 200px; overflow: auto; }

/* розрахунок */
.roi { display: grid; gap: 16px; }
.roi-in, .lead-form { display: grid; gap: 12px; }
.roi-in label, .lead-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink2); font-weight: 600; }
.roi-in small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--s1); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--s1) 25%, transparent); }
.roi-out { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; grid-template-columns: 1fr 1fr; align-content: start; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--alt); min-width: 0; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font-size: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi.main { background: var(--brand-soft); }
.kpi.main b { color: var(--good); }
.formula, .units { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink2); margin: 0; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.units summary { cursor: pointer; font-weight: 600; }
.units p { margin: 8px 0 0; }
@media (min-width: 900px) { .roi { grid-template-columns: 1fr 1.2fr; align-items: start; } }

/* ціни */
.period { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; padding: 3px; background: var(--surface); margin-bottom: 16px; }
.seg { border: 0; background: none; color: var(--ink2); font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 9px; min-height: 40px; cursor: pointer; }
.seg.on { background: var(--brand); color: var(--brand-ink); }
.plan { display: flex; flex-direction: column; gap: 10px; }
.plan .herd { color: var(--muted); font-size: 14px; margin: 0; }
.plan .price { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan .save { color: var(--good); font-size: 14px; font-weight: 600; margin: 0; }
.plan ul { margin: 0; padding-left: 18px; color: var(--ink2); }
.plan .btn { margin-top: auto; }
.plan.fit { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

/* питання */
#faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
#faq summary { cursor: pointer; font-weight: 600; }
#faq details p { margin: 8px 0 0; color: var(--ink2); }

/* заявка */
.two { display: grid; gap: 12px; }
@media (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } .lead-form .btn { justify-self: start; } }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { margin: 0; font-weight: 600; }
.form-msg.ok { color: var(--good); }
.form-msg.err { color: var(--crit); }

/* підвал */
.foot { border-top: 1px solid var(--line); padding: 32px 0 24px; background: var(--alt); }
.foot-in { display: grid; gap: 18px; margin-bottom: 12px; }
@media (min-width: 760px) { .foot-in { grid-template-columns: 2fr 1fr 1fr; } }
.brand-sm { font-weight: 700; margin-bottom: 4px; }
.todo { color: var(--warn); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
