/* Benefits Management Styles - SelectHCM Branding */

@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@400;500;600;700&family=Merriweather:wght@400;700&display=swap');

:root {
    /* SelectHCM Brand Colors */
    --primary-blue: #98B4A0;  /* Changed to sage green */
    --primary-dark: #54595F;
    --text-gray: #7A7A7A;
    --green-accent: #61CE70;
    --yellow-accent: #F7CE5F;
    --orange-accent: #F68C4A;
    --sage-green: #98B4A0;
    --near-black: #1C231A;
    --white: #FFFFFF;

    /* Semantic colors */
    --success-color: #61CE70;
    --warning-color: #F7CE5F;
    --danger-color: #F68C4A;

    /* Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #7A7A7A;
    --gray-600: #54595F;
    --gray-700: #374151;
    --gray-800: #1C231A;
    --gray-900: #111827;
}

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

body {
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-100);
    color: var(--primary-dark);
    line-height: 1.6;
    font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 700;
    color: var(--near-black);
}

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    max-width: 420px;
    margin: 80px auto;
    padding: 48px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* Logo Styles */
.login-logo {
    display: block;
    max-width: 220px;
    height: auto;
    margin: 0 auto 16px;
}

.register-logo {
    display: block;
    max-width: 220px;
    height: auto;
    margin: 0 auto 12px;
}

.header-logo {
    height: 36px;
    width: auto;
}

.login-container h1 {
    text-align: center;
    color: var(--near-black);
    margin-bottom: 8px;
    font-size: 28px;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-dark);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Libre Franklin', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(110, 193, 228, 0.15);
}

.error-message {
    color: var(--orange-accent);
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
}

.success-message {
    color: var(--green-accent);
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
}

/* Checkbox styling */
.checkbox-group {
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

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

.help-text {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-gray);
    margin-left: 30px;
}

/* Buttons */
.btn {
    padding: 12px 28px;
    border: 2px solid transparent;
    border-radius: 28px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--near-black);
    color: var(--white);
    border-color: var(--near-black);
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--white);
    color: var(--near-black);
}

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

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

/* Registration Screen */
#register-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 50%, rgba(110, 193, 228, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

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

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

.register-header h1 {
    color: var(--near-black);
    margin-bottom: 8px;
    font-size: 32px;
    font-family: 'Merriweather', serif;
}

.register-header .subtitle {
    color: var(--text-gray);
    font-size: 16px;
    font-weight: 500;
}

.register-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 48px 40px;
    animation: slideUp 0.4s ease-out;
}

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

.register-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

.register-loading p {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.register-loading p::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.register-error {
    text-align: center;
    padding: 40px 20px;
}

.register-error h2 {
    color: var(--danger-color);
    margin-bottom: 16px;
    font-size: 24px;
    font-family: 'Merriweather', serif;
}

.register-error p {
    color: var(--text-gray);
    margin-bottom: 28px;
    font-size: 15px;
    line-height: 1.6;
}

.register-email-display {
    background: linear-gradient(135deg, var(--gray-50), rgba(110, 193, 228, 0.08));
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 28px;
    text-align: center;
}

.register-email-display label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}

.register-email-display .email-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--near-black);
    margin: 0;
    word-break: break-word;
}

#register-form .form-group {
    margin-bottom: 20px;
}

#register-form .form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
}

#register-form .form-group input {
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 15px;
}

#register-form .help-text {
    margin-left: 0;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-gray);
}

#register-form .error-message {
    margin-top: 20px;
    margin-bottom: 0;
    padding: 12px;
    background: rgba(246, 140, 74, 0.1);
    border-radius: 8px;
    text-align: left;
}

#register-form .error-message:empty {
    display: none;
}

#register-form .btn-primary {
    margin-top: 8px;
    padding: 16px 24px;
    font-size: 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--near-black), #2a3328);
    transition: all 0.3s ease;
}

#register-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(28, 35, 26, 0.25);
    background: linear-gradient(135deg, #2a3328, var(--near-black));
    color: var(--white);
}

.register-success {
    text-align: center;
    padding: 20px 0;
}

.register-success .success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--success-color), #4eb85c);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 28px;
    box-shadow: 0 8px 24px rgba(97, 206, 112, 0.35);
    animation: successPop 0.4s ease-out;
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.register-success h2 {
    color: var(--near-black);
    margin-bottom: 16px;
    font-size: 26px;
    font-family: 'Merriweather', serif;
}

.register-success p {
    color: var(--text-gray);
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.6;
}

.register-success strong {
    color: var(--near-black);
    font-weight: 600;
    background: rgba(110, 193, 228, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.register-success .btn {
    margin-top: 28px;
    padding: 14px 32px;
}

.btn-full {
    width: 100%;
}

/* Modal subtitle */
.modal-subtitle {
    color: var(--text-gray);
    font-size: 14px;
    margin: -8px 0 20px 0;
}

/* App Header */
.app-header {
    background: var(--near-black);
    padding: 12px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--sage-green);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
}

.header-brand:hover {
    opacity: 0.9;
}

.header-logo {
    height: 28px;
    width: auto;
}

.header-title {
    font-family: 'Merriweather', serif;
    font-size: 21px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.3px;
    line-height: 28px;
    position: relative;
    top: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Service Tabs Bar */
.service-tabs-bar {
    display: flex;
    gap: 4px;
    padding: 0 32px;
    background: #2a3328;
}

.service-tab {
    padding: 14px 28px;
    cursor: pointer;
    border: none;
    border-radius: 10px 10px 0 0;
    transition: all 0.2s ease;
    font-family: 'Libre Franklin', sans-serif;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    top: 2px;
}

.service-tab.active {
    background: var(--gray-50);
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.service-tab:not(.active) {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
}

.service-tab:not(.active):hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

/* Company Context Bar (for company users with multiple companies) */
.company-context-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 32px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}

.company-context-bar label {
    color: var(--text-gray);
    font-weight: 500;
}

.company-context-bar select {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 6px 28px 6px 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
    min-width: 200px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A7A7A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.company-context-bar select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.15);
}

/* Placeholder Views (for coming soon features) */
.placeholder-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
    min-height: 400px;
}

.placeholder-icon {
    width: 100px;
    height: 100px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: var(--text-gray);
}

.placeholder-view h2 {
    margin-bottom: 12px;
    color: var(--near-black);
}

.placeholder-view p {
    color: var(--text-gray);
    font-size: 16px;
    margin-bottom: 8px;
}

.placeholder-hint {
    font-size: 14px !important;
    color: var(--gray-400) !important;
    max-width: 400px;
}

#user-display {
    color: var(--gray-300);
    font-size: 14px;
    font-weight: 500;
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 8px 4px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    color: var(--white);
}

.user-menu-trigger:hover {
    opacity: 0.85;
}

.user-icon {
    opacity: 0.9;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.user-menu.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

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

.dropdown-header {
    padding: 16px;
    background: var(--gray-50);
}

.dropdown-email {
    font-size: 13px;
    color: var(--text-gray);
    word-break: break-all;
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-200);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--primary-dark);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--gray-50);
}

.dropdown-item svg {
    color: var(--text-gray);
    flex-shrink: 0;
}

.dropdown-item-danger {
    color: var(--danger-color);
}

.dropdown-item-danger svg {
    color: var(--danger-color);
}

.dropdown-item-danger:hover {
    background: rgba(246, 140, 74, 0.08);
}

/* Navigation */
.app-nav {
    background: #F9F9F9;
    padding: 0 32px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 18px 24px;
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: -2px;
}

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

.nav-btn.active {
    color: var(--near-black);
    border-bottom-color: var(--sage-green);
}

/* Main Content */
.app-main {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.view h2 {
    margin-bottom: 28px;
    color: var(--near-black);
    font-size: 24px;
}

/* ================================================
   DASHBOARD - Refined Admin Dashboard
   ================================================ */

#dashboard-view {
    animation: fadeInUp 0.4s ease-out;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dashboard-header h2 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.dashboard-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

.last-import-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--gray-200);
    font-size: 13px;
}

.last-import-label {
    color: var(--text-gray);
}

.last-import-value {
    font-weight: 600;
    color: var(--near-black);
}

/* Stats Row - Top Section */
.dashboard-stats-row {
    display: flex;
    gap: 24px;
    margin-bottom: 28px;
    align-items: stretch;
}

.stats-group {
    display: flex;
    gap: 16px;
    flex: 1;
}

.stat-card {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-200);
    flex: 1;
    min-width: 120px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.stat-card.stat-pending {
    border-left: 4px solid var(--orange-accent);
}

.stat-card.stat-completed {
    border-left: 4px solid var(--green-accent);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
    line-height: 1.1;
}

.stat-label {
    color: var(--text-gray);
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Pending by Type - Inline Stats */
.pending-by-type {
    display: flex;
    gap: 12px;
    background: var(--white);
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    align-items: center;
}

.type-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    min-width: 90px;
}

.type-stat.enrollment {
    background: rgba(97, 206, 112, 0.1);
    border-left: 3px solid var(--green-accent);
}

.type-stat.waived {
    background: rgba(128, 128, 128, 0.1);
    border-left: 3px solid #888;
}

.type-stat.modification {
    background: rgba(247, 206, 95, 0.12);
    border-left: 3px solid var(--yellow-accent);
}

.type-stat.termination {
    background: rgba(246, 140, 74, 0.1);
    border-left: 3px solid var(--orange-accent);
}

.type-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
    line-height: 1;
}

.type-label {
    font-size: 10px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

/* Companies Section */
.dashboard-companies {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(180deg, var(--gray-50), var(--white));
}

.section-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
}

.dashboard-companies .data-table-container {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Companies Table Styling */
#companies-table th:nth-child(1) { width: 40%; }
#companies-table th:nth-child(2),
#companies-table th:nth-child(3),
#companies-table th:nth-child(4) { width: 15%; text-align: center; }
#companies-table th:nth-child(5) { width: 15%; text-align: center; }

#companies-table td:nth-child(2),
#companies-table td:nth-child(3),
#companies-table td:nth-child(4),
#companies-table td:nth-child(5) { text-align: center; }

#companies-table tr.has-pending {
    background: rgba(246, 140, 74, 0.03);
}

#companies-table tr.has-pending:hover {
    background: rgba(110, 193, 228, 0.08);
}

#companies-table tr.no-pending {
    opacity: 0.7;
}

#companies-table tr.no-pending:hover {
    opacity: 1;
    background: var(--gray-50);
}

.zero-count {
    color: var(--gray-400);
    font-size: 13px;
}

.pending-total {
    color: var(--orange-accent);
    font-size: 16px;
}

.zero-total {
    color: var(--gray-400);
}

/* Legacy section styles (for other pages) */
.section {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-200);
}

.section h3 {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
}

/* Filters */
.filters {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
}

.filters input,
.filters select {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Libre Franklin', sans-serif;
    transition: border-color 0.2s;
}

.filters input {
    flex: 1;
    max-width: 320px;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.filters .btn {
    width: auto;
    padding: 12px 24px;
}

/* Data Tables */
.data-table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: background-color 0.15s;
}

