:root {
    color-scheme: light;
}

body.auth-page {
    min-height: 100vh;
    margin: 0;
    background: #f6d6dc;
    color: #4a2c2a;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-shell {
    width: min(92vw, 520px);
    margin: 34px auto 60px;
}

.auth-shell.users-shell {
    width: min(94vw, 860px);
}

.auth-card {
    padding: 24px;
    border: 1px solid rgba(161, 75, 90, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 42px rgba(74, 44, 42, 0.16);
}

.auth-card h1,
.auth-card h2 {
    margin: 0 0 8px;
}

.auth-card p {
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-field label {
    font-weight: 700;
}

.auth-field input {
    min-height: 44px;
    box-sizing: border-box;
    border: 1px solid #c98d98;
    border-radius: 10px;
    padding: 9px 11px;
    background: #fff;
    color: #2d1a19;
    font: inherit;
}

.auth-field input:focus {
    outline: 3px solid rgba(251, 208, 3, 0.65);
    outline-offset: 1px;
}

.auth-button {
    min-height: 44px;
    border: 1px solid #6e5510;
    border-radius: 999px;
    padding: 10px 16px;
    background: #fbd003;
    color: #15110a;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.auth-button.secondary {
    border-color: #4a2c2a;
    background: #4a2c2a;
    color: #fff;
}

.auth-button.danger {
    border-color: #8f1c25;
    background: #fff;
    color: #8f1c25;
}

.auth-button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.auth-button.compact {
    min-height: 38px;
    flex: 0 0 auto;
    padding: 7px 13px;
    font-size: 0.86rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: #765955;
    font-size: 0.86rem;
}

.auth-divider::before,
.auth-divider::after {
    height: 1px;
    flex: 1;
    background: #dfbcc2;
    content: "";
}

.auth-message {
    min-height: 1.4em;
    margin: 14px 0 0;
    color: #8f1c25;
    font-weight: 650;
}

.auth-message.success {
    color: #08794e;
}

.auth-note {
    color: #765955;
    font-size: 0.9rem;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    font-size: 0.92rem;
}

.auth-links a {
    color: #713e47;
    font-weight: 700;
}

.auth-hidden {
    display: none !important;
}

.passkey-list {
    display: grid;
    gap: 10px;
    margin: 18px 0;
    padding: 0;
    list-style: none;
}

.admin-user-section {
    margin-top: 28px;
    border-top: 1px solid #dfbcc2;
    padding-top: 22px;
}

.admin-user-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.admin-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid #dfbcc2;
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.admin-user-details {
    min-width: 0;
}

.admin-user-details small {
    display: block;
    margin-top: 4px;
    color: #765955;
}

.admin-user-you {
    display: inline-block;
    margin-left: 8px;
    border-radius: 999px;
    padding: 2px 7px;
    background: #fbd003;
    color: #15110a;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.admin-user-protected {
    display: inline-block;
    margin-left: 8px;
    border: 1px solid rgba(230, 194, 138, 0.56);
    border-radius: 999px;
    padding: 2px 7px;
    color: #7d541d;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-owner-protection {
    display: grid;
    justify-items: end;
    gap: 3px;
    color: #7d541d;
    text-align: right;
}

.admin-owner-protection small {
    color: #765955;
}

.invitation-result {
    margin-top: 16px;
    border: 2px solid #08794e;
    border-radius: 14px;
    padding: 16px;
    background: #f2fff9;
}

.invitation-code {
    display: block;
    overflow-wrap: anywhere;
    margin: 10px 0;
    color: #2d1a19;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: clamp(1.05rem, 3vw, 1.4rem);
    font-weight: 800;
    letter-spacing: 0.04em;
}

.invitation-link {
    display: block;
    margin: 12px 0;
    overflow-wrap: anywhere;
    color: #713e47;
    font-weight: 700;
}

.invitation-actions,
.admin-role-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-role-controls {
    justify-content: flex-end;
}

.admin-control-note {
    flex-basis: 100%;
    color: #765955;
    text-align: right;
}

.admin-role-select {
    min-height: 40px;
    border: 1px solid #b9a8aa;
    border-radius: 8px;
    padding: 7px 10px;
    background: #fff;
    color: #241c1d;
}

.passkey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #dfbcc2;
    border-radius: 12px;
    padding: 12px;
}

.passkey-item small {
    display: block;
    margin-top: 3px;
    color: #765955;
}

.auth-footer {
    margin-top: 18px;
    text-align: center;
    color: #765955;
    font-size: 0.82rem;
}

@media (max-width: 520px) {
    .auth-card {
        padding: 20px 16px;
    }

    .auth-links,
    .admin-user-item,
    .passkey-item,
    .admin-role-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-owner-protection {
        justify-items: start;
        text-align: left;
    }

    .admin-control-note {
        text-align: left;
    }
}
