:root {
    --primary: #614FBD;
    --primary-dark: #4B3A9F;
    --primary-light: #8A7BDD;
    --secondary: #F48218;
    --secondary-dark: #D96808;
    --secondary-light: #FFB15C;

    --bg: #F7F8FC;
    --surface: #FFFFFF;
    --surface-soft: #F1F0FA;

    --sidebar-bg: #1A1730;
    --sidebar-bg-2: #221E3D;

    --border: #E4E5EF;

    --text: #1D1D3E;
    --text-secondary: #66677A;
    --text-muted: #9293A5;
    --text-white: #FFFFFF;

    --success: #22A06B;
    --warning: #E9A21B;
    --danger: #D94A4A;
    --info: #3978D8;

    --primary-soft: rgba(97, 79, 189, 0.10);
    --secondary-soft: rgba(244, 130, 24, 0.10);

    --shadow-sm: 0 2px 8px rgba(29, 29, 62, 0.06);
    --shadow-md: 0 6px 20px rgba(29, 29, 62, 0.10);
    --shadow-lg: 0 12px 35px rgba(29, 29, 62, 0.14);
    --shadow-xl: 0 24px 60px rgba(29, 29, 62, 0.18);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    --transition: all 0.25s ease;
}

* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
}

a {
    text-decoration: none;
}

.text-theme-orange {
    color: var(--secondary-light);
}

/* ============================================================
    LOGIN LAYOUT — Two column
============================================================ */
.login-wrap {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ============================================================
    LEFT PANEL — Brand / Hero
============================================================ */
.brand-panel {
    flex: 1 1 55%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-white);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.brand-panel::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -120px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.brand-panel::after {
    content: "";
    position: absolute;
    bottom: -140px;
    left: -80px;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.brand-panel>* {
    position: relative;
    z-index: 1;
}

/* Brand logo */
.brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 2rem;
    text-shadow: 1px 2px 1px #2c0097;
}

.brand-logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: grid;
    place-items: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
}

/* Hero content */
.brand-hero {
    max-width: 480px;
    margin: 60px 0;
}

.brand-hero h1 {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 16px;
}

.brand-hero p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.6;
    margin: 0 0 32px;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.92);
}

.brand-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex-shrink: 0;
    backdrop-filter: blur(6px);
}

/* Stats strip */
.brand-stats {
    display: flex;
    gap: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    flex-wrap: wrap;
}

.brand-stat .bs-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.brand-stat .bs-label {
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Footer note */
.brand-footer {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
}

/* ============================================================
    RIGHT PANEL — Login Form
============================================================ */
.form-panel {
    flex: 1 1 45%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    overflow-y: auto;
}

.form-wrap {
    width: 100%;
    max-width: 420px;
}

.form-header {
    margin-bottom: 28px;
}

.form-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
    line-height: 1.2;
}

.form-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================================
    ROLE SELECTOR
============================================================ */
.role-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    display: block;
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 22px;
}

.role-option {
    position: relative;
}

.role-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.role-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    min-height: 88px;
    font-family: inherit;
}

.role-option label:hover {
    border-color: var(--primary-light);
    background: var(--primary-soft);
    transform: translateY(-2px);
}

.role-option input:checked+label {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.role-option .role-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    transition: var(--transition);
}

.role-option input:checked+label .role-icon {
    transform: scale(1.08);
}

.role-option .role-icon.admin {
    background: var(--primary-soft);
    color: var(--primary);
}

.role-option .role-icon.employee {
    background: var(--secondary-soft);
    color: var(--secondary);
}

.role-option .role-icon.customer {
    background: rgba(57, 120, 216, .12);
    color: var(--info);
}

.role-option .role-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.role-option .role-sub {
    font-size: 0.66rem;
    color: var(--text-muted);
    line-height: 1.1;
}

/* ============================================================
    FORM FIELDS
============================================================ */
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 12px 14px;
    font-size: 0.92rem;
    transition: var(--transition);
    height: 48px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.input-group-icon {
    position: relative;
}

.input-group-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    transition: var(--transition);
}

.input-group-icon input {
    padding-left: 42px;
}

.input-group-icon input:focus~i {
    color: var(--primary);
}

/* Password toggle */
.pwd-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.pwd-toggle:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.input-group-icon input[type="password"] {
    padding-right: 48px;
}

.input-group-icon input[type="text"].pwd-visible {
    padding-right: 48px;
}

/* ============================================================
    FORM ROW — Remember + Forgot
============================================================ */
.form-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    min-height: auto;
    margin: 0;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    cursor: pointer;
    margin: 0;
    transition: var(--transition);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-check-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.forgot-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    transition: var(--transition);
}

