:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #667085;
    --border: #d9e0ea;
    --border-soft: #eaecf0;
    --primary: #1f5eff;
    --primary-dark: #1648c7;
    --primary-soft: #eef4ff;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --success: #067647;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --shadow: 0 18px 45px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); }

/* --------------------------------------------------------------------------
   Gemeinsame Formularelemente
-------------------------------------------------------------------------- */
label {
    display: block;
    font-weight: 650;
    margin-bottom: 7px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

textarea { resize: vertical; }

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(31, 94, 255, .14);
    border-color: var(--primary);
}

button,
.button {
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    line-height: 1.2;
    transition: background-color .15s ease, box-shadow .15s ease, transform .08s ease;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
}

button:active,
.button:active { transform: translateY(1px); }

.button-secondary,
.button.secondary,
button.secondary {
    background: #eef2ff;
    color: #1d2939;
}

.button-secondary:hover,
.button.secondary:hover,
button.secondary:hover {
    background: #dfe7ff;
    color: #1d2939;
}

.danger-button,
button.danger-button,
.button.danger-button {
    background: var(--danger);
    color: #fff;
}

.danger-button:hover,
button.danger-button:hover,
.button.danger-button:hover {
    background: #8f1d14;
    color: #fff;
}

.small { font-size: .92rem; }
.muted { color: var(--muted); }
.danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.full { grid-column: 1 / -1; }

.notice {
    margin: 18px 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: #1849a9;
    border: 1px solid #d1e0ff;
}
.notice code { word-break: break-word; }
.error { background: var(--danger-soft); color: var(--danger); border-color: #fecdca; }
.success { background: var(--success-soft); color: var(--success); border-color: #abefc6; }
.info { background: var(--primary-soft); color: #1849a9; }

/* --------------------------------------------------------------------------
   Öffentliche Seiten
-------------------------------------------------------------------------- */
.page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}
.card {
    width: 100%;
    max-width: 760px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow);
}
.brand {
    color: var(--primary);
    font-weight: 800;
    letter-spacing: .02em;
}
h1 {
    margin: 0 0 10px;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 1.08;
}
h2 { margin-top: 28px; }
p { color: var(--muted); line-height: 1.6; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 26px;
}
.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 8px;
}
.checkbox input {
    width: auto;
    margin-top: 5px;
}
.honeypot {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.actions {
    margin-top: 26px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.footer {
    margin-top: 18px;
    text-align: center;
    color: var(--muted);
    display: flex;
    justify-content: center;
    gap: 8px;
}
.footer a { color: var(--muted); }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.language-switch { font-size: 14px; white-space: nowrap; }
.language-switch a {
    text-decoration: none;
    color: #344054;
    padding: 4px 6px;
    border-radius: 8px;
}
.language-switch a.active { font-weight: 700; background: #f2f4f7; }
.language-switch span { color: #98a2b3; }

/* --------------------------------------------------------------------------
   Admin Grundlayout
-------------------------------------------------------------------------- */
.admin-body { background: #f4f6fb; }
.admin-page {
    width: auto;
    margin: 24px 24px;
}
.admin-card {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 18px 48px rgba(16, 24, 40, .10);
}
.admin-topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 18px;
    margin-bottom: 16px;
}
.admin-brand { font-weight: 800; font-size: 20px; color: var(--text); }
.admin-subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; }
.admin-meta { font-size: 14px; color: var(--muted); text-align: right; }
.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-soft);
}
.admin-nav a {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1d2939;
    text-decoration: none;
    font-weight: 650;
    font-size: 14px;
    transition: background-color .15s ease, color .15s ease;
}
.admin-nav a:hover {
    background: #dfe7ff;
    color: #102a83;
}
.admin-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}
.admin-heading-row h1 { margin-top: 0; }
.admin-heading-row p { margin-top: 6px; }

