/* Návrh B „Svieži“: fialovomodrý akcent, farebné dlaždice, zaoblené tvary. */
:root {
  --bg: #f3f4fb; --panel: #ffffff; --panel-2: #f7f7fd; --text: #1c1b2e; --muted: #6b6a85; --line: #e3e3f1;
  --accent: #534ab7; --accent-hover: #463ea3; --accent-soft: #eeedfe; --accent-text: #3c3489; --on-accent: #ffffff;
  --ok: #0f6e56; --ok-soft: #e1f5ee; --warn: #854f0b; --warn-soft: #faeeda; --bad: #a32d2d; --bad-soft: #fcebeb;
  --t1: #eeedfe; --t1-text: #3c3489; --t2: #e1f5ee; --t2-text: #085041; --t3: #faece7; --t3-text: #712b13; --t4: #faeeda; --t4-text: #633806;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 27, 46, .04), 0 6px 20px rgba(28, 27, 46, .05);
  --tabbar-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12121f; --panel: #1b1b2d; --panel-2: #222238; --text: #ecebf7; --muted: #a09fba; --line: #2d2c47;
    --accent: #8b83f0; --accent-hover: #a29cf5; --accent-soft: #2a2650; --accent-text: #cecbf6; --on-accent: #15122e;
    --ok: #5dcaa5; --ok-soft: #0f3a30; --warn: #fac775; --warn-soft: #3a2a10; --bad: #f09595; --bad-soft: #3c1a1a;
    --t1: #2a2650; --t1-text: #cecbf6; --t2: #0f3a30; --t2-text: #9fe1cb; --t3: #3f2116; --t3-text: #f5c4b3; --t4: #3a2a10; --t4-text: #fac775;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14.5px/1.55 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, system-ui, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.015em; font-weight: 650; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 22px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--on-accent); }
.logo .ico { width: 19px; height: 19px; stroke-width: 1.9; }
.account { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }

.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 53px); }
.nav { padding: 14px 12px; border-right: 1px solid var(--line); background: var(--panel); }
.nav-group { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .03em; margin: 14px 12px 6px; }
.nav-group:first-child { margin-top: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; color: var(--text); text-decoration: none; cursor: pointer; margin-bottom: 2px; }
.nav a .ico { color: var(--muted); }
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav a.active .ico { color: var(--accent); }
.main { padding: 26px 30px 70px; max-width: 1180px; width: 100%; }
.tabbar, .sheet-backdrop, .nav-close { display: none; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); overflow-x: auto; min-width: 0; }
.card + .card { margin-top: 14px; }
.grid .card + .card { margin-top: 0; }
.stat { font-size: 30px; font-weight: 650; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; }
.tile .tile-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.tile .tile-sub { font-size: 12px; opacity: .8; }
.tile.t1 { background: var(--t1); color: var(--t1-text); }
.tile.t2 { background: var(--t2); color: var(--t2-text); }
.tile.t3 { background: var(--t3); color: var(--t3-text); }
.tile.t4 { background: var(--t4); color: var(--t4-text); }
.hero { display: flex; gap: 14px; align-items: flex-start; }
.hero-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; white-space: nowrap; transition: border-color .15s, background .15s, transform .05s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