.data-table tbody tr:hover {
    background: rgba(110, 193, 228, 0.06);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Change Type Badges */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-new, .badge-enrollment {
    background: rgba(97, 206, 112, 0.15);
    color: #3d8b47;
}

.badge-modified, .badge-modification {
    background: rgba(247, 206, 95, 0.25);
    color: #8b7117;
}

.badge-terminated, .badge-termination {
    background: rgba(246, 140, 74, 0.15);
    color: #b85a2b;
}

.badge-waived {
    background: rgba(128, 128, 128, 0.15);
    color: #5a5a5a;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.pagination button {
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-family: 'Libre Franklin', sans-serif;
    transition: all 0.2s;
}

.pagination button:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.pagination button.active {
    background: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(28, 35, 26, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--near-black);
}

.modal-small {
    max-width: 420px;
}

.modal-small h3 {
    margin-bottom: 24px;
    color: var(--near-black);
    font-size: 20px;
}

.modal-medium {
    max-width: 600px;
}

.modal-medium h3 {
    margin-bottom: 8px;
    color: var(--near-black);
    font-size: 20px;
}

.modal-medium .modal-subtitle {
    margin-bottom: 24px;
}

/* Form Layout - Two Column */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
}

.form-group-half {
    flex: 1;
    min-width: 0;
}

.field-hint {
    display: block;
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* Access Section for Company Users */
.access-section {
    margin-bottom: 24px;
}

.access-group {
    margin-bottom: 20px;
}

.access-group:last-child {
    margin-bottom: 0;
}

.access-group > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-dark);
    font-size: 14px;
}

.access-section > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-dark);
    font-size: 14px;
}

.access-hint {
    font-size: 12px;
    color: var(--text-gray);
    margin: 0 0 8px 0;
}

.checkbox-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    padding: 8px;
}

.access-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: background-color 0.15s;
}

.access-checkbox-item:hover {
    background: var(--gray-100);
}

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

.access-checkbox-item label {
    font-size: 14px;
    color: var(--primary-dark);
    cursor: pointer;
    flex: 1;
    margin: 0;
}

/* Protected checkboxes (cannot be unchecked by company admins) */
.access-checkbox-item.protected {
    background: var(--gray-100);
    opacity: 0.8;
}

.access-checkbox-item.protected input[type="checkbox"] {
    cursor: not-allowed;
}

.access-checkbox-item.protected label {
    cursor: not-allowed;
    color: var(--text-gray);
}

.protected-hint {
    font-size: 11px;
    color: var(--text-gray);
    font-style: italic;
}

.optional-label {
    font-weight: 400;
    color: var(--text-gray);
    font-size: 12px;
}

.empty-hint {
    color: var(--text-gray);
    font-size: 13px;
    font-style: italic;
    text-align: center;
    padding: 16px;
    margin: 0;
}

.text-muted {
    color: var(--text-gray);
    font-style: italic;
}

.service-desc {
    display: block;
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 400;
    margin-top: 2px;
}

/* Companies page */
.companies-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding: 0 24px;
}

.companies-header-left h2 {
    margin: 0 0 4px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-dark);
}

.companies-subtitle {
    margin: 0;
    color: var(--text-gray);
    font-size: 14px;
}

#companies-view .table-container {
    margin: 0 24px;
}

/* Companies table */
.companies-table .company-name-cell {
    font-weight: 500;
}

.companies-table .ein-cell,
.companies-table .legal-id-cell {
    font-family: monospace;
    color: var(--text-gray);
    font-size: 13px;
}

/* Edit column - first column for editing company details */
.companies-table .edit-col {
    width: 40px;
    padding: 0;
}

.companies-table .edit-cell {
    text-align: center;
    padding: 8px 4px;
}

/* Services header group - spans all service columns */
.companies-table .services-header-group {
    background: var(--primary-blue);
    color: white;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 2px solid var(--gray-200);
}

/* Service checkbox cells */
.companies-table .service-checkbox-cell {
    background: rgba(110, 193, 228, 0.05);
    border-left: 1px solid var(--gray-100);
    padding: 8px 12px;
    min-width: 140px;
}

.companies-table .service-checkbox-cell:first-of-type {
    border-left: 2px solid var(--gray-200);
}

.companies-table .service-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.companies-table .service-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.companies-table .service-toggle .service-name {
    font-size: 13px;
    color: var(--text-gray);
    white-space: nowrap;
}

.companies-table .service-toggle input:checked + .service-name {
    color: var(--primary-dark);
    font-weight: 500;
}

.companies-table .service-checkbox-cell.saved {
    background-color: rgba(76, 175, 80, 0.15);
    transition: background-color 0.3s ease;
}

/* Company/Service hints in access checkboxes */
.company-service-hint {
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 400;
}

.company-service-hint.no-services {
    color: var(--danger-red);
}

.access-checkbox-item.no-services {
    opacity: 0.5;
}

.access-checkbox-item.no-services label {
    cursor: not-allowed;
}

.service-company-hint {
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 400;
    margin-left: 4px;
}

/* Company Access List (nested company -> services) */
.company-access-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.company-access-block {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px;
    background: var(--gray-50);
}

.company-access-block.no-services {
    opacity: 0.6;
}

.company-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.company-header-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.company-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.company-label strong {
    font-size: 14px;
}

.no-services-hint {
    font-size: 12px;
    color: var(--text-gray);
    font-style: italic;
}

.company-services-list {
    margin-left: 26px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 12px;
    border-left: 2px solid var(--gray-200);
}

.service-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.service-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.service-checkbox-item label {
    font-size: 13px;
    cursor: pointer;
}

.protected-hint {
    font-size: 11px;
    color: var(--text-gray);
    font-style: italic;
    margin-left: 4px;
}

/* User Type Badges */
.badge-internal {
    background-color: var(--gray-200);
    color: var(--primary-dark);
}

.badge-company {
    background-color: #E3F2FD;
    color: #1565C0;
}

/* Access Cell in Users Table */
.access-cell {
    font-size: 13px;
    max-width: 200px;
}

.text-muted {
    color: var(--text-gray);
    font-style: italic;
}

.text-warning {
    color: var(--orange-accent);
    font-weight: 500;
}

/* ===================== */
/* Administration Page   */
/* ===================== */

.admin-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.admin-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

/* Back button */
.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-back svg {
    stroke: currentColor;
}

/* Admin Sub-Navigation */
.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-200);
}

.admin-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-nav-btn:hover {
    border-color: var(--gray-300);
    color: var(--primary-dark);
}

.admin-nav-btn.active {
    background: var(--near-black);
    border-color: var(--near-black);
    color: var(--white);
}

.admin-nav-btn.active svg {
    stroke: var(--white);
}

.admin-nav-btn svg {
    flex-shrink: 0;
    stroke: var(--text-gray);
    transition: stroke 0.2s ease;
}

.admin-nav-btn:hover svg {
    stroke: var(--primary-dark);
}

/* Admin Content Sections */
.admin-content {
    /* Container for admin sections */
}

.admin-section {
    animation: fadeIn 0.2s ease-out;
}

.admin-section h3 {
    font-size: 18px;
    margin: 0 0 4px 0;
}

.admin-section h4 {
    font-size: 16px;
    margin: 0;
}

/* ===================== */
/* User Management Page  */
/* ===================== */

.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.users-header-left {
    min-width: 0;
}

.users-header h2 {
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
}

.users-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
    flex-shrink: 0;
}

.users-subtitle {
    color: var(--text-gray);
    font-size: 14px;
    margin: 0;
    white-space: nowrap;
}

.users-header .btn-primary {
    width: auto;
    padding: 10px 20px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.users-header .btn-primary svg {
    flex-shrink: 0;
}

/* User Sections */
.users-section {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.users-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.users-section-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--near-black);
}

.users-count {
    background: var(--gray-200);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
}

.users-section-desc {
    color: var(--text-gray);
    font-size: 13px;
    margin: 0 0 16px 0;
}

/* Users Table */
.table-container {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.users-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.users-table tbody tr {
    border-bottom: 1px solid var(--gray-200);
}

.users-table tbody tr:last-child {
    border-bottom: none;
}

.users-table tbody tr:hover {
    background: var(--gray-50);
}

.users-table td {
    padding: 14px 16px;
    vertical-align: middle;
}

.user-name-cell .user-name {
    font-weight: 500;
    color: var(--near-black);
}

.user-name-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notification-indicator {
    display: inline-flex;
    align-items: center;
    color: var(--sage-green);
    opacity: 0.8;
}

.notification-indicator:hover {
    opacity: 1;
}

.last-login-cell {
    color: var(--text-gray);
    font-size: 13px;
}

.actions-col {
    width: 120px;
    text-align: right;
}

.actions-cell {
    text-align: right;
    white-space: nowrap;
}

/* Status & Role Badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: rgba(97, 206, 112, 0.15);
    color: #2E7D32;
}

.status-badge.pending {
    background: rgba(247, 206, 95, 0.25);
    color: #E65100;
}

.status-badge.inactive {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-gray);
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--text-gray);
}

.role-badge.admin {
    background: var(--primary-blue);
    color: var(--white);
}

/* Icon Buttons */
.btn-icon {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-gray);
    border-radius: 6px;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--primary-dark);
}

.btn-icon-danger:hover {
    background: rgba(246, 140, 74, 0.1);
    color: var(--orange-accent);
}

/* Company Groups */
.company-group {
    margin-top: 24px;
}

.company-group:first-child {
    margin-top: 0;
}

.company-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-blue);
}

.company-group-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 0;
}

.company-group-count {
    font-size: 12px;
    color: var(--text-gray);
}

.empty-row {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-gray);
    font-style: italic;
}

.empty-message {
    text-align: center;
    padding: 24px;
    color: var(--text-gray);
    font-style: italic;
    margin: 0;
}

/* Action buttons in tables */
.btn-sm {
    padding: 8px 14px;
    font-size: 11px;
    border-radius: 20px;
}

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

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

.btn-warning {
    background-color: var(--yellow-accent);
    color: var(--near-black);
    border-color: var(--yellow-accent);
}

.btn-warning:hover {
    background-color: var(--white);
    color: var(--near-black);
    border-color: var(--yellow-accent);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* Employee Detail */
.employee-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-200);
}

.employee-header h3 {
    font-size: 26px;
    margin-bottom: 10px;
}

.employee-meta {
    display: flex;
    gap: 28px;
    color: var(--text-gray);
    font-size: 14px;
}

.detail-section {
    margin-bottom: 28px;
}

.detail-section h4 {
    margin-bottom: 14px;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
    font-size: 16px;
}

/* Plan Period Groups */
.plan-period-group {
    margin-bottom: 20px;
}

.plan-period-group:last-child {
    margin-bottom: 0;
}

.plan-period-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--gray-100);
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--gray-200);
}

.plan-period-label {
    font-weight: 600;
    color: var(--near-black);
    font-size: 13px;
}

.plan-period-dates {
    color: var(--text-gray);
    font-size: 13px;
}

.current-period .plan-period-header {
    background: rgba(97, 206, 112, 0.1);
    border-bottom-color: rgba(97, 206, 112, 0.3);
}

.current-period .plan-period-label {
    color: var(--green-accent);
}

.past-period .plan-period-header {
    background: var(--gray-50);
}

.past-period .plan-period-label {
    color: var(--text-gray);
}

