:root,
[data-theme="light"] {
    --dm-primary: #2b5491;
    --dm-primary-hover: #234876;
    --dm-primary-rgb: 43, 84, 145;

    --dm-page-bg: #ffffff;
    --dm-surface: #ffffff;
    --dm-input-bg: #f1f4f9;
    --dm-input-border: transparent;
    --dm-input-border-focus: #2b5491;
    --dm-input-focus-ring: rgba(43, 84, 145, 0.12);

    --dm-illustration-bg: #f8fafc;
    --dm-illustration-shadow: none;

    --dm-text: #1a1a1a;
    --dm-text-heading: #333333;
    --dm-text-muted: #6b7280;
    --dm-text-light: #9ca3af;
    --dm-text-link: #2b5491;

    --dm-divider: #dce3eb;
    --dm-checkbox-border: #c5cdd8;

    --dm-btn-text: #ffffff;

    --dm-icon: #2b5491;
    --dm-icon-muted: #9ca3af;

    --dm-theme-toggle-bg: #f1f4f9;
    --dm-theme-toggle-border: #e5e7eb;
    --dm-theme-toggle-icon: #2b5491;

    --dm-input-radius: 12px;
    --dm-btn-radius: 12px;
    --dm-panel-radius: 32px;

    --dm-illustration-padding: 48px;
    --dm-form-max-width: 520px;
    --dm-input-min-height: 58px;

    --dm-font: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

[data-theme="dark"] {
    --dm-primary: #4a8fd4;
    --dm-primary-hover: #3a7bc0;
    --dm-primary-rgb: 74, 143, 212;

    --dm-page-bg: #0b1120;
    --dm-surface: #0b1120;
    --dm-input-bg: #151d2e;
    --dm-input-border: #1e293b;
    --dm-input-border-focus: #4a8fd4;
    --dm-input-focus-ring: rgba(74, 143, 212, 0.18);

    --dm-illustration-bg: #111827;
    --dm-illustration-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);

    --dm-text: #f1f5f9;
    --dm-text-heading: #f8fafc;
    --dm-text-muted: #94a3b8;
    --dm-text-light: #64748b;
    --dm-text-link: #4a8fd4;

    --dm-divider: #334155;
    --dm-checkbox-border: #475569;

    --dm-btn-text: #ffffff;

    --dm-icon: #4a8fd4;
    --dm-icon-muted: #64748b;

    --dm-theme-toggle-bg: #151d2e;
    --dm-theme-toggle-border: #1e293b;
    --dm-theme-toggle-icon: #fbbf24;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    font-family: var(--dm-font);
    background: var(--dm-page-bg);
    color: var(--dm-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.auth-page {
    height: 100vh;
    max-height: 100vh;
    background: var(--dm-page-bg);
    overflow: hidden;
}

.auth-container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

.auth-row {
    display: grid;
    grid-template-columns: 1fr;
    height: 100%;
    width: 100%;
    margin: 0;
    overflow: hidden;
}

.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1050;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--dm-theme-toggle-border);
    background: var(--dm-theme-toggle-bg);
    color: var(--dm-theme-toggle-icon);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover {
    transform: scale(1.04);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--dm-primary);
    outline-offset: 2px;
}

.theme-toggle .bi-sun-fill,
[data-theme="dark"] .theme-toggle .bi-moon-fill {
    display: none;
}

[data-theme="dark"] .theme-toggle .bi-sun-fill {
    display: block;
}

.theme-toggle .bi-moon-fill {
    display: block;
}

.auth-form-column {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    max-height: 100vh;
    width: 100%;
    padding: var(--dm-illustration-padding) 3rem;
    background: var(--dm-surface);
    order: 1;
    box-sizing: border-box;
    overflow: hidden;
}

.auth-page--register .auth-form-column {
    align-items: center;
    justify-content: center;
}

.auth-form-stack {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    max-width: var(--dm-form-max-width);
    min-height: calc(100vh - (var(--dm-illustration-padding) * 2));
    margin: 0 auto;
}

.auth-page--register .auth-form-stack {
    min-height: auto;
    padding-top: 3rem;
    padding-bottom: 1rem;
}

.auth-column-top {
    flex-shrink: 0;
}

.auth-form-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    padding: 2rem 0;
}

.auth-page--register .auth-form-inner {
    justify-content: flex-start;
    padding: 1.5rem 0 2rem;
}

.auth-column-bottom {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding-top: 1rem;
}

.dm-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.dm-brand-anchor {
    position: absolute;
    top: 40px;
    left: 50px;
    z-index: 10;
}

.dm-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dm-text-heading);
    line-height: 1.2;
    margin: 0 0 0.35rem;
    letter-spacing: -0.01em;
}

.dm-subtitle {
    color: var(--dm-text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    margin: 0 0 1.75rem;
}

.auth-page--register .dm-subtitle {
    margin-bottom: 1.5rem;
}

.dm-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dm-text);
    margin-bottom: 0.5rem;
    display: block;
}

.form-required-asterisk {
    color: #dc3545;
    font-weight: 700;
}

.dm-field > .dm-label:has(+ .food-item-form-modal__required) {
    display: inline;
    margin-bottom: 0;
    vertical-align: baseline;
}

.dm-field > .food-item-form-modal__required {
    display: inline;
    color: #dc2626;
    font-weight: 700;
    vertical-align: baseline;
}

.dm-field {
    margin-bottom: 1.25rem;
}

.auth-page--register .dm-field {
    margin-bottom: 1rem;
}

