/* Wings-appen (/app/): ét login, forskellig grænseflade for fagperson, familie og administrator.
   Bygger oven på styles.css + portal.css. Mobil først, med fast fanebjælke i bunden. */

.app-body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.app-top { padding-top: max(12px, env(safe-area-inset-top)); }
.app-main { max-width: 760px; padding-top: 18px; }
.app-main h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }

/* Opstart */
.app-boot { display: grid; place-items: center; min-height: 56vh; }
.boot-mark { width: 74px; height: 74px; animation: boot 1.6s var(--ease) infinite; }
@keyframes boot { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.07); opacity: 1; } }

/* Formularer */
.app-form { margin-top: 20px; }
.btn.block { width: 100%; justify-content: center; padding: 16px 20px; font-size: 1.02rem; }
.field .hint { margin-top: 2px; }
.otp {
  font: 600 1.9rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  letter-spacing: .38em; text-align: center; padding: 18px 12px !important;
}
.otp-code { text-transform: uppercase; letter-spacing: .18em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; }
.otp.otp-code { font-size: 1.5rem !important; letter-spacing: .2em; }
.linkish {
  background: none; border: 0; padding: 6px 2px; cursor: pointer; font: 600 .92rem var(--sans);
  color: var(--teal); text-decoration: underline; text-underline-offset: 3px;
}
.linkish[disabled] { color: var(--muted); text-decoration: none; cursor: default; }
.app-links { justify-content: space-between; margin-top: 16px; }
.app-links.center { justify-content: center; gap: 22px; margin-top: 8px; }
.label-sm { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.small-gap { margin: -4px 0 14px; }

/* Rollevalg */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
@media (max-width: 560px) { .role-grid { grid-template-columns: 1fr; } }
.role-card {
  display: grid; gap: 10px; text-align: left; padding: 20px; border-radius: 22px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.role-card:hover, .role-card.selected { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow-sm); }
.role-card .tile { --s: 50px; }
.role-card .name { font-family: var(--serif); font-size: 1.3rem; font-weight: 500; }
.role-card .sub { color: var(--muted); font-size: .92rem; line-height: 1.45; }

/* Overskrifter og rækker */
.hello { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hello > .tile { --s: 56px; }
.panel-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.panel-head .tile { --s: 46px; }
.panel-head h2 { margin: 0; }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 26px 4px 10px; }
.section-row h2 { margin: 0; font-size: 1.5rem; font-weight: 500; }
.app-stats { margin-top: 20px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 680px) { .app-stats { grid-template-columns: repeat(3, 1fr); } .app-stats .stat-v { font-size: 1.6rem; } }

/* Familiekort (fagperson) */
.family {
  display: grid; gap: 14px; padding: 20px; border-radius: 24px; border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow-sm);
}
.family-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 12px; flex-wrap: wrap; }
.family-head .lhs { display: flex; gap: 14px; align-items: center; flex: 1 1 220px; min-width: 0; }
.family-head .tile { --s: 48px; }
.family-head h3 { margin: 0; font-size: 1.15rem; font-family: var(--sans); font-weight: 600; }
.family .meta { color: var(--muted); font-size: .88rem; }
.kids { display: grid; gap: 10px; }
.kid {
  display: grid; gap: 8px; padding: 12px 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line);
}
.kid.paused { opacity: .62; }
.kid-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.kid-name { font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.kid-name::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.kid-wishes { display: flex; flex-wrap: wrap; gap: 6px; }
.wchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: .8rem; background: var(--sand); color: var(--ink-2); }
.wchip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.wchip.wait { background: #FBF1DC; color: #7A5A00; }
.wchip.ok { background: #E3F1E8; color: #1E6A4C; }
.wchip.done { background: #E6EBF7; color: #2B3F86; }
@media (prefers-color-scheme: dark) {
  .wchip.wait { background: #3A2F14; color: #F6E3B0; }
  .wchip.ok { background: #183A2E; color: #9FE0C7; }
  .wchip.done { background: #222C48; color: #BCC9F5; }
}
.family-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-add select {
  font: 400 .92rem var(--sans); padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink);
}
.mini { padding: 7px 12px; font-size: .82rem; }

/* Invitér: børnerækker */
.child-rows { display: grid; gap: 12px; margin-bottom: 12px; }
.child-row { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); }
.child-row-head { display: flex; justify-content: space-between; align-items: center; min-height: 34px; }
.child-row .num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--btn-bg); color: var(--btn-fg); font-weight: 700; font-size: .85rem;
}
.child-row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.child-row .field { margin: 0; min-width: 0; }

/* Resultat */
.result-grid { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: center; margin: 8px 0 16px; }
@media (max-width: 600px) { .result-grid { grid-template-columns: 1fr; } }
.result-grid .qr { margin: 0; }
.result-grid .qr svg { width: 200px; height: 200px; }
.big-code {
  font: 700 2.1rem/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em;
  color: var(--ink); padding: 16px 18px; border-radius: 18px; text-align: center;
  background: linear-gradient(145deg, color-mix(in srgb, var(--gold) 16%, var(--paper)), var(--paper));
  border: 1px dashed color-mix(in srgb, var(--gold) 70%, transparent); margin: 6px 0 12px;
}

/* Forælder */
.child-section { margin-bottom: 26px; }
.child-section .section-row { margin-top: 10px; }
.child-badge { display: inline-flex; align-items: center; gap: 10px; }
.child-badge .tile { --s: 40px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper);
  font: 600 .92rem var(--sans); color: var(--ink-2); cursor: pointer;
}
.chip.active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); }
.empty-state { text-align: center; padding: 26px 18px; border-radius: 22px; border: 1px dashed var(--line-strong); color: var(--muted); }

