/* Hide number input spinners globally */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* CSS Variables - Clean Minimalist */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --primary-subtle: #eef2ff;
    
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #2563eb;
    --info-light: #dbeafe;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
    
    --radius-sm: 2px;
    --radius: 3px;
    --radius-lg: 4px;
    --radius-md: 3px;
    --radius-xl: 4px;
    
    --transition: all 0.12s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-700);
    line-height: 1.5;
    font-size: 13px;
    min-height: 100vh;
}

/* Auth Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

/* Hide app content until auth is verified */
.app-container.auth-pending {
    display: none !important;
}

.auth-modal.hidden {
    display: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.auth-modal-content {
    background: var(--white);
    padding: 1.5rem 2rem;
    max-width: 380px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    position: relative;
}

.auth-header {
    text-align: center;
    margin-bottom: 1rem;
}

.auth-brand-icon {
    display: block;
    margin: 0 auto;
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.auth-brand-text {
    display: block;
    margin: 0.25rem auto 0.5rem auto;
    width: 120px;
    height: auto;
    object-fit: contain;
}

.auth-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
    margin: 0 0 0.375rem 0;
}

.auth-tagline {
    font-size: 0.6875rem;
    color: var(--gray-500);
    line-height: 1.4;
    margin: 0;
}

.auth-about {
    font-size: 0.6875rem;
    color: var(--gray-500);
    line-height: 1.4;
    margin: 0.75rem 0 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    text-align: center;
}

.auth-about a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-about a:hover {
    text-decoration: underline;
}

/* Auth Mode Toggle */
.auth-mode-toggle {
    display: flex;
    background: var(--gray-100);
    padding: 2px;
    margin-bottom: 1rem;
}

.auth-mode-btn {
    flex: 1;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    background: transparent;
    border: none;
    cursor: pointer;
}

.auth-mode-btn.active {
    background: var(--white);
    color: var(--gray-800);
}

.auth-mode-btn:hover:not(.active) {
    color: var(--gray-700);
}

.optional {
    font-weight: 400;
    color: var(--gray-400);
    font-size: 0.625rem;
}

.auth-social {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-social {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
    color: var(--gray-700);
}

.btn-social:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-google:hover {
    border-color: #4285F4;
}

.btn-apple {
    background: var(--gray-800);
    color: var(--white);
    border-color: var(--gray-800);
}

.btn-apple:hover {
    background: var(--gray-700);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.auth-divider span {
    padding: 0 0.625rem;
    font-size: 0.6875rem;
    color: var(--gray-500);
    text-transform: uppercase;
}

.auth-form .form-group {
    margin-bottom: 0.75rem;
}

.auth-form .form-group label {
    font-size: 0.6875rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--gray-600);
}

.auth-form .form-group input {
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
    border: 1px solid var(--gray-300);
}

.auth-form .form-group input:focus {
    border-color: var(--primary);
    outline: none;
}

.auth-form .form-group input.error {
    border-color: #dc3545;
    background-color: #fff8f8;
}

.auth-form .form-group input.error:focus {
    border-color: #dc3545;
}

.auth-error {
    color: #dc3545;
    font-size: 0.625rem;
    margin-top: 0.25rem;
}

.form-error-message {
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    margin-bottom: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: rgba(220, 53, 69, 0.08);
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 0.625rem;
    cursor: pointer;
    padding: 2px 4px;
    text-transform: uppercase;
    font-weight: 500;
}

.password-toggle:hover {
    color: var(--gray-700);
}

/* Password Requirements */
.password-requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 0.75rem;
    margin-top: 0.375rem;
    font-size: 0.5625rem;
    color: var(--gray-400);
}

.password-requirements .req {
    transition: color 0.15s;
}

.password-requirements .req.valid {
    color: var(--success);
}

/* Remember me checkbox */
.remember-me {
    margin-bottom: 0.75rem !important;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--gray-700);
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1.125rem;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.checkbox-label span {
    -webkit-user-select: none;
    user-select: none;
}

.forgot-password {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
    margin-top: -0.375rem;
    margin-bottom: 0.625rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-password:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

/* Admin panel link - shown only for admin emails */
.admin-panel-link {
    display: block;
    text-align: right;
    font-size: 0.6875rem;
    color: #666;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.admin-panel-link:hover {
    text-decoration: underline;
    color: #333;
}

.btn-full {
    width: 100%;
    margin-top: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.auth-terms {
    text-align: center;
    font-size: 0.625rem;
    color: #999;
    margin-top: 0.875rem;
}

.auth-terms a {
    color: var(--primary);
    text-decoration: none;
}

.auth-terms a:hover {
    text-decoration: underline;
}

/* Forgot Password Modal */
.forgot-password-modal {
    background: white;
    border-radius: 0;
    padding: 1rem 1.25rem;
    width: 100%;
    max-width: 280px;
    position: relative;
    box-shadow: none;
}

.forgot-password-modal .modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: #999;
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    padding: 0;
    line-height: 1;
}

.forgot-password-modal .modal-close:hover {
    color: #333;
}

.forgot-icon {
    font-size: 1rem;
    text-align: center;
    margin-bottom: 0.25rem;
}

.forgot-password-modal h2 {
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    text-transform: lowercase;
}

.forgot-password-modal h3 {
    text-align: center;
    font-size: 0.625rem;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0.25rem 0;
}

.forgot-description {
    text-align: center;
    font-size: 0.5625rem;
    color: #666;
    margin-bottom: 0.625rem;
    line-height: 1.4;
}

.forgot-step .form-group {
    margin-bottom: 0.5rem;
}

.forgot-step .form-group label {
    display: block;
    font-size: 0.5625rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.125rem;
}

.forgot-step .form-group input {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.6875rem;
    transition: border-color 0.2s;
}

.forgot-step .form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.forgot-hint {
    display: block;
    font-size: 0.5rem;
    color: #999;
    margin-top: 0.125rem;
}

.forgot-user-info {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem;
    background: #f8f9fa;
    border-radius: 3px;
    margin-bottom: 0.5rem;
}

/* Forgot password code inputs */
.forgot-step .code-input-container {
    display: flex;
    justify-content: center;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.forgot-step .code-input {
    width: 32px;
    height: 38px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 3px;
    transition: border-color 0.2s;
}

.forgot-step .code-input:focus {
    outline: none;
    border-color: var(--primary);
}

.forgot-step .code-input.error {
    border-color: #e74c3c;
    animation: shake 0.3s ease;
}

.forgot-error {
    text-align: center;
    font-size: 0.5625rem;
    color: #e74c3c;
    margin-bottom: 0.375rem;
}

.forgot-user-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.5625rem;
}

.forgot-user-name {
    font-weight: 500;
    color: #1a1a1a;
    font-size: 0.5625rem;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 2.5rem !important;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

.password-strength {
    height: 3px;
    border-radius: 0;
    margin-top: 0.375rem;
    background: #eee;
    overflow: hidden;
}

.password-strength::after {
    content: '';
    display: block;
    height: 100%;
    width: var(--strength, 0%);
    background: var(--strength-color, #eee);
    transition: width 0.3s, background 0.3s;
}

.password-strength.weak::after {
    --strength: 33%;
    --strength-color: #e74c3c;
}

.password-strength.medium::after {
    --strength: 66%;
    --strength-color: #f39c12;
}

.password-strength.strong::after {
    --strength: 100%;
    --strength-color: #27ae60;
}

.forgot-step .btn {
    font-size: 0.625rem;
    padding: 0.375rem 0.75rem;
    border-radius: 3px;
}

.forgot-step .btn-primary {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: white;
}

.forgot-step .btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-link {
    background: none;
    border: none;
    color: #666;
    font-size: 0.5625rem;
    cursor: pointer;
    margin-top: 0.375rem;
    display: block;
    width: 100%;
    text-align: center;
    padding: 0;
}

.btn-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.success-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #27ae60;
    color: white;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Email Verification Modal - Clean Modern Design */
.verify-modal {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 340px;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    animation: verifySlideUp 0.35s ease;
    text-align: center;
}

@keyframes verifySlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.verify-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #ccc;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    line-height: 1;
}

.verify-close:hover {
    background: #f5f5f5;
    color: #666;
}

.verify-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.verify-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: #111;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.verify-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 1.75rem 0;
    line-height: 1.5;
}

.verify-subtitle strong {
    color: #333;
    font-weight: 500;
}

.totp-code-prompt {
    margin-top: 1rem;
}

/* 6-digit code input - Modern Style */
.code-input-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.code-input {
    width: 44px;
    height: 52px;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1.375rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    background: #fafafa;
    color: #111;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.15);
}

.code-input.filled {
    border-color: var(--primary);
    background: white;
}

.code-input.error {
    border-color: #ff4444;
    background: #fff8f8;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.verify-error {
    color: #d32f2f;
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    padding: 0.625rem 1rem;
    background: #ffebee;
    border-radius: 8px;
}

.verify-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.verify-btn:hover {
    background: #4a8ac4;
    transform: translateY(-1px);
}

.verify-btn:active {
    transform: translateY(0);
}

.verify-resend {
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: #888;
}

.verify-resend-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.verify-resend-btn:hover {
    color: #4a8ac4;
}

.verify-resend-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    text-decoration: none;
}

.verify-timer {
    color: #999;
    margin-left: 4px;
}

/* TOTP Authenticator Modal Styles */
.totp-modal {
    max-width: 380px;
}

.totp-qr-container {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    justify-content: center;
}

.totp-qr {
    width: 180px;
    height: 180px;
    border-radius: 8px;
}

.totp-secret {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f0f7ff;
    border-radius: 10px;
}

.totp-secret-label {
    font-size: 0.75rem;
    color: #666;
    margin: 0 0 0.5rem 0;
}

.totp-secret-code {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.1em;
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    -webkit-user-select: all;
    user-select: all;
    cursor: text;
}

.totp-account {
    font-size: 0.8rem;
    color: #666;
    margin: 0.75rem 0 0 0;
}

.totp-help {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 8px;
    color: #666;
}

.totp-help small {
    font-size: 0.75rem;
    line-height: 1.4;
}

.totp-error {
    margin-top: 0;
}

/* Legacy resend-code styles for compatibility */
.resend-code {
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: #666;
}

.btn-link-inline {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 0;
    margin-left: 0.25rem;
}

.btn-link-inline:hover {
    text-decoration: underline;
}

.btn-link-inline:disabled {
    color: #999;
    cursor: not-allowed;
}

.resend-timer {
    color: #999;
    margin-left: 0.25rem;
}

.verify-note {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #999;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    padding: 0.625rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    display: none;
}

.logo h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    letter-spacing: -0.25px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Quarter Dropdown in Header - Minimalist Button Style */
.quarter-dropdown {
    position: relative;
}

.quarter-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: var(--white);
    color: var(--gray-700);
    padding: 0.25rem 0.5rem;
    border-radius: 0;
    font-weight: 400;
    font-size: 0.6875rem;
    border: 1px solid var(--gray-300);
    cursor: pointer;
    text-align: center;
    min-width: 70px;
}

