:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1d2523;
  --muted: #5d6865;
  --line: #e2ded5;
  --primary: #1f5c57;
  --primary-ink: #ffffff;
  --primary-soft: #e3efed;
  --danger: #a3332b;
  --danger-soft: #fbeceb;
  --warn-soft: #fdf5e1;
  --ok-soft: #e6f2e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 28, .06), 0 4px 16px rgba(20, 30, 28, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--primary); }
[hidden] { display: none !important; }

/* ---------- Oppsett ---------- */
.site-header {
  padding: 20px 20px 0;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .85rem; }
main { max-width: 1100px; margin: 0 auto; padding: 20px; }
main.narrow { max-width: 560px; }
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 20px 40px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 16px; }

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 20px; }

/* ---------- Skjema ---------- */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.pc { grid-template-columns: 9rem 1fr; }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } .row.pc { grid-template-columns: 7.5rem 1fr; } }

input[type=text], input[type=email], input[type=tel], input[type=time], input[type=password], input[type=number], input[type=search], input[type=date],
select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  min-height: 48px;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 1px;
  border-color: var(--primary);
}
input[aria-invalid=true] { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: .88rem; margin-top: 4px; }

.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--primary-soft); border-radius: 10px; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.check label { font-weight: 400; margin: 0; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Knapper ---------- */
button, .btn {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: 1.5px solid transparent;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  background: var(--primary);
  color: var(--primary-ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.block { width: 100%; min-height: 52px; font-size: 1.05rem; }
button.secondary { background: #fff; color: var(--primary); border-color: var(--line); }
button.ghost { background: transparent; color: var(--primary); padding: 8px 10px; }
button.danger { background: #fff; color: var(--danger); border-color: #ecc9c6; }
button.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Meldinger ---------- */
.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); }
.notice.info { background: var(--primary-soft); }

.success { text-align: center; padding: 16px 0; }
.success .mark {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--ok-soft); color: #2f7a43;
  display: grid; place-items: center; margin: 0 auto 16px; font-size: 2rem;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
  box-shadow: var(--shadow); transition: transform .25s ease; z-index: 50; max-width: 90vw;
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ---------- Oversikt ---------- */
.userbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: .92rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  background: transparent; color: var(--muted); border-radius: 10px 10px 0 0;
  border: none; border-bottom: 3px solid transparent; padding: 10px 14px;
}
.tabs button[aria-selected=true] { color: var(--primary); border-bottom-color: var(--primary); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar > .grow { flex: 1 1 220px; }
.toolbar select, .toolbar input { min-height: 44px; padding: 8px 12px; }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--primary-soft); border-radius: 10px; padding: 10px 14px; min-width: 120px; }
.stat b { display: block; font-size: 1.4rem; }
.stat span { color: var(--muted); font-size: .85rem; }

.leaders-line { color: var(--muted); font-size: .92rem; margin: -6px 0 14px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); text-align: center; padding: 28px 8px; }

