/* Tilasuunnittelija, kokeiluversio: vaalea neutraali kehys, Inter (paikallinen, SIL OFL), yksi korostusväri,
   brändistä vain TÄHTITORNI-logo (omistaja 2026-11-05). Paneelit kelluvat lasimaisina pohjan ja 3D:n päällä;
   prefers-reduced-transparency tai .solid tekee niistä peittäviä. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}

:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --glass: rgba(255, 255, 255, .88);
  --glass-strong: rgba(255, 255, 255, .95);
  --text: #1B1F27;
  --text-2: #3C4451;
  --muted: #5F6975;
  --line: #E2E5EA;
  --line-2: #C9CED6;
  --accent: #1E4ED8;
  --accent-2: #173DA8;
  --accent-soft: #E8EEFC;
  --ok: #15803D;
  --warn: #B45309;
  --warn-soft: #FEF3E2;
  --bad: #B42318;
  --bad-soft: #FEECEB;
  --ink: #2A2F3A;
  --shadow: 0 4px 16px rgba(16, 24, 40, .10);
  --shadow-2: 0 8px 28px rgba(16, 24, 40, .14);
  --radius: 12px;
  --f: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 13px/1.5 var(--f); -webkit-font-smoothing: antialiased; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.meta { color: var(--muted); font-size: 12px; margin: 0; }
.label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 10px 0 6px; }
.coord { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; }
.vline { width: 1px; height: 22px; background: var(--line); flex: 0 0 auto; }
a { color: var(--accent); }

/* ---- sovelluksen runko ---- */
.app { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.top { grid-row: 1; height: 56px; padding: 0 14px; display: flex; align-items: center; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.logo-link { display: inline-flex; align-items: center; border-radius: 6px; }
.logo { height: 20px; width: auto; display: block; }
.venue-pick select { max-width: 220px; }
.plan-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
#event-name { font: 600 13px/1.3 var(--f); color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -6px; width: 260px; }
#event-name:hover, #event-name:focus { border-color: var(--line-2); background: var(--surface); }
#file-state { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
#file-state.unsaved { color: var(--warn); }
.top-center { flex: 1 1 auto; display: flex; justify-content: center; gap: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; }

/* ---- kontrollit ---- */
button, select, input, summary { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .45; cursor: default; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #9AA3AF; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.icon { width: 34px; padding: 0; }
.btn.small { height: 28px; }
.btn.icon.small { width: 28px; }
.btn.round { border-radius: 50%; }
.btn.wide { width: 100%; margin: 4px 0; }
.btn.dashed { border-style: dashed; height: 56px; }
.btn svg, .tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select, input[type="number"], input[type="text"], input[type="search"] { height: 32px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); font-size: 13px; }
input[type="number"] { width: 5.2em; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; background: #E9ECF0; border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.tool { height: 36px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tool:hover { background: #EEF1F5; }
.tool[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tool.icon { width: 36px; padding: 0; justify-content: center; }
.tool.danger { color: var(--bad); }
.tool.danger:hover { background: var(--bad-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12px; font-weight: 500; color: var(--text-2); }
.chip:hover { border-color: #9AA3AF; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs { display: flex; gap: 2px; background: #E9ECF0; border-radius: 8px; padding: 3px; }
.tabs button { flex: 1; height: 28px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.tabs .cnt { color: var(--muted); font-weight: 400; }
.row { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; }
.field > span:first-child { color: var(--text-2); font-size: 12px; }
.field select { width: 100%; }
.inp { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; color: var(--text-2); }
.num-field { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 12px; }
.inline { display: inline-flex; align-items: center; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 10px; top: 8px; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { width: 100%; padding-left: 32px; }

/* valikko (details) */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: 40px; z-index: 20; min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); display: flex; flex-direction: column; }
.menu-list > button, .menu-list > a { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text); text-decoration: none; }
.menu-list > button:hover, .menu-list > a:hover { background: #EEF1F5; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu-list .label { padding: 0 10px; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent button { width: 100%; text-align: left; padding: 6px 10px; border-radius: 6px; overflow-wrap: anywhere; }
.recent button:hover { background: #EEF1F5; }
.recent .sub { display: block; color: var(--muted); font-size: 11px; }

/* ---- vaihepalkki ---- */
.stepper { grid-row: 2; height: 52px; padding: 8px 14px; display: flex; align-items: center; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.step { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 6px; border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.step:hover { background: #EEF1F5; }
.step.on { background: var(--accent-soft); color: var(--accent); }
.step.done { color: var(--text); }
.step .no { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: 1.5px solid var(--line-2); color: var(--muted); background: var(--surface); }
.step .no svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.step.on .no { border-color: var(--accent); background: var(--accent); color: #fff; }
.step.done .no { border-color: var(--ok); background: var(--ok); color: #fff; }
.step-line { width: 18px; height: 1px; background: var(--line-2); flex: 0 0 auto; }
.step-sum { margin-left: auto; white-space: nowrap; }

/* ---- työtila ---- */
.work { grid-row: 3; display: grid; grid-template-columns: 72px minmax(0, 1fr); min-height: 0; }
.rail { padding: 8px 4px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border-right: 1px solid var(--line); }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; padding: 10px 0 8px; border-radius: 10px; font-size: 11px; font-weight: 500; color: var(--muted); }
.rail button:hover { background: #EEF1F5; color: var(--text); }
.rail button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.rail svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#view { position: relative; min-height: 0; overflow: hidden; touch-action: none; background: var(--bg); }
#view > canvas { display: block; width: 100%; height: 100%; }
#view canvas.plan { position: absolute; inset: 0; pointer-events: none; }

.glass { background: var(--glass); -webkit-backdrop-filter: blur(16px) saturate(1.25); backdrop-filter: blur(16px) saturate(1.25); border: 1px solid rgba(255, 255, 255, .7); box-shadow: var(--shadow), inset 0 0 0 1px rgba(226, 229, 234, .6); border-radius: var(--radius); }
.glass.solid { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@supports not (backdrop-filter: blur(1px)) {
  .glass { background: var(--glass-strong); }
}

.panel { position: absolute; left: 12px; top: 12px; bottom: 60px; width: 324px; z-index: 5; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 20px; }
.panel > section { display: flex; flex-direction: column; gap: 6px; }
body.panel-closed .panel { display: none; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel-title { margin: 0; font-size: 15px; font-weight: 700; }
.note-box { padding: 8px 10px; background: #F4F5F7; border-radius: 8px; }
.rooms { list-style: none; margin: 0; padding: 0; }
.rooms li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.rooms li b { font-weight: 600; color: var(--text); white-space: nowrap; }
.notes, .zones { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 12px; }
.notes li, .zones li { margin-bottom: 6px; }
.exports { display: flex; flex-direction: column; gap: 4px; }
.exports .meta { margin-top: 2px; }
.bom.compare { margin-top: 4px; }
.bom.compare th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 6px 4px 0; }
.bom.compare td { padding: 5px 6px 5px 0; }

/* vieraat ja istumajärjestys */
.guest-list h3 { margin: 10px 0 4px; }
.guest-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.guest-name { flex: 1 1 auto; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.guest-row .btn.small, .guest-row .btn.icon.small { flex: 0 0 auto; }
.btn.small { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.danger-text { color: var(--bad); border-color: var(--bad-soft); }
.btn.danger-text:hover { background: var(--bad-soft); }

/* pöytäkortit (tulostus) */
.sheet-cards { padding: 10mm; }
.cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6mm; margin-top: 6mm; }
.place-card { border: 0.3mm dashed #9AA3AF; border-radius: 3mm; padding: 8mm 6mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3mm; min-height: 40mm; text-align: center; }
.place-card b { font-size: 16pt; }
.place-card span { font-size: 10pt; color: #5F6975; }

/* tarkistukset (yhteenveto) */
#check-list li.ok { color: var(--ok); }
#check-list li.bad { color: var(--warn); }
.result { color: var(--accent); margin: 8px 0 0; min-height: 1.5em; font-weight: 500; }
.warn { color: var(--bad); margin: 0 0 8px; font-weight: 500; }
.img-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.img-list li { display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: center; }
.img-list img { width: 48px; height: 36px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #F4F5F7; }
.img-list .img-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.img-list .img-dim { display: block; color: var(--muted); font-size: 11px; }
.img-list button { height: 26px; padding: 0 8px; border-radius: 6px; font-size: 12px; color: var(--bad); }
.img-list button:hover { background: var(--bad-soft); }

/* kalustekortit */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; }
.card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card .th { height: 68px; border-radius: 6px; background: #F4F5F7; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card .th img { width: 100%; height: 100%; object-fit: contain; }
.card .th .sym { width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 50%; }
.card .th .sym.rect { border-radius: 2px; width: 40px; height: 22px; }
.card .nm { font-size: 12px; font-weight: 600; line-height: 1.3; }
.card .dm { font-size: 11px; color: var(--muted); }
.card .pr { font-size: 11px; font-weight: 600; color: var(--accent); }
.cards .empty { grid-column: 1 / -1; }

/* ohjattu tila: vaiheen paneeli */
.guide-panel { display: flex; flex-direction: column; gap: 6px; }
.guide-panel .intro { margin: 0; color: var(--text-2); line-height: 1.5; }
.tasks { display: flex; flex-direction: column; gap: 2px; }
.chk { display: flex; align-items: flex-start; gap: 10px; padding: 8px 8px; border-radius: 8px; font-size: 13px; line-height: 1.4; text-align: left; width: 100%; }
.chk:hover { background: #EEF1F5; }
.chk .box { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.5px solid var(--line-2); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }
.chk .box svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chk.done .box { background: var(--ok); border-color: var(--ok); }
.chk.done .t { color: var(--muted); }
.chk.warn .box { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.chk .s { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.hints { display: flex; flex-direction: column; gap: 6px; }
.hint { margin: 0; padding: 9px 11px; border-radius: 10px; background: #F4F5F7; font-size: 12px; line-height: 1.5; color: var(--text-2); }
.note { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: #7A3E00; font-size: 12px; line-height: 1.45; }
.guide-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.guide-nav .primary { flex: 1 1 100%; }

/* yhteenveto */
.summary { position: absolute; right: 12px; top: 12px; bottom: 60px; width: 320px; z-index: 5; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 10px; }
body.summary-closed .summary { display: none; }
.seats-card { padding: 10px 12px; border-radius: 10px; background: #F4F5F7; }
.seats-row { display: flex; justify-content: space-between; font-size: 12px; }
.seats-row b { font-variant-numeric: tabular-nums; }
.bar { height: 8px; margin-top: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--ok); transition: width .2s; }
.seats-card.short .bar div { background: var(--warn); }
.seats-card #bom-guests { margin-top: 6px; font-weight: 600; color: var(--ok); }
.seats-card.short #bom-guests { color: var(--warn); }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.totals .cost-total { grid-column: 1 / -1; background: #F4F5F7; }
.totals div { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.totals .k { display: block; color: var(--muted); font-size: 11px; }
.totals .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bom { width: 100%; border-collapse: collapse; }
.bom td { padding: 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 12px; color: var(--text-2); }
.bom td.num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); width: 2.6em; }
.bom-lib th { text-align: left; padding: 12px 0 4px; font-size: 12px; font-weight: 700; color: var(--text); }
.bom-lib th .cnt { font-weight: 500; color: var(--muted); float: right; }
.bom-meta { display: block; color: var(--muted); font-size: 11px; }
.bom-sum td { font-weight: 600; color: var(--text); }
.bom.media .sub { display: block; color: var(--muted); font-size: 11px; }
.sum-sec { border-top: 1px solid var(--line); }
.sum-sec summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 10px 0; font-size: 13px; font-weight: 600; }
.sum-sec summary::-webkit-details-marker { display: none; }
.sum-sec summary::after { content: "＋"; color: var(--muted); font-weight: 400; }
.sum-sec[open] summary::after { content: "－"; }
.sum-sec .cnt { font-weight: 500; color: var(--muted); margin-left: 6px; }
.bom.light th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 0 4px; }
.bom.light td + td, .bom.light th + th { text-align: right; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 10px 0 0; font-size: 11px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

/* kelluva muokkausrivi */
.selbar { position: absolute; z-index: 6; padding: 4px 6px; max-width: 760px; transform: translate(-50%, -100%); font-size: 12px; white-space: nowrap; }
.selbar-row { display: flex; align-items: center; gap: 2px; }
.selbar-row.media { flex-wrap: wrap; gap: 8px; padding: 6px 4px 4px; border-top: 1px solid var(--line); margin-top: 4px; white-space: normal; }
.selbar-row.media .field { margin: 0; }
.selbar .tool { height: 30px; padding: 0 8px; }
.selbar .tool.icon { width: 30px; }
.selbar .sel-name { margin: 0; padding: 0 6px; font-weight: 600; }
.selbar #sel-state { margin: 0; padding: 0 6px; }
.selbar #sel-pos { padding: 2px 6px 0; }
#sel-state.ok { color: var(--ok); }
#sel-state.bad { color: var(--bad); }
.selbar-group { display: inline-flex; align-items: center; gap: 2px; }

/* työkalurivi ja tilarivi */
.toolbar { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 2px; padding: 4px; }
.toolbar > div { display: flex; align-items: center; gap: 2px; }
.toolbar .seg { margin-right: 4px; }
.toolbar select { height: 30px; }
#zoom-pct { min-width: 44px; text-align: center; font-size: 12px; }
.status { position: absolute; left: 0; right: 0; bottom: 0; height: 36px; z-index: 6; display: flex; align-items: center; gap: 16px; padding: 0 14px; background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; }
#status-msg { overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }

.view-badge { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4; pointer-events: none; background: var(--glass); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 12px; color: var(--text-2); }
.gpu-render { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.render-panel { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 7; width: 300px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.render-panel progress { width: 100%; height: 6px; accent-color: var(--accent); }
.measure-label { position: absolute; z-index: 4; transform: translate(-50%, -140%); background: var(--ink); color: #fff; font: 500 12px var(--f); padding: 2px 8px; border-radius: 6px; pointer-events: none; }

/* ohje */
.help { border: 0; border-radius: var(--radius); padding: 20px 22px; max-width: 560px; width: calc(100% - 32px); box-shadow: var(--shadow-2); color: var(--text); }
.help::backdrop { background: rgba(16, 24, 40, .35); }
.modal { border: 0; border-radius: var(--radius); padding: 20px 22px; max-width: 360px; width: calc(100% - 32px); box-shadow: var(--shadow-2); color: var(--text); }
.modal::backdrop { background: rgba(16, 24, 40, .35); }
.keys { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; margin: 12px 0; font-size: 12px; }
.keys dt { font-weight: 600; }
.keys dd { margin: 0; color: var(--text-2); }

/* ---- aloitus ---- */
.start { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; }
.start-top { height: 56px; padding: 0 24px; display: flex; align-items: center; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.start-app { flex: 1 1 auto; font-weight: 600; }
.start-body { max-width: 1040px; margin: 0 auto; padding: 48px 24px 48px; display: flex; flex-direction: column; gap: 14px; }
/* kirjautumis- ja admin-näkymän leveydet (ei inline-tyyliä: CSP style-src 'self' pilvipaketissa) */
.start-body.narrow { max-width: 360px; }
.start-body.medium { max-width: 860px; }
.start h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
.lead { margin: 0 0 12px; font-size: 15px; color: var(--text-2); }
.start .chip { height: 34px; padding: 0 14px; font-size: 13px; }
.modes { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 12px; }
.mode { display: flex; flex-direction: column; gap: 12px; padding: 26px 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-decoration: none; color: var(--text); flex: 1 1 360px; min-width: 0; }
.mode:hover { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--text); }
.mode.rec { border-color: var(--accent); }
.mode h2 { margin: 0; font-size: 20px; font-weight: 700; }
.mode p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.mode ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.mode .btn { align-self: flex-start; margin-top: 4px; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #E9ECF0; color: var(--text-2); align-self: flex-start; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.recent-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.recent-grid button { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; width: 100%; }
.recent-grid button:hover { border-color: #9AA3AF; }
.recent-grid b { display: block; font-size: 14px; }

.print-only { display: none; }

@media (max-width: 1100px) {
  .top { flex-wrap: wrap; height: auto; padding: 8px 14px; }
  .panel, .summary { width: 280px; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body { display: block; background: #fff; color: #1B1F27; font-size: 10pt; }
  body > :not(#print) { display: none !important; }
  .print-only { display: block; }
  .sheet { height: 270mm; display: flex; flex-direction: column; gap: 4mm; break-after: page; }
  .sheet-plan { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
  .sheet-plan img { display: block; max-width: none; border: 0.2mm solid #93A3B6; }
  .title-block { width: 100%; border-collapse: collapse; border: 0.5mm solid #1B1F27; font-size: 8.5pt; }
  .title-block td { border: 0.2mm solid #1B1F27; padding: 1.4mm 2.4mm; vertical-align: top; }
  .title-block span { display: block; font-size: 6.5pt; letter-spacing: .12em; text-transform: uppercase; color: #5F6975; }
  .title-block b { display: block; min-height: 4.6mm; font-weight: 600; }
  .title-block .tb-logo { width: 62mm; vertical-align: middle; }
  .tb-logo img { width: 56mm; display: block; }
  .title-block .tb-foot { font-size: 7.5pt; color: #4A5D74; }
  .title-block .tb-foot span { display: inline; font: inherit; letter-spacing: 0; text-transform: none; color: #1B1F27; }
  #print h1 { font-size: 18pt; font-weight: 700; margin: 0 0 4mm; }
  #print h2 { margin: 6mm 0 2mm; }
  #print .totals { margin-bottom: 4mm; }
  #print .totals div { background: #F4F5F7; border-color: #ddd; }
  #print .bom td { border-color: #ddd; color: #1B1F27; }
  #print .notes, #print .bom-meta, #print .meta { color: #5F6975; }
  .media-print th { text-align: left; font-size: 7pt; letter-spacing: .1em; text-transform: uppercase; color: #5F6975; padding: 0 2mm 1mm 0; }
  .media-print td { padding: 1mm 2mm 1mm 0; font-size: 8.5pt; }
  .place-card { break-inside: avoid; }
  #print-moments-body h2 { margin: 6mm 0 2mm; color: #5F6975; }
}

/* Vain tietokoneelle: kosketuslaitteella näytetään pelkkä ilmoitus. Sama ehto on js/boot.js:ssä. */
.desktop-only { display: none; }
@media (pointer: coarse), (hover: none) {
  body { display: block; min-height: 100%; }
  body > :not(#desktop-only) { display: none !important; }
  .desktop-only {
    display: flex; flex-direction: column; justify-content: center; gap: 0;
    min-height: 100vh; min-height: 100dvh; max-width: 34rem; margin: 0 auto; padding: 48px 24px;
    font-size: 17px; line-height: 1.65;
  }
  .desktop-only .logo { width: 240px; height: auto; margin-bottom: 48px; }
  .desktop-only h1 { font-size: 2rem; font-weight: 700; margin: 0 0 18px; }
  .desktop-only p { margin: 0 0 14px; color: var(--text-2); }
  .desktop-only .label { margin-bottom: 12px; }
  .desktop-only .coord { margin: 10px 0 22px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
  .desktop-only button { align-self: flex-start; }
}

/* Admin: käyttäjälista (admin.html / js/admin.js) */
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.admin-users { width: 100%; border-collapse: collapse; margin: 12px 0 28px; font-size: 13px; }
.admin-users th, .admin-users td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-users th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.admin-users .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
