html,
body {
    margin: 0;
    min-height: 100%;
    background: #f8fafc;
}

body.sanwd-app-template {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #111827;
}

html.brk-theme-dark,
html.brk-theme-dark body,
body.brk-theme-dark {
    background: #0f141d;
    color: #e5e7eb;
}

#sanwd-app-main {
    flex: 1 0 auto;
    width: 100%;
}

.sanwd-app-system {
    position: fixed;
    top: 12px;
    left: 50%;
    z-index: 10050;
    width: min(920px, calc(100vw - 24px));
    transform: translateX(-50%);
    pointer-events: none;
}

.sanwd-app-system > * {
    pointer-events: auto;
}

.sanwd-app-system:empty {
    display: none;
}

.sanwd-login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 18px;
    box-sizing: border-box;
    background-color: #111827;
    background-image: var(--sanwd-login-bg, linear-gradient(135deg, #111827 0%, #0b1018 58%, #151b25 100%));
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.sanwd-login-card {
    width: min(420px, calc(100vw - 36px));
    box-sizing: border-box;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .36);
    color: #111827;
}

.sanwd-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.sanwd-login-mark {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #e60005;
    color: #fff;
    font-weight: 900;
    font-size: 1.15rem;
    box-shadow: 0 10px 24px rgba(230, 0, 5, .22);
}

.sanwd-login-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    flex: 0 0 auto;
    border-radius: 12px;
}

.sanwd-login-brand strong {
    display: block;
    font-size: 1.08rem;
    line-height: 1.1;
}

.sanwd-login-brand span {
    display: block;
    margin-top: 3px;
    color: #6b7280;
    font-size: .9rem;
    font-weight: 600;
}

.sanwd-login-card h1 {
    margin: 0 0 6px;
    font-size: 1.55rem;
    line-height: 1.12;
}

.sanwd-login-card p {
    margin: 0 0 22px;
    color: #6b7280;
    line-height: 1.45;
}

.sanwd-login-card label {
    display: block;
    margin: 15px 0 7px;
    font-size: .82rem;
    font-weight: 800;
    color: #4b5563;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.sanwd-login-card input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: #111827;
    font: inherit;
    padding: 13px 14px;
    outline: none;
    transition: border-color .14s ease, box-shadow .14s ease;
}

.sanwd-login-card input:focus {
    border-color: #e60005;
    box-shadow: 0 0 0 4px rgba(230, 0, 5, .11);
}

.sanwd-login-card button {
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: #e60005;
    color: #fff;
    font: inherit;
    font-weight: 800;
    padding: 13px 16px;
    cursor: pointer;
    margin-top: 18px;
    box-shadow: 0 12px 24px rgba(230, 0, 5, .2);
}

.sanwd-login-card button:hover {
    background: #cc0004;
}

.sanwd-login-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 22px;
    font-size: .86rem;
}

.sanwd-login-links a {
    color: rgba(255,255,255,.78);
    text-decoration: none;
    font-weight: 700;
}

.sanwd-login-links a:hover,
.sanwd-login-links a:focus {
    color: #fff;
    text-decoration: underline;
}

.sanwd-legal-shell {
    min-height: 100vh;
    padding: 18px clamp(14px, 2vw, 32px) 72px;
    box-sizing: border-box;
    background: #f8fafc;
    color: #111827;
}

.sanwd-legal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: min(1120px, 100%);
    margin: 0 auto 18px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .08);
}

.sanwd-legal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sanwd-legal-mark {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: #e60005;
    color: #fff;
    font-weight: 900;
    font-size: .86rem;
}

.sanwd-legal-brand strong {
    display: block;
    font-size: 1.1rem;
    line-height: 1.15;
}

.sanwd-legal-brand span {
    display: block;
    margin-top: 2px;
    color: #6b7280;
    font-size: .86rem;
    font-weight: 700;
}

.sanwd-legal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.sanwd-legal-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: #374151;
    font-weight: 800;
    text-decoration: none;
}

.sanwd-legal-actions a:hover,
.sanwd-legal-actions a:focus {
    border-color: #e60005;
    color: #e60005;
}

.sanwd-legal-actions .sanwd-legal-primary {
    border-color: #e60005;
    background: #e60005;
    color: #fff;
}

.sanwd-legal-actions .sanwd-legal-primary:hover,
.sanwd-legal-actions .sanwd-legal-primary:focus {
    background: #cc0004;
    color: #fff;
}

.sanwd-legal-main {
    width: min(920px, 100%);
    margin: 0 auto;
    padding: clamp(20px, 3vw, 40px);
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .08);
    line-height: 1.62;
}