.forgot-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================================
    SUBMIT BUTTON
============================================================ */
.btn-login {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(97, 79, 189, 0.30);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(97, 79, 189, 0.40);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-login .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
    DIVIDER + DEMO CREDS
============================================================ */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 20px;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.demo-creds {
    background: var(--surface-soft);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.demo-creds-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.demo-creds-title i {
    color: var(--primary);
}

.demo-cred-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
    gap: 8px;
}

.demo-cred-item:last-child {
    border-bottom: none;
}

.demo-cred-item:hover {
    padding-left: 6px;
    color: var(--primary);
}

.demo-cred-item .role {
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.demo-cred-item .creds {
    color: var(--text-muted);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.76rem;
    background: var(--surface);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
    FOOTER
============================================================ */
.form-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 20px;
}

.form-footer a {
    color: var(--primary);
    font-weight: 600;
    transition: var(--transition);
}

.form-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================================
    TOAST
============================================================ */
.toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-toast {
    min-width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    font-size: 0.86rem;
}

.app-toast.success {
    border-left-color: var(--success);
}

.app-toast.warning {
    border-left-color: var(--warning);
}

.app-toast.danger {
    border-left-color: var(--danger);
}

.app-toast.hide {
    animation: slideOut 0.3s ease forwards;
}

.app-toast .t-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--primary-soft);
    color: var(--primary);
}

.app-toast.success .t-icon {
    background: rgba(34, 160, 107, .12);
    color: var(--success);
}

.app-toast.warning .t-icon {
    background: rgba(233, 162, 27, .14);
    color: var(--warning);
}

.app-toast.danger .t-icon {
    background: rgba(217, 74, 74, .12);
    color: var(--danger);
}

.app-toast .t-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.86rem;
}

.app-toast .t-msg {
    color: var(--text-secondary);
    font-size: 0.76rem;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* ============================================================
    SHAKE ANIMATION for errors
============================================================ */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

.shake {
    animation: shake 0.4s ease;
}

/* ============================================================
    RESPONSIVE
============================================================ */
@media (max-width: 991.98px) {
    .brand-panel {
        flex: 0 0 320px;
        padding: 32px 28px;
        justify-content: flex-start;
    }

    .brand-hero {
        margin: 24px 0;
    }

    .brand-hero h1 {
        font-size: 1.6rem;
    }

    .brand-hero p {
        font-size: 0.88rem;
        margin-bottom: 20px;
    }

    .brand-features {
        display: none;
    }

    .brand-stats {
        gap: 20px;
        padding-top: 16px;
    }

    .brand-stat .bs-value {
        font-size: 1.15rem;
    }

    .brand-stat .bs-label {
        font-size: 0.68rem;
    }

    .brand-footer {
        display: none;
    }

    .form-panel {
        padding: 32px 22px;
    }
}

@media (max-width: 767.98px) {
    .login-wrap {
        flex-direction: column;
    }

    .brand-panel {
        flex: 0 0 auto;
        padding: 28px 22px 32px;
        border-radius: 0 0 24px 24px;
    }

    .brand-panel::before {
        top: -80px;
        right: -80px;
        width: 220px;
        height: 220px;
    }

    .brand-panel::after {
        bottom: -80px;
        left: -60px;
        width: 180px;
        height: 180px;
    }

    .brand-hero {
        margin: 18px 0 4px;
    }

    .brand-hero h1 {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }

    .brand-hero p {
        font-size: 0.82rem;
        margin-bottom: 0;
    }

    .brand-stats {
        margin-top: 18px;
        padding-top: 16px;
        gap: 18px;
    }

    .brand-stat .bs-value {
        font-size: 1.05rem;
    }

    .brand-stat .bs-label {
        font-size: 0.64rem;
    }

    .form-panel {
        padding: 26px 20px 40px;
        align-items: flex-start;
    }

    .form-header h2 {
        font-size: 1.4rem;
    }

    .role-grid {
        gap: 6px;
    }

    .role-option label {
        padding: 12px 6px;
        min-height: 78px;
    }

    .role-option .role-icon {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .role-option .role-name {
        font-size: 0.72rem;
    }

    .role-option .role-sub {
        font-size: 0.6rem;
    }
}

@media (max-width: 380px) {
    .brand-hero h1 {
        font-size: 1.2rem;
    }

    .brand-stat .bs-value {
        font-size: 0.95rem;
    }

    .form-header h2 {
        font-size: 1.25rem;
    }

    .role-option label {
        padding: 10px 4px;
        min-height: 72px;
    }

    .role-option .role-name {
        font-size: 0.68rem;
    }
}