/* Isäntä: vastaanoton huonetaulu. Vasen valikko + yksi työalue, hairline-rivit paneelien sijaan.
   LH:n brändiohje 15.9.2026: kerma / muste / tumma kulta, Cormorant Garamond luvuille ja otsikoille, Manrope käyttöliittymälle. */
:root {
  --paper: #FAF8F4;
  --surface: #FFFFFF;
  --sunk: #F2EEE6;
  --ink: #1D1E22;
  --muted: #5E6068;
  --faint: #8A8A8F;
  --line: #E6E0D4;
  --line-strong: #D2C9B7;
  --gold: #C9A24E;
  --gold-ink: #684F2B;
  --gold-soft: #F3EAD3;
  --ok: #3B7650; --ok-soft: #E2EFE5;
  --warn: #9A6513; --warn-soft: #F7ECD6;
  --crit: #A93D2C; --crit-soft: #F6E0DA;
  --ch-booking: #4A6382; --ch-airbnb: #C2594F; --ch-vrbo: #6E7F4B; --ch-direct: #B8902F; --ch-owner: #A9A397;
  --bar-text: #FFFFFF;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-ui: "Manrope", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --day: 46px;
  --namecol: 230px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F0F0F; --surface: #17171A; --sunk: #1D1D21; --ink: #EEEAE2; --muted: #A9A59C; --faint: #7D7A73;
    --line: #2A2A2F; --line-strong: #3B3B42; --gold: #C9A24E; --gold-ink: #D9B565; --gold-soft: #2A2418;
    --ok: #74B98A; --ok-soft: #16251B; --warn: #E3AE52; --warn-soft: #2B2213; --crit: #E68571; --crit-soft: #2E1915;
    --ch-booking: #6F8DB3; --ch-airbnb: #CF6E64; --ch-vrbo: #869A5E; --ch-direct: #C9A24E; --ch-owner: #5A5650;
    --bar-text: #0F0F0F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0F0F0F; --surface: #17171A; --sunk: #1D1D21; --ink: #EEEAE2; --muted: #A9A59C; --faint: #7D7A73;
  --line: #2A2A2F; --line-strong: #3B3B42; --gold: #C9A24E; --gold-ink: #D9B565; --gold-soft: #2A2418;
  --ok: #74B98A; --ok-soft: #16251B; --warn: #E3AE52; --warn-soft: #2B2213; --crit: #E68571; --crit-soft: #2E1915;
  --ch-booking: #6F8DB3; --ch-airbnb: #CF6E64; --ch-vrbo: #869A5E; --ch-direct: #C9A24E; --ch-owner: #5A5650;
  --bar-text: #0F0F0F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.num, table, .stat b, .rack { font-variant-numeric: tabular-nums; }

/* ---------- Kehys ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line); padding: 22px 14px 18px;
  display: flex; flex-direction: column; gap: 22px; background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.brand img { height: 30px; width: auto; }
.brand span { font-family: var(--font-display); font-weight: 600; font-size: 25px; letter-spacing: .01em; line-height: 1; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: inline; } }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 3px;
  text-decoration: none; color: var(--muted); font-weight: 500;
}
.nav a:hover { color: var(--ink); background: var(--sunk); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--gold-soft); font-weight: 600; }
.nav svg, .tabbar svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--crit); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 8px; font-size: 12.5px; color: var(--muted); }
.demo-flag { border: 1px solid var(--line-strong); padding: 8px 10px; border-radius: 3px; line-height: 1.45; }
.demo-flag b { color: var(--ink); }
.theme-btn { background: none; border: 1px solid var(--line-strong); border-radius: 3px; padding: 6px 10px; cursor: pointer; text-align: left; color: var(--muted); }
.theme-btn:hover { color: var(--ink); }

main { min-width: 0; padding: 30px 36px 64px; }
.wrap { max-width: 1240px; }

.topbar, .tabbar { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--paper); border-bottom: 1px solid var(--line);
  }
  .topbar img { height: 24px; }
  .topbar .t { font-weight: 700; font-size: 15px; }
  .topbar .demo-pill { margin-left: auto; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); border: 1px solid var(--line-strong); padding: 3px 7px; border-radius: 3px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--paper); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; text-decoration: none; font-size: 11px; font-weight: 600; color: var(--faint); }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] svg { stroke: var(--gold); }
  main { padding: 18px 16px calc(92px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Typografia ja yleiset ---------- */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin-bottom: 26px; }