.sanwd-legal-main :is(h1, h2, h3) {
    line-height: 1.18;
}

.sanwd-legal-main img,
.sanwd-legal-main table {
    max-width: 100%;
}

html.brk-theme-dark .sanwd-legal-shell,
body.brk-theme-dark .sanwd-legal-shell {
    background: #0f141d;
    color: #e5e7eb;
}

html.brk-theme-dark .sanwd-legal-head,
html.brk-theme-dark .sanwd-legal-main,
body.brk-theme-dark .sanwd-legal-head,
body.brk-theme-dark .sanwd-legal-main {
    border-color: #334155;
    background: #111827;
    color: #e5e7eb;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .24);
}

html.brk-theme-dark .sanwd-legal-brand span,
body.brk-theme-dark .sanwd-legal-brand span {
    color: #9ca3af;
}

html.brk-theme-dark .sanwd-legal-actions a,
body.brk-theme-dark .sanwd-legal-actions a {
    border-color: #334155;
    background: #0f172a;
    color: #e5e7eb;
}

/* Footer im normalen Dokumentfluss – optisch an die obere Navigation angelehnt. */
.sanwd-footer {
    position: static;
    flex: 0 0 auto;
    width: 100%;
    box-sizing: border-box;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    box-shadow: 0 -1px 3px rgba(15, 23, 42, .04);
}

.sanwd-footer-inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    min-height: 46px;
    padding: 0 16px;
    box-sizing: border-box;
}

.sanwd-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
    padding: 0 11px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #4b5563;
    font-size: .83rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: color .14s ease, background-color .14s ease;
}

.sanwd-footer a:hover,
.sanwd-footer a:focus-visible {
    background: #f3f4f6;
    color: #dc2626;
    outline: none;
}

html.brk-theme-dark .sanwd-footer,
body.brk-theme-dark .sanwd-footer {
    border-top-color: #273244;
    background: #111827;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, .2);
}

html.brk-theme-dark .sanwd-footer a,
body.brk-theme-dark .sanwd-footer a {
    color: #cbd5e1;
}

html.brk-theme-dark .sanwd-footer a:hover,
html.brk-theme-dark .sanwd-footer a:focus-visible,
body.brk-theme-dark .sanwd-footer a:hover,
body.brk-theme-dark .sanwd-footer a:focus-visible {
    background: #1f2937;
    color: #fff;
}

@media (max-width: 700px) {
    .sanwd-legal-head {
        align-items: stretch;
        flex-direction: column;
    }

    .sanwd-legal-actions {
        justify-content: stretch;
    }

    .sanwd-legal-actions a {
        flex: 1 1 auto;
    }

    .sanwd-footer-inner {
        padding: 0 8px;
    }
}

/* ================================================================
   Joomla-Menüs im originalen SanWD-App-Look – Template v1.3.0
   ================================================================ */
.sanwd-app-navbar {
    position: relative;
    z-index: 1000;
    width: 100%;
    flex: 0 0 auto;
    background: #fff;
    border-bottom: 1px solid #dfe3e8;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.sanwd-app-navbar-inner {
    min-height: 40px;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px;
    box-sizing: border-box;
}

.sanwd-mainmenu {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
}

.sanwd-mainmenu > .moduletable,
.sanwd-mainmenu > div,
.sanwd-mainmenu nav {
    min-width: 0;
    width: 100%;
}

.sanwd-mainmenu ul,
.sanwd-sidebar ul,
.sanwd-footer-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sanwd-mainmenu > div > ul,
.sanwd-mainmenu > .moduletable > ul,
.sanwd-mainmenu nav > ul,
.sanwd-mainmenu > ul {
    min-height: 40px;
    display: flex;
    align-items: stretch;
    gap: 0;
    white-space: nowrap;
}

.sanwd-mainmenu li {
    position: relative;
    display: flex;
    align-items: stretch;
}

.sanwd-mainmenu li > a,
.sanwd-mainmenu li > span,
.sanwd-mainmenu li > .separator {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
    padding: 0 11px;
    border-bottom: 2px solid transparent;
    color: #667085;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    transition: color .12s ease, border-color .12s ease, background-color .12s ease;
}

.sanwd-mainmenu li > a:hover,
.sanwd-mainmenu li > a:focus-visible,
.sanwd-mainmenu li.active > a,
.sanwd-mainmenu li.current > a,
.sanwd-mainmenu li.active > span,
.sanwd-mainmenu li.current > span {
    color: #e30613;
    border-bottom-color: #e30613;
}

