:root {
  /* eDomovnice CID: měď (logo), zlatá (sada pro značku), černá */
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3ede4;
  --text: #151412;
  --muted: #6b625a;
  --line: #e8e0d4;
  --accent: #a8532a;        /* měď – odkazy, ikony, zvýraznění */
  --accent-ink: #ffffff;
  --accent-soft: #f6e7de;
  --gold: #d4aa4a;          /* zlatá – hlavní tlačítka (černý text) */
  --gold-ink: #151412;
  --gold-soft: #f7edd5;
  --ink: #151412;           /* černá plocha (AI tlačítka, bublina uživatele) */
  --on-ink: #ddb86a;
  --warn: #b5651d;
  --shadow: 0 1px 2px rgba(40, 28, 16, .06), 0 8px 24px rgba(40, 28, 16, .07);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110; --surface: #1b1a18; --surface-2: #252320; --text: #f2ede6;
    --muted: #a39a8f; --line: #34302b; --accent: #e0977b; --accent-ink: #1a0f0a;
    --accent-soft: #3a2519; --gold: #ddb86a; --gold-ink: #151412; --gold-soft: #3a3020;
    --ink: #ddb86a; --on-ink: #151412; --warn: #e3a35f; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --surface: #1b1a18; --surface-2: #252320; --text: #f2ede6;
  --muted: #a39a8f; --line: #34302b; --accent: #e0977b; --accent-ink: #1a0f0a;
  --accent-soft: #3a2519; --gold: #ddb86a; --gold-ink: #151412; --gold-soft: #3a3020;
  --ink: #ddb86a; --on-ink: #151412; --warn: #e3a35f; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.55 "Open Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.accent { color: var(--accent); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 600; color: var(--accent); margin: 0 0 .5rem; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; text-decoration: none; display: flex; gap: .5rem; align-items: center; font-size: 1.1rem; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #e0977b, #a8532a); color: #fff; }
.brand img { display: block; height: 48px; width: auto; }
@media (max-width: 640px) { .brand img { height: 38px; } }
.topnav { display: flex; gap: 1.25rem; align-items: center; font-size: .95rem; }
.topnav a { text-decoration: none; color: var(--muted); }
.topnav a.btn { color: var(--text); }
.topnav a.back-home:hover { color: var(--accent); }
.footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--accent); }
@media (max-width: 640px) { .topnav { gap: .75rem; font-size: .9rem; } }