/* Toolbar / Filter */
.admin-toolbar,
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
    margin: 16px 0;
    padding: 14px;
    background: #f9fafb;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
}
.admin-toolbar > div,
.toolbar > div { min-width: 180px; }
.toolbar-field-wide { flex: 1 1 300px; }
.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.admin-result-meta {
    color: var(--muted);
    font-size: 14px;
    margin: 12px 0;
}

/* Tabellen */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: #fff;
}
.admin-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    font-size: 14px;
}
.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--border-soft);
    padding: 11px 12px;
    text-align: left;
    vertical-align: top;
}
.admin-table th {
    background: #f9fafb;
    font-weight: 750;
    color: #344054;
    font-size: 13px;
    white-space: nowrap;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr {
    transition: background-color .12s ease;
}
.admin-table tbody tr:hover {
    background: #f8fbff;
}
.admin-table td { overflow-wrap: anywhere; }
.cell-email { min-width: 220px; }
.actions-cell {
    white-space: nowrap;
    min-width: 150px;
}
.actions-cell a,
.actions-cell button {
    margin-right: 6px;
    margin-bottom: 6px;
}
.audit-table { min-width: 980px; }
.details-code,
.audit-details {
    display: block;
    max-width: 720px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.45;
    background: #f9fafb;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 9px;
    margin: 0;
}

/* Badges */
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    background: #eef2ff;
    color: #3538cd;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}
.badge-active { background: #dcfae6; color: #067647; }
.badge-pending { background: #fef0c7; color: #b54708; }
.badge-unsubscribed { background: #f2f4f7; color: #475467; }
.badge-bounced { background: #f4ebff; color: #6941c6; }
.badge-blocked { background: #fee4e2; color: #b42318; }

/* Kontaktformular */
.admin-form { margin-top: 10px; }
.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 18px;
}
.admin-form-grid > div {
    min-width: 0;
}

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f9fafb;
}
.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #fff;
    color: #344054;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.checkbox-list label:hover {
    background: #f8fbff;
    border-color: #bfd0ff;
    box-shadow: 0 1px 0 rgba(16, 24, 40, .04);
}
.checkbox-list input[type="checkbox"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    accent-color: var(--primary);
}

.warning-box {
    background: var(--warning-soft);
    border: 1px solid #fedf89;
    border-radius: 14px;
    padding: 13px 14px;
}
.warning-box label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-weight: 650;
    color: #7a2e0e;
}
.warning-box input[type="checkbox"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin: 2px 0 0;
    padding: 0;
    accent-color: var(--warning);
}
.danger-zone {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px;
    border: 1px solid #fecdca;
    border-radius: 16px;
    background: #fffbfa;
}
.danger-zone form { margin: 0; }
.copy-input {
    width: 100%;
    margin-top: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
hr {
    border: 0;
    border-top: 1px solid var(--border-soft);
    margin: 28px 0;
}

/* Mobile */
@media (max-width: 900px) {
    .admin-page {
        width: min(100% - 20px, 1520px);
        margin: 10px auto 32px;
    }
    .admin-card { padding: 18px; border-radius: 18px; }
    .admin-topbar,
    .admin-heading-row { flex-direction: column; }
    .admin-meta { text-align: left; }
    .admin-toolbar,
    .toolbar { display: grid; grid-template-columns: 1fr; }
    .admin-toolbar > div,
    .toolbar > div { min-width: 0; }
    .toolbar-actions .button,
    .toolbar-actions button { width: 100%; }
    .admin-form-grid { grid-template-columns: 1fr; }
    .checkbox-list { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .page { padding: 20px 12px; }
    .card { padding: 24px; border-radius: 18px; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; }
    h1 { font-size: clamp(1.55rem, 7vw, 2rem); }
    .actions .button,
    .actions button { width: 100%; }
}

/* --------------------------------------------------------------------------
   Listenverwaltung: ruhiges Tabellen-/Formularlayout
   Diese Regeln ergänzen die Admin-Styles, ohne die Kontaktseite zu verändern.
-------------------------------------------------------------------------- */
.admin-two-column {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(280px, .75fr);
    gap: 18px;
    align-items: start;
    margin: 18px 0 24px;
}

.sub-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 8px 22px rgba(16, 24, 40, .045);
}

.sub-card h2 {
    margin: 0 0 14px;
    font-size: 1.15rem;
    line-height: 1.25;
}

.stacked-form {
    display: grid;
    gap: 14px;
}

.stacked-form label {
    margin: 0;
}

.checkbox-row {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    width: fit-content;
    font-weight: 650;
    padding: 8px 0;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    accent-color: var(--primary);
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 2px;
}

.inline-form {
    display: inline;
    margin: 0;
}

.link-button {
    appearance: none;
    border: 0;
    background: transparent !important;
    color: var(--primary) !important;
    padding: 0;
    min-height: 0;
    border-radius: 0;
    display: inline;
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    vertical-align: baseline;
}

.link-button:hover,
.actions-cell a:hover {
    color: var(--primary-dark) !important;
    text-decoration: underline;
    background: transparent !important;
}

.link-button.danger {
    color: var(--danger) !important;
}

.link-button.danger:hover {
    color: #8f1d14 !important;
}

.actions-cell a {
    font-weight: 650;
    text-decoration: none;
}

.actions-cell .inline-form,
.actions-cell a {
    margin-right: 10px;
    margin-bottom: 6px;
    display: inline-block;
}

/* Listen-Tabelle etwas kompakter als Kontakte/Audit */
.admin-table.lists-table,
.admin-table:has(+ .__never__) {
    min-width: 0;
}

@media (max-width: 900px) {
    .admin-two-column {
        grid-template-columns: 1fr;
    }
    .sub-card {
        padding: 16px;
    }
}

/* --------------------------------------------------------------------------
   Kontaktaktionen: Zusatz für Double-Opt-In erneut senden
   Bewusst am Dateiende, damit bestehende Kontakt-/Listenstyles stabil bleiben.
-------------------------------------------------------------------------- */
.contact-actions-zone {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-color: #d1e0ff;
    background: #f8fbff;
}

.contact-actions-zone form {
    margin: 0;
}

.contact-actions-zone .action-hint {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.contact-actions-zone button.secondary,
.contact-actions-zone .button.secondary {
    background: #eef4ff;
    color: #1849a9;
}

.contact-actions-zone button.secondary:hover,
.contact-actions-zone .button.secondary:hover {
    background: #d1e0ff;
    color: #102a83;
}

.login-secondary-actions {
    margin-top: 1rem;
    text-align: center;
}

.login-secondary-actions .button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    padding: 0.65rem 1rem;
    text-decoration: none;
}

.admin-footer-link {
    display: inline-block;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    text-decoration: none;
}

.admin-footer-link:hover {
    text-decoration: underline;
}

/* Ergebnis-Seite nach Admin-Aktionen, z. B. DOI-Mail erneut senden */
.admin-result-page {
    max-width: 920px;
    margin: 0 auto;
}

.admin-result-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.admin-result-card h1,
.admin-result-card h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.5rem;
    line-height: 1.25;
}

.admin-result-card p {
    margin: 0 0 16px;
    color: #475569;
    line-height: 1.6;
}

.admin-result-success {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    margin: 0 0 22px;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    background: #f0fdf4;
    color: #166534;
}

.admin-result-success .result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #22c55e;
    color: #ffffff;
    font-weight: 700;
    line-height: 1;
}

.admin-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.admin-result-actions .button,
.admin-result-actions a.button,
.admin-result-actions .button-secondary,
.admin-result-actions a.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
}

