:root {
  --bg: #f6f6f3;
  --bg-2: #eeeeea;
  --card: #ffffff;
  --ink: #141c18;
  --muted: #69736e;
  --line: #e6e5df;
  --line-strong: #d6d4cc;
  --brand: #16233b;          /* Kellonan tummansininen; yrityksen sivuilla korvataan yrityksen teemavärillä */
  --gold: #b9844f;           /* Kellonan kulta (logon liukuvärin keskisävy) */
  --gold-ink: #16233b;
  --brand-ink: #ffffff;
  --accent: var(--brand);
  --accent-ink: var(--brand-ink);
  --accent-soft: color-mix(in srgb, var(--brand) 10%, var(--card));
  --accent-ring: color-mix(in srgb, var(--brand) 22%, transparent);
  --danger: #b4372b;
  --danger-soft: #fbeae7;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 20, .05);
  --shadow: 0 1px 2px rgba(17, 24, 20, .04), 0 6px 20px -6px rgba(17, 24, 20, .10);
  --shadow-lg: 0 2px 6px rgba(17, 24, 20, .05), 0 24px 48px -12px rgba(17, 24, 20, .18);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1311; --bg-2: #161b18; --card: #181e1b; --ink: #eef2ef; --muted: #9ba7a1; --line: #262e2a; --line-strong: #34403a;
    --accent: color-mix(in srgb, var(--brand) 55%, #ffffff); --accent-ink: #0d110f;
    --accent-soft: color-mix(in srgb, var(--brand) 24%, var(--card));
    --accent-ring: color-mix(in srgb, var(--brand) 45%, transparent);
    --danger: #ef8f84; --danger-soft: #3a211d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
header.site { text-align: center; margin: 12px 0 28px; }
header.site h1 { margin: 0; font-size: 1.75rem; letter-spacing: -0.01em; }
header.site p { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
h2 .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .85rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* Palvelut */
.services { display: grid; gap: 10px; }
.service {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: left;
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 10px; background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.service:hover { border-color: var(--accent); }
.service[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.service strong, .service .muted { display: block; }
.service .price { font-weight: 600; white-space: nowrap; }
.service-card .info { margin: 6px 4px 0; font-size: .92rem; }
.service-card .info summary { cursor: pointer; color: var(--accent); font-weight: 600; width: max-content; }
.service-card .info p { margin: 6px 0 4px; white-space: pre-line; color: var(--ink); }
.chip-time { display: inline-block; margin-top: 6px; font-size: .78rem; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); }

/* Yrityksen ylätunniste */
header.brand { background: var(--brand); color: var(--brand-ink); }
.brand-inner { max-width: 760px; margin: 0 auto; padding: 22px 16px; display: flex; align-items: center; gap: 18px; justify-content: center; text-align: center; }
.brand-inner:has(.logo:not(.hidden)) { justify-content: flex-start; text-align: left; }
.brand h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
.brand p { margin: 2px 0 0; opacity: .85; }
.brand p:empty { display: none; }
.logo { max-height: 72px; max-width: 160px; border-radius: 8px; background: #fff; padding: 4px; object-fit: contain; }

/* Lisäpalvelut */
.addons { display: grid; gap: 10px; }
.addon { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.addon:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.addon input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.addon-text { flex: 1; display: flex; flex-direction: column; }
.addon .price { font-weight: 600; white-space: nowrap; }

/* Asiakkaan viikkonäkymä */
.cal-head.wide { max-width: none; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wday { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-width: 0; }
.wday-head { display: flex; flex-direction: column; align-items: center; padding: 8px 2px; background: var(--bg); border-bottom: 1px solid var(--line); }
.wday-head.today { background: var(--accent-soft); }
.wday-head .wd { font-size: .75rem; text-transform: uppercase; color: var(--muted); }
.wday-head .dn { font-weight: 700; font-size: 1.05rem; }
.wday-slots { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.wday-slots .none { text-align: center; color: var(--muted); padding: 6px 0; }
.time .end { display: block; font-size: .72rem; font-weight: 400; opacity: .75; }
.wday .time { padding: 6px 0; font-size: .9rem; }
@media (max-width: 640px) {
  .week { grid-template-columns: 1fr; }
  .wday { display: grid; grid-template-columns: 64px 1fr; }
  .wday-head { border-bottom: 0; border-right: 1px solid var(--line); justify-content: center; }
  .wday-slots { flex-direction: row; flex-wrap: wrap; }
  .wday .time { width: 74px; }
  .wday-slots .none { text-align: left; padding: 6px; }
}

/* Kalenteri */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-head strong { text-transform: capitalize; }
.icon-btn { border: 1px solid var(--line); background: transparent; color: inherit; border-radius: 8px; width: 38px; height: 38px; font-size: 1.1rem; cursor: pointer; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.cal-head, .cal { max-width: 440px; margin-left: auto; margin-right: auto; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .75rem; color: var(--muted); padding: 4px 0; text-transform: uppercase; }
.day {
  aspect-ratio: 1; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted);
  font: inherit; cursor: default; position: relative; opacity: .45;
}
.day.avail { opacity: 1; color: var(--ink); background: var(--accent-soft); cursor: pointer; font-weight: 600; }
.day.avail:hover { border-color: var(--accent); }
.day.selected { background: var(--accent); color: var(--accent-ink); }
.day.today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }

.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 8px; }
.time { padding: 10px 0; border: 1.5px solid var(--line); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.time:hover { border-color: var(--accent); }
.time[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Lomake */
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: .95rem; }
label .opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--card); color: inherit; font: inherit;
}
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: 16px; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.summary { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; }

.btn { display: inline-block; padding: 12px 20px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.danger { background: var(--danger); color: #fff; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

.alert { padding: 12px 14px; border-radius: 10px; margin-top: 12px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--accent-soft); }
.done { text-align: center; padding: 28px 20px; }
.done .big { font-size: 2.6rem; line-height: 1; }
.done .summary { text-align: left; }
h2.center { justify-content: center; }
.prose h2 { margin-top: 22px; }
.prose p, .prose li { color: var(--ink); }

footer.site { text-align: center; color: var(--muted); font-size: .875rem; margin-top: 32px; }
footer.site a { color: inherit; }

/* Hallinta */
.wrap.wide { max-width: 1000px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tr.cancelled td { color: var(--muted); text-decoration: line-through; }
tr.cancelled td:last-child { text-decoration: none; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; background: var(--accent-soft); }
.badge.off { background: var(--danger-soft); color: var(--danger); }
.day-sep td { background: var(--bg); font-weight: 700; text-transform: capitalize; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.table-scroll { overflow-x: auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 16px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Asetukset */
.svc-row { border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px 14px; margin-bottom: 12px; }
.svc-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 12px; }
.row-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }
.link.danger { color: var(--danger); }
.hours-day { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hours-day:last-child { border-bottom: 0; }
.hours-day > strong { padding-top: 8px; }
.ranges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.range input[type=time] { width: auto; padding: 6px; border: 0; }
.range button, .chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 2px 4px; }
.closed-label { color: var(--muted); padding-top: 8px; }
.inline-add { display: flex; gap: 8px; max-width: 360px; }
.inline-add input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); border-radius: 99px; padding: 4px 6px 4px 12px; font-size: .9rem; }
.chip.past { opacity: .5; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.savebar .ok { color: var(--accent); }
.savebar .err { color: var(--danger); }
@media (max-width: 560px) {
  .svc-grid { grid-template-columns: 1fr 1fr; }
  .svc-grid > :first-child { grid-column: 1 / -1; }
  .hours-day { grid-template-columns: 1fr; }
  .hours-day > strong { padding-top: 0; }
}
/* ===== Hallinnan kalenteri ===== */
.wrap.xwide { max-width: 1240px; }
.admin-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.admin-head h1 { margin: 0; font-size: 1.4rem; }
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav strong { margin-left: 6px; text-transform: capitalize; }
.cal-nav input[type=date] { width: auto; padding: 7px 10px; }
.btn.slim { padding: 8px 14px; }
.cal-help { margin: 0 0 10px; }
.wcal-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wcal { display: grid; }
.wc-corner, .wc-head { position: sticky; top: 0; z-index: 3; background: var(--card); border-bottom: 1px solid var(--line); }
.wc-head { display: flex; flex-direction: column; align-items: center; padding: 8px 2px; border-left: 1px solid var(--line); line-height: 1.25; }
.wc-head .wd { font-size: .75rem; text-transform: uppercase; color: var(--muted); }
.wc-head .dn { font-weight: 700; }
.wc-head .cl { font-size: .7rem; color: var(--muted); }
.wc-head.today { background: var(--accent-soft); }
.wc-head.today .dn { color: var(--accent); }
.wc-times { position: relative; }
.wc-times span { position: absolute; right: 6px; transform: translateY(-50%); font-size: .72rem; color: var(--muted); }
.wc-times span:first-child { transform: none; }
.wc-day {
  position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-color: color-mix(in srgb, var(--line) 45%, var(--card));
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour));
}
.wc-open { position: absolute; left: 0; right: 0; background: var(--card); background-image: inherit; }
.wc-day:hover .wc-open { background-color: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.wc-head .mod { font-size: .7rem; color: var(--accent); }
.wc-head .reset { margin-top: 2px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted); font: inherit; font-size: .75rem; cursor: pointer; }
.wc-head .reset:hover { color: var(--accent); border-color: var(--accent); }
/* Lahjakortti ja ennakkomaksu (asiakas) */
.voucher-box, .pay-box { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.voucher-box label { margin-top: 0; }
.voucher-box .inline-add input { text-transform: uppercase; letter-spacing: 1px; }
.pay-box p { margin: 0 0 6px; }
.ok-text { color: var(--accent); }
.error-text { color: var(--danger); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 16px; }
.shop-option { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--card); text-align: left; font: inherit; cursor: pointer; color: inherit; }
.shop-option strong { display: block; font-size: 1.15rem; }
.shop-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.voucher-code { font-family: ui-monospace, monospace; font-size: 1.4rem; letter-spacing: 3px; font-weight: 700; padding: 10px 14px; background: var(--accent-soft); border-radius: var(--radius); display: inline-block; }
.ev.pending { opacity: .6; border-left-style: dashed; }
.card.inset { box-shadow: none; border: 1px solid var(--line); margin-top: 12px; }
.privacy-seg { margin: 6px 0 8px; }
.privacy-list { margin: 10px 0 0; padding-left: 18px; color: var(--muted); }
.wait-box { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.cust-locked { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--line-strong); }
.ev.locked .ev-name { letter-spacing: .04em; }
.privacy-modes .check { margin-top: 8px; }
/* Asiakasrekisteri */
.register-modes .check { margin-top: 8px; }
.cust-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 14px; }
.cust-toolbar input[type=search] { flex: 1 1 260px; margin: 0; }
dialog.cust-dialog { width: min(720px, calc(100vw - 24px)); }
.cust-pick { margin-bottom: 6px; }
.cust-pick-list { display: grid; gap: 4px; margin-top: 4px; }
.cust-pick-item { text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; cursor: pointer; color: var(--ink); font: inherit; }
.cust-pick-item:hover, .cust-pick-item:focus-visible { border-color: var(--brand); }
.note-list { display: grid; gap: 8px; margin-top: 10px; }
.note { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--bg); }
.note-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.note-text { margin: 4px 0 0; white-space: pre-wrap; }
.plain-list { margin: 4px 0 0; padding-left: 18px; }
.badge-warn { color: var(--danger); font-weight: 600; }
.health-consent { margin-top: 10px; }
/* Omat muistiinpanot kalenterissa */
.ev.cal-note { background: color-mix(in srgb, var(--note, #f2c94c) 55%, var(--card)); border: 1px dashed color-mix(in srgb, var(--note, #f2c94c) 80%, #000); color: var(--ink); }
.ev.cal-note .ev-name { white-space: pre-wrap; font-weight: 500; }
.note-colors { display: flex; gap: 8px; margin: 8px 0; }
.note-color { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.note-color.on { border-color: var(--ink); }
/* Kaksivaiheinen tunnistautuminen */
.tfa-qr { width: 200px; max-width: 100%; background: #fff; padding: 8px; border-radius: 8px; margin: 8px 0; }
.tfa-qr svg { display: block; width: 100%; height: auto; }
.tfa-codelist { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; columns: 2; font-size: 15px; letter-spacing: 1px; }
.dpa-box { margin: 10px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--gold, #b9844f) 50%, var(--line)); background: color-mix(in srgb, var(--gold, #b9844f) 8%, var(--card)); }
.dpa-box.ok { border-color: var(--line); background: var(--bg); }
@media print { .no-print, .topbar { display: none !important; } body { background: #fff; } .card { box-shadow: none; border: 0; } }
.intake-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; margin: 14px 0; }
.intake-box legend { font-weight: 600; padding: 0 6px; }
.receipt-preview { background: #fff; color: #16233b; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 10px 0; }
.receipt table { width: 100%; border-collapse: collapse; } .receipt td { padding: 3px 0; } .receipt .num { text-align: right; } .receipt .total td { border-top: 1px solid #ccc; font-weight: 700; }
.qr-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
#emCode { font-family: ui-monospace, monospace; font-size: 13px; }
.location-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.loc-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font: inherit; text-align: left; }
.loc-btn[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.interval-seg { margin: 10px auto 16px; max-width: 520px; }
.plan-save { color: var(--ok, #2f6b57); font-size: 13px; }
.demo-banner { background: color-mix(in srgb, var(--gold, #b9844f) 18%, var(--card)); border-bottom: 1px solid var(--line); padding: 8px 16px; text-align: center; font-size: 14px; }
/* Aloitusopas */
dialog.wizard { width: min(640px, calc(100vw - 24px)); }
.wiz-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 10px 0; }
.wiz-opt { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font: inherit; text-align: left; }
.wiz-opt[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.svc-kind { margin: 6px 0; padding-top: 6px; border-top: 1px dashed var(--line); }
/* Tekoäly */
.ai-box { margin: 12px 0; padding: 10px 12px; border: 1px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: 10px; }
.ai-out { margin: 8px 0 0; white-space: pre-wrap; }
.ai-setting { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
#noteAdd .row-actions .spacer { flex: 1; }
.bulk-bar { position: sticky; bottom: 12px; margin-top: 14px; padding: 14px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--card) 94%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line)); box-shadow: var(--shadow-lg); backdrop-filter: blur(8px); }
.bulk-bar .bulk-reason label { margin-top: 0; }
.bulk-bar .btn { margin-top: 10px; }
/* Tilastot */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--card); }
.kpi .k { font-size: .8rem; color: var(--muted); }
.kpi .v { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: .78rem; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--accent); }
.chart .bar:hover { fill: color-mix(in srgb, var(--accent) 75%, var(--ink)); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.heat { display: grid; gap: 2px; font-size: .72rem; }
.heat .c { aspect-ratio: 1.6; border-radius: 3px; background: var(--accent); }
.heat .lbl { color: var(--muted); display: flex; align-items: center; }
.stats-off { text-align: center; padding: 30px 10px; }
/* Lasku: ei saapunut */
.muted-block { opacity: .55; }
.btn.danger-ghost { color: var(--danger); border-color: var(--danger); padding: 6px 12px; }
dialog.inv-dialog { width: min(1100px, calc(100vw - 24px)); max-width: none; padding: 18px 20px; }
.inv-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 18px; align-items: start; }
.inv-preview { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; max-height: 72vh; overflow: auto; }
.inv-buttons { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 6px; }
@media (max-width: 800px) { .inv-layout { grid-template-columns: 1fr; } .inv-preview { max-height: none; } }
@media print {
  body.printing-invoice > *:not(#invDlg) { display: none !important; }
  body.printing-invoice #invDlg { position: static; border: 0; padding: 0; width: auto; box-shadow: none; }
  body.printing-invoice #invDlg::backdrop { background: none; }
  body.printing-invoice .dlg-head, body.printing-invoice .inv-edit { display: none !important; }
  body.printing-invoice .inv-layout { display: block; }
  body.printing-invoice .inv-preview { border: 0; max-height: none; overflow: visible; }
}
/* Vastaanottoaikojen maalaus */
.paint-bar { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 10px; font-size: .9rem; }
.paint-bar p { margin: 0 0 8px; }
.paint-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wcal-wrap.painting .wc-day { cursor: crosshair; touch-action: none; user-select: none; }
.wcal-wrap.painting .ev { pointer-events: none; opacity: .55; }
.wcal-wrap.painting .wc-open { box-shadow: inset 3px 0 0 var(--accent); }
.wc-paint { position: absolute; left: 3px; right: 3px; z-index: 2; border-radius: 4px; pointer-events: none; display: flex; align-items: flex-start; justify-content: center; font-size: .75rem; font-weight: 700; padding-top: 2px; }
.wc-paint.add { background: color-mix(in srgb, var(--accent) 30%, transparent); border: 2px solid var(--accent); color: var(--accent); }
.wc-paint.erase { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--danger) 18%, transparent) 0 6px, transparent 6px 12px); border: 2px dashed var(--danger); color: var(--danger); }
.wc-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.wc-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.ev {
  position: absolute; z-index: 1; overflow: hidden; text-align: left; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; gap: 0; padding: 3px 6px; line-height: 1.2;
  border: 0; border-left: 4px solid var(--ev, var(--accent)); border-radius: 6px;
  background: color-mix(in srgb, var(--ev, var(--accent)) 16%, var(--card)); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.ev:hover { background: color-mix(in srgb, var(--ev, var(--accent)) 26%, var(--card)); z-index: 2; }
.ev.own { border-left-style: dashed; }
.ev.block { border-left-color: var(--muted); color: var(--muted);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--line) 70%, var(--card)) 0 6px, var(--card) 6px 12px); }
.ev-time { font-size: .72rem; font-weight: 700; }
.ev.short { flex-direction: row; flex-wrap: wrap; align-content: flex-start; column-gap: 6px; padding-top: 2px; }
.ev.short .ev-svc { display: none; }
.ev-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-svc { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Varausikkuna */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15, 20, 18, .45); }
dialog form { padding: 18px 20px 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 12px; }
.seg label { margin: 0; padding: 7px 16px; cursor: pointer; font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.dlg-addons .check { margin-top: 8px; }
.grid2.tight { grid-template-columns: 1fr 1fr; }
.calc { margin: 8px 0 0; font-size: .9rem; color: var(--accent); font-weight: 600; min-height: 1.2em; }
.dlg-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.dlg-actions .spacer { flex: 1; }

/* Ulkoasuasetukset */
.appearance { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.logo-edit { display: flex; gap: 14px; align-items: center; }
.logo-preview { width: 120px; height: 72px; border: 1.5px dashed var(--line); border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: #fff; flex: none; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 52px; height: 40px; border: 1.5px solid var(--line); border-radius: 8px; padding: 2px; background: var(--card); cursor: pointer; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.brand-preview { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 16px 18px; border-radius: 10px; position: relative; }
.brand-preview .logo { max-height: 48px; }
.preview-tag { position: absolute; top: 6px; right: 10px; opacity: .7; }
.svc-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.check.inline { margin-top: 4px; }

/* ===== Yläpalkki, etusivu, kirjautuminen ===== */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; }
.wordmark { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.hero { background: linear-gradient(160deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #000)); color: #fff; }
.hero-inner { max-width: 860px; margin: 0 auto; padding: 64px 16px 72px; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.02em; }
.hero .lead { font-size: 1.15rem; opacity: .92; max-width: 640px; margin: 0 auto 28px; }
.hero-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero .btn { background: #fff; color: var(--brand); font-size: 1.05rem; padding: 14px 26px; }
.hero .muted { color: rgba(255,255,255,.8); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 32px 0; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature .ico { font-size: 1.6rem; }
.feature h3 { margin: 8px 0 6px; }
.feature p { margin: 0; color: var(--muted); }
.how ol { padding-left: 20px; line-height: 1.9; }
.auth-page { display: flex; justify-content: center; padding: 32px 16px; }
.auth-box { width: min(440px, 100%); }
.auth-box > .wordmark { display: block; text-align: center; margin-bottom: 18px; font-size: 1.3rem; }
.auth-box h1 { margin: 0 0 6px; font-size: 1.4rem; }
.center { text-align: center; }
.slug-field { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 8px; padding-left: 12px; background: var(--card); }
.slug-field span { white-space: nowrap; font-size: .9rem; }
.slug-field input { border: 0 !important; padding-left: 2px !important; }
.slug-field:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint.ok { color: var(--accent); }
.hint.err { color: var(--danger); }

/* Hallinnan lisät */
.linkbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.linkbar a { font-weight: 700; word-break: break-all; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 6px; font-size: .85rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cal-nav select { width: auto; padding: 7px 10px; }
.emp-row .color-row input[type=color] { width: 60px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.stat { display: flex; flex-direction: column; margin: 0; }
.stat strong { font-size: 1.6rem; }
td select, td input[type=date] { width: auto; padding: 6px 8px; }

.billing-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.danger-zone h2 { color: var(--danger); }

/* Asiakkaan työntekijävalinta */
.employees { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.service.emp { justify-content: flex-start; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); font-weight: 800; }

@media (max-width: 700px) {
  .cal-toolbar { flex-direction: column; align-items: stretch; }
  .grid2.tight { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .card { padding: 16px; }
  .responsive thead { display: none; }
  .responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .responsive td { display: block; border: 0; padding: 2px 0; }
}

/* =====================================================================
   PREMIUM-ILME – yhtenäinen, selkeä ja viimeistelty ulkoasu.
   Ohittaa yllä olevat perustyylit samoilla luokilla.
   ===================================================================== */
::selection { background: var(--accent-ring); }
h1, h2, h3 { letter-spacing: -0.015em; }
a { color: var(--accent); text-underline-offset: 3px; }
.muted { color: var(--muted); }
:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }

/* --- Rakenne ja kortit --- */
.wrap { max-width: 780px; padding: 28px 18px 72px; }
.card {
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--radius-lg);
  padding: 26px; margin-bottom: 18px; box-shadow: var(--shadow);
}
h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 18px; gap: 12px; }
h2 .num {
  width: 30px; height: 30px; font-size: .85rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-ring);
}
.step { transition: opacity .25s var(--ease); }

/* --- Yrityksen ylätunniste (asiakkaan sivut) --- */
header.brand {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 140% at 85% -20%, color-mix(in srgb, #fff 22%, transparent) 0, transparent 55%),
    linear-gradient(155deg, color-mix(in srgb, var(--brand) 92%, #fff), color-mix(in srgb, var(--brand) 78%, #000));
}
header.brand::after { content: ""; position: absolute; inset: auto 0 0 0; height: 1px; background: rgba(255,255,255,.12); }
html:not(.branded) header.brand { background: var(--bg-2); }
html:not(.branded) header.brand .brand-inner { opacity: 0; }
header.brand .brand-inner { transition: opacity .25s var(--ease); }
.brand-inner { max-width: 780px; padding: 40px 18px 46px; gap: 20px; position: relative; }
.brand h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 750; letter-spacing: -0.025em; }
.brand p { font-size: 1.02rem; opacity: .88; margin-top: 4px; }
.logo { max-height: 76px; max-width: 170px; border-radius: 16px; padding: 8px; box-shadow: 0 8px 24px -8px rgba(0,0,0,.35); }
.lang-box { position: absolute; top: 14px; right: 18px; }
.lang-switch {
  appearance: none; width: auto; padding: 6px 30px 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='white' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: #fff; cursor: pointer; backdrop-filter: blur(6px);
}
.lang-switch option { color: #141c18; }
/* Hallinnan ja etusivun kielivalitsin vaalealla pohjalla */
.topbar .lang-switch, .auth-box .lang-switch { border-color: var(--line); background-color: var(--card); color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2369736e' stroke-width='1.6'/%3E%3C/svg%3E"); }

/* --- Palvelut ja valinnat --- */
.services, .addons { gap: 12px; }
.service, .addon, .shop-option {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: var(--card);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease), background-color .15s var(--ease);
}
.service:hover, .addon:hover, .shop-option:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.service[aria-pressed="true"], .addon:has(input:checked), .shop-option.selected {
  border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-ring);
}
.service strong { font-size: 1.02rem; font-weight: 650; }
.service .price, .addon .price {
  font-weight: 700; font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
}
.service[aria-pressed="true"] .price { background: var(--card); }
.chip-time { margin-top: 8px; padding: 2px 10px; font-weight: 600; font-size: .76rem; color: var(--muted); background: var(--bg); border: 1px solid var(--line); }
.service-card .info summary { font-size: .9rem; }
.employees { gap: 12px; }
.avatar { width: 44px; height: 44px; font-size: 1.05rem; box-shadow: inset 0 0 0 1px var(--accent-ring); }

/* --- Ajat --- */
.week { gap: 8px; align-items: start; }
.wday { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.wday.empty { background: var(--bg); }
.wday-head { background: transparent; padding: 10px 2px 8px; }
.wday-head .wd { font-size: .7rem; font-weight: 700; letter-spacing: .06em; }
.wday-head .dn { font-size: 1.05rem; font-weight: 750; }
.wday-head.today { background: var(--accent-soft); }
.wday-head.today .dn { color: var(--accent); }
.wday-slots { gap: 6px; padding: 8px; }
.time {
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 650; font-variant-numeric: tabular-nums;
  transition: all .15s var(--ease);
}
.time:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.time[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -6px var(--accent); }
.time .end { opacity: .65; }
.cal { gap: 6px; }
.day { border-radius: 12px; }
.day.avail { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-ring); }
.day.avail:hover { border-color: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.day.selected { box-shadow: 0 6px 16px -6px var(--accent); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  box-shadow: var(--shadow-sm); transition: all .15s var(--ease);
}
.icon-btn:hover:not(:disabled) { border-color: var(--line-strong); box-shadow: var(--shadow); }
.cal-head strong { font-size: 1.02rem; font-weight: 700; }

/* --- Lomakkeet --- */
label { font-weight: 600; font-size: .92rem; margin: 16px 0 6px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], textarea, select {
  min-height: 46px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card);
  box-shadow: var(--shadow-sm); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:hover, textarea:hover, select:hover { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--ink)); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
textarea { min-height: 96px; }
.check { gap: 12px; }
.check input { accent-color: var(--accent); }
.summary {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px; margin-bottom: 12px;
}
.summary div { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.summary div:last-child { border-bottom: 0; }
.summary span { color: var(--muted); }
.summary strong { text-align: right; font-weight: 650; }
.voucher-box, .pay-box { border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); padding: 16px; }

/* --- Painikkeet --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 12px 22px; border-radius: 12px; font-weight: 650; letter-spacing: -0.005em;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent));
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -8px var(--accent), var(--shadow-sm);
  transition: transform .12s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease);
}
.btn:hover:not(:disabled) { filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 10px 22px -8px var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.995); }
.btn.block { min-height: 52px; font-size: 1.02rem; }
.btn.slim { min-height: 38px; padding: 8px 14px; font-size: .92rem; }
.btn.ghost { background: var(--card); color: var(--accent); border: 1px solid var(--accent-ring); box-shadow: var(--shadow-sm); }
.btn.ghost:hover:not(:disabled) { background: var(--accent-soft); filter: none; }
.btn.danger { background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 90%, #fff), var(--danger)); box-shadow: 0 6px 16px -8px var(--danger); }
.btn.danger-ghost { background: var(--card); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); box-shadow: none; }
.link { text-underline-offset: 3px; }

/* --- Ilmoitukset --- */
.alert { border-radius: 12px; padding: 13px 16px; border: 1px solid transparent; font-size: .95rem; }
.alert.error { border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.ok { border-color: var(--accent-ring); }
.done { padding: 40px 26px; }
.done .big {
  width: 64px; height: 64px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%;
  font-size: 1.9rem; color: var(--accent-ink); background: var(--accent); box-shadow: 0 12px 28px -10px var(--accent);
}
footer.site { margin-top: 40px; font-size: .84rem; line-height: 1.8; }
footer.site a { text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.prose h2 { font-size: 1.05rem; margin-top: 26px; }
.prose p { line-height: 1.7; }

/* --- Hallinta: yläpalkki ja välilehdet --- */
body.admin { background: var(--bg); }
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.topbar-inner { padding: 12px 20px; }
.wordmark { font-weight: 800; letter-spacing: -0.02em; }
.wrap.xwide { padding-top: 22px; }
.linkbar { border-radius: var(--radius-lg); padding: 14px 18px; }
.linkbar a { text-decoration: none; }
.tabs {
  gap: 4px; padding: 5px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow-sm); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; border-radius: 10px; padding: 9px 16px; margin: 0; white-space: nowrap; font-size: .93rem; transition: all .15s var(--ease); }
.tab:hover { color: var(--ink); background: var(--bg); }
.tab[aria-selected="true"] { color: var(--accent-ink); background: var(--accent); box-shadow: 0 4px 12px -4px var(--accent); }
table { font-size: .93rem; }
th { font-size: .72rem; letter-spacing: .06em; padding: 10px; }
td { padding: 12px 10px; }
tbody tr { transition: background-color .12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.day-sep td { background: var(--bg) !important; font-size: .85rem; }
.savebar { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); backdrop-filter: blur(10px); background: color-mix(in srgb, var(--card) 92%, transparent); }
.kpi { border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi .v { font-size: 1.7rem; letter-spacing: -0.02em; }
.seg { border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; background: var(--bg); }
.seg label { border-radius: 9px; padding: 7px 16px; }
.seg label:has(input:checked) { box-shadow: 0 4px 12px -4px var(--accent); }
.chip { background: var(--bg); border: 1px solid var(--line); }
.svc-row, .svc-edit { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 6px 16px 16px; margin-bottom: 14px; }
.hours-day { border-bottom-color: var(--line); }
.range { border-radius: 10px; background: var(--card); }

/* --- Hallinnan kalenteri --- */
.wcal-wrap { border-radius: var(--radius-lg); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--line) 70%, transparent); }
.wc-head { padding: 10px 2px; }
.wc-head .wd { font-size: .68rem; font-weight: 700; letter-spacing: .07em; }
.wc-head .dn { font-size: 1rem; font-weight: 750; }
.wc-head.today .dn { color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 0 9px; }
.wc-day { background-color: color-mix(in srgb, var(--bg-2) 70%, var(--card)); background-image: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--line) 75%, transparent) 0 1px, transparent 1px var(--hour)); }
.ev {
  border-radius: 8px; border-left-width: 3px; padding: 4px 7px;
  box-shadow: 0 1px 2px rgba(17,24,20,.06), 0 4px 10px -6px rgba(17,24,20,.25);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.ev:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.ev-name { font-weight: 650; }
dialog { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(12, 16, 14, .5); backdrop-filter: blur(3px); }

/* --- Etusivu ja kirjautuminen --- */
.hero {
  background:
    radial-gradient(90% 120% at 80% -10%, rgba(255,255,255,.18), transparent 55%),
    linear-gradient(160deg, color-mix(in srgb, var(--brand) 95%, #fff), color-mix(in srgb, var(--brand) 65%, #000));
}
.hero-inner { padding: 88px 18px 96px; }
.hero h1 { font-weight: 800; letter-spacing: -0.035em; }
.hero .btn { background: #fff; color: var(--brand); box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); }
.feature { border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--line) 70%, transparent); }
.feature .ico { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); font-size: 1.4rem; }
.feature h3 { font-size: 1.05rem; }
.auth-page { padding: 56px 16px; min-height: 100vh; background: radial-gradient(80% 60% at 50% 0%, var(--accent-soft), transparent 70%); }
.auth-box .card { padding: 32px; }
.slug-field { border-radius: 12px; border-color: var(--line-strong); min-height: 46px; }
.slug-field:focus-within { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }

@media (max-width: 640px) {
  .card { padding: 20px 18px; border-radius: 18px; }
  .brand-inner { padding: 48px 18px 36px; flex-direction: column; text-align: center; }
  .brand-inner:has(.logo:not(.hidden)) { justify-content: center; text-align: center; }
  .lang-box { top: 10px; right: 12px; }
  .wrap { padding: 20px 14px 56px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Hinnoittelutasot (etusivu + hallinta) ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px 22px 22px; box-shadow: var(--shadow-sm); }
.plan.featured { border: 2px solid var(--accent); box-shadow: var(--shadow-lg); }
.plan.current { border: 2px solid var(--accent); background: var(--accent-soft); }
.plan h3 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.plan-tag { margin: 0; color: var(--muted); font-size: .92rem; }
.plan-price { margin: 10px 0 4px; }
.plan-price strong { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; }
.plan-price span { color: var(--muted); font-size: .9rem; }
.plan ul { list-style: none; padding: 0; margin: 6px 0; }
.plan li { padding: 4px 0; font-size: .93rem; display: flex; gap: 8px; align-items: baseline; }
.plan-limits { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0 !important; }
.plan-feats { flex: 1; }
.plan li.off { color: var(--muted); opacity: .7; }
.plan .tick { color: var(--accent); font-weight: 700; width: 1em; flex: none; }
.plan li.off .tick { color: var(--muted); }
.plan .btn { margin-top: 12px; width: 100%; justify-content: center; text-align: center; }
.plan-badge { position: absolute; top: -12px; left: 22px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.plan-badge.current { background: var(--ink); color: var(--card); }

/* ---------- Etusivu: osiot ---------- */
.landing-section { margin: 56px 0; }
.landing-section > h2 { text-align: center; font-size: clamp(1.5rem, 3.2vw, 2.1rem); letter-spacing: -0.025em; margin: 0 0 8px; }
.landing-section > .sub { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 24px; }
.privacy-band { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.privacy-band h3 { margin: 0 0 4px; font-size: 1rem; }
.privacy-band p { margin: 0; color: var(--muted); font-size: .93rem; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { color: var(--muted); margin: 10px 0 0; }
.cta-band { text-align: center; background: linear-gradient(160deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #000)); color: #fff; border-radius: var(--radius-lg); padding: 40px 20px; }
.cta-band h2 { margin: 0 0 10px; }
.cta-band .btn { background: #fff; color: var(--brand); }
.hero-trust { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin-top: 22px; font-size: .9rem; opacity: .9; }
.center { text-align: center; }

/* ---------- Käyttöohje ---------- */
.guide { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.guide-toc { position: sticky; top: 76px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); max-height: calc(100vh - 100px); overflow: auto; }
.guide-toc-title { margin: 0 0 8px; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.guide-toc ol { margin: 0; padding-left: 20px; font-size: .92rem; line-height: 1.9; }
.guide-toc a { color: var(--ink); text-decoration: none; }
.guide-toc a:hover { color: var(--accent); text-decoration: underline; }
.guide-body { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px clamp(18px, 4vw, 44px); box-shadow: var(--shadow); min-width: 0; }
.guide-body h1 { margin-top: 0; font-size: clamp(1.7rem, 3.5vw, 2.3rem); letter-spacing: -0.03em; }
.guide-body .lead { font-size: 1.05rem; color: var(--muted); }
.guide-body section { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 28px; scroll-margin-top: 80px; }
.guide-body h2 { font-size: 1.3rem; letter-spacing: -0.015em; }
.guide-body h3 { font-size: 1.02rem; margin: 18px 0 6px; }
.guide-body li { margin: 4px 0; }
.guide-body em { font-style: normal; font-weight: 600; background: var(--bg-2); padding: 0 5px; border-radius: 5px; }
.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 38px; margin: 10px 0; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.tip { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; }
.guide-dl dt { font-weight: 700; margin-top: 12px; }
.guide-dl dd { margin: 2px 0 0; color: var(--muted); }
.guide-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.guide-table th, .guide-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide-table th { background: var(--bg-2); }
.guide-body details { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 8px 0; }
.guide-body summary { cursor: pointer; font-weight: 600; }
.guide-body details p { color: var(--muted); margin: 8px 0 0; }
@media (max-width: 860px) {
  .guide { grid-template-columns: 1fr; gap: 16px; }
  .guide-toc { position: static; max-height: none; }
}
@media print {
  .topbar, .guide-toc, footer.site { display: none; }
  .guide { display: block; padding: 0; }
  .guide-body { border: 0; box-shadow: none; padding: 0; }
  .guide-body details { break-inside: avoid; }
  .guide-body details > p { display: block; }
}

/* ---------- Vahvistus- ja ilmoitusikkuna (korvaa selaimen confirm/alert) ---------- */
.app-dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); padding: 24px; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.app-dialog::backdrop { background: rgba(10, 14, 12, .45); }
.app-dialog-text { margin: 0 0 20px; white-space: pre-line; line-height: 1.55; font-size: 1rem; }
.app-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Kellona-logo ja sinikulta brändi ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 10px; }
.wm-logo { width: 36px; height: 36px; flex: none; }
.wm-text { text-transform: uppercase; letter-spacing: .16em; font-weight: 650; }
.auth-box > .wordmark { display: flex; justify-content: center; }
.auth-box > .wordmark .wm-logo { width: 44px; height: 44px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wm-logo { content: url(/brand/logo-dark.svg); }
}
.plan.featured { border-color: var(--gold); }
.plan-badge { background: var(--gold); color: var(--gold-ink); }
.hero { border-bottom: 3px solid var(--gold); }
.hero-trust span::first-letter { color: var(--gold); }

/* ---------- Hallinnan kalenteri: näkymävalitsin ja puhelinkäyttö ---------- */
.seg.cal-view { margin-top: 0; }
.seg.cal-view label { padding: 6px 12px; font-size: .9rem; white-space: nowrap; }
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: inline; } }
.wcal-wrap.slide-l .wcal { animation: cal-in-l .22s var(--ease); }
.wcal-wrap.slide-r .wcal { animation: cal-in-r .22s var(--ease); }
@keyframes cal-in-l { from { opacity: .3; transform: translateX(24px); } }
@keyframes cal-in-r { from { opacity: .3; transform: translateX(-24px); } }

@media (max-width: 700px) {
  .admin .wrap.xwide { padding-left: 10px; padding-right: 10px; }
  .admin .linkbar { padding: 10px 14px; flex-wrap: nowrap; }
  .admin .linkbar > div { min-width: 0; }
  .admin .linkbar a { font-size: .88rem; word-break: normal; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .admin .linkbar .btn { flex: none; }

  /* Työkalurivi: navigointi ja valinnat siisteiksi riveiksi */
  .cal-toolbar { gap: 8px; align-items: stretch; }
  .cal-toolbar .cal-nav { width: 100%; min-width: 0; }
  .cal-toolbar .cal-nav:first-child { flex-wrap: nowrap; }
  .cal-toolbar .cal-nav:first-child strong { flex: 1; min-width: 0; margin: 0; text-align: center; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; order: 2; }
  .cal-toolbar .cal-nav:first-child #calPrev { order: 1; }
  .cal-toolbar .cal-nav:first-child #calNext { order: 3; }
  .cal-toolbar .cal-nav:first-child #calToday { order: 4; }
  .icon-btn { width: 42px; height: 42px; flex: none; }
  .seg.cal-view { flex: 1 1 100%; }
  .seg.cal-view label { flex: 1; text-align: center; padding: 8px 6px; }
  .cal-nav select, .cal-nav input[type=date] { flex: 1 1 40%; min-width: 0; }
  #calPaint { flex: 1 1 100%; }
  .cal-help { font-size: .8rem; }
  .legend { font-size: .8rem; gap: 8px; }
  .paint-bar { padding: 10px 12px; }
  .paint-bar p { font-size: .82rem; }
  .paint-actions .btn { flex: 1; }

  /* Uusi varaus: pyöreä pikanappi peukalon ulottuville */
  #calNew {
    position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30;
    width: 58px; height: 58px; min-height: 0; padding: 0; border-radius: 50%;
    box-shadow: 0 10px 24px -8px var(--accent), var(--shadow-lg);
  }
  #calNew .fab-plus { font-size: 1.9rem; line-height: 1; font-weight: 500; }
  #calNew .fab-text { display: none; }
  #tabCalendar { padding-bottom: 76px; }

  /* Kapeat sarakkeet: vain aika ja nimi, tiiviimpi teksti */
  .wc-head { padding: 7px 1px; }
  .wc-times span { right: 4px; font-size: .66rem; }
  .wcal[data-days="3"] .wc-head .wd, .wcal[data-days="7"] .wc-head .wd { font-size: .62rem; letter-spacing: .04em; }
  .wcal[data-days="3"] .wc-head .dn, .wcal[data-days="7"] .wc-head .dn { font-size: .9rem; }
  .wcal[data-days="3"] .ev, .wcal[data-days="7"] .ev { padding: 3px 4px; border-radius: 6px; border-left-width: 3px; }
  .wcal[data-days="3"] .ev-time, .wcal[data-days="7"] .ev-time { font-size: .64rem; }
  .wcal[data-days="3"] .ev-name, .wcal[data-days="7"] .ev-name { font-size: .74rem; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
  .wcal[data-days="3"] .ev-svc, .wcal[data-days="7"] .ev-svc { display: none; }
  .wcal[data-days="3"] .ev.short, .wcal[data-days="7"] .ev.short { flex-direction: column; flex-wrap: nowrap; }
  .wcal[data-days="3"] .ev.short .ev-name, .wcal[data-days="7"] .ev.short .ev-name { white-space: nowrap; }
  .ev:hover { transform: none; }

  /* Viikkonäkymä puhelimella: vierii sivuttain, kellonajat pysyvät näkyvissä */
  .wcal-wrap.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .wcal-wrap.scroll-x .wcal { min-width: calc(40px + 7 * 92px); }
  .wcal-wrap.scroll-x .wc-times { position: sticky; left: 0; z-index: 4; background: var(--card); border-right: 1px solid var(--line); }
  .wcal-wrap.scroll-x .wc-corner { left: 0; z-index: 5; }
}
