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

body.sanwd-app-template {
    width: 100%;
    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 {
    min-height: 100vh;
}

.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;
}

.sanwd-legal-links {
    position: fixed;
    left: 16px;
    bottom: 10px;
    z-index: 9100;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 7px 10px;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 999px;
    background: rgba(15, 23, 42, .72);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .22);
    backdrop-filter: blur(12px);
}

.sanwd-legal-links a {
    color: rgba(255, 255, 255, .82);
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

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

@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-legal-links {
        left: 10px;
        right: 10px;
        justify-content: center;
        width: auto;
    }
}