.quarter-select:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.quarter-select:focus {
    outline: none;
    border-color: var(--gray-500);
}

.rate-status {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    color: var(--gray-500);
}

.status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gray-400);
}

.rate-status.live .status-dot,
.rate-status.verified .status-dot {
    background: var(--success);
}

.rate-status.error .status-dot {
    background: var(--danger);
}

.rate-status.fetching .status-dot {
    background: var(--primary);
    animation: pulse 1s infinite;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* System Health Indicator */
.system-health {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.625rem;
    color: var(--gray-500);
}

.health-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--success);
}

.system-health.checking .health-dot {
    background: var(--primary);
    animation: pulse 1s infinite;
}

.system-health.warning .health-dot {
    background: var(--warning);
}

.system-health.error .health-dot {
    background: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
}

/* Cards */
.card {
    background: var(--white);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
}

.card h2 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.card h2 svg {
    display: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    background: var(--white);
    color: var(--gray-600);
    transition: var(--transition);
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
}

.btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn svg {
    flex-shrink: 0;
    width: 13px;
    height: 13px;
}

.btn-primary {
    background: #4f46e5;
    color: var(--white);
    border-color: #4f46e5;
}

.btn-primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-600);
    border-color: var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.btn-danger {
    background: var(--white);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-light);
}

