/* Pure Home myynti – ulkoasu. Mobiili ensin; samat värit kuin laskurissa. */

:root {
  --bg: #f3f4ef;
  --surface: #ffffff;
  --surface-muted: #f8f9f6;
  --text: #17231c;
  --text-soft: #3a4740;
  --muted: #6b766f;
  --border: #e1e5dd;
  --border-strong: #cdd4ca;
  --primary: #1f5b3f;
  --primary-dark: #163a2a;
  --primary-soft: #e5efe8;
  --accent: #93b33a;
  --accent-soft: #f0f5df;
  --danger: #b3261e;
  --danger-soft: #fbecea;
  --warning: #8a5a00;
  --warning-soft: #fff5dc;
  --warning-border: #efd38f;
  --blue: #24527a;
  --blue-soft: #e4eef8;
  --violet: #4f3a7a;
  --violet-soft: #efeaf8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 34, 24, .05), 0 4px 16px rgba(16, 34, 24, .05);
  --focus: 0 0 0 3px rgba(147, 179, 58, .45);

  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
a { color: var(--primary); text-underline-offset: 2px; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .75rem; letter-spacing: -.015em; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.icon { flex: none; vertical-align: -3px; }
.icon.flip { transform: rotate(180deg); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { color: var(--text-soft); font-size: 1.05rem; margin-top: 0; }
.hint { color: var(--muted); font-size: .88rem; margin: .3rem 0 0; }
.hint.centered { text-align: center; }
.error { color: var(--danger); font-size: .9rem; margin: .3rem 0 0; }
.notice { background: var(--warning-soft); border: 1px solid var(--warning-border); color: var(--warning); padding: .6rem .8rem; border-radius: var(--radius-sm); }

/* ---------- Yläpalkki ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: linear-gradient(180deg, #1a4532 0%, var(--primary-dark) 100%); color: #fff; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 .75rem; display: flex; align-items: center; gap: .75rem; min-height: 54px; }
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--primary-dark); }
.brand-text em { font-style: normal; font-weight: 500; color: #c9dc8f; }
.mainnav { display: flex; gap: .15rem; flex: 1; }
.mainnav a { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border-radius: 8px; color: rgba(255,255,255,.8); text-decoration: none; font-weight: 500; }
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.14); }
.usermenu { display: flex; align-items: center; gap: .2rem; }
.who { display: flex; align-items: center; gap: .45rem; font-weight: 600; margin-right: .2rem; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.15); font-size: .85rem; }
.usermenu-link { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; color: rgba(255,255,255,.85); background: none; border: 0; cursor: pointer; }
.usermenu-link:hover { background: rgba(255,255,255,.1); color: #fff; }
form.inline { display: inline; margin: 0; }

/* Puhelimessa päävalikko alapalkiksi, jotta se on peukalon ulottuvilla. */
@media (max-width: 760px) {
  .brand-text, .who-name { display: none; }
  .topbar-inner { justify-content: space-between; }
  .mainnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; justify-content: space-around;
    background: var(--primary-dark); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,.15);
  }
  .mainnav a { flex-direction: column; gap: .1rem; font-size: .72rem; padding: .35rem .4rem; min-width: 64px; }
  body { padding-bottom: 72px; }
  body.auth-page { padding-bottom: 0; }
}

/* ---------- Asettelu ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 1rem .75rem 2rem; }
.container.narrow { max-width: 560px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.page-head h1 { margin: 0; }
.flash { padding: .7rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; background: var(--blue-soft); color: var(--blue); }
.flash-success { background: var(--primary-soft); color: var(--primary); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.hero { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.hero h1 { margin-bottom: .25rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { display: grid; gap: .2rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.tile .icon { color: var(--primary); }
.tile span { color: var(--muted); font-size: .9rem; }

/* ---------- Painikkeet ja kentät ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover { border-color: var(--primary); }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.big { min-height: 52px; font-size: 1.05rem; padding: .7rem 1.3rem; }
.button.small { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.button.wide { width: 100%; }
.field { margin-bottom: .9rem; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: .3rem; color: var(--text-soft); }
.key::after { content: " •"; color: var(--accent); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], select, textarea {
  width: 100%; font: inherit; padding: .65rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); min-height: 46px;
}
textarea { resize: vertical; }
.has-error input, .has-error select { border-color: var(--danger); }
.field-grid { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .field-grid { grid-template-columns: 1fr 1fr; } .span-all { grid-column: 1 / -1; } }
label.check { display: flex; gap: .6rem; align-items: flex-start; margin: .5rem 0 1rem; font-weight: 500; }
label.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; }

/* ---------- Kirjautuminen ---------- */
.auth-page .container { padding-top: 3rem; }
.login-brand { text-align: center; margin-bottom: 1.25rem; }
.login-brand .brand-mark { width: 52px; height: 52px; margin: 0 auto .6rem; border-radius: 14px; }
.brand-title { margin: 0; }
.brand-title span { color: var(--accent); font-weight: 500; }
.login-brand p { color: var(--muted); margin: .2rem 0 0; }

/* ---------- Tapaamislista ---------- */
.meeting-list { list-style: none; margin: 0; padding: 0; }
.meeting-list li + li { border-top: 1px solid var(--border); }
.meeting-row { display: flex; align-items: center; gap: .75rem; padding: .75rem .25rem; color: var(--text); text-decoration: none; }
.meeting-row:hover { background: var(--surface-muted); }
.mr-main { display: grid; flex: 1; min-width: 0; }
.mr-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--blue-soft); color: var(--blue); white-space: nowrap; }
.pill.ok { background: var(--primary-soft); color: var(--primary); }
.pill.warn { background: var(--warning-soft); color: var(--warning); }