.pill { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.pill.grey { background: #eee; color: var(--muted); }

/* Tabeller blir til kort på mobil */
@media (max-width: 720px) {
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 5px 0; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
  table.responsive td.name { font-weight: 700; font-size: 1.05rem; }
  table.responsive td.name::before { content: none; }
  table.responsive td.actions { justify-content: flex-end; }
  table.responsive td.actions::before { content: none; }
}

.list-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-item:last-child { border-bottom: none; }
.list-item .meta { color: var(--muted); font-size: .9rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); border-radius: 99px; padding: 3px 4px 3px 10px; font-size: .85rem; }
.chip button { min-height: 24px; height: 24px; width: 24px; padding: 0; border-radius: 50%; background: transparent; color: var(--muted); }

dialog { border: none; border-radius: var(--radius); padding: 24px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(20, 30, 28, .45); }

/* =====================================================================
   Ledervisning: gruppe, oppmøte, deling
   ===================================================================== */

.auth-card { max-width: 440px; margin: 24px auto; }
.center { text-align: center; margin: 16px 0 0; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
.count { color: var(--muted); font-weight: 500; }
.psub { display: block; color: var(--muted); font-size: .88rem; font-weight: 400; }
.danger-text { color: var(--danger) !important; }
.btn.secondary { background: #fff; color: var(--primary); border-color: var(--line); }

.group-switch { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.group-switch select { max-width: 360px; min-height: 44px; padding: 8px 12px; }
.chip-btn { background: #fff; color: var(--ink); border: 1.5px solid var(--line); border-radius: 99px; min-height: 40px; padding: 6px 16px; font-weight: 600; }
.chip-btn[aria-pressed=true] { background: var(--primary); color: #fff; border-color: var(--primary); }

.group-head { margin: 4px 0 16px; }
.group-head h1 { margin: 0; }
.group-head .meta { color: var(--muted); }

button.big { min-height: 60px; font-size: 1.15rem; margin-bottom: 16px; border-radius: 14px; }
button.big span { font-size: 1.3rem; }

.card.plain { padding: 8px 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 4px; }
.card-head h2 { margin: 0; }

.plist, .mlist, .attend-list, .split-list { list-style: none; margin: 0; padding: 0; }
.plist > li, .mlist > li { border-bottom: 1px solid var(--line); }
.plist > li:last-child, .mlist > li:last-child { border-bottom: none; }
.plist .empty { padding: 20px 8px; }

.prow, .mrow {
  width: 100%; background: transparent; color: var(--ink); border: none; border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 6px; text-align: left; font-weight: 400; min-height: 60px;
}
.prow:hover, .mrow:hover { background: var(--bg); filter: none; }
.pmain { display: flex; flex-direction: column; min-width: 0; }
.pname { font-weight: 600; font-size: 1.02rem; }
.mrow { min-height: 52px; }

.dots { display: inline-flex; gap: 4px; flex: none; }
.dots i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #b9c7c4; display: block; }
.dots i.on { background: var(--primary); border-color: var(--primary); }

.arow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 6px; flex-wrap: wrap; }

details.fold { padding: 4px 16px; }
details.fold summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::after { content: '›'; color: var(--muted); font-size: 1.3rem; line-height: 1; transition: transform .2s; margin-left: auto; }
details.fold[open] summary::after { transform: rotate(90deg); }
details.fold .hint { margin: 0 0 6px; }

.quiet-links { display: flex; flex-wrap: wrap; gap: 4px 8px; justify-content: center; margin: 20px 0 8px; }
.quiet-links button { color: var(--muted); font-weight: 500; }
.quiet-links button:hover { color: var(--primary); }

.grow-hint { display: flex; gap: 12px; align-items: flex-start; background: #eef6e9; border: 1px solid #d5e8c9; }
.grow-hint p { margin: 4px 0 10px; }
.grow-icon { font-size: 1.6rem; line-height: 1; }

/* Oppmøte */
.back { margin: 0 0 4px -10px; }
.attend-bar { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; font-size: 1.05rem; }
.attend-list { display: grid; gap: 8px; margin-bottom: 96px; }
.arow-btn {
  width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 14px; text-align: left;
  background: #fff; color: var(--ink); border: 1.5px solid var(--line); border-radius: 12px;
  min-height: 60px; padding: 10px 16px; font-weight: 400;
}
.arow-btn:hover { filter: none; border-color: #c9d6d3; }
.arow-btn .tick {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #b9c7c4; flex: none;
  display: grid; place-items: center; transition: all .12s;
}
.arow-btn[aria-checked=true] { background: var(--primary-soft); border-color: var(--primary); }
.arow-btn[aria-checked=true] .tick { background: var(--primary); border-color: var(--primary); }
.arow-btn[aria-checked=true] .tick::after { content: '✓'; color: #fff; font-weight: 700; font-size: .95rem; }

.sticky-actions {
  position: sticky; bottom: 0; padding: 12px 0 16px; margin-top: 8px;
  background: linear-gradient(to top, var(--bg) 75%, transparent);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}

/* Del gruppen */
.steps { display: flex; gap: 6px; margin: 4px 0 16px; font-size: .85rem; color: var(--muted); }
.steps span { flex: 1; border-top: 3px solid var(--line); padding-top: 6px; }
.steps span.on { border-color: var(--primary); color: var(--primary); font-weight: 600; }
fieldset.choices { border: none; padding: 0; margin: 0 0 16px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: #fff; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }

.split-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.split-totals .total { border-radius: 12px; padding: 10px 14px; }
.split-totals .total b { display: block; font-size: 1.5rem; }
.split-totals .total span { font-size: .88rem; }
.split-totals .a, .srow.a .sidepill { background: var(--primary-soft); color: var(--primary); }
.split-totals .b, .srow.b .sidepill { background: #fbefd9; color: #8a5a00; }
.split-list { display: grid; gap: 8px; margin: 10px 0 96px; }
.srow {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #fff; color: var(--ink); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 14px; min-height: 58px; text-align: left; font-weight: 400;
}
.srow:hover { filter: none; }
.srow.b { border-color: #ecd3a5; }
.sidepill { border-radius: 99px; padding: 4px 10px; font-size: .82rem; font-weight: 600; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }

.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: .9rem; }

/* Invitasjon */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.segmented button { background: transparent; color: var(--muted); border: none; min-height: 40px; }
.segmented button[aria-selected=true] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.invite-line { font-size: .88rem; color: #8a5a00; margin-top: 4px; }

/* Detaljer om person */
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 20px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

select.compact { width: auto; min-height: 36px; padding: 4px 8px; }

/* ---------- Leder og nestleder ---------- */
.leaders-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.lrow { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lrow:last-child { border-bottom: none; }
.lrole { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.lwho { display: flex; flex-direction: column; min-width: 0; }
.lwho strong { font-size: 1.02rem; }
.contact { color: var(--muted); font-size: .88rem; }
.contact a { color: var(--muted); text-decoration: none; }
.contact a:hover { color: var(--primary); text-decoration: underline; }
.lact { display: flex; gap: 4px; }
.lrow.pending { background: #fbf6ec; }
.lrow.missing { background: #fdf3e3; }
.lrow.missing .lrole, .lrow.missing strong { color: #8a4b00; }
@media (max-width: 480px) {
  .lrow { grid-template-columns: 1fr auto; }
  .lrole { grid-column: 1 / -1; }
}

.role-pill { display: inline-block; margin-left: 8px; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); vertical-align: 2px; text-transform: uppercase; letter-spacing: .03em; }
.role-pill.pending { background: #fbefd9; color: #8a5a00; }
.role-pill.warn { background: #fde2cc; color: #8a3b00; margin-left: 0; }

.admin-leaders { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 4px; font-size: .92rem; }
.admin-leaders b { font-weight: 600; color: var(--muted); }
.notice.warn-soft { background: #fdf3e3; color: #6b3d00; }
.stat.warn { background: #fde9d4; }
.stat.warn b { color: #8a3b00; }


/* =====================================================================
   Versjon 4: roligere uttrykk, meny, oversikt, triader
   ===================================================================== */
.narrow-panel { max-width: 720px; margin: 0 auto; }

/* Brukermeny */
.usermenu { position: relative; }
.usermenu #btn-menu { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(20,30,28,.14); min-width: 200px; padding: 6px; z-index: 40; }
.menu-who { padding: 8px 10px 10px; color: var(--muted); font-size: .88rem; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-item { width: 100%; justify-content: flex-start; background: transparent; color: var(--ink); font-weight: 500; border-radius: 8px; }
.menu-item:hover { background: var(--bg); filter: none; }

/* Faner: én linje, rulles sidelengs på smal skjerm */
.tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 720px; margin: 0 auto 18px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { white-space: nowrap; flex: none; padding: 10px 12px; }

.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h1 { margin: 0; }

/* Lederkort: rolig. Mangler = dempet tekst med en liten prikk */
.lrow.pending, .lrow.missing { background: transparent; }
.missing-text { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #d9a441; display: inline-block; flex: none; }
.muted-btn { color: var(--muted) !important; font-weight: 500; }
.muted { color: var(--muted); }

/* Forslag om å multiplisere: en stille linje */
.soft-hint { border: 1px dashed #c9d6d3; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; background: transparent; }
.soft-hint p { margin: 0 0 4px; color: var(--ink); }
.soft-actions { display: flex; flex-wrap: wrap; gap: 0 4px; margin-left: -10px; }
.soft-note { color: var(--muted); font-size: .92rem; margin: -8px 0 16px; }
button.inline { padding: 0; min-height: 0; font-size: inherit; font-weight: 600; vertical-align: baseline; }

.why-list { padding-left: 1.3em; margin: 0 0 14px; }
.why-list li { margin-bottom: 6px; }
.why-foot { color: var(--muted); font-size: .95rem; }

.quiet-label { color: var(--muted); font-size: .85rem; align-self: center; }
.admin-only { margin-top: 0; }

/* Rollemerker: dempet */
.role-pill { background: var(--primary-soft); color: var(--primary); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: .75rem; }
.role-pill.pending { background: #f1ede5; color: var(--muted); }

/* Oversikt (admin) */
.stats.compact { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stats.compact .stat { min-width: 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); }
.stats.compact .stat b { font-size: 1.3rem; }
.glist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.gcard { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font-weight: 400; }
.gcard:hover { filter: none; border-color: #c9d6d3; }
.gmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gname { font-weight: 700; font-size: 1.05rem; }
.gline { font-size: .9rem; }
.gcount { text-align: right; flex: none; }
.gcount b { display: block; font-size: 1.35rem; line-height: 1.1; }
.gcount small { color: var(--muted); font-size: .75rem; }

/* Deltakere (admin) */
[data-panel=members] .toolbar { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 8px; }
@media (min-width: 600px) { [data-panel=members] .toolbar { grid-template-columns: 2fr 1fr; } }
.chev { color: var(--muted); font-size: 1.4rem; }
.psub.inline { display: inline; }

/* Triader */
.tlist { list-style: none; margin: 0; padding: 0 0 6px; }
.tlist li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.tlist li:last-child { border-bottom: none; }
.triad-card + .triad-card { margin-top: 12px; }
.empty-card { text-align: center; padding: 20px 16px; }
.empty-card p { margin: 4px 0; }
.stack { display: grid; gap: 8px; }

@media (max-width: 480px) {
  .site-header { padding-top: 14px; }
  main { padding: 14px; }
  .group-head h1 { font-size: 1.45rem; }
}

.stats.compact .stat span { font-size: .8rem; line-height: 1.25; display: block; }
.soft-actions .ghost { padding: 6px 10px; }

/* Datasjekk */
.health { margin-bottom: 14px; }
.health summary .count { margin-left: auto; margin-right: 6px; font-weight: 500; font-size: .9rem; }
.warn-count { color: #8a5a00 !important; }
.health-list { list-style: none; padding: 0; margin: 0 0 8px; }
.health-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.health-list li:last-child { border-bottom: none; }
input[readonly] { background: var(--bg); }

/* Systemsjekk */
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: none; }
.checks .icon { font-weight: 700; font-size: 1.1rem; text-align: center; }
.checks .ok .icon { color: #2f7a43; }
.checks .bad .icon { color: var(--danger); }
.checks .warnc .icon { color: #b07a10; }
.checks .wait .icon { color: var(--muted); }
.checks .detail { grid-column: 2; color: var(--muted); font-size: .9rem; }


/* =====================================================================
   Grafisk profil – Bergen Frikirke
   Mørk, nesten svart blågrønn (#101b1f), rutemønster og hvitt symbol.
   ===================================================================== */
:root {
  --brand: #101b1f;
  --brand-2: #172226;
  --bg: #f3f4f4;
  --surface: #ffffff;
  --ink: #121a1d;
  --muted: #5d686c;
  --line: #dfe3e4;
  --primary: #101b1f;
  --primary-ink: #ffffff;
  --primary-soft: #e7ecee;
}
a { color: var(--brand); text-underline-offset: 2px; }

.site-header {
  max-width: none;
  margin: 0;
  padding: 14px max(20px, calc((100% - 1100px) / 2 + 20px));
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="44" height="44" viewBox="0 0 44 44"%3E%3Crect width="44" height="44" fill="#101b1f"/%3E%3Cpath d="M22 0L44 22L22 44L0 22Z" fill="#192629"/%3E%3C/svg%3E");
  background-size: 44px 44px;
  color: #fff;
  border-bottom: 1px solid #0a1214;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand .logo { width: 30px; height: 30px; color: #fff; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; letter-spacing: .01em; }
.brand small { color: rgba(255, 255, 255, .68); font-weight: 500; }
.site-header #btn-menu { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .28); }
.site-header #btn-menu:hover { background: rgba(255, 255, 255, .16); filter: none; }
main { padding-top: 24px; }

h1, h2 { letter-spacing: -.01em; }
.eyebrow { letter-spacing: .12em; }
button:hover { filter: none; background-color: #22323a; }
button.secondary:hover, button.ghost:hover, button.danger:hover, .menu-item:hover,
.prow:hover, .mrow:hover, .gcard:hover, .arow-btn:hover, .srow:hover, .chip-btn:hover,
.tabs button:hover, .segmented button:hover { background-color: var(--bg); }
button.ghost:hover { background-color: rgba(16, 27, 31, .06); }
.tabs button[aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); }
.chip-btn[aria-pressed=true] { background: var(--brand); border-color: var(--brand); }
.chip-btn[aria-pressed=true]:hover { background: #22323a; }
.dots i.on { background: var(--brand); border-color: var(--brand); }
.arow-btn[aria-checked=true] { border-color: var(--brand); }
.arow-btn[aria-checked=true] .tick { background: var(--brand); border-color: var(--brand); }
.success .mark { background: var(--brand); color: #fff; }
.check input, .choice input { accent-color: var(--brand); }
.soft-hint { border-color: #c7cfd1; }
.stat { background: var(--primary-soft); }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid rgba(16, 27, 31, .22); border-color: var(--brand);
}
.toast { background: var(--brand); }
.site-footer a { color: var(--muted); }

.health summary::after { margin-left: 10px; }

/* Tilgang: overskrifter og ventende invitasjoner */
.section-title { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; }
.prow-actions { display: flex; gap: 6px; flex-shrink: 0; }
.prow.static { cursor: default; }

/* Valg med to knapper (kjønn) */
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.field legend { padding: 0; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-row .choice-opt { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fff; cursor: pointer; font-weight: 500; margin: 0; }
.choice-row .choice-opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.choice-row .choice-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice-row .choice-opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice-row[aria-invalid=true] .choice-opt { border-color: var(--danger); }

/* Oppmøte: starttid, timer og type */
.meet-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .92rem; margin: -6px 0 14px; }
.meet-edit { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 10px; max-width: 420px; margin: -6px 0 6px; }
.meet-edit .field { margin-bottom: 10px; }

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.reminder-buttons { display: grid; gap: 10px; }
.reminder-buttons .btn { text-align: center; }

/* Ukens samling */
.week-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.week-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.week-date { font-size: 1.35rem; font-weight: 700; line-height: 1.25; margin-top: 2px; }
.week-sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.week-status { font-size: .82rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); }
.week-status.done { background: var(--primary-soft); color: var(--ink); }
.week-status:empty { display: none; }
.week-card #btn-attend { margin: 0; }
.meet-edit .meet-date { grid-column: 1 / -1; max-width: 220px; }
.mrow .psub.not-registered { font-style: italic; }

.week-card .week-reminder { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; color: var(--ink); }
.week-card .week-reminder[hidden] { display: none; }

/* Håndbok */
.dream { background: var(--primary-soft); border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 18px; }
.dream h2 { font-size: .95rem; margin: 0 0 10px; }
.dream-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dream-list li { background: #fff; border-radius: 999px; padding: 4px 11px; font-size: .86rem; }
.guide-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.guide-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-height: 0; font-weight: 400; }
.guide-card:hover { border-color: var(--primary); }
.guide-card .chev { font-size: 1.4rem; color: var(--muted); line-height: 1; }
.guide-body p { margin: 0 0 10px; }
.guide-h { font-size: 1rem; margin: 16px 0 6px; }
.guide-note { color: var(--muted); font-size: .92rem; }
.guide-list { margin: 0 0 10px; padding-left: 1.2rem; }
.guide-list li { margin-bottom: 6px; }
.guide-hint { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: .9rem; margin-bottom: 14px; }
.text-link { background: none; border: none; padding: 0; min-height: 0; color: var(--ink); text-decoration: underline; font-weight: 500; font-size: .88rem; cursor: pointer; display: inline; }
.leaders-card .text-link { display: block; margin-top: 4px; color: var(--muted); }
.triad-info { margin: -4px 0 18px; padding-left: 1.2rem; color: var(--muted); font-size: .92rem; }
.triad-info li { margin-bottom: 4px; }
.invite-about { color: var(--muted); font-size: .95rem; margin-top: -6px; }
.about-group { margin: -6px 0 16px; }

.dep-switch { display: block; margin-top: 8px; color: var(--muted); font-size: .85rem; }

/* Smale skjermer: alle fanene skal få plass uten å rulle */
@media (max-width: 440px) {
  .tabs { gap: 0; justify-content: space-between; }
  .tabs button { padding: 10px 6px; font-size: .9rem; }
}
@media (max-width: 380px) {
  .tabs button { padding: 10px 3px; font-size: .84rem; }
}

/* Roller: tydelige merker */
.role-pill.role-admin { background: #101b1f; color: #fff; }
.role-pill.role-leder { background: #dfe9ec; color: #101b1f; }
.role-pill.role-nestleder { background: #f1ede5; color: #5b4a2a; }
.pname .role-pill + .role-pill { margin-left: 4px; }
.plist-head { display: flex; flex-direction: column; gap: 2px; padding: 14px 4px 6px; font-weight: 700; font-size: .95rem; border-bottom: 1px solid var(--line); }
.plist-head:first-child { padding-top: 4px; }
.plist-head .count { color: var(--muted); font-weight: 600; }
.plist-head .psub { font-weight: 400; }
/* Filterknapper */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.chips button { min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 500; font-size: .88rem; }
.chips button[aria-pressed=true] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Tidligere samling, rett under ukens */
.week-past { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.week-past[hidden] { display: none; }
.week-past label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 6px; }
.week-past-row { display: flex; gap: 8px; }
.week-past-row select { flex: 1; min-width: 0; margin: 0; }
.week-past-row button { margin: 0; white-space: nowrap; }
@media (max-width: 480px) {
  .week-past-row { flex-direction: column; }
  .week-past-row button { width: 100%; }
}
.lmore { padding: 6px 12px 8px; border-top: 1px solid var(--line); }
.lmore button { margin: 0; }

/* Slettede grupper */
.plist > li.drow { display: flex; align-items: center; gap: 10px; padding: 10px 4px; }
.drow .pmain { flex: 1; min-width: 0; }
.drow-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.drow-actions button { margin: 0; }
@media (max-width: 480px) { .plist > li.drow { flex-direction: column; align-items: stretch; } .drow-actions { justify-content: flex-start; } }
#ov-deleted { padding: 0; margin: 0 0 6px; list-style: none; }
.week-empty { margin: 10px 0 0; }

h3.sub { font-size: .95rem; margin: 18px 0 8px; }
dialog h3.sub:first-child { margin-top: 4px; }
.srow.pinned { cursor: default; opacity: .85; }
.srow.pinned:disabled { color: inherit; }

/* iPhone zoomer inn når et felt under 16 px får fokus. Alle felt er derfor minst 16 px. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
input, select, textarea, .copy-row input { font-size: max(16px, 1rem); }

/* Forsiden (innlogging) */
.welcome { max-width: 460px; }
.welcome-intro { padding: 4px 4px 0; margin-bottom: 16px; }
.welcome-intro h1 { font-size: 1.5rem; }
.welcome-intro .lead { margin-bottom: 0; }
.welcome .card { margin: 0; }
.welcome-help { display: grid; gap: 10px; margin-top: 16px; }
.help-item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.help-item h3 { font-size: 1rem; margin: 0 0 4px; }
.help-item p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Be om tilgang */
.role-choice { display: grid; gap: 8px; border: 0; padding: 0; margin: 0 0 16px; }
.role-choice legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.choice-opt.block-opt { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; }
.choice-opt.block-opt input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--primary); flex: none; }
.choice-opt.block-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice-opt.block-opt .psub { margin-top: 2px; }
.success-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; margin: 0 0 14px; }
.request-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; }
.request-row .pmain { flex: 1; min-width: 0; }
.request-msg { background: var(--bg); border-radius: 10px; padding: 8px 12px; margin: 8px 0 0; font-size: .95rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-actions { display: flex; flex-direction: column; gap: 6px; }
.request-actions button { margin: 0; }
@media (max-width: 480px) { .request-row { flex-direction: column; } .request-actions { flex-direction: row; } }
.tab-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 5px; border-radius: 999px; background: #c0392b; color: #fff; font-size: .72rem; font-weight: 700; vertical-align: 1px; }
.request-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.request-notice button { margin: 0; white-space: nowrap; }