.sanwd-mainmenu li.parent > a::after,
.sanwd-mainmenu li.deeper > a::after {
    content: "⌄";
    margin-left: 2px;
    font-size: 11px;
    color: currentColor;
}

.sanwd-mainmenu li ul {
    display: none;
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    z-index: 1010;
    min-width: 205px;
    padding: 5px;
    border: 1px solid #dfe3e8;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
}

.sanwd-mainmenu li:hover > ul,
.sanwd-mainmenu li:focus-within > ul {
    display: block;
}

.sanwd-mainmenu li ul li {
    display: block;
}

.sanwd-mainmenu li ul a,
.sanwd-mainmenu li ul span {
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 2px;
}

.sanwd-mainmenu li ul a:hover,
.sanwd-mainmenu li ul a:focus-visible,
.sanwd-mainmenu li ul .active > a,
.sanwd-mainmenu li ul .current > a {
    border: 0;
    background: #f6f7f9;
    color: #e30613;
}

.sanwd-navbar-user {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    color: #667085;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 650;
}

.sanwd-theme-toggle,
.sanwd-logout-link {
    appearance: none;
    border: 0;
    background: transparent;
    color: #667085;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    padding: 0 3px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.sanwd-theme-toggle:hover,
.sanwd-theme-toggle:focus-visible,
.sanwd-logout-link:hover,
.sanwd-logout-link:focus-visible {
    color: #e30613;
    outline: none;
}

.sanwd-theme-icon {
    font-size: 16px;
    line-height: 1;
    transform: rotate(-25deg);
}

.sanwd-user-avatar {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #e9edf2;
    color: #596579;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.sanwd-user-name {
    color: #596579;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sanwd-logout-form {
    margin: 0;
    padding: 0;
    display: flex;
}

.sanwd-logout-icon {
    font-size: 15px;
    line-height: 1;
}

.sanwd-app-layout {
    flex: 1 0 auto;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.sanwd-app-layout #sanwd-app-main {
    min-width: 0;
    flex: 1 1 auto;
}

.sanwd-sidebar {
    flex: 0 0 235px;
    width: 235px;
    box-sizing: border-box;
    border-right: 1px solid #dfe3e8;
    background: #fff;
    padding: 12px 8px;
}

.sanwd-sidebar .moduletable,
.sanwd-sidebar nav {
    margin: 0;
}

.sanwd-sidebar li + li {
    margin-top: 2px;
}

.sanwd-sidebar a,
.sanwd-sidebar .separator,
.sanwd-sidebar span {
    display: flex;
    align-items: center;
    min-height: 36px;
    box-sizing: border-box;
    padding: 0 10px;
    border-radius: 2px;
    color: #667085;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.sanwd-sidebar a:hover,
.sanwd-sidebar a:focus-visible {
    background: #f6f7f9;
    color: #111827;
}

.sanwd-sidebar .active > a,
.sanwd-sidebar .current > a {
    background: #fff5f5;
    color: #e30613;
}

.sanwd-sidebar li ul {
    margin: 2px 0 5px 12px;
    padding-left: 8px;
    border-left: 1px solid #e5e7eb;
}

.sanwd-footer {
    border-top: 1px solid #dfe3e8;
    background: #fff;
}

.sanwd-footer-inner {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 24px;
    box-sizing: border-box;
}

.sanwd-footer-menu > div > ul,
.sanwd-footer-menu > .moduletable > ul,
.sanwd-footer-menu nav > ul,
.sanwd-footer-menu > ul,
.sanwd-footer-legal {
    display: flex;
    align-items: center;
    gap: 24px;
}

.sanwd-footer-menu a,
.sanwd-footer-legal a {
    color: #596579;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}

.sanwd-footer-menu a:hover,
.sanwd-footer-legal a:hover {
    color: #e30613;
}

html.brk-theme-dark .sanwd-app-navbar,
html.brk-theme-dark .sanwd-sidebar,
html.brk-theme-dark .sanwd-footer {
    background: #151b25;
    border-color: #293241;
}

html.brk-theme-dark .sanwd-mainmenu li > a,
html.brk-theme-dark .sanwd-mainmenu li > span,
html.brk-theme-dark .sanwd-navbar-user,
html.brk-theme-dark .sanwd-theme-toggle,
html.brk-theme-dark .sanwd-logout-link,
html.brk-theme-dark .sanwd-user-name,
html.brk-theme-dark .sanwd-sidebar a,
html.brk-theme-dark .sanwd-sidebar span,
html.brk-theme-dark .sanwd-footer-menu a,
html.brk-theme-dark .sanwd-footer-legal a {
    color: #b7c0ce;
}

html.brk-theme-dark .sanwd-mainmenu li.active > a,
html.brk-theme-dark .sanwd-mainmenu li.current > a,
html.brk-theme-dark .sanwd-mainmenu li > a:hover,
html.brk-theme-dark .sanwd-theme-toggle:hover,
html.brk-theme-dark .sanwd-logout-link:hover,
html.brk-theme-dark .sanwd-sidebar .active > a,
html.brk-theme-dark .sanwd-sidebar .current > a {
    color: #ff4b55;
}

html.brk-theme-dark .sanwd-mainmenu li ul {
    background: #151b25;
    border-color: #293241;
}

html.brk-theme-dark .sanwd-mainmenu li ul a:hover,
html.brk-theme-dark .sanwd-sidebar a:hover {
    background: #1c2430;
}

html.brk-theme-dark .sanwd-user-avatar {
    background: #2a3442;
    color: #d6dce5;
}

@media (max-width: 920px) {
    .sanwd-app-navbar-inner {
        flex-wrap: wrap;
        padding: 0 8px;
    }

    .sanwd-mainmenu {
        order: 2;
        flex: 1 0 100%;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .sanwd-navbar-user {
        order: 1;
        margin-left: auto;
    }

    .sanwd-user-name,
    .sanwd-theme-label,
    .sanwd-logout-link > span:last-child {
        display: none;
    }
}

@media (max-width: 700px) {
    .sanwd-sidebar {
        flex-basis: 190px;
        width: 190px;
    }
}

@media (max-width: 560px) {
    .sanwd-app-layout.has-sidebar {
        display: block;
    }

    .sanwd-sidebar {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid #dfe3e8;
        padding: 6px 8px;
    }

    .sanwd-sidebar > div > ul,
    .sanwd-sidebar > .moduletable > ul,
    .sanwd-sidebar nav > ul,
    .sanwd-sidebar > ul {
        display: flex;
        overflow-x: auto;
        gap: 2px;
    }

    .sanwd-sidebar li + li {
        margin-top: 0;
    }

    .sanwd-sidebar li ul {
        display: none;
    }

    .sanwd-footer-inner {
        align-items: flex-start;
        flex-direction: column;
        padding-top: 10px;
        padding-bottom: 10px;
    }
}

/* ================================================================
   Joomla Frontend-Editing aus den App-Menüpositionen heraushalten
   Template v1.3.1
   Joomla kann bei aktivierter Frontend-Bearbeitung vor Modulen einen
   jmodedit-Link samt Tooltip/Metadaten einfügen. Im schlanken App-
   Template würde dieser ohne Joomla-Backend-CSS Platz in der Navbar
   belegen. Die Bearbeitungsfunktion bleibt in Joomla erhalten, wird
   in den Navigationspositionen aber nicht dargestellt.
   ================================================================ */
.sanwd-mainmenu .jmodedit,
.sanwd-sidebar .jmodedit,
.sanwd-footer-menu .jmodedit,
.sanwd-mainmenu [class~="jmodedit"],
.sanwd-sidebar [class~="jmodedit"],
.sanwd-footer-menu [class~="jmodedit"],
.sanwd-mainmenu a[href*="task=module.edit"],
.sanwd-sidebar a[href*="task=module.edit"],
.sanwd-footer-menu a[href*="task=module.edit"] {
    display: none !important;
}

/* Von Joomla erzeugte Edit-Tooltips dürfen die Navigation ebenfalls
   weder verschieben noch als ungestylter Text sichtbar werden. */
.sanwd-app-navbar .joomla-edit-tooltip,
.sanwd-sidebar .joomla-edit-tooltip,
.sanwd-footer-menu .joomla-edit-tooltip,
.sanwd-app-navbar .tooltip,
.sanwd-sidebar .tooltip,
.sanwd-footer-menu .tooltip {
    display: none !important;
}

/* Falls der Bearbeitungslink als direktes Geschwisterelement vor dem
   Menü ausgegeben wird, darf er keinerlei Flex-Breite belegen. */
.sanwd-mainmenu > a.jmodedit,
.sanwd-mainmenu > button.jmodedit,
.sanwd-sidebar > a.jmodedit,
.sanwd-sidebar > button.jmodedit,
.sanwd-footer-menu > a.jmodedit,
.sanwd-footer-menu > button.jmodedit {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
}
