:root {
  --bg: #f6f7f5;
  --card: #ffffff;
  --ink: #1d2420;
  --muted: #5d6b64;
  --line: #e0e5e1;
  --brand: #195e4a;
  --brand-2: #e8f2ee;
  --ok: #1f7a45;
  --ok-bg: #e6f4ec;
  --warn: #9a6200;
  --warn-bg: #fdf3df;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --info-bg: #eef3fb;
  --fb: #1877f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.err { color: var(--bad); min-height: 1.2em; margin: .3em 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.hidden { display: none !important; }

.demo-strip { background: #1d2420; color: #e9efe9; text-align: center; font-size: .82rem; padding: 6px 12px; }
.top { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 10px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .85rem; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-weight: 500; }
nav a.active, nav a:hover { background: var(--brand-2); color: var(--brand); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.usage { font-size: .82rem; color: var(--muted); }
.kill-banner { background: var(--bad); color: #fff; text-align: center; padding: 8px 16px; }
main { padding-top: 20px; padding-bottom: 40px; min-height: 60vh; }
.foot { color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); padding-top: 14px; padding-bottom: 30px; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 9px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; line-height: 1.2; }
.btn:hover { border-color: #b9c4bd; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #134b3b; }
.btn-ghost { background: transparent; }
.btn-kill { background: var(--bad-bg); color: var(--bad); border-color: #f1c4bf; }
.btn-kill.on { background: var(--bad); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: .84rem; }
.btn-good { color: var(--ok); }
.btn-bad { color: var(--bad); }
.btn-link { border: 0; background: none; color: var(--brand); padding: 0; font-weight: 600; cursor: pointer; font: inherit; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 1000px) { .g3 { grid-template-columns: 1fr; } }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef0ee; color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: #2b4f8a; }
.chip.brand { background: var(--brand-2); color: var(--brand); }

.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 700; }
.callout { background: var(--info-bg); border-radius: 10px; padding: 10px 14px; }
.callout.warn { background: var(--warn-bg); }

.src { display: grid; grid-template-columns: 96px 1fr; gap: 12px; }
.src img, .src .noimg { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; background: #e7ece9; }
.src h3 { margin-bottom: 4px; font-size: .98rem; }
.src .meta { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.src p { margin: 0 0 8px; font-size: .86rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .9rem; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

.stepper { display: flex; gap: 0; margin: 4px 0 16px; overflow-x: auto; }
.stepper div { flex: 1; min-width: 110px; padding: 8px 10px; border-bottom: 3px solid var(--line); color: var(--muted); font-size: .84rem; font-weight: 600; }
.stepper div.done { border-color: var(--ok); color: var(--ok); }
.stepper div.now { border-color: var(--brand); color: var(--brand); background: var(--brand-2); }

.variant { display: flex; flex-direction: column; gap: 10px; }
.variant.selected { outline: 2px solid var(--brand); }
.variant header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fbpost { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.fbhead { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.fbavatar { width: 32px; height: 32px; border-radius: 50%; background: var(--fb); color: #fff; display: grid; place-items: center; font-size: .7rem; font-weight: 700; }
.fbname { font-weight: 700; font-size: .86rem; } .fbname small { display: block; font-weight: 400; color: var(--muted); }
.fbtext { white-space: pre-wrap; font-size: .9rem; }
.fblink { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: .8rem; }
.fblink img { width: 100%; height: 140px; object-fit: cover; display: block; background: #e7ece9; }
.fblink div { padding: 6px 10px; background: #f0f2f5; color: var(--muted); }
.pin { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; font-size: .86rem; }
.pin b { display: block; }
.checks { border-radius: 10px; padding: 10px; font-size: .86rem; }
.checks.ok { background: var(--ok-bg); } .checks.bad { background: var(--bad-bg); } .checks.warn { background: var(--warn-bg); } .checks.pending { background: #f1f3f1; }
.checks ul { margin: 4px 0 0; padding-left: 18px; }
details summary { cursor: pointer; font-weight: 600; }
.claims { margin-top: 6px; display: grid; gap: 6px; }
.claim { background: #fff; border-radius: 8px; padding: 6px 8px; font-size: .82rem; }
.claim q { color: var(--muted); font-style: italic; }
textarea, input, select { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; }
label { display: grid; gap: 4px; font-size: .86rem; font-weight: 600; margin-bottom: 10px; }
.counter { font-weight: 400; color: var(--muted); font-size: .78rem; }
.panel { margin-top: 16px; }
.panel h2 { display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: .9rem; }
.kpi { padding: 14px; }
.kpi b { display: block; font-size: 1.6rem; line-height: 1.1; margin: 4px 0; }
.kpi span { font-size: .82rem; color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: 140px 1fr; gap: 10px; }
.source-text { white-space: pre-wrap; font-size: .86rem; max-height: 340px; overflow: auto; background: #fafbfa; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }

.dlg { border: 0; border-radius: 14px; padding: 20px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dlg::backdrop { background: rgba(20, 30, 25, .45); }
.busy { text-align: center; }
.busy-steps { text-align: left; font-size: .9rem; padding-left: 20px; }
.busy-steps li.done { color: var(--ok); } .busy-steps li.now { font-weight: 700; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--brand-2); border-top-color: var(--brand); animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d2420; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); }

@media (max-width: 700px) {
  .top { gap: 8px; }
  .top-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .kv { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  h1 { font-size: 1.3rem; }
}
