/* ==========================================================================
   PHP-udgaven: kontrolpanel med trin, skabeloner, fakturaer og kontaktsystem.
   ========================================================================== */

.flashTop { margin-top: 20px; }
.flashWrap { width: min(1120px, 100% - 2 * var(--gutter)); margin: 16px auto 0; }
.pageBody { padding-bottom: clamp(64px, 8vw, 104px); }
.profileSection.firstSection { margin-top: 0; }
.profileSection + .claimCard, .firstSection + .claimCard { margin-top: 32px; }

.noAiCard { display: flex; gap: 16px; align-items: flex-start; padding: 22px 24px; background: var(--green-soft); border-radius: var(--r-lg); color: var(--green-ink); }
.noAiCard svg { flex: none; margin-top: 3px; }
.noAiCard h2, .noAiCard h3 { margin-bottom: 6px; font-size: 1.35rem; color: var(--green-ink); }
.noAiCard p { color: var(--ink-2); margin-bottom: 12px; }
.noAiCard p:last-child { margin-bottom: 0; }

/* Trin i kontrolpanelet */
.dashNav a { justify-content: flex-start; align-items: center; gap: 10px; }
.stepDot { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border: 1.5px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.dashNav a.isDone .stepDot { background: var(--green); border-color: var(--green); color: #fff; }
.stepNo { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 4px; background: var(--ink); border-radius: 999px; color: #fff; font-family: var(--font-sans); font-size: 0.9rem; font-weight: 650; vertical-align: 3px; }
.nextStep { margin-top: 12px; color: var(--ink-2); font-size: 0.92rem; }
.nextStep a { color: var(--green); font-weight: 600; }
.subHead { margin: 26px 0 12px; font-family: var(--font-sans); font-size: 1rem; font-weight: 650; }

.templateGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.templateGrid form { display: contents; }
.templateButton { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); color: var(--ink); font-size: 0.95rem; font-weight: 550; text-align: left; text-decoration: none; transition: border-color .15s ease, background-color .15s ease; }
.templateButton:hover:not(:disabled) { border-color: var(--ink); background: #fbfaf6; }
.templateButton svg { flex: none; color: var(--green); }
.templateButton.isUsed { background: var(--green-soft); border-color: transparent; color: var(--green-ink); cursor: default; }
.templateButton.isCustom { border-style: dashed; }
.noAiForm { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.noAiForm .fine { margin: 0; }

.segLink { padding: 8px 16px; border-radius: 999px; color: var(--ink-2); font-size: 0.92rem; font-weight: 550; text-decoration: none; }
.segLink.isActive { background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink); }
.codeArea { width: 100%; resize: vertical; border: 0; }

.invoiceList { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.invoiceList li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.invoiceList a { font-weight: 600; }

/* Faktura */
.invoiceMain { width: min(820px, 100% - 2 * var(--gutter)); margin: 32px auto 96px; }
.invoicePaper { display: grid; gap: 24px; }
.invoiceHead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; }
.invoiceHead h1 { font-size: 2rem; margin-bottom: 6px; }
.invoiceMeta { display: grid; gap: 6px; margin: 0; }
.invoiceMeta div { display: flex; justify-content: space-between; gap: 24px; font-size: 0.93rem; }
.invoiceMeta dt { color: var(--muted); }
.invoiceMeta dd { margin: 0; font-weight: 600; }
.invoiceBuyer { color: var(--ink-2); }
.adminTable .num { text-align: right; white-space: nowrap; }
.adminTable tfoot td { padding: 10px 12px; border-bottom: 0; }
.adminTable tfoot tr.total td { font-size: 1.1rem; font-weight: 700; border-top: 1px solid var(--ink); }
.payBox { padding: 18px 20px; background: var(--surface-2); border-radius: var(--r-md); }
.payBox h2 { margin-bottom: 8px; font-family: var(--font-sans); font-size: 0.8rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.invoicePaper > .button { justify-self: start; }

/* Admin */
.adminTabs a { display: inline-flex; flex: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-bottom: 2px solid transparent; color: var(--ink-2); font-weight: 550; text-decoration: none; }
.adminTabs a:hover { color: var(--ink); }
.adminTabs a.active { border-bottom-color: var(--ink); color: var(--ink); }
.filterTabs { flex-wrap: wrap; gap: 2px; }
.dueNow { color: var(--amber); }
.hitList details { border-bottom: 1px solid var(--line); }
.hitList summary { display: grid; gap: 2px; padding: 12px 10px; cursor: pointer; list-style: none; }
.hitList summary::-webkit-details-marker { display: none; }
.hitList summary:hover { background: var(--green-soft); }
.addContact { padding: 6px 10px 16px; }
.mailCard textarea { font-family: var(--font-sans); font-size: 0.95rem; line-height: 1.55; }
.mailCard .linkButton { justify-self: start; margin: -8px 0 14px; font-size: 0.88rem; }
.reviewForm { margin-top: 18px; }
.formActions form { display: inline-flex; }

@media (max-width: 640px) {
  .templateGrid { grid-template-columns: minmax(0, 1fr); }
  .invoiceList li { grid-template-columns: minmax(0, 1fr) auto; }
}

/* Søgefelter med ikon: plads til ikonet (overstyrer de almindelige feltregler) */
.registerSearch .field input:not([type="checkbox"]):not([type="radio"]) { height: 54px; padding-left: 48px; border-radius: 999px; }

/* Grid-børn må gerne være smallere end tabellerne i dem; tabellen ruller så vandret i sin egen boks */
.adminMain > *, .adminStack > *, .dashMain > *, .dashGrid > * { min-width: 0; }

/* Brede logoer (ordmærker): dobbelt så bred flise */
.monogram.hasLogo.isWide { width: auto; aspect-ratio: 2 / 1; padding: 6px 8px; }
.monogram-sm.hasLogo.isWide { width: 72px; height: 36px; }
.monogram-lg.hasLogo.isWide { width: 144px; height: 72px; padding: 12px 14px; }
.monogram.hasLogo.isWide img { border-radius: 0; }
.dashIdentity .monogram-lg.hasLogo.isWide { width: 104px; height: 52px; }

/* Logo i kontrolpanelet */
.logoBlock { display: flex; gap: 18px; align-items: flex-start; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.logoBlock h3 { margin: 0 0 4px; font-family: var(--font-sans); font-size: 1rem; font-weight: 650; }
.logoBlock .muted { margin: 0 0 12px; font-size: 0.92rem; }
.logoForm { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 8px; }
.logoForm .field { flex: 1 1 260px; margin: 0; }
.logoForm input[type="file"] { padding: 10px; font-size: 0.9rem; }
@media (max-width: 640px) { .logoBlock { flex-direction: column; } }

/* Mailudkast i admin */
.fieldLabel { margin: 18px 0 8px; font-size: 0.86rem; font-weight: 600; color: var(--ink-2); }
.mailPreview { padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: visible; min-height: max-content; }
.mailPreview img { max-width: 100%; }
.plainMail { margin-top: 16px; }
.plainMail summary { cursor: pointer; color: var(--ink-2); font-size: 0.92rem; }
.plainMail textarea { width: 100%; margin: 12px 0 10px; font-family: var(--font-sans); font-size: 0.92rem; line-height: 1.5; }
.logoBlockAdmin { margin-top: 0; padding-top: 0; border-top: 0; }
.breakAll { word-break: break-all; }

/* Kontrolpanel: besked nederst, markering af det, der lige er gemt, og plads under sidehovedet */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; max-width: min(560px, calc(100% - 32px)); padding: 14px 20px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 0.95rem; line-height: 1.45; box-shadow: 0 12px 32px rgba(22, 33, 28, .22); opacity: 0; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; pointer-events: none; }
.toast.isOn { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: #8a2c1d; }
.dashMain [id] { scroll-margin-top: 88px; }
.dashSystems li.isNew { animation: justSaved 2.4s ease; }
@keyframes justSaved { 0%, 40% { background: var(--green-soft); } 100% { background: transparent; } }
.dashSystems li.isEditing { display: block; }
body.isSaving .dashMain { cursor: progress; }
body.isSaving .dashMain button[type="submit"]:disabled { opacity: .6; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } .dashSystems li.isNew { animation: none; background: var(--green-soft); } }
.systemEditor { scroll-margin-top: 88px; }
.newSystem { margin-top: 18px; }

/* Sidehoved: menupunkterne må aldrig bryde over to linjer; den kompakte menu tager over i tide */
.siteHeaderInner a { white-space: nowrap; }
@media (max-width: 1140px) {
  .mainNav, .headerActions { display: none; }
  .mobileMenu { display: block; margin-left: auto; }
}
.consentForm { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 16px 0 4px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--r-md); }
.consentForm .field { flex: 1 1 320px; margin: 0; }

/* Fire valg af mærke: må gerne bryde over to linjer på smalle skærme */
#maerke .segmented { flex-wrap: wrap; width: auto; max-width: 100%; }

/* Profilside: beskrivelse og handlinger i toppen, spørgsmål og svar, mærket i sidespalten */
.profileLead { max-width: 62ch; margin: 18px 0 0; color: var(--ink-2); font-size: 1.06rem; line-height: 1.6; }
.profileActions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.profileActions .button { min-height: 44px; }
.profileFaq { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--line); }
.profileFaq > div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.profileFaq dt { margin-bottom: 6px; font-weight: 650; color: var(--ink); }
.profileFaq dd { margin: 0; color: var(--ink-2); line-height: 1.6; }
.sideSeal { margin: 6px 0 14px; }
.sectionMore { margin-top: 16px; }
.crumbs a { display: inline-block; padding: 6px 0; }

/* Små links i foden: store nok at ramme med en finger */
.footerBottom a { display: inline-block; padding: 12px 0; }

/* Admin: hvem skal mailen til? */
.pillGood { background: var(--green-soft); color: var(--green-ink); }
.recipientNow { margin-bottom: 16px; }
.recipientMail { font-weight: 620; overflow-wrap: anywhere; }
.recipientNow .fine { margin-top: 6px; max-width: 64ch; }
.recipientList { display: grid; margin: 4px 0 16px; padding: 0; list-style: none; }
.recipientList li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.recipientList li > div { min-width: 0; }
.recipientList b { font-weight: 620; overflow-wrap: anywhere; }
.recipientList .fine { margin-top: 4px; max-width: 64ch; }
.recipientList form { flex: none; }
