/* LUB-appen – Svenska kyrkans grafiska profil (samma som Taizé-appen och Tyresö Unga)
   Typsnitt: DM Sans (huvudtypsnitt) + Spectral Italic (betoning)
   Färger: beige grund, svart text, vinröd/rosa/orange/guld (varma skalan – grönt och lila blandas inte in) */

@font-face { font-family: 'DM Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/dm-sans/dm-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/dm-sans/dm-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/dm-sans/dm-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Spectral'; font-weight: 400; font-style: italic; font-display: swap; src: url('/fonts/spectral/spectral-latin-400-italic.woff2') format('woff2'); }

:root {
  --beige: #FFEBE1;
  --beige-2: #FFF5F0;
  --beige-3: #F7DCCF;
  --svart: #000000;
  --text-2: #4a3a3f;
  --vinrod: #7D0037;
  --vinrod-2: #5e0029;
  --rosa: #FFC3AA;
  --orange: #FF785A;
  --guld: #BC8E4C;
  --radius: 18px;
  --sans: 'DM Sans', Arial, sans-serif;
  --serif: 'Spectral', 'Times New Roman', serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--beige); color: var(--svart);
  font-family: var(--sans); font-size: 16px; line-height: 1.2;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--vinrod); }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; }
h1, h2, h3 { font-weight: 500; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 34px; line-height: 0.98; }
h2 { font-size: 22px; line-height: 1.0; }
h3 { font-size: 18px; line-height: 1.1; }
p { line-height: 1.3; margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.hidden { display: none !important; }

/* ------------------------------------------------ Ram */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  max-width: 760px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 40px; text-decoration: none; color: inherit; font-weight: 500; min-width: 0; }
.brand .mark { width: 30px; height: 30px; background: var(--vinrod); border-radius: 7px; position: relative; overflow: hidden; flex: none; }
.brand .mark::after { content: ''; position: absolute; right: 0; top: 0; width: 17px; height: 17px; background: var(--rosa); border-bottom-left-radius: 17px; }
.brand .sep { width: 1px; height: 22px; background: var(--svart); flex: none; }
.brand .parish { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 4px; flex: none; }
.icon-btn {
  border: 0; background: transparent; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none;
  color: var(--svart); text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: rgba(0,0,0,.05); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.on { background: var(--rosa); color: var(--vinrod); }

main { max-width: 760px; margin: 0 auto; padding: 4px 16px calc(40px + var(--safe-b)); }
.page-head { padding: 12px 0 20px; }
.page-head p { margin-top: 10px; }

/* ------------------------------------------------ Nedräkningen (kvadrat + kvartscirkel) */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--vinrod); color: var(--beige); padding: 22px 20px 20px;
  transition: background-color .4s ease, color .4s ease;
}
.hero::after {
  content: ''; position: absolute; right: -1px; top: -1px; width: 72px; height: 72px;
  background: var(--rosa); border-bottom-left-radius: 72px; transition: background-color .4s ease;
}
.hero > * { position: relative; z-index: 1; }
.hero .kicker { font-size: 15px; color: var(--rosa); margin-bottom: 34px; max-width: calc(100% - 64px); min-height: 18px; }
.hero h1 { font-size: 30px; line-height: 1.02; overflow-wrap: break-word; hyphens: auto; min-height: 61px; }
@media (max-width: 360px) { .hero h1 { font-size: 27px; min-height: 55px; } }
.hero h1 .serif { color: var(--rosa); }
.hero .count-label { margin-top: 22px; font-size: 15px; color: var(--rosa); }
.hero .count {
  font-size: clamp(76px, 27vw, 148px); font-weight: 500; line-height: .95; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap;
}
.hero .count.long { font-size: clamp(54px, 19vw, 110px); }
.hero .count.text { font-size: clamp(40px, 12vw, 64px); letter-spacing: -0.02em; white-space: normal; line-height: 1; }
.hero .bar { height: 8px; border-radius: 4px; background: rgba(255, 235, 225, .25); margin-top: 16px; overflow: hidden; }
.hero .bar i { display: block; height: 100%; width: 0; background: var(--rosa); border-radius: 4px; transition: width .3s linear; }
.hero .then { margin-top: 14px; font-size: 17px; line-height: 1.25; }
.hero .then strong { font-weight: 700; }

