/* CSS Variables - Minimalist Ocean Blue Theme */
:root {
    --primary: #5b9bd5;
    --primary-dark: #4a8bc4;
    --primary-light: #a8d1f0;
    --primary-subtle: #e8f4fc;
    
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    
    --success: #66bb6a;
    --warning: #ffb74d;
    --danger: #ef5350;
    
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    
    --radius-sm: 3px;
    --radius: 6px;
    --radius-lg: 8px;
    
    --transition: all 0.15s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
}

/* Auth Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.auth-modal.hidden {
    display: none;
}

/* Modal Overlay - for forgot password and verification modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.auth-modal-content {
    background: var(--white);
    border-radius: 0;
    padding: 1.5rem 2rem;
    max-width: 360px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: none;
    position: relative;
}

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

/* Brand Icon - bearded guy */
.auth-brand-icon {
    display: block;
    margin: 0 auto;
    width: 70px;
    height: 70px;
    object-fit: contain;
}

/* Brand Text Logo - logistiXnerd */
.auth-brand-text {
    display: block;
    margin: 0.25rem auto 0.5rem auto;
    width: 140px;
    height: auto;
    object-fit: contain;
}

/* IFTA Wizard Title - much smaller */
.auth-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    color: #333333;
    margin: 0 0 0.5rem 0;
    padding-top: 0;
    letter-spacing: 0.3px;
}

/* Tagline - smaller */
.auth-tagline {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.55rem;
    font-weight: 400;
    color: #888888;
    line-height: 1.5;
    margin: 0;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

/* Auth Mode Toggle */
.auth-mode-toggle {
    display: flex;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 3px;
    margin-bottom: 1.25rem;
}

.auth-mode-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-mode-btn.active {
    background: #ffffff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.auth-mode-btn:hover:not(.active) {
    color: #333;
}

/* Optional label */
.optional {
    font-weight: 400;
    color: #aaa;
    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-radius: 4px;
    border: 1px solid var(--gray-300);
    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.75rem;
    font-size: 0.75rem;
    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;
}

.auth-form .form-group input {
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
}

.auth-form .form-group input.error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.auth-form .form-group input.error:focus {
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.auth-error {
    color: #dc3545;
    font-size: 0.625rem;
    margin-top: 0.25rem;
}

.forgot-password {
    display: block;
    text-align: right;
    font-size: 0.6875rem;
    color: var(--primary);
    text-decoration: none;
    margin-top: -0.25rem;
    margin-bottom: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.forgot-password:hover {
    text-decoration: underline;
}

.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;
}

/* 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;
}

/* 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-200);
    padding: 0.625rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1280px;
    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: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.25px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Quarter Dropdown in Header - Minimalist Button Style */
.quarter-dropdown {
    position: relative;
}

.quarter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--primary-subtle);
    color: var(--primary-dark);
    padding: 0.3rem 0.625rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.6875rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    min-width: 70px;
}

.quarter-select:hover {
    background: var(--primary-light);
    color: var(--white);
}

.quarter-select:focus {
    outline: none;
    background: var(--primary);
    color: var(--white);
}

.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);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--gray-200);
}

.card h2 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.card h2 svg {
    display: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.3rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    background: var(--white);
}

.btn svg {
    display: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

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

.btn-icon {
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

/* 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.2rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input, select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-800);
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-subtle);
}

input::placeholder {
    color: var(--gray-400);
}

/* Config Panel */
.config-panel {
    background: var(--white);
    padding: 0.875rem;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

/* 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;
}

/* Data Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

#dataTable, #ratesTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

#dataTable th, #ratesTable th {
    background: var(--gray-50);
    padding: 0.5rem 0.375rem;
    text-align: left;
    font-weight: 500;
    color: var(--gray-600);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

#dataTable td, #ratesTable td {
    padding: 0.375rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    color: var(--gray-700);
}

#dataTable tbody tr:hover, #ratesTable tbody tr:hover {
    background: var(--gray-50);
}

#dataTable input, #dataTable select {
    padding: 0.25rem 0.375rem;
    font-size: 0.75rem;
    min-width: 60px;
    border-color: var(--gray-200);
}

#dataTable input:focus, #dataTable select:focus {
    border-color: var(--primary);
}

.col-jurisdiction { min-width: 110px; }
.col-miles, .col-taxable, .col-gallons { min-width: 70px; }
.col-rate { min-width: 60px; }
.col-taxable-gal, .col-net-gal { min-width: 70px; }
.col-tax { min-width: 75px; }
.col-actions { min-width: 40px; text-align: center; }

/* Minimalist Totals Row */
.totals-row {
    background: var(--gray-50);
}

.totals-row td {
    font-weight: 500;
    font-size: 0.6875rem;
    color: var(--gray-700);
    border-bottom: none;
    padding: 0.375rem;
}

.tax-amount {
    font-weight: 600;
}

.tax-amount.positive {
    color: var(--danger);
}

.tax-amount.negative {
    color: var(--success);
}

.rate-display {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.6875rem;
    color: var(--gray-500);
}

.delete-row {
    background: transparent;
    color: var(--gray-400);
    border: none;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.6875rem;
}

.delete-row:hover {
    color: var(--danger);
    background: rgba(239, 83, 80, 0.08);
}

/* Inline Summary Bar */
.inline-summary {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.625rem 0.75rem;
    margin-top: 0.625rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 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: var(--primary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
}

.inline-summary .summary-item.highlight .summary-label {
    color: rgba(255, 255, 255, 0.8);
}

.inline-summary .summary-item.highlight .summary-value {
    color: var(--white);
}

/* Export Section - Compact */
.export-section {
    background: var(--white);
    padding: 0.625rem 1rem;
}

.export-section h2 {
    display: none;
}

.export-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.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;
}

.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-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

#ratesTable th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--gray-50);
}

/* Footer */
.footer {
    background: var(--gray-800);
    color: var(--gray-400);
    padding: 0.75rem 1.5rem;
    text-align: center;
    font-size: 0.6875rem;
}

.footer a {
    color: var(--primary-light);
    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.5rem;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay p {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 1001;
}

.toast {
    background: var(--white);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    animation: slideIn 0.2s ease;
    max-width: 280px;
    font-size: 0.75rem;
    border: 1px solid var(--gray-200);
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

.toast.info {
    border-left: 3px solid var(--primary);
}

@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;
    }

    .card {
        padding: 0.75rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .config-grid {
        grid-template-columns: 1fr 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%;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-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(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 600;
}

.profile-name {
    font-size: 0.6875rem;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s ease;
    z-index: 200;
}

.profile-dropdown.open .profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-menu-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-user-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--gray-800);
}

.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;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.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(239, 83, 80, 0.08);
}

.menu-badge {
    background: var(--primary);
    color: white;
    font-size: 0.5625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    font-weight: 600;
}

.profile-menu-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 0.25rem 0;
}

/* Export divider */
.export-divider {
    width: 1px;
    height: 20px;
    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);
    border-radius: var(--radius-lg);
    max-width: 420px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-lg {
    max-width: 640px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 1.25rem;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body textarea {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    resize: vertical;
    font-family: inherit;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-subtle);
}

.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: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

/* 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);
}

.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-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 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;
    }
}
