/* Permen, og redigeringen av den, som skal se lik ut. */

.group {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 32px);
}

.group-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 24px;
  margin-bottom: 8px;
  font-weight: 600;
}
.group-top a { text-decoration: none; }
.group-top #edit { margin-left: auto; }

.admin-note {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--error);
  color: var(--surface);
  font-weight: 600;
}

.hero {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: var(--border);
  margin: 16px 0 20px;
}

.description { white-space: pre-line; font-size: 1.0625rem; margin: 16px 0 0; }
.description a { overflow-wrap: anywhere; }
.lists { margin-top: 32px; }
.lists .button { margin-top: 12px; }

/* ---------------------------------------------------------------------------
   Redigering av permen: samme oppsett, med felt i stedet for tekst.
   --------------------------------------------------------------------------- */

.editing-group h2 { font-size: 1.25rem; margin: 0 0 4px; }

.group-top-right { display: flex; align-items: center; gap: 12px; }

.save-status { color: var(--muted); font-size: 0.8125rem; font-weight: 400; }
.save-status.error { color: var(--error); font-weight: 600; }

/* Minst 16px skrift i alle felt, ellers zoomer iPhone inn. */
.editing-group .field {
  display: block;
  width: calc(100% + 12px);
  margin-left: -6px;
  margin-right: -6px;
  padding: 2px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  box-shadow: inset 0 0 0 1px var(--border);
  outline: none;
}
.editing-group .field:focus { box-shadow: inset 0 0 0 2px var(--accent); }

.editing-group .name-field {
  font: inherit;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.editing-group textarea.description {
  min-height: 5em;
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
}

.hero-edit { position: relative; }

.hero-empty {
  display: grid;
  place-items: center;
}

.photo-button {
  padding: 16px 22px;
  border: 2px dashed var(--muted);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.hero-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
}

.hero-tools .tool {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Listene i redigeringen ser ut som de grønne knappene i permen, med
   verktøyene inni kortet. */
.list-row {
  margin-top: 10px;
  padding: 12px 14px 14px 12px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 16px rgba(31, 111, 74, 0.18);
}

.list-row-title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  font-size: 1.0625rem;
  overflow-wrap: anywhere;
}

.list-row .row-tools { gap: 6px; margin-top: 12px; }
.list-row .row-tools > * {
  min-width: 38px;
  padding: 8px 11px;
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font-weight: 600;
}
.list-row .row-tools > :first-child { background: var(--surface); color: var(--accent); }
.list-row .row-tools .danger { background: rgba(0, 0, 0, 0.22); color: inherit; }

.row-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.row-tools > * {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
}
.row-tools > :disabled { opacity: 0.4; cursor: default; }
.row-tools .danger { color: var(--error); }

.new-item { margin-top: 20px; }
#editor-message { margin: 12px 0 0; }

.editor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.editor-row:first-child { border-top: 1px solid var(--border); margin-top: 12px; }
.editor-row button {
  flex: none;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--error);
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
}