.plan-period-group .data-table {
    border-radius: 0 0 8px 8px;
}

.plan-period-cell {
    font-size: 12px;
    color: var(--text-gray);
}

/* Waived benefit rows */
.waived-row {
    background: var(--gray-50);
    opacity: 0.75;
}

.waived-row td {
    color: var(--text-gray);
}

/* Eligibility indicators */
.eligible-yes {
    color: var(--green-accent);
    font-weight: 600;
}

.eligible-no {
    color: var(--orange-accent);
    font-weight: 600;
}

/* Clickable rows */
.clickable {
    cursor: pointer;
}

/* Loading */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-gray);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-gray);
    font-size: 15px;
}

/* SSN masking */
.ssn-masked {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* Checkbox styling in tables */
.data-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.data-table th input[type="checkbox"] {
    margin-top: 2px;
}

/* Completed/Pending status badges */
.badge-pending {
    background: rgba(247, 206, 95, 0.25);
    color: #8b7117;
}

.badge-completed {
    background: rgba(97, 206, 112, 0.15);
    color: #3d8b47;
}

/* User role badges */
.badge-admin {
    background: linear-gradient(135deg, rgba(110, 193, 228, 0.2), rgba(110, 193, 228, 0.35));
    color: #1a6a8a;
    border: 1px solid rgba(110, 193, 228, 0.4);
    font-weight: 700;
}

.badge-user {
    background: rgba(152, 180, 160, 0.18);
    color: #4a5e4f;
    border: 1px solid rgba(152, 180, 160, 0.3);
}

/* Notification status badges */
.badge-notif-on {
    background: rgba(97, 206, 112, 0.15);
    color: #3d8b47;
    border: 1px solid rgba(97, 206, 112, 0.3);
}

.badge-notif-off {
    background: var(--gray-100);
    color: var(--gray-400);
    border: 1px solid var(--gray-200);
}

.col-center {
    text-align: center;
}

/* ================================================
   USERS PAGE - Premium Admin Console Styling
   ================================================ */

#users-view {
    animation: fadeInUp 0.4s ease-out;
}

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

#users-view h2 {
    display: flex;
    align-items: center;
    gap: 14px;
}

#users-view h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

#users-view .filters {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--gray-200);
    border-bottom: none;
    margin-bottom: 0;
}

#users-view .filters .btn-primary {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--near-black), #2a3328);
    border: none;
    box-shadow: 0 2px 8px rgba(28, 35, 26, 0.2);
    transition: all 0.25s ease;
}

#users-view .filters .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(28, 35, 26, 0.3);
    background: linear-gradient(135deg, #2a3328, var(--near-black));
}

#users-view .filters .btn-primary::before {
    content: '+';
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
}

#users-view .data-table-container {
    border-radius: 0 0 12px 12px;
    border-top: none;
    overflow-x: auto;
}

/* Users table specific styling */
#users-list .data-table {
    width: 100%;
}

#users-list .data-table th,
#users-list .data-table td {
    vertical-align: middle;
    white-space: nowrap;
    padding: 12px 10px;
}

#users-list .data-table th:nth-child(3),
#users-list .data-table td:nth-child(3),
#users-list .data-table th:nth-child(4),
#users-list .data-table td:nth-child(4),
#users-list .data-table th:nth-child(5),
#users-list .data-table td:nth-child(5) {
    text-align: center;
}

#users-list .data-table th:nth-child(7),
#users-list .data-table td:nth-child(7) {
    text-align: right;
}

#users-list .data-table thead th {
    background: linear-gradient(180deg, var(--gray-50), var(--gray-100));
    border-bottom: 2px solid var(--gray-200);
    position: relative;
}

#users-list .data-table thead th::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--gray-200);
}

#users-list .data-table thead th:last-child::after {
    display: none;
}

#users-list .data-table tbody tr {
    transition: all 0.2s ease;
}

#users-list .data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(110, 193, 228, 0.06), rgba(152, 180, 160, 0.04));
}

/* User info cell styling */
#users-list .data-table td:first-child {
    font-weight: 600;
    color: var(--near-black);
}

#users-list .data-table td:nth-child(3) {
    color: var(--text-gray);
    font-size: 13px;
}

/* Action buttons container */
#users-list .action-buttons {
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
}

#users-list .action-buttons .btn-sm {
    padding: 6px 12px;
    font-size: 10px;
    white-space: nowrap;
    border-width: 1.5px;
}

/* Refined button styles for user actions */
#users-list .btn-secondary {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--primary-dark);
}

#users-list .btn-secondary:hover {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: var(--white);
}

#users-list .btn-edit {
    background: transparent;
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

#users-list .btn-edit:hover {
    background: var(--primary-blue);
    color: var(--white);
}

#users-list .btn-warning {
    background: transparent;
    border-color: var(--yellow-accent);
    color: #7a6415;
}

#users-list .btn-warning:hover {
    background: var(--yellow-accent);
    color: var(--near-black);
}

#users-list .btn-danger {
    background: transparent;
    border-color: rgba(246, 140, 74, 0.5);
    color: #b85a2b;
}

#users-list .btn-danger:hover {
    background: var(--orange-accent);
    border-color: var(--orange-accent);
    color: var(--white);
}

/* Status indicators with subtle animation */
#users-list .badge-enrollment {
    position: relative;
}

#users-list .badge-enrollment::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #3d8b47;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

#users-list .badge-enrollment {
    padding-left: 18px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Pending invite badge styling */
#users-list .badge-modification {
    background: linear-gradient(135deg, rgba(247, 206, 95, 0.2), rgba(247, 206, 95, 0.35));
    border: 1px solid rgba(247, 206, 95, 0.5);
    animation: pendingGlow 3s ease-in-out infinite;
}

@keyframes pendingGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(247, 206, 95, 0); }
    50% { box-shadow: 0 0 8px 2px rgba(247, 206, 95, 0.2); }
}

/* User modal enhancements */
#user-modal .modal-content {
    max-width: 420px;
    border-radius: 16px;
    padding: 24px 28px;
}

#user-modal h3 {
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

#user-modal .form-group {
    margin-bottom: 14px;
}

#user-modal .form-group label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    margin-bottom: 4px;
}

#user-modal .form-group input,
#user-modal .form-group select {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}

#user-modal .form-group select {
    width: 100%;
    background: var(--white);
    cursor: pointer;
}

#user-modal .checkbox-group {
    background: var(--gray-50);
    padding: 12px;
    border-radius: 8px;
    margin: 16px 0;
    border: 1px solid var(--gray-200);
}

#user-modal .checkbox-label {
    font-size: 13px;
}

#user-modal .help-text {
    margin-left: 30px;
    margin-top: 2px;
    font-size: 11px;
}

#user-modal #password-fields {
    padding: 12px;
    background: rgba(110, 193, 228, 0.05);
    border-radius: 8px;
    border: 1px dashed var(--gray-200);
    margin-bottom: 14px;
}

#user-modal #password-fields .form-group {
    margin-bottom: 12px;
}

#user-modal #password-fields .form-group:last-child {
    margin-bottom: 0;
}

#user-modal .btn-primary {
    margin-top: 4px;
    padding: 12px 24px;
    font-size: 13px;
}

/* Company Modal */
#company-modal .modal-content {
    max-width: 420px;
    border-radius: 16px;
    padding: 24px 28px;
}

#company-modal h3 {
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

#company-modal .form-group {
    margin-bottom: 14px;
}

#company-modal .form-group label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    margin-bottom: 4px;
}

#company-modal .form-group input {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

#company-modal .form-actions {
    margin-top: 16px;
    padding-top: 16px;
}

#company-modal .btn {
    padding: 10px 20px;
    font-size: 13px;
}

/* Confirm Modal */
.modal-confirm {
    max-width: 400px;
    text-align: center;
    padding: 32px 40px;
}

.modal-confirm h3 {
    color: var(--orange-accent);
    margin-bottom: 16px;
    font-size: 20px;
}

.modal-confirm p {
    color: var(--primary-dark);
    margin-bottom: 28px;
    font-size: 15px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-buttons .btn {
    min-width: 100px;
    width: auto;
}

/* ================================================
   CHANGES PAGE - Premium Task Management Styling
   ================================================ */

#changes-view {
    animation: fadeInUp 0.4s ease-out;
}

.changes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.changes-header h2 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.changes-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

.changes-count-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    padding: 12px 20px;
    border-radius: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.changes-count-badge .count-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
}

.changes-count-badge .count-label {
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Changes Filters */
.changes-filters {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--gray-200);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.changes-filters .filters-row {
    display: flex;
    gap: 14px;
    flex: 1;
    align-items: center;
}

.changes-filters input,
.changes-filters select {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Libre Franklin', sans-serif;
    transition: border-color 0.2s;
}

.changes-filters input {
    flex: 1;
    max-width: 280px;
}

.changes-filters input:focus,
.changes-filters select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.changes-filters .btn-primary {
    width: auto;
    padding: 12px 24px;
}

/* Bulk action button */
.btn-bulk {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--green-accent), #4eb85c);
    color: var(--white);
    border: none;
    border-radius: 24px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(97, 206, 112, 0.3);
}

.btn-bulk:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(97, 206, 112, 0.4);
}

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

.btn-bulk .bulk-icon {
    font-size: 16px;
    font-weight: bold;
}

/* Changes table container */
#changes-view .data-table-container {
    border-radius: 0 0 12px 12px;
    border-top: none;
}

/* Changes table styling */
#changes-table {
    width: 100%;
    table-layout: auto;
    font-size: 11px;
}

#changes-table th,
#changes-table td {
    vertical-align: middle;
    padding: 8px 6px;
    white-space: nowrap;
}

#changes-table th {
    font-size: 10px;
}

#changes-table .col-checkbox {
    width: 36px;
    text-align: center;
}

#changes-table .col-action {
    width: 100px;
    text-align: right;
}

#changes-table thead th {
    background: linear-gradient(180deg, var(--gray-50), var(--gray-100));
    border-bottom: 2px solid var(--gray-200);
}

/* Contribution columns - right align currency with spacing */
#changes-table th:nth-last-child(4),
#changes-table th:nth-last-child(3),
#changes-table td:nth-last-child(4),
#changes-table td:nth-last-child(3) {
    text-align: right;
    padding-right: 16px;
}

#changes-table td:nth-last-child(4),
#changes-table td:nth-last-child(3) {
    font-size: 11px;
}

/* Smaller badges for changes table */
#changes-table .badge {
    padding: 3px 8px;
    font-size: 9px;
    border-radius: 12px;
}

/* Smaller action buttons for changes table */
#changes-table .btn-action {
    padding: 4px 10px;
    font-size: 9px;
    border-width: 1px;
    border-radius: 12px;
}

#changes-table .btn-action .action-icon {
    font-size: 11px;
}

#changes-table .btn-action .action-text {
    font-size: 9px;
}

/* Change rows - clickable */
#changes-table .change-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

#changes-table .change-row:hover {
    background: linear-gradient(90deg, rgba(110, 193, 228, 0.08), rgba(152, 180, 160, 0.04));
}

/* Action buttons in table */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.btn-action .action-icon {
    font-size: 14px;
    line-height: 1;
}