/* Sista minuten: orange, så att alla ser att det snart är dags */
.hero.soon { background: var(--orange); color: var(--svart); }
.hero.soon::after { background: var(--vinrod); }
.hero.soon .kicker, .hero.soon .count-label, .hero.soon h1 .serif { color: var(--vinrod-2); }
.hero.soon .bar { background: rgba(0,0,0,.15); }
.hero.soon .bar i { background: var(--vinrod); }
.hero.final .count { animation: tick 1s ease-in-out infinite; }
@keyframes tick { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.04); } }
.hero .count { transform-origin: left center; }

.hero.calm { background: var(--svart); }
.hero.calm::after { background: var(--guld); }

/* Blinkar över hela skärmen när det är dags att byta */
.flash {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--orange); color: var(--svart); padding: 24px; cursor: pointer;
  animation: blink 1s steps(1) 6;
}
.flash .big { font-size: clamp(64px, 24vw, 150px); font-weight: 500; line-height: .95; letter-spacing: -0.03em; }
.flash .big .serif { display: block; }
.flash p { font-size: 22px; margin-top: 18px; max-width: 520px; overflow-wrap: anywhere; }
.flash .shape { width: 110px; height: 110px; background: var(--vinrod); border-top-right-radius: 110px; margin-bottom: 26px; }
@keyframes blink { 0% { background: var(--orange); } 50% { background: var(--rosa); } }

/* Meddelande från personalen */
.notice {
  background: var(--guld); color: var(--svart); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
  display: flex; gap: 12px; align-items: flex-start; line-height: 1.3; font-weight: 500; overflow-wrap: anywhere;
}
.notice svg { width: 22px; height: 22px; flex: none; }
.offline { background: var(--beige-3); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }

