/* Skrifter (SIL Open Font License). Nå: Jost (geometrisk, i Futura-tradisjonen) overalt.
   Serifskriftene under lastes bare hvis variablene peker på dem igjen. */
@font-face { font-family: "Jost"; src: url(fonts/jost-latin-wght-normal.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Jost"; src: url(fonts/jost-latin-wght-italic.woff2) format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-full-normal.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-wght-italic.woff2) format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/cormorant-garamond-latin-wght-normal.woff2) format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url(fonts/lora-latin-wght-normal.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url(fonts/lora-latin-wght-italic.woff2) format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  /* Varm palett: krem, espresso og terrakotta */
  --bg: #f6efe4;
  --surface: #fffaf3;
  --text: #3a2a20;
  --muted: #8c7666;
  --line: #eaddcb;
  --accent: #b5562f;
  --accent-ink: #fff8ef;
  --accent-soft: #f6e2d3;
  --danger: #a3322f;
  --honey: #c9922f;
  --ok: #7f9461;
  --shadow: 0 1px 2px rgb(110 70 30 / 0.06), 0 6px 18px rgb(110 70 30 / 0.06);
  /* Bytt tilbake til serif: --display: "Cormorant Garamond"; --serif: "Fraunces"; --text-serif: "Lora" */
  --sans: "Jost", "Futura", "Avenir Next", "Century Gothic", sans-serif;
  --display: var(--sans);
  --serif: var(--sans);
  --text-serif: var(--sans);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1712;
    --surface: #29211a;
    --text: #f2e7d9;
    --muted: #b29e8b;
    --line: #3b3027;
    --accent: #e3895e;
    --accent-ink: #26170f;
    --accent-soft: #3e2a1f;
    --danger: #f08a7c;
    --honey: #e0b25e;
    --ok: #a3b882;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--text-serif);
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
.i { width: 24px; height: 24px; flex: none; vertical-align: -6px; }
.i.sm { width: 17px; height: 17px; vertical-align: -3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.err { color: var(--danger); font-size: 14px; }

input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  outline: none;
}
select {
  width: 100%; min-height: 48px; padding: 12px 14px; font: inherit; color: inherit;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
input:focus, select:focus { border-color: var(--accent); outline: none; }

.primary .i, .btn .i, .danger .i { margin-right: 6px; }
.primary, .btn, .danger {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.btn { background: var(--accent-soft); color: var(--text); }
.danger { background: transparent; border: 1px solid var(--line); color: var(--danger); }
.wide { display: block; width: 100%; }
.link-btn { background: none; border: 0; color: var(--accent); padding: 8px 0; font-weight: 500; }
.link-btn.center { display: block; margin: -4px auto 8px; }
.icon-btn {
  background: none; border: 0; padding: 8px; border-radius: 10px;
  color: var(--text); font-size: 28px; line-height: 1; display: grid; place-items: center;
}

/* Oppstart */
#join { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.join-card { width: 100%; max-width: 420px; display: grid; gap: 16px; }
.join-card h1 { font-size: 32px; }
.join-card label { display: block; margin-bottom: 8px; font-weight: 600; }
.row { display: flex; gap: 8px; }
.row .primary { flex: none; white-space: nowrap; }
.or { text-align: center; color: var(--muted); position: relative; }
.or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { background: var(--bg); padding: 0 10px; position: relative; }

/* App-skall */
#app { max-width: 640px; margin: 0 auto; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
}
.top h1 { font-size: 28px; flex: 1; }
.conn { width: 9px; height: 9px; border-radius: 50%; background: var(--honey); }
.conn.on { background: var(--accent); }
.conn.off { background: var(--danger); }
main { padding: 0 16px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; max-width: 220px; background: none; border: 0;
  display: grid; justify-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: 12px; color: var(--muted);
}
.tabbar button.active { color: var(--accent); }
.tabbar .i { width: 26px; height: 26px; }

/* Handleliste */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--line); padding: 3px; border-radius: 12px; margin: 4px 0 14px;
}
.seg button { border: 0; background: none; padding: 8px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.count { font-weight: 500; color: var(--muted); font-size: 14px; }

.add { display: flex; gap: 8px; margin-bottom: 14px; }
.add .primary { width: 50px; padding: 0; flex: none; display: grid; place-items: center; }
.add .primary .i { width: 28px; height: 28px; margin: 0; } /* ikon alene: ingen luft til tekst */

.suggest { list-style: none; margin: -6px 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.suggest:empty { display: none; }
.suggest li { display: flex; align-items: center; background: var(--accent-soft); border-radius: 999px; }
.suggest .pick { background: none; border: 0; padding: 8px 4px 8px 14px; font-weight: 500; }
.suggest .forget { background: none; border: 0; padding: 8px 12px 8px 6px; color: var(--muted); display: grid; place-items: center; }

.items { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.items:empty { display: none; }
.items li { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.items li:last-child { border-bottom: 0; }
.check {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  background: none; border: 0; padding: 13px 0 13px 14px; text-align: left;
}
.box {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center;
}
.done .box { background: var(--accent); border-color: var(--accent); }
.done .box::after { content: ""; width: 6px; height: 11px; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.txt { overflow-wrap: anywhere; }
.done .txt { color: var(--muted); text-decoration: line-through; }
.del { flex: none; background: none; border: 0; color: var(--muted); padding: 10px 14px; display: grid; place-items: center; }
.del .i { width: 20px; height: 20px; }

.empty { text-align: center; color: var(--muted); margin: 32px 0; }
.done-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 6px; }
.done-head h2 { font-size: 15px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.oda-link { display: block; text-align: center; margin: 20px 0; color: var(--accent); font-weight: 600; text-decoration: none; }

/* Ukemeny */
.week-nav { display: flex; align-items: center; justify-content: space-between; text-align: center; margin: 2px 0 10px; }
.week-label { font-weight: 700; font-size: 19px; }
.days { display: grid; gap: 10px; padding-bottom: 12px; }
.day { background: var(--surface); border-radius: 14px; padding: 12px 14px 14px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; }
.day-name { font-weight: 700; }
.day input { padding: 10px 12px; }
.day .dish { font-weight: 600; }
.day .link { font-size: 15px; }
.recipe { font-size: 15px; color: var(--accent); font-weight: 600; text-decoration: none; }

/* Innstillinger */
dialog {
  border: 0; padding: 0; width: min(520px, 100%); max-height: 92dvh;
  margin: auto auto 0; border-radius: 18px 18px 0 0;
  background: var(--bg); color: var(--text);
}
@media (min-width: 600px) { dialog { margin: auto; border-radius: 18px; } }
dialog::backdrop { background: rgb(45 28 18 / 0.45); }
.sheet { padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet h3 { margin-top: 14px; font-size: 16px; }
.sheet p { margin: 0; }
.code-box { background: var(--surface); border-radius: 12px; padding: 14px; text-align: center; }
.code-box code { font-family: inherit; font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px; z-index: 20;
}

/* Kalender */
#calDays .day { gap: 4px; padding-bottom: 10px; }
#calDays .day-head { align-items: center; gap: 8px; }
#calDays .day-head .muted { margin-right: auto; }
.add-ev {
  background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 10px;
  width: 34px; height: 34px; display: grid; place-items: center; margin: -4px -4px -4px 0;
}
.add-ev .i { width: 20px; height: 20px; }
.evs { list-style: none; margin: 0; padding: 0; }
.evs:empty { display: none; }
.ev {
  width: 100%; display: flex; gap: 12px; align-items: baseline; text-align: left;
  background: none; border: 0; border-top: 1px solid var(--line); padding: 10px 0;
}
.evs li:first-child .ev { border-top: 0; }
.ev-time { flex: none; width: 88px; white-space: nowrap; color: var(--accent); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.ev-title { overflow-wrap: anywhere; }

/* Skjema i ark */
#evDialog .sheet-head h2 { font-size: 17px; }
.link-btn.strong { font-weight: 700; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field input[type="date"], .field input[type="time"] { min-height: 48px; -webkit-appearance: none; appearance: none; }
#evDelete { margin-top: 10px; }

/* Gjentakelse */
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick button {
  aspect-ratio: 1; max-height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 15px; padding: 0;
}
.daypick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ev-title .i.sm { color: var(--muted); margin-left: 4px; width: 15px; height: 15px; }
#evHint { margin: 0; }

/* Kalenderoppføringer i ukemenyen */
.day-evs { list-style: none; margin: -4px 0 0; padding: 0; font-size: 13px; color: var(--muted); display: grid; gap: 1px; }
.day-evs:empty { display: none; }
.day-evs b { font-weight: 600; color: var(--accent); margin-right: 4px; font-variant-numeric: tabular-nums; }

/* Hurtig-innlegging i kalenderen */
.qa { margin: 4px 0 8px; }
.qa-preview {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  background: var(--accent-soft); border-radius: 12px; padding: 8px 8px 8px 12px;
}
.qa-sum { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; }
.qa-sum b { font-size: 15px; width: 100%; }
.qa-sum .i.sm { color: var(--accent); margin-right: 3px; }
.qa-preview .link-btn { flex: none; padding: 8px; }
.qa-help { margin: 0 0 12px; }
.qa-help .ex {
  display: inline-block; margin: 6px 6px 0 0; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); cursor: pointer;
}
#calDays .day { cursor: pointer; }
.ev-time { display: grid; line-height: 1.25; }
.ev-time small { color: var(--muted); font-weight: 500; font-size: 13px; }
#evAllDay { margin: -4px 0 0; }
input:disabled { opacity: .45; }

/* Startskjerm */
.home-date { margin: -6px 2px 14px; font-size: 15px; }
.card { background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); display: grid; gap: 10px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card-head h2 .i { color: var(--accent); width: 22px; height: 22px; }
.card-head .link-btn { padding: 4px 0; font-size: 15px; }
.card .add, .card .qa { margin: 0; }
.card .suggest { margin: -2px 0 0; }
.card .dish { font-weight: 600; }
.card .evs .ev { padding: 9px 0; }
.items.flat { background: none; box-shadow: none; border-radius: 0; margin: -4px 0; }
.items.flat .check { padding-left: 0; }
.items.flat .del { padding-right: 0; }
#hNoEvents, #hEmpty { margin: 0; }
#hMore { justify-self: start; padding: 0; }
.ev.past { opacity: .5; }
.ev .now { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-ink); background: var(--accent); border-radius: 6px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px; }
.mini-seg { display: flex; gap: 2px; background: var(--line); padding: 2px; border-radius: 9px; }
.mini-seg button { border: 0; background: none; border-radius: 7px; padding: 4px 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mini-seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.mini-seg span { font-weight: 500; }
.tomorrow h2 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tomorrow .day-evs { margin: 0; font-size: 15px; gap: 4px; color: var(--text); }
.tabbar button { max-width: 160px; }

/* Varsel med angre-knapp */
.toast { display: flex; align-items: center; gap: 14px; }
.toast-btn { background: none; border: 0; color: var(--accent-soft); font-weight: 700; padding: 0; }

/* Lister som piller (rulles sidelengs når det blir mange) */
.pills { display: flex; gap: 8px; overflow-x: auto; margin: 4px -16px 14px; padding: 2px 16px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pills button {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 14px; font-weight: 600; font-size: 15px; color: var(--text); white-space: nowrap;
}
.pills button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pills button.active .count { color: inherit; opacity: .8; }
.pills .new-list { color: var(--accent); border-style: dashed; display: flex; align-items: center; gap: 4px; }
.pills .new-list .i { width: 18px; height: 18px; }
.list-tools { display: flex; justify-content: center; gap: 24px; margin: 20px 0; }
.danger-text { color: var(--danger); }
.item-link { flex: none; color: var(--accent); padding: 10px 4px; display: grid; place-items: center; }
.item-link .i { width: 20px; height: 20px; }
.host { color: var(--muted); font-size: 14px; }

/* Avtaler fra andre kalendere */
.ev.ext .ev-title { color: var(--text); }
.src {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; vertical-align: 2px;
}
.feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.feed-list:empty { display: none; }
.feed-list li { background: var(--surface); border-radius: 12px; padding: 10px 6px 10px 14px; display: flex; align-items: center; gap: 8px; }
.feed-list .meta { flex: 1; min-width: 0; display: grid; }
.feed-list .meta span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-list .meta .feed-err { color: var(--danger); white-space: normal; }
.feed-list button { background: none; border: 0; color: var(--muted); padding: 8px; display: grid; place-items: center; }
.feed-form { display: grid; gap: 8px; }
.howto { font-size: 14px; color: var(--muted); }
.howto summary { color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px 0; }
.howto ol { padding-left: 20px; margin: 6px 0; display: grid; gap: 4px; }
.howto p { margin: 6px 0; }
.howto b { color: var(--text); font-weight: 600; }
.toast { width: max-content; max-width: calc(100vw - 32px); }

/* Kompakt ukemeny: én rad per dag */
#days { gap: 6px; }
.mrow {
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 8px; padding: 6px 6px 6px 12px;
}
.mlabel { display: grid; line-height: 1.15; }
.mlabel b { font-size: 15px; }
.mlabel span { font-size: 12px; color: var(--muted); }
.mmain { min-width: 0; display: grid; gap: 2px; }
.mmain .day-evs { margin: 0 0 2px 2px; font-size: 12px; }
.dinner { display: flex; align-items: center; gap: 6px; }
.dinner .dish {
  flex: 1; min-width: 0; padding: 8px 10px; font-weight: 600;
  border-color: transparent; background: var(--bg);
}
.dinner .dish:focus { border-color: var(--accent); background: var(--surface); }
.dinner .dish::placeholder { font-weight: 500; }
.rlink {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: none; border: 1px dashed var(--line); color: var(--muted); opacity: .55;
  -webkit-touch-callout: none; user-select: none;
}
.rlink .i { width: 21px; height: 21px; }
.rlink.on { opacity: 1; border: 0; background: var(--accent-soft); color: var(--accent); }
.week-nav { margin-bottom: 6px; }

/* Forslag fra tidligere retter/avtaler */
.suggest .pick .sub { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.dish-suggest { margin: 4px 0 2px; gap: 6px; }
.dish-suggest .pick { padding: 6px 2px 6px 12px; font-size: 15px; }
.dish-suggest .forget { padding: 6px 10px 6px 4px; }
#evSuggest { margin: -4px 0 0; }
.card .suggest:empty, #evSuggest:empty { display: none; }

/* Helligdager og bursdager */
.ev.holiday { cursor: default; }
.ev.holiday .ev-time { color: var(--muted); font-weight: 500; }
.ev.holiday.red .ev-title, .ev.holiday.red .ev-time { color: var(--danger); }
.ev.bday .ev-title .i.sm { color: var(--accent); margin: 0 6px 0 0; vertical-align: -3px; }
.red-day, .red-day + .muted { color: var(--danger) !important; }
.day-evs li.hol { font-style: italic; }
.day-evs li.hol.red { color: var(--danger); font-style: normal; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }
.check-row .i.sm { color: var(--accent); margin: 0 -4px 0 0; }

/* Klokke på startskjermen */
#title.clock { white-space: nowrap; overflow: hidden; min-width: 0; font-variant-numeric: lining-nums tabular-nums; }
#title.clock .time { color: var(--accent); }

/* Kalender: visningsvalg */
.seg3 { grid-template-columns: 1fr 1fr 1fr; margin: 0 0 10px; }

/* Månedsvisning */
.mgrid-head, .mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mgrid-head { margin: 2px 0 4px; }
.mgrid-head span { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.mgrid-head span:nth-child(7) { color: var(--danger); }
.mcell {
  aspect-ratio: 1 / 1.05; border: 0; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow);
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; padding: 4px 2px 6px;
  font-size: 16px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums;
}
.mcell.other { background: none; box-shadow: none; color: var(--muted); opacity: .45; }
.mcell.red .num { color: var(--danger); }
.mcell.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.mcell .dots { display: flex; gap: 3px; height: 6px; }
.mcell .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.mcell .dots i.ext { background: var(--muted); }
.mcell .dots i.bday { background: var(--honey); }
.mcell .dots i.more { background: none; width: auto; height: auto; font-size: 9px; line-height: 6px; color: var(--muted); font-style: normal; }
.mday { margin-top: 12px; }
.mday h2 { font-size: 17px; }

/* Kommende */
.agenda { display: grid; gap: 10px; margin-bottom: 12px; }
.agenda .aday { background: var(--surface); border-radius: 14px; padding: 10px 14px 4px; box-shadow: var(--shadow); }
.agenda h3 { margin: 0 0 2px; font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.agenda h3.red-day { color: var(--danger); }
.agenda .evs .ev { padding: 8px 0; }
.agenda-empty { text-align: center; color: var(--muted); margin: 24px 0; }
.mcell { aspect-ratio: auto; height: 46px; padding: 4px 2px 5px; font-size: 15px; }
.mgrid { gap: 3px; }
.mcell.sun .num { color: var(--danger); }

/* ================= Varm stil ================= */
body { background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 60%, var(--bg)) 0, var(--bg) 320px) fixed, var(--bg); }

/* Overskrifter og «store» tekster i Fraunces – myk og elegant */
h1, h2, h3, #title, .week-label, .day-name, .mlabel b, .card-head h2, .sheet-head h2,
.code-box code, .join-card h1, .dinner .dish, .mcell .num, .qa-sum b, .feed-list b {
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 0;
}
.top h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
#title.clock .time { font-style: normal; }
.join-card h1 { font-size: 44px; font-weight: 600; letter-spacing: -0.02em; }
.week-label { font-weight: 600; font-size: 20px; }
.day-name, .mlabel b { font-weight: 600; }
.card-head h2 { font-size: 19px; font-weight: 600; }
.dinner .dish { font-size: 17px; font-weight: 500; }
.dinner .dish::placeholder { font-style: italic; font-weight: 400; }
input::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
.home-date { font-family: var(--serif); font-style: italic; font-size: 16px; }

/* Små etiketter: kursiv i stedet for STORE BOKSTAVER */
.done-head h2, .agenda h3, .tomorrow h2 {
  font-family: var(--serif); font-style: italic; text-transform: none; letter-spacing: 0;
  font-size: 16px; font-weight: 500;
}
.agenda h3 { color: var(--accent); }
.tomorrow h2 { color: var(--muted); }

/* Mykere flater */
.card, .day, .mrow, .items, .agenda .aday { border-radius: 18px; box-shadow: var(--shadow); }
.mrow { border-radius: 16px; }
.mcell { border-radius: 12px; }
input, select { border-radius: 14px; background: var(--surface); }
.dinner .dish { background: color-mix(in srgb, var(--bg) 70%, var(--surface)); }
.primary, .btn, .danger { border-radius: 14px; font-family: var(--text-serif); font-weight: 600; }
.primary { box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent); }
.seg, .mini-seg { background: color-mix(in srgb, var(--line) 75%, var(--bg)); }
.seg button, .mini-seg button { font-family: var(--serif); }
.pills button { font-family: var(--serif); font-weight: 500; }
.suggest li { background: var(--accent-soft); }

/* Tab-baren som et varmt papirark */
.tabbar { background: color-mix(in srgb, var(--surface) 88%, transparent); border-top-color: var(--line); }
.tabbar button { font-family: var(--serif); font-size: 13px; }
.tabbar button.active { font-weight: 600; }

/* Avtaler */
.ev-time { font-family: var(--serif); font-weight: 600; }
.now { font-family: var(--text-serif); }
.toast { font-family: var(--text-serif); border-radius: 14px; }

/* Toppen: gjennomskinnelig, så den varme bakgrunnen flyter under */
.top {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.home-date { margin: 2px 2px 16px; }
/* Tilkobling: rolig salviegrønn når alt er synkronisert */
.conn.on { background: var(--ok); }

/* De største titlene: Cormorant Garamond – klassisk og elegant */
#title, .join-card h1 {
  font-family: var(--display);
  font-variation-settings: normal;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: lining-nums tabular-nums;
}
#title { font-size: 36px; line-height: 1.1; }
.join-card h1 { font-size: 58px; line-height: 1; }

/* Arcticons: tynn, avrundet strek – litt kraftigere i små størrelser */
.i { stroke-width: 2.6; }
.i.sm { stroke-width: 3; }
.tabbar .i { stroke-width: 2.4; }

/* Jost: vekter tilpasset en geometrisk sans */
#title, .join-card h1 { font-weight: 500; letter-spacing: -0.015em; }
#title { font-size: 32px; }
.join-card h1 { font-size: 54px; letter-spacing: -0.03em; }
.card-head h2, .week-label, .day-name, .mlabel b { font-weight: 600; letter-spacing: -0.01em; }
.dinner .dish { font-weight: 500; }
.ev-time { font-weight: 600; }
body { letter-spacing: 0.005em; }

/* Ikon foran titler fra andre kalendere (f.eks. fotball) */
.ev-title .i.sm.lead { color: var(--accent); margin: 0 6px 0 0; vertical-align: -3px; }
.day-evs .i.sm { color: var(--accent); vertical-align: -3px; }

/* Ikonvelger i avtaleskjemaet */
.icon-pick-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 8px 12px; min-height: 48px;
  font: inherit; font-weight: 500; color: var(--text);
}
.icon-pick-show { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.icon-pick-show:empty { background: none; border: 1px dashed var(--line); }
.icon-pick-show .i { width: 22px; height: 22px; }
#evIconName { flex: 1; }
#evIconName small { color: var(--muted); font-weight: 400; }
.icon-pick-btn .caret { color: var(--muted); transition: transform .15s; }
.icon-pick-btn[aria-expanded="true"] .caret { transform: rotate(90deg); }
.icon-grid { margin-top: 8px; max-height: 300px; overflow-y: auto; padding: 2px; display: grid; gap: 10px; }
.icon-grid h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.icon-grid .row { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.icon-grid button {
  height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--text); padding: 0;
}
.icon-grid button .i { width: 24px; height: 24px; }
.icon-grid button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icon-grid button.none { font-size: 12px; color: var(--muted); }
.icon-grid { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 10px; max-height: 280px; }

/* Velkomstskjermen: Uka-logoen (bokstaver i tekstfarge, haken i terrakotta) */
.join-title { margin: 0 0 4px; line-height: 0; }
.join-title .wordmark { width: min(200px, 55vw); height: auto; fill: var(--text); }

/* Logo i toppfeltet (trykk = startsiden) */
.brand { flex: none; background: none; border: 0; padding: 4px 2px 0 0; margin-right: -2px; display: grid; place-items: center; color: var(--accent); }
.brand svg { height: 24px; width: auto; fill: currentColor; display: block; }
/* Toppfelt i to linjer: logo, tilkobling og innstillinger øverst – tittelen (klokken) får hele bredden under */
.top {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center;
  grid-template-areas: "brand conn gear" "title title title";
  column-gap: 10px; row-gap: 0; padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px;
}
.top .brand { grid-area: brand; justify-self: start; padding: 2px 0; }
.top .brand svg { height: 20px; }
.top #conn { grid-area: conn; }
.top #settingsBtn { grid-area: gear; margin-right: -8px; }
.top #title { grid-area: title; min-width: 0; }