.btn-action .action-text {
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-complete {
    background: rgba(97, 206, 112, 0.12);
    border-color: var(--green-accent);
    color: #3d8b47;
}

.btn-complete:hover {
    background: var(--green-accent);
    color: var(--white);
}

.btn-reopen {
    background: rgba(110, 193, 228, 0.12);
    border-color: var(--primary-blue);
    color: #1a6a8a;
}

.btn-reopen:hover {
    background: var(--primary-blue);
    color: var(--white);
}

/* Status badges */
.badge-pending {
    background: rgba(247, 206, 95, 0.25);
    color: #8b7117;
}

.badge-completed {
    background: rgba(97, 206, 112, 0.15);
    color: #3d8b47;
}

/* ================================================
   CHANGE DETAIL MODAL
   ================================================ */

.modal-change-detail {
    max-width: 1000px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.change-detail-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.change-detail-header {
    padding: 28px 32px;
    border-bottom: 2px solid var(--gray-200);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.change-detail-employee-info {
    flex: 1;
}

.change-detail-employee-info h3 {
    font-size: 26px;
    margin-bottom: 10px;
    color: var(--near-black);
}

.change-detail-employee-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    color: var(--text-gray);
    font-size: 14px;
}

.change-detail-employee-meta + .change-detail-employee-meta {
    margin-top: 8px;
}

.change-detail-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 24px;
    margin-top: 24px;
}

.change-type-badge {
    padding: 8px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-enrollment-large {
    background: linear-gradient(135deg, rgba(97, 206, 112, 0.2), rgba(97, 206, 112, 0.35));
    color: #2d7a36;
    border: 2px solid rgba(97, 206, 112, 0.4);
}

.badge-modification-large {
    background: linear-gradient(135deg, rgba(247, 206, 95, 0.25), rgba(247, 206, 95, 0.4));
    color: #7a6415;
    border: 2px solid rgba(247, 206, 95, 0.5);
}

.badge-termination-large {
    background: linear-gradient(135deg, rgba(246, 140, 74, 0.2), rgba(246, 140, 74, 0.35));
    color: #a34d20;
    border: 2px solid rgba(246, 140, 74, 0.4);
}

.badge-waived-large {
    background: linear-gradient(135deg, rgba(128, 128, 128, 0.2), rgba(128, 128, 128, 0.35));
    color: #4a4a4a;
    border: 2px solid rgba(128, 128, 128, 0.4);
}

.change-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.completed-info {
    font-size: 12px;
    color: var(--text-gray);
}

.change-detail-section {
    padding: 24px 32px;
    border-bottom: 1px solid var(--gray-200);
}

.change-detail-section:last-of-type {
    border-bottom: none;
}

.change-detail-section h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--near-black);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Plan Details Section */
.plan-details-section {
    border-bottom: 2px solid var(--gray-200);
}

.plan-header-row {
    display: flex;
    align-items: baseline;
    gap: 24px;
    margin-bottom: 12px;
}

.plan-type-title {
    font-size: 22px;
    margin: 0;
    color: var(--near-black);
}

.plan-subtitle {
    font-size: 15px;
    color: var(--text-gray);
    margin-top: 4px;
    margin-bottom: 12px;
}

.action-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    text-transform: capitalize;
}

.action-enrolled {
    background: var(--green-bg);
    color: var(--green-text);
}

.action-waived {
    background: var(--gray-100);
    color: var(--text-gray);
}

.action-changed {
    background: var(--orange-bg);
    color: var(--orange-accent);
}

.change-date-inline {
    font-size: 15px;
    color: var(--text-gray);
}

.change-date-inline strong {
    color: var(--orange-accent);
    font-weight: 600;
}

.plan-details-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    color: var(--text-gray);
    font-size: 14px;
}

/* Coverage date highlighting when different from plan dates */
.coverage-differs-start {
    font-weight: 700;
    color: var(--near-black);
}

.coverage-differs-end {
    color: var(--orange-accent);
    font-weight: 600;
}

/* Activity Date Callout */
.activity-date-callout {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    font-size: 14px;
}

.activity-date-callout.activity-date-highlight {
    background: #fff8e1;
    border-left: 3px solid var(--orange-accent);
}

.activity-date-label {
    color: var(--text-gray);
    font-weight: 500;
}

.activity-date-value {
    color: var(--near-black);
    font-weight: 600;
}

.activity-date-note {
    color: var(--orange-accent);
    font-size: 12px;
    font-style: italic;
}

/* Contributions Table */
.contributions-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.contributions-table th,
.contributions-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.contributions-table thead th {
    background: var(--gray-50);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--primary-dark);
}

.contributions-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.contributions-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.contributions-table tbody tr:last-child td {
    border-bottom: none;
}

.contributions-table .row-label {
    font-weight: 500;
    color: var(--primary-dark);
    width: 50%;
}

.contributions-table .amount {
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--near-black);
    text-align: right;
    width: 25%;
}

.contributions-table tbody tr:hover {
    background: var(--gray-50);
}

/* Contributions Section - Cards Layout */
.contributions-section {
    padding: 0;
}

.deduction-info {
    display: flex;
    gap: 32px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--gray-50);
    border-radius: 8px;
}

.deduction-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.deduction-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    font-weight: 500;
}

.deduction-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark);
}

.contributions-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.contribution-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.contribution-card.ee-card {
    border-left: 4px solid var(--green-accent);
}

.contribution-card.er-card {
    border-left: 4px solid var(--primary-dark);
}

.contribution-header {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    font-weight: 600;
    margin-bottom: 8px;
}

.contribution-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Courier New', monospace;
    margin-bottom: 4px;
}

.contribution-frequency {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 12px;
}

.contribution-tax-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.contribution-tax-type.tax-pretax {
    background: #e8f5e9;
    color: #2e7d32;
}

.contribution-tax-type.tax-posttax {
    background: #fff3e0;
    color: #e65100;
}

/* Compact Contributions Layout */
.contributions-compact {
    padding: 20px 32px;
    background: var(--gray-50);
}

.contributions-row {
    display: flex;
    align-items: center;
    gap: 32px;
}

.contribution-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: var(--white);
    border-radius: 10px;
    border: 1px solid var(--gray-200);
    min-width: 120px;
}

.contributions-compact .contribution-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    font-weight: 600;
}

.contributions-compact .contribution-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Courier New', monospace;
}

.contribution-tax {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

.contribution-tax.tax-pre {
    background: #e8f5e9;
    color: #2e7d32;
}

.contribution-tax.tax-post {
    background: #fff3e0;
    color: #e65100;
}

.contribution-item.contribution-frequency {
    background: transparent;
    border: none;
    padding: 12px 16px;
}

.contribution-frequency .contribution-cycle {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-dark);
}

/* Activity Indicator for tables */
.activity-indicator {
    display: inline-block;
    color: var(--orange-accent);
    font-weight: 700;
    font-size: 14px;
    margin-left: 4px;
    cursor: help;
}

/* Tax badge for tables (smaller inline version) */
.tax-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    margin-left: 6px;
    vertical-align: middle;
}

.tax-badge.tax-pre {
    background: #e8f5e9;
    color: #2e7d32;
}

.tax-badge.tax-post {
    background: #fff3e0;
    color: #e65100;
}

/* Inline waived badge for tables (same size as tax-badge) */
.waived-badge-inline {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    margin-left: 6px;
    vertical-align: middle;
    background: rgba(128, 128, 128, 0.15);
    color: #666;
}

/* Sortable Table Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

th.sortable:hover {
    background: var(--gray-100);
}

th.sortable.sort-active {
    background: var(--gray-100);
    color: var(--primary-dark);
}

.change-detail-section h5 {
    margin: 16px 0 12px 0;
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 600;
}

/* Dependents Section */
.dependents-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--near-black);
    margin-bottom: 12px;
}

.dependents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dependent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.dependent-name {
    font-weight: 500;
    color: var(--near-black);
    min-width: 150px;
}

.dependent-relationship {
    font-size: 11px;
    padding: 2px 8px;
}

.badge-spouse {
    background: #e8f4fd;
    color: #0369a1;
}

.badge-child {
    background: #fef3c7;
    color: #92400e;
}

.dependent-dob {
    font-size: 12px;
    color: var(--text-gray);
    margin-left: auto;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-gray);
    font-weight: 500;
}

.detail-value {
    font-size: 15px;
    color: var(--near-black);
    font-weight: 500;
}

/* Before/After comparison */
.change-comparison {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comparison-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comparison-item.highlight {
    background: rgba(247, 206, 95, 0.1);
    padding: 16px;
    border-radius: 12px;
    border: 1px dashed var(--yellow-accent);
}

.comparison-item.termination {
    background: rgba(246, 140, 74, 0.08);
    border-color: var(--orange-accent);
}

.before-after {
    display: flex;
    align-items: center;
    gap: 16px;
}

.before-after .before,
.before-after .after {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.before-after .before {
    background: rgba(246, 140, 74, 0.1);
    border: 1px solid rgba(246, 140, 74, 0.3);
}

.before-after .after {
    background: rgba(97, 206, 112, 0.1);
    border: 1px solid rgba(97, 206, 112, 0.3);
}

.before-after .after.terminated {
    background: rgba(246, 140, 74, 0.15);
    border-color: rgba(246, 140, 74, 0.4);
}

.before-after .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-gray);
    font-weight: 600;
}

.before-after .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--near-black);
}

.before-after .arrow {
    font-size: 20px;
    color: var(--text-gray);
    flex-shrink: 0;
}

/* Changed Fields Section - What Changed */
.changed-fields-section {
    background: linear-gradient(135deg, rgba(247, 206, 95, 0.08), rgba(247, 206, 95, 0.03));
}

.changed-fields-section h4 {
    color: var(--yellow-accent);
    margin-bottom: 12px;
}

.changed-fields-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.changed-field-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.changed-field-name {
    font-weight: 600;
    color: var(--near-black);
    font-size: 13px;
    min-width: 200px;
}

.changed-field-values {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.changed-field-old {
    color: var(--text-gray);
    text-decoration: line-through;
    opacity: 0.8;
}

.changed-field-arrow {
    color: var(--yellow-accent);
    font-weight: 600;
    font-size: 16px;
}

.changed-field-new {
    color: var(--near-black);
    font-weight: 600;
}

/* Termination notice */
.termination-notice {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(246, 140, 74, 0.1), rgba(246, 140, 74, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(246, 140, 74, 0.3);
    margin-bottom: 16px;
}

.termination-notice .notice-icon {
    font-size: 24px;
    color: var(--orange-accent);
    line-height: 1;
}

.termination-notice .notice-text strong {
    display: block;
    color: var(--orange-accent);
    margin-bottom: 4px;
}

.termination-notice .notice-text p {
    margin: 0;
    font-size: 14px;
    color: var(--primary-dark);
}

/* Change Modal - flex layout for scrollable body with fixed header/footer */
#change-modal .modal-content {
    display: flex;
    flex-direction: column;
    padding: 0;
    max-height: 85vh;
    overflow: hidden;
}

#change-modal #change-detail {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 85vh;
    overflow: hidden;
}