.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
}

.btn-icon {
    padding: 0.25rem;
    width: 30px;
    height: 30px;
}

/* Form Elements */
.form-group {
    margin-bottom: 0.625rem;
}

.form-group label {
    display: block;
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input, select {
    width: 100%;
    padding: 0 8px;
    height: 30px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
    background: transparent;
    color: #111827;
    transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

select {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    padding-right: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

input:hover, select:hover {
    border-color: #c7d2fe;
    background: #fafbff;
}

input:focus, select:focus {
    outline: none;
    border-color: #6366f1;
    background: #fff;
    box-shadow: inset 0 0 0 1px #6366f1;
}

input::placeholder {
    color: #c6cbd2;
    font-weight: 400;
}

/* Config Panel */
.config-panel {
    background: var(--white);
    padding: 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
}

.config-panel input,
.config-panel select {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

/* Required field indicator */
.required {
    color: var(--danger);
    font-weight: 600;
}

/* MPG hint label */
.mpg-hint, .optional-hint {
    font-size: 0.625rem;
    color: var(--gray-500);
    font-weight: 400;
}

/* Calculated MPG field */
.mpg-calculated {
    background: var(--gray-50) !important;
    color: var(--primary);
    font-weight: 500;
    text-align: center;
    cursor: default;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.section-header h2 {
    margin-bottom: 0;
}

.action-buttons {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.paste-hint {
    font-size: 0.625rem;
    color: var(--gray-400);
    cursor: default;
    margin-left: 0.25rem;
    white-space: nowrap;
}

/* Data Table */
.table-container {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
}

@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
    }
}

#dataTable, #ratesTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    background: var(--white);
}

#dataTable th, #ratesTable th {
    background: #f9fafb;
    padding: 7px 8px;
    text-align: left;
    font-weight: 700;
    color: #6b7280;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #f3f4f6;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

#dataTable th:last-child, #ratesTable th:last-child {
    border-right: none;
}

#dataTable td, #ratesTable td {
    padding: 0;
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    vertical-align: middle;
    color: var(--gray-700);
    height: 30px;
}

#dataTable td:last-child, #ratesTable td:last-child {
    border-right: none;
}

#dataTable tbody tr, #ratesTable tbody tr {
    transition: background 0.1s;
}

#dataTable tbody tr:nth-child(even), #ratesTable tbody tr:nth-child(even) {
    background: #fafbfc;
}

#dataTable tbody tr:hover, #ratesTable tbody tr:hover {
    background: #f0f4ff;
}

#dataTable input, #dataTable select {
    width: 100%;
    height: 30px;
    padding: 0 8px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 0;
    outline: none;
    background: transparent;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    color: #111827;
    transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
    box-sizing: border-box;
}

#dataTable input::placeholder {
    color: #c6cbd2;
    font-weight: 400;
}

#dataTable select {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    padding-right: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

#dataTable input:hover, #dataTable select:hover {
    border-color: #c7d2fe;
    background: #fafbff;
}

#dataTable input:focus, #dataTable select:focus {
    border-color: #6366f1;
    background: #fff;
    box-shadow: inset 0 0 0 1px #6366f1;
    z-index: 2;
    position: relative;
}

/* Hover-to-edit cells */
.ifta-cell {
    position: relative;
    cursor: pointer;
    padding: 0 !important;
}

.ifta-cell .ifta-cell-display {
    padding: 0 8px;
    height: 30px;
    line-height: 30px;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: border-color 0.12s, background 0.12s;
}

.ifta-cell:hover .ifta-cell-display {
    border-color: #c7d2fe;
    background: #fafbff;
}

.ifta-cell .ifta-cell-editor {
    display: none;
}

.ifta-cell.editing .ifta-cell-display {
    display: none;
}

.ifta-cell.editing .ifta-cell-editor {
    display: block;
    width: 100%;
}

.ifta-cell-number .ifta-cell-display {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.ifta-cell-jurisdiction .ifta-cell-display {
    font-weight: 500;
    color: #111827;
}

.cell-placeholder {
    color: #c6cbd2;
    font-weight: 400;
}

.col-jurisdiction { min-width: 100px; }
.col-miles, .col-taxable, .col-gallons { min-width: 65px; }
.col-rate { min-width: 55px; }
.col-taxable-gal, .col-net-gal { min-width: 65px; }
.col-tax { min-width: 70px; }
.col-actions { min-width: 35px; text-align: right; padding-right: 0.5rem; }

#dataTable td:last-child {
    text-align: right;
    padding-right: 0.75rem;
    width: 45px;
}