.head > div { min-width: 0; }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); font-weight: 600; margin: 0 0 6px; }
h1 { font-family: var(--font-display); font-weight: 600; font-size: 40px; line-height: 1.05; margin: 0; text-wrap: balance; letter-spacing: -.005em; }
.lead { color: var(--muted); max-width: 68ch; margin: 8px 0 0; }
.head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
h2.sec {
  display: flex; align-items: baseline; gap: 10px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin: 34px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong);
}
h2.sec .more { margin-left: auto; letter-spacing: 0; text-transform: none; font-weight: 600; font-size: 13px; color: var(--gold-ink); text-decoration: none; }
h2.sec .more:hover { text-decoration: underline; }
h3 { font-size: 15px; margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.back { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; color: var(--muted); font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.back svg, .btn svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border: 1px solid var(--line-strong);
  border-radius: 3px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.quiet { background: none; }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 3px; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.gold { background: var(--gold-soft); color: var(--gold-ink); }

.ch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ch::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--c, var(--faint)); }
.ch.booking { --c: var(--ch-booking); } .ch.airbnb { --c: var(--ch-airbnb); } .ch.vrbo { --c: var(--ch-vrbo); } .ch.direct { --c: var(--ch-direct); } .ch.owner { --c: var(--ch-owner); }

/* ---------- Tunnusluvut ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.stat { padding: 14px 16px 14px 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.stat + .stat { padding-left: 16px; border-left: 1px solid var(--line); }
.stat b { font-family: var(--font-display); font-weight: 600; font-size: 42px; line-height: 1; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat small { font-size: 12px; color: var(--faint); }
a.stat:hover b { color: var(--gold-ink); }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat, .stat + .stat { padding: 12px 12px 12px 0; border-left: 0; }
  .stat:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat b { font-size: 34px; }
}

/* ---------- Rivilistat ---------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: grid; gap: 4px 18px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line);
  text-decoration: none; min-width: 0;
}
.row > * { min-width: 0; }
a.row:hover { background: linear-gradient(90deg, transparent, var(--sunk) 8%, var(--sunk) 92%, transparent); }
.row .title, .row .sub { display: block; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .right { text-align: right; }

.alert { display: grid; grid-template-columns: 3px minmax(0, 1fr) auto; gap: 0 16px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.alert::before { content: ""; align-self: stretch; background: var(--sev, var(--faint)); border-radius: 1px; }
.alert.crit { --sev: var(--crit); } .alert.warn { --sev: var(--warn); } .alert.info { --sev: var(--gold); }
.alert h3 { font-size: 15px; margin-bottom: 3px; }
.alert p { margin: 0; color: var(--muted); font-size: 14px; max-width: 78ch; }
.alert .act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 700px) { .alert { grid-template-columns: 3px minmax(0, 1fr); } .alert .act { grid-column: 2; justify-content: flex-start; margin-top: 10px; } }

.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
@media (max-width: 1000px) { .cols { grid-template-columns: minmax(0, 1fr); } }

.arr-row { grid-template-columns: 54px minmax(0, 1fr) auto; }
.arr-row .time { font-weight: 700; font-size: 15px; }

/* ---------- Taulukot ---------- */
.tablewrap { overflow-x: auto; border-top: 1px solid var(--line-strong); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--sunk); }
td a.plain { text-decoration: none; font-weight: 600; }
td a.plain:hover { text-decoration: underline; }
tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line-strong); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.filters button { border: 1px solid var(--line-strong); background: none; padding: 6px 11px; border-radius: 3px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Huonetaulu (kalenteri) ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -8px 0 14px; color: var(--muted); }
.rackwrap { overflow-x: auto; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); position: relative; }
.rack { display: grid; min-width: max-content; }
.rack-row { display: grid; grid-template-columns: var(--namecol) repeat(var(--days), var(--day)); position: relative; }
.rack-row + .rack-row { border-top: 1px solid var(--line); }
.rack-name {
  grid-column: 1; grid-row: 1; position: sticky; left: 0; z-index: 3; background: var(--paper);
  padding: 8px 12px 8px 0; border-right: 1px solid var(--line); min-width: 0; text-decoration: none;
}
.rack-name b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rack-name span { font-size: 11.5px; color: var(--faint); }
.rack-head .rack-name { background: var(--paper); }
.dayh { grid-row: 1; text-align: center; padding: 8px 0 6px; font-size: 11px; color: var(--muted); line-height: 1.25; }
.dayh b { display: block; font-size: 14px; color: var(--ink); font-weight: 700; }
.cell { grid-row: 1; border-left: 1px solid var(--line); font-size: 10.5px; color: var(--faint); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3px; min-height: 48px; }
.cell.we { background: var(--sunk); }
.cell.today, .dayh.today { box-shadow: inset 2px 0 0 var(--gold), inset -2px 0 0 var(--gold); }
.dayh.today b { color: var(--gold-ink); }
.bar {
  grid-row: 1; align-self: center; z-index: 2; height: 30px; border-radius: 3px; background: var(--c);
  color: var(--bar-text); font-size: 12px; font-weight: 700; padding: 0 8px; display: flex; align-items: center; gap: 6px;
  overflow: hidden; white-space: nowrap; text-decoration: none; margin: 0 2px; min-width: 0;
}
.bar span { overflow: hidden; text-overflow: ellipsis; }
.bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.bar.booking { --c: var(--ch-booking); } .bar.airbnb { --c: var(--ch-airbnb); } .bar.vrbo { --c: var(--ch-vrbo); } .bar.direct { --c: var(--ch-direct); }
.bar.owner { --c: var(--ch-owner); background: repeating-linear-gradient(135deg, var(--ch-owner) 0 6px, transparent 6px 12px); color: var(--ink); border: 1px solid var(--ch-owner); }
.bar.flag { outline: 2px solid var(--crit); outline-offset: 1px; }
.bar:hover { filter: brightness(1.06); }
@media (max-width: 900px) { :root { --namecol: 132px; --day: 40px; } .rack-name b { font-size: 12px; } }

