/* Livs app — roligt og varmt, lys eller mørk efter telefonen. Ingen skrifttyper udefra. */
:root {
  --bg: #f6f2ec; --flade: #ffffff; --flade2: #efe9e0; --tekst: #2a2622; --stille: #7a736b;
  --accent: #b7791f; --accent-bg: #f3e3c6; --kant: #e4ddd2; --fejl: #b4442f;
  --rund: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418; --flade: #1b1f26; --flade2: #232833; --tekst: #ece6dc; --stille: #9aa0a8;
    --accent: #e8b467; --accent-bg: #3a2f1e; --kant: #2c313b; --fejl: #ff8a72;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--tekst);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.skjult { display: none !important; }

/* top og faner */
#top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px;
  padding: 14px 18px 10px; background: var(--bg);
}
#titel { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.tilbage { border: 0; background: none; font-size: 34px; line-height: 1; padding: 0 8px 4px 0; color: var(--accent); }
#indhold { padding: 0 14px; max-width: 680px; margin: 0 auto; }
#faner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: space-around;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); background: var(--flade);
  border-top: 1px solid var(--kant);
}
.fane {
  flex: 1; max-width: 180px; border: 0; background: none; padding: 6px 0; display: flex; flex-direction: column;
  align-items: center; gap: 2px; font-size: 13px; color: var(--stille); border-radius: 12px; min-height: 52px;
}
.fane .ikon { font-size: 22px; }
.fane.valgt { color: var(--accent); background: var(--accent-bg); }

/* kort og tekst */
.kort { background: var(--flade); border-radius: var(--rund); padding: 16px 18px; margin: 0 0 14px; border: 1px solid var(--kant); }
.dag-titel { margin: 0 0 4px; font-size: 21px; }
.info { margin: 0 0 10px; color: var(--stille); font-size: 15px; }
.kort p { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kort p:last-child { margin-bottom: 0; }
.sektion { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--stille); font-weight: 600; }
.overskrift { margin: 18px 0 8px; font-size: 18px; }
.memo { background: var(--flade2); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.memo-titel { margin: 0 0 2px; font-size: 18px; }
.meta { color: var(--stille); font-style: italic; font-size: 15px; }
.punkt { padding-left: 4px; }
blockquote { margin: 0 0 12px; padding: 4px 0 4px 12px; border-left: 3px solid var(--accent); color: var(--stille); white-space: pre-wrap; }
hr { border: 0; border-top: 1px solid var(--kant); margin: 16px 0; }
.fold { margin: 6px 0 4px; }
.fold summary { color: var(--stille); font-size: 15px; padding: 6px 0; }
.raa { color: var(--stille); font-size: 15px; }
.stille { color: var(--stille); }
.kursiv { font-style: italic; }
.venter { text-align: center; padding: 30px 0; }
.fejltekst { color: var(--fejl); padding: 20px 4px; }
.linje { margin: 0 0 8px !important; }

/* humør og skriveboks */
.humoer { display: flex; align-items: center; gap: 6px; margin: 0 0 14px; padding: 0 4px; }
.humoer-tekst { color: var(--stille); font-size: 15px; margin-right: auto; }
.humoer-knap {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--kant); background: var(--flade);
  font-size: 24px; line-height: 1; padding: 0; opacity: 0.55;
}
.humoer-knap.valgt { opacity: 1; border-color: var(--accent); background: var(--accent-bg); }
.skriv { display: flex; flex-direction: column; gap: 10px; margin: 0 0 18px; }
textarea, input[type=search], input:not([type]), #kode, select {
  width: 100%; border: 1px solid var(--kant); background: var(--flade); border-radius: 12px; padding: 12px 14px;
  font-size: 17px; outline: none;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); }
.stor {
  border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; padding: 13px 18px;
  min-height: 48px;
}
@media (prefers-color-scheme: dark) { .stor { color: #1b1408; } }
.stor:disabled { opacity: 0.5; }

/* lister */
.raekke {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; background: var(--flade);
  border-radius: 12px; padding: 12px 14px; margin: 0 0 8px; border: 1px solid var(--kant);
}
.kort .raekke { background: var(--flade2); border: 0; }
.raekke-dato { font-size: 14px; color: var(--stille); }
.raekke-titel { font-weight: 600; }
.raekke-glimt { font-size: 15px; color: var(--stille); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.raekke-emner { font-size: 13px; color: var(--accent); }
.mere { width: 100%; border: 1px solid var(--kant); background: var(--flade); border-radius: 12px; padding: 12px; margin: 4px 0 20px; color: var(--accent); }
.log-ud { display: block; margin: 26px auto 10px; border: 0; background: none; color: var(--stille); font-size: 15px; padding: 10px 20px; }

/* Dagbog */
.segment { display: flex; background: var(--flade2); border-radius: 12px; padding: 3px; margin: 0 0 12px; }
.segment button { flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 10px; color: var(--stille); font-size: 15px; }
.segment button.valgt { background: var(--flade); color: var(--tekst); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.filtre { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.filtre select { padding: 10px 12px; font-size: 15px; -webkit-appearance: none; appearance: none; }
.kal-hoved { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; }
.kal-hoved .sektion { margin: 0; text-transform: none; letter-spacing: 0; font-size: 18px; color: var(--tekst); }
.pil { border: 0; background: none; font-size: 30px; color: var(--accent); padding: 0 14px; min-height: 44px; }
.kalender { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0 0 20px; }
.ugedag { text-align: center; font-size: 13px; color: var(--stille); padding: 4px 0; }
.kal-dag {
  aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--flade); position: relative; font-size: 16px;
  min-height: 42px; padding: 0;
}
.kal-dag.har::after {
  content: ""; position: absolute; left: 50%; bottom: 6px; width: 6px; height: 6px; margin-left: -3px;
  border-radius: 50%; background: var(--accent);
}
.kal-dag.fremtid { opacity: 0.35; }
.soeg { display: flex; gap: 8px; margin: 0 0 12px; }
.soeg input { flex: 1; }

/* besked nederst */
.besked {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9;
  background: var(--tekst); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px;
  max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.besked.fejl { background: var(--fejl); color: #fff; }

/* login */
body.login { padding-bottom: env(safe-area-inset-bottom); }
.login main { max-width: 420px; margin: 0 auto; padding: 12vh 24px 40px; text-align: center; }
.login .logo { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
.login h1 { margin: 16px 0 4px; font-size: 32px; }
.login .stor { width: 100%; margin: 26px 0 10px; font-size: 18px; }
.login-besked { min-height: 24px; color: var(--stille); }
.login-besked.fejl { color: var(--fejl); }
.login details { margin-top: 26px; text-align: left; background: var(--flade); border: 1px solid var(--kant); border-radius: var(--rund); padding: 12px 16px; }
.login summary { color: var(--accent); padding: 4px 0; }
.login details button:not(.stor) { width: 100%; margin: 6px 0 10px; border: 1px solid var(--kant); background: var(--flade2); border-radius: 12px; padding: 12px; }
.login #kode { text-align: center; letter-spacing: 0.4em; font-size: 22px; }
.login details .stor { margin: 12px 0 4px; }
