/* Brändistudio Myyjäpaneeli – tumma, rauhallinen, nopea käyttää puhelun aikana.
   Merkkiväri: sormenjäljen violetinsininen. Vihreä = soita/onnistui, oranssi = kuuma, punainen = stop. */
@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "GeistMono"; src: url("/fonts/geist-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #0d0f1c; --bg-2: #12152a; --surface: #171a33; --surface-2: #1e2240; --line: #2a2f55; --line-2: #22264a;
  --ink: #eef0ff; --ink-2: #c4c8e8; --muted: #8a90b8;
  --accent: #8b93ff; --accent-2: #6f78f5; --accent-soft: rgb(139 147 255 / 0.14);
  --go: #2bd17e; --go-ink: #04140b; --go-soft: rgb(43 209 126 / 0.14);
  --hot: #ff9f43; --hot-soft: rgb(255 159 67 / 0.14);
  --bad: #ff5d6c; --bad-soft: rgb(255 93 108 / 0.13);
  --warn: #ffd166;
  --radius: 16px; --radius-sm: 10px;
  --f: "Bricolage", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "GeistMono", ui-monospace, Consolas, monospace;
  --shadow: 0 10px 30px -12px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; background: radial-gradient(1200px 600px at 85% -10%, rgb(111 120 245 / 0.18), transparent 60%), var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- yläpalkki ja navigaatio ---------- */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: rgb(13 15 28 / 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-2); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 0.75rem; }