/* ---------- Varauksen sivu ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 48px; }
@media (max-width: 1000px) { .detail { grid-template-columns: minmax(0, 1fr); } }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 0; }
.kv > div { padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.kv > div:nth-child(odd) { color: var(--muted); font-size: 13.5px; }
.money { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.money > div { padding: 8px 0; border-bottom: 1px solid var(--line); }
.money > div:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.money .total { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line-strong); }
.money .neg { color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; border: 2px solid var(--line-strong); }
.timeline .done .dot { background: var(--ok); border-color: var(--ok); }
.timeline .next .dot { border-color: var(--gold); background: var(--gold-soft); }
.timeline .when { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.timeline p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.note { border-left: 3px solid var(--gold); background: var(--gold-soft); padding: 12px 14px; font-size: 14px; margin: 14px 0; }
.note.crit { border-color: var(--crit); background: var(--crit-soft); }

/* ---------- Viestit ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); border-top: 1px solid var(--line-strong); min-height: 560px; }
.threads { border-right: 1px solid var(--line); }
.thread-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 13px 14px 13px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.thread-link[aria-current="page"] { background: var(--gold-soft); padding-left: 10px; }
.thread-link .who { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-link .when { font-size: 12px; color: var(--faint); }
.thread-link .prev { grid-column: 1 / -1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-link .meta { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.unread .who::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--crit); margin-left: 7px; vertical-align: middle; }
.conv { display: flex; flex-direction: column; min-width: 0; padding: 0 0 0 26px; }
.conv-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.msgs { display: flex; flex-direction: column; gap: 12px; padding: 18px 0; }
.msg { max-width: 72%; padding: 10px 13px; border-radius: 3px; background: var(--sunk); font-size: 14.5px; }
.msg.out { align-self: flex-end; background: var(--surface); border: 1px solid var(--line-strong); }
.msg small { display: block; font-size: 11.5px; color: var(--faint); margin-top: 5px; }
.draft { border: 1px solid var(--gold); background: var(--surface); padding: 14px; margin-top: 4px; }
.draft .lbl { display: flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 8px; }
.draft textarea { width: 100%; min-height: 130px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); padding: 10px; font: 14.5px/1.5 var(--font-ui); border-radius: 2px; resize: vertical; }
.draft .why { font-size: 12.5px; color: var(--muted); margin: 8px 0 10px; }
.draft .btns { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .inbox { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .inbox.has-thread .threads { display: none; }
  .inbox:not(.has-thread) .conv { display: none; }
  .threads { border-right: 0; }
  .conv { padding: 0; }
  .msg { max-width: 88%; }
}

/* ---------- Siivous ---------- */
.lanes { border-top: 1px solid var(--line-strong); }
.lane { display: grid; grid-template-columns: 120px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.lane-name { padding: 12px 0; font-weight: 700; }
.lane-name small { display: block; font-weight: 500; color: var(--faint); font-size: 12px; }
.lane-track { position: relative; height: 64px; background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / 9)); }
.lane-hours { display: grid; grid-template-columns: 120px minmax(0, 1fr); font-size: 11.5px; color: var(--faint); }
.lane-hours div:last-child { display: grid; grid-template-columns: repeat(9, 1fr); }
.job { text-decoration: none; position: absolute; top: 10px; height: 44px; border-radius: 3px; padding: 4px 8px; font-size: 12px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 1px solid var(--line-strong); background: var(--surface); }
.job.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.job.doing { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-ink); }
.job.late { background: var(--crit-soft); border-color: var(--crit); color: var(--crit); }
.job small { display: block; font-weight: 500; opacity: .85; }
.now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--crit); z-index: 2; }
@media (max-width: 900px) { .lanes-scroll { overflow-x: auto; } .lanes, .lane-hours { min-width: 760px; } }

