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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Heading typography — DM Sans */
h1, h2, h3, .page-title, .stat-value, .contractor-name, .card-title {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}

/* Logo text — Space Grotesk */
.login-logo-text, .sidebar-logo-text {
    font-family: 'Space Grotesk', sans-serif;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, hsl(40, 20%, 98%) 0%, hsla(220, 60%, 50%, 0.08) 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--accent-gradient);
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    top: -200px;
    right: -200px;
    animation: float 20s ease-in-out infinite;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, hsl(220, 60%, 60%) 0%, hsl(220, 60%, 50%) 100%);
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.1;
    bottom: -100px;
    left: -100px;
    animation: float 15s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(5deg); }
    66% { transform: translate(-20px, 20px) rotate(-5deg); }
}

.login-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: slideUp 0.6s ease-out;
}

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

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

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

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    justify-content: center;
}

.login-logo-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 12px hsla(220, 60%, 50%, 0.4);
}

.login-logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

/* Email address chip shown above password / SSO steps */
.login-email-chip {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-bottom: 20px;
    word-break: break-all;
}

/* Error message below the active login step */
.login-error {
    margin-top: 16px;
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    display: none;
}
.login-error.show {
    display: block;
}

/* Text-only back / navigation button on the login page */
.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 13px;
    cursor: pointer;
    margin-top: 12px;
    padding: 4px 0;
    display: block;
    width: 100%;
    text-align: center;
    font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* Large centered TOTP code input */
.login-mfa-input {
    font-size: 24px;
    text-align: center;
    padding: 14px;
    letter-spacing: 6px;
    font-family: 'Inter', monospace;
}

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

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--bg-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px var(--accent-light);
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    width: 100%;
    box-shadow: 0 4px 12px hsla(220, 60%, 50%, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px hsla(220, 60%, 50%, 0.45);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: hsl(0, 72%, 48%);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: hsl(155, 65%, 38%);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-icon {
    padding: 6px;
    width: 28px;
    height: 28px;
}

/* Delete button (reports/time entries) */
.btn-delete {
    padding: 6px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    opacity: 0.3;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover {
    background: hsla(0, 72%, 55%, 0.1);
    color: var(--danger);
    opacity: 1;
}

.error-message {
    background: var(--danger-light);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: none;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-message.show {
    display: block;
}

/* Financial color utility classes (Lovable spec) */
.text-stat-revenue { color: hsl(215, 80%, 52%); }
.text-stat-cost { color: hsl(0, 72%, 51%); }
.text-stat-profit { color: hsl(152, 60%, 40%); }
.text-stat-hours { color: var(--stat-hours); }
.text-stat-contractors { color: var(--stat-contractors); }
.text-stat-margin { color: var(--stat-margin); }
