/* Schema – Svenska kyrkans grafiska profil (samma som samlingsappen)
   Typsnitt: DM Sans (huvudtypsnitt) + Spectral Italic (betoning)
   Färger: beige grund, svart text, vinröd/rosa/orange/guld */

@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: 'DM Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/dm-sans/dm-sans-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-024F; }
@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;
  --nav-h: 68px;
  --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.25; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--vinrod); }
h1, h2, h3 { font-weight: 500; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1; }
h2 { font-size: 22px; line-height: 1.05; }
h3 { font-size: 17px; }
p { margin: 0; line-height: 1.35; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--vinrod); }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Ram */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--beige); border-bottom: 1px solid var(--beige-3); }
.topbar .inner { max-width: 1480px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-height: 44px; }
.brand img { height: 36px; width: auto; display: block; }
.brand .sk { font-weight: 700; }
.brand .sep { width: 1px; height: 22px; background: var(--svart); }
.brand .app { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--vinrod); margin-left: 6px; }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.mainnav a { padding: 10px 14px; border-radius: 999px; text-decoration: none; color: var(--svart); font-weight: 500; font-size: 15px; }
.mainnav a.on { background: var(--svart); color: var(--beige); }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--rosa); color: var(--vinrod); font-weight: 700; font-size: 15px; display: grid; place-items: center; flex: none; }
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }

