/* Livssnack – grundtema. Mobil först. Varmt ljust tema med mörk petrol och mjuka accenter. */

:root {
  --bg: #faf5ec;
  --bg-soft: #f4ecdf;
  --surface: #ffffff;
  --surface-soft: #fbefe2;
  --border: #eadfcd;
  --border-strong: #d9cab2;
  --text: #1f2a2a;
  --text-muted: #5b6767;
  --petrol: #14484a;
  --petrol-700: #0f3a3c;
  --petrol-50: #e3efee;
  --peach: #f2a66a;
  --peach-50: #fde9d8;
  --sage: #8fb8a2;
  --sage-50: #e5f1ea;
  --sand: #e2c79a;
  --sand-50: #f6ecda;
  --danger: #a8322a;
  --danger-50: #fbe7e4;
  --warn: #8a5a00;
  --warn-50: #fdf1d6;
  --ok: #1f6b45;
  --ok-50: #e2f3e9;
  --info: #1e5470;
  --info-50: #e3eff6;
  --focus: #0b6bcb;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(31, 42, 42, .05), 0 4px 16px rgba(31, 42, 42, .06);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --tap: 44px;
  --topbar-h: 60px;
  --bottomnav-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { max-width: 100%; }
img { height: auto; }

h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; color: var(--petrol-700); margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--petrol); text-underline-offset: 2px; }
a:hover { color: var(--petrol-700); }
code { background: var(--bg-soft); padding: .1em .35em; border-radius: 6px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--petrol); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; color: #fff; }

.visually-hidden, .hp {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }

.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.text-center { text-align: center; }
.text-error { color: var(--danger); display: block; }
.lead { font-size: 1.125rem; color: var(--text-muted); }
.narrow { max-width: 640px; margin: 0 auto; width: 100%; }