/* ------------------------------------------------ Schemat */
.section { margin: 28px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section .muted { font-size: 15px; }
.list { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.row {
  background: var(--beige-2); border: 1px solid var(--beige-3); border-radius: 14px; padding: 12px 14px;
  display: flex; gap: 14px; align-items: center; min-width: 0;
}
.row .time { flex: none; width: 52px; font-variant-numeric: tabular-nums; line-height: 1.15; font-weight: 500; }
.row .time small { display: block; font-weight: 400; color: var(--text-2); font-size: 14px; }
.row .body { flex: 1; min-width: 0; }
.row h3 { overflow-wrap: anywhere; }
.row .note { color: var(--text-2); font-size: 14px; line-height: 1.3; margin-top: 3px; overflow-wrap: anywhere; }
.row .len { flex: none; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.row.past { opacity: .5; }
.row.now { background: var(--rosa); border-color: var(--rosa); border-top-right-radius: 34px; }
.row.now .time small, .row.now .note, .row.now .len { color: #3d1b22; }
.row.now .len { font-weight: 700; color: var(--vinrod); }
.row.next { border-color: var(--vinrod); }
a.row { text-decoration: none; color: inherit; }
.card-empty { text-align: center; color: var(--text-2); padding: 22px; border: 1px dashed var(--beige-3); border-radius: var(--radius); line-height: 1.3; }

.foot { margin-top: 32px; text-align: center; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.foot a { font-weight: 500; }

/* ------------------------------------------------ Knappar & formulär */
.btn {
  appearance: none; border: 2px solid var(--vinrod); background: var(--vinrod); color: var(--beige);
  border-radius: 999px; padding: 12px 20px; font-weight: 500; font-size: 16px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--vinrod-2); border-color: var(--vinrod-2); }
.btn svg { width: 18px; height: 18px; }
.btn.secondary { background: transparent; color: var(--vinrod); }
.btn.secondary:hover { background: rgba(125, 0, 55, .06); }
.btn.dark { background: var(--svart); border-color: var(--svart); }
.btn.danger { background: transparent; color: #a3001f; border-color: #a3001f; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1 1 130px; }
.panel.live .btn-row .btn.small { flex: 1 1 76px; padding: 8px 10px; white-space: nowrap; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 15px; }
.field .hint { font-size: 13px; color: var(--text-2); line-height: 1.3; }
.input, .field input, .field textarea {
  width: 100%; border: 2px solid var(--beige-3); background: #fff; border-radius: 12px;
  padding: 12px 14px; font-size: 16px; min-height: 48px; outline: none; min-width: 0;
}
.input:focus, .field input:focus { border-color: var(--vinrod); }
.error { background: #ffe1d9; border-left: 4px solid var(--orange); padding: 10px 12px; border-radius: 8px; font-size: 15px; margin-bottom: 14px; line-height: 1.3; }

.panel { background: var(--beige-2); border: 1px solid var(--beige-3); border-radius: var(--radius); padding: 16px; }
.panel + .panel { margin-top: 12px; }
.panel h3 { margin-bottom: 6px; }
.panel > p { color: var(--text-2); font-size: 15px; }
.panel.live { background: var(--vinrod); border-color: var(--vinrod); color: var(--beige); }
.panel.live > p { color: var(--rosa); }
.panel.live .big { font-size: 44px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; margin: 10px 0 2px; }
.panel.live .btn { background: var(--beige); border-color: var(--beige); color: var(--vinrod); }
.panel.live .btn.secondary { background: transparent; color: var(--beige); }
.panel.live .btn.hot { background: var(--orange); border-color: var(--orange); color: var(--svart); flex-basis: 100%; }

/* Redigera schema */
.edit-row { background: var(--beige-2); border: 1px solid var(--beige-3); border-radius: 14px; padding: 10px; display: grid; gap: 8px; }
.edit-row .line { display: flex; gap: 8px; align-items: center; min-width: 0; }
.edit-row { min-width: 0; }
.edit-row input { border: 2px solid var(--beige-3); background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 16px; min-height: 44px; outline: none; min-width: 0; }
.edit-row input:focus { border-color: var(--vinrod); }
.edit-row input[type=time] { flex: 1 1 0; width: 0; font-variant-numeric: tabular-nums; }
.edit-row input.title { flex: 1; font-weight: 500; }
.edit-row input.note { flex: 1; font-size: 15px; }
.edit-row input.what, .edit-row input.group { flex: 1; }
.edit-row .dash { flex: none; color: var(--text-2); }
.edit-row .del { color: #a3001f; }

.edit-row select { flex: 1 1 0; width: 0; border: 2px solid var(--beige-3); background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 16px; min-height: 44px; min-width: 0; font-weight: 500; }
.edit-row select:focus { border-color: var(--vinrod); outline: none; }
.edit-row .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--svart); color: var(--beige); display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.edit-row .icon-btn { width: 40px; height: 40px; }
.edit-row .icon-btn:disabled { opacity: .25; cursor: default; }
.edit-row .check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; min-height: 32px; cursor: pointer; }
.edit-row .check input { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--vinrod); flex: none; }
.edit-row .sendto { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.edit-row .sendto svg { width: 16px; height: 16px; flex: none; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-btn { border: 2px solid var(--beige-3); background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 15px; cursor: pointer; min-height: 38px; -webkit-tap-highlight-color: transparent; }
.pick-btn.on { background: var(--vinrod); border-color: var(--vinrod); color: var(--beige); font-weight: 500; }
.field textarea { line-height: 1.4; resize: vertical; }

/* ------------------------------------------------ Stationer: vem är var och vart skickar man */
.stations { display: grid; gap: 8px; }
@media (min-width: 620px) { .stations { grid-template-columns: 1fr 1fr; } }
.station {
  background: var(--beige-2); border: 1px solid var(--beige-3); border-radius: 14px; padding: 12px 14px;
  display: grid; gap: 6px; justify-items: start; min-width: 0;
}
.station .top { appearance: none; border: 0; background: none; padding: 0; color: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 32px; }
.station .room { font-size: 20px; font-weight: 500; line-height: 1.1; overflow-wrap: anywhere; min-width: 0; }
.station .tag { flex: none; font-size: 13px; font-weight: 500; background: transparent; color: var(--vinrod); border: 1.5px solid var(--vinrod); border-radius: 999px; padding: 4px 11px; }
.station.mine .tag { background: var(--beige); border-color: var(--beige); font-weight: 700; }
.station .who { font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.station .chip { font-size: 14px; background: var(--beige); border: 1px solid var(--beige-3); border-radius: 999px; padding: 3px 10px; overflow-wrap: anywhere; }
.station .to { display: flex; align-items: flex-start; gap: 6px; font-size: 15px; line-height: 1.25; color: var(--vinrod); overflow-wrap: anywhere; }
.station .to svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.station.mine { background: var(--vinrod); border-color: var(--vinrod); color: var(--beige); border-top-right-radius: 34px; }
.station.mine .to { color: var(--rosa); }
.station.mine .chip { background: transparent; border-color: rgba(255, 235, 225, .45); }
.station.mine .tag { margin-right: 14px; }
.hint-line { font-size: 14px; color: var(--text-2); margin-top: 10px; line-height: 1.3; }

.hero .send { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 235, 225, .3); font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.hero .send .go { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; font-size: 21px; line-height: 1.15; font-weight: 500; }
.hero .send .go strong { font-weight: 700; }
.hero .send .go svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.hero.soon .send { border-top-color: rgba(0, 0, 0, .2); }

.edit-row .seg { display: flex; background: var(--beige-3); border-radius: 999px; padding: 3px; gap: 3px; }
.edit-row .seg button { flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 999px; font-weight: 500; font-size: 15px; cursor: pointer; min-height: 40px; -webkit-tap-highlight-color: transparent; }
.edit-row .seg button.active { background: var(--svart); color: var(--beige); }
.who-pick { border: 2px solid var(--beige-3); background: #fff; border-radius: 10px; }
.who-pick summary { list-style: none; cursor: pointer; padding: 10px 12px; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.who-pick summary::-webkit-details-marker { display: none; }
.who-pick .chg { flex: none; color: var(--vinrod); font-weight: 500; text-decoration: underline; }
.who-pick[open] .chg { visibility: hidden; }
.who-pick .pick { padding: 0 10px 10px; }
.row .where { font-size: 14px; line-height: 1.3; margin-top: 3px; color: var(--text-2); overflow-wrap: anywhere; }
.row .where .kind { color: var(--vinrod); font-weight: 500; }
.row.now .where { color: #3d1b22; }
.station .what { font-size: 16px; font-weight: 500; line-height: 1.2; overflow-wrap: anywhere; }
.station .who { font-size: 15px; }
.station .who strong { font-weight: 500; }
.hero .send > div + div { margin-top: 10px; }

/* ------------------------------------------------ Instruktioner till ledarna */
.info-text { white-space: pre-line; line-height: 1.4; overflow-wrap: anywhere; }
details.info { width: 100%; margin-top: 4px; }
details.info summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--vinrod); text-decoration: underline; min-height: 32px; }
details.info summary::-webkit-details-marker { display: none; }
details.info summary::after { content: '+'; text-decoration: none; display: inline-block; font-weight: 700; }
details.info[open] summary::after { content: '–'; }
details.info .info-text { font-size: 15px; padding: 4px 0 6px; color: var(--svart); }
.station.mine details.info summary { color: var(--rosa); }
.station.mine details.info .info-text { color: var(--beige); }
.row.past details.info { display: none; }
.task { background: var(--svart); color: var(--beige); border-radius: var(--radius); border-bottom-left-radius: 44px; padding: 18px 20px 22px 22px; margin-top: 12px; }
.task-k { font-size: 14px; color: var(--rosa); margin-bottom: 6px; }
.task h2 { font-size: 21px; line-height: 1.1; margin-bottom: 10px; overflow-wrap: anywhere; }
.task .info-text { font-size: 16px; }
.edit-row textarea { width: 100%; border: 2px solid var(--beige-3); background: #fff; border-radius: 10px; padding: 9px 10px; font-size: 15px; line-height: 1.35; resize: vertical; outline: none; min-height: 76px; display: block; }
.edit-row textarea:focus { border-color: var(--vinrod); }

.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); transform: translateX(-50%);
  background: var(--svart); color: var(--beige); padding: 12px 18px; border-radius: 14px; z-index: 90; font-weight: 500;
  max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25); line-height: 1.3;
}
.toast.err { background: var(--orange); color: var(--svart); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--beige-3); border-top-color: var(--vinrod); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 700px) {
  .hero { padding: 32px 30px 28px; }
  .hero::after { width: 110px; height: 110px; border-bottom-left-radius: 110px; }
  .hero .kicker { margin-bottom: 60px; }
  .hero h1 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
