:root {
    --primary: #4dc0b5;
    --primary-dark: #3aa89f;
    --secondary: #38c172;
    --danger: #e3342f;
    --dark: #1a202c;
    --text: #2d3748;
    --text-secondary: #718096;
    --text-placeholder: #a0aec0;
    --bg: #f0fdf9;
    --white: #ffffff;
    --border: #e2e8f0;
    --border-focus: #4dc0b5;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.12);
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(160deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    -webkit-font-smoothing: antialiased;
}

/* ── Wrapper ── */
.auth-wrapper {
    width: 100%;
    max-width: 420px;
    animation: slideUp .35s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ── */
.auth-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* ── Brand bar ── */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
}

.auth-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
}

.auth-brand-name {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
}

.auth-brand-tagline {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Body ── */
.auth-body {
    padding: 32px 28px 28px;
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
    margin-bottom: 28px;
}

/* ── Fields ── */
.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.field-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.field-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

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

.field-input {
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.field-input:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(77, 192, 181, 0.12);
}

.field-input.has-error {
    border-color: var(--danger);
}

.field-input.has-error:focus-within {
    box-shadow: 0 0 0 3px rgba(227, 52, 47, 0.1);
}

.field-input > i {
    padding-left: 14px;
    font-size: 0.9rem;
    color: var(--text-placeholder);
    flex-shrink: 0;
    pointer-events: none;
}

.field-input:focus-within > i {
    color: var(--primary);
}

.field-input input,
.field-input select {
    flex: 1;
    border: none;
    outline: none;
    padding: 11px 14px 11px 10px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text);
    background: transparent;
    min-width: 0;
    width: 100%;
    min-height: 44px;
}

.field-input select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-placeholder) 50%), linear-gradient(135deg, var(--text-placeholder) 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.field-input input::placeholder {
    color: var(--text-placeholder);
}

.field-toggle {
    background: none;
    border: none;
    padding: 0 14px;
    cursor: pointer;
    color: var(--text-placeholder);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: color var(--transition);
    flex-shrink: 0;
}

.field-toggle:hover {
    color: var(--primary);
}

.field-error {
    display: block;
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 5px;
    font-weight: 500;
}

/* ── Checkbox ── */
.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text);
    font-weight: 500;
    user-select: none;
}

.checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Submit button ── */
.btn-submit {
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(77, 192, 181, 0.35);
}

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

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-label,
.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ── Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0;
    color: var(--text-placeholder);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Alt link ── */
.auth-alt {
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.auth-alt a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-alt a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

/* ── Footer ── */
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.auth-footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
    color: #fff;
}

/* ── Legacy compat (register, reset, etc.) ── */
.auth-links {
    margin-top: 24px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
}

.auth-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: var(--text);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group label i {
    margin-right: 4px;
    color: var(--primary);
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control::placeholder { color: var(--text-placeholder); }
.form-control:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(77, 192, 181, 0.12); }
.form-control.is-invalid { border-color: var(--danger); }

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    cursor: pointer;
    font-weight: 500;
    color: var(--text);
    font-size: 0.88rem;
}

.input-password { position: relative; }
.input-password .form-control { padding-right: 44px; }
.toggle-password {
    position: absolute; right: 2px; top: 2px; bottom: 2px; width: 40px;
    background: none; border: none; cursor: pointer; color: var(--text-placeholder);
    display: flex; align-items: center; justify-content: center;
    transition: color var(--transition);
}
.toggle-password:hover { color: var(--primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; border: none; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.95rem; font-family: inherit; cursor: pointer; transition: transform var(--transition), box-shadow var(--transition); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(77, 192, 181, 0.35); }
.btn-block { width: 100%; }

.error-message { color: var(--danger); font-size: 0.78rem; margin-top: 5px; display: block; font-weight: 500; }

.alert { padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.88rem; }
.alert-success { background: rgba(56, 193, 114, 0.1); color: var(--secondary); border-left: 4px solid var(--secondary); }

/* ── Responsive ── */
@media (max-width: 480px) {
    body { padding: 16px 12px; }
    .auth-card { border-radius: 14px; }
    .auth-brand { padding: 16px 20px; }
    .auth-body { padding: 24px 20px 22px; }
    .auth-title { font-size: 1.2rem; }
}