.admin-result-meta {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    color: #64748b;
    font-size: 0.92rem;
}

@media (max-width: 700px) {
    .admin-result-card {
        padding: 20px;
        border-radius: 14px;
    }

    .admin-result-actions {
        flex-direction: column;
    }

    .admin-result-actions .button,
    .admin-result-actions a.button,
    .admin-result-actions .button-secondary,
    .admin-result-actions a.button-secondary {
        width: 100%;
    }
}

/* Ende */

/* Admin user management add-on */
.admin-section-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}
.badge-role {
    text-transform: lowercase;
}
.help-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.align-end {
    align-self: end;
}
.mt-2 {
    margin-top: 2rem;
}
@media (max-width: 760px) {
    .admin-section-header,
    .help-grid {
        display: block;
    }
    .admin-section-header .actions {
        margin-top: 1rem;
    }
}

/* Ende */

/* Role based disabled/read-only UI */
.permission-note {
    margin: 0.75rem 0 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    color: #4b5563;
    font-size: 0.92rem;
}

.permission-note strong {
    color: #111827;
}

.role-disabled-panel {
    position: relative;
    opacity: 0.82;
}

.role-disabled-panel::before {
    content: "Nur Leserechte";
    display: inline-block;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.78rem;
    font-weight: 700;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled,
.button.is-disabled,
.link-button.is-disabled {
    cursor: not-allowed !important;
    opacity: 0.55;
    filter: grayscale(0.15);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
}

.button.is-disabled,
.link-button.is-disabled {
    pointer-events: none;
    text-decoration: none;
}

.admin-action-disabled {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.55rem;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.85rem;
    border: 1px solid #e5e7eb;
}

.admin-readonly-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a8a;
}