/* Totals Row */
.totals-row {
    background: #f9fafb;
}

.totals-row td {
    font-weight: 700;
    font-size: 0.6875rem;
    color: #111827;
    border-bottom: none;
    padding: 7px 8px;
    border-top: 1px solid #e5e7eb;
}

.tax-amount {
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    padding: 0 8px;
    white-space: nowrap;
    text-align: right;
    line-height: 30px;
}

.tax-amount.positive {
    color: var(--danger);
}

.tax-amount.negative {
    color: var(--success);
}

/* Read-only calculated fields */
.rate-display {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    padding: 0 8px;
    white-space: nowrap;
    line-height: 30px;
}

.taxable-gallons,
.net-taxable-gallons {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    padding: 0 8px;
    white-space: nowrap;
    text-align: right;
    line-height: 30px;
}

.net-taxable-gallons.negative {
    color: var(--success);
    background: rgba(102, 187, 106, 0.1);
}

/* Whole number inputs - no decimals */
.total-miles,
.taxable-miles,
.tax-paid-gallons {
    text-align: right;
}

/* Taxable miles indicator — removed special background, now matches usheet */
.taxable-miles:focus {
    border-color: #6366f1;
    background: #fff;
    box-shadow: inset 0 0 0 1px #6366f1;
}

.delete-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #9ca3af;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.12s;
    opacity: 0;
}

tr:hover .delete-row {
    opacity: 1;
}

.delete-row:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

/* Inline Summary Bar */
.inline-summary {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    background: transparent;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--gray-200);
}

.inline-summary .summary-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.inline-summary .summary-label {
    font-size: 0.625rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.inline-summary .summary-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
}

.inline-summary .summary-item.highlight {
    margin-left: auto;
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.inline-summary .summary-item.highlight .summary-label {
    color: var(--gray-500);
}

.inline-summary .summary-item.highlight .summary-value {
    color: var(--gray-800);
    font-weight: 600;
}

/* Export Section - Compact */
.export-section {
    background: var(--white);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-top: 0.75rem;
}

.export-section h2 {
    display: none;
}

.export-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.export-label {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* Rates Section */
.rates-section {
    margin-top: 0.75rem;
    background: var(--white);
    padding: 0.75rem;
    border: 1px solid var(--gray-200);
}

.rates-info {
    display: flex;
    gap: 0.75rem;
    font-size: 0.625rem;
    color: var(--gray-500);
}

.rates-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.rates-filter input {
    max-width: 180px;
}

.rates-filter select {
    max-width: 100px;
}

.rates-table-container {
    max-height: 280px;
    overflow-y: auto;
    border-top: 1px solid var(--gray-200);
}

#ratesTable th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--gray-50);
}

/* Footer */
.footer {
    background: var(--white);
    color: var(--gray-500);
    padding: 0.5rem 1.5rem;
    text-align: center;
    font-size: 0.625rem;
    border-top: 1px solid var(--gray-200);
}

.footer a {
    color: var(--gray-600);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.disclaimer {
    font-size: 0.625rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay p {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 4px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 60px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: var(--white);
    padding: 0.625rem 0.875rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.2s ease;
    max-width: 320px;
    font-size: 0.8125rem;
    border: 1px solid var(--gray-200);
    pointer-events: auto;
}

.toast.success {
    border-left: 3px solid var(--success);
    background: #f0fdf4;
}

.toast.error {
    border-left: 3px solid var(--danger);
    background: #fef2f2;
}

.toast.warning {
    border-left: 3px solid var(--warning);
    background: #fffbeb;
}

.toast.info {
    border-left: 3px solid var(--primary);
    background: #eff6ff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Print Styles */
@media print {
    .header, .config-panel, .action-buttons, .export-section, .rates-section, .footer, .loading-overlay, .toast-container, .auth-modal {
        display: none !important;
    }

    .app-container {
        padding: 0;
    }

    .main-content {
        padding: 0;
        max-width: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
        page-break-inside: avoid;
    }

    body {
        background: white;
        font-size: 10pt;
    }

    #dataTable {
        font-size: 8pt;
    }

    #dataTable input, #dataTable select {
        border: none;
        padding: 0;
        background: transparent;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0.5rem 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .main-content {
        padding: 0.75rem;
    }
    
    /* Table on mobile */
    .table-container {
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    
    #dataTable th, #dataTable td {
        padding: 0.35rem 0.25rem;
        font-size: 0.7rem;
    }
    
    #dataTable input, #dataTable select {
        font-size: 0.7rem;
        padding: 0.2rem 0.25rem;
        min-width: 50px;
    }
    
    .jurisdiction-select {
        min-width: 90px !important;
        max-width: 110px;
    }
    
    .total-miles, .taxable-miles, .tax-paid-gallons {
        min-width: 55px !important;
        max-width: 70px;
    }
    
    /* Make tax rate and calculated columns narrower */
    .rate-display, .taxable-gallons, .net-taxable-gallons {
        font-size: 0.65rem;
    }
    
    .tax-amount {
        font-size: 0.7rem;
        font-weight: 600;
    }
    
    .delete-row {
        padding: 0.2rem;
    }
    
    .delete-row svg {
        width: 14px;
        height: 14px;
    }

    .card {
        padding: 0.75rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .config-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .inline-summary {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .inline-summary .summary-item.highlight {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .rates-filter {
        flex-direction: column;
    }

    .rates-filter input, .rates-filter select {
        max-width: none;
    }

    .export-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .export-buttons {
        width: 100%;
    }

    .export-buttons .btn {
        flex: 1;
    }

    .rates-info {
        flex-direction: column;
        gap: 0.25rem;
    }

    .auth-modal-content {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .config-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        width: 100%;
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
    
    /* Auth modal on small screens */
    .auth-modal-content {
        padding: 1rem;
        margin: 0.5rem;
        max-width: 100%;
    }
    
    .auth-header {
        margin-bottom: 1rem;
    }
    
    .auth-brand-text {
        max-width: 120px;
    }
    
    .auth-title {
        font-size: 1.25rem;
    }
    
    .auth-mode-toggle {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .auth-mode-btn {
        width: 100%;
        padding: 0.5rem;
    }
    
    .btn-social {
        font-size: 0.8rem;
        padding: 0.6rem;
    }
    
    /* Export buttons on mobile */
    .export-buttons {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    
    .export-buttons .btn {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }
    
    .export-divider {
        display: none;
    }
    
    .inline-summary {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .summary-item {
        width: 100%;
        justify-content: space-between;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
}

.profile-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gray-400);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 600;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 0.6875rem;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--white);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-100);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.12s ease;
    z-index: 200;
}

.profile-dropdown.open .profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--gray-100);
    width: 100%;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.profile-menu-header:hover {
    background: var(--gray-50);
}

.menu-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.menu-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden;
}

.menu-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-edit-btn {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--gray-500);
}

.avatar-edit-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.profile-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-user-name {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--gray-800);
}

.profile-edit-hint {
    font-size: 0.625rem;
    color: var(--gray-400);
    margin-top: 0.125rem;
}

.profile-user-email {
    font-size: 0.6875rem;
    color: var(--gray-500);
}

.profile-menu-items {
    padding: 0.375rem;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
    color: var(--gray-700);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
}

.profile-menu-item:hover {
    background: var(--gray-50);
}

.profile-menu-item.menu-item-danger {
    color: var(--danger);
}

.profile-menu-item.menu-item-danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

.menu-badge {
    background: var(--gray-500);
    color: white;
    font-size: 0.5625rem;
    padding: 0.125rem 0.375rem;
    font-weight: 500;
}

.profile-menu-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 0.25rem 0;
}

/* Export divider */
.export-divider {
    width: 1px;
    height: 16px;
    background: var(--gray-200);
    margin: 0 0.25rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    max-width: 400px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-lg {
    max-width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.modal-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.125rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 1rem;
}

.modal-body .form-group {
    margin-bottom: 0.875rem;
}

.modal-body textarea {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--gray-200);
    resize: vertical;
    font-family: inherit;
    transition: var(--transition);
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--gray-400);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: 0.375rem 0;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* Reports Modal */
.reports-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.reports-search input {
    min-width: 200px;
}

.reports-actions {
    display: flex;
    gap: 0.375rem;
}

.reports-list {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    max-height: 400px;
    overflow-y: auto;
}

.reports-empty {
    padding: 2rem;
    text-align: center;
    color: var(--gray-500);
}

/* ── Task Manager ──────────────────────────────────────────────── */
.task-manager-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--gray-50);
}

