/* Lunchen – "Lunchbiljetten": ljus grå grund, bläckblå text, tomatröd huvudhandling, solgult för vinnare. */

:root{
  color-scheme: light;
  --bg: #F2F0EB;
  --card: #FFFFFF;
  --card-off: #E7E4DD;
  --ink: #16202A;
  --ink-soft: #3E454C;
  --muted: #5A626B;
  --line: #D5D1C8;
  --line-strong: #A8A396;
  --accent: #D2401F;
  --accent-ink: #B8361A;
  --on-accent: #FFFFFF;
  --sun: #FFC93C;
  --on-sun: #16202A;
  --night: #16202A;
  --on-night: #FFFFFF;
  --night-soft: #C3C9D0;
  --night-line: #3A4757;
  --ok: #1F8A4C;
  --bar: #EBE8E1;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --nav-h: 88px;
}
@media (prefers-color-scheme: dark){
  :root{
    color-scheme: dark;
    --bg: #10161D;
    --card: #1A232D;
    --card-off: #141B22;
    --ink: #EEF1F4;
    --ink-soft: #C9D0D7;
    --muted: #9BA5AF;
    --line: #2E3A47;
    --line-strong: #4A5868;
    --accent: #E4572E;
    --accent-ink: #FF8A65;
    --night: #26323F;
    --night-line: #3F4E5F;
    --bar: #2A3540;
  }
}