/* Action buttons in modal */
.change-detail-actions {
    padding: 20px 32px;
    background: var(--gray-50);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.change-detail-actions .btn {
    width: auto;
    padding: 12px 24px;
}

/* ================================================
   EMPLOYEES PAGE
   ================================================ */

#employees-view {
    animation: fadeInUp 0.4s ease-out;
}

.employees-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.employees-header h2 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.employees-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

.employees-count-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    padding: 12px 20px;
    border-radius: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.employees-count-badge .count-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
}

.employees-count-badge .count-label {
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.employees-filters {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--gray-200);
    border-bottom: none;
}

.employees-filters .filters-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.employees-filters input,
.employees-filters select {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Libre Franklin', sans-serif;
    transition: border-color 0.2s;
}

.employees-filters input {
    flex: 1;
    max-width: 300px;
}

.employees-filters select {
    min-width: 180px;
}

.employees-filters input:focus,
.employees-filters select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.employees-filters .btn-primary {
    width: auto;
    padding: 12px 24px;
}

#employees-view .data-table-container {
    border-radius: 0 0 12px 12px;
    border-top: none;
}

#employees-table {
    width: 100%;
    table-layout: auto;
    font-size: 13px;
}

#employees-table thead th {
    background: linear-gradient(180deg, var(--gray-50), var(--gray-100));
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
    font-size: 12px;
}

#employees-table td {
    white-space: nowrap;
    padding: 10px 12px;
}

#employees-table .clickable:hover {
    background: linear-gradient(90deg, rgba(110, 193, 228, 0.08), rgba(152, 180, 160, 0.04));
}

/* Employee Detail Modal - wider for tables */
#employee-modal .modal-content {
    max-width: 1100px;
    padding: 32px 40px;
}

#employee-modal .detail-section {
    overflow-x: auto;
}

#employee-modal .data-table {
    font-size: 12px;
    width: 100%;
    table-layout: auto;
}

#employee-modal .data-table th,
#employee-modal .data-table td {
    padding: 10px 12px;
    white-space: nowrap;
}

#employee-modal .data-table th {
    text-align: left;
}

#employee-modal .plan-period-group {
    margin-bottom: 16px;
}

#employee-modal .plan-period-header {
    border-radius: 6px 6px 0 0;
}

/* ================================================
   SELF BILL BENEFITS PAGE
   ================================================ */

.benefits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.benefits-header h2 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.benefits-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

.benefits-count-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    padding: 12px 20px;
    border-radius: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.benefits-count-badge .count-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
}

.benefits-count-badge .count-label {
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.benefits-filters {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--gray-200);
    border-bottom: none;
    margin-bottom: 0;
}

.benefits-filters .filters-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.benefits-filters input,
.benefits-filters select {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Libre Franklin', sans-serif;
    transition: border-color 0.2s;
}

.benefits-filters input {
    flex: 1;
    max-width: 300px;
}

.benefits-filters select {
    min-width: 180px;
}

.benefits-filters input:focus,
.benefits-filters select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.benefits-filters .btn-primary {
    width: auto;
    padding: 12px 24px;
}

/* ================================================
   SELF BILL CONTACTS PAGE
   ================================================ */

.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.contacts-header h2 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.contacts-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

.contacts-count-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    padding: 12px 20px;
    border-radius: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.contacts-count-badge .count-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
}

.contacts-count-badge .count-label {
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.contacts-filters {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--gray-200);
    border-bottom: none;
    margin-bottom: 0;
}

.contacts-filters .filters-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.contacts-filters input,
.contacts-filters select {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Libre Franklin', sans-serif;
    transition: border-color 0.2s;
}

.contacts-filters input {
    flex: 1;
    max-width: 300px;
}

.contacts-filters select {
    min-width: 180px;
}

.contacts-filters input:focus,
.contacts-filters select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.contacts-filters .btn-primary {
    width: auto;
    padding: 12px 24px;
}

/* ================================================
   IMPORTS PAGE
   ================================================ */

#imports-view {
    animation: fadeInUp 0.4s ease-out;
}

.imports-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.imports-header h2 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.imports-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

.imports-count-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    padding: 12px 20px;
    border-radius: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.imports-count-badge .count-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
    font-family: 'Merriweather', serif;
}

.imports-count-badge .count-label {
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.imports-filters {
    margin-bottom: 24px;
}

.imports-filters .filters-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.imports-filters select {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    color: var(--near-black);
    background: var(--white);
    min-width: 160px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.imports-filters select:hover {
    border-color: var(--sage-green);
}

.imports-filters select:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15);
}

#imports-view .data-table-container {
    border-radius: 12px;
}

/* Self Bill View Header */
.view-header {
    margin-bottom: 24px;
}

.view-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
    margin: 0 0 8px 0;
}

.view-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
    flex-shrink: 0;
}

.view-subtitle {
    color: var(--gray-500);
    font-size: 14px;
    margin: 0;
    padding-left: 16px;
}

/* Self Bill Dashboard */
.sb-stats-row {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--white);
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sb-stat-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.sb-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
}

.sb-stat-label {
    font-size: 13px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sb-stat-divider {
    width: 1px;
    height: 32px;
    background: var(--gray-200);
}

.sb-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.sb-dashboard-card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.sb-dashboard-card.sb-companies-overview {
    grid-column: 1 / -1;
}

.sb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.sb-card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--near-black);
}

.sb-card-header select {
    padding: 6px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    color: var(--near-black);
    background: var(--white);
    min-width: 180px;
    cursor: pointer;
}

.sb-card-header select:focus {
    outline: none;
    border-color: var(--sage-green);
}

.sb-period-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--sage-green);
    background: rgba(138, 154, 91, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

.sb-card-content {
    padding: 20px;
}

.sb-chart-container {
    height: 280px;
    position: relative;
}

.sb-chart-container canvas {
    max-height: 100%;
}

.sb-chart-container .empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

#sb-billing-chart {
    display: none;
}

/* Previous Month Status Items */
.sb-action-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 260px;
    overflow-y: auto;
}

.sb-action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 3px solid var(--gray-300);
}

.sb-action-item.needs-action {
    border-left-color: var(--warning-orange);
    background: rgba(255, 152, 0, 0.05);
}

.sb-action-item.complete {
    border-left-color: var(--sage-green);
    background: rgba(138, 154, 91, 0.05);
}

.sb-action-company {
    font-weight: 500;
    color: var(--near-black);
}

.sb-action-status {
    font-size: 13px;
}

.sb-action-status.pending {
    color: var(--warning-orange);
}

.sb-action-status.done {
    color: var(--sage-green);
}

.sb-action-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: var(--sage-green);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.sb-action-btn:hover {
    background: var(--sage-green-dark);
}

/* Companies Overview in Dashboard */
.sb-companies-overview .data-table {
    margin: 0;
}

.sb-companies-overview .data-table th,
.sb-companies-overview .data-table td {
    padding: 12px 16px;
}

/* Prevent layout shifts */
.sb-card-content {
    min-height: 120px;
}

.sb-action-list {
    min-height: 100px;
}

.sb-companies-overview .sb-card-content {
    min-height: 150px;
}

@media (max-width: 1024px) {
    .sb-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .sb-stats-row {
        flex-wrap: wrap;
        gap: 16px;
    }

    .sb-stat-divider {
        display: none;
    }
}

/* Self Bill Billing Header */
.sb-billing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.sb-billing-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--near-black);
    margin: 0;
}

.sb-billing-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
    flex-shrink: 0;
}

.sb-billing-header select {
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Libre Franklin', sans-serif;
    color: var(--near-black);
    background: var(--white);
    width: 280px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sb-billing-header select:hover {
    border-color: var(--sage-green);
}

.sb-billing-header select:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15);
}

/* Self Bill Filters */
.sb-filters {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sb-filters .filters-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.sb-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sb-filters .filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sb-filters select {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Libre Franklin', sans-serif;
    color: var(--near-black);
    background: var(--white);
    min-width: 200px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sb-filters select:hover {
    border-color: var(--sage-green);
}

.sb-filters select:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15);
}

.sb-filters .btn-primary {
    padding: 12px 24px;
    align-self: flex-end;
    margin-left: auto;
}

#imports-table {
    width: 100%;
    table-layout: auto;
}

#imports-table thead th {
    background: linear-gradient(180deg, var(--gray-50), var(--gray-100));
    border-bottom: 2px solid var(--gray-200);
}

#imports-table tbody tr:hover {
    background: var(--gray-50);
}

/* ================================================
   REPORTS PAGE
   ================================================ */

.reports-header {
    margin-bottom: 32px;
}

.reports-header h2 {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.reports-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--primary-blue);
    border-radius: 2px;
}

.reports-subtitle {
    color: var(--text-gray);
    font-size: 14px;
    margin: 0;
}

.reports-section {
    margin-bottom: 40px;
}

.reports-section-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.reports-section-header h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark);
}

.reports-section-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-gray);
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.report-card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    padding: 24px;
    transition: box-shadow 0.2s ease;
}

.report-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.report-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.report-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(110, 193, 228, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-blue);
}

.report-card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-dark);
}

.report-description {
    color: var(--text-gray);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.report-filters {
    margin-bottom: 20px;
}

.report-filters .form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.report-filters .form-row:last-child {
    margin-bottom: 0;
}

.report-filters .form-row .form-group {
    flex: 1;
    min-width: 0;
}

.report-filters .form-group {
    margin-bottom: 0;
}

.report-filters label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    margin-bottom: 6px;
    display: block;
}

.report-filters select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
    cursor: pointer;
}

.report-actions {
    display: flex;
    gap: 12px;
}

.report-actions .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-actions .btn svg {
    flex-shrink: 0;
}

.report-date-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.report-date-row .form-group {
    flex: 1;
}

.report-filters input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
}

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 768px) {
    .changes-header,
    .employees-header,
    .imports-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .changes-filters,
    .employees-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .changes-filters .filters-row,
    .employees-filters .filters-row {
        flex-wrap: wrap;
    }

    .changes-filters input,
    .employees-filters input {
        max-width: none;
        width: 100%;
    }

    .employees-filters select {
        min-width: auto;
        width: 100%;
    }

    .btn-bulk {
        width: 100%;
        justify-content: center;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .before-after {
        flex-direction: column;
    }

    .before-after .arrow {
        transform: rotate(90deg);
    }

    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters {
        flex-wrap: wrap;
    }

    .filters input {
        max-width: none;
        width: 100%;
    }

    .data-table {
        font-size: 14px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 14px;
    }

    .app-nav {
        overflow-x: auto;
    }

    .nav-btn {
        padding: 14px 16px;
        font-size: 12px;
    }
}

/* =====================
   Account Settings Page
   ===================== */

.settings-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.settings-header h2 {
    font-size: 24px;
    color: var(--near-black);
    margin: 0;
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Account page grid layout */
.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.account-right-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-grid .settings-card-header {
    padding: 16px 20px;
}

.account-grid .settings-card-header h3 {
    margin: 0;
}

.account-grid .settings-form {
    padding: 20px;
}

.account-grid .settings-option {
    padding: 16px 20px;
}

@media (max-width: 900px) {
    .account-grid {
        grid-template-columns: 1fr;
    }
}

.settings-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.settings-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.settings-card-header h3 {
    font-size: 16px;
    color: var(--near-black);
    margin: 0 0 4px 0;
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 600;
}

.settings-card-header p {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
}

.settings-form {
    padding: 24px;
}

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

.form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
}

.settings-option + .settings-option {
    border-top: 1px solid var(--gray-200);
}

.settings-option-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-option-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--near-black);
}