.task-manager-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem 2rem;
    flex-shrink: 0;
}

.task-manager-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 2rem;
}

.task-manager-title-section h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.task-manager-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0.25rem 0 0;
}

.task-manager-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.task-view-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--gray-100);
    padding: 0.375rem;
    border-radius: 6px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.toggle-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.task-manager-filters {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-select,
.filter-input {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    color: var(--gray-900);
    font-family: inherit;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-group.search {
    flex: 1;
    min-width: 200px;
}

.filter-input {
    width: 100%;
}

/* Task View Container */
.task-view-container {
    flex: 1;
    overflow-y: auto;
    display: none;
}

.task-view-container.active {
    display: flex;
    flex-direction: column;
}

/* Kanban View */
.task-view-kanban {
    padding: 1.5rem 2rem;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    grid-auto-flow: dense;
}

.kanban-column {
    display: flex;
    flex-direction: column;
    background: var(--gray-100);
    border-radius: 8px;
    overflow: hidden;
    max-height: calc(100vh - 300px);
}

.kanban-column-header {
    padding: 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    border-left: 4px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.kanban-column-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--gray-200);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
}

.kanban-column-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kanban-column-cards.drag-over {
    background: rgba(79, 70, 229, 0.05);
    border-radius: 6px;
}

/* Task Card */
.task-card {
    background: var(--white);
    border-radius: 6px;
    padding: 0.875rem;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--primary);
    cursor: pointer;
    transition: var(--transition);
    -webkit-user-select: none;
    user-select: none;
    word-break: break-word;
}

.task-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.task-card.task-card-overdue {
    border-left-color: #dc2626;
    background: rgba(220, 38, 38, 0.02);
}

.task-card-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.task-entity-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.task-type-badge {
    display: inline;
    padding: 0;
    font-size: 0.8125rem;
    font-weight: 400;
    border-radius: 0;
    text-transform: none;
    letter-spacing: normal;
    color: #1d1c1d;
}

.task-type-maintenance,
.task-type-safety,
.task-type-training,
.task-type-incident,
.task-type-inspection {
    background: transparent;
    color: #1d1c1d;
}

.task-card-body {
    margin-bottom: 0.75rem;
}

.task-card-text {
    font-size: 0.875rem;
    color: var(--gray-800);
    font-weight: 500;
    margin: 0 0 0.375rem;
    line-height: 1.4;
}

.task-card-entity {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin: 0;
}