/* buttons */
.btn { border: 1px solid transparent; border-radius: 10px; padding: .6rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.btn-primary { background: var(--gold); color: var(--gold-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-lg { padding: .8rem 1.3rem; font-size: 1rem; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; color: var(--muted); font-size: 1.1rem; }

/* hero */
main { padding: 0 clamp(16px, 4vw, 48px); max-width: 1280px; margin: 0 auto; }
.hero { padding: clamp(24px, 5vw, 56px) 0 24px; }
.hero-copy { max-width: 760px; margin-bottom: 28px; }
.lede { font-size: 1.1rem; color: var(--muted); margin: .75rem 0 0; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head > div { display: flex; flex-direction: column; }
.agent-id { flex-direction: row !important; gap: 10px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.1rem; }
.avatar img { width: 24px; height: auto; display: block; }
.status { font-size: .8rem; color: var(--muted); }
.status.thinking::after { content: " · přemýšlí…"; color: var(--accent); }

/* chat */
.chat, .brain { height: 640px; }
@media (max-width: 900px) { .chat { height: 560px; } .brain { height: auto; max-height: none; } }
.messages { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; animation: pop .2s ease-out; }
.msg.agent { background: var(--surface-2); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.user { background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 4px; align-self: flex-end; }
.msg.note { align-self: center; font-size: .82rem; color: var(--muted); background: none; padding: 2px 8px; }
.msg.typing { color: var(--muted); }
.msg.typing span { animation: blink 1.2s infinite; }
.msg.typing span:nth-child(2) { animation-delay: .2s; }
.msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; }
.chip { border: 1px solid var(--accent); color: var(--accent); background: var(--surface); border-radius: 999px; padding: .4rem .85rem; font: inherit; font-size: .9rem; cursor: pointer; }
.chip:hover, .chip.selected { background: var(--accent); color: var(--accent-ink); }
.chip.confirm { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.composer input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 10px; padding: .6rem .8rem; font: inherit; }
.composer input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* brain */
.brain { min-height: 0; }
.pill { background: var(--gold-soft); color: var(--text); border-radius: 999px; padding: .2rem .6rem; font-weight: 600; font-size: .85rem; }
.progress { height: 4px; background: var(--surface-2); }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .5s ease; }
.facts { position: relative; margin: 0; padding: 4px 16px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.fact { padding: 7px 0; border-bottom: 1px dashed var(--line); animation: pop .3s ease-out; }
.fact:last-child { border-bottom: 0; }
.fact dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fact dd { margin: 2px 0 0; font-weight: 500; }
.fact.fresh dd { background: linear-gradient(90deg, var(--accent-soft), transparent); border-radius: 4px; }
.brain-empty { padding: 24px 16px; color: var(--muted); font-size: .92rem; }
.insight { margin: 6px 16px 16px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; font-size: .9rem; }

/* dashboard */
.dashboard { margin: 24px 0 40px; padding: clamp(18px, 3vw, 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); animation: pop .4s ease-out; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.dash-head > div { max-width: 720px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: .7rem 1rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.count { background: var(--surface-2); border-radius: 999px; padding: 0 .5rem; font-size: .8rem; margin-left: .25rem; }

.plan { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.step { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.step.done { opacity: .6; }
.step.done h3 { text-decoration: line-through; }
.step-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem; }
.step h3 { margin-bottom: 4px; }
.step p { margin: 2px 0; font-size: .92rem; }
.step .why { color: var(--muted); }
.step .meta { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.step .meta code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: .78rem; }
.step input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); margin-top: 4px; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: middle; }
.tag.opt { background: var(--surface-2); color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.card .cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; }
.card p { margin: 0; font-size: .92rem; }
.card .actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.card .actions button { flex: 1; font-size: .85rem; padding: .45rem .6rem; }
.card.accepted { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.card.dismissed { opacity: .45; }
.card.dismissed p { display: none; }

/* how */
.how { padding: 32px 0 56px; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.how-grid > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.how-grid p { color: var(--muted); margin: 0; font-size: .95rem; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 8px; }

.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 20px clamp(16px, 4vw, 48px); border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

/* step actions & help */
.step-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.step-actions .btn { font-size: .82rem; padding: .35rem .7rem; font-weight: 500; }
.btn-ai { background: var(--ink); color: var(--on-ink); }
.btn-ai:hover { filter: brightness(1.08); }
.lock { font-size: .7rem; background: rgba(221,184,106,.22); border-radius: 999px; padding: 0 6px; margin-left: 2px; }
.tag.premium { background: var(--ink); color: var(--on-ink); }
.step.premium { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.help { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }
.help h4 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.help ol, .help ul { margin: 0 0 10px; padding-left: 1.2rem; }
.help li { margin: 3px 0; }
.help .src { font-size: .78rem; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; font-size: .9rem; z-index: 50; animation: pop .2s ease-out; }

.tag.ai { background: var(--accent-soft); color: var(--accent); }
.step.featured { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
#aiHelpPrompt { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; font: inherit; font-size: .85rem; background: var(--bg); color: var(--text); resize: vertical; }
.paid-steps a { color: var(--accent); }
.connect { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 6px; padding: 8px 10px; }
.connect code { flex: 1; font-size: .85rem; white-space: normal; word-break: break-word; }

/* paywall */
dialog.wide { width: min(620px, calc(100vw - 32px)); }
.ai-points { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: .92rem; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.plan-opt { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; flex-direction: row !important; }
.plan-opt:has(input:checked) { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: var(--gold-soft); }
.plan-opt input { margin-top: 4px; accent-color: var(--accent); }
.plan-opt strong { display: block; }
.plan-opt .price { font-size: 1.15rem; font-weight: 700; display: block; margin: 2px 0; }
.paid-steps { padding-left: 1.2rem; display: grid; gap: 8px; margin: 0; }

/* dialog */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 24px; width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(21, 20, 18, .55); }
.lead-form { display: flex; flex-direction: column; gap: 12px; }
.lead-form label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
.lead-form input:not([type="checkbox"]) { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; font: inherit; background: var(--bg); color: var(--text); }
.lead-form label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
.lead-form label.check input { margin-top: 4px; accent-color: var(--accent); }
.lead-form label.check a { color: var(--accent); text-decoration: underline; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* zamčené placené rozšíření */
.btn[disabled] { opacity: .55; cursor: not-allowed; filter: none; }
.plans .plan-opt { cursor: default; }

/* avatar průvodce „dýchá“, když přemýšlí */
.avatar { position: relative; }
.avatar.thinking::after { content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--gold); border-right-color: transparent; border-bottom-color: transparent;
  animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .avatar.thinking::after { animation: none; } }

/* živá síť (mozek průvodce) jako pozadí celé stránky */
.page-viz { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .8;
  /* pod úvodním textem vlevo nahoře je síť ztlumená, aby nerušila čtení */
  -webkit-mask-image: radial-gradient(ellipse 55% 38% at 22% 22%, rgba(0,0,0,.18) 0%, rgba(0,0,0,.25) 55%, #000 100%);
          mask-image: radial-gradient(ellipse 55% 38% at 22% 22%, rgba(0,0,0,.18) 0%, rgba(0,0,0,.25) 55%, #000 100%); }
.page-viz canvas { position: absolute; inset: 0; display: block; }
.topbar, main, .footer { position: relative; z-index: 1; }
.topbar { z-index: 5; }
@media (max-width: 900px) { .page-viz { opacity: .35; -webkit-mask-image: none; mask-image: none; } }

/* formulář leadu: past na roboty a chybová hláška */
.lead-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { margin: 0; padding: .6rem .8rem; border-radius: 8px; background: #fdecea; color: #8a1c12; font-size: .88rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .form-error { background: #3a1a16; color: #f3b7ad; } }

/* heslo k účtu */
.lead-form fieldset.pw { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pw-wrap { display: flex; gap: 6px; }
.pw-wrap input { flex: 1; min-width: 0; }
.pw-eye { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 0 .7rem; font: inherit; font-size: .8rem; cursor: pointer; }
.pw-rules { list-style: none; margin: -2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .8rem; color: var(--muted); }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: var(--accent); }
.pw-rules li.ok::before { content: "✓ "; }
.pw-msg { margin: 0; font-size: .85rem; color: #b3261e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pw-msg { color: #f3b7ad; } }
:root[data-theme="dark"] .pw-msg { color: #f3b7ad; }

/* jméno a příjmení vedle sebe */
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .name-row { grid-template-columns: 1fr; } }

/* Ekosystém: karty z Katalogu */
.card.eco .badge { display: inline-block; margin-left: 6px; font-size: .7rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--text); vertical-align: middle; }
.card.eco .badge.free { background: var(--accent-soft); color: var(--accent); }
.card.eco .eco-why { color: var(--accent); font-weight: 600; font-size: .88rem; }
.card.eco .eco-price { color: var(--muted); font-size: .82rem; }
.card.eco .eco-link { margin-top: auto; align-self: flex-start; color: var(--accent); font-weight: 600; font-size: .88rem; text-decoration: none; }
.card.eco .eco-link:hover { text-decoration: underline; }
