:root { --brand-primary: var(--brand-primary); --brand-header: var(--brand-header); }
/* RESET + BASE */
html, body {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f7fb;
    color: var(--brand-header);
}

/* Sticky Footer Layout */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.has-admin-notice::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(17,24,39,0.32);
}

/* HEADER */
.site-header {
    background: var(--brand-header);
    padding: 18px 30px;
}

.site-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 40px;
}

/* Logo */
.site-logo {
    flex-shrink: 0;
}

/* Navigation bleibt links fixiert */
.site-nav {
    display: flex;
    gap: 25px;
    margin-right: auto;
}

/* Login Bereich immer rechts */
.admin-header-login {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.site-logo img {
    height: 100px;
    display: block;
}

/* NAVIGATION */
.site-nav {
    display: flex;
    gap: 25px;
}

.site-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: 0.2s;
}

.site-nav a:hover {
    opacity: 0.7;
}

/* MAIN WRAPPER */
.page-wrapper {
    flex: 1;
    max-width: 1040px;
    margin: 60px auto;
    padding: 0 20px;
}

/* HERO */
.hero {
    text-align: center;
    margin-bottom: 30px;
}

.eyebrow {
    color: var(--brand-primary);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 12px;
}

.hero h1 {
    font-size: 36px;
    margin: 10px 0;
}

/* FORM */
.mf-form {
    background: #fff;
    max-width: 760px;
    margin: 0 auto;
    padding: 40px;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
}

.admin-overview {
    background: #ffffff;
    padding: 28px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-top: 28px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.06);
}

.admin-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.admin-overview-header h2 {
    margin: 6px 0 0;
}

.admin-overview-controls {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) minmax(150px, 190px);
    gap: 12px;
    margin-bottom: 14px;
}

.admin-overview-controls input,
.admin-overview-controls select {
    margin-bottom: 0;
}

.admin-overview-summary {
    color: #4b5563;
    font-size: 13px;
    margin-bottom: 12px;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th,
.admin-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: #374151;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
    background: #f9fafb;
}

.admin-table a {
    color: var(--brand-primary);
    font-weight: 700;
    text-decoration: none;
}

.admin-table button {
    width: auto;
    padding: 8px 12px;
}

.admin-table input,
.admin-table select {
    margin-bottom: 0;
    min-width: 120px;
}

.user-form-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.user-form-grid .admin-btn {
    min-height: 47px;
}

.admin-table td input + input {
    margin-top: 6px;
}


.user-table {
    table-layout: fixed;
    min-width: 920px;
}

.user-table th:nth-child(1) { width: 26%; }
.user-table th:nth-child(2) { width: 23%; }
.user-table th:nth-child(3) { width: 15%; }
.user-table th:nth-child(4) { width: 8%; text-align: center; }
.user-table th:nth-child(5) { width: 15%; }
.user-table th:nth-child(6) { width: 13%; }

.user-table input,
.user-table select {
    width: 100%;
    min-width: 0;
    min-height: 47px;
    box-sizing: border-box;
}

.user-name-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.user-status-cell {
    text-align: center;
    vertical-align: middle;
}

.user-status-cell input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin-top: 8px;
}

.user-action-cell .admin-btn {
    width: 100%;
    white-space: nowrap;
}


.user-action-buttons {
    display: grid;
    gap: 8px;
}

.danger-btn {
    background: #ef4444;
}

.danger-btn:hover {
    background: #dc2626;
}

.danger-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
.user-password-cell input {
    min-width: 0;
}
.object-type-form-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(190px, 240px) auto;
}

.object-management-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.object-management-grid button {
    min-height: 47px;
}

.object-card-list {
    display: grid;
    gap: 14px;
}

.object-type-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.object-type-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.object-type-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 8px 22px rgba(79,70,229,0.12);
}

.object-type-card h3 {
    margin: 0 0 12px;
    font-size: 17px;
}

.object-type-meta {
    display: grid;
    gap: 6px;
    color: #4b5563;
    font-size: 13px;
}

.object-type-admin-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 14px;
}

.object-type-admin-row input,
.object-type-admin-row select {
    margin-bottom: 0;
}

.object-type-admin-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.object-type-admin-actions button {
    width: auto;
    padding: 10px 14px;
}

.object-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
}

.object-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.object-card-header h3 {
    margin: 0;
    font-size: 16px;
}

.object-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px;
}

.object-card-field {
    display: grid;
    gap: 6px;
    color: #374151;
    font-size: 12px;
    font-weight: 700;
}

.object-card-field input {
    margin-bottom: 0;
}

.object-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.object-card-actions button {
    width: auto;
    padding: 10px 14px;
}

.object-empty-state {
    padding: 18px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    color: #6b7280;
    background: #f9fafb;
}

.object-detail {
    margin-top: 18px;
}

.object-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.object-detail-header h3 {
    margin: 0;
}

.object-detail-panel,
.object-history {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px;
    background: #ffffff;
    margin-top: 14px;
}

.object-detail-panel h3,
.object-history h3 {
    margin-top: 0;
}

.history-item {
    border-top: 1px solid #e5e7eb;
    padding: 12px 0;
}

.history-item:first-of-type {
    border-top: none;
}

.history-item span {
    display: block;
    color: #6b7280;
    font-size: 13px;
    margin-top: 4px;
}

.history-item p {
    margin: 8px 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill.is-sent {
    color: #065f46;
    background: #d1fae5;
}

.status-pill.is-failed {
    color: #991b1b;
    background: #fee2e2;
}

.priority-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    background: #eef2ff;
    color: #3730a3;
}

.mf-step {
    display: none;
}

.mf-step.active {
    display: block;
}

/* INPUTS */
input,
select,
textarea {
    width: 100%;
    padding: 14px;
    margin-bottom: 14px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

/* BUTTONS */
button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: var(--brand-primary);
    color: #fff;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    opacity: 0.92;
}

.prev {
    background: #e5e7eb;
    color: var(--brand-header);
    margin-bottom: 10px;
}

/* REQUIRED NOTE */
.required-note {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 20px;
}

.mf-result {
    display: none;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.45;
    border: 1px solid transparent;
}

#admin_notice {
    position: fixed;
    top: 32vh;
    left: 50%;
    z-index: 1000;
    width: auto;
    max-width: min(640px, calc(100vw - 32px));
    margin: 0;
    transform: translateX(-50%);
    overflow-wrap: anywhere;
    box-shadow: 0 14px 36px rgba(17,24,39,0.16);
}

.mf-result.is-success {
    display: block;
    color: #065f46;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.mf-result.is-warning {
    display: block;
    color: #92400e;
    background: #fffbeb;
    border-color: #fcd34d;
}

.mf-result.is-error {
    display: block;
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

/* DATENSCHUTZ */
.privacy-box {
    background: #f9fafb;
    border: 1px solid #dfe3ea;
    border-radius: 12px;
    padding: 18px;
    margin: 18px 0;
}

.privacy-header {
    margin-bottom: 14px;
}

.privacy-title {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    font-weight: bold;
    font-size: 16px;
    color: var(--brand-header);
    cursor: pointer;
}

.privacy-title input[type="checkbox"] {
    width: 18px !important;
    height: 18px;
    margin: 0;
    flex: 0 0 18px;
    cursor: pointer;
}

.privacy-title span {
    display: inline-block;
    line-height: 1.3;
}

.privacy-details {
    margin-top: 8px;
}

.privacy-details summary {
    cursor: pointer;
    font-size: 14px;
    color: var(--brand-primary);
    font-weight: 600;
    margin-bottom: 14px;
    line-height: 1.35;
}

.privacy-details summary:hover {
    text-decoration: underline;
}

.privacy-text {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.55;
    margin-top: 10px;
}

.privacy-hint {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.55;
    margin-top: 16px;
}

/* FOOTER */
.site-footer {
    background: var(--brand-header);
    color: #fff;
    padding: 40px 20px;
    margin-top: 0;
}

.site-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 40px;
}

.site-footer a {
    color: #fff;
    text-decoration: none;
}

/* MOBILE */
@media (max-width: 768px) {

    .site-header-inner {
        flex-direction: column;
        gap: 15px;
    }

    .site-logo img {
        height: 80px;
    }

    .site-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .page-wrapper {
        margin: 35px auto;
        padding: 0 16px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .site-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .mf-form {
        padding: 25px;
    }

    .admin-overview {
        padding: 20px;
    }

    .admin-overview-header,
    .admin-overview-controls {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .object-card-grid,
    .object-management-grid,
    .object-type-admin-row {
        grid-template-columns: 1fr;
    }

    .object-type-admin-actions {
        flex-direction: column;
    }

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

    .object-detail-header {
        flex-direction: column;
    }

    .object-card-actions {
        justify-content: stretch;
        flex-direction: column;
    }

    .object-card-actions button {
        width: 100%;
    }
}
/* FEHLER */
.mf-error {
    border-color: #ef4444 !important;
    background: #fff5f5 !important;
}

/* reservierter Platz für Fehlermeldung */
.mf-error-message {
    color: #ef4444;
    font-size: 13px;
    min-height: 16px;
    margin-top: -8px;
    margin-bottom: 12px;
    font-weight: 500;
    line-height: 1.2;
}

/* Layout stabil halten */
.mf-form input,
.mf-form select,
.mf-form textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
}

/* ADMIN LOGIN HEADER */
.admin-header-login {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-header-login input {
    width: 160px;
    padding: 10px 12px;
    margin: 0;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 14px;
}

.admin-header-login input::placeholder {
    color: rgba(255,255,255,0.7);
}

.admin-header-login input:focus {
    outline: none;
    border-color: #6366f1;
    background: rgba(255,255,255,0.12);
}

.admin-header-login #admin_user,
.admin-header-login #admin_pass,
.admin-header-login #admin_login {
    display: none !important;
}

.admin-btn {
    width: auto;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--brand-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.admin-btn:hover {
    opacity: 0.92;
}

.admin-btn.is-active {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55), 0 0 0 2px rgba(79, 70, 229, 0.25);
    filter: brightness(1.04);
}

.admin-btn.is-active:hover {
    opacity: 1;
}

.logout-btn {
    background: #ef4444;
}

/* MOBILE */
@media (max-width: 768px) {

    .admin-header-login {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .admin-header-login input,
    .admin-btn {
    width: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
}
.user-action-buttons {
    display: grid;
    gap: 8px;
    width: 100%;
}

.user-action-buttons .admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 38px;
    padding: 10px 16px;
    box-sizing: border-box;
}

.user-action-buttons .danger-btn,
.user-action-buttons .danger-btn:hover {
    background: #ef4444;
    color: #ffffff;
}

.user-action-buttons .danger-btn:hover {
    background: #dc2626;
}

.user-action-buttons .danger-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
/* Benutzerverwaltung: einheitliche Feldhoehen in der Tabelle */
.user-table td {
    vertical-align: middle;
}

.user-table input,
.user-table select {
    display: block;
    width: 100%;
    height: 54px;
    min-height: 54px;
    padding: 0 14px;
    line-height: 54px;
    box-sizing: border-box;
}

.user-table select {
    line-height: normal;
}

.user-name-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
}

.user-status-cell input[type="checkbox"] {
    display: inline-block;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    padding: 0;
    margin: 0;
    vertical-align: middle;
}
.login-page {
    min-height: 100vh;
    background: #f5f7fb;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.login-panel {
    width: min(440px, 100%);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.08);
    padding: 34px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 170px;
    min-height: 96px;
    margin-bottom: 20px;
    background: var(--brand-header);
    border-radius: 8px;
    padding: 12px;
}

