/* The workers' wish form (deploy/toivelomake). One reading column in the planner's own look (its cream ground,
   purple chips, system type). The worker sees one step at a time under a progress line, with Back and Next; each
   question is a card of its own. One page, two states: the form a worker fills in (no notes on how an answer is
   used), and the same form with the management's review tools (#arviointi), where every item says what is done
   with the answer. The manager page (hallinta.html) uses these styles too. */
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
:root {
  --bg: #F8F5F0; --card: #FFFFFF; --fg: #2C2C2C; --muted: #646464; --line: #E0DCD5;
  --primary: #6B6183; --primary-ink: #FFFFFF; --soft: #F5F3FA; --chip-line: #CFC7DD;
  --uses: #2B6B3A; --uses-bg: #E7F3E9; --sees: #7A5200; --sees-bg: #FBF0D9;
  --sm: #D9E6F7; --se: #FBE7C2; --sl: #E3DCF2; --sn: #C9C3DA; --alert: #B3261E; --focus: #2F6FED;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1A20; --card: #25232C; --fg: #ECE9F1; --muted: #ABA6B6; --line: #3A3744;
    --primary: #B3A6CC; --primary-ink: #1B1A20; --soft: #2E2B38; --chip-line: #4E4A5E;
    --uses: #9AD3A4; --uses-bg: #1F3325; --sees: #E5BD6A; --sees-bg: #3A2F17;
    --sm: #26384F; --se: #4A3B1C; --sl: #3A3350; --sn: #4C4666; --alert: #FF8A80; --focus: #8AB4FF; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1A20; --card: #25232C; --fg: #ECE9F1; --muted: #ABA6B6; --line: #3A3744;
  --primary: #B3A6CC; --primary-ink: #1B1A20; --soft: #2E2B38; --chip-line: #4E4A5E;
  --uses: #9AD3A4; --uses-bg: #1F3325; --sees: #E5BD6A; --sees-bg: #3A2F17;
  --sm: #26384F; --se: #4A3B1C; --sl: #3A3350; --sn: #4C4666; --alert: #FF8A80; --focus: #8AB4FF; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 760px; margin: 0 auto; padding-block: 20px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0; text-wrap: balance; }
h3 { font-size: 0.95rem; margin: 0; text-wrap: balance; }
p, ul, ol { margin: 0; }
button { font: inherit; color: inherit; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.top { display: flex; flex-direction: column; gap: 10px; }
.head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; justify-content: space-between; }
.head h1 { flex: 1 1 260px; min-width: 0; }
.lede { color: var(--muted); max-width: 65ch; display: grid; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--chip-line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; min-height: 40px; }
.seg button + button { border-left: 1px solid var(--chip-line); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); font-weight: 600; }
.modebar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; background: var(--sees-bg); color: var(--sees);
  border-radius: 8px; padding: 8px 12px; font-weight: 600; }