.clean-row { grid-template-columns: minmax(0, 1.6fr) 120px 150px minmax(0, 1fr) auto; }
@media (max-width: 900px) { .clean-row { grid-template-columns: minmax(0, 1fr) auto; } .clean-row .hide-m { display: none; } }

/* ---------- Hinnoittelu ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font-ui); }
.chart .l-pl { stroke: var(--ink); stroke-width: 2; fill: none; }
.chart .l-shadow { stroke: var(--gold); stroke-width: 2.5; fill: none; }
.chart .l-market { stroke: var(--faint); stroke-width: 1.5; fill: none; stroke-dasharray: 4 4; }
.chart .booked { fill: var(--sunk); }
.chart .todayline { stroke: var(--gold); stroke-width: 1; }
.chart .dotend { fill: var(--gold); }
.keys { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin: 6px 0 12px; }
.keys i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.keys .k-pl i { border-color: var(--ink); } .keys .k-sh i { border-color: var(--gold); border-top-width: 3px; } .keys .k-mk i { border-color: var(--faint); border-top-style: dashed; }
.keys .k-bk i { border: 0; width: 14px; height: 10px; background: var(--sunk); outline: 1px solid var(--line-strong); }
select { font: inherit; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface); color: var(--ink); max-width: 100%; }

/* ---------- Miten toimii ---------- */
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr) 44px minmax(0, 1.3fr); align-items: stretch; margin: 8px 0 6px; }
.node { border: 1px solid var(--line-strong); background: var(--surface); padding: 14px 16px; border-radius: 3px; }
.node.core { border: 2px solid var(--gold); }
.node h3 { font-size: 15px; margin-bottom: 6px; }
.node ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.node .tag { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; display: block; margin-bottom: 4px; }
.flow-arrow { display: flex; align-items: center; justify-content: center; color: var(--gold-ink); font-size: 20px; }
.svc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 1000px) { .flow { grid-template-columns: minmax(0, 1fr); } .flow-arrow { height: 34px; transform: rotate(90deg); } .svc { grid-template-columns: minmax(0, 1fr); } }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(s); font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 1; color: var(--gold-ink); }
.steps b { display: block; }
.steps span { color: var(--muted); font-size: 14px; }
.phases { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); }
.phase { padding: 14px 16px 14px 0; }
.phase + .phase { padding-left: 16px; border-left: 1px solid var(--line); }
.phase b { font-family: var(--font-display); font-size: 22px; font-weight: 600; display: block; }
.phase p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
@media (max-width: 900px) { .phases { grid-template-columns: minmax(0, 1fr); } .phase + .phase { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); } }