.task-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.task-card-assignees {
    display: flex;
    gap: -0.25rem;
}

.assignee-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-subtle);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 50%;
    margin-left: -0.375rem;
    border: 2px solid var(--white);
}

.assignee-avatar:first-child {
    margin-left: 0;
}

.task-card-due {
    font-size: 0.75rem;
    color: var(--gray-600);
    padding: 0.25rem 0.5rem;
    background: var(--gray-100);
    border-radius: 3px;
}

.task-card-due.overdue {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
    font-weight: 600;
}

/* Table View */
.task-view-table {
    padding: 1.5rem 2rem;
    flex: 1;
    overflow: auto;
}

.task-table-wrapper {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.task-table thead {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.task-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
    border-right: 1px solid var(--gray-100);
}

.task-table th:last-child {
    border-right: none;
}

.task-table td {
    padding: 0.875rem 1rem;
    border-right: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
}

.task-table td:last-child {
    border-right: none;
}

.task-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.02);
}

.task-table tbody tr.task-expand-row:hover {
    background: var(--gray-50);
}

.task-table tbody tr.row-overdue {
    background: rgba(220, 38, 38, 0.02);
}

.td-due-date {
    font-size: 0.8rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.td-created {
    font-size: 0.8rem;
    color: var(--gray-600);
    white-space: nowrap;
    min-width: 100px;
}

.created-date {
    display: block;
    font-weight: 500;
}

.created-time {
    display: block;
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-top: 1px;
}

.td-days {
    text-align: center;
    white-space: nowrap;
}

.days-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.days-ok {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.days-warn {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.days-overdue {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.days-na {
    color: var(--gray-300);
}

/* Note cell */
.td-note {
    max-width: 220px;
}

.note-cell {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.note-preview {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
    color: var(--gray-700);
}

.btn-note-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-note-toggle:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
}

/* Owner */
.td-owner {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Assignee trigger button */
.assignee-trigger {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.8rem;
    color: var(--gray-600);
    padding: 0.3rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assignee-trigger:hover {
    border-color: var(--gray-200);
    background: rgba(79, 70, 229, 0.02);
}

.unassigned-label {
    color: var(--gray-300);
    font-style: italic;
}

/* Assignee dropdown */
.assignee-dropdown {
    position: fixed;
    z-index: 10000;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    max-height: 320px;
    display: flex;
    flex-direction: column;
    animation: fadeInDown 0.12s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.assignee-dd-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.assignee-dd-input {
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font: inherit;
    font-size: 0.8rem;
    color: var(--gray-800);
    outline: none;
    transition: border-color 0.15s;
}

.assignee-dd-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.assignee-dd-input::placeholder {
    color: var(--gray-300);
}

.assignee-dd-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem;
}

.assignee-dd-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
    -webkit-user-select: none;
    user-select: none;
}

.assignee-dd-item:hover {
    background: rgba(79, 70, 229, 0.04);
}

.assignee-dd-item.is-selected {
    background: rgba(79, 70, 229, 0.06);
}

.assignee-dd-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
    cursor: pointer;
}

.assignee-dd-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.assignee-dd-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.assignee-dd-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assignee-dd-email {
    font-size: 0.7rem;
    color: var(--gray-400);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assignee-dd-empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray-400);
}

/* Form assignee picker */
.form-assignee-picker {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-assignee-trigger {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    font: inherit;
    font-size: 0.84rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
}

.form-assignee-trigger:hover {
    border-color: var(--primary);
}

.form-assignee-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.assignee-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
}

/* Inline status select */
.inline-status {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 1.2rem 0.3rem 0.55rem;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 8px;
}

.inline-status:hover {
    opacity: 0.85;
}

.inline-status:focus {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* Comments toggle */
.td-comments {
    text-align: center;
}

.btn-comments-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: 1px solid var(--gray-200);
    color: var(--gray-500);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-comments-toggle:hover {
    background: rgba(79, 70, 229, 0.06);
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.2);
}

.btn-comments-toggle svg {
    opacity: 0.6;
}

/* ── Expand rows ── */
.task-expand-row td {
    padding: 0 !important;
    border-right: none !important;
    background: var(--gray-50);
}

.expand-note-panel,
.expand-comments-panel {
    padding: 1rem 1.25rem;
    border-top: 2px solid var(--primary);
}

.expand-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.4rem;
}

.note-edit-area {
    width: 100%;
    min-height: 70px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    font: inherit;
    font-size: 0.84rem;
    color: var(--gray-800);
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.note-edit-area:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.expand-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Note history */
.note-history {
    margin-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    padding-top: 0.6rem;
}

.note-history-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: 0.4rem;
}

.note-history-entry {
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--gray-100);
}

.note-history-entry:last-child {
    border-bottom: none;
}

.note-history-meta {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-bottom: 0.15rem;
}

.note-history-text {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-style: italic;
    white-space: pre-wrap;
}

.note-history-empty {
    font-size: 0.78rem;
    color: var(--gray-300);
    font-style: italic;
    margin: 0;
}

/* Comments panel */
.comment-thread {
    margin-bottom: 0.75rem;
}

.comment-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.comment-entry:last-child {
    border-bottom: none;
}

.comment-meta {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-bottom: 0.15rem;
}

.comment-text {
    font-size: 0.84rem;
    color: var(--gray-700);
}

.comments-empty {
    font-size: 0.8rem;
    color: var(--gray-300);
    font-style: italic;
    margin: 0 0 0.5rem 0;
}

.comment-add {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.comment-input {
    flex: 1;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    font: inherit;
    font-size: 0.84rem;
    color: var(--gray-800);
    outline: none;
    transition: border-color 0.15s;
}

.comment-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.comment-input::placeholder {
    color: var(--gray-300);
}

.td-status {
    text-align: center;
    white-space: nowrap;
}

.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.td-actions {
    text-align: center;
}

.btn-task-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    border-radius: 3px;
    transition: var(--transition);
}

.btn-task-view:hover {
    background: rgba(79, 70, 229, 0.1);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--gray-500);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0 0 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin: 0;
}