/* ---------- Uusi tapaaminen ---------- */
.type-choices { display: grid; gap: .5rem; }
.type-choice, .field label.type-choice { display: flex; margin: 0; gap: .75rem; align-items: center; padding: .8rem; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.type-choice input { width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.type-choice span { display: grid; }
.type-choice small { color: var(--muted); font-weight: 400; }
.type-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

/* ---------- Tapaamisen vaiheet ---------- */
.meeting-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.meeting-head > div { display: grid; flex: 1; min-width: 0; }
.meeting-head .back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.save-state { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.save-state.error { color: var(--danger); }

.stepnav { position: relative; overflow-x: auto; margin: 0 -.75rem .75rem; padding: 0 .75rem; scrollbar-width: none; }
.stepnav::-webkit-scrollbar { display: none; }
.stepnav ol { display: flex; gap: .35rem; list-style: none; margin: 0; padding: .1rem 0 .3rem; }
.stepnav li > button, .stepnav li > a {
  display: flex; align-items: center; gap: .4rem; white-space: nowrap; min-height: 40px;
  padding: .3rem .7rem .3rem .35rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); font: inherit; font-size: .88rem; cursor: pointer; text-decoration: none;
}
.stepnav .dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-muted); border: 1px solid var(--border-strong); font-size: .8rem; font-weight: 700; }
.stepnav .count { font-size: .72rem; font-weight: 700; background: var(--warning-soft); color: var(--warning); border-radius: 999px; padding: 0 .4rem; }
.stepnav li.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepnav li.partial .dot { border-color: var(--accent); background: var(--accent-soft); }
.stepnav li.current > button, .stepnav li.current > a { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }

.step-intro { margin-bottom: 1rem; }
.step-no { margin: 0; color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.step-intro h1 { margin-bottom: .2rem; }
.goal { font-size: 1.05rem; margin: 0 0 .6rem; }
.coach { display: flex; gap: .5rem; background: var(--accent-soft); border-left: 4px solid var(--accent); padding: .6rem .8rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0; color: var(--text-soft); font-size: .93rem; }
.coach .icon { margin-top: 2px; color: var(--primary); }
.step-body { border: 0; padding: 0; margin: 0; min-width: 0; }
.notes { margin-top: 1rem; }

.step-actions {
  position: sticky; bottom: 0; z-index: 40; display: flex; justify-content: space-between; gap: .75rem;
  padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(243,244,239,0) 0%, var(--bg) 30%);
}
.step-actions .button.primary { flex: 1; max-width: 340px; margin-left: auto; }
@media (max-width: 760px) { .step-actions { bottom: 64px; } }