.morelist a { display: flex; gap: 12px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 600; font-size: 16px; }
.morelist svg { width: 20px; height: 20px; stroke: var(--gold-ink); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.morelist small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 3px; font-weight: 600; font-size: 14px; max-width: calc(100vw - 32px);
}
@media (max-width: 900px) { #toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: no-preference) { #toast { animation: rise .18s ease-out; } @keyframes rise { from { transform: translate(-50%, 6px); opacity: 0; } } }

/* ---------- Lataus: pyörivä kuvake, edistymispalkki, painikkeen kiireinen tila ---------- */
.spinner { display: inline-block; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--gold); animation: pyori .8s linear infinite; }
.spin { display: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: pyori .7s linear infinite; }
.btn.busy .spin { display: inline-block; }
.btn.busy { cursor: progress; opacity: .85; }
.btn:disabled:not(.busy) { opacity: .45; cursor: not-allowed; }
@keyframes pyori { to { transform: rotate(360deg); } }
.app-loading { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); font-weight: 600; }
.app-loading .spinner { width: 34px; height: 34px; }
#progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--gold); z-index: 100; opacity: 0; pointer-events: none; box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent); }
#progress.go { opacity: 1; width: 72%; transition: width .9s cubic-bezier(.1,.7,.2,1), opacity .1s; }
#progress.done { opacity: 0; width: 100%; transition: width .18s ease-out, opacity .3s .18s; }
main.ladataan { opacity: .55; transition: opacity .12s; }
@media (prefers-reduced-motion: reduce) {
  .spinner, .spin { animation-duration: 2.4s; }
  #progress.go, #progress.done { transition: none; }
}