.view { display: flex; flex-direction: column; gap: 28px; margin-top: 14px; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.progress { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding-block: 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.progress-text { font-size: 0.87rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 0; }
.jump { border: 1px solid var(--primary); background: var(--card); color: var(--primary); border-radius: 6px; padding: 6px 12px; min-height: 40px; font-weight: 600; font-size: 0.87rem; white-space: nowrap; cursor: pointer; }
.jump:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.progress-text b { color: var(--fg); font-weight: 600; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.page { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.page-h { font-size: 1.4rem; line-height: 1.2; }
.page-h:focus { outline: none; }
.page-intro { max-width: 65ch; }
.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
.nav .btn { min-height: 46px; padding: 10px 22px; }
.nav .sp { flex: 1; }
.plain { padding-left: 1.2rem; display: grid; gap: 4px; max-width: 65ch; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.group-h { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.q { display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.q-text { font-size: 1.02rem; }
.q-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.q-text { font-weight: 600; flex: 1 1 260px; min-width: 0; }
.hint { color: var(--muted); font-size: 0.87rem; max-width: 70ch; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--chip-line); background: var(--card); border-radius: 999px; padding: 8px 15px; cursor: pointer; min-height: 40px; text-align: left; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chips.long { flex-direction: column; align-items: stretch; }
.chips.long .chip { border-radius: 12px; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.tag.uses { background: var(--uses-bg); color: var(--uses); }
.tag.sees { background: var(--sees-bg); color: var(--sees); }
.tag.card { background: var(--soft); color: var(--primary); border: 1px solid var(--chip-line); }
.learn { font-size: 0.82rem; border-left: 3px solid var(--primary); padding-left: 8px; }
.lv-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.lv-row .lv-q { font-size: 0.87rem; color: var(--muted); }
.levels { display: grid; gap: 4px; max-width: 70ch; padding: 0; list-style: none; }
.tag.mark { background: var(--soft); color: var(--primary); border: 1px solid var(--chip-line); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.star { display: inline-flex; border: 1px solid var(--chip-line); border-radius: 6px; overflow: hidden; }
.star button { border: 0; background: transparent; padding: 4px 9px; font-size: 0.8rem; cursor: pointer; min-height: 32px; }
.star button + button { border-left: 1px solid var(--chip-line); }
.star button[aria-pressed="true"] { background: var(--primary); font-weight: 600; color: var(--primary-ink); }
.star button[disabled] { opacity: 0.4; cursor: default; }
.shift-rows { display: grid; gap: 8px; }
.shift-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; }
.shift-name { min-width: 11rem; flex: 1 1 14rem; overflow-wrap: anywhere; }   /* a day's own name may be one long word */
.shift-name span { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.87rem; }
.msg { color: var(--alert); font-size: 0.87rem; font-weight: 600; }
textarea, input[type="text"] { width: 100%; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--chip-line); border-radius: 6px; padding: 8px; }
textarea { min-height: 72px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-weight: 600; }
.mind { padding-left: 1.2rem; display: grid; gap: 4px; max-width: 70ch; }
.pic { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; align-self: flex-start; max-width: 100%; }
.strip { display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 2.5rem)); gap: 3px; }
.strip .h { font-size: 0.68rem; color: var(--muted); text-align: center; letter-spacing: 0.04em; text-transform: uppercase; }
.examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ex { display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.ex .chips { flex-wrap: nowrap; }
.ex .chip { flex: 1 1 auto; padding: 8px 10px; text-align: center; white-space: nowrap; }
.cell { height: 26px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600; border: 1px solid var(--line); }
.cell.M { background: var(--sm); } .cell.E, .cell.D { background: var(--se); } .cell.L, .cell.P, .cell.W { background: var(--sl); } .cell.N { background: var(--sn); }
.cell.end { border-style: dashed; color: var(--muted); font-weight: 400; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.82rem; color: var(--muted); }
.add { display: flex; flex-wrap: wrap; gap: 8px; }
.add input[type="text"] { flex: 1 1 220px; width: auto; }
.ret { display: grid; gap: 12px; }
.strip.days { grid-template-columns: repeat(var(--a, 2), minmax(0, 2.5rem)) repeat(6, minmax(0, 2.5rem)); }
.ret-row { display: flex; flex-direction: column; gap: 4px; }
.ret-row .cell { height: 34px; }
.cell.pick { cursor: pointer; background: var(--card); color: var(--fg); padding: 0; font: inherit; font-weight: 700; }
.cell.pick.free { background: var(--uses-bg); }
.cell.pick.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.ret-row .res { font-size: 0.87rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank { list-style: none; padding: 0; display: grid; gap: 6px; max-width: 34rem; }
.rank li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px 4px 10px; }
.rank .rk { font-weight: 700; min-width: 1.6rem; font-variant-numeric: tabular-nums; }
.rank .rn { flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; }
.rank .rb { display: flex; gap: 4px; margin-left: auto; }
.mv { border: 1px solid var(--chip-line); background: var(--card); color: var(--fg); border-radius: 6px; min-width: 42px; min-height: 42px; padding: 0 10px; cursor: pointer; white-space: nowrap; }
.mv:disabled { opacity: 0.3; cursor: default; }
.rev { border-left: 3px solid var(--primary); background: var(--soft); border-radius: 0 6px 6px 0; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.rev .eff { font-size: 0.87rem; }
.rev textarea { min-height: 48px; }
.rev .chip { min-height: 32px; padding: 4px 12px; font-size: 0.87rem; }
.rev .chip[data-v="ok"][aria-pressed="true"] { background: var(--uses); border-color: var(--uses); color: var(--card); }
.rev .chip[data-v="drop"][aria-pressed="true"] { background: var(--alert); border-color: var(--alert); color: var(--card); }
.words { padding-left: 1.1rem; font-size: 0.82rem; color: var(--muted); display: grid; gap: 1px; font-variant-numeric: tabular-nums; }
.changes { padding-left: 1.2rem; display: grid; gap: 4px; max-width: 72ch; font-size: 0.92rem; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); vertical-align: -1px; margin-right: 4px; }
.q, .page, #f-name, #miss { scroll-margin-top: 88px; }
.miss-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.miss-go { width: 100%; text-align: left; border: 1px solid var(--chip-line); background: var(--card); color: var(--fg); border-radius: 8px; padding: 10px 12px; min-height: 44px; cursor: pointer; }
.miss-go { overflow-wrap: anywhere; }
.miss-go b { font-weight: 600; }
.miss-go span { color: var(--muted); }
.net { font-size: 0.8rem; color: var(--muted); }
.net.bad { color: var(--alert); font-weight: 600; }
.sent { color: var(--uses); font-weight: 600; }
.who { color: var(--muted); font-size: 0.87rem; }
.who b { color: var(--fg); }
.who .link { min-height: 36px; padding: 4px 0; font-size: inherit; }
.note { background: var(--sees-bg); color: var(--sees); border-radius: 8px; padding: 10px 12px; font-weight: 600; }
#gate-code { font-size: 1.25rem; letter-spacing: 0.08em; text-transform: uppercase; font-variant-numeric: tabular-nums; max-width: 16rem; min-height: 48px; }
.count { font-variant-numeric: tabular-nums; }
.count b { font-size: 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.btn { border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); border-radius: 6px; padding: 8px 14px; cursor: pointer; font-weight: 600; min-height: 40px; }
.btn.ghost { background: transparent; color: var(--primary); }
.link { border: 0; background: none; padding: 8px 0; min-height: 40px; color: var(--primary); text-decoration: underline; cursor: pointer; }
.status { font-size: 0.87rem; color: var(--muted); }
.foot { display: flex; justify-content: center; }
@media (max-width: 640px) {
  .strip.days { grid-template-columns: repeat(var(--a, 2), minmax(0, 0.62fr)) repeat(6, minmax(0, 1fr)); }
  .strip.days .h { font-size: 0.6rem; letter-spacing: 0; }
  .ret-row .cell { height: 44px; }
  .chip { min-height: 44px; padding: 8px 14px; }
  .shift-row .chips { flex-wrap: nowrap; width: 100%; }
  .shift-row .chip { flex: 1 1 auto; padding: 8px 8px; text-align: center; white-space: nowrap; }
  .star button { min-height: 44px; }
  .shift-name { min-width: 0; flex: 1 1 100%; }
}
@media (prefers-reduced-motion: no-preference) { .chip, .seg button { transition: background-color .12s; } .bar i { transition: width .2s; } }
@media print {
  .seg, .actions, .foot, .modebar, .add, .progress, .nav, .miss .hint, .star button[aria-pressed="false"], .star button[data-lv="normal"] { display: none !important; }
  .star { border: 0; }
  .card { break-inside: avoid; } body { font-size: 12px; background: #fff; }
  .chip[aria-pressed="true"] { border-width: 2px; font-weight: 700; }
  .chip[aria-pressed="true"]::before { content: "\2713\00a0"; }
}