.settings-option-description {
    font-size: 13px;
    color: var(--text-gray);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--green-accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.toggle-with-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-saved-indicator {
    font-size: 12px;
    color: var(--green-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toggle-saved-indicator.show {
    opacity: 1;
}

/* Responsive settings */
@media (max-width: 640px) {
    .settings-page {
        padding: 20px;
    }

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

    .settings-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ================================================
   CONNECTION GUIDE PAGE
   ================================================ */

#guide-view {
    animation: fadeInUp 0.4s ease-out;
}

.guide-container {
    max-width: 900px;
    margin: 0 auto;
}

.guide-header {
    text-align: center;
    margin-bottom: 40px;
}

.guide-header h2 {
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.guide-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--sage-green);
    border-radius: 2px;
}

.guide-subtitle {
    color: var(--text-gray);
    font-size: 16px;
    margin: 0;
}

/* Step Cards */
.guide-step {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    background: var(--white);
    border-radius: 16px;
    padding: 28px 32px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.step-number {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--sage-green), var(--green-accent));
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Merriweather', serif;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: var(--near-black);
}

.step-content > p {
    margin: 0 0 20px 0;
    color: var(--text-gray);
    line-height: 1.6;
}

/* Fields Grid */
.guide-fields-section {
    margin-bottom: 20px;
}

.guide-fields-section:last-child {
    margin-bottom: 0;
}

.guide-fields-section h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-dark);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.guide-fields-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.guide-field {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--primary-dark);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Guide List */
.guide-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-gray);
    line-height: 1.8;
}

.guide-list li {
    margin-bottom: 8px;
}

.guide-list li:last-child {
    margin-bottom: 0;
}

.guide-note {
    font-size: 13px;
    color: var(--text-gray);
    margin-top: 8px;
    font-style: italic;
}

.guide-important-note {
    margin-top: 20px;
    padding: 12px 16px;
    background: #fff8e6;
    border-left: 4px solid #e6a700;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
}

.guide-important-note strong {
    color: #664d03;
}

.guide-format-note {
    margin-top: 16px;
    padding: 12px 16px;
    background: #e8f4fd;
    border-left: 4px solid #0066cc;
    border-radius: 4px;
    font-size: 14px;
    color: #004085;
}

.guide-format-note strong {
    color: #003366;
}

.guide-field-note {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Settings Table for Step 2 */
.settings-table {
    margin-bottom: 20px;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-group h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-dark);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gray-200);
}

.setting-row {
    display: flex;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    margin-bottom: 4px;
    align-items: center;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-label {
    flex: 0 0 280px;
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 500;
}

.setting-value {
    flex: 1;
    font-size: 13px;
    color: var(--near-black);
}

.setting-value.setting-important {
    font-weight: 600;
    color: #4a6b52;  /* Darker green for emphasis */
}

.setting-value.setting-user {
    font-style: italic;
    color: var(--text-gray);
}

.setting-value.setting-checkbox {
    color: var(--text-gray);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
}

.setting-row-note {
    background: rgba(110, 193, 228, 0.1);
    border: 1px dashed var(--primary-blue);
}

.setting-note {
    font-size: 13px;
    color: var(--primary-blue);
    font-style: italic;
}

.step-note {
    margin: 16px 0 0 0;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-gray);
    border-left: 3px solid var(--sage-green);
}

/* SFTP Details */
.sftp-details {
    background: var(--gray-50);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.sftp-row {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.sftp-row:last-child {
    border-bottom: none;
}

.sftp-label {
    width: 140px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    flex-shrink: 0;
}

.sftp-value-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.sftp-value {
    background: var(--white);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--near-black);
    border: 1px solid var(--gray-200);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.copy-btn {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-gray);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.copy-btn.copied {
    background: var(--green-accent);
    border-color: var(--green-accent);
    color: var(--white);
}

/* Password blur effect */
.sftp-password-blur {
    filter: blur(4px);
    user-select: all;
    transition: filter 0.2s ease;
}

.sftp-password-blur:hover {
    filter: blur(2px);
}

.reveal-btn {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-gray);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reveal-btn:hover {
    background: var(--gray-50);
    color: var(--primary-dark);
}

/* PGP Section */
.pgp-section {
    margin-top: 24px;
    background: var(--gray-50);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--gray-200);
}

.pgp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.pgp-header h4 {
    font-size: 15px;
    color: var(--primary-dark);
    margin: 0 0 4px 0;
}

.pgp-note {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
}

.btn-copy-pgp {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
}

.pgp-key {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px;
    font-size: 11px;
    line-height: 1.6;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: var(--text-gray);
    margin: 0;
    max-height: 120px;
    overflow-y: auto;
    word-break: break-all;
    user-select: all;
}

/* Guide Report Sections (for connection guide step 2) */
.guide-report-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.guide-report-section:last-child {
    margin-bottom: 0;
}

.guide-report-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.guide-report-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--primary-dark);
}

.guide-report-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-blue);
    color: var(--white);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.guide-report-section .settings-table {
    margin-bottom: 0;
}

.guide-report-section .settings-group {
    background: var(--white);
    border-radius: 8px;
}

/* Guide Column Tables (for required columns in connection guides) */
.guide-column-table {
    font-size: 13px;
    margin-top: 16px;
    border-radius: 8px;
    overflow: hidden;
}

.guide-column-table th,
.guide-column-table td {
    padding: 8px 12px;
}

.guide-column-table th {
    font-size: 11px;
    background: var(--gray-100);
}

.guide-column-table td {
    font-size: 13px;
}

.guide-column-table td:first-child {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: var(--near-black);
}

.guide-column-table td:last-child {
    color: var(--text-gray);
}

.guide-column-table .optional-row td {
    color: var(--text-gray);
    font-style: italic;
}

.guide-column-table .optional-row td:first-child {
    color: var(--text-gray);
}

/* Help Section */
.guide-help {
    background: linear-gradient(135deg, var(--gray-50), var(--white));
    border-radius: 12px;
    padding: 24px 28px;
    border: 1px solid var(--gray-200);
    text-align: center;
    margin-top: 20px;
}

.guide-help h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--near-black);
}

.guide-help p {
    margin: 0;
    color: var(--text-gray);
}

/* Responsive Guide */
@media (max-width: 768px) {
    .guide-step {
        flex-direction: column;
        padding: 24px;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .sftp-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sftp-label {
        width: 100%;
    }
}


/* ==========================================================================
   Reports Redesign - List View, Slide Panel, and Builder
   ========================================================================== */

/* Reports List View */
.reports-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
}

.report-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--white);
    transition: background 0.15s;
}

.report-list-item:hover {
    background: var(--gray-50);
}

.report-list-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.report-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--sage-green);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    flex-shrink: 0;
}

.report-list-icon.custom-report-icon {
    background: var(--primary-dark);
}

.report-list-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.report-list-name {
    font-weight: 600;
    color: var(--near-black);
    font-size: 15px;
}

.report-list-desc {
    font-size: 13px;
    color: var(--text-gray);
}

.report-shared-badge {
    display: inline-block;
    background: var(--sage-green);
    color: var(--white);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.report-list-actions {
    display: flex;
    gap: 8px;
}

.reports-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-gray);
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
}

.reports-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.reports-section-header-left h3 {
    margin: 0 0 4px 0;
}

.reports-section-header-left p {
    margin: 0;
    font-size: 13px;
    color: var(--text-gray);
}

/* Slide-out Report Panel */
.report-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
}

.report-panel.hidden {
    display: none;
}

.report-panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.report-panel-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--white);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.report-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.report-panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.report-panel-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.report-panel-close:hover {
    color: var(--near-black);
}

.report-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.report-panel-desc {
    color: var(--text-gray);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.report-panel-filters .form-group {
    margin-bottom: 24px;
}

.report-panel-filters .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 14px;
}

.report-panel-filters select,
.report-panel-filters input[type="date"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Libre Franklin', sans-serif;
    color: var(--primary-dark);
    background-color: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.report-panel-filters select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='%2354595F'%3E%3Cpath d='M2.5 4.5L6 8L9.5 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.report-panel-filters select:focus,
.report-panel-filters input[type="date"]:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 4px rgba(152, 180, 160, 0.15);
}

.report-panel-filters select:hover,
.report-panel-filters input[type="date"]:hover {
    border-color: var(--gray-300);
}

.report-panel-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Report Builder Full Page View */
.report-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 20px;
}

.report-builder-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-builder-header-left h2 {
    margin: 0;
}

.report-builder-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.report-builder-header-actions .error-message {
    margin: 0;
    max-width: 300px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    font-family: inherit;
    transition: color 0.15s;
}

.btn-back:hover {
    color: var(--near-black);
}

.report-builder-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.report-builder-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
}

.report-builder-main {
    min-width: 0;
}

.builder-card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    padding: 24px;
}

.builder-card h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: var(--near-black);
}

.builder-card .field-count {
    font-weight: 400;
    color: var(--text-gray);
}

.builder-card .form-group {
    margin-bottom: 20px;
}

.builder-card .form-group:last-of-type {
    margin-bottom: 0;
}

.builder-card .checkbox-group {
    margin-top: 0;
}

.builder-card .help-text {
    margin-left: 0;
    margin-top: 8px;
}

.builder-card textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

.builder-card textarea:focus {
    outline: none;
    border-color: var(--sage-green);
}

/* Preview Modal */
.modal-xlarge {
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.report-builder-fields-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.report-builder-fields-header h3 {
    margin: 0;
}

.report-builder-field-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.action-divider {
    color: var(--gray-300);
}

.btn-link {
    background: none;
    border: none;
    color: var(--sage-green);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--near-black);
}

/* Flat Field List Container */
.report-builder-field-list {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding: 4px;
}

/* Field Group (flat display, no accordion) */
.field-group {
    margin-bottom: 20px;
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 2px solid var(--sage-green);
    margin-bottom: 10px;
}

.field-group-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--near-black);
}

.field-group-count {
    font-size: 11px;
    color: var(--text-gray);
    background: var(--gray-200);
    padding: 2px 8px;
    border-radius: 10px;
}

.field-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.field-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--primary-dark);
    border-radius: 6px;
    transition: background 0.1s;
}

.field-checkbox:hover {
    background: var(--gray-50);
}

.field-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--sage-green);
    flex-shrink: 0;
}

.field-checkbox span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Selected Fields */
.report-builder-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    align-content: flex-start;
}

.report-builder-no-fields {
    color: var(--text-gray);
    font-size: 13px;
    margin: 0;
    width: 100%;
    text-align: center;
    line-height: 1.5;
}

