/* ---------------------------------------------------------------------------
   Catalyzt intern — designsystem
   1:1 med Lovable-prototypen (catalyz-intern-app): varm sand-baggrund,
   terracotta primærfarve, Fraunces til overskrifter og Nunito Sans til brødtekst.
   Tokens er kopieret direkte fra prototypens styles.css (oklch).
   Fonte hostes lokalt — CSP'en er default-src 'self', så Google Fonts blokeres.
--------------------------------------------------------------------------- */

@font-face {
  font-family: 'Fraunces';
  src: url('/static/fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Nunito Sans';
  src: url('/static/fonts/nunitosans-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --radius: 1rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);

  --font-display: 'Fraunces', Georgia, serif;
  --font-sans: 'Nunito Sans', system-ui, -apple-system, sans-serif;

  --background: oklch(0.984 0.009 84);
  --foreground: oklch(0.28 0.025 55);
  --card: oklch(0.995 0.005 90);
  --card-foreground: oklch(0.28 0.025 55);
  --primary: oklch(0.6 0.115 42);
  --primary-foreground: oklch(0.99 0.005 90);
  --secondary: oklch(0.945 0.018 80);
  --secondary-foreground: oklch(0.35 0.03 55);
  --muted: oklch(0.955 0.014 82);
  --muted-foreground: oklch(0.52 0.025 60);
  --accent: oklch(0.93 0.032 75);
  --accent-foreground: oklch(0.33 0.035 50);
  --destructive: oklch(0.55 0.17 27);
  --destructive-foreground: oklch(0.99 0.005 90);
  --success: oklch(0.58 0.09 155);
  --success-foreground: oklch(0.99 0.005 90);
  --border: oklch(0.9 0.018 78);
  --input: oklch(0.9 0.018 78);
  --ring: oklch(0.6 0.115 42);

  --shadow-soft: 0 1px 2px oklch(0.45 0.05 60 / 0.05), 0 8px 24px -12px oklch(0.45 0.05 60 / 0.18);
  --shadow-lift: 0 2px 4px oklch(0.45 0.05 60 / 0.06), 0 18px 40px -18px oklch(0.45 0.05 60 / 0.28);
}

/* --- base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

.muted { color: var(--muted-foreground); }
.small { font-size: 0.8125rem; }
.grow { min-width: 0; flex: 1; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.center { text-align: center; }

/* --- layout: max-w-md, som prototypens AppShell ------------------------- */

.wrap {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 20px 20px calc(96px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- topbar (sticky, backdrop blur) ------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid oklch(0.9 0.018 78 / 0.6);
  background: oklch(0.984 0.009 84 / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-inner {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .mark { width: 32px; height: 32px; flex: 0 0 auto; object-fit: contain; }

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .sub {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .back {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted-foreground);
  flex: 0 0 auto;
}

/* Admin-pillen i højre side, som prototypen */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}
.pill:hover { text-decoration: none; filter: brightness(0.97); }
.pill svg { width: 14px; height: 14px; }

/* --- card-soft ----------------------------------------------------------- */

.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.card h2,
.section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--foreground);
  margin: 0 0 12px;
}

.card h2:only-child,
.card .row h2 { margin-bottom: 0; }

.card p:last-child { margin-bottom: 0; }

/* --- knapper ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0 18px;
  height: 40px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: filter 0.15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(0.93); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.small { height: 32px; padding: 0 14px; font-size: 0.75rem; }

.btn.secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  box-shadow: none;
}

.btn.outline {
  background: var(--background);
  color: var(--foreground);
  border-color: var(--input);
  box-shadow: none;
}

.btn.ghost { background: transparent; color: var(--muted-foreground); box-shadow: none; }
.btn.ghost:hover { background: var(--accent); color: var(--accent-foreground); }

.btn.danger { background: var(--destructive); color: var(--destructive-foreground); }

/* --- formularer ---------------------------------------------------------- */

label { display: block; font-size: 0.8125rem; font-weight: 700; margin-bottom: 6px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px oklch(0.6 0.115 42 / 0.18);
}

textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

input[type=file] { font-size: 0.8125rem; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.hint { font-size: 0.75rem; color: var(--muted-foreground); margin: 6px 0 0; }

/* --- flash --------------------------------------------------------------- */

.flash {
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.flash.error {
  background: oklch(0.55 0.17 27 / 0.1);
  border-color: oklch(0.55 0.17 27 / 0.3);
  color: var(--destructive);
}
.flash.success {
  background: oklch(0.58 0.09 155 / 0.12);
  border-color: oklch(0.58 0.09 155 / 0.3);
  color: var(--success);
}

/* --- badge --------------------------------------------------------------- */

.badge {
  display: inline-block;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 3px 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge.primary { background: var(--primary); color: var(--primary-foreground); }
.badge.ok { background: oklch(0.58 0.09 155 / 0.15); color: var(--success); }

/* --- profilhoved --------------------------------------------------------- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background: var(--secondary);
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.profile-head .name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-head .date { font-size: 0.75rem; color: var(--muted-foreground); }

/* --- lister -------------------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.list > li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: oklch(0.945 0.018 80 / 0.6);
  border-radius: var(--radius-lg);
  padding: 12px;
  font-size: 0.9375rem;
}

.list > li .sub { font-size: 0.75rem; color: var(--muted-foreground); }
.list > li .verse { font-size: 0.75rem; font-weight: 700; color: var(--primary); }

/* --- kalender-events ----------------------------------------------------- */

.event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  background: oklch(0.945 0.018 80 / 0.6);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 8px;
}
.event:last-of-type { margin-bottom: 0; }
.event .when {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}
.event .what { font-weight: 600; }
.event .where { font-size: 0.75rem; color: var(--muted-foreground); }

.stale-note { font-size: 0.75rem; color: var(--muted-foreground); margin: 10px 0 0; }

/* --- skriftsted og citat ------------------------------------------------- */

.scripture { margin-top: 12px; }
.scripture .ref { font-size: 0.875rem; font-weight: 700; color: var(--primary); }
.scripture div + div { font-size: 0.875rem; color: var(--muted-foreground); }

blockquote {
  margin: 12px 0 0;
  border-left: 2px solid var(--border);
  padding-left: 12px;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--muted-foreground);
}
blockquote cite { display: block; font-style: normal; margin-top: 4px; }

/* --- afkrydsning (læseplan) ---------------------------------------------- */

.check-row { display: flex; align-items: center; gap: 12px; }

.check-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--background);
  color: transparent;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.check-btn.on {
  background: var(--success);
  border-color: var(--success);
  color: var(--success-foreground);
}

/* --- genvejsfliser ------------------------------------------------------- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 14px;
  color: var(--foreground);
  text-decoration: none;
}
.tile:hover { text-decoration: none; box-shadow: var(--shadow-lift); }
.tile .t-icon { color: var(--primary); margin-bottom: 6px; }
.tile .t-icon svg { width: 20px; height: 20px; }
.tile .t-label { font-family: var(--font-display); font-weight: 600; font-size: 0.9375rem; }
.tile .t-sub { font-size: 0.75rem; color: var(--muted-foreground); }

/* --- bundnavigation ------------------------------------------------------ */

.bottomnav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  border-top: 1px solid var(--border);
  background: oklch(0.995 0.005 90 / 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bottomnav ul {
  list-style: none;
  margin: 0 auto;
  max-width: 28rem;
  padding: 0 8px env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-lg);
  padding: 10px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-decoration: none;
}
.bottomnav a:hover { text-decoration: none; }
.bottomnav a svg { width: 20px; height: 20px; }
.bottomnav a.active { color: var(--primary); }
.bottomnav a.active svg { stroke-width: 2.4; }

/* --- login --------------------------------------------------------------- */

.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--background);
}
.auth-box { width: 100%; max-width: 24rem; }
.auth-head { text-align: center; margin-bottom: 32px; }
.auth-head img { width: 12rem; margin: 0 auto 16px; }
.auth-head p { font-size: 0.875rem; color: var(--muted-foreground); margin: 4px 0 0; }

/* --- tabeller ------------------------------------------------------------ */

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
th { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; }

/* --- bogcovers ----------------------------------------------------------- */

.cover { width: 56px; height: 82px; flex: 0 0 auto; border-radius: var(--radius-sm); object-fit: cover; background: var(--secondary); }

/* --- diverse ------------------------------------------------------------- */

.stack { display: flex; flex-direction: column; gap: 14px; }
.empty { font-size: 0.875rem; color: var(--muted-foreground); margin: 0; }
.progress { height: 8px; border-radius: 999px; background: var(--secondary); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* --- profilhoved som link ------------------------------------------------ */

a.profile-head { color: inherit; text-decoration: none; }
a.profile-head:hover { text-decoration: none; box-shadow: var(--shadow-lift); }

/* --- læseliste ----------------------------------------------------------- */

.books { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.book { display: block; color: inherit; text-decoration: none; }
.book:hover { text-decoration: none; }
.book img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  background: var(--secondary);
}

.nocover {
  aspect-ratio: 2 / 3;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
  font-family: var(--font-display);
  font-size: 0.6875rem;
  line-height: 1.3;
  color: var(--muted-foreground);
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.b-title { margin-top: 6px; font-size: 0.75rem; font-weight: 700; line-height: 1.25; }
.b-author { font-size: 0.6875rem; color: var(--muted-foreground); }

/* --- advarsel ------------------------------------------------------------ */

.warn {
  border-radius: var(--radius-md);
  background: oklch(0.55 0.17 27 / 0.08);
  border: 1px solid oklch(0.55 0.17 27 / 0.25);
  color: var(--destructive);
  padding: 10px 12px;
  font-size: 0.8125rem;
}

.badge.accent { background: var(--primary); color: var(--primary-foreground); }

/* --- dokumentliste ------------------------------------------------------- */

.doc-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.doc-title svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--primary); }

/* --- statustal ----------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--primary);
}
.stat span { font-size: 0.75rem; color: var(--muted-foreground); }

/* --- listerækker med indhold --------------------------------------------- */

.list > li .ref { display: block; font-weight: 600; }
.list > li .sub { display: block; }
.list > li.today { background: oklch(0.93 0.032 75 / 0.85); }
.list > li form { display: contents; }

.card .empty + .list, .card .empty + ul { margin-top: 10px; }

/* Besvaret forbøn / betalt økonomipost dæmpes */
.list > li.done { opacity: 0.6; }
.list > li.done .grow > div:first-child { text-decoration: line-through; }