/* Modals & Drawers */
.modal,
.drawer {
    display: none;
    position: fixed;
    z-index: 1000;
}

.modal.open,
.drawer.open {
    display: flex;
}

.modal {
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.drawer {
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: var(--white);
    flex-direction: column;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { right: -500px; }
    to { right: 0; }
}

.drawer.open {
    right: 0;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header,
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2,
.drawer-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.modal-close,
.drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--gray-500);
    border-radius: 4px;
    transition: var(--transition);
}

.modal-close:hover,
.drawer-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Form Styles */
.task-form,
.resolution-form {
    padding: 1.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.form-select,
.form-input,
.form-textarea {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-900);
    font-family: inherit;
    transition: var(--transition);
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Task Detail Styles */
.detail-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-section {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-entity h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.25rem;
}

.detail-entity-type {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

.detail-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0 0 0.75rem;
}

.detail-section p {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin: 0.25rem 0;
    line-height: 1.5;
}

.assignee-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.assignee-list li {
    font-size: 0.875rem;
    color: var(--gray-700);
    padding: 0.375rem 0;
}

.resolution-info {
    background: rgba(34, 197, 94, 0.05);
    border-left: 3px solid #22c55e;
    padding: 1rem;
    border-radius: 4px;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

/* Responsive */
@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .drawer {
        width: 100%;
        right: -100%;
    }
    
    @keyframes slideInRight {
        from { right: -100%; }
        to { right: 0; }
    }
}

@media (max-width: 768px) {
    .task-manager-header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-manager-actions {
        width: 100%;
        justify-content: space-between;
    }

    .task-manager-filters {
        flex-direction: column;
    }

    .filter-group,
    .filter-group.search {
        width: 100%;
    }

    .task-table {
        font-size: 0.8rem;
    }

    .task-table th,
    .task-table td {
        padding: 0.5rem;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95vw;
    }

    .drawer {
        width: 100%;
    }
}

/* Profile Task Widget Styles */
.profile-tasks-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

.profile-tasks-list .empty-state {
    padding: 1rem;
    margin: 0;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.profile-task-item:last-child {
    border-bottom: none;
}

.reports-empty p {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.reports-empty small {
    font-size: 0.6875rem;
}

.report-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    gap: 0.75rem;
    transition: var(--transition);
}

.report-item:last-child {
    border-bottom: none;
}

.report-item:hover {
    background: var(--gray-50);
}

.report-item input[type="checkbox"] {
    width: auto;
    flex-shrink: 0;
}

.report-item-info {
    flex: 1;
    min-width: 0;
}

.report-item-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-item-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.625rem;
    color: var(--gray-500);
    margin-top: 0.125rem;
}

.report-item-actions {
    display: flex;
    gap: 0.25rem;
}

.report-item-actions .btn {
    padding: 0.25rem 0.375rem;
    font-size: 0.625rem;
}

/* Email Attachments */
.email-attachments {
    margin-bottom: 0.5rem;
}

.saved-reports-attach {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.saved-reports-attach:empty::before {
    content: "No saved reports";
    font-size: 0.6875rem;
    color: var(--gray-400);
}

/* Drive Modal */
.drive-connect {
    text-align: center;
    padding: 1rem 0;
}

.drive-btn-icon {
    margin-right: 6px;
    flex-shrink: 0;
    vertical-align: middle;
}

.drive-connect p {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.drive-user {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.drive-user strong {
    color: var(--gray-800);
}

.drive-reports,
.drive-saved-reports {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.drive-saved-reports {
    max-height: 150px;
    overflow-y: auto;
}

/* Preferences Modal */
.preference-section {
    margin-bottom: 1.25rem;
}

.preference-section h3 {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.625rem;
}

/* Report Options Checkboxes */
.section-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-item:hover {
    color: var(--gray-900);
}

/* Smaller modal for export options */
.modal-sm .modal-content {
    max-width: 400px;
}

/* Report Preview */
.report-preview {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-top: 1rem;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    padding: 0.25rem 0;
}

.preview-label {
    color: var(--gray-500);
}

.preview-value {
    font-weight: 500;
    color: var(--gray-800);
}

/* Responsive for modals */
@media (max-width: 480px) {
    .modal-content {
        max-height: 90vh;
    }
    
    .reports-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .reports-search input {
        min-width: auto;
        width: 100%;
    }
    
    .reports-actions {
        justify-content: flex-end;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Sync spinner animation */
.sync-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================
   CUSTOM TOOLTIPS
   ==========================================*/
/* Tooltip container */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

/* Tooltip text bubble - light transparent blue, smaller text, normal case */
[data-tooltip]::before {
    content: attr(data-tooltip);
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.4rem 0.6rem;
    background: rgba(59, 130, 246, 0.12);
    color: var(--gray-600);
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: 1.5;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    max-width: 220px;
    text-align: left;
    border-radius: 6px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}

/* Tooltip arrow - matching light blue */
[data-tooltip]::after {
    content: '';
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(59, 130, 246, 0.15);
}

/* Show on hover */
[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Table cell tooltips - position below instead of above */
#dataTable td[data-tooltip]::before,
#dataTable td input[data-tooltip]::before,
#dataTable td select[data-tooltip]::before,
#dataTable th[data-tooltip]::before {
    bottom: auto;
    top: calc(100% + 6px);
}

#dataTable td[data-tooltip]::after,
#dataTable td input[data-tooltip]::after,
#dataTable td select[data-tooltip]::after,
#dataTable th[data-tooltip]::after {
    bottom: auto;
    top: calc(100% + 0px);
    border-top-color: transparent;
    border-bottom-color: rgba(59, 130, 246, 0.15);
}

/* Table header tooltips */
#dataTable th[data-tooltip] {
    position: relative;
    cursor: help;
}

/* Help icon for labeled tooltips */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--gray-200);
    color: var(--gray-600);
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    margin-left: 4px;
    cursor: help;
}

.help-icon:hover {
    background: var(--primary);
    color: white;
}

/* Info labels in table headers */
.th-with-help {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Tooltip on left for elements near right edge */
[data-tooltip-left]::before {
    left: auto;
    right: 0;
    transform: none;
}

[data-tooltip-left]::after {
    left: auto;
    right: 10px;
    transform: none;
}

/* Keyboard shortcut hints */
.shortcut-hint {
    font-size: 0.65rem;
    color: var(--gray-400);
    margin-left: 0.5rem;
}

/* ==========================================
   EMBEDDED MODE (inside dashboard iframe)
   ========================================== */
.embedded body {
    background: transparent;
    font-size: 0.8125rem;
}

.embedded .app-container {
    min-height: 0;
}

/* Hide logo, profile dropdown, footer, auth modals when embedded */
.embedded .logo,
.embedded .profile-dropdown,
.embedded .footer,
.embedded .auth-modal,
.embedded #loadingOverlay {
    display: none !important;
}

/* Header becomes a compact toolbar */
.embedded .header {
    background: transparent;
    border-bottom: none;
    padding: 0.5rem 1.25rem;
    position: relative;
}

.embedded .header-content {
    max-width: 100%;
    justify-content: flex-end;
}

.embedded .header-info {
    gap: 0.75rem;
}

.embedded .quarter-select {
    border-radius: 8px;
    border-color: rgba(0,0,0,0.07);
    padding: 0.25rem 0.625rem;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.embedded .rate-status {
    font-size: 0.6875rem;
}

/* Main content — full width, no max-width cap */
.embedded .main-content {
    max-width: 100%;
    padding: 1.25rem;
}

/* Cards — match dashboard glassmorphism */
.embedded .card {
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 4px 16px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s cubic-bezier(0.4,0,0.2,1);
}

.embedded .card:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.04), 0 8px 28px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);
}

.embedded .card h2 {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--gray-800);
    margin-bottom: 0.875rem;
    padding-bottom: 0.625rem;
    border-bottom: 2px solid #f1f5f9;
}