.selected-field-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--sage-green);
    color: var(--white);
    padding: 4px 8px 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.selected-field-tag button {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.selected-field-tag button:hover {
    opacity: 1;
}

/* Report Builder Actions */
.report-builder-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

/* Report Preview */
.report-preview-table-container {
    flex: 1;
    overflow: auto;
    margin: 20px 0;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.preview-table {
    width: 100%;
    min-width: max-content;
}

.preview-table th,
.preview-table td {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
}

.report-preview-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    .report-builder-layout {
        grid-template-columns: 1fr;
    }

    .report-builder-sidebar {
        position: static;
        order: 2;
    }

    .report-builder-main {
        order: 1;
    }

    .report-builder-field-list {
        max-height: 400px;
    }

    .report-builder-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .report-panel-content {
        max-width: 100%;
    }

    .report-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .report-list-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .reports-section-header {
        flex-direction: column;
        gap: 12px;
    }

    .report-builder-field-actions {
        flex-wrap: wrap;
    }

    .report-builder-header-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* =============================================================================
   SELF BILL BILLING CONFIGURATION & BILLS
   ============================================================================= */

/* Age Band Row */
.age-band-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}

.age-band-row input {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 13px;
}

.age-band-row .age-band-rate {
    width: 100px;
}

.age-band-separator {
    color: var(--gray-500);
    font-size: 13px;
}

/* Info Box (for contribution note) */
.info-box {
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.info-box strong {
    color: #0369a1;
}

.info-box p {
    margin: 8px 0;
    font-size: 13px;
    color: var(--gray-700);
}

.info-box .compact-list {
    margin: 8px 0 0 20px;
    font-size: 12px;
    color: var(--gray-600);
}

.info-box .compact-list li {
    margin: 2px 0;
}

/* Form value display */
.form-value {
    font-weight: 600;
    color: var(--near-black);
    padding: 8px 0;
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 16px;
}

.form-group-half {
    flex: 1;
}

/* Checkbox group styling */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Bill Summary Cards */
.bill-summary-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.bill-summary-card {
    flex: 1;
    min-width: 120px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
}

.bill-summary-card.bill-summary-total {
    background: var(--sage-green);
    border-color: var(--sage-green);
}

.bill-summary-card.bill-summary-total .bill-summary-label,
.bill-summary-card.bill-summary-total .bill-summary-value {
    color: var(--white);
}

.bill-summary-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.bill-summary-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--near-black);
}

.bill-meta {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

/* Modal sizes */
.modal-medium .modal-content,
.modal-content.modal-medium {
    max-width: 550px;
}

.modal-xlarge .modal-content,
.modal-content.modal-xlarge {
    max-width: 1100px;
    width: 95%;
}

/* Status badge for exported */
.status-badge.status-exported {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Text alignment utilities */
.text-right {
    text-align: right;
}

/* Small button styling */
.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

/* Table in bill detail modal */
#bill-detail-lines-table {
    font-size: 13px;
}

#bill-detail-lines-table th,
#bill-detail-lines-table td {
    padding: 8px 12px;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.empty-state.error {
    color: var(--danger-color);
}

/* Billing responsive adjustments */
@media (max-width: 768px) {
    .age-band-row {
        flex-wrap: wrap;
    }

    .age-band-row input {
        width: 60px;
    }

    .bill-summary-cards {
        flex-direction: column;
    }

    .bill-summary-card {
        min-width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal-content.modal-xlarge {
        width: 100%;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 24px;
}

.dashboard-section {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-section .section-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.dashboard-section .section-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--near-black);
}

@media (min-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Form hints */
.form-hint {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* Config count badge (for rate history) */
.config-count {
    font-size: 11px;
    color: var(--text-gray);
    margin-left: 6px;
}

/* Button outline variant */
.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--near-black);
}

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

/* =====================================================
   BILLING CONFIG MODAL
   ===================================================== */

.billing-config-modal {
    max-width: 680px;
    padding: 0;
}

.billing-config-modal .modal-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--gray-200);
}

.billing-config-modal .modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--near-black);
    margin: 0;
}

.billing-config-modal .modal-body {
    padding: 24px 28px;
}

/* Plan Header */
.billing-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 24px;
}

.plan-name-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.plan-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    font-weight: 600;
}

.plan-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--near-black);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.btn-link:hover {
    background: rgba(110, 193, 228, 0.1);
    text-decoration: underline;
}

/* Config Section */
.billing-config-section {
    margin-bottom: 20px;
}

.billing-config-section .section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

/* Form Grid */
.config-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.billing-config-modal .form-group {
    margin-bottom: 0;
}

.billing-config-modal .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.billing-config-modal .form-group input,
.billing-config-modal .form-group select,
.billing-config-modal .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.billing-config-modal .form-group input:focus,
.billing-config-modal .form-group select:focus,
.billing-config-modal .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.15);
}

.billing-config-modal .form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.billing-config-modal .field-hint {
    display: block;
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* Rate Options Panel */
.rate-options-panel {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-100);
}

/* Info Box Blue */
.info-box-blue {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 16px 18px;
}

.info-box-blue .info-box-title {
    font-size: 13px;
    font-weight: 600;
    color: #0369a1;
    margin-bottom: 8px;
}

.info-box-blue p {
    font-size: 13px;
    color: #0c4a6e;
    margin: 0 0 12px 0;
}

.multiplier-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 20px;
    font-size: 12px;
    color: #0c4a6e;
}

/* Age Options */
.age-source-section {
    margin-bottom: 20px;
}

.section-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.checkbox-row {
    display: flex;
    gap: 24px;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--near-black);
}

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

.radio-row {
    display: flex;
    gap: 24px;
}

.radio-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--near-black);
}

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

.config-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.age-source-group {
    display: flex;
    flex-direction: column;
}

.age-source-group .section-label {
    margin-bottom: 8px;
}

.age-source-group .radio-row {
    margin-bottom: 0;
}

.age-bands-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.age-bands-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.age-bands-toolbar .section-label {
    margin-bottom: 0;
}

.age-bands-actions {
    display: flex;
    gap: 8px;
}

.age-bands-hint {
    color: var(--text-gray);
    font-size: 13px;
    font-style: italic;
    margin: 8px 0;
}

.age-bands-table {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.age-bands-header-row {
    display: grid;
    grid-template-columns: 160px 1fr 32px;
    gap: 12px;
    padding: 10px 12px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#billing-age-bands-container {
    /* No max-height - show all bands */
}

.age-band-row {
    display: grid;
    grid-template-columns: 160px 1fr 32px;
    gap: 12px;
    padding: 8px 12px;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
}

.age-band-row:last-child {
    border-bottom: none;
}

.age-band-row:nth-child(odd) {
    background: var(--gray-50);
}

.age-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.age-range-inputs input {
    width: 60px;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    text-align: center;
}

.age-range-inputs input:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 2px rgba(152, 180, 160, 0.2);
}

.age-separator {
    color: var(--text-gray);
    font-weight: 500;
}

.age-band-row .age-band-rate {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
}

.age-band-row .age-band-rate:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 2px rgba(152, 180, 160, 0.2);
}

.age-band-row .age-band-rate::placeholder {
    color: var(--gray-400);
}

.age-band-row .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--gray-400);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 18px;
    line-height: 1;
}

.age-band-row .btn-icon:hover {
    background: #fee2e2;
    color: #dc2626;
}

.add-band-btn {
    margin-top: 0;
}

/* Notes Group */
.notes-group {
    margin-bottom: 0;
}

.notes-group textarea {
    resize: vertical;
    min-height: 60px;
}

.optional-label {
    font-weight: 400;
    color: var(--text-gray);
    font-size: 12px;
}

/* Modal Footer */
.billing-config-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    border-radius: 0 0 16px 16px;
}

.footer-left {
    flex: 1;
}

.footer-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid #fca5a5;
    color: #dc2626;
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-danger-outline:hover {
    background: #fee2e2;
    border-color: #f87171;
}

.billing-config-footer .btn {
    padding: 10px 20px;
    font-size: 13px;
    white-space: nowrap;
}

#billing-save-new-version-btn {
    padding: 10px 14px;
    font-size: 12px;
}

/* =====================================================
   BILLING PLANS CARDS
   ===================================================== */

.billing-plans-section {
    margin-bottom: 32px;
}

.plans-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.plan-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
}

.plan-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.plan-card-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.plan-card-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--near-black);
}

.plan-config-summary {
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 400;
}

.status-configured {
    background: var(--sage-green) !important;
    color: var(--white) !important;
}

.plan-card-actions {
    display: flex;
    gap: 8px;
}

.plan-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--gray-100);
    font-size: 13px;
    color: var(--text-gray);
}

.detail-item strong {
    color: var(--near-black);
}

.detail-link {
    color: var(--primary-blue);
    text-decoration: none;
}

.detail-link:hover {
    text-decoration: underline;
}

/* Coverage Tiers */
.plan-coverages {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

.coverages-header {
    margin-bottom: 12px;
}

.coverages-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
}

.coverages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coverage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--gray-50);
    border-radius: 8px;
    font-size: 13px;
}

.coverage-name {
    flex: 1;
    font-weight: 500;
    color: var(--near-black);
}

.coverage-config {
    color: var(--text-gray);
    font-size: 12px;
}

.coverage-inherit {
    font-style: italic;
    color: var(--gray-400);
}

/* Extra small button */
.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
}

/* Config History Section */
.config-history-toggle {
    font-size: 12px;
    color: var(--primary-blue);
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.config-history-toggle:hover {
    text-decoration: underline;
}

.config-history-toggle .toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.config-history-toggle.expanded .toggle-icon {
    transform: rotate(90deg);
}

.config-history-section {
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 3px solid var(--gray-300);
}

.config-history-section.hidden {
    display: none;
}

.config-history-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    margin-bottom: 10px;
}

.config-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.config-history-item:last-child {
    margin-bottom: 0;
}

.config-history-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.config-history-date {
    font-weight: 500;
    color: var(--near-black);
}

.config-history-details {
    color: var(--text-gray);
}

.config-history-actions {
    display: flex;
    gap: 6px;
}

.config-history-actions .btn-xs {
    padding: 2px 8px;
    font-size: 10px;
}

.btn-danger-outline {
    color: var(--error-red);
    border-color: var(--error-red);
    background: transparent;
}

.btn-danger-outline:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* Excluded Plans Section */
.excluded-section {
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.excluded-section .section-label {
    margin-bottom: 12px;
}

.excluded-plans-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.excluded-plan-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.excluded-plan-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.excluded-plan-info .plan-name {
    font-weight: 500;
    color: var(--near-black);
}

.exclusion-reason {
    font-size: 12px;
    color: var(--text-gray);
    font-style: italic;
}

.excluded-plan-actions {
    display: flex;
    gap: 8px;
}

.excluded-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.excluded-section-header .section-label {
    margin-bottom: 0;
}

.excluded-count {
    font-size: 12px;
    color: var(--text-gray);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 10px;
}

.excluded-section-note {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0 0 16px 0;
}

/* Exclude Plan Modal */
.exclude-plan-modal {
    max-width: 450px;
}

.exclude-plan-modal .modal-body {
    padding: 24px;
}

.exclude-plan-message {
    font-size: 15px;
    color: var(--near-black);
    margin: 0 0 8px 0;
}

.exclude-plan-note {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0 0 20px 0;
}

.exclude-plan-modal .form-group {
    margin-bottom: 0;
}

.exclude-plan-modal .form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 6px;
    display: block;
}

.exclude-plan-modal .form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.exclude-plan-modal .form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.15);
}