.nav { display: flex; gap: 4px; margin-left: 18px; }
.nav button { background: none; border: 0; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); cursor: pointer; font-weight: 550; }
.nav button[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.nav button:hover { color: var(--ink); }
.top .spacer { flex: 1; }
.who { color: var(--muted); font-size: 0.9rem; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 8px; }
.linkbtn:hover { color: var(--ink); }

.bottomnav { display: none; }
@media (max-width: 760px) {
  .nav, .who { display: none; }
  .top { padding: 10px 14px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--bg-2); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav button { flex: 1; background: none; border: 0; color: var(--muted); padding: 6px 2px; font-size: 0.72rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
  .bottomnav button span { font-size: 1.25rem; line-height: 1; }
  .bottomnav button[aria-current="page"] { color: var(--accent); }
  main { padding-bottom: 90px !important; }
}

main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
@media (max-width: 760px) { main { padding: 14px 12px; } }

/* ---------- yleiset palikat ---------- */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .v { font-size: 1.7rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 0.85rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.hot { background: var(--hot-soft); color: var(--hot); border-color: transparent; }
.chip.go { background: var(--go-soft); color: var(--go); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.warn { background: rgb(255 209 102 / 0.13); color: var(--warn); border-color: transparent; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-weight: 650; cursor: pointer; text-decoration: none !important; min-height: 44px; transition: transform .08s ease, background .15s ease; }
.btn:hover { background: #262b52; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent-2); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--accent); }
.btn.go { background: var(--go); border-color: transparent; color: var(--go-ink); }
.btn.go:hover { filter: brightness(1.07); }
.btn.bad { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 0.9rem; border-radius: 10px; }
.btn.big { min-height: 58px; font-size: 1.15rem; border-radius: 16px; padding: 14px 20px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; min-height: 44px;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-size: 0.85rem; color: var(--ink-2); font-weight: 600; margin: 12px 0 6px; }

/* ---------- soittolista ---------- */
.listhead { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 7px 13px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.filters button[aria-pressed="true"] { background: var(--accent-2); border-color: transparent; color: #fff; }
.filters .n { opacity: 0.75; font-family: var(--mono); font-size: 0.8rem; margin-left: 4px; }
.search { flex: 1; min-width: 200px; max-width: 360px; }

.leads { display: grid; gap: 10px; }
.lead { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; transition: border-color .15s ease, transform .08s ease; text-align: left; width: 100%; color: inherit; }
.lead:hover { border-color: var(--line); background: #1a1d3a; }
.lead:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lead .name { font-weight: 700; font-size: 1.05rem; }
.lead .meta { color: var(--muted); font-size: 0.88rem; }
.lead .why { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.lead .call { font-family: var(--mono); color: var(--ink-2); font-size: 0.95rem; }
.lead.locked { opacity: 0.55; }
.lead.done { opacity: 0.6; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 6px; }

/* ---------- liidikortti (laatikko) ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgb(5 6 14 / 0.6); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); z-index: 60; background: var(--bg-2); border-left: 1px solid var(--line); overflow-y: auto; box-shadow: var(--shadow); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer header { position: sticky; top: 0; z-index: 2; background: rgb(18 21 42 / 0.95); backdrop-filter: blur(10px); padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: flex-start; }
.drawer header h2 { font-size: 1.3rem; }
.drawer .body { padding: 18px 20px 120px; display: grid; gap: 16px; }
.close { margin-left: auto; background: var(--surface-2); border: 1px solid var(--line); width: 40px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 1.2rem; flex: none; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.facts div { min-width: 0; }
.facts dt { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.opener { background: var(--accent-soft); border: 1px solid rgb(139 147 255 / 0.3); border-radius: var(--radius); padding: 14px 16px; }
.opener .l { font-size: 0.78rem; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.outcomes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.outcomes .btn { justify-content: flex-start; text-align: left; }
.outcomes .btn.sel { outline: 2px solid var(--accent); }
.when { display: flex; gap: 6px; flex-wrap: wrap; }
.history { display: grid; gap: 8px; }
.history .h { border-left: 2px solid var(--line); padding: 2px 0 2px 12px; font-size: 0.9rem; }
.history .h b { color: var(--ink); }

/* ---------- apuri ---------- */
.fab { position: fixed; right: 22px; bottom: 22px; z-index: 70; border-radius: 999px; padding: 14px 20px; background: var(--accent-2); color: #fff; border: 0; font-weight: 700; box-shadow: var(--shadow); cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 1rem; }
.fab:hover { background: var(--accent); }
@media (max-width: 760px) { .fab { bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; padding: 0; width: 54px; height: 54px; justify-content: center; font-size: 0; } .fab::before { content: "💬"; font-size: 1.5rem; } }
.helper { position: fixed; right: 18px; bottom: 18px; z-index: 80; width: min(460px, calc(100vw - 24px)); max-height: min(78vh, 760px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; animation: pop .15s ease-out; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 760px) { .helper { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-height: 86vh; } }
.helper header { padding: 14px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.helper .scroll { overflow-y: auto; padding: 14px 16px; display: grid; gap: 12px; }
.helper .objs { display: flex; flex-wrap: wrap; gap: 6px; }
.helper .objs-wrap { padding: 10px 16px 12px; border-bottom: 1px solid var(--line-2); }
.helper .objs.scrollx { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.helper .objs.scrollx button { flex: none; }
body.kortti-auki .fab { display: none; }
.helper .objs button { border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); padding: 6px 11px; border-radius: 999px; cursor: pointer; font-size: 0.88rem; font-weight: 600; }
.helper .objs button:hover { color: var(--ink); border-color: var(--accent); }
.answer { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; font-size: 1.02rem; }
.answer .q { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.answer.ai { border-color: rgb(139 147 255 / 0.4); }
.helper form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line-2); background: var(--bg-2); }
.helper form input { flex: 1; }
.typing::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

/* ---------- modaalit ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 90; background: rgb(5 6 14 / 0.7); display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: 92vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.paketit { display: grid; gap: 8px; }
.paketti { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--surface); }
.paketti input { margin: 0; accent-color: var(--accent); width: 18px; height: 18px; }
.paketti .p { font-weight: 700; }
.paketti .h { color: var(--muted); font-size: 0.88rem; grid-column: 2; }
.paketti .pr { color: var(--go); font-weight: 700; font-family: var(--mono); grid-row: 1 / span 2; grid-column: 3; text-align: right; }
.paketti:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.paylink { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px; }

/* ---------- tulokset, ohjeet, hallinta ---------- */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 120px; padding-top: 8px; }
.bars div { background: var(--accent-2); border-radius: 6px 6px 2px 2px; min-height: 3px; position: relative; }
.bars div.hot { background: var(--go); }
.bars-l { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; font-size: 0.7rem; color: var(--muted); text-align: center; margin-top: 6px; font-family: var(--mono); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; }
.tablewrap { overflow-x: auto; }
.section { display: grid; gap: 12px; margin-bottom: 26px; }
.qa { display: grid; gap: 10px; }
.qa details { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 16px; }
.qa summary { cursor: pointer; font-weight: 650; }
.qa details p { margin: 8px 0 2px; color: var(--ink-2); }
.steps { display: grid; gap: 10px; }
.step { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px; }
.step b { display: block; margin-bottom: 4px; color: var(--accent); }
.copybox { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 12px; }
.copybox code { flex: 1; overflow-wrap: anywhere; font-family: var(--mono); font-size: 0.85rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } .facts { grid-template-columns: 1fr 1fr; } }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100; background: var(--surface-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; max-width: calc(100vw - 32px); }
.toast.ok { border-color: rgb(43 209 126 / 0.5); }
.toast.err { border-color: rgb(255 93 108 / 0.6); }
@media (max-width: 760px) { .toast { bottom: calc(86px + env(safe-area-inset-bottom)); } }

/* ---------- kirjautuminen ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth .brand { margin-bottom: 18px; }
.auth .err { color: var(--bad); margin-top: 10px; min-height: 1.4em; font-weight: 600; }
.auth .btn { width: 100%; margin-top: 18px; }

.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); height: 74px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