/* ---------- Knappar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px;
  border-radius: var(--radius-pill); border: 1.5px solid transparent;
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn .icon { width: 20px; height: 20px; }
.btn-primary { background: var(--petrol); color: #fff; }
.btn-primary:hover { background: var(--petrol-700); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--petrol); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--petrol-50); color: var(--petrol-700); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8c2821; color: #fff; }
.btn-on-dark { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-on-dark:hover { background: rgba(255,255,255,.22); color: #fff; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.btn-lg { min-height: 52px; padding: 12px 26px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); border-radius: 50%;
  color: var(--petrol); background: transparent; border: 0; cursor: pointer; list-style: none;
}
.icon-btn:hover { background: var(--petrol-50); }
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn-dark { color: #fff; }
.icon-btn-dark:hover { background: rgba(255,255,255,.15); }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.actions-center { justify-content: center; }

.link-arrow { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; min-height: var(--tap); }
.link-back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; min-height: var(--tap); }

/* ---------- Kort, märken, notiser ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin: 0 0 16px; box-shadow: var(--shadow);
}
.card-soft { background: var(--surface-soft); border-color: #f1dcc4; box-shadow: none; }
.card-danger { border-color: #efc9c4; }
.card-title { font-size: 1.15rem; margin-bottom: .6em; }
.card-welcome { background: linear-gradient(135deg, var(--peach-50), var(--surface)); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-pill);
  font-size: .78rem; font-weight: 600; background: var(--bg-soft); color: var(--text-muted); white-space: nowrap;
}
.badge-ok { background: var(--ok-50); color: var(--ok); }
.badge-warn { background: var(--warn-50); color: var(--warn); }
.badge-fail { background: var(--danger-50); color: var(--danger); }
.badge-info { background: var(--info-50); color: var(--info); }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; border: 1px solid transparent;
}
.notice p { margin: 0; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice-success { background: var(--ok-50); color: #134a30; border-color: #bfe1cc; }
.notice-info { background: var(--info-50); color: #143a4e; border-color: #c4dbe8; }
.notice-warning { background: var(--warn-50); color: #5e3d00; border-color: #f0dba6; }
.notice-error { background: var(--danger-50); color: #7a221c; border-color: #f0c4be; }
.notice .icon { margin-top: 1px; }

.banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: .92rem; }
.banner p { margin: 0; }
.banner-warning { background: var(--warn-50); color: #5e3d00; border-bottom: 1px solid #f0dba6; }

.draft-label {
  display: inline-flex; gap: 6px; align-items: center; background: var(--warn-50); color: var(--warn);
  font-weight: 700; font-size: .85rem; padding: 6px 12px; border-radius: var(--radius-sm);
}

.tone-peach { background: var(--peach-50); color: #b45f1c; }
.tone-sage { background: var(--sage-50); color: #2f6b4b; }
.tone-sand { background: var(--sand-50); color: #8a6420; }
.tone-petrol { background: var(--petrol-50); color: var(--petrol); }

/* Avatarer (initialer tills profilbilder finns) */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%; font-weight: 700; font-size: .95rem;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border);
}
.avatar-sm { width: 34px; height: 34px; font-size: .8rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 1.8rem; border-width: 4px; }
.tone-1 { background: #fde9d8; color: #9c4f14; }
.tone-2 { background: #e3efee; color: #14484a; }
.tone-3 { background: #e5f1ea; color: #2f6b4b; }
.tone-4 { background: #f6ecda; color: #7a5618; }
.tone-5 { background: #ece6f3; color: #4f3c73; }
.tone-6 { background: #f8e3e6; color: #8a3443; }

/* ---------- Formulär ---------- */
.form { display: block; }
.field { margin: 0 0 18px; }
.field label { display: block; font-weight: 600; margin: 0 0 6px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label-row label { margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  font: inherit; font-size: 1rem; color: var(--text);
  background: #fff; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--petrol); box-shadow: 0 0 0 3px rgba(20, 72, 74, .2); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.hint { font-size: .86rem; color: var(--text-muted); margin: 6px 0 0; }
.field-error { display: flex; gap: 6px; align-items: flex-start; color: var(--danger); font-size: .9rem; font-weight: 600; margin: 6px 0 0; }
.field-check { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; }
.field-check input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--petrol); }
.field-check label { font-weight: 500; margin: 0; display: flex; flex-direction: column; }
.field-check .field-error { grid-column: 1 / -1; }
.field-inline { align-self: end; margin-bottom: 10px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-toggle {
  position: absolute; right: 2px; top: 2px; width: var(--tap); height: var(--tap);
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
.password-toggle[aria-pressed="true"] { color: var(--petrol); }
.form-summary { scroll-margin-top: 80px; }
.form-summary a { color: inherit; font-weight: 600; }
.form-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-inline .field { margin: 0; }
.field-grow { flex: 1 1 240px; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.role-grid { display: grid; gap: 12px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-bottom: 12px; }
.filter-bar .field { margin: 0; flex: 1 1 140px; }
.filter-bar .field-grow { flex: 2 1 240px; }
.filter-actions { display: flex; gap: 8px; }

/* ---------- Publik sidhuvud ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--petrol); font-family: var(--font-serif); font-weight: 700; font-size: 1.5rem; min-height: var(--tap); }
.brand img { display: block; }
.brand-light { color: #fff; }
.brand-light:hover { color: #fff; }

.pubbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(250, 245, 236, .92); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.pubnav { display: flex; gap: 8px; align-items: center; }
.pubnav-link { display: none; font-weight: 600; text-decoration: none; padding: 8px 10px; min-height: var(--tap); align-items: center; }
.pubmain { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }

/* ---------- Medlemsytor ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 10px 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-actions { display: flex; align-items: center; gap: 2px; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.12);
  padding: 8px;
}
.menu-head { display: flex; flex-direction: column; padding: 8px 12px 10px; margin: 0 0 4px; border-bottom: 1px solid var(--border); }
.menu-head span { color: var(--text-muted); font-size: .875rem; }
.menu-panel a, .menu-form button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 8px 12px;
  text-decoration: none; color: var(--text); border-radius: var(--radius-sm); font: inherit; background: none; border: 0; cursor: pointer; text-align: left;
}
.menu-panel a:hover, .menu-form button:hover { background: var(--bg-soft); }
.menu-form { margin: 4px 0 0; border-top: 1px solid var(--border); padding-top: 4px; }
.menu-dark .menu-panel { color: var(--text); }

.shell { flex: 1; display: block; width: 100%; max-width: 1280px; margin: 0 auto; }
.main { padding: 18px 16px calc(var(--bottomnav-h) + var(--safe-bottom) + 24px); min-width: 0; }
.main:focus { outline: none; }
.sidenav, .aside { display: none; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--bottomnav-h) + var(--safe-bottom)); padding: 0 4px var(--safe-bottom);
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgba(0,0,0,.04);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; padding: 6px 2px; margin: 4px 2px;
  font-size: .72rem; font-weight: 600; color: var(--text-muted); text-decoration: none; text-align: center; line-height: 1.1;
  border-radius: 14px; hyphens: manual;
}
.bottomnav a[aria-current="page"] { color: var(--petrol); background: var(--petrol-50); }
.bottomnav .icon { width: 24px; height: 24px; }
.bottomnav-write { color: var(--petrol) !important; }
.bottomnav-write-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin-top: -18px; border-radius: 50%;
  background: var(--petrol); color: #fff; box-shadow: 0 4px 14px rgba(20,72,74,.35); border: 3px solid var(--surface);
}

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head h1 { margin-bottom: .2em; }
.page-head-action { display: none; }
.section-title { font-size: 1.5rem; }
.section-title-sm { font-size: 1.1rem; margin: 20px 0 10px; }

.tabs { display: flex; gap: 6px; margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 600; white-space: nowrap;
}
.tab[aria-current="page"] { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.tab-disabled { color: var(--text-muted); opacity: .7; }

.subnav { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px 4px; scrollbar-width: thin; }
.subnav a { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: var(--radius-pill); text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: .92rem; }
.subnav a[aria-current="page"] { background: var(--petrol-50); border-color: #bcd6d4; color: var(--petrol-700); }

.shortcut-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.shortcut {
  display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 600;
}
.shortcut:hover { border-color: var(--border-strong); }
.shortcut-icon, .compose-icon, .feature-icon, .stat-icon, .empty-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 12px;
}
.shortcut-icon { width: 40px; height: 40px; }

.empty-state { text-align: center; padding: 28px 12px; }
.empty-state-card { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); margin-bottom: 16px; }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 12px; }
.empty-icon .icon { width: 28px; height: 28px; }
.error-state { padding-top: 40px; }
.error-code { font-family: var(--font-serif); font-size: 3rem; color: var(--peach); margin: 0; font-weight: 700; }
pre.debug { text-align: left; white-space: pre-wrap; background: #fff; border: 1px solid var(--border); padding: 12px; border-radius: var(--radius-sm); font-size: .8rem; }

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list a { display: flex; align-items: center; gap: 10px; min-height: var(--tap); text-decoration: none; color: var(--text); padding: 4px 0; }
.link-list a:hover { color: var(--petrol); }
.link-list-rows li + li { border-top: 1px solid var(--border); }
.link-list-rows a span:first-of-type { flex: 1; }
.chevron { color: var(--text-muted); width: 18px; height: 18px; }

.check-list { list-style: none; padding: 0; margin: 0 0 1em; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px; }
.check-list .icon { color: var(--ok); margin-top: 2px; }

.dl { margin: 0 0 12px; }
.dl > div { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dl > div:last-child { border-bottom: 0; }
.dl dt { font-size: .85rem; color: var(--text-muted); font-weight: 600; }
.dl dd { margin: 0; overflow-wrap: anywhere; }

/* Skrivval */
.compose-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.compose-options a {
  display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text);
}
.compose-options a:hover { border-color: var(--petrol); }
.compose-options strong { display: block; font-size: 1.05rem; }
.compose-options small { color: var(--text-muted); font-size: .88rem; }
.compose-options a > span:nth-child(2) { flex: 1; }
.compose-icon { width: 48px; height: 48px; }

.sheet {
  border: 0; padding: 20px 16px calc(20px + var(--safe-bottom)); margin: auto 0 0; width: 100%; max-width: 100%;
  border-radius: 22px 22px 0 0; background: var(--bg); color: var(--text); box-shadow: 0 -10px 40px rgba(0,0,0,.2);
}
.sheet::backdrop { background: rgba(15, 30, 30, .45); }
.sheet h2 { margin-right: 48px; }
.sheet-close-form { position: absolute; right: 10px; top: 10px; margin: 0; }

/* Introduktion */
.intro-steps { list-style: none; padding: 0; margin: 0 0 16px; }
.intro-step { display: flex; gap: 14px; align-items: flex-start; }
.intro-step h2 { font-size: 1.1rem; margin-bottom: .25em; }
.intro-step p { margin-bottom: .6em; }
.intro-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%; background: var(--petrol-50); color: var(--petrol); font-weight: 700;
}
.intro-step.is-done .intro-num { background: var(--ok-50); color: var(--ok); }

/* Krypin */
.krypin-cover {
  height: 140px; margin: -18px -16px 0; background:
  linear-gradient(180deg, rgba(20,72,74,.0) 40%, rgba(20,72,74,.15)), linear-gradient(120deg, #c9dccf 0%, #f3d6b5 55%, #f2a66a 100%);
}
.krypin-head { display: flex; align-items: flex-end; gap: 14px; margin-top: -40px; margin-bottom: 8px; }
.krypin-head h1 { margin: 0; }
.krypin-head p { margin: 0; }

/* Sessioner */
.session-list { list-style: none; padding: 0; margin: 0; }
.session { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.session-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 260px; }
.session-main > .icon { color: var(--petrol); margin-top: 2px; }
.session-title { font-weight: 600; margin: 0 0 2px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.session .small { margin: 0; }

/* ---------- Publika sidor ---------- */
.hero { display: grid; gap: 24px; align-items: center; padding: 12px 0 28px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: #b45f1c; margin-bottom: .5em; }
.hero h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.2rem); }
.hero-art img { width: 100%; border-radius: 24px; display: block; }

.features { padding: 12px 0 24px; }
.feature-grid { display: grid; gap: 12px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin: 10px 0 6px; }
.feature p { margin: 0; color: var(--text-muted); }
.feature-icon { width: 48px; height: 48px; }

.split { display: grid; gap: 16px; padding: 16px 0; align-items: start; }
.cta-band { text-align: center; background: var(--petrol); color: #fff; border-radius: 24px; padding: 32px 20px; margin: 24px 0 8px; }
.cta-band h2 { color: #fff; font-size: 1.8rem; }
.cta-band .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.cta-band .btn-ghost:hover { background: rgba(255,255,255,.12); }
.cta-band .btn-primary { background: var(--peach); color: #3b2210; }
.cta-band .btn-primary:hover { background: #f4b682; color: #3b2210; }

.prose { max-width: 720px; margin: 0 auto; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.steps { list-style: none; padding: 0 !important; counter-reset: step; }
.steps li { position: relative; padding-left: 52px; margin-bottom: 18px; counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 36px; height: 36px; border-radius: 50%; background: var(--peach-50); color: #9c4f14;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.steps h2 { font-size: 1.15rem; margin: 4px 0 6px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 14px; min-height: var(--tap); }
.faq details p { padding: 0 14px 12px; margin: 0; }

.auth-wrap { display: flex; justify-content: center; padding: 8px 0 24px; }
.auth-card { width: 100%; max-width: 460px; padding: 22px 18px; }
.auth-alt { text-align: center; margin: 16px 0 0; }

.footer { padding: 24px 16px calc(24px + var(--safe-bottom)); text-align: center; color: var(--text-muted); font-size: .9rem; border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-bottom: 8px; }
.footer a { color: var(--text-muted); display: inline-flex; align-items: center; min-height: var(--tap); }
.is-member .footer { padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 16px); }

.message-body { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow-wrap: anywhere; }
.mail-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0; }

/* ---------- Admin ---------- */
.is-admin { background: #f6f1e8; }
.adminbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--petrol); color: #fff; position: sticky; top: 0; z-index: 20;
}
.adminbar .brand { font-size: 1.3rem; }
.adminbar-sep { width: 1px; height: 26px; background: rgba(255,255,255,.35); display: none; }
.adminbar-title { font-family: var(--font-serif); font-weight: 700; font-size: 1.1rem; display: none; }
.adminbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.admintabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 60px; z-index: 15; scrollbar-width: thin;
}
.admintabs a {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 8px 14px;
  border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font-weight: 600; font-size: .95rem;
}
.admintabs a[aria-current="page"] { background: var(--sage-50); color: var(--petrol-700); }
.adminmain { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 12px 40px; }
.admin-h1 { font-size: 1.5rem; }

.stat-grid { display: grid; gap: 10px; margin-bottom: 16px; }
.stat-card {
  display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 76px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card-alert { border-color: #efc9c4; background: #fff8f7; }
.stat-icon { width: 48px; height: 48px; }
.stat-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.stat-body strong { font-family: var(--font-serif); font-size: 1.15rem; color: var(--petrol-700); }
.stat-body span { color: var(--text-muted); font-size: .9rem; }
.admin-cols { display: grid; gap: 0 16px; }

.row-list { list-style: none; margin: 0 0 16px; padding: 0; }
.row-list.card { padding: 4px 14px; }
.row-list li + li { border-top: 1px solid var(--border); }
.row-list a, .row-static { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 0; text-decoration: none; color: var(--text); }
.row-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.row-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; }

.member-head { display: flex; gap: 14px; align-items: center; }
.member-head h1 { margin: 0; }
.member-head p { margin: 2px 0; }

.status-list { list-style: none; padding: 0; margin: 0 0 8px; }
.status-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-ok { background: #2f9e62; }
.dot-warn { background: #e2a400; }
.dot-info { background: #6b8fa3; }

.check-table { list-style: none; padding: 0; margin: 0; }
.check-table li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: center; }
.check-table li:last-child { border-bottom: 0; }
.check-value { grid-column: 2; color: var(--text-muted); font-size: .9rem; overflow-wrap: anywhere; }
.check-hint { grid-column: 2; font-size: .85rem; color: var(--warn); }
.check-label { font-weight: 600; }

.log-list { list-style: none; padding: 0; margin: 0 0 16px; }
.log-item { padding: 12px 14px; margin-bottom: 8px; }
.log-item p { margin: 0 0 2px; }
.log-list.compact li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.log-list.compact li:last-child { border-bottom: 0; }

.chip-row { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; }
.chip { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 600; font-size: .9rem; }
.chip[aria-current="page"] { background: var(--petrol); color: #fff; border-color: var(--petrol); }

/* ---------- Större mobiler ---------- */
@media (min-width: 420px) {
  .shortcut-grid { grid-template-columns: repeat(4, 1fr); }
  .shortcut { flex-direction: column; justify-content: center; text-align: center; min-height: 96px; }
  .bottomnav a { font-size: .76rem; }
}

/* ---------- Surfplatta ---------- */
@media (min-width: 720px) {
  .main { padding: 24px 24px calc(var(--bottomnav-h) + var(--safe-bottom) + 24px); }
  .pubmain { padding: 28px 24px 48px; }
  .pubnav-link { display: inline-flex; }
  .hero { grid-template-columns: 1.1fr 1fr; padding: 28px 0 40px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1.2fr 1fr; }
  .dl > div { grid-template-columns: 180px 1fr; gap: 12px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-cols { grid-template-columns: repeat(2, 1fr); }
  .adminbar-sep, .adminbar-title { display: block; }
  .adminmain { padding: 20px 20px 48px; }
  .page-head-action { display: inline-flex; }
  .sheet { max-width: 520px; margin: auto; border-radius: 22px; }
  .krypin-cover { height: 200px; margin: -24px -24px 0; border-radius: 0 0 var(--radius) var(--radius); }
  .role-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 22px; }
}

/* ---------- Dator: sidnav + innehåll + kompletterande kolumn ---------- */
@media (min-width: 1024px) {
  .bottomnav { display: none; }
  .is-member .footer { padding-bottom: 24px; }
  .shell { display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; gap: 24px; padding: 0 20px; }
  .main { padding: 24px 0 40px; }
  .sidenav {
    display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px);
    align-self: start; padding: 16px 0;
  }
  .sidenav a { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font-weight: 600; }
  .sidenav a:hover { background: var(--bg-soft); }
  .sidenav a[aria-current="page"] { background: var(--sage-50); color: var(--petrol-700); }
  .sidenav .sidenav-write { margin-top: 14px; color: #fff; }
  .sidenav .sidenav-write:hover { background: var(--petrol-700); color: #fff; }
  .aside { display: block; padding: 24px 0; position: sticky; top: var(--topbar-h); align-self: start; }
  .topbar { padding-left: 24px; padding-right: 20px; }
  .feature-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .krypin-cover { margin: -24px 0 0; border-radius: var(--radius); }
}

@media (min-width: 1280px) {
  .shell { grid-template-columns: 240px minmax(0, 1fr) 320px; }
}

/* ---------- Tillgänglighet ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .btn, .tab, .chip, .card { border: 1px solid CanvasText; }
}

@media print {
  .topbar, .bottomnav, .sidenav, .aside, .pubbar, .footer, .adminbar, .admintabs { display: none !important; }
}