/* ---------- Kirjautuminen ---------- */
.auth-body { min-height: 100%; }
.auth { display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr); min-height: 100vh; }
.auth-side { background: #0F0F0F; color: #EEEAE2; padding: 44px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-logo { height: 54px; width: auto; align-self: flex-start; }
.auth-word { font-family: var(--font-display); font-weight: 600; font-size: 64px; line-height: 1; margin: 0 0 14px; color: #EEEAE2; }
.auth-tag { margin: 0; max-width: 34ch; color: #BDB7AC; font-size: 16px; }
.auth-foot { margin: 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #C9A24E; font-weight: 600; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; gap: 18px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { font-size: 36px; margin-bottom: 6px; }
.auth-lead { color: var(--muted); margin: 0 0 22px; }
.auth-logo-m { display: none; height: 40px; margin-bottom: 26px; }
.auth-legal { font-size: 12px; color: var(--faint); margin: 0; text-align: center; max-width: 400px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.auth-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 0; color: var(--muted); font-weight: 600; }
.auth-loading p { margin: 0; }
.auth-loading[hidden] { display: none; }
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .auth-logo-m.logo-light { display: block; }
  .auth-main { justify-content: flex-start; padding: calc(32px + env(safe-area-inset-top, 0px)) 20px 32px; }
}
@media (max-width: 860px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-logo-m.logo-light { display: none; } :root:not([data-theme="light"]) .auth-logo-m.logo-dark { display: block; } }
@media (max-width: 860px) { :root[data-theme="dark"] .auth-logo-m.logo-light { display: none; } :root[data-theme="dark"] .auth-logo-m.logo-dark { display: block; } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field-row label { font-size: 13.5px; font-weight: 700; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.field-link { font-size: 13.5px; font-weight: 600; color: var(--gold-ink); text-decoration: none; }
.field-link:hover { text-decoration: underline; }
.field input[type=email], .field input[type=password], .field input[type=text], .tili-form input {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 3px;
  background: var(--surface); color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .tili-form input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-weight: 700; font-size: 13px; color: var(--muted); padding: 6px 8px; cursor: pointer; border-radius: 3px; }
.pw-toggle:hover { color: var(--ink); background: var(--sunk); }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; color: var(--muted); margin: 2px 0 18px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--gold-ink); flex: none; }
.btn-wide { width: 100%; justify-content: center; padding: 12px 16px; font-size: 15px; }
.link-btn { background: none; border: 0; padding: 0; font-weight: 600; font-size: 13.5px; color: var(--gold-ink); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.form-error { background: var(--crit-soft); color: var(--crit); border-left: 3px solid var(--crit); padding: 10px 12px; font-size: 14px; font-weight: 600; margin: 0 0 14px; }
.form-ok { background: var(--ok-soft); color: var(--ok); border-left: 3px solid var(--ok); padding: 10px 12px; font-size: 14px; font-weight: 600; margin: 0 0 16px; }
.form-error[hidden], .form-ok[hidden] { display: none; }
.code-input { font-variant-numeric: tabular-nums; letter-spacing: .3em; font-size: 24px !important; text-align: center; font-weight: 700; }
.hint { font-size: 12.5px; color: var(--muted); margin: 2px 0 0; }
.meter { height: 4px; background: var(--sunk); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.meter span { display: block; height: 100%; width: 0; background: var(--crit); transition: width .2s, background .2s; }
.meter span[data-v="2"] { background: var(--warn); } .meter span[data-v="3"], .meter span[data-v="4"] { background: var(--ok); }
.steps-mini { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 22px; counter-reset: v; }
.steps-mini li { counter-increment: v; flex: 1; font-size: 12px; font-weight: 700; color: var(--faint); border-top: 3px solid var(--line); padding-top: 6px; }
.steps-mini li::before { content: counter(v) " · "; }
.steps-mini li.done { color: var(--ok); border-color: var(--ok); }
.steps-mini li[aria-current="step"] { color: var(--ink); border-color: var(--gold); }
.qr { width: 200px; height: 200px; margin: 0 auto 12px; background: #fff; padding: 8px; border: 1px solid var(--line-strong); }
.qr svg { width: 100%; height: 100%; display: block; }
.manual { margin: 0 0 18px; font-size: 13.5px; }
.manual summary { cursor: pointer; color: var(--gold-ink); font-weight: 600; }
.key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: .06em; background: var(--sunk); padding: 8px 10px; word-break: break-all; }
.codes { list-style: none; padding: 14px; margin: 0 0 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; background: var(--sunk); border: 1px dashed var(--line-strong); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; font-weight: 600; letter-spacing: .05em; text-align: center; }
#kopioi-koodit { margin-bottom: 14px; }

/* ---------- Käyttäjä ja tili ---------- */
.user-box { display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 3px; }
.user-box b { color: var(--ink); font-size: 13.5px; }
.user-box .row-links { display: flex; gap: 12px; margin-top: 6px; }
.user-box a, .user-box button { font-size: 12.5px; font-weight: 700; color: var(--gold-ink); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.user-box a:hover, .user-box button:hover { text-decoration: underline; }
.tili-form { max-width: 420px; display: flex; flex-direction: column; gap: 12px; }
.tili-form label { font-size: 13.5px; font-weight: 700; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Varauslistan työkalurivi, lajittelu ja sivutus ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin: 0 0 14px; }
.search { position: relative; flex: 1 1 320px; min-width: 0; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; stroke: var(--faint); fill: none; stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; font: inherit; font-size: 15px; padding: 9px 12px 9px 36px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface); color: var(--ink); }
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
th .sort { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; font-weight: 700; }
th .sort:hover, th .sort.on { color: var(--ink); }
th.r .sort { text-align: right; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.pager > span:last-child { display: flex; gap: 8px; }

/* Varauslista puhelimessa: korttirivit taulukon sijaan */
@media (max-width: 700px) {
  .res-table thead { display: none; }
  .res-table, .res-table tbody { display: block; }
  .res-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "vieras summa" "kohde kanava" "aika tila"; gap: 3px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .res-table td { border: 0; padding: 0; min-width: 0; }
  .res-table td:nth-child(1) { grid-area: vieras; } .res-table td:nth-child(2) { grid-area: kohde; font-size: 13.5px; }
  .res-table td:nth-child(3) { grid-area: aika; font-size: 13.5px; color: var(--muted); } .res-table td:nth-child(4) { display: none; }
  .res-table td:nth-child(5) { grid-area: kanava; text-align: right; } .res-table td:nth-child(6) { grid-area: summa; text-align: right; font-weight: 700; }
  .res-table td:nth-child(7) { grid-area: tila; text-align: right; }
  .res-table td[colspan] { grid-column: 1 / -1; }
}
.tablewrap:has(.res-table) { overflow-x: visible; }
@media (max-width: 700px) { .tablewrap:has(.res-table) { border-top: 1px solid var(--line-strong); } }
.mobile-only { display: none; }
@media (max-width: 700px) { .mobile-only { display: block; } }