/* Buttons — match dashboard style */
.embedded .btn {
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.embedded .btn:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.embedded .btn:active {
    transform: translateY(0);
}

.embedded .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 1px 4px rgba(79,70,229,0.2);
}

.embedded .btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}

/* Form controls — inherit base usheet-matching styles */
.embedded .config-panel input,
.embedded .config-panel select {
    border-color: rgba(0,0,0,0.07);
    border-radius: 6px;
}

/* Config panel — match card style */
.embedded .config-panel {
    background: rgba(255,255,255,0.88);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 4px 16px rgba(0,0,0,0.04);
    padding: 1.25rem;
}

/* Tables — already styled by base; just override for embedded specifics */
.embedded #dataTable tbody tr:hover,
.embedded #ratesTable tbody tr:hover {
    background: #f0f4ff;
}

/* Export section — match card look */
.embedded .export-section {
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.88);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 4px 16px rgba(0,0,0,0.04);
}

/* Totals row */
.embedded .totals-row {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.embedded .totals-row td {
    font-weight: 700;
}

/* Section header — match dashboard card-header */
.embedded .section-header {
    padding-bottom: 0.625rem;
    margin-bottom: 0.875rem;
    border-bottom: 2px solid #f1f5f9;
}

.embedded .section-header h2 {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}

/* Action buttons — match dashboard toolbar buttons */
.embedded .action-buttons {
    gap: 0.375rem;
}

.embedded .action-buttons .btn {
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.embedded .action-buttons .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 1px 4px rgba(79,70,229,0.2);
}

.embedded .action-buttons .btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}

/* Table container — border handled by base */
.embedded .table-container {
    border: none;
}

/* Rate display — compact */
.embedded .rate-display {
    color: var(--primary);
    font-weight: 600;
}

/* Rates section — match card */
.embedded .rates-section {
    background: rgba(255,255,255,0.88);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 4px 16px rgba(0,0,0,0.04);
}

/* Rates filter — match dashboard filter style */
.embedded .rates-filter input,
.embedded .rates-filter select {
    border-radius: 8px;
    height: 28px;
    font-size: 0.6875rem;
}

/* Config grid labels — match dashboard form labels */
.embedded .form-group label {
    text-transform: none;
    font-weight: 600;
    font-size: 0.6875rem;
    color: #64748b;
    letter-spacing: 0;
}

/* Config inputs — taller, rounded */
.embedded .config-panel input,
.embedded .config-panel select {
    border-radius: 8px;
    height: 30px;
    border-color: rgba(0,0,0,0.07);
}

/* Tax amount styling — stronger colors */
.embedded .tax-amount.positive {
    color: #dc2626;
    font-weight: 700;
}

.embedded .tax-amount.negative {
    color: #16a34a;
    font-weight: 700;
}