.admin-readonly-toolbar p {
    margin: 0;
}

@media (max-width: 720px) {
    .admin-readonly-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Ende */

/* Role based read-only/disabled UI */
.permission-note {
    margin: 0.75rem 0 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    color: #4b5563;
    font-size: 0.92rem;
}

.admin-readonly-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.9rem 1rem;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a8a;
}

.admin-readonly-toolbar p { margin: 0; }

.role-disabled-panel {
    opacity: 0.92;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled,
.button.is-disabled,
.link-button.is-disabled {
    cursor: not-allowed !important;
    opacity: 0.58;
    filter: grayscale(0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
}

.button.is-disabled,
.link-button.is-disabled {
    pointer-events: none;
    text-decoration: none;
}

.admin-action-disabled {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.85rem;
    border: 1px solid #e5e7eb;
}

.admin-users-actions {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.inline-form button.link-button {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.danger-link {
    color: #b91c1c !important;
}

.danger-link:hover {
    color: #7f1d1d !important;
    text-decoration: underline;
}

/* Ende */

/* Admin dashboard */
.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.admin-page-header h1 {
    margin-bottom: 0.25rem;
}

.admin-page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.65rem;
}

.dashboard-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dashboard-grid-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dashboard-grid-main {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.dashboard-stat {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-height: 128px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    color: #111827;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.dashboard-stat:hover {
    transform: translateY(-1px);
    border-color: #bfdbfe;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.dashboard-stat strong {
    font-size: clamp(1.6rem, 2.4vw, 2.35rem);
    line-height: 1;
}

.stat-label {
    color: #4b5563;
    font-size: 0.9rem;
    font-weight: 700;
}

.stat-help {
    margin-top: auto;
    color: #6b7280;
    font-size: 0.82rem;
}

.stat-active {
    border-color: #bbf7d0;
}

.stat-pending {
    border-color: #fde68a;
}

.stat-danger {
    border-color: #fecaca;
}

.stat-muted {
    border-color: #e5e7eb;
    background: #fafafa;
}

.dashboard-alerts {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.notice {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1e3a8a;
}

.notice.warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.notice a {
    font-weight: 700;
    color: inherit;
}

.dashboard-card {
    min-width: 0;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-header-row h2 {
    margin: 0;
}

.small-link {
    font-size: 0.9rem;
    color: #2563eb;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.small-link:hover {
    text-decoration: underline;
}

.admin-table.compact th,
.admin-table.compact td {
    padding: 0.6rem 0.7rem;
}

.admin-table .number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.1;
    background: #f3f4f6;
    color: #4b5563;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge.muted {
    background: #f3f4f6;
    color: #6b7280;
}

.recent-list {
    display: grid;
    gap: 0.65rem;
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.8rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    background: #ffffff;
}

.recent-item:hover {
    border-color: #bfdbfe;
    background: #f8fafc;
}

.recent-item span:first-child {
    min-width: 0;
}

.recent-item strong,
.recent-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-item small {
    margin-top: 0.2rem;
    color: #6b7280;
}

.activity-list {
    display: grid;
    gap: 0.7rem;
}

.activity-item {
    display: grid;
    gap: 0.45rem;
    padding: 0.75rem 0.8rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
}

.activity-item small {
    display: block;
    margin-top: 0.2rem;
    color: #6b7280;
}

.activity-item code,
.admin-table code {
    white-space: normal;
    word-break: break-word;
    color: #374151;
    background: #f9fafb;
    border-radius: 8px;
    padding: 0.15rem 0.35rem;
}

@media (max-width: 1180px) {
    .dashboard-grid-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-grid-main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .admin-page-header {
        flex-direction: column;
    }

    .admin-page-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .admin-page-actions .button {
        width: 100%;
    }

    .dashboard-grid-stats {
        grid-template-columns: 1fr;
    }

    .card-header-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .recent-item {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* Public logo and manual opt-out actions */
.public-logo-wrap {
    display: flex;
    justify-content: center;
    margin: 4px 0 22px;
}

.public-logo {
    display: block;
    width: min(260px, 78vw);
    height: auto;
}

.public-actions {
    align-items: stretch;
}

.public-actions .button,
.public-actions button {
    min-width: 170px;
}

@media (max-width: 560px) {
    .public-actions .button,
    .public-actions button {
        width: 100%;
    }
}


/* Newsletter preference center */
.preference-form {
    display: grid;
    gap: 1.2rem;
}

.preference-panel {
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 18px;
    padding: 1rem;
    background: rgba(248, 250, 252, .85);
}

.preference-panel h2 {
    margin-top: 0;
}

.preference-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .75rem;
    margin-top: .85rem;
}

.preference-list-card {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: .7rem;
    align-items: flex-start;
    padding: .85rem;
    border: 1px solid rgba(15, 23, 42, .13);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
}

.preference-list-card:hover {
    border-color: rgba(15, 23, 42, .25);
}

.preference-list-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: .1rem;
}

.preference-list-card strong {
    display: block;
    margin-bottom: .2rem;
}

.preference-list-card small {
    display: block;
    color: #64748b;
    line-height: 1.35;
}

.preference-actions {
    align-items: center;
    flex-wrap: wrap;
}

.danger-soft {
    border-color: #fecaca !important;
    background: #fef2f2 !important;
    color: #991b1b !important;
}

.danger-soft:hover {
    background: #fee2e2 !important;
}


/* Public brand logo: default requested size */
.brand-logo-wrap {
    display: flex;
    align-items: center;
}

.brand-logo {
    width: 120px;
    height: 52px;
    max-width: 120px;
    max-height: 52px;
    object-fit: contain;
    display: block;
}

/* Newsletter preferences repair */
.preference-form {
    display: grid;
    gap: 1.2rem;
}

.preference-panel {
    display: block;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 18px;
    padding: 1rem;
    background: rgba(248, 250, 252, .85);
}

.preference-list-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .75rem;
    margin-top: .85rem;
}

.preference-list-card {
    display: grid !important;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: .7rem;
    align-items: flex-start;
    padding: .85rem;
    border: 1px solid rgba(15, 23, 42, .13);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
}

.preference-list-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: .1rem;
}

.preference-list-card strong {
    display: block;
    margin-bottom: .2rem;
}

.preference-list-card small {
    display: block;
    color: #64748b;
    line-height: 1.35;
}

.preference-actions,
.preference-actions-sticky {
    display: flex !important;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: .25rem;
    padding-top: .25rem;
}

.preference-actions button {
    min-height: 44px;
}

.danger-soft {
    border-color: #fecaca !important;
    background: #fef2f2 !important;
    color: #991b1b !important;
}

.danger-soft:hover {
    background: #fee2e2 !important;
}

@media (max-width: 640px) {
    .brand-logo {
        width: 120px;
        height: 52px;
    }

    .preference-actions button {
        width: 100%;
    }
}


/* -------------------------------------------------------------------------
   Unsubscribe preference controls v2 - intentionally explicit and robust
   ------------------------------------------------------------------------- */
.preference-form-v2 {
    display: block !important;
    margin-top: 1rem;
}

.preference-panel-v2 {
    display: block !important;
    padding: 1rem !important;
}

.preference-list-items {
    display: grid !important;
    gap: .75rem !important;
    margin-top: 1rem !important;
}

.preference-option {
    display: grid !important;
    grid-template-columns: 24px minmax(0, 1fr) !important;
    gap: .8rem !important;
    align-items: flex-start !important;
    padding: .9rem !important;
    border: 1px solid rgba(15, 23, 42, .16) !important;
    border-radius: 14px !important;
    background: #fff !important;
}

.preference-option-checkbox {
    display: block !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    margin: .15rem 0 0 0 !important;
    padding: 0 !important;
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    accent-color: var(--primary);
}

.preference-option-label {
    display: block !important;
    margin: 0 !important;
    font-weight: 400 !important;
    cursor: pointer !important;
}

.preference-option-label strong {
    display: inline-block !important;
    color: var(--text) !important;
    font-weight: 800 !important;
    overflow-wrap: anywhere !important;
}

.preference-option-label em {
    display: inline-block !important;
    margin-left: .45rem !important;
    color: #92400e !important;
    font-size: .85rem !important;
    font-style: normal !important;
}

.preference-option-label small {
    display: block !important;
    margin-top: .25rem !important;
    color: var(--muted) !important;
    line-height: 1.45 !important;
}

.preference-reason {
    margin-top: 1rem !important;
}

.preference-reason label {
    display: block !important;
    margin-bottom: .4rem !important;
}

.preference-reason textarea {
    display: block !important;
    min-height: 92px !important;
}

.preference-buttons {
    display: flex !important;
    gap: .75rem !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    margin-top: 1rem !important;
}

.preference-buttons button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    cursor: pointer !important;
}

@media (max-width: 640px) {
    .preference-buttons button {
        width: 100% !important;
    }
}


/* Public logo cleanup: only the central header logo should be visible */
.public-brand,
.public-logo,
.page-logo,
.logo-wrap:not(.brand-logo-wrap) {
    display: none !important;
}

/* Central header logo size */
.brand-logo {
    width: 120px !important;
    height: 52px !important;
    max-width: 120px !important;
    max-height: 52px !important;
    object-fit: contain !important;
}


/* Unsubscribe terminal state */
.notice.warning {
    overflow-wrap: anywhere;
}

.actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}


/* Public logo home link */
.brand-logo-link,
.public-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.brand-logo-link:focus-visible,
.public-logo-link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .45);
    outline-offset: 4px;
    border-radius: 10px;
}

.public-logo-link .public-logo,
.brand-logo-link .brand-logo {
    display: block;
}


/* Integration review: public form spacing */
.preference-form-v2,
.preference-panel-v2,
.preference-list-items,
.preference-buttons,
.public-actions {
    min-width: 0;
}

.preference-buttons {
    gap: .75rem;
}

.preference-option {
    min-height: 48px;
}

.brand-logo-link,
.public-logo-link {
    cursor: pointer;
}


/* Preference email language */
.preference-language {
    display: grid;
    gap: .4rem;
    margin-top: 1rem;
}

.preference-language label {
    font-weight: 700;
}

.preference-language select {
    width: min(100%, 360px);
}

.preference-language small {
    color: #64748b;
    line-height: 1.35;
}
