/* ==========================================================================
   Admin – bygger oven på site.css
   ========================================================================== */

/* ---------- Log ind ---------- */

body.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 48px 20px; }
.login__card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 28px; padding: 40px 36px 36px; border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4); }
.login__card :focus-visible { outline-color: var(--accent); }
.login__brand { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.login__title { margin-bottom: 6px; font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1.1; letter-spacing: -0.02em; }
.login__back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: #FFFFFF; font-size: 15px; }
.login__back:hover { color: var(--on-navy); }

/* ---------- Ramme ---------- */

body.admin { display: flex; flex-wrap: wrap; min-height: 100vh; }
.admin-side { flex: 1 1 220px; max-width: 264px; display: flex; flex-direction: column; gap: 28px; padding: 24px 16px; background: var(--navy); color: #FFFFFF; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side :focus-visible { outline-color: #FFFFFF; }
.admin-side .logo { padding: 0 10px; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px; color: var(--on-navy); font-weight: 500; font-size: 15px; text-decoration: none; }
.admin-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #FFFFFF; }
.admin-nav a[aria-current="page"] { background: var(--accent); color: #FFFFFF; font-weight: 600; }
.admin-nav__count { margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 999px; background: #FFFFFF; color: var(--navy); font-size: 12px; font-weight: 600; text-align: center; }
.admin-side__bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.admin-side__bottom a, .admin-side__bottom button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--on-navy); font-size: 15px; text-align: left; text-decoration: none; cursor: pointer; }
.admin-side__bottom a:hover, .admin-side__bottom button:hover { background: rgba(255, 255, 255, 0.08); color: #FFFFFF; }

.admin-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 28px; padding: 32px 40px 64px; }
.admin-main > .notice { margin: 0; }
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.admin-head--bottom { padding-top: 4px; }
.admin-head__title { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.admin-title { font-family: var(--font-display); font-weight: 700; font-size: 36px; line-height: 1.1; letter-spacing: -0.02em; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-actions .button, .admin-head > .button { min-height: 48px; padding: 0 22px; font-size: 15px; }

/* ---------- Lister ---------- */

.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 16px 12px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.admin-row__image { flex: none; display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--image-ground); color: var(--image-ink); }
.admin-row__image--round { border-radius: 50%; }
.admin-row__image img { width: 100%; height: 100%; object-fit: cover; }
.admin-row__text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.admin-row__name { color: var(--ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.admin-row__name:hover { color: var(--accent); text-decoration: underline; }
.admin-row__meta { color: var(--muted); font-size: 14px; }
.admin-row__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-row__actions { display: flex; gap: 2px; }
.icon-button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); }
.icon-button:hover { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Formularer ---------- */

.garment-form { display: flex; flex-direction: column; gap: 28px; }
.form-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.form-layout__main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.form-layout__side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.form-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.form-narrow { width: 100%; max-width: 680px; }

.form-card { display: flex; flex-direction: column; gap: 20px; padding: 28px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.form-card > h2, .form-card__head h2 { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; }
.form-card h2 .icon { color: var(--accent); }
.form-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.form-layout__side .form-card { padding: 24px; gap: 16px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 16px; }
.input--number { width: 180px; max-width: 100%; font-family: var(--font-mono); font-size: 17px; }
.input--readonly { background: #F7F9F8; font-size: 13px; font-weight: 400; }
.input-unit { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.check-line { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; cursor: pointer; }
.check-line input { width: 20px; height: 20px; accent-color: var(--accent); }
input[type="file"] { max-width: 100%; font-size: 15px; }
input[type="file"]::file-selector-button { min-height: 44px; margin-right: 12px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }

/* Valgknapper: 1–5, vurdering og størrelse */
.segmented { display: flex; flex-direction: column; gap: 8px; }
.segmented__options { display: grid; gap: 6px; }
.segmented__options--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.segmented__options--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented__options--stack { grid-template-columns: minmax(0, 1fr); }
.segmented label { position: relative; display: block; cursor: pointer; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented label > span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-weight: 600; font-size: 15px; }
.segmented label:hover > span { background: #EDF0EF; }
.segmented input:checked + span { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.segmented__options--stack label > span { flex-direction: column; align-items: flex-start; gap: 0; padding: 10px 16px; }
.segmented__options--stack small { font-weight: 400; font-size: 13px; opacity: 0.85; }
.segmented__scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

/* Billeder */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr)); gap: 14px; }
.image-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 14px; background: var(--image-ground); }
.image-tile > img { width: 100%; height: 100%; border-radius: 14px; object-fit: cover; }
.image-tile__badge { position: absolute; left: 8px; bottom: 8px; padding: 2px 10px; border-radius: 999px; background: var(--navy); color: #FFFFFF; font-size: 12px; font-weight: 600; }
.image-tile__tools { position: absolute; top: 6px; right: 6px; left: 6px; display: flex; justify-content: flex-end; gap: 4px; }
.image-tile__tools button, .image-tile__remove { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: #FFFFFF; color: var(--ink); cursor: pointer; }
.image-tile__tools button::after, .image-tile__remove::after { content: ""; position: absolute; width: 44px; height: 44px; }
.image-tile__tools button, .image-tile__remove { position: relative; }
.image-tile__tools button:first-child { margin-right: auto; }
.image-tile__tools button:hover, .image-tile__remove:hover { background: var(--accent-soft); }
.image-tile__remove input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.image-tile__remove:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.image-tile__removed { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; padding: 34px 10px 10px; border-radius: 14px; background: rgba(16, 27, 58, 0.78); color: #FFFFFF; font-size: 13px; font-weight: 600; text-align: center; pointer-events: none; }
.image-tile:has([data-remove]:checked) .image-tile__removed { display: flex; }
.image-tile:has([data-remove]:checked) .image-tile__remove { z-index: 1; background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.image-tile:has([data-remove]:checked) [data-move], .image-tile:has([data-remove]:checked) .image-tile__badge { visibility: hidden; }
.image-add { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1 / 1; border: 2px dashed var(--line-strong); border-radius: 14px; background: #F7F9F8; color: var(--accent); font-weight: 600; font-size: 14px; text-align: center; cursor: pointer; }
.image-add:hover { background: var(--accent-soft); }
.image-add input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.image-add:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.image-add.is-busy { opacity: 0.6; pointer-events: none; }

.photo-field { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 24px; }
.photo-field .field { flex: 1 1 260px; }
.photo-field__preview { flex: none; width: 112px; height: 112px; border-radius: 50%; object-fit: cover; background: var(--image-ground); }
.photo-field__preview--empty { display: flex; align-items: center; justify-content: center; color: var(--image-ink); }
.settings-image { width: 240px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; }

.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding: 24px 28px; border: 1px solid #E8B9AC; border-radius: 20px; background: #FFF8F5; }
.danger-zone h2 { font-size: 17px; font-weight: 600; }
.danger-zone > div { flex: 1 1 280px; }
.danger-zone .button { min-height: 48px; padding: 0 22px; font-size: 15px; }

/* ---------- QR-koder ---------- */

.qr-box { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #FFFFFF; color: var(--ink); }
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-box--plain { padding: 0; border: 0; border-radius: 0; }
.qr-box--empty { flex-direction: column; gap: 10px; padding: 20px; border: 2px dashed #C3CBC9; color: var(--muted); font-size: 14px; text-align: center; }
.address { font-size: 13px; font-weight: 400; overflow-wrap: anywhere; }

.qr-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.qr-list { flex: 1 1 340px; min-width: 0; padding: 20px 16px 16px; gap: 12px; }
.qr-list .field { padding: 0 4px; }
.qr-list ul { display: flex; flex-direction: column; gap: 4px; }
.qr-list__item { display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px solid transparent; border-radius: 14px; color: var(--ink); text-decoration: none; }
.qr-list__item:hover { background: #EDF0EF; color: var(--ink); }
.qr-list__item[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.qr-list__item[aria-current="true"] .chip { background: #FFFFFF; }
.qr-list__image { flex: none; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: #E9ECF0; color: var(--muted); }
.qr-list__image img { width: 100%; height: 100%; object-fit: cover; }
.qr-list__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qr-list__text strong { font-weight: 600; overflow-wrap: anywhere; }
.qr-list__text small { font-size: 13px; color: #36454A; }

.qr-detail { flex: 2 1 480px; min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 32px 40px; padding: 32px; }
.qr-detail__tag { flex: 0 1 240px; min-width: 0; margin: 0 auto; }
.qr-detail__info { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.qr-detail__name { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; }
.qr-detail__buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.qr-detail__buttons .button { flex: 1 1 150px; padding: 0 20px; }
.copy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.copy-row .input { flex: 1 1 120px; min-width: 0; min-height: 48px; }
.empty--inline { flex: 2 1 480px; }

/* ---------- Beskeder ---------- */

.message-list { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.message { gap: 14px; }
.message__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.message__head > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.message__head time { font-size: 13px; font-weight: 400; }
.message__text { overflow-wrap: anywhere; }
.message form { align-self: flex-start; }

/* ---------- Mobil ---------- */

@media (max-width: 860px) {
  .admin-side { position: static; height: auto; max-width: none; flex-basis: 100%; gap: 12px; padding: 12px; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-nav a { min-height: 44px; }
  .admin-side__bottom { margin-top: 0; flex-direction: row; flex-wrap: wrap; padding-top: 8px; }
  .admin-side__bottom a, .admin-side__bottom button { width: auto; }
  .admin-main { padding: 24px 20px 48px; }
  .admin-title { font-size: 30px; }
  .form-card { padding: 22px 20px; }
  .login__card { padding: 32px 24px 28px; }
}

/* ---------- Print af QR-mærke ---------- */

@media print {
  body.admin { display: block; background: #FFFFFF; }
  .admin-side, .admin-head, .qr-list, .qr-detail__info, .notice, .skip-link { display: none !important; }
  .admin-main, .qr-detail, .qr-detail__tag { display: block; margin: 0; padding: 0; border: 0; }
  .hangtag--outline { width: var(--tag-size, 5cm); gap: calc(var(--tag-size, 5cm) * 0.06); padding: calc(var(--tag-size, 5cm) * 0.2) calc(var(--tag-size, 5cm) * 0.09) calc(var(--tag-size, 5cm) * 0.08); border: 0.3mm solid #000000; border-radius: calc(var(--tag-size, 5cm) * 0.07); box-shadow: none; break-inside: avoid; }
  .hangtag--outline::before { top: calc(var(--tag-size, 5cm) * 0.07); width: calc(var(--tag-size, 5cm) * 0.07); height: calc(var(--tag-size, 5cm) * 0.07); margin-left: calc(var(--tag-size, 5cm) * -0.035); border: 0.3mm solid #000000; background: #FFFFFF; }
  .hangtag--outline .hangtag__text { gap: 0; padding-top: calc(var(--tag-size, 5cm) * 0.04); border-top: 0.2mm dashed #000000; }
  .hangtag--outline .label { font-size: calc(var(--tag-size, 5cm) * 0.045); color: #000000; }
  .hangtag--outline .hangtag__name { font-size: calc(var(--tag-size, 5cm) * 0.07); }
}