.dm-combined-input {
    display: flex;
    align-items: center;
    background: var(--dm-input-bg);
    border: 1px solid var(--dm-input-border);
    border-radius: var(--dm-input-radius);
    min-height: var(--dm-input-min-height);
    padding: 0 1.125rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.dm-combined-input:focus-within {
    border-color: var(--dm-input-border-focus);
    box-shadow: 0 0 0 0.15rem var(--dm-input-focus-ring);
}

.dm-combined-input input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--dm-text);
    min-width: 0;
    padding: 1rem 0;
    line-height: 1.4;
}

.dm-combined-input input::placeholder {
    color: var(--dm-text-light);
}

.dm-input-field,
.dm-password-wrap input {
    width: 100%;
    background: var(--dm-input-bg);
    border: 1px solid var(--dm-input-border);
    border-radius: var(--dm-input-radius);
    padding: 1rem 1.25rem;
    min-height: var(--dm-input-min-height);
    font-size: 1.05rem;
    color: var(--dm-text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.dm-input-field::placeholder,
.dm-password-wrap input::placeholder {
    color: var(--dm-text-light);
}

.dm-password-wrap input::placeholder {
    letter-spacing: 0.12em;
}

.dm-input-field:focus,
.dm-password-wrap input:focus {
    border-color: var(--dm-input-border-focus);
    box-shadow: 0 0 0 0.15rem var(--dm-input-focus-ring);
}

.dm-input-field.is-invalid,
.dm-password-wrap input.is-invalid {
    border-color: #dc3545;
}

.dm-toggle-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    color: var(--dm-icon);
    transition: opacity 0.15s ease, color 0.2s ease;
}

.dm-toggle-btn:hover {
    opacity: 0.85;
}

.dm-toggle-btn i {
    font-size: 1.125rem;
}

.dm-password-wrap {
    position: relative;
}

.dm-password-wrap input {
    padding-right: 2.75rem;
}

.dm-eye-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    color: var(--dm-icon-muted);
    transition: color 0.2s ease;
}

.dm-eye-btn:hover {
    color: var(--dm-icon);
}

.dm-eye-btn i {
    font-size: 1.125rem;
}

.dm-form-options {
    margin-bottom: 1.5rem;
}

.dm-form-options .form-check-label {
    font-size: 0.875rem;
    color: var(--dm-text-muted);
    line-height: 1.4;
}

.dm-form-options .form-check-input {
    width: 1rem;
    height: 1rem;
    margin-top: 0.15rem;
    border-color: var(--dm-checkbox-border);
    background-color: var(--dm-input-bg);
    cursor: pointer;
}

.dm-form-options .form-check-input:checked {
    background-color: var(--dm-primary);
    border-color: var(--dm-primary);
}

.dm-form-options .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem var(--dm-input-focus-ring);
    border-color: var(--dm-primary);
}

.dm-link {
    color: var(--dm-text-link);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.4;
    transition: color 0.15s ease;
}

.dm-link:hover {
    color: var(--dm-primary-hover);
    text-decoration: underline;
}

.dm-btn {
    background: var(--dm-primary);
    border: none;
    border-radius: var(--dm-btn-radius);
    padding: 0.9rem 1rem;
    font-weight: 600;
    font-size: 1rem;
    min-height: var(--dm-input-min-height);
    color: var(--dm-btn-text);
    width: 100%;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.dm-btn:hover,
.dm-btn:focus {
    background: var(--dm-primary-hover);
    color: var(--dm-btn-text);
}

.dm-btn:active {
    transform: scale(0.995);
}

.dm-auth-footer-text {
    font-size: 0.875rem;
    color: var(--dm-text-muted);
    line-height: 1.5;
    margin: 1rem 0 0;
    text-align: center;
}

.dm-auth-footer-text .dm-link {
    font-weight: 600;
}

.dm-powered-by {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.dm-powered-by-text {
    font-size: 0.7rem;
    color: var(--dm-text-muted);
    text-transform: lowercase;
    letter-spacing: 0.02em;
    line-height: 1;
}

.auth-illustration-column {
    display: none;
    height: 100%;
    max-height: 100vh;
    width: 100%;
    padding: var(--dm-illustration-padding) var(--dm-illustration-padding) var(--dm-illustration-padding) 0;
    background: var(--dm-page-bg);
    order: 2;
    box-sizing: border-box;
    overflow: hidden;
}

.dm-illustration-box {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: var(--dm-panel-radius);
    box-shadow: var(--dm-illustration-shadow);
    overflow: hidden;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-illustration-panel.dm-illustration-box {
    display: block;
}

.dm-illustration-box img {
    display: block;
    object-fit: contain;
    object-position: center center;
}

.invalid-feedback {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #dc3545;
}

.dm-alert {
    font-size: 0.875rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

@media (min-width: 992px) {
    .auth-row {
        grid-template-columns: 50% 50%;
    }

    .auth-form-column {
        width: 100%;
        max-width: none;
    }

    .auth-illustration-column {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: none;
    }

    .dm-illustration-box {
        flex: 1;
        width: 100%;
        height: 100%;
        min-height: 0;
    }
}

@media (max-width: 991.98px) {
    .auth-form-column {
        padding: 2rem 1.5rem;
    }

    .auth-form-stack {
        min-height: auto;
    }

    .auth-page--register .auth-form-stack {
        padding-top: 4rem;
    }

    .dm-brand-anchor {
        top: 24px;
        left: 24px;
    }

    .theme-toggle {
        top: 16px;
        right: 16px;
    }
}

.dm-btn-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: dm-btn-spin 0.65s linear infinite;
    vertical-align: -0.15em;
    margin-right: 0.35rem;
}

button.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

@keyframes dm-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.dm-throttle-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.875rem;
    border-radius: 0.75rem;
    border: 1px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.875rem;
    line-height: 1.45;
}

.dm-throttle-alert .bi {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

[data-theme="dark"] .dm-throttle-alert {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.45);
    color: #fcd34d;
}