.text-input {
  width: 100%;
  font: inherit;
  font-size: 1.0625rem;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.edit-section { margin-top: 40px; }
.edit-section p { margin: 0 0 4px; }

.button.danger { background: var(--error); color: var(--surface); }

/* ---------------------------------------------------------------------------
   Permen: bildet øverst, helt ut til kantene, og innholdet på
   et ark som legger seg litt inn over bildekanten. Brukes av både permen
   og redigeringen av den, så eieren ser det gjestene ser. Mangler bildet,
   blir toppen en rolig grønn flate.
   --------------------------------------------------------------------------- */

.gp {
  max-width: 640px;
  margin: 0 auto;
}

.gp-message { padding: calc(env(safe-area-inset-top) + 24px) 20px; }

.gp-hero {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, #1f6f4a 0%, #3f9a6c 55%, #8cc9a4 100%);
}
.gp-hero.no-image {
  aspect-ratio: auto;
  height: calc(env(safe-area-inset-top) + 132px);
}
.gp-hero > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* På brede skjermer står siden som et kort midt på. */
@media (min-width: 672px) {
  .gp { padding-top: 24px; }
  .gp-hero { border-radius: 24px; }
  .gp-sheet { border-radius: 24px; margin: -24px 12px 40px; }
}

/* Navigasjon oppå bildet: små mørke merkelapper som er lesbare på alle bilder. */
.gp-bar {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gp-bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.gp-bar > .pill:last-child { margin-left: auto; }
.pill:empty { display: none; }
.pill.save-status { font-weight: 400; font-size: 0.875rem; }
.pill.save-status.error { background: var(--error); color: var(--surface); font-weight: 600; }

.gp-sheet {
  position: relative;
  margin-top: -24px;
  padding: 26px 20px calc(env(safe-area-inset-bottom) + 40px) 46px;
  border-radius: 24px 24px 0 0;
  background: var(--bg);
}

/* Spiralen: siden ser ut som et oppslag i en spiralperm. Den går fra under den
   runde toppkanten og helt ned forbi sjekklistene. */
.gp-sheet::before {
  content: "";
  position: absolute;
  top: 30px;
  bottom: 24px;
  left: 0;
  width: 34px;
  background: var(--spiral-page) 0 0 / 34px 20px;
  background-repeat: no-repeat round; /* bare hele vindinger */
  pointer-events: none;
}

.gp-sheet h1 {
  margin: 0 0 12px;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.gp-sheet .description { margin: 0; color: var(--text); }

.gp-section-title {
  margin: 32px 0 4px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Listene: store grønne kort med hake og pil, så det er tydelig at de trykkes på. */
.list-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  margin-top: 10px;
  padding: 12px 14px 12px 12px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 16px rgba(31, 111, 74, 0.18);
}
.list-card:active { transform: scale(0.99); }

.card-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
}
.card-icon svg { width: 22px; height: 22px; }

.card-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-chevron { flex: none; font-size: 1.625rem; line-height: 1; opacity: 0.75; }

/* Redigeringen: bildeverktøy nede til høyre i bildet, over arket. */
.gp .hero-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 24px;
}
.gp .photo-button {
  border-color: rgba(255, 255, 255, 0.85);
  color: #ffffff;
  background: rgba(0, 0, 0, 0.15);
}
.gp .hero-tools {
  top: auto;
  bottom: 36px;
  right: 12px;
}
/* QR-kode og plakat for permen: nede til venstre på bildet (eller den grønne
   flaten), over kanten der arket begynner. */
.gp .hero-links {
  position: absolute;
  left: 12px;
  bottom: 36px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

/* Uten bilde trengs litt mer høyde i redigeringen, så «Legg til bilde» og
   QR-knappen ikke kolliderer. */
.editing-group .gp-hero.no-image { height: calc(env(safe-area-inset-top) + 200px); }
.editing-group .gp-hero.no-image .hero-empty { padding: 40px 0 72px; }

.gp .name-field { margin-bottom: 12px; }
.gp .gp-section-title { font-size: 0.8125rem; margin: 32px 0 4px; }
.gp .lists { margin-top: 0; }

/* Smale telefoner: knappene på bildet blir litt mindre, så de ikke kolliderer. */
@media (max-width: 400px) {
  .gp .hero-links .pill,
  .gp .hero-tools .tool { padding: 0 11px; font-size: 0.875rem; }
}

/* Loggen over bekreftelser: en diskret lenke nederst i permen, bare for
   eiere og redaktører. */
.log { margin-top: 40px; text-align: center; }
.log-link {
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.log-list { margin-top: 8px; text-align: left; }
.log-entry { padding: 12px 0; border-top: 1px solid var(--border); }
.log-entry:last-of-type { border-bottom: 1px solid var(--border); }
.log-entry-head {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.log-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.log-meta { display: flex; justify-content: space-between; gap: 12px; }
.log-chevron { flex: none; font-size: 1.25rem; line-height: 1; transition: transform 0.15s; }
.log-entry-head[aria-expanded="true"] .log-chevron { transform: rotate(90deg); }
.log-details { margin-top: 8px; }
.log-steps { margin: 0; padding: 0; list-style: none; }
.log-steps li { display: flex; gap: 8px; padding: 3px 0; font-size: 0.9375rem; }
.log-mark { flex: none; width: 1.2em; font-weight: 800; }
.log-steps li.done .log-mark { color: var(--accent); }
.log-steps li.missing { color: var(--error); }
.log-head strong { overflow-wrap: anywhere; }
.log-count { flex: none; color: var(--error); font-size: 0.875rem; font-weight: 700; }
.log-count.ok { color: var(--accent); }
.log-meta { color: var(--muted); font-size: 0.875rem; }
.log-comment { margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid var(--accent-soft); white-space: pre-line; font-size: 0.9375rem; }
.log-empty { margin: 8px 0; color: var(--muted); font-size: 0.875rem; text-align: center; }

.log-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.log-photos a { display: block; width: 88px; height: 88px; }
.log-photos img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

/* Valg av visning for en ny liste */
.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.mode-option { position: relative; margin: 0; cursor: pointer; }
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
}
.mode-option svg { width: 30px; height: 30px; color: var(--muted); }
.mode-option strong { font-size: 0.9375rem; line-height: 1.25; }
.mode-option small { color: var(--muted); font-weight: 400; font-size: 0.8125rem; line-height: 1.3; }
.mode-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-soft-text); }
.mode-option input:checked + span svg { color: var(--accent); }
.mode-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