.exclude-plan-modal .modal-footer {
    padding: 16px 24px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Generate Bill Modal */
#sb-generate-bill-modal .modal-content {
    padding: 0;
}

#sb-generate-bill-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

#sb-generate-bill-modal .modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--near-black);
    margin: 0;
}

#sb-generate-bill-modal .modal-close {
    position: static;
    font-size: 24px;
}

#sb-generate-bill-modal .modal-body {
    padding: 24px;
}

#sb-generate-bill-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

#sb-generate-bill-modal .form-group {
    margin-bottom: 16px;
}

#sb-generate-bill-modal .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

#sb-generate-bill-modal .form-group select,
#sb-generate-bill-modal .form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    box-sizing: border-box;
}

#sb-generate-bill-modal .form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

#sb-generate-bill-modal .form-group select:focus,
#sb-generate-bill-modal .form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.15);
}

/* Bill Detail Modal */
#sb-bill-detail-modal .modal-content {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

#sb-bill-detail-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

#sb-bill-detail-modal .modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--near-black);
    margin: 0;
}

#sb-bill-detail-modal .modal-close {
    position: static;
    font-size: 24px;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sb-bill-detail-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    min-height: 0;
}

#sb-bill-detail-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 28px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-shrink: 0;
}

#sb-bill-detail-modal .modal-footer .btn {
    min-width: 100px;
}

#sb-bill-detail-modal .bill-summary {
    margin-bottom: 24px;
}

#sb-bill-detail-modal .bill-summary-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

#sb-bill-detail-modal .bill-summary-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 14px 18px;
    min-width: 100px;
    flex: 1;
}

#sb-bill-detail-modal .bill-summary-card.bill-summary-total {
    background: var(--sage-green);
    border-color: var(--sage-green);
}

#sb-bill-detail-modal .bill-summary-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    margin-bottom: 4px;
}

#sb-bill-detail-modal .bill-summary-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--near-black);
}

#sb-bill-detail-modal .bill-meta {
    font-size: 13px;
    color: var(--text-gray);
    margin-top: 12px;
    line-height: 1.5;
}

#sb-bill-detail-modal .table-container {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

#sb-bill-detail-modal .bill-summary-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
    min-width: 900px;
}

#sb-bill-detail-modal .bill-summary-table th {
    background: var(--gray-100);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-gray);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

#sb-bill-detail-modal .bill-summary-table th.text-right {
    text-align: right;
}

#sb-bill-detail-modal .bill-summary-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    white-space: nowrap;
}

#sb-bill-detail-modal .bill-summary-table td.text-right {
    text-align: right;
}

#sb-bill-detail-modal .bill-summary-table tbody tr:last-child td {
    border-bottom: none;
}

#sb-bill-detail-modal .bill-summary-table tr:hover {
    background: var(--gray-50);
}

/* Bill modal footer with split layout */
.bill-modal-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center;
    padding: 10px 20px !important;
}

.bill-modal-footer .modal-footer-left {
    display: flex;
    gap: 8px;
}

.bill-modal-footer .modal-footer-right {
    display: flex;
    gap: 8px;
}

.bill-modal-footer .btn {
    padding: 5px 12px;
    font-size: 12px;
    min-width: auto;
}

/* Text button style for delete */
.btn.btn-text {
    background: transparent;
    border: none;
    padding: 5px 10px;
    font-size: 12px;
}

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

.btn.btn-text.btn-danger:hover {
    background: rgba(246, 140, 74, 0.1);
}

/* Compact summary cards */
#sb-bill-detail-modal .bill-summary-cards.compact {
    gap: 10px;
}

#sb-bill-detail-modal .bill-summary-cards.compact .bill-summary-card {
    padding: 10px 14px;
    min-width: 80px;
}

#sb-bill-detail-modal .bill-summary-cards.compact .bill-summary-label {
    font-size: 10px;
    margin-bottom: 2px;
}

#sb-bill-detail-modal .bill-summary-cards.compact .bill-summary-value {
    font-size: 16px;
}

/* Status badge in title */
#sb-bill-detail-modal .modal-header h2 .status-badge {
    font-size: 11px;
    vertical-align: middle;
    margin-left: 8px;
}

/* Plan group header rows */
#sb-bill-detail-modal .plan-group-header {
    background: var(--gray-100) !important;
}

#sb-bill-detail-modal .plan-group-header td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
}

#sb-bill-detail-modal .plan-group-header:hover {
    background: var(--gray-100) !important;
}

/* Plan detail rows - indented */
#sb-bill-detail-modal .plan-detail-row td:first-child {
    padding-left: 28px;
}

#sb-bill-detail-modal .plan-detail-row {
    font-size: 12px;
    color: var(--gray-600);
}

/* Bill meta info styling */
#sb-bill-detail-modal .bill-meta {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 8px;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    background: var(--primary-dark);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.toast-success {
    background: var(--success-color);
    color: var(--near-black);
}

.toast-notification.toast-error {
    background: var(--danger-color);
    color: white;
}

.toast-notification.toast-info {
    background: var(--sage-green);
    color: var(--near-black);
}

/* ==============================================================================
   BILL TEMPLATES STYLES
   ============================================================================== */

/* Templates View */
#sb-templates-view .view-header {
    margin-bottom: 24px;
}

#sb-templates-view .view-description {
    font-size: 14px;
    color: var(--text-gray);
    margin-top: 8px;
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
}

/* Templates Grid - follows plan-card pattern */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* Template Card - matches plan-card style */
.template-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.15s ease;
}

.template-card:hover {
    border-color: var(--sage-green);
}

.template-card.default {
    border-color: var(--sage-green);
    border-width: 2px;
}

.template-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.template-card-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--near-black);
    font-family: 'Libre Franklin', sans-serif;
}

.template-description {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.template-meta {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 16px;
    display: flex;
    gap: 16px;
}

.template-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}

/* Template badges */
.template-card .badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.template-card .badge-primary {
    background: var(--sage-green);
    color: var(--white);
}

.template-card .badge-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Template Builder Modal - follows billing-config-modal pattern */
#sb-template-builder-modal .modal-content {
    max-width: 700px;
    padding: 0;
}

#sb-template-builder-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    border-bottom: 1px solid var(--gray-200);
}

#sb-template-builder-modal .modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--near-black);
    margin: 0;
    font-family: 'Libre Franklin', sans-serif;
}

#sb-template-builder-modal .modal-close {
    position: static;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

#sb-template-builder-modal .modal-close:hover {
    color: var(--near-black);
}

#sb-template-builder-modal .modal-body {
    padding: 0;
    max-height: 60vh;
    overflow-y: auto;
}

#sb-template-builder-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 28px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Template Tabs */
.template-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    padding: 0 28px;
}

.template-tab {
    padding: 14px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--gray-500);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}

.template-tab:hover {
    color: var(--near-black);
}

.template-tab.active {
    color: var(--sage-green);
    border-bottom-color: var(--sage-green);
}

.template-tab-content {
    padding: 24px 28px;
}

.template-tab-content.hidden {
    display: none;
}

/* Form styles inside template builder */
#sb-template-builder-modal .form-group {
    margin-bottom: 16px;
}

#sb-template-builder-modal .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

#sb-template-builder-modal .form-group input,
#sb-template-builder-modal .form-group select,
#sb-template-builder-modal .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}

#sb-template-builder-modal .form-group input:focus,
#sb-template-builder-modal .form-group select:focus,
#sb-template-builder-modal .form-group textarea:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15);
}

#sb-template-builder-modal .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--primary-dark);
    cursor: pointer;
}

#sb-template-builder-modal .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--sage-green);
}

/* Column Configuration */
.columns-config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.columns-section h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--near-black);
    font-family: 'Libre Franklin', sans-serif;
}

.section-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin: 0 0 12px 0;
}

.columns-list {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--white);
}

.column-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    background: var(--white);
    transition: background 0.1s ease;
}

.column-item:last-child {
    border-bottom: none;
}

.column-item:hover {
    background: var(--gray-50);
}

.drag-handle {
    cursor: grab;
    color: var(--gray-400);
    margin-right: 12px;
    font-size: 14px;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.sortable-ghost {
    background: var(--gray-100);
    opacity: 0.7;
}

.column-item .checkbox-label {
    flex: 1;
}

/* Plan Mappings */
#template-plan-mappings {
    margin-bottom: 16px;
}

.plan-mapping-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.plan-mapping-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.plan-mapping-row input:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15);
}

.mapping-arrow {
    color: var(--gray-400);
    font-size: 16px;
}

.plan-mapping-row .btn-danger {
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1;
}

/* Branding Preview */
.branding-preview {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    transition: opacity 0.2s ease;
}

.branding-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.branding-preview-header strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
}

.branding-summary {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.logo-thumbnail {
    max-width: 80px;
    max-height: 60px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
}

.branding-info {
    font-size: 14px;
    line-height: 1.6;
    color: var(--primary-dark);
}

/* Branding Editor Modal */
#sb-branding-modal .modal-content {
    max-width: 600px;
    padding: 0;
}

#sb-branding-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    border-bottom: 1px solid var(--gray-200);
}

#sb-branding-modal .modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--near-black);
    margin: 0;
    font-family: 'Libre Franklin', sans-serif;
}

#sb-branding-modal .modal-close {
    position: static;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

#sb-branding-modal .modal-body {
    padding: 24px 28px;
    max-height: 60vh;
    overflow-y: auto;
}

#sb-branding-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 28px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.branding-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray-200);
}

.branding-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.branding-section h4 {
    margin: 0 0 16px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Libre Franklin', sans-serif;
}

/* Logo Upload */
.logo-upload-area {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.logo-preview {
    width: 120px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    overflow: hidden;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-preview .no-logo {
    color: var(--gray-400);
    font-size: 12px;
    text-align: center;
}

.logo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.logo-actions .field-hint {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Form Grids */
.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-grid-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

#sb-branding-modal .form-group {
    margin-bottom: 16px;
}

#sb-branding-modal .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

#sb-branding-modal .form-group input,
#sb-branding-modal .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}

#sb-branding-modal .form-group input:focus,
#sb-branding-modal .form-group textarea:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15);
}

/* Color inputs */
input[type="color"] {
    -webkit-appearance: none;
    width: 100%;
    height: 42px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 4px;
    cursor: pointer;
    background: var(--white);
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

input[type="color"]:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15);
}

/* Export Options in Bill Detail Modal */
.export-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 12px;
}

.export-select {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    min-width: 140px;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
}

.export-select:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .columns-config {
        grid-template-columns: 1fr;
    }

    #sb-template-builder-modal .modal-content,
    #sb-branding-modal .modal-content {
        width: 95%;
        max-width: none;
    }

    .form-grid-2col,
    .form-grid-3col {
        grid-template-columns: 1fr;
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }

    .export-options {
        flex-direction: column;
        align-items: stretch;
    }

    .template-tabs {
        padding: 0 16px;
        overflow-x: auto;
    }

    .template-tab {
        padding: 12px 16px;
        white-space: nowrap;
    }

    .template-tab-content {
        padding: 20px 16px;
    }

    #sb-template-builder-modal .modal-header,
    #sb-branding-modal .modal-header,
    #sb-template-builder-modal .modal-footer,
    #sb-branding-modal .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}