input[type=text], input[type=number], input[type=search], input[type=password], select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 11px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }
label.field { display: grid; gap: 4px; margin-bottom: 12px; }
label.field span { font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ellipsis { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--accent-soft); color: var(--accent-text); margin: 1px 3px 1px 0; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.grey { background: var(--panel-2); color: var(--muted); }
.unread { font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px; text-align: center; background: var(--panel); cursor: pointer; transition: .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { display: block; font-size: 16px; margin-bottom: 4px; }

.rule { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 10px; }
.rule-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.rule-head .name { font-weight: 600; }
.rule-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.rule.off .rule-head { opacity: .55; }
.cond, .act { display: grid; grid-template-columns: 220px 150px 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.act { grid-template-columns: 220px 1fr auto; }
.act .params { display: flex; gap: 6px; flex-wrap: wrap; }
.act .params input { flex: 1 1 160px; }
.section-label { font-size: 12px; color: var(--muted); font-weight: 600; margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.hint { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; font-size: 12px; color: var(--muted); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.result-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.result-item:last-child { border-bottom: 0; }
.step { font-size: 13px; margin-left: 12px; }
.step.err { color: var(--bad); }

.breadcrumb { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.breadcrumb a { cursor: pointer; }

.banner { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--accent-soft); color: var(--accent-text); }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; max-width: 420px; box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 20; }
.toast.error { background: var(--bad); color: #fff; }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.loading { color: var(--muted); padding: 20px 0; }

/* ---------- Mobil: spodná lišta a menu Viac ---------- */
@media (max-width: 860px) {
  :root { --tabbar-h: calc(64px + env(safe-area-inset-bottom)); }
  .top { padding: 10px 16px; }
  .account > span:not(.chip), .account .btn { display: none; }
  .brand { white-space: nowrap; }
  .layout { grid-template-columns: 1fr; min-height: 0; }
  .main { padding: 18px 16px calc(var(--tabbar-h) + 28px); }
  h1 { font-size: 23px; }
  .cond, .act { grid-template-columns: 1fr; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-height: 82vh; overflow-y: auto; border: 0; border-radius: 22px 22px 0 0;
    padding: 10px 14px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .18); transform: translateY(105%); transition: transform .22s ease; }
  .nav::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 6px; }
  .nav a { padding: 11px 12px; font-size: 15px; }
  .nav-close { display: flex; justify-content: center; margin-top: 8px; }
  body.more-open .nav { transform: none; }
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 10, 25, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.more-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--tabbar-h);
    padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; align-content: center; gap: 3px; font: inherit; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
  .tabbar .ico { width: 23px; height: 23px; }
  .tabbar .pill { display: grid; place-items: center; width: 54px; height: 30px; border-radius: 99px; transition: background .15s; }
  .tabbar .active { color: var(--accent-text); }
  .tabbar .active .pill { background: var(--accent-soft); color: var(--accent); }
  .toast { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 12px); max-width: none; }
  body.locked .tabbar { display: none; }
}

/* ---------- Kouč ---------- */
.coach-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.coach-side { position: sticky; top: 64px; }
.topic-list { list-style: none; margin: 12px 0; padding: 0; }
.topic-list a { display: block; padding: 8px 12px; border-radius: 12px; color: var(--text); text-decoration: none; }
.topic-list a:hover { background: var(--panel); }
.topic-list a.active { background: var(--accent-soft); }
.topic-list .ellipsis { max-width: 100%; }
.profile summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 8px; }
.profile textarea { width: 100%; margin-top: 6px; }
.coach-main { min-width: 0; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { border-radius: 18px; padding: 11px 15px; max-width: 760px; }
.bubble.user { align-self: flex-end; background: var(--accent-soft); color: var(--accent-text); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bubble.coach { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); width: 100%; }
.bubble-actions { margin-top: 6px; opacity: .55; }
.bubble.coach:hover .bubble-actions { opacity: 1; }
.thinking { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; position: sticky; bottom: 0; background: var(--bg); padding: 8px 0; }
.composer textarea { flex: 1; resize: vertical; }
.composer-actions { display: flex; flex-direction: column; gap: 6px; }
.mic { justify-content: center; }
.mic .ico { width: 17px; height: 17px; }
.mic.recording { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); animation: pulse 1.4s ease-in-out infinite; }
@media (max-width: 600px) { .composer .mic .mic-label { display: none; } .composer .mic { padding: 8px 11px; } }
.md p { margin: 0 0 8px; }
.md h3, .md h4, .md h5 { margin: 12px 0 6px; font-size: 15px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li { margin-bottom: 3px; }
.md > :last-child { margin-bottom: 0; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.mode { display: grid; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
.mode:hover { border-color: var(--accent); }
.mode.selected { border-color: var(--accent); background: var(--accent-soft); }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 6px; }
@media (max-width: 860px) { .coach-layout { grid-template-columns: 1fr; } .coach-side { position: static; } }

/* ---------- Prihlásenie ---------- */
body.locked .nav { display: none; }
body.locked .layout { grid-template-columns: 1fr; }
body.locked .main { display: grid; place-items: start center; padding-top: 8vh; max-width: none; }
.login { width: min(400px, 100%); }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; margin-bottom: 18px; }
.login input { width: 100%; font-size: 16px; padding: 9px 11px; }
.login .btn { width: 100%; justify-content: center; padding: 10px; }
.login-error { color: var(--bad); min-height: 1.2em; margin: 4px 0 10px; font-size: 13px; }

/* ---------- Test osobnosti ---------- */
.test-link { display: grid; gap: 2px; margin-top: 8px; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; }
.test-link:hover { border-color: var(--accent); }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 8px 0 6px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
.test-info { margin: 10px 0 0; padding-left: 20px; }
.test-info li { margin-bottom: 4px; }
.test-modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 10px; margin: 14px 0; }
.test-module { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 12px 14px; }
.test-module-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.test-page { max-width: 760px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 4px; }
.questions { display: grid; gap: 10px; margin: 12px 0; }
.q { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 12px 14px; transition: border-color .15s; }
.q.done { border-color: var(--accent-soft); }
.q-text { margin: 0 0 10px; }
.q-num { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.scale5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale5 button { font: inherit; padding: 10px 0; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.scale5 button:hover { border-color: var(--accent); }
.scale5 button.selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.q.bipolar { display: grid; grid-template-columns: 1fr minmax(200px, 240px) 1fr; gap: 12px; align-items: center; }
.q.bipolar .pole { font-size: 14px; }
.q.bipolar .pole.right { text-align: right; }
.options { display: grid; gap: 6px; }
.option { display: grid; gap: 2px; text-align: left; font: inherit; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.option:hover { border-color: var(--accent); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.q.open { display: grid; gap: 8px; }
.q.open .q-text { margin: 0; font-weight: 500; }
.q.open textarea { width: 100%; resize: vertical; }
.test-nav { margin-top: 6px; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
.res-list { display: grid; gap: 14px; }
.res-notes { margin: 8px 0 4px; padding-left: 20px; }
.res-group h3 { font-size: 14px; margin: 14px 0 6px; }
.res-row { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 70px; gap: 10px; align-items: center; margin: 4px 0; font-size: 14px; }
.res-bar { position: relative; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.res-bar span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.res-bar span.risk { background: var(--warn); }
.res-bar.two { overflow: visible; background: linear-gradient(90deg, var(--accent-soft), var(--line) 50%, var(--accent-soft)); }
.res-bar.two i { position: absolute; top: -3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.res-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
@media (max-width: 600px) {
  .q.bipolar { grid-template-columns: 1fr 1fr; }
  .q.bipolar .scale5 { grid-column: 1 / -1; grid-row: 2; }
  .res-row { grid-template-columns: 1fr 64px; }
  .res-row .res-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Passkey ---------- */
.passkey-btn { margin-bottom: 4px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 12px 0 10px; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.passkeys { list-style: none; margin: 8px 0 0; padding: 0; }
.passkeys li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.passkeys li:first-child { border-top: 0; }

/* lepkavé spodné panely v mobile nad spodnou lištou (musí byť až za ich pravidlami) */
@media (max-width: 860px) {
  .composer, .test-nav { bottom: var(--tabbar-h); }
}

/* ---------- Zistenia ---------- */
.notes { display: grid; gap: 12px; }
.notes .card + .card { margin-top: 0; }
.note-pin { color: var(--accent); display: inline-grid; padding-top: 2px; }
.note-actions { flex-wrap: wrap; justify-content: flex-end; }
.note-meta { margin-top: 10px; }
.note-meta a.chip { text-decoration: none; }
.note-editor { margin: 8px 0 4px; }
.note-editor input[type=text], .note-editor textarea { width: 100%; }
.insights { display: grid; gap: 10px; margin: 10px 0 12px; }
.insight { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.insight.off { opacity: .5; }
@media (max-width: 600px) { .note-actions { width: 100%; justify-content: flex-start; } }