/* Admin */
.admin-item .who { display: grid; gap: 2px; }
.admin-item .who .title { font-weight: 600; }
.admin-item .who .sub { color: var(--muted); font-size: .88rem; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--sand); color: var(--ink-2); margin-right: 4px; }
.tag.good { background: #E3F1E8; color: #1E6A4C; }
.tag.warn { background: #FBF1DC; color: #7A5A00; }
.lang-wide .lang select { width: 100%; padding-top: 12px; padding-bottom: 12px; }

/* Fanebjælke i bunden */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; max-width: 150px; display: grid; justify-items: center; gap: 4px; padding: 8px 6px; border: 0;
  border-radius: 16px; background: transparent; color: var(--muted); font: 600 .74rem var(--sans); cursor: pointer;
  transition: color .2s, background .2s;
}
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button.active { color: var(--ink); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.tabbar button.active svg { color: var(--teal); }

/* Flyt flydende elementer op over fanebjælken, når den vises */
.app-body.has-tabs .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
.app-body.has-tabs .pwa-bar { bottom: calc(150px + env(safe-area-inset-bottom)); }
.app-body .pwa-install { display: none; }

/* Gavekort-hoved må bryde på smalle skærme */
.app-main .voucher-head { flex-wrap: wrap; row-gap: 4px; }
.app-main .voucher-brand { flex: 1 1 160px; min-width: 0; }
.child-row .field select { padding-left: 12px; padding-right: 30px; background-position: right 8px center; }

/* Voksne i familien */
.adults-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.adult-form-row .field { margin: 0; }
.adults { display: grid; gap: 6px; }
.adults .label-sm { margin: 0 0 2px; }
.adult-row {
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center;
  padding: 9px 12px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); font-size: .92rem;
}
.adult-name { font-weight: 600; }
.adult-line { color: var(--muted); font-size: .86rem; min-width: 0; }
.adult-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.adult-dot.claimed { background: #2E8B63; }
.adult-dot.unused { background: var(--gold); }
@media (max-width: 480px) {
  .adult-row { grid-template-columns: auto 1fr auto; }
  .adult-line { grid-column: 2 / 3; }
}
.adult-invites { display: grid; gap: 18px; margin: 6px 0 14px; }
.adult-invite { padding: 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--paper); }
.adult-invite-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 1.05rem; }
.adult-invite-head .num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--btn-bg); color: var(--btn-fg); font-weight: 700; font-size: .85rem;
}
.adult-invite .result-grid { margin: 0; }
.adult-invite .big-code { font-size: 1.8rem; }

/* Butikker og gavekort (admin) */
.shop-tools { align-items: center; margin: 4px 0 14px; }
.shop-tools .field { margin: 0; min-width: 180px; }
.shop-item { align-items: flex-start; }
.shop-item.off .title { color: var(--muted); }
.shop-item.blocked { align-items: center; }
.shop-item .blocked-note { font-size: .84rem; line-height: 1.45; }
.shop-item .who { display: grid; gap: 3px; min-width: 0; flex: 1 1 260px; }
.cat-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip.small { padding: 6px 11px; font-size: .8rem; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.switch input {
  appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; margin: 0;
  background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease);
}
.switch input:checked { background: var(--teal); }
.switch input:checked::after { transform: translateX(18px); }
.barcode .pin { font-size: .95rem; letter-spacing: .08em; }
.barcode a.btn { justify-self: center; }