.login-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.login-heading h1 {
    margin: 6px 0 8px;
    font-size: 30px;
}

.login-heading p:last-child {
    color: #4b5563;
    margin: 0 0 22px;
    line-height: 1.45;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-form input,
.login-form button {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
}

.sender-info {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
}

.sender-info strong {
    color: #0f172a;
    font-size: 16px;
}

.profile-panel {
    max-width: 760px;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.profile-form-grid input,
.profile-form-grid button {
    min-height: 48px;
    box-sizing: border-box;
}

.profile-form-grid #profile_email,
.profile-form-grid #profile_password,
.profile-form-grid #save_profile {
    grid-column: 1 / -1;
}

@media (max-width: 720px) {
    .profile-form-grid {
        grid-template-columns: 1fr;
    }
}


.brand-fallback {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    max-width: 220px;
    color: #ffffff;
    font-weight: 800;
    font-size: 18px;
    line-height: 1.1;
}

.settings-card {
    max-width: 1040px;
    margin: 0 auto 72px;
}

.settings-form h2 {
    margin: 28px 0 14px;
    font-size: 18px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.settings-grid input,
.settings-grid select,
.settings-form input,
.settings-form select {
    min-height: 46px;
}

.settings-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-weight: 700;
}

@media (max-width: 760px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}


.settings-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
    margin-bottom: 10px;
}

.settings-toggle-grid label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    font-weight: 700;
}

@media (max-width: 760px) {
    .settings-toggle-grid {
        grid-template-columns: 1fr;
    }
}


.form-builder {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 18px;
    align-items: start;
}

.form-builder-list,
.form-builder-editor {
    display: grid;
    gap: 10px;
}

.form-builder-editor textarea {
    min-height: 92px;
}

.form-builder-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
}

.form-builder-row span {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 13px;
}

.form-builder-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.secondary-btn {
    background: #64748b;
}

.custom-fields-container {
    display: grid;
    gap: 12px;
}

.custom-fields-title {
    margin: 8px 0 0;
    font-size: 18px;
}