*{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }
body{
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a{ color: var(--accent-ink); }
a:hover{ text-decoration-thickness: 2px; }
h1, h2, h3{ margin: 0; }
p{ margin: 0; }
button, input, select{ font: inherit; color: inherit; }
:focus-visible{ outline: 3px solid var(--sun); outline-offset: 2px; }
.sr-only{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.screen{
  max-width: 520px; margin: 0 auto; min-height: 100vh;
  padding: 0 20px calc(var(--nav-h) + 24px);
  display: flex; flex-direction: column;
}
.screen.dark{ background: var(--night); color: var(--on-night); max-width: none; }
.screen.dark > *{ width: 100%; max-width: 480px; margin-left: auto; margin-right: auto; }
.screen.sun{ background: var(--sun); color: var(--on-sun); max-width: none; position: relative; overflow: hidden; }
.screen.sun > *{ width: 100%; max-width: 480px; margin-left: auto; margin-right: auto; position: relative; }
body.has-dark{ background: var(--night); }
body.has-sun{ background: var(--sun); }

/* Topp */
.top{ display: flex; align-items: center; justify-content: space-between; padding: 20px 0 8px; gap: 12px; }
.brand{ font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.5px; color: inherit; text-decoration: none; }
.brand span{ color: var(--accent); }
.back{ width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: inherit; margin-left: -12px; }
.top .label{ font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.pill{
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 600; border: 0; cursor: pointer;
}
.avatars{ display: inline-flex; }
.av{
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; border: 2px solid var(--card); background: var(--night); color: #fff;
  flex-shrink: 0; text-transform: uppercase;
}
.av + .av{ margin-left: -8px; }
.av.lg{ width: 36px; height: 36px; font-size: 12px; border: 0; }
.av.c1{ background: #16202A; color: #fff; } .av.c2{ background: #FFC93C; color: #16202A; }
.av.c3{ background: #D2401F; color: #fff; } .av.c4{ background: #2F6FB5; color: #fff; }
.av.c5{ background: #5A626B; color: #fff; } .av.c0{ background: #D5D1C8; color: #16202A; }
.av.out{ opacity: .45; }

.eyebrow{ font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.h1{ font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1.02; letter-spacing: -1.2px; }
.h2{ font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.4px; }
.intro{ padding-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.lead{ color: var(--ink-soft); font-size: 15px; }
.small{ font-size: 13px; color: var(--muted); }

/* Stor slumpknapp */
.spin-btn{
  margin-top: 20px; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 22px; border-radius: 24px; border: 0; cursor: pointer; text-align: left;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 0 var(--night);
  transition: transform .08s ease, box-shadow .08s ease;
}
.spin-btn:active{ transform: translateY(4px); box-shadow: 0 2px 0 var(--night); }
.spin-btn .t{ font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -.5px; display: block; }
.spin-btn .s{ font-size: 14px; color: #FFE9E2; display: block; }
.spin-btn .die{ width: 56px; height: 56px; border-radius: 16px; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.spin-btn:disabled{ opacity: .6; cursor: not-allowed; }

/* Listan */
.section{ padding-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.section-head{ display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card{
  background: var(--card); border-radius: 20px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.card.off{ background: var(--card-off); }
.card-head{ display: flex; justify-content: space-between; gap: 12px; }
.card-head .who{ display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-head .num{ display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; text-align: right; }
.card h3{ font-size: 18px; font-weight: 700; }
.card h3 a{ color: inherit; text-decoration: none; }
.card h3 a:hover{ text-decoration: underline; }
.card.off h3{ text-decoration: line-through; color: var(--ink-soft); }
.meta{ font-size: 13px; color: var(--muted); }
.price{ font-size: 15px; font-weight: 700; }
.card-body{ display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.dishes{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.35; }
.dishes li{ display: flex; justify-content: space-between; gap: 12px; }
.dishes .p{ color: var(--muted); flex-shrink: 0; }
.dishes .d{ display: block; font-size: 13px; color: var(--muted); }
.tag{ display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--bar); color: var(--ink-soft); margin-left: 4px; vertical-align: 1px; }
.card-foot{ display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.link{ font-size: 14px; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.note{ font-size: 13px; color: var(--ink-soft); }
.veto-band{
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border-radius: 14px; background: var(--night); color: var(--on-night);
}
.veto-band strong{ display: block; font-size: 14px; }
.veto-band span{ font-size: 13px; color: var(--night-soft); }

/* Knappar */
.btn{
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap;
}
.btn.ink{ background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.accent{ background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.ghost{ background: transparent; }
.btn.light{ background: transparent; color: #fff; border-color: #fff; }
.btn.big{ min-height: 56px; border-radius: 18px; font-family: var(--display); font-weight: 800; font-size: 20px; width: 100%; border: 0; }
.btn.wide{ width: 100%; min-height: 52px; border-radius: 16px; font-size: 15px; }
.btn.dashed{ border-style: dashed; border-color: var(--line-strong); background: transparent; }
.btn[aria-pressed="true"].vote{ background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[aria-pressed="true"].veto{ background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn:disabled{ opacity: .5; cursor: not-allowed; }
.row2{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions{ margin-top: auto; padding: 20px 0 8px; display: flex; flex-direction: column; gap: 10px; }

/* Slumpresultat (mörk vy) */
.reel{ padding-top: 20px; display: flex; flex-direction: column; align-items: center; }
.reel .ghost{
  font-family: var(--display); font-weight: 800; display: flex; align-items: flex-end; justify-content: center; box-sizing: border-box;
}
.reel .g1{ width: 82%; height: 40px; border-radius: 16px 16px 0 0; background: #26323F; color: #8C96A1; font-size: 18px; padding-bottom: 6px; }
.reel .g2{ width: 90%; height: 34px; background: #2F3D4C; color: #A9B2BC; font-size: 20px; padding-bottom: 4px; }
.ticket{
  width: 100%; background: var(--sun); color: var(--on-sun); border-radius: 24px; padding: 24px 22px 20px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.35); transform: rotate(-1.5deg);
}
.ticket a{ color: var(--on-sun); }
.ticket h1{ font-family: var(--display); font-weight: 800; font-size: 44px; line-height: .95; letter-spacing: -1.5px; }
.ticket .chip{ background: rgba(22,32,42,.1); border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 600; }
.ticket .cut{ border-top: 2px dashed rgba(22,32,42,.35); margin: 2px -22px 0; }
.ticket .dishes{ font-size: 15px; gap: 10px; }
.ticket .dishes .p, .ticket .dishes .d{ color: var(--on-sun); }
.ticket .dishes .p{ font-weight: 600; }
.ticket .tag{ background: rgba(22,32,42,.12); color: var(--on-sun); }
.dark .note{ color: var(--night-soft); text-align: center; margin-top: 18px; }
.dark .btn.ghost{ color: #fff; border-color: var(--night-line); }
.dark .btn .sub{ display: block; font-size: 12px; color: var(--night-soft); font-weight: 500; }
.dark .btn.stack{ flex-direction: column; gap: 1px; min-height: 52px; border-radius: 16px; font-size: 15px; white-space: normal; text-align: center; }
.spinning .ticket{ animation: drop .7s cubic-bezier(.2,1.4,.4,1) both; }
.spinning .reel .ghost{ animation: flick .5s ease-out both; }
@keyframes drop{ from{ transform: translateY(-60px) rotate(-6deg); opacity: 0; } to{ transform: rotate(-1.5deg); opacity: 1; } }
@keyframes flick{ from{ transform: translateY(30px); opacity: 0; } to{ transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce){ .spinning .ticket, .spinning .reel .ghost{ animation: none; } }

/* Omröstning */
.chip-dark{ display: inline-flex; align-items: center; gap: 8px; background: var(--night); color: #fff; border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; }
.live{ display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.live i{ width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.live.off i{ background: var(--line-strong); }
.seg{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; background: var(--bg); border-radius: 14px; padding: 4px; }
.seg button{ min-height: 44px; border: 0; border-radius: 11px; background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"]{ background: var(--ink); color: var(--bg); }
.people{ list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; }
.people li{ display: flex; align-items: center; gap: 8px; min-width: 0; }
.people .n{ font-size: 14px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .st{ font-size: 12px; color: var(--muted); display: block; }
.cand{ border: 2px solid var(--card); }
.cand.mine{ border-color: var(--ink); }
.cand.out{ opacity: .6; }
.cand.out h3{ text-decoration: line-through; }
.count{ font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; }
.bar{ height: 8px; border-radius: 999px; background: var(--bar); overflow: hidden; }
.bar i{ display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .3s ease; }
.cand-foot{ display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cand-foot .btns{ display: flex; gap: 6px; flex-shrink: 0; }
.add-form{ display: flex; gap: 8px; }
.add-form select{ flex: 1; min-width: 0; min-height: 52px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); padding: 0 12px; }

/* Beslut (gul vy) */
.confetti i{ position: absolute; display: block; }
.decision{ padding-top: 48px; display: flex; flex-direction: column; gap: 8px; }
.decision h1{ font-family: var(--display); font-weight: 800; font-size: 64px; line-height: .92; letter-spacing: -2.5px; word-break: break-word; }
.meet{ margin-top: 24px; background: var(--night); color: #fff; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.meet .time{ width: 64px; height: 52px; border-radius: 14px; background: var(--sun); color: var(--on-sun); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 18px; flex-shrink: 0; }
.meet .sub{ font-size: 14px; color: var(--night-soft); }
.meet .avatars .av{ width: 30px; height: 30px; font-size: 11px; border-color: var(--night); }
.meet-foot{ display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--night-line); padding-top: 12px; }
.tie{ margin-top: 12px; background: rgba(255,255,255,.55); border-radius: 18px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.sun .btn.ghost{ border-color: var(--on-sun); color: var(--on-sun); }
.sun .btn.big{ box-shadow: 0 5px 0 var(--night); }
.sun a{ color: var(--on-sun); }
.sun .btn.big.accent{ color: #fff; }

/* Formulär */
.form{ display: flex; flex-direction: column; gap: 16px; }
.field{ display: flex; flex-direction: column; gap: 6px; }
.field label, .legend{ font-size: 14px; font-weight: 600; }
.input{ min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; width: 100%; }
.row-fields{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
fieldset{ border: 0; margin: 0; padding: 0; }
.chips{ display: flex; flex-wrap: wrap; gap: 8px; }
.chk{ position: relative; }
.chk input{ position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chk span{ min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); display: inline-flex; align-items: center; font-size: 14px; font-weight: 600; background: var(--card); }
.chk input:checked + span{ background: var(--sun); border-color: var(--sun); color: var(--on-sun); }
.chk input:focus-visible + span{ outline: 3px solid var(--sun); outline-offset: 2px; }
.panel{ background: var(--card); border-radius: 24px; padding: 20px; }
.panel.night{ background: var(--night); color: #fff; }
.panel.night .input{ background: #26323F; border-color: var(--night-line); color: #fff; }
.panel.night .chk span{ background: transparent; border-color: var(--night-line); color: #fff; }
.panel.night .chk input:checked + span{ background: var(--sun); border-color: var(--sun); color: var(--on-sun); }
.panel.night .small{ color: var(--night-soft); }
.error{ background: #FDECEA; color: #8C1D18; border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.ok{ background: #E3F3EA; color: #145C33; border-radius: 14px; padding: 12px 14px; font-size: 14px; }

/* Inbjudan */
.qr{ width: 200px; height: 200px; padding: 12px; border: 2px solid var(--ink); border-radius: 16px; background: #fff; }
.qr svg{ width: 100%; height: 100%; display: block; }
.code{ font-family: var(--display); font-weight: 800; font-size: 40px; letter-spacing: 2px; }
.copy-row{ width: 100%; display: flex; gap: 8px; }
.copy-row .url{ flex: 1; min-width: 0; min-height: 48px; border-radius: 14px; background: var(--bg); display: flex; align-items: center; padding: 0 14px; font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Bottenmeny */
.nav{
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  display: flex; justify-content: center; z-index: 10;
}
body.has-dark .nav{ background: linear-gradient(to top, var(--night) 70%, transparent); }
body.has-sun .nav{ background: linear-gradient(to top, var(--sun) 70%, transparent); }
.nav .in{ width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; background: #16202A; border-radius: 999px; padding: 6px; }
.nav a{ min-height: 44px; border-radius: 999px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; text-decoration: none; }
.nav a[aria-current="page"]{ background: #fff; color: #16202A; font-weight: 700; }

.empty{ text-align: center; padding: 32px 12px; color: var(--ink-soft); }
details.more summary{ cursor: pointer; list-style: none; }
details.more summary::-webkit-details-marker{ display: none; }
details.more[open] summary{ display: none; }
.stack{ display: flex; flex-direction: column; gap: 12px; }

/* Kryssruta som rad (t.ex. "Lunch varje vardag") */
.switch-row{ display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); cursor: pointer; }
.switch-row input{ width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.switch-row strong{ display: block; font-size: 15px; }
.switch-row small{ display: block; font-size: 13px; color: var(--muted); }

.pw-checks{ list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.pw-checks li.pass{ color: var(--ok); }
.panel.night .pw-checks{ color: var(--night-soft); }
.panel.night .pw-checks li.pass{ color: #7FD6A2; }
select.input{ appearance: auto; }
