* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --primary-muted: #c7d2fe;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --text-color: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 40px rgba(79,70,229,0.15), 0 8px 16px rgba(0,0,0,0.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    font-family: var(--font);
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 460px;
}

.auth-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.logo {
    text-align: center;
    margin-bottom: 32px;
}

.brand-mark-xl {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.75rem;
    font-family: var(--font);
    margin: 0 auto 14px;
    box-shadow: 0 8px 24px rgba(99,102,241,0.35);
    letter-spacing: -0.04em;
}

.brand-wordmark {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 6px;
}

.tagline {
    color: var(--text-light);
    font-size: 0.875rem;
}

.form-container {
    display: none;
}

.form-container.active {
    display: block;
}

.form-container h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-color);
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.9375rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font);
    color: var(--text-color);
    background: white;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

select {
    cursor: pointer;
}

.btn {
    width: 100%;
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.form-footer {
    margin-top: 22px;
    text-align: center;
}

.form-footer p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.form-footer a:hover {
    text-decoration: underline;
}

.forgot-password-link {
    text-align: right;
    margin-top: -6px;
    margin-bottom: 16px;
}

.forgot-password-link a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 0.15s;
}

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

.info-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 20px;
    line-height: 1.55;
}

.success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto 24px;
    box-shadow: 0 8px 20px rgba(16,185,129,0.3);
}

.reset-info {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 16px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.dev-info { text-align: left; }
.dev-info p { margin-bottom: 10px; font-size: 0.875rem; }

.reset-link-box {
    background: white;
    border: 1.5px dashed var(--primary-muted);
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    word-break: break-all;
}

.reset-link {
    color: var(--primary-color);
    font-size: 0.875rem;
}

.expires-text {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 6px;
}

.alert {
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 18px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideIn 0.25s ease;
}

.alert.show { display: block; }

.alert.error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 3px solid var(--danger-color);
}

.alert.success {
    background: #ecfdf5;
    color: #065f46;
    border-left: 3px solid var(--success-color);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.signup-sub {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 18px;
    margin-top: 4px;
}

.signup-badge-admin {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 3px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 18px;
}

.signup-badge-customer {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    padding: 3px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 18px;
}

.signup-type-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}

.signup-type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 16px 18px;
    background: var(--bg-light);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    font-family: var(--font);
    width: 100%;
}

.signup-type-card:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.signup-type-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.signup-type-card strong {
    font-size: 0.9375rem;
    color: var(--text-color);
    font-weight: 700;
}

.signup-type-desc {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.45;
}

.org-availability {
    font-size: 0.8rem;
    margin-top: 5px;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    gap: 4px;
}

.org-availability.checking  { color: var(--text-light); }
.org-availability.available { color: var(--success-color); font-weight: 600; }
.org-availability.taken     { color: var(--danger-color); font-weight: 600; }

.form-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
    display: block;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .brand-mark-xl {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }
}