.custom-field {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.custom-field span,
.custom-field small {
    color: #475569;
}

.custom-field-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-field-checkbox input {
    width: auto;
    min-height: auto;
}

@media (max-width: 900px) {
    .form-builder {
        grid-template-columns: 1fr;
    }
}

/* Betriebsmanagement modules */
[hidden] { display:none !important; }
.workflow-page { padding-bottom:72px; }
.workflow-tabs { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:18px; }
.workflow-tabs .is-active { background:var(--brand-primary); color:#fff; }
.workflow-panel[hidden] { display:none; }
.workflow-designer-layout { display:grid; grid-template-columns:minmax(240px,320px) minmax(0,1fr); gap:18px; align-items:start; }
.workflow-designer-card { min-width:0; }
.workflow-visual-workbench { display:grid; grid-template-columns:210px minmax(420px,1fr) minmax(320px,.75fr); gap:18px; align-items:start; margin-top:20px; }
.workflow-field-palette{position:sticky;top:18px;padding:16px;border:1px solid var(--border-color);border-radius:14px;background:var(--surface-soft)}
.workflow-field-palette h3,.workflow-live-preview h3{margin:3px 0 5px}.workflow-field-palette small{display:block;margin-bottom:14px;color:var(--muted-color)}
.workflow-palette-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.workflow-palette-grid button{min-height:72px;padding:9px;border:1px solid var(--border-color);border-radius:10px;background:#fff;color:var(--text-color);font-size:1.05rem;font-weight:800;cursor:pointer}.workflow-palette-grid button:hover{border-color:var(--primary-color);color:var(--primary-color);transform:translateY(-1px)}.workflow-palette-grid span{display:block;margin-top:5px;font-size:.7rem;font-weight:700}
.workflow-preview-special,.workflow-preview-privacy{display:grid;gap:6px;padding:12px;border:1px solid var(--border-color);border-radius:9px;background:var(--surface-soft)}.workflow-preview-special small{display:block}.workflow-preview-privacy label{display:flex;gap:8px;align-items:center}.workflow-preview-privacy p{font-size:.78rem;color:var(--muted-color)}
.workflow-step-builder,.workflow-preview-steps{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0 20px}
.workflow-step-item{display:grid;grid-template-columns:36px minmax(130px,1fr) 34px;gap:6px;padding:7px;border:1px solid var(--border-color);border-radius:10px;background:var(--surface-soft)}
.workflow-step-item.is-active{border-color:var(--primary-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--primary-color) 16%,transparent)}
.workflow-step-item [data-select]{border:0;border-radius:7px;background:var(--primary-color);color:#fff;font-weight:800;cursor:pointer}
.workflow-step-item input{min-width:0;border:0;background:transparent;font-weight:700}
.workflow-preview-steps span{padding:7px 10px;border:1px solid var(--border-color);border-radius:999px;font-size:.78rem;font-weight:700}
.workflow-preview-steps span.is-active{background:var(--primary-color);border-color:var(--primary-color);color:#fff}
.workflow-builder-column { min-width:0; }
.workflow-live-preview { position:sticky; top:24px; padding:18px; border:1px solid #cbd5e1; border-radius:12px; background:#eef2f7; }
.workflow-preview-form { display:grid; gap:14px; padding:22px; border-radius:10px; background:#fff; box-shadow:0 10px 30px rgba(15,23,42,.1); }
.workflow-preview-form h3,.workflow-preview-form p { margin:0; }
.workflow-preview-form p { color:#64748b; line-height:1.45; }
.workflow-preview-form label { display:grid; gap:6px; color:#334155; font-size:12px; font-weight:800; }
.workflow-preview-form input:not([type=checkbox]),.workflow-preview-form select,.workflow-preview-form textarea { width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:8px; box-sizing:border-box; background:#fff; }
.workflow-preview-form small { color:#64748b; font-weight:400; }
.workflow-advanced { margin-top:22px; border:1px solid #dbe3ee; border-radius:10px; background:#fff; }
.workflow-advanced > summary { padding:15px; color:#334155; font-weight:900; cursor:pointer; }
.workflow-advanced[open] { padding:0 15px 15px; }
.workflow-definition-list { display:grid; gap:8px; }
.workflow-definition-item { display:grid; gap:5px; width:100%; padding:12px; border:1px solid #dbe3ee; border-radius:9px; background:#fff; text-align:left; cursor:pointer; }
.workflow-definition-item small { color:#64748b; }
.workflow-definition-item.is-active { border-color:var(--brand-primary); background:#eef2ff; }
.workflow-builder-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:24px; padding-top:18px; border-top:1px solid #e2e8f0; }
.workflow-builder-row { display:grid; gap:10px; align-items:end; padding:14px; margin:10px 0; border:1px solid #e2e8f0; border-radius:10px; background:#f8fafc; }
.workflow-field-row { grid-template-columns:repeat(4,minmax(120px,1fr)); }
.workflow-field-row { position:relative; padding-top:46px; cursor:grab; }
.workflow-field-row.is-dragging { opacity:.45; border-color:var(--brand-primary); }
.workflow-order-controls { position:absolute; top:10px; left:12px; display:flex; align-items:center; gap:5px; }
.workflow-order-controls button { width:30px; height:28px; border:1px solid #cbd5e1; border-radius:6px; background:#fff; cursor:pointer; }
.workflow-drag { padding:4px 8px; color:#64748b; font-weight:900; cursor:grab; }
.workflow-status-row { grid-template-columns:1fr 1fr auto auto; }
.workflow-transition-row { grid-template-columns:1fr 1fr 1fr minmax(220px,1.5fr) auto; }
.workflow-builder-row label { display:grid; gap:5px; color:#475569; font-size:12px; font-weight:800; }
.workflow-builder-row input,.workflow-builder-row select,.workflow-builder-row textarea { width:100%; padding:9px; border:1px solid #cbd5e1; border-radius:7px; background:#fff; box-sizing:border-box; font:inherit; }
.workflow-builder-row .workflow-check { display:flex; flex-direction:row; align-items:center; }
.workflow-builder-row .workflow-check input { width:auto; }
.workflow-builder-row fieldset { display:flex; flex-wrap:wrap; gap:8px; min-width:0; padding:8px; border:1px solid #cbd5e1; border-radius:7px; }
.workflow-builder-row legend { color:#475569; font-size:11px; font-weight:800; }
.workflow-runtime-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:20px; padding-top:20px; border-top:1px solid #e2e8f0; }
.workflow-runtime-fields label { display:grid; gap:6px; color:#475569; font-size:12px; font-weight:800; }
.workflow-runtime-fields input:not([type=checkbox]),.workflow-runtime-fields select,.workflow-runtime-fields textarea { width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:8px; box-sizing:border-box; font:inherit; }
.workflow-runtime-fields small { color:#64748b; font-weight:400; }
.workflow-system-form-info { grid-column:1/-1; padding:18px; border:1px solid #bfdbfe; border-radius:10px; background:#eff6ff; color:#1e3a8a; }
.workflow-system-form-info p { margin:6px 0 0; color:#475569; line-height:1.5; }
.form-runtime-page{max-width:980px!important}.form-runtime-page .mf-form{max-width:820px;margin:0 auto}.form-page-field{display:grid;gap:7px;margin:0 0 16px;color:#334155;font-weight:800}.form-page-field input:not([type=checkbox]),.form-page-field select,.form-page-field textarea{width:100%;box-sizing:border-box;padding:12px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;font:inherit}.form-page-field small{color:#64748b;font-size:.78rem;font-weight:400}.form-page-actions{display:flex;justify-content:space-between;gap:12px;margin-top:22px}.form-page-actions button:last-child{margin-left:auto}
.form-runtime-page .hero{max-width:820px;margin-left:auto;margin-right:auto}.form-page-progress{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;margin-bottom:28px}.form-page-progress button{display:flex;align-items:center;gap:9px;padding:11px 13px;border:1px solid #dbe3ee;border-radius:10px;background:#f8fafc;color:#475569;text-align:left;cursor:pointer}.form-page-progress button span{display:grid;place-items:center;width:27px;height:27px;border-radius:50%;background:#e2e8f0;font-weight:900}.form-page-progress button strong{font-size:.82rem}.form-page-progress button.is-active{border-color:var(--brand-primary);background:#eef2ff;color:var(--brand-primary)}.form-page-progress button.is-active span{background:var(--brand-primary);color:#fff}.form-page-step{animation:formStepIn .16s ease}.form-page-step h2{margin:0 0 8px}.form-page-actions button{width:auto;min-width:125px;padding:12px 18px;border:0;border-radius:9px;background:var(--brand-primary);color:#fff;font-weight:800;cursor:pointer}.form-page-actions .prev{background:#e2e8f0;color:#334155}@keyframes formStepIn{from{opacity:.45;transform:translateY(4px)}to{opacity:1;transform:none}}@media(max-width:600px){.form-runtime-page .mf-form{padding:22px 16px}.form-page-progress{grid-template-columns:1fr}.form-page-actions{position:sticky;bottom:8px;padding:10px;background:rgba(255,255,255,.94);border-radius:10px}}
/* Full-width visual form builder */
.workflow-page{width:calc(100vw - var(--app-sidebar-width) - 32px);margin-left:calc(var(--app-sidebar-width) + 16px);margin-right:16px;padding-left:0;padding-right:0}
.workflow-designer-layout{grid-template-columns:1fr}.workflow-designer-layout>aside{padding:14px 18px}.workflow-definition-list{display:flex;gap:10px;overflow:auto}.workflow-definition-item{min-width:230px;width:auto}
.workflow-visual-workbench{grid-template-columns:220px minmax(0,1fr)}.workflow-builder-column,.workflow-live-preview{grid-column:2}.workflow-live-preview{position:static}
.workflow-preview-steps button{padding:9px 13px;border:1px solid #dbe3ee;border-radius:999px;background:#fff;font-size:.8rem;font-weight:800;cursor:pointer}.workflow-preview-steps button.is-active{background:var(--brand-primary);border-color:var(--brand-primary);color:#fff}
.workflow-canvas-field{position:relative;padding:18px 14px 14px;border:1px solid transparent;border-radius:10px}.workflow-canvas-field:hover{border-color:var(--brand-primary);background:#f8faff}.workflow-canvas-actions{position:absolute;z-index:2;right:8px;top:-12px;display:none;gap:4px}.workflow-canvas-field:hover .workflow-canvas-actions{display:flex}.workflow-canvas-actions button{width:29px;height:27px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#334155;font-weight:900;cursor:pointer}.workflow-canvas-actions button:hover{background:var(--brand-primary);border-color:var(--brand-primary);color:#fff}.workflow-preview-navigation{display:flex;justify-content:space-between;gap:10px;margin-top:8px}.workflow-preview-navigation .admin-btn:last-child{margin-left:auto}
.workflow-field-dialog{width:min(650px,calc(100vw - 32px));padding:0;border:0;border-radius:16px;box-shadow:0 24px 80px rgba(15,23,42,.35)}.workflow-field-dialog::backdrop{background:rgba(15,23,42,.58);backdrop-filter:blur(2px)}.workflow-field-dialog form{padding:22px}#workflow_field_dialog_body{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:18px 0}#workflow_field_dialog_body label{display:grid;gap:6px;font-size:.8rem;font-weight:800}#workflow_field_dialog_body input:not([type=checkbox]),#workflow_field_dialog_body select,#workflow_field_dialog_body textarea{width:100%;box-sizing:border-box;padding:10px;border:1px solid #cbd5e1;border-radius:8px}.dialog-icon-close{border:0;background:transparent;font-size:28px;cursor:pointer}
@media(max-width:900px){.workflow-page{width:calc(100vw - 24px);margin-left:12px;margin-right:12px}.workflow-visual-workbench{grid-template-columns:1fr}.workflow-field-palette{position:static}.workflow-builder-column,.workflow-live-preview{grid-column:auto}.workflow-palette-grid{grid-template-columns:repeat(4,1fr)}}@media(max-width:600px){.workflow-palette-grid{grid-template-columns:repeat(2,1fr)}#workflow_field_dialog_body{grid-template-columns:1fr}.workflow-preview-steps{display:grid}.workflow-preview-steps button{width:100%}}
@media (max-width:900px){.workflow-visual-workbench{grid-template-columns:1fr}.workflow-field-palette{position:static}.workflow-builder-column,.workflow-live-preview{grid-column:auto}}
@media (max-width:1100px){.workflow-designer-layout{grid-template-columns:1fr}.workflow-field-row,.workflow-transition-row{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:700px){.workflow-field-row,.workflow-status-row,.workflow-transition-row,.workflow-runtime-fields{grid-template-columns:1fr}}
.operations-page { padding-bottom: 72px; }
.operations-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-bottom:18px; }
.operations-stat { display:grid; gap:5px; padding:18px 20px; border:1px solid var(--app-border); border-radius:12px; background:#fff; box-shadow:0 10px 28px rgba(15,23,42,.05); }
.operations-stat strong { font-size:30px; color:var(--brand-primary); }
.operations-stat span { color:#52627a; font-weight:700; }
.operations-stat.is-warning { border-color:#f59e0b; background:#fffbeb; }
.operations-stat.is-warning strong { color:#b45309; }
.operations-toolbar { display:flex; align-items:end; gap:12px; margin-bottom:18px; padding:16px; border:1px solid var(--app-border); border-radius:12px; background:#fff; }
.operations-search { display:grid; flex:1; gap:6px; color:#475569; font-size:12px; font-weight:800; }
.operations-search input { width:100%; min-height:42px; padding:9px 12px; border:1px solid #cbd5e1; border-radius:8px; font:inherit; }
.operations-layout { display:grid; grid-template-columns:minmax(0,2fr) minmax(280px,1fr); gap:18px; align-items:start; }
.operations-card { min-width:0; padding:20px; border:1px solid var(--app-border); border-radius:12px; background:#fff; box-shadow:0 14px 34px rgba(15,23,42,.06); }
.operations-card-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
.operations-card-head h2 { margin:4px 0 0; }
.operations-table-wrap { overflow:auto; }
.operations-table { width:100%; border-collapse:collapse; }
.operations-table th,.operations-table td { padding:12px 10px; border-bottom:1px solid #e2e8f0; text-align:left; vertical-align:top; white-space:nowrap; }
.operations-table th { color:#64748b; font-size:11px; letter-spacing:.05em; text-transform:uppercase; }
.operations-primary { font-weight:800; color:#0f172a; }
.operations-alert { color:#b45309; font-weight:800; }
.table-action { border:0; background:transparent; color:var(--brand-primary); font:inherit; font-weight:800; cursor:pointer; }
.operations-history-item { display:grid; gap:5px; padding:12px 0; border-bottom:1px solid #e2e8f0; }
.operations-history-item span,.operations-history-item small { color:#64748b; }
.operations-dialog { width:min(760px,calc(100vw - 32px)); max-height:calc(100vh - 40px); padding:0; border:0; border-radius:14px; box-shadow:0 28px 80px rgba(15,23,42,.3); }
.operations-dialog::backdrop { background:rgba(15,23,42,.55); }
.operations-dialog form { padding:22px; }
.operations-dialog-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.operations-dialog-head h2 { margin:0; }
.operations-dialog-head button { border:0; background:transparent; font-size:28px; cursor:pointer; }
.operations-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.operations-form-grid[hidden] { display:none; }
.operations-form-grid label { display:grid; gap:6px; color:#475569; font-size:12px; font-weight:800; }
.operations-form-grid input,.operations-form-grid select,.operations-form-grid textarea { width:100%; padding:10px 11px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; color:#0f172a; font:inherit; box-sizing:border-box; }
.operations-span { grid-column:1/-1; }
.operations-dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
.operations-page > .mf-result { position:fixed; right:24px; bottom:24px; z-index:100; max-width:420px; }
@media (max-width:900px) {
    .operations-stats,.operations-layout,.operations-form-grid { grid-template-columns:1fr; }
    .operations-toolbar { align-items:stretch; flex-direction:column; }
    .operations-toolbar .admin-btn { width:100%; }
    .operations-span { grid-column:auto; }
}


.settings-page .hero-copy {
    margin-bottom: 24px;
}

.settings-card {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 72px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.settings-tab {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    font-weight: 700;
}

.settings-tab.is-active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}

.settings-form {
    padding: 24px;
}

.settings-section {
    display: none;
}

.settings-section.is-active {
    display: block;
}

.settings-section-head {
    margin-bottom: 20px;
    max-width: 760px;
}

.settings-section-head h2 {
    margin: 4px 0 8px;
    font-size: 26px;
}

.settings-section-head p:last-child {
    color: #64748b;
    margin: 0;
    line-height: 1.45;
}

.settings-form h3 {
    margin: 26px 0 12px;
    font-size: 18px;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 22px;
    margin-top: 24px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 760px) {
    .settings-card {
        width: min(100% - 20px, 1120px);
    }

    .settings-tabs {
        justify-content: stretch;
    }

    .settings-tab {
        flex: 1 1 160px;
    }

    .settings-form {
        padding: 18px;
    }
}


.settings-grid {
    align-items: start;
}

.settings-field,
.settings-field-label {
    display: grid;
    gap: 7px;
    color: #1f2937;
    font-size: 13px;
    font-weight: 700;
}

.settings-field input,
.settings-field select,
.settings-field textarea,
.settings-field-label input,
.settings-field-label select,
.settings-field-label textarea {
    width: 100%;
    margin: 0;
    font-weight: 400;
}

.settings-check,
.settings-toggle {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
}

.settings-check input,
.settings-toggle input {
    width: auto;
    margin: 0;
}

.standard-fields-builder {
    display: grid;
    gap: 12px;
}

.standard-field-card {
    display: grid;
    grid-template-columns: minmax(160px, 0.75fr) minmax(220px, 1.1fr) minmax(230px, 0.95fr) auto;
    gap: 14px;
    align-items: end;
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

.standard-field-card-title {
    display: grid;
    gap: 4px;
    align-self: center;
}

.standard-field-card-title strong {
    color: #0f172a;
    font-size: 15px;
}

.standard-field-card-title span {
    color: #64748b;
    font-size: 13px;
}

.standard-field-controls,
.standard-field-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.standard-field-actions {
    justify-content: flex-end;
}

.settings-preview {
    padding: 22px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.settings-form-preview-card {
    max-width: 650px;
    margin: 0 auto;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

.settings-preview-hero {
    margin-bottom: 24px;
    text-align: center;
}

.settings-preview-hero h2 {
    margin: 5px 0 8px;
    font-size: 28px;
}

.settings-preview-hero p:last-child {
    margin: 0;
    color: #475569;
}

.settings-preview-section {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.settings-preview-section h3 {
    margin: 0 0 4px;
}

.preview-field {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.preview-field input,
.preview-field select,
.preview-field textarea {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #64748b;
}

.preview-field textarea {
    min-height: 92px;
    padding-top: 12px;
}

.preview-checkbox {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.preview-checkbox span {
    order: 2;
}

.preview-checkbox input {
    order: 1;
    width: 18px;
    min-height: 18px;
    padding: 0;
}

.settings-preview-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

.settings-preview-actions button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: var(--brand-primary);
    color: #ffffff;
    font-weight: 800;
    opacity: 0.82;
}

@media (max-width: 980px) {
    .standard-field-card {
        grid-template-columns: 1fr;
    }

    .standard-field-actions {
        justify-content: flex-start;
    }
}


.settings-workbench {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto 72px;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.settings-sidebar {
    position: sticky;
    top: 18px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.settings-menu-head {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #0f172a;
}

.settings-burger {
    width: 22px;
    display: grid;
    gap: 4px;
}

.settings-burger span {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: var(--brand-primary);
}

.settings-workbench .settings-card {
    width: 100%;
    margin: 0;
}

.settings-workbench .settings-tabs {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-bottom: 0;
    background: #ffffff;
}

.settings-workbench .settings-tab {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 0 14px;
}

.settings-workbench .settings-tab.is-active {
    box-shadow: 0 10px 18px rgba(79, 70, 229, 0.18);
}

.settings-content {
    min-width: 0;
}

@media (max-width: 980px) {
    .settings-workbench {
        width: min(100% - 20px, 1120px);
        grid-template-columns: 1fr;
    }

    .settings-sidebar {
        position: static;
    }

    .settings-workbench .settings-tabs {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }
}


/* Settings page refinements */
.site-header .admin-bar {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-page .hero-copy {
    width: min(1280px, calc(100% - 32px));
    margin: 46px auto 24px;
    text-align: left;
}

.settings-workbench {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 26px;
}

.settings-sidebar {
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.settings-menu-head {
    min-height: 54px;
    padding: 0 16px;
    background: #ffffff;
}

.settings-workbench .settings-tabs {
    padding: 10px;
    gap: 4px;
}

.settings-workbench .settings-tab {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #334155;
    font-size: 14px;
    font-weight: 800;
    justify-content: flex-start;
    padding: 0 12px;
    box-shadow: none;
}

.settings-workbench .settings-tab:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.settings-workbench .settings-tab.is-active {
    background: var(--brand-primary);
    color: #ffffff;
    box-shadow: none;
}

.settings-content {
    justify-self: center;
    max-width: 1040px;
}

@media (max-width: 768px) {
    .site-header .admin-bar {
        margin-left: 0;
        justify-content: center;
    }

    .settings-page .hero-copy {
        width: min(100% - 20px, 1120px);
        margin-top: 28px;
    }
}


/* Wide form designer */
.settings-workbench {
    width: min(1760px, calc(100% - 32px));
    grid-template-columns: 230px minmax(0, 1fr);
}

.settings-content {
    max-width: none;
    justify-self: stretch;
}

.settings-section[data-settings-section="form"].is-active {
    min-width: 0;
}

.form-designer-layout {
    display: grid;
    grid-template-columns: minmax(420px, 0.95fr) minmax(520px, 1.05fr);
    gap: 26px;
    align-items: start;
}

.form-designer-controls {
    min-width: 0;
}

.form-designer-preview {
    position: sticky;
    top: 18px;
    min-width: 0;
}

.form-designer-preview-head {
    margin-bottom: 12px;
    padding: 16px 18px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}

.form-designer-preview-head h3 {
    margin: 4px 0 6px;
}

.form-designer-preview-head p:last-child {
    margin: 0;
    color: #64748b;
}

.form-designer-preview .settings-preview {
    padding: 26px;
}

.form-designer-preview .settings-form-preview-card {
    max-width: 760px;
}

.preview-editable {
    display: inline-block;
    min-width: 36px;
    border-radius: 6px;
    outline: 2px solid transparent;
    outline-offset: 2px;
    cursor: text;
    transition: background 0.15s ease, outline-color 0.15s ease;
}

.preview-editable:hover {
    background: #eef2ff;
    outline-color: #c7d2fe;
}

.preview-editable:focus {
    background: #ffffff;
    outline-color: var(--brand-primary);
}

.preview-field-caption {
    width: fit-content;
}

.preview-section-title {
    width: fit-content;
}

.preview-intro-text {
    max-width: 100%;
}

.is-editable-preview {
    position: relative;
}

.is-editable-preview::after {
    content: "Bearbeiten";
    position: absolute;
    right: 10px;
    top: 9px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--brand-primary);
    font-size: 11px;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.is-editable-preview:hover::after {
    opacity: 1;
}

@media (max-width: 1280px) {
    .form-designer-layout {
        grid-template-columns: 1fr;
    }

    .form-designer-preview {
        position: static;
    }
}


/* True form designer mode */
.settings-section[data-settings-section="form"] .form-designer-layout {
    grid-template-columns: minmax(0, 1fr);
}

.settings-section[data-settings-section="form"] .form-designer-controls {
    display: none;
}

.settings-section[data-settings-section="form"] .form-designer-preview {
    position: static;
    width: 100%;
}

.settings-section[data-settings-section="form"] .form-designer-preview .settings-preview {
    min-height: 720px;
}

.settings-section[data-settings-section="form"] .form-designer-preview .settings-form-preview-card {
    max-width: 820px;
}

.designer-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #dbe3ee;
}

.designer-tool {
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.designer-tool:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.designer-tool.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.designer-add-field {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.55fr) auto;
    gap: 10px;
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.designer-add-field input,
.designer-add-field select {
    min-height: 42px;
    margin: 0;
}

@media (max-width: 760px) {
    .designer-add-field {
        grid-template-columns: 1fr;
    }
}


/* Step-based form designer */
.designer-step-nav {
    max-width: 820px;
    margin: 0 auto 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.designer-step-nav button {
    min-height: 40px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    font-weight: 800;
}

.designer-step-nav button.is-active {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: #ffffff;
}

.form-designer-preview .settings-form-preview-card {
    max-width: 650px;
}

.form-designer-preview .mf-step.active {
    display: grid;
    gap: 12px;
}

.form-designer-preview .preview-field {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 7px 10px;
}

.form-designer-preview .preview-field-caption,
.form-designer-preview .preview-field input,
.form-designer-preview .preview-field select,
.form-designer-preview .preview-field textarea {
    grid-column: 1;
}

.form-designer-preview .designer-toolbar {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
    min-width: 108px;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.form-designer-preview .designer-tool {
    min-height: 28px;
    padding: 0 7px;
    font-size: 11px;
}

.form-designer-preview .is-editable-preview::after {
    display: none;
}

.designer-step-actions {
    margin-top: 18px;
}

.designer-privacy-box {
    margin-top: 4px;
}

@media (max-width: 760px) {
    .designer-step-nav {
        grid-template-columns: 1fr;
    }

    .form-designer-preview .preview-field {
        grid-template-columns: 1fr;
    }

    .form-designer-preview .designer-toolbar {
        grid-column: 1;
        grid-row: auto;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        min-width: 0;
    }
}


.designer-step-tab {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
}

.designer-step-tab > button:first-child,
.designer-step-add {
    min-height: 40px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    font-weight: 800;
}

.designer-step-tab.is-active > button:first-child {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: #ffffff;
}

.designer-step-remove {
    width: 38px;
    min-height: 40px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fff5f5;
    color: #dc2626;
    cursor: pointer;
    font-weight: 900;
}

.designer-step-remove:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.designer-step-add {
    border-style: dashed;
    color: var(--brand-primary);
}


.preview-field.is-required .preview-field-caption::after,
.designer-privacy-box.is-required .privacy-title span::after {
    content: "";
}

.designer-tool.is-active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.designer-add-field input,
.designer-add-field select {
    min-height: 44px;
}


.system-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 16px 0 24px;
}

.system-status-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    display: grid;
    gap: 6px;
}

.system-status-card strong {
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
}

.system-status-card span {
    color: #111827;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.settings-help {
    color: #64748b;
    margin: 6px 0 14px;
}


.inline-actions {
    justify-content: flex-start;
    gap: 10px;
}

.system-status-card span {
    overflow-wrap: anywhere;
}


.license-feature-notice {
    border: 1px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 12px 0 18px;
    font-weight: 700;
}

.settings-tab.is-license-locked,
.settings-section.is-license-locked {
    opacity: 0.68;
}

.settings-tab.is-license-locked {
    cursor: not-allowed;
}


.license-activation-panel,
.license-help-panel {
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

.license-activation-panel textarea,
.license-help-panel textarea {
    min-height: 96px;
    resize: vertical;
}

.license-usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 18px 0 22px;
}
.license-action-row {
    border-top: 0;
    margin-top: -2px;
    padding-top: 0;
}
.settings-form.is-customizer-mode {
    display: grid;
    gap: 22px;
}

.settings-form.is-customizer-mode .customization-section {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    padding: 22px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.settings-form.is-customizer-mode .customization-section:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12), 0 14px 34px rgba(15, 23, 42, 0.08);
}

.settings-form.is-customizer-mode .customization-section .settings-section-head {
    margin-bottom: 18px;
}
.guided-customizer-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.guided-customizer-tab {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    align-items: center;
    min-height: 76px;
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #ffffff;
    color: #1f2937;
    text-align: left;
    cursor: pointer;
}

.guided-customizer-tab span {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #eef2ff;
    color: var(--brand-primary);
    font-weight: 800;
}

.guided-customizer-tab strong {
    font-size: 14px;
}

.guided-customizer-tab small {
    color: #64748b;
    line-height: 1.35;
}

.guided-customizer-tab.is-active {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.settings-form.is-customizer-mode {
    grid-template-columns: 1fr;
    align-items: start;
}

.settings-form.is-customizer-mode .guided-customizer-nav {
    grid-column: 1;
}

.settings-form.is-customizer-mode .customization-section {
    display: none;
    grid-column: 1;
    width: 100%;
}

.settings-form.is-customizer-mode .customization-section.is-guided-active {
    display: block;
}
@media (max-width: 760px) {
    .guided-customizer-nav {
        grid-template-columns: 1fr;
    }
}
/* Guided customizer refinement */
.settings-page .settings-card {
    width: min(1480px, calc(100% - 40px));
}

.settings-form.is-customizer-mode {
    gap: 18px;
}

.settings-form.is-customizer-mode .guided-customizer-nav {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 6px 0 14px;
    background: #ffffff;
}

.settings-form.is-customizer-mode .guided-customizer-tab {
    min-height: 64px;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.settings-form.is-customizer-mode .guided-customizer-tab:hover {
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

.settings-form.is-customizer-mode .customization-section {
    padding: 28px;
    border-radius: 8px;
    box-shadow: none;
}

.settings-form.is-customizer-mode .settings-section-head {
    max-width: 980px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e5e7eb;
}

.settings-form.is-customizer-mode .settings-section-head h2 {
    font-size: 24px;
}

.settings-form.is-customizer-mode .settings-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.settings-form.is-customizer-mode h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 30px 0 14px;
    padding-top: 18px;
    border-top: 1px solid #eef2f7;
    color: #111827;
}

.settings-form.is-customizer-mode h3::before {
    content: "";
    width: 8px;
    height: 22px;
    border-radius: 999px;
    background: var(--brand-primary);
}

.customizer-field {
    gap: 8px;
}

.customizer-field > span {
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
}

.customizer-field input,
.customizer-field textarea,
.customizer-field select {
    background: #ffffff;
}

.settings-field-help {
    display: block;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

.settings-form.is-customizer-mode textarea {
    min-height: 104px;
}

@media (max-width: 900px) {
    .settings-page .settings-card {
        width: min(100% - 20px, 1480px);
    }

    .settings-form.is-customizer-mode .settings-grid {
        grid-template-columns: 1fr;
    }
}
/* Prevent customizer field clipping */
.settings-form.is-customizer-mode .settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-form.is-customizer-mode .settings-grid > *,
.settings-form.is-customizer-mode .customizer-field,
.settings-form.is-customizer-mode .settings-field {
    min-width: 0;
}

.settings-form.is-customizer-mode input,
.settings-form.is-customizer-mode select,
.settings-form.is-customizer-mode textarea {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

.settings-form.is-customizer-mode .customization-section {
    overflow: visible;
}

.settings-form.is-customizer-mode textarea {
    overflow: auto;
}

@media (max-width: 1280px) {
    .settings-form.is-customizer-mode .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .settings-form.is-customizer-mode .settings-grid {
        grid-template-columns: 1fr;
    }
}
/* Guided customizer readable width */
.settings-form.is-customizer-mode {
    max-width: 1240px;
    margin: 0 auto;
}

.settings-form.is-customizer-mode .guided-customizer-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-form.is-customizer-mode .customization-section {
    padding: 28px 32px;
}

.settings-form.is-customizer-mode .settings-section-head {
    max-width: 860px;
}

.settings-form.is-customizer-mode .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
    row-gap: 18px;
}

.settings-form.is-customizer-mode .customizer-field textarea {
    min-height: 140px;
}


@media (max-width: 980px) {
    .settings-form.is-customizer-mode .guided-customizer-nav,
    .settings-form.is-customizer-mode .settings-grid {
        grid-template-columns: 1fr;
    }
}
/* Guided navigation is only visible inside Individualisierung */
.guided-customizer-nav {
    display: none;
}

.settings-form.is-customizer-mode .guided-customizer-nav {
    display: grid;
}
/* Section subnavigation for settings pages */
.guided-section-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin: 0 0 22px;
    padding: 6px 0 14px;
    border-bottom: 1px solid #eef2f7;
}

.guided-section-nav .settings-subtab {
    min-height: 64px;
    border-radius: 8px;
}

.settings-section:not(.is-active) .guided-section-nav {
    display: none;
}

.settings-subpanel-hidden {
    display: none !important;
}

.settings-section[data-settings-section="form"] .form-designer-layout {
    display: block;
}

.settings-section[data-settings-section="form"] .form-designer-controls {
    display: block;
}

.settings-section[data-settings-section="form"] .form-designer-preview.settings-subpanel-hidden {
    display: none !important;
}

.settings-section[data-settings-section="form"] .form-designer-preview:not(.settings-subpanel-hidden) {
    display: block;
    max-width: 860px;
}

@media (max-width: 760px) {
    .guided-section-nav {
        grid-template-columns: 1fr;
    }
}
/* Subnavigation without numbering */
.guided-customizer-tab,
.guided-customizer-tab.settings-subtab {
    grid-template-columns: 1fr;
    gap: 4px;
}

.guided-customizer-tab span {
    display: none;
}
/* Unified settings subsection layout */
.settings-form.is-section-subnav-mode {
    display: grid;
    gap: 18px;
    max-width: 1240px;
    margin: 0 auto;
}

.settings-form.is-section-subnav-mode > .settings-section.is-active {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    padding: 28px 32px;
}

.settings-form.is-section-subnav-mode .guided-section-nav {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    margin: 0 0 22px;
    padding: 6px 0 14px;
}

.settings-form.is-section-subnav-mode .settings-section-head {
    max-width: 860px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e5e7eb;
}

.settings-form.is-section-subnav-mode .settings-section-head h2 {
    font-size: 24px;
}

.settings-form.is-section-subnav-mode .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
    row-gap: 18px;
    margin-bottom: 22px;
}

.settings-form.is-section-subnav-mode .settings-grid > *,
.settings-form.is-section-subnav-mode .settings-field,
.settings-form.is-section-subnav-mode .customizer-field {
    min-width: 0;
}

.settings-form.is-section-subnav-mode input,
.settings-form.is-section-subnav-mode select,
.settings-form.is-section-subnav-mode textarea {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

.settings-form.is-section-subnav-mode h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 30px 0 14px;
    padding-top: 18px;
    border-top: 1px solid #eef2f7;
    color: #111827;
}

.settings-form.is-section-subnav-mode h3::before {
    content: "";
    width: 8px;
    height: 22px;
    border-radius: 999px;
    background: var(--brand-primary);
}

.guided-section-nav .settings-subtab,
.guided-customizer-tab {
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.guided-section-nav .settings-subtab:hover,
.guided-customizer-tab:hover {
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

@media (max-width: 980px) {
    .settings-form.is-section-subnav-mode .guided-section-nav,
    .settings-form.is-section-subnav-mode .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-form.is-section-subnav-mode > .settings-section.is-active {
        padding: 22px;
    }
}
/* Customizer page heading above subnavigation */
.customizer-main-head {
    display: none;
}

.settings-form.is-customizer-mode .customizer-main-head {
    display: block;
    max-width: 860px;
    padding-bottom: 18px;
    margin-bottom: 0;
    border-bottom: 1px solid #e5e7eb;
}

.settings-form.is-customizer-mode .guided-customizer-nav {
    padding-top: 0;
}
/* Align all settings subnavs with Individualisierung */
.settings-form.is-section-subnav-mode .guided-section-nav {
    margin: 0 0 22px;
    padding: 0 0 14px;
    border-bottom: 1px solid #eef2f7;
}

.settings-form.is-section-subnav-mode .guided-section-nav .settings-subtab {
    min-height: 64px;
    border-radius: 8px;
    padding: 14px;
}

.settings-form.is-section-subnav-mode .settings-section-head {
    margin-bottom: 18px;
}
/* Match section pages to Individualisierung layout */
.settings-form.is-section-subnav-mode > .settings-section.is-active {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.settings-form.is-section-subnav-mode .settings-subpanel-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    padding: 28px 32px;
    margin-top: 10px;
}

.settings-form.is-section-subnav-mode .settings-subpanel-card h3:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.settings-form.is-section-subnav-mode .settings-subpanel-card.settings-grid {
    display: grid;
}

.settings-form.is-section-subnav-mode .form-designer-preview {
    margin: 0;
}

@media (max-width: 980px) {
    .settings-form.is-section-subnav-mode .settings-subpanel-card {
        padding: 22px;
    }
}
/* Step based standard field editor */
.standard-step-group {
    display: grid;
    gap: 12px;
    margin-bottom: 22px;
}

.standard-step-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.standard-step-title strong {
    font-size: 16px;
}

.standard-step-title span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}



.standard-options-editor {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    padding-top: 4px;
}

.standard-options-toggle {
    justify-self: start;
}

.standard-options-panel {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}
.standard-options-panel[hidden] {
    display: none;
}

.standard-options-list {
    display: grid;
    gap: 8px;
}

.standard-option-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.standard-option-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.icon-action-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2a44;
    font-weight: 900;
    cursor: pointer;
}

.icon-action-btn:hover:not(:disabled) {
    border-color: #4f46e5;
    color: #4f46e5;
}

.icon-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.icon-action-btn.danger {
    border-color: #fecaca;
    background: #fff5f5;
    color: #ef4444;
}

.standard-option-add {
    justify-self: start;
}

@media (max-width: 720px) {
    .standard-option-row {
        grid-template-columns: 1fr;
    }

    .standard-option-actions {
        justify-content: flex-start;
    }
}
.settings-utility-panel {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 16px;
    margin: 18px 0;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

.settings-utility-panel h3 {
    margin: 0 0 6px;
}

.settings-utility-panel p {
    margin: 0;
    color: #64748b;
    line-height: 1.45;
}

.settings-utility-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.settings-file-action {
    cursor: pointer;
}

.settings-area-select {
    min-width: 220px;
}

@media (max-width: 900px) {
    .settings-utility-panel {
        grid-template-columns: 1fr;
    }

    .settings-utility-actions {
        justify-content: flex-start;
    }
}
/* Unified form designer */
.settings-form.is-section-subnav-mode .settings-subpanel-card.form-designer-unified {
    display: grid;
    grid-template-columns: minmax(420px, 0.95fr) minmax(460px, 1.05fr);
    gap: 24px 30px;
    align-items: start;
}

.settings-form.is-section-subnav-mode .form-designer-unified > :not(.form-designer-preview) {
    grid-column: 1;
}

.settings-form.is-section-subnav-mode .form-designer-unified > .form-designer-preview {
    grid-column: 2;
    grid-row: 1 / span 12;
    position: sticky;
    top: 18px;
}

.settings-form.is-section-subnav-mode .form-designer-unified > h3:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.settings-form.is-section-subnav-mode .form-designer-unified .settings-grid {
    grid-template-columns: 1fr;
}

.settings-form.is-section-subnav-mode .form-designer-unified .standard-field-card {
    grid-template-columns: 1fr;
    align-items: stretch;
}

.settings-form.is-section-subnav-mode .form-designer-unified .standard-field-actions {
    justify-content: flex-start;
}

.settings-form.is-section-subnav-mode .settings-subpanel-card[data-subpanel="form-backup"] {
    max-width: 920px;
}

@media (max-width: 1180px) {
    .settings-form.is-section-subnav-mode .settings-subpanel-card.form-designer-unified {
        grid-template-columns: 1fr;
    }

    .settings-form.is-section-subnav-mode .form-designer-unified > .form-designer-preview {
        grid-column: 1;
        grid-row: auto;
        position: static;
    }
}
/* In-form field editor */
.form-designer-preview .preview-field {
    grid-template-columns: minmax(0, 1fr);
}

.form-designer-preview .designer-field-editor {
    grid-column: 1;
    margin-top: 4px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

.form-designer-preview .designer-field-editor summary {
    min-height: 34px;
    padding: 8px 11px;
    color: var(--brand-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
}

.designer-field-editor-body {
    display: grid;
    gap: 12px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
}

.designer-field-toggle-row,
.designer-field-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.designer-field-options {
    display: grid;
    gap: 8px;
}

.designer-inline-options {
    display: grid;
    gap: 8px;
}

.designer-field-actions .designer-tool {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.form-designer-preview .designer-toolbar {
    display: none;
}
.preview-button-caption {
    display: inline-block;
    min-width: 28px;
    color: inherit;
}

.preview-button-caption:focus {
    outline-color: #ffffff;
}
.designer-source-hidden {
    display: none !important;
}

.settings-form.is-section-subnav-mode .settings-subpanel-card.form-designer-unified {
    display: block;
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

.settings-form.is-section-subnav-mode .form-designer-unified > .form-designer-preview {
    position: static;
    width: 100%;
}

.settings-form.is-section-subnav-mode .form-designer-unified .settings-preview {
    padding: 28px;
}
/* Compact right-side field actions */
.form-designer-preview .preview-field {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 12px;
}

.form-designer-preview .preview-field-caption,
.form-designer-preview .preview-field input,
.form-designer-preview .preview-field select,
.form-designer-preview .preview-field textarea,
.form-designer-preview .sender-info strong,
.form-designer-preview .privacy-header,
.form-designer-preview .privacy-details,
.form-designer-preview .privacy-hint {
    grid-column: 1;
}

.designer-field-quick-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    align-self: end;
    min-width: 108px;
}

.designer-field-quick-actions .designer-tool,
.designer-quick-btn {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
}

.designer-field-quick-actions .designer-tool:hover,
.designer-quick-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.designer-quick-btn.primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}

.form-designer-preview .designer-field-editor {
    grid-column: 1 / -1;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.form-designer-preview .designer-field-editor[hidden] {
    display: none;
}

.designer-field-editor-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.designer-field-editor-head strong {
    color: #111827;
    font-size: 15px;
}

.designer-field-editor-head span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.designer-field-editor-body {
    padding: 14px;
}

.designer-editor-main-label input {
    min-height: 42px;
}

@media (max-width: 760px) {
    .form-designer-preview .preview-field {
        grid-template-columns: 1fr;
    }

    .designer-field-quick-actions {
        grid-column: 1;
        grid-row: auto;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        min-width: 0;
    }
}
.designer-field-source {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

@media (max-width: 760px) {
    .designer-field-source {
        grid-template-columns: 1fr;
    }
}

/* Sidebar application layout */
:root {
    --app-sidebar-width: 250px;
    --app-surface: #f6f7fb;
    --app-border: #dde3ee;
    --app-nav-active: #4f46e5;
}

body {
    display: block;
    min-height: 100vh;
    background: var(--app-surface);
    color: #0f172a;
}

.site-header {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: var(--app-sidebar-width);
    padding: 22px 16px;
    background: #1d2433;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    overflow-y: auto;
}

.site-header-inner {
    max-width: none;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
}

.site-logo {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 54px;
    color: #ffffff;
    text-decoration: none;
    padding: 8px 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.site-logo::before {
    content: "SK";
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand-primary), #ff7a1a);
    color: #ffffff;
    font-weight: 800;
    font-size: 13px;
}

.site-logo:has(img)::before {
    display: none;
}

.site-logo img {
    grid-column: 1 / -1;
    max-width: 172px;
    width: auto;
    height: auto;
    max-height: 76px;
    object-fit: contain;
}

.brand-fallback {
    display: block;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.2;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-logo .brand-fallback::after {
    content: "Portal";
    display: block;
    margin-top: 3px;
    color: #9aa6b8;
    font-size: 12px;
    font-weight: 500;
}

.site-nav,
.admin-header-login,
.admin-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 0;
}

.site-nav {
    padding: 4px 0 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-nav-label,
.admin-header-login::before,
.admin-bar::before {
    display: block;
    margin: 6px 8px 8px;
    color: #8ea0bc;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-header-login::before,
.admin-bar::before {
    content: "Verwaltung";
}

.site-nav a,
.admin-bar .admin-btn,
.admin-header-login .admin-btn {
    min-height: 40px;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 0;
    box-sizing: border-box;
    background: transparent;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.site-nav a:hover,
.admin-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.admin-header-login .admin-btn::before,
.admin-bar .admin-btn::before,
.site-nav a::before {
    width: 18px;
    flex: 0 0 18px;
    text-align: center;
    opacity: 0.95;
}


.admin-btn.is-active,
.site-nav a.is-active {
    background: var(--app-nav-active) !important;
    color: #ffffff;
    box-shadow: none;
    filter: none;
}

.logout-btn {
    margin-top: 10px;
    background: rgba(239, 68, 68, 0.14) !important;
    color: #fecaca;
}

.logout-btn:hover {
    background: #ef4444 !important;
    color: #ffffff;
}

.admin-header-login input,
.admin-header-login #admin_user,
.admin-header-login #admin_pass,
.admin-header-login #admin_login {
    display: none !important;
}

.page-wrapper {
    width: auto;
    max-width: 1220px;
    min-height: calc(100vh - 72px);
    margin: 0 0 0 var(--app-sidebar-width);
    padding: 34px 32px 64px;
    box-sizing: border-box;
}

.hero {
    max-width: none;
    margin: 0 0 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--app-border);
    text-align: left;
}

.hero h1 {
    margin: 8px 0 8px;
    font-size: 28px;
    line-height: 1.15;
}

.hero p:not(.eyebrow) {
    max-width: 760px;
    margin: 0;
    color: #52627a;
}

.eyebrow {
    color: var(--brand-primary);
    letter-spacing: 0.04em;
}

.mf-form,
.admin-overview,
.users-card,
.object-card,
.profile-card,
.settings-shell,
.settings-page-card,
.settings-panel,
.license-panel,
.system-panel,
.mail-panel {
    border-radius: 12px !important;
    border: 1px solid var(--app-border) !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06) !important;
}

.mf-form {
    max-width: 780px;
    margin: 0;
}

.admin-overview,
.users-card,
.object-card,
.profile-card,
.settings-shell {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.site-footer {
    margin-left: var(--app-sidebar-width);
    background: transparent;
    color: #64748b;
    border-top: 1px solid var(--app-border);
    padding: 18px 32px;
}

.site-footer-inner {
    max-width: 1220px;
    margin: 0;
    color: inherit;
}

.site-footer a {
    color: #475569;
}

@media (max-width: 900px) {
    :root { --app-sidebar-width: 100%; }

    .site-header {
        position: static;
        width: auto;
        min-height: auto;
        padding: 14px;
    }

    .site-header-inner {
        height: auto;
    }

    .site-logo {
        grid-template-columns: 42px minmax(0, 1fr);
        padding-bottom: 14px;
    }

    .site-nav,
    .admin-header-login,
    .admin-bar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
    }

    .site-nav-label,
    .admin-header-login::before,
    .admin-bar::before {
        grid-column: 1 / -1;
    }

    .page-wrapper,
    .site-footer {
        margin-left: 0;
    }

    .page-wrapper {
        padding: 26px 16px 42px;
    }
}


/* Login and setup inside sidebar application layout */
.login-page .login-shell {
    min-height: 100vh;
    margin-left: var(--app-sidebar-width);
    display: grid;
    place-items: start center;
    padding: 72px 32px 64px;
    box-sizing: border-box;
}

.login-page .login-panel {
    width: min(460px, 100%);
    margin: 0;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.login-page .setup-panel {
    width: min(560px, 100%);
}

.login-page .login-logo {
    display: none;
}

.auth-sidebar-nav {
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-sidebar-nav::before {
    content: "Zugang";
}

.auth-sidebar-nav .admin-btn {
    pointer-events: none;
}

@media (max-width: 900px) {
    .login-page .login-shell {
        margin-left: 0;
        min-height: auto;
        padding: 32px 16px 44px;
    }
}


/* Keep login screen as centered standalone panel */
body.login-page:not(.setup-page) {
    display: block;
    min-height: 100vh;
    background: #f5f7fb;
}

body.login-page:not(.setup-page) .login-shell {
    min-height: 100vh;
    margin-left: 0;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    box-sizing: border-box;
}

body.login-page:not(.setup-page) .login-panel {
    width: min(440px, 100%);
    margin: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.08);
    padding: 34px;
}

body.login-page:not(.setup-page) .login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 170px;
    min-height: 96px;
    margin-bottom: 20px;
    background: var(--brand-header);
    border-radius: 8px;
    padding: 12px;
    box-sizing: border-box;
}

body.login-page:not(.setup-page) .login-logo::before {
    display: none;
}

body.login-page:not(.setup-page) .login-logo img {
    width: 100%;
    height: auto;
    max-height: 76px;
    display: block;
    object-fit: contain;
}

body.login-page:not(.setup-page) .login-logo .brand-fallback::after {
    content: none;
}

body.login-page:not(.setup-page) .login-form .admin-btn {
    justify-content: center;
    text-align: center;
}

body.login-page:not(.setup-page) .login-form .admin-btn::before {
    content: none;
}


/* Final sidebar consistency pass */
.site-header .admin-bar,
.site-header .admin-header-login {
    margin-left: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: nowrap;
}

.site-header .admin-bar .admin-btn,
.site-header .admin-header-login .admin-btn {
    width: 100% !important;
    min-height: 40px;
    justify-content: flex-start;
    text-align: left;
}

.site-nav a:hover,
.site-header .admin-bar .admin-btn:hover,
.site-header .admin-header-login .admin-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.site-header .admin-bar .admin-btn.is-active,
.site-header .admin-header-login .admin-btn.is-active,
.site-nav a.is-active {
    background: var(--app-nav-active) !important;
    color: #ffffff;
}

.site-nav a::before { content: "L"; }
#admin_form::before { content: "F"; }
#admin_meldungen::before { content: "M"; }
#admin_objects::before { content: "O"; }
#admin_users::before { content: "B"; }
#admin_profile::before { content: "P"; }
#admin_settings::before { content: "E"; }
#admin_logout::before { content: "X"; }

.settings-page .hero-copy {
    width: auto;
    margin: 0 0 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--app-border);
    text-align: left;
}

.settings-page .hero-copy h1 {
    margin: 8px 0 8px;
    font-size: 28px;
    line-height: 1.15;
}

.settings-page .hero-copy p:not(.eyebrow) {
    max-width: 760px;
    margin: 0;
    color: #52627a;
}

.settings-page .settings-workbench {
    width: 100%;
    margin: 0;
}

@media (max-width: 900px) {
    .site-header .admin-bar,
    .site-header .admin-header-login {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
    }

    .site-header .admin-bar::before,
    .site-header .admin-header-login::before {
        grid-column: 1 / -1;
    }

    .settings-page .hero-copy {
        width: auto;
        margin: 0 0 24px;
    }
}


/* Keep page action buttons visually separate from sidebar navigation */
.page-wrapper .admin-btn:hover {
    background: var(--brand-primary);
    opacity: 0.92;
}

.page-wrapper .danger-btn:hover,
.page-wrapper .user-action-buttons .danger-btn:hover {
    background: #dc2626;
    color: #ffffff;
}

.page-wrapper .admin-btn.is-active:not([id^="admin_"]) {
    box-shadow: none;
    filter: none;
}


/* Sidebar user welcome */
.sidebar-user {
    display: grid;
    gap: 3px;
    padding: 10px 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    color: #ffffff;
}

.sidebar-user[hidden] {
    display: none !important;
}

.sidebar-user-kicker {
    color: #8ea0bc;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-user strong {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.25;
    font-weight: 800;
    overflow-wrap: anywhere;
}


/* Sidebar divider cleanup */
.time-clock {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 1fr)) auto auto;
    align-items: end;
    gap: 18px;
    margin-bottom: 24px;
}
.time-section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.time-section-card { position: relative; display: grid; gap: 6px; min-height: 118px; padding: 18px; text-align: left; color: #182033; background: #fff; border: 1px solid #dfe3eb; border-radius: 14px; cursor: pointer; box-shadow: 0 10px 24px rgba(23, 31, 56, .06); }
.time-section-card strong { font-size: 18px; }
.time-section-card small { color: #667085; line-height: 1.4; }
.time-section-card.is-active { border-color: var(--brand-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 16%, transparent); }
.time-notification-badge { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 7px; color: #fff; background: #dc2626; border: 2px solid #fff; border-radius: 999px; box-shadow: 0 3px 9px rgba(185, 28, 28, .35); font-size: 12px; font-weight: 800; line-height: 1; }
.time-notification-badge[hidden] { display: none; }

.time-clock h2 { margin: 4px 0 6px; }
.time-clock label, .time-toolbar label { display: grid; gap: 7px; font-weight: 700; }
.time-clock-button { min-height: 46px; white-space: nowrap; }
.time-clock-button.is-running { background: #b42318; border-color: #b42318; }
.time-pause-button { min-height: 46px; white-space: nowrap; }
.time-pause-button.is-running { color: #b54708; border-color: #fdb022; background: #fffaeb; }
.time-app-link { display: none; width: fit-content; margin-top: 14px; }
.time-toolbar { grid-template-columns: minmax(180px, 240px) minmax(220px, 320px) auto; justify-content: start; }
.time-report { margin-top: 24px; }
.time-schedule { margin-top: 24px; }
.time-workdays { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 14px; border: 1px solid #dfe3eb; border-radius: 10px; }
.time-workdays legend { padding: 0 6px; font-weight: 800; }
.time-workdays label { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.time-entry-locked { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #667085; background: #f2f4f7; font-size: 12px; font-weight: 800; }
.time-request-panel { margin: 18px 0 24px; padding: 16px; border: 1px solid #dfe3eb; border-radius: 12px; background: #f9fafb; }
.time-correction-tabs { display: flex; gap: 10px; margin-top: 18px; }
.time-request-panel h3 { margin: 0 0 12px; }
.time-request-item { display: grid; grid-template-columns: minmax(180px,1fr) minmax(220px,2fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid #e4e7ec; }
.time-request-item:first-child { border-top: 0; }
.time-request-item small { display: block; color: #667085; margin-top: 3px; }
.time-correction-hint { position: relative; display: inline-flex; vertical-align: middle; }
.time-correction-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; color: #fff; background: #d97706; border: 0; border-radius: 999px; font: 800 13px/1 Georgia,serif; cursor: help; }
.time-correction-tooltip { position: absolute; z-index: 20; right: 0; bottom: calc(100% + 9px); display: none; width: min(360px,calc(100vw - 48px)); padding: 12px 14px; color: #7c2d12; background: #fff7ed; border: 1px solid #fdba74; border-radius: 10px; box-shadow: 0 12px 30px rgba(15,23,42,.18); font-size: 12px; font-weight: 500; line-height: 1.45; text-align: left; white-space: normal; }
.time-correction-tooltip strong,.time-correction-tooltip span,.time-edit-history span { display: block; }
.time-correction-tooltip strong { margin-bottom: 5px; color: #9a3412; }
.time-correction-hint:hover .time-correction-tooltip,.time-correction-hint:focus-within .time-correction-tooltip { display: block; }
.time-edit-history { display: grid; gap: 4px; margin-bottom: 16px; padding: 12px 14px; color: #7c2d12; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; font-size: 12px; line-height: 1.45; }
.time-edit-history[hidden] { display: none; }
.time-edit-history strong { margin-bottom: 3px; color: #9a3412; }
.time-request-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) { .time-request-item { grid-template-columns: 1fr; } }
.time-report-filters { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)) repeat(3, auto); gap: 14px; align-items: end; margin: 18px 0 24px; }
.time-report-filters label { display: grid; gap: 7px; font-weight: 700; }
.time-report tfoot td { padding: 12px; background: #eef0ff; font-weight: 800; }

@media (max-width: 1100px) {
    .time-clock { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .time-clock > div, .time-clock-button { grid-column: 1 / -1; }
    .time-report-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .time-section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .time-clock, .time-toolbar, .time-report-filters { grid-template-columns: 1fr; }
    .time-section-grid { grid-template-columns: 1fr; }
    .time-clock > div, .time-clock-button { grid-column: auto; }
}

@media (max-width: 680px) and (pointer: coarse) {
    .time-app-link { display: inline-flex; }
}

.site-logo {
    border-bottom: 0 !important;
    padding-bottom: 8px;
}

.site-nav:empty {
    display: none !important;
}

.site-nav {
    border-bottom: 0 !important;
    padding-bottom: 0;
}

.sidebar-user {
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 8px;
    padding-bottom: 14px;
}


/* Dashboard page */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.dashboard-card {
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 20px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    text-decoration: none;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.dashboard-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
}

.dashboard-card-primary {
    background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
}

.dashboard-card-kicker {
    color: var(--brand-primary);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-card strong {
    font-size: 20px;
}

.dashboard-card small,
.dashboard-panel p {
    color: #52627a;
    line-height: 1.45;
}

.dashboard-panel {
    padding: 24px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.dashboard-panel h2 {
    margin: 8px 0;
}

#admin_dashboard::before { content: "D"; }

/* Settings dashboard navigation */
.settings-dashboard-grid.settings-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    justify-content: initial;
    padding: 0;
    margin: 0 0 22px;
    border: 0;
    background: transparent;
}

.settings-dashboard-grid .dashboard-card {
    appearance: none;
    width: 100%;
    min-height: 132px;
    padding: 20px;
    text-align: left;
    font: inherit;
}

.settings-dashboard-grid .settings-tab {
    color: #0f172a;
}

.settings-dashboard-grid .settings-tab.is-active {
    background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
    border-color: var(--brand-primary);
    color: #0f172a;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
}

.settings-dashboard-grid .settings-tab.is-active .dashboard-card-kicker {
    color: var(--brand-primary);
}

.settings-dashboard-grid .settings-tab:disabled,
.settings-dashboard-grid .settings-tab.is-license-locked {
    cursor: not-allowed;
    opacity: 0.55;
}

.settings-dashboard-content.settings-card {
    width: 100%;
    margin-bottom: 72px;
}

/* Centered application content */
:root {
    --app-content-max: 1580px;
    --app-content-gutter: 32px;
}

.page-wrapper {
    width: min(var(--app-content-max), calc(100vw - var(--app-sidebar-width) - (var(--app-content-gutter) * 2)));
    max-width: none;
    margin-left: calc(var(--app-sidebar-width) + max(var(--app-content-gutter), ((100vw - var(--app-sidebar-width) - var(--app-content-max)) / 2)));
    margin-right: max(var(--app-content-gutter), ((100vw - var(--app-sidebar-width) - var(--app-content-max)) / 2));
}

.hero,
.settings-page .hero-copy {
    width: 100%;
}

.mf-form,
.admin-overview,
.users-card,
.object-card,
.profile-card,
.dashboard-grid,
.dashboard-panel,
.settings-dashboard-grid,
.settings-dashboard-content.settings-card {
    margin-left: auto !important;
    margin-right: auto !important;
}

.mf-form,
.profile-card,
.profile-panel {
    max-width: 780px;
}

.users-card {
    max-width: 1040px;
}

.object-card,
.admin-overview,
.settings-dashboard-content.settings-card {
    width: fit-content;
    min-width: min(100%, 780px);
    max-width: 100%;
}

.dashboard-grid,
.dashboard-panel,
.settings-dashboard-grid {
    width: 100%;
    max-width: 100%;
}

.site-footer-inner {
    max-width: var(--app-content-max);
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 900px) {
    :root {
        --app-content-gutter: 16px;
    }

    .page-wrapper {
        width: auto;
        margin-left: 0;
        margin-right: 0;
    }
}

/* Module driven navigation */
.admin-header-login .admin-btn[data-module-hidden="1"],
.admin-bar .admin-btn[data-module-hidden="1"],
.admin-header-login input[data-module-hidden="1"] {
    display: none !important;
}

.admin-header-login .admin-btn[data-module-icon]::before,
.admin-bar .admin-btn[data-module-icon]::before {
    content: attr(data-module-icon) !important;
}

.profile-start-page-field {
    grid-column: 1 / -1;
}

.profile-start-page-field select {
    width: 100%;
}

.user-access-row[hidden] {
    display: none !important;
}

.user-access-row > td {
    padding: 0 10px 18px;
    background: #f8fafc;
}

.user-access-panel {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 18px;
    display: grid;
    gap: 16px;
}

.user-access-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-access-title span,
.user-access-card small {
    color: #64748b;
    font-size: 13px;
}

.user-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.user-access-card {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 14px;
    display: grid;
    gap: 10px;
    background: #f8fafc;
}

.user-access-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.user-access-card select {
    width: 100%;
    min-height: 40px;
    border: 1px solid #d7deea;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
}

.module-group-admin {
    margin: 28px 0;
    padding: 24px;
    border: 1px solid var(--border-color, #dde4ef);
    border-radius: 8px;
    background: #fff;
}

.compact-header {
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #dde4ef);
}

.compact-header p:not(.eyebrow) {
    margin: 6px 0 0;
    color: var(--muted-text, #64748b);
}

.module-group-builder {
    display: grid;
    gap: 18px;
}

.module-group-card {
    border: 1px solid var(--border-color, #dde4ef);
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.module-group-card-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color, #dde4ef);
}

.module-group-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.module-group-card-header p:not(.eyebrow) {
    margin: 6px 0 0;
    color: var(--muted-text, #64748b);
}

.module-group-list {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.module-group-row {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-color, #dde4ef);
    border-radius: 8px;
    background: #fff;
}

.module-group-row.is-new {
    border-style: dashed;
    background: #fbfdff;
}

.module-group-row-head {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.module-group-row-head input {
    width: 100%;
}

.module-group-row-head small {
    color: var(--muted-text, #64748b);
    white-space: nowrap;
}

.module-permission-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

.module-permission-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--border-color, #dde4ef);
    border-radius: 8px;
    background: #f8fafc;
}

.module-permission-option input {
    margin-top: 3px;
}

.module-permission-option strong,
.module-permission-option small {
    display: block;
}

.module-permission-option small {
    margin-top: 3px;
    color: var(--muted-text, #64748b);
    line-height: 1.35;
}

.module-group-actions {
    justify-content: flex-end;
}

@media (max-width: 760px) {
    .module-group-row-head {
        grid-template-columns: 1fr;
    }

    .module-group-row-head small {
        white-space: normal;
    }

    .module-group-actions {
        justify-content: stretch;
    }

    .module-group-actions .admin-btn {
        width: 100%;
    }
}

.rights-module-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.rights-module-tab {
    appearance: none;
    border: 1px solid var(--border-color, #dde4ef);
    background: #fff;
    color: var(--text-color, #0f172a);
    border-radius: 8px;
    padding: 11px 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: none;
}

.rights-module-tab:hover,
.rights-module-tab.is-active {
    border-color: var(--primary-color, #4f46e5);
    color: var(--primary-color, #4f46e5);
    background: #f5f7ff;
}

.rights-matrix-card {
    border: 1px solid var(--border-color, #dde4ef);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.rights-matrix-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border-color, #dde4ef);
    background: #fff;
}

.rights-matrix-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.rights-matrix-header p:not(.eyebrow) {
    margin: 6px 0 0;
    color: var(--muted-text, #64748b);
}

.rights-matrix-wrap {
    overflow: visible;
    max-width: 100%;
}

.rights-matrix-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
}

.rights-matrix-table th,
.rights-matrix-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color, #dde4ef);
    vertical-align: middle;
}

.rights-matrix-table th {
    background: #f8fafc;
    color: var(--muted-text, #64748b);
    font-size: .78rem;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: .03em;
    white-space: nowrap;
}

.rights-matrix-table th:first-child,
.rights-matrix-table td:first-child {
    width: 32%;
    text-align: left;
}

.rights-matrix-table th:last-child,
.rights-matrix-table td:last-child {
    width: 170px;
    text-align: right;
}

.rights-group-name-cell input {
    width: 100%;
    min-height: 44px;
}

.rights-group-name-cell small {
    display: block;
    margin-top: 6px;
    color: var(--muted-text, #64748b);
    font-size: .78rem;
}

.rights-permission-cell {
    text-align: center;
}

.rights-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 28px;
    cursor: pointer;
}

.rights-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rights-toggle span {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #d9e2ef;
    transition: background .18s ease;
}

.rights-toggle span::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .22);
    transition: transform .18s ease;
}

.rights-toggle input:checked + span {
    background: var(--primary-color, #4f46e5);
}

.rights-toggle input:checked + span::after {
    transform: translateX(18px);
}

.rights-row-actions {
    display: inline-flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.rights-row-actions .admin-btn {
    min-height: 38px;
    padding: 0 13px;
    white-space: nowrap;
}

.rights-matrix-new-row td {
    background: #fbfdff;
}

@media (max-width: 760px) {
    .rights-module-tab {
        flex: 1 1 160px;
    }

    .rights-matrix-table {
        min-width: 760px;
    }
}

.rights-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.rights-subnav {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--app-border, #dbe3ef);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.rights-subnav-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 12px;
    border-bottom: 1px solid var(--app-border, #dbe3ef);
    margin-bottom: 6px;
}

.rights-subnav-icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--brand-primary, #4f46e5);
    color: #fff;
    font-weight: 900;
}

.rights-subnav-item {
    appearance: none;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-color, #0f172a);
    display: grid;
    gap: 3px;
    padding: 13px 14px;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.rights-subnav-item:hover,
.rights-subnav-item.is-active {
    background: var(--brand-primary, #4f46e5);
    color: #fff;
}

.rights-subnav-item strong {
    font-size: .95rem;
}

.rights-subnav-item small {
    color: #64748b;
    line-height: 1.35;
}

.rights-subnav-item:hover small,
.rights-subnav-item.is-active small {
    color: rgba(255, 255, 255, .78);
}

.rights-content {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.rights-content .rights-matrix-card {
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

@media (max-width: 980px) {
    .rights-layout {
        grid-template-columns: 1fr;
    }

    .rights-subnav {
        position: static;
    }
}

.user-management-page .admin-overview {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.user-management-page .module-group-admin {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
}

.user-management-page .rights-layout {
    grid-template-columns: 280px minmax(0, 1fr);
    min-width: 0;
}

.user-management-page .rights-matrix-table {
    min-width: 0;
}

@media (min-width: 1500px) {
    :root {
        --app-content-gutter: 40px;
    }

    .user-management-page .rights-layout {
        grid-template-columns: 300px minmax(0, 1fr);
    }
}

@media (max-width: 980px) {
    .user-management-page .rights-layout {
        grid-template-columns: 1fr;
    }
}


/* Rechte-Matrix ohne innere Scrollflaeche */
.rights-matrix-table th,
.rights-matrix-table td {
    overflow-wrap: anywhere;
}

.rights-matrix-table th:not(:first-child):not(:last-child),
.rights-matrix-table td:not(:first-child):not(:last-child) {
    width: auto;
}

@media (max-width: 760px) {
    .rights-matrix-card {
        overflow: visible;
    }

    .rights-matrix-table,
    .rights-matrix-table thead,
    .rights-matrix-table tbody,
    .rights-matrix-table tr,
    .rights-matrix-table th,
    .rights-matrix-table td {
        display: block;
        width: 100% !important;
    }

    .rights-matrix-table thead {
        display: none;
    }

    .rights-matrix-table tr {
        padding: 14px;
        border-bottom: 1px solid var(--border-color, #dde4ef);
    }

    .rights-matrix-table td {
        padding: 9px 0;
        border-bottom: 0;
        text-align: left !important;
    }

    .rights-permission-cell {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
    }

    .rights-permission-cell::before {
        content: attr(data-permission-label);
        color: var(--muted-text, #64748b);
        font-weight: 800;
        font-size: .82rem;
    }

    .rights-row-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .rights-row-actions .admin-btn {
        width: 100%;
    }
}