main { max-width: 1480px; margin: 0 auto; padding: 24px 24px 64px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head .kicker { margin-bottom: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.layout > .content { flex: 999 1 720px; min-width: 0; }
.layout > .side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.bottomnav { display: none; }
@media (max-width: 860px) {
  .mainnav { display: none; }
  .topbar .inner { padding: 10px 16px; }
  main { padding: 16px 16px calc(var(--nav-h) + 40px + var(--safe-b)); }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--svart); padding-bottom: var(--safe-b); }
  .bottomnav a { flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #cdb9b0; text-decoration: none; font-size: 11px; font-weight: 500; }
  .bottomnav a.on { color: var(--beige); }
  .brand .sk, .brand .sep { display: none; }
  .brand.has-logo .app { display: none; }
}

/* ---------------------------------------------------------------- Knappar och fält */
.btn { border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 500; font-size: 15px; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; background: var(--vinrod); color: #fff; white-space: nowrap; }
.btn:hover { background: var(--vinrod-2); }
.btn.sec { background: transparent; color: var(--svart); box-shadow: inset 0 0 0 1.5px var(--svart); }
.btn.sec:hover { background: var(--beige-2); }
.btn.ghost { background: transparent; color: var(--svart); }
.btn.ghost:hover { background: var(--beige-3); }
.btn.danger { background: transparent; color: var(--vinrod); box-shadow: inset 0 0 0 1.5px var(--vinrod); }
.btn.sm { padding: 7px 14px; min-height: 36px; font-size: 14px; }
.btn.icon { width: 44px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; background: var(--beige-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: 14px; cursor: pointer; min-height: 36px; }
.seg button.on { background: var(--vinrod); color: #fff; }
.seg.dark button.on { background: var(--svart); color: var(--beige); }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.inp, select.inp, textarea.inp { width: 100%; border: 0; border-radius: 12px; background: #fff; padding: 11px 13px; font-size: 16px; min-height: 46px; box-shadow: inset 0 0 0 1px var(--beige-3); font-weight: 400; }
.inp:focus { outline: 2px solid var(--vinrod); outline-offset: 1px; }
textarea.inp { min-height: 90px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.35; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--vinrod); flex: none; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 500; cursor: pointer; min-height: 40px; background: #fff; box-shadow: inset 0 0 0 1px var(--beige-3); }
.pill.on { box-shadow: inset 0 0 0 2px var(--svart); background: var(--beige-2); }
.pill .av { width: 24px; height: 24px; font-size: 10px; }
.pill.dim { opacity: .55; }
.sw { width: 14px; height: 14px; border-radius: 4px; flex: none; display: inline-block; }

.card { background: var(--beige-2); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card.dark { background: var(--svart); color: var(--beige); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--beige-3); }
.list-row:first-of-type { border-top: 0; }
.stat b { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 38px; line-height: 1; color: var(--vinrod); }
.card.dark.stat b { color: var(--rosa); }
.stat span { font-size: 14px; color: var(--text-2); }
.card.dark.stat span { color: var(--beige); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.notice { background: var(--rosa); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.35; }
.empty { padding: 28px; text-align: center; color: var(--text-2); }

/* ---------------------------------------------------------------- Kalender */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.month { min-width: 860px; display: flex; flex-direction: column; gap: 6px; }
.mrow { display: grid; grid-template-columns: 40px repeat(7, minmax(0, 1fr)); gap: 6px; }
.mrow.head { font-size: 13px; color: var(--text-2); font-weight: 500; }
.wkno { font-size: 13px; font-weight: 700; padding-top: 9px; }
.day { background: var(--beige-2); border-radius: 10px; padding: 7px; min-height: 118px; display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; border: 0; text-align: left; }
.day:hover { box-shadow: inset 0 0 0 1px var(--guld); }
.day.out { background: transparent; box-shadow: inset 0 0 0 1px var(--beige-3); }
.day.out .dnum { color: #8a767c; }
.day.today { box-shadow: inset 0 0 0 2px var(--vinrod); }
.day.red .dnum b { color: var(--vinrod); }
.dnum { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 14px; margin-bottom: 2px; }
.dnum b { font-weight: 500; }
.dnum small { font-size: 11px; color: var(--vinrod); font-weight: 700; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-radius: 6px; padding: 3px 6px; font-size: 12px; line-height: 1.2; font-weight: 500; min-height: 20px; border: 0; cursor: pointer; text-align: left; width: 100%; }
.chip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chip .ini { font-size: 10px; font-weight: 700; letter-spacing: .02em; opacity: .9; white-space: nowrap; }
.chip.ovr { background: transparent !important; color: var(--text-2) !important; box-shadow: inset 0 0 0 1px #8a767c; font-style: italic; }
.chip.missing { outline: 2px dashed var(--svart); outline-offset: -1px; }
.chip.light { box-shadow: inset 0 0 0 1px var(--svart); }
.more { font-size: 12px; color: var(--text-2); text-decoration: underline; padding: 2px 4px; }
.inline-chip { display: inline-flex; width: auto; cursor: default; }

.year { min-width: 1300px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.ycol { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ycol h3 { font-size: 14px; font-weight: 700; padding: 0 4px 6px; border-bottom: 2px solid var(--svart); margin-bottom: 4px; }
.yc { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 4px; height: 26px; padding: 0 4px; border-radius: 5px; background: var(--beige-2); font-size: 11px; border: 0; cursor: pointer; text-align: left; }
.yc.we { background: var(--beige-3); }
.yc.red .yd { color: var(--vinrod); font-weight: 700; }
.yc.today { box-shadow: inset 0 0 0 2px var(--vinrod); }
.yd { color: var(--text-2); font-weight: 500; white-space: nowrap; }
.yl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; padding: 2px 4px; font-weight: 500; min-width: 0; }
.yn { font-size: 10px; font-weight: 700; color: var(--text-2); }

.alist { display: flex; flex-direction: column; gap: 4px; }
.arow { display: grid; grid-template-columns: 120px 110px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--beige-2); border-radius: 12px; padding: 10px 14px; border: 0; text-align: left; cursor: pointer; width: 100%; }
.arow .sw { margin-right: 8px; }
@media (max-width: 640px) { .arow { grid-template-columns: 1fr; gap: 4px; } }

/* ---------------------------------------------------------------- Mitt schema */
.weeks { min-width: 720px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(40px, 1fr); gap: 5px; align-items: end; }
.wk { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: flex-end; padding: 8px 2px; border-radius: 10px; background: var(--beige-2); font-size: 11px; border: 0; cursor: pointer; min-height: 110px; }
.wk .bar { width: 60%; border-radius: 4px; background: var(--rosa); min-height: 4px; }
.wk.full .bar { background: var(--vinrod); }
.wk.none .bar { background: transparent; box-shadow: inset 0 0 0 1px var(--guld); }
.wk.sel { box-shadow: inset 0 0 0 2px var(--svart); }
.wk.now .wn { color: var(--vinrod); font-weight: 700; }
table.work { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 820px; font-size: 14px; }
table.work th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 13px; padding: 8px; border-bottom: 2px solid var(--svart); }
table.work td { padding: 6px 8px; border-bottom: 1px solid var(--beige-3); vertical-align: middle; }
table.work tr.we td { background: rgba(247, 220, 207, .6); }
table.work tr.warn td { background: var(--rosa); }
table.work tr.today td:first-child { box-shadow: inset 3px 0 0 var(--vinrod); }
.tinp { width: 74px; border: 0; border-radius: 8px; background: #fff; padding: 7px 8px; font-size: 15px; min-height: 38px; box-shadow: inset 0 0 0 1px var(--beige-3); }
.tinp.kind { width: 120px; }
.tinp.note { width: 100%; min-width: 120px; }
.tinp:disabled { background: transparent; box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips .chip { width: auto; cursor: default; }
.rule { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.35; padding: 8px 0; border-top: 1px solid var(--beige-3); }
.rule:first-of-type { border-top: 0; }
.dot { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--svart); color: var(--beige); }
.dot.bad { background: var(--orange); color: var(--svart); }
.saved { font-size: 12px; color: var(--text-2); min-width: 60px; }

/* ---------------------------------------------------------------- Bemanning */
.crew { min-width: 1100px; display: flex; flex-direction: column; gap: 6px; }
.crow { display: grid; grid-template-columns: 190px repeat(7, minmax(0, 1fr)); gap: 6px; }
.crow.head span { font-size: 13px; color: var(--text-2); font-weight: 500; padding: 0 4px; }
.who { display: flex; align-items: center; gap: 10px; background: var(--beige-2); border-radius: 12px; padding: 10px; min-width: 0; }
.who .av { width: 36px; height: 36px; font-size: 13px; }
.cell { background: var(--beige-2); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 4px; min-height: 72px; font-size: 12px; min-width: 0; }
.cell.off { background: transparent; box-shadow: inset 0 0 0 1px var(--beige-3); color: var(--text-2); }
.cell.away { background: #fff; box-shadow: inset 0 0 0 1px var(--svart); }
.cell.warn { background: var(--rosa); }
.cell .tm { font-size: 13px; font-weight: 500; }
.cover { background: var(--svart); color: var(--beige); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; min-height: 56px; min-width: 0; }
.cover .miss { color: var(--orange); font-weight: 700; }

/* ---------------------------------------------------------------- Personal */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.person { background: var(--beige-2); border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; align-items: flex-start; border: 0; text-align: left; cursor: pointer; width: 100%; }
.person .av { width: 44px; height: 44px; font-size: 15px; }
.person.inactive { opacity: .55; }
.tpl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tpl td, .tpl th { padding: 6px 4px; text-align: left; }
.tpl th { font-weight: 500; color: var(--text-2); font-size: 13px; }

/* ---------------------------------------------------------------- Dialog */
.modal-back { position: fixed; inset: 0; background: rgba(40, 10, 20, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto; }
.modal { background: var(--beige-2); border-radius: 22px; width: 100%; max-width: 720px; padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal.wide { max-width: 1100px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--beige-3); }
.modal-foot .left { margin-right: auto; display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 560px) { .modal-back { padding: 0; } .modal { border-radius: 0; min-height: 100dvh; padding: 20px 16px 32px; } }
.menu { position: absolute; right: 16px; top: 64px; background: var(--beige-2); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .18); padding: 8px; display: flex; flex-direction: column; min-width: 220px; z-index: 50; }
.menu a, .menu button { padding: 12px 14px; border-radius: 10px; text-decoration: none; color: var(--svart); border: 0; background: transparent; text-align: left; cursor: pointer; font-weight: 500; }
.menu a:hover, .menu button:hover { background: var(--beige-3); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--svart); color: var(--beige); padding: 12px 18px; border-radius: 999px; z-index: 200; font-weight: 500; font-size: 15px; max-width: calc(100% - 32px); }
@media (max-width: 860px) { .toast { bottom: calc(var(--nav-h) + 16px + var(--safe-b)); } }
.pw { font-family: ui-monospace, Menlo, monospace; font-size: 20px; background: #fff; padding: 12px 16px; border-radius: 12px; user-select: all; }

/* ---------------------------------------------------------------- Inloggning */
.auth { max-width: 440px; margin: 8vh auto 40px; padding: 0 16px; display: flex; flex-direction: column; gap: 20px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.err { color: var(--vinrod); font-weight: 500; font-size: 14px; min-height: 18px; }

table.imp { width: 100%; border-collapse: collapse; font-size: 14px; }
table.imp td, table.imp th { padding: 6px; border-bottom: 1px solid var(--beige-3); text-align: left; vertical-align: middle; }
table.imp th { font-weight: 500; color: var(--text-2); font-size: 13px; position: sticky; top: 0; background: var(--beige-2); }
table.imp select { min-height: 36px; padding: 6px 8px; font-size: 14px; }
table.imp tr.dup td { color: #8a767c; }

@media print {
  .topbar, .bottomnav, .side, .toolbar, .no-print { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .day, .yc, .cell { break-inside: avoid; }
}
.alist .card .chip { min-height: 32px; font-size: 14px; padding: 6px 10px; }
@media (max-width: 700px) {
  .page-head .toolbar { width: 100%; }
  .topbar .seg button { padding: 8px 11px; }
}

/* ---------------------------------------------------------------- Lokalbokning */
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: var(--svart); font-size: 12px; font-weight: 700; margin-left: 6px; }
.dot-badge { position: absolute; top: -6px; right: -12px; margin: 0; min-width: 18px; height: 18px; font-size: 11px; }
.brow { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--beige-2); border-radius: 14px; padding: 12px 16px; }
.brow.done { opacity: .7; }
.brow.done .btn.ghost { text-decoration: line-through; }
.bcheck { display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.bcheck input { width: 28px; height: 28px; accent-color: var(--vinrod); cursor: pointer; margin: 0; }
.bwho { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .brow { grid-template-columns: 44px minmax(0, 1fr); } .bwho { grid-column: 2; justify-content: flex-start; } }
@media (max-width: 1400px) { .mainnav a { padding: 9px 11px; font-size: 14.5px; } .topbar .inner { gap: 12px; } }
@media (max-width: 1100px) { .brand .sk, .brand .sep { display: none; } }
table.work tr.outm td { opacity: .45; }
