        :root {
            --primary-color: #0ea5e9;
            --bg-primary: #ffffff;
            --bg-secondary: #f8f9fa;
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --border-light: #e5e7eb;
        }

        * {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }

        body {
            min-height: 100vh;
            min-height: 100dvh;
            background: white;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 2rem 1.5rem;
            box-sizing: border-box;
        }

        .logo-container {
            text-align: center;
            margin-bottom: 2.5rem;
            flex-shrink: 0;
        }

        .logo-container img {
            max-width: 280px;
            width: 100%;
            height: auto;
            display: block;
            margin: 0 auto;
        }

        .logo-tagline {
            font-size: 0.8125rem;
            color: var(--text-secondary);
            margin-top: 0.5rem;
            margin-bottom: 0;
            line-height: 1.3;
            max-width: 280px;
            margin-left: auto;
            margin-right: auto;
        }

        .auth-container {
            width: 100%;
            max-width: 420px;
            flex: 0 1 auto;
            min-width: 0;
        }

        .auth-card {
            background: white;
            border-radius: 16px;
            border: 2px solid var(--border-light);
        }

        .auth-form {
            padding: 2rem 2rem;
        }

        .auth-header {
            margin-bottom: 2rem;
            text-align: center;
        }

        .auth-header h2 {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
        }

        .auth-header p {
            font-size: 0.875rem;
            color: var(--text-secondary);
            margin: 0;
        }

        .auth-header p a {
            color: var(--primary-color);
        }
        .auth-footer-link {
            margin-top: 1.25rem;
            padding-top: 1rem;
            border-top: 1px solid var(--border-light);
            font-size: 0.8125rem;
            color: var(--text-secondary);
        }
        .auth-footer-link a {
            color: var(--primary-color);
            font-weight: 600;
            text-decoration: none;
        }

        .form-group {
            margin-bottom: 1.25rem;
        }

        .form-group label {
            display: block;
            font-size: 0.875rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
        }

        .form-control {
            width: 100%;
            padding: 0.75rem 1rem;
            font-size: 0.9375rem;
            border: 2px solid var(--border-light);
            border-radius: 8px;
            transition: all 0.2s ease;
        }

        .form-control:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
        }

        .form-options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .custom-checkbox {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .custom-checkbox input {
            width: 18px;
            height: 18px;
            cursor: pointer;
        }

        .custom-checkbox label {
            font-size: 0.875rem;
            color: var(--text-secondary);
            margin: 0;
            cursor: pointer;
            font-weight: 500;
        }

        .forgot-link {
            font-size: 0.875rem;
            color: var(--text-secondary);
            text-decoration: none;
            font-weight: 500;
        }

        .forgot-link:hover {
            color: var(--primary-color);
        }

        .btn-primary-modern {
            width: 100%;
            padding: 0.875rem 1.5rem;
            background: var(--primary-color);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .btn-primary-modern:hover {
            background: #0284c7;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
        }

        .btn-primary-modern:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .login-error-wrap {
            min-height: 0;
            margin-bottom: 1rem;
        }
        .login-error-wrap:not(:empty) {
            margin-bottom: 1.25rem;
        }
        .alert {
            padding: 0.875rem 1rem;
            border-radius: 8px;
            margin-bottom: 0;
            font-size: 0.875rem;
        }

        .alert-danger {
            background: rgba(239, 68, 68, 0.1);
            color: #dc2626;
            border: 1px solid rgba(239, 68, 68, 0.2);
        }

        .alert-info {
            background: rgba(59, 130, 246, 0.1);
            color: #2563eb;
            border: 1px solid rgba(59, 130, 246, 0.2);
        }

        .alert-warning {
            background: rgba(245, 158, 11, 0.1);
            color: #d97706;
            border: 1px solid rgba(245, 158, 11, 0.2);
        }

        /* Modal Styles */
        .modal-content {
            border-radius: 16px;
            border: none;
        }

        .modal-header {
            border-bottom: 1px solid var(--border-light);
            padding: 1.5rem;
        }

        .modal-title {
            font-weight: 700;
            color: var(--text-primary);
        }

        .modal-body {
            padding: 1.5rem;
        }

        /* Branch selector modal: logo first, welcome, lean list */
        .branch-selector-dialog {
            max-width: 420px;
        }
        .branch-selector-modal {
            border-radius: 20px;
            overflow: hidden;
            position: relative;
        }
        .branch-selector-close {
            position: absolute;
            top: 0.75rem;
            right: 0.75rem;
            z-index: 2;
            width: 36px;
            height: 36px;
            padding: 0;
            margin: 0;
            border: none;
            background: transparent;
            color: var(--text-secondary);
            font-size: 1.5rem;
            line-height: 1;
            cursor: pointer;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.2s, background 0.2s;
        }
        .branch-selector-close:hover {
            color: var(--text-primary);
            background: var(--bg-secondary);
        }
        .branch-selector-body {
            padding: 2rem 1.75rem 1.75rem;
            text-align: center;
        }
        .branch-selector-brand {
            margin-bottom: 1rem;
        }
        .branch-selector-logo-wrap {
            display: inline-block;
            width: 72px;
            height: 72px;
            border-radius: 16px;
            overflow: hidden;
            background: var(--bg-secondary);
            border: 1px solid var(--border-light);
        }
        .branch-selector-logo {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
        }
        .branch-selector-no-logo {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 72px;
            height: 72px;
            border-radius: 16px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-light);
            color: var(--text-secondary);
            font-size: 1.75rem;
        }
        .branch-selector-welcome {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text-primary);
            margin: 0 0 0.25rem 0;
            line-height: 1.3;
        }
        .branch-selector-subtitle {
            font-size: 0.9375rem;
            color: var(--text-secondary);
            margin: 0 0 1.25rem 0;
        }
        .branch-selector-list {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }
        .branch-selector-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.875rem 1rem;
            border: 1px solid var(--border-light);
            border-radius: 12px;
            background: white;
            text-align: left;
            width: 100%;
            cursor: pointer;
            transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
            border-left: 3px solid var(--branch-color, var(--primary-color));
        }
        .branch-selector-item:hover {
            border-color: var(--branch-color, var(--primary-color));
            background: rgba(14, 165, 233, 0.04);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }
        .branch-selector-item:disabled {
            opacity: 0.7;
            cursor: not-allowed;
        }
        .branch-selector-item-name {
            font-weight: 600;
            font-size: 0.9375rem;
            color: var(--text-primary);
        }
        .branch-selector-item-code {
            font-size: 0.8125rem;
            color: var(--text-secondary);
            font-weight: 500;
        }

        .center-button {
            padding: 1.25rem 1.5rem;
            border: 2px solid var(--border-light);
            border-radius: 12px;
            background: white;
            transition: all 0.2s ease;
            text-align: left;
            width: 100%;
        }

        .center-button:hover {
            border-color: var(--primary-color);
            background: rgba(14, 165, 233, 0.05);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .center-button .font-weight-bold {
            color: var(--text-primary);
            font-size: 1.125rem;
            margin-bottom: 0.25rem;
        }

        .center-button .small {
            color: var(--text-secondary);
            font-size: 0.8125rem;
        }

        /* Tablet: keep card narrow and centered so it doesn’t stretch full width */
        @media (min-width: 769px) and (max-width: 1024px) {
            body {
                padding: 2rem 1.5rem;
                padding-top: max(2rem, env(safe-area-inset-top));
                padding-bottom: max(2rem, env(safe-area-inset-bottom));
                padding-left: max(1.5rem, env(safe-area-inset-left));
                padding-right: max(1.5rem, env(safe-area-inset-right));
            }
            .auth-container {
                max-width: 420px;
            }
            .auth-form {
                padding: 2rem 1.75rem;
            }
        }

        /* Tablet and phone */
        @media (max-width: 768px) {
            body {
                padding: 1.5rem 1rem;
                justify-content: center;
                padding-top: max(1.5rem, env(safe-area-inset-top));
                padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
                padding-left: max(1rem, env(safe-area-inset-left));
                padding-right: max(1rem, env(safe-area-inset-right));
            }

            .logo-container {
                margin-bottom: 1.5rem;
            }

            .logo-container img {
                max-width: 260px;
            }

            .auth-container {
                max-width: 92%;
                max-width: min(360px, 92%);
            }

            .auth-form {
                padding: 1.5rem 1.25rem;
            }

            .auth-header {
                margin-bottom: 1.5rem;
            }

            .auth-header h2 {
                font-size: 1.25rem;
            }

            .auth-header p {
                font-size: 0.8125rem;
            }

            .form-control {
                padding: 0.5rem 0.75rem;
                font-size: 0.9375rem;
            }

            .btn-primary-modern {
                padding: 0.65rem 1rem;
                font-size: 0.9375rem;
            }

            /* Branch modal: viewport-relative on mobile/tablet */
            #myModal .modal-dialog {
                margin: 0.75rem auto;
                width: calc(100% - 1.5rem);
                max-width: none;
                max-height: calc(100vh - 1.5rem);
                max-height: calc(100dvh - 1.5rem);
            }

            #myModal .modal-content {
                max-height: calc(100vh - 1.5rem);
                max-height: calc(100dvh - 1.5rem);
                border-radius: 12px;
            }

            #myModal .modal-header {
                padding: 1rem 1rem;
            }

            #myModal .modal-body,
            #myModal .branch-selector-body {
                padding: 1.25rem 1rem;
                max-height: calc(100vh - 140px);
                max-height: calc(100dvh - 140px);
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }

            #myModal .modal-title {
                font-size: 1.1rem;
            }

            .branch-selector-welcome {
                font-size: 1.125rem;
            }
            .branch-selector-dialog {
                width: calc(100% - 1.5rem);
                max-width: none;
            }
        }

        /* Small phones */
        @media (max-width: 480px) {
            body {
                padding: 1rem 0.75rem;
                justify-content: center;
                padding-top: max(1rem, env(safe-area-inset-top));
                padding-bottom: max(1rem, env(safe-area-inset-bottom));
                padding-left: max(0.75rem, env(safe-area-inset-left));
                padding-right: max(0.75rem, env(safe-area-inset-right));
            }

            .logo-container {
                margin-bottom: 1.25rem;
            }

            .logo-container img {
                max-width: min(260px, 72vw);
            }

            .auth-container {
                max-width: min(340px, 92%);
            }

            .auth-form {
                padding: 1.25rem 1rem;
            }

            .auth-header {
                margin-bottom: 1.25rem;
            }

            .auth-header h2 {
                font-size: 1.125rem;
            }

            .auth-header p {
                font-size: 0.8125rem;
            }

            .form-control {
                padding: 0.5rem 0.75rem;
                font-size: 16px;
            }

            .btn-primary-modern {
                padding: 0.6rem 1rem;
                font-size: 0.9375rem;
            }

            .form-options {
                flex-wrap: wrap;
                gap: 0.5rem;
                margin-bottom: 1.25rem;
            }

            .forgot-link,
            .custom-checkbox label {
                font-size: 0.8125rem;
            }

            #myModal .modal-dialog {
                margin: 0.5rem auto;
                width: calc(100% - 1rem);
                max-width: none;
            }

            #myModal .modal-content {
                max-height: calc(100vh - 1rem);
                max-height: calc(100dvh - 1rem);
            }

            #myModal .modal-body,
            #myModal .branch-selector-body {
                padding: 1rem 0.875rem;
                max-height: calc(100vh - 120px);
                max-height: calc(100dvh - 120px);
            }

            .branch-selector-welcome {
                font-size: 1rem;
            }
            .branch-selector-item {
                padding: 0.75rem 1rem;
            }

            .center-button {
                padding: 0.75rem 1rem;
            }

            .center-button .font-weight-bold {
                font-size: 1rem;
            }
        }

        /* Large desktop: prevent card from feeling too small */
        @media (min-width: 1025px) {
            .auth-container {
                max-width: 440px;
            }
            .auth-form {
                padding: 2.25rem 2rem;
            }
        }