/* Kohtakortit */
.items { display: grid; gap: .65rem; }
.item { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow); }
.item.required { border-left-color: var(--warning-border); }
.item.highlight { border-left-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft) 0, var(--surface) 40%); }
.item.is-checked { border-left-color: var(--primary); opacity: .82; }
.item-check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.item-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.item-check .box { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--border-strong); background: #fff; color: transparent; margin-top: 2px; }
.item-check input:checked + .box { background: var(--primary); border-color: var(--primary); color: #fff; }
.item-check input:focus-visible + .box { box-shadow: var(--focus); }
.item-head { display: grid; gap: .2rem; }
.item-head strong { font-size: 1.02rem; }
.say { margin: .5rem 0 0 2.6rem; color: var(--text-soft); }
.item .more { margin: .4rem 0 0 2.6rem; font-size: .9rem; }
.more summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.more p { margin: .35rem 0 0; color: var(--text-soft); }
.verify-note { color: var(--warning) !important; font-size: .88rem; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
.tag { font-size: .7rem; font-weight: 700; letter-spacing: .02em; padding: .08rem .45rem; border-radius: 999px; text-transform: uppercase; }
.tag-ask { background: var(--blue-soft); color: var(--blue); }
.tag-say { background: var(--violet-soft); color: var(--violet); }
.tag-req { background: var(--warning-soft); color: var(--warning); }
.tag-hit { background: var(--accent); color: var(--primary-dark); text-transform: none; }
.tag-verify { background: #fde3cf; color: #8a3b12; }

/* Motiivit */
.motives { margin-top: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px; padding: .45rem .85rem; cursor: pointer; background: #fff; font-weight: 500; min-height: 42px; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.chip:has(input:focus-visible) { box-shadow: var(--focus); }
.chip.static { background: var(--accent-soft); border-color: var(--accent); min-height: 0; padding: .15rem .6rem; margin: 0 .2rem .2rem 0; cursor: default; }
.motive-summary { margin: 0 0 .75rem; }

/* Vastaväitteet */
.objection summary { cursor: pointer; list-style-position: outside; }
.objection .answer { margin: .5rem 0 0; padding-left: 1.2rem; color: var(--text-soft); }
.objection .answer li + li { margin-top: .3rem; }
.objection.raised-kasitelty { border-left-color: var(--primary); }
.objection.raised-auki { border-left-color: var(--danger); }
.segmented { display: flex; margin-top: .7rem; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: grid; place-items: center; min-height: 42px; padding: .3rem; font-size: .85rem; font-weight: 600; text-align: center; cursor: pointer; color: var(--text-soft); }
.segmented label + label span { border-left: 1px solid var(--border-strong); }
.segmented input:checked + span { background: var(--primary-soft); color: var(--primary-dark); }
.segmented input[value=auki]:checked + span { background: var(--danger-soft); color: var(--danger); }
.segmented input:focus-visible + span { box-shadow: inset var(--focus); }

/* Seuraava askel */
.radio-list { display: grid; gap: .4rem; }
.radio-row { display: flex; align-items: center; gap: .7rem; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; min-height: 48px; }
.radio-row input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.radio-row:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

/* Yhteenveto */
.missing-card { border-color: var(--warning-border); background: var(--warning-soft); }
.missing-card h2 { color: var(--warning); }
.missing-card ul { margin: .2rem 0 0; padding-left: 1.2rem; }
.ok-card { border-color: var(--primary); background: var(--primary-soft); }
.ok-card h2 { color: var(--primary); margin: 0; }
.memo { font-family: inherit; font-size: .93rem; margin-top: .5rem; background: var(--surface-muted); }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 600; }
.danger-zone form { margin-top: .75rem; }

/* Hissipuheet ja faktapankki */
.pitch h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: .25rem; }
.pitch p { font-size: 1.05rem; }
.pitch details summary, .pitch-inline summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.pitch-inline p { margin-bottom: 0; }
.filter { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .2rem; }
.filter a { white-space: nowrap; padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; text-decoration: none; color: var(--text-soft); }
.filter a[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.lib-item { padding: .7rem 0; }
.lib-item + .lib-item { border-top: 1px solid var(--border); }
.lib-item .say { margin: .3rem 0 0; }
.lib-item .tags { margin-bottom: .25rem; }
.lib-item .answer { margin: .3rem 0 0; padding-left: 1.2rem; color: var(--text-soft); }
/* Ylläpito */
.admin-tabs { margin-bottom: 1rem; }
.admin-list { list-style: none; margin: .25rem 0 0; padding: 0; }
.admin-list li { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .7rem 0; scroll-margin-top: 80px; }
.admin-list li + li { border-top: 1px solid var(--border); }
.admin-list li.inactive .admin-main { opacity: .55; }
.admin-list li:target { background: var(--accent-soft); border-radius: var(--radius-sm); }
.admin-main { display: grid; gap: .15rem; flex: 1 1 260px; min-width: 0; }
.admin-main .tags:empty { display: none; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.row-actions form { margin: 0; }
.tag-off { background: #e8e8e8; color: #555; }
.tag-new { background: var(--blue-soft); color: var(--blue); }
.tag-edited { background: var(--primary-soft); color: var(--primary); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; gap: .1rem; padding: .5rem 0; }
.history li + li { border-top: 1px solid var(--border); }
.history-text { color: var(--text-soft); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; }
.table .num { text-align: right; white-space: nowrap; }
.warn-text { color: var(--danger); }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; align-items: center; }
.bar-label { grid-column: 1 / -1; }
.bar { width: 100%; height: 12px; }
.bar-value { font-weight: 700; font-size: .9rem; min-width: 3.2em; text-align: right; }
.report-filter .field-grid { margin-bottom: .25rem; }
.password-box { display: flex; gap: .5rem; align-items: center; margin: 1rem 0; }
.password-box input { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.2rem; letter-spacing: .05em; }
.segmented span { padding: .3rem .5rem; }
/* Käyttöohje */
.guide .card ul, .guide .card ol { padding-left: 1.2rem; margin: .4rem 0 0; }
.guide .card li + li { margin-top: .45rem; }
.guide section { scroll-margin-top: 70px; }
.guide-toc ol { margin: 0; }
.guide-steps { margin: .75rem 0 0; display: grid; grid-template-columns: max-content 1fr; gap: .55rem .9rem; }
.guide-steps dt { font-weight: 700; color: var(--primary-dark); }
.guide-steps dd { margin: 0; color: var(--text-soft); }
@media (max-width: 520px) { .guide-steps { grid-template-columns: 1fr; gap: .1rem; } .guide-steps dd { margin-bottom: .5rem; } }
.error-code { font-size: 2.5rem; font-weight: 800; color: var(--border-strong); margin: 0; }
