/* Tailwind Architecture Style Guide CSS
 * This file contains all CSS for the Tailwind component library
 * Used in /style-guide/ and can be imported in base layouts
 */

/* TABLE OF CONTENTS:
 * 1. Page Header Components
 * 2. Filter Bar Components
 * 3. Modal Components
 * 4. Form Components
 * 5. Table Components
 * 6. Button Components
 * 7. Manager Page Components (from manager.html)
 * 8. Base Layout Styles (from base_standardized.html)
 * 9. Dashboard Components (dashboard-rebooted)
 * 10. Tab Navigation Components (For Update Pages)
 * 11. Appointment Update Page Components
 * 12. Foreign Key CRUD Components (from invoice_create_fullpage.html)
 * 13. Print Preview Components (from invoices/print.html)
 */


/* === PAGE HEADER COMPONENTS === */

/* Standard Page Header */
.tw-page-header {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #2563eb, #1e40af);
    color: white;
    position: relative;
    overflow: hidden;
}

.tw-page-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(to right, #2563eb, #1d4ed8, #1e40af);
    opacity: 0.9;
}

.tw-page-header-content {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.tw-page-header-text {
    flex: 1;
    min-width: 0;
}

.tw-page-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Single column layout on mobile */
@media (max-width: 768px) {
    .tw-page-header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tw-page-header-actions {
        align-items: center;
        margin-top: 0.5rem;
    }
}

.tw-page-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.25;
    margin-top: 0;
}

.tw-page-subtitle {
    font-size: 1.125rem;
    font-weight: 300;
    opacity: 0.9;
    line-height: 1.625;
    margin-bottom: 0;
}

/* Header Color Variants */
.tw-page-header-primary {
    background: linear-gradient(to right, #667eea, #764ba2);
}

.tw-page-header-primary::before {
    background: linear-gradient(to right, #667eea, #7c3aed, #764ba2);
}

.tw-page-header-success {
    background: linear-gradient(to right, #059669, #047857);
}

.tw-page-header-success::before {
    background: linear-gradient(to right, #059669, #0d9488, #047857);
}

.tw-page-header-warning {
    background: linear-gradient(to right, #d97706, #b45309);
}

.tw-page-header-warning::before {
    background: linear-gradient(to right, #d97706, #ca8a04, #b45309);
}

.tw-page-header-danger {
    background: linear-gradient(to right, #dc2626, #b91c1c);
}

.tw-page-header-danger::before {
    background: linear-gradient(to right, #dc2626, #e11d48, #b91c1c);
}

.tw-page-header-info {
    background: linear-gradient(to right, #0891b2, #0e7490);
}

.tw-page-header-info::before {
    background: linear-gradient(to right, #0891b2, #0284c7, #0e7490);
}

.tw-page-header-secondary {
    background: linear-gradient(to right, #4b5563, #374151);
}

.tw-page-header-secondary::before {
    background: linear-gradient(to right, #4b5563, #6b7280, #374151);
}

.tw-page-header-dark {
    background: linear-gradient(to right, #1f2937, #111827);
}

.tw-page-header-dark::before {
    background: linear-gradient(to right, #1f2937, #374151, #111827);
}

/* Page Header with Info Section (Connected Design) */
.tw-page-header-with-info {
    border-radius: 0.5rem 0.5rem 0 0; /* Only top corners rounded */
    padding-bottom: 1.5rem; /* Keep padding for header content */
}

.tw-page-header-info {
    position: relative;
    z-index: 10;
    background-color: #f8f9fa;
    color: #212529; /* Dark text for info section */
    padding: 1.5rem;
    margin: 1.5rem -1.5rem -1.5rem -1.5rem; /* Negative margins to extend to edges */
    border-radius: 0 0 0.5rem 0.5rem; /* Only bottom corners rounded */
}

/* Responsive adjustments for page headers */
@media (max-width: 768px) {
    .tw-page-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    .tw-page-title {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    .tw-page-subtitle {
        font-size: 1rem;
    }
}

/* Unified Dashboard Header Wrapper - Combines page header and quick action bar */
.tw-dashboard-header-unified {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Header inside unified container - remove bottom radius and margin */
.tw-dashboard-header-unified .tw-page-header {
    border-radius: 0.5rem 0.5rem 0 0;  /* Only top corners rounded */
    margin-bottom: 0;
    box-shadow: none;
}

/* Action bar inside unified container - remove top radius and shadow */
.tw-dashboard-header-unified .tw-dashboard-quick-action-bar {
    border-radius: 0 0 0.5rem 0.5rem;  /* Only bottom corners rounded */
    box-shadow: none;
    margin-bottom: 0;
}

/* === BASE COMPONENTS === */

/* Typography */
.tw-text-xs { font-size: 0.75rem; line-height: 1rem; }
.tw-text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.tw-text-base { font-size: 1rem; line-height: 1.5rem; }
.tw-text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.tw-text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.tw-text-2xl { font-size: 1.5rem; line-height: 2rem; }
.tw-text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.tw-text-4xl { font-size: 2.25rem; line-height: 2.5rem; }

.tw-font-light { font-weight: 300; }
.tw-font-normal { font-weight: 400; }
.tw-font-medium { font-weight: 500; }
.tw-font-semibold { font-weight: 600; }
.tw-font-bold { font-weight: 700; }

.tw-text-gray-500 { color: #6b7280; }
.tw-text-gray-700 { color: #374151; }
.tw-text-gray-900 { color: #111827; }
.tw-text-primary { color: #2563eb; }
.tw-text-secondary { color: #4b5563; }
.tw-text-success { color: #059669; }
.tw-text-danger { color: #dc2626; }
.tw-text-warning { color: #d97706; }
.tw-text-info { color: #0891b2; }

/* Links - Global override for Tailwind's aggressive reset */
a {
    color: #007bff;
    text-decoration: underline;
    transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

a:active {
    color: #004085;
}

/* Specific contexts where links should not be styled */
.nav-link a,
.navbar a,
.btn a,
button a {
    color: inherit;
    text-decoration: none;
}

/* Layout */
.tw-container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.tw-flex { display: flex; }
.tw-flex-wrap { flex-wrap: wrap; }
.tw-flex-col { flex-direction: column; }
.tw-items-center { align-items: center; }
.tw-justify-center { justify-content: center; }
.tw-justify-between { justify-content: space-between; }
.tw-gap-2 { gap: 0.5rem; }
.tw-gap-4 { gap: 1rem; }
.tw-gap-6 { gap: 1.5rem; }

/* Overflow Utilities */
.tw-overflow-visible { overflow: visible !important; }
.tw-overflow-hidden { overflow: hidden !important; }

.tw-grid { display: grid; }
.tw-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.tw-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tw-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tw-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 768px) {
    .md\:tw-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:tw-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:tw-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Spacing */
.tw-m-0 { margin: 0; }
.tw-m-1 { margin: 0.25rem; }
.tw-m-2 { margin: 0.5rem; }
.tw-m-3 { margin: 0.75rem; }
.tw-m-4 { margin: 1rem; }
.tw-mb-0 { margin-bottom: 0; }
.tw-mb-2 { margin-bottom: 0.5rem; }
.tw-mb-3 { margin-bottom: 0.75rem; }
.tw-mb-4 { margin-bottom: 1rem; overflow: visible; }
.tw-mb-6 { margin-bottom: 1.5rem; }
.tw-mt-2 { margin-top: 0.5rem; }
.tw-mt-4 { margin-top: 1rem; }
.tw-mt-6 { margin-top: 1.5rem; }
.tw-ml-2 { margin-left: 0.5rem; }
.tw-mr-2 { margin-right: 0.5rem; }
.tw-mx-auto { margin-left: auto; margin-right: auto; }

.tw-p-2 { padding: 0.5rem; }
.tw-p-3 { padding: 0.75rem; }
.tw-p-4 { padding: 1rem; }
.tw-p-6 { padding: 1.5rem; }
.tw-px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.tw-px-4 { padding-left: 1rem; padding-right: 1rem; }
.tw-px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.tw-py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.tw-py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.tw-py-4 { padding-top: 1rem; padding-bottom: 1rem; }

/* Background Colors for Use Cases */
.tw-bg-blue-50 { background-color: #eff6ff; }
.tw-bg-green-50 { background-color: #f0fdf4; }
.tw-bg-yellow-50 { background-color: #fefce8; }
.tw-bg-red-50 { background-color: #fef2f2; }
.tw-bg-cyan-50 { background-color: #ecfeff; }
.tw-bg-gray-50 { background-color: #f9fafb; }

/* Border Colors for Use Cases */
.tw-border-l-4 { border-left-width: 4px; }
.tw-border-blue-400 { border-color: #60a5fa; }
.tw-border-green-400 { border-color: #4ade80; }
.tw-border-yellow-400 { border-color: #facc15; }
.tw-border-red-400 { border-color: #f87171; }
.tw-border-cyan-400 { border-color: #22d3ee; }
.tw-border-gray-400 { border-color: #9ca3af; }

/* Text Colors for Use Cases */
.tw-text-blue-800 { color: #1e40af; }
.tw-text-green-800 { color: #166534; }
.tw-text-yellow-800 { color: #92400e; }
.tw-text-red-800 { color: #991b1b; }
.tw-text-cyan-800 { color: #155e75; }
.tw-text-gray-800 { color: #1f2937; }

/* Space utilities */
.tw-space-y-1 > * + * { margin-top: 0.25rem; }
.tw-space-y-2 > * + * { margin-top: 0.5rem; }
.tw-space-y-4 > * + * { margin-top: 1rem; }
.tw-space-y-6 > * + * { margin-top: 1.5rem; }

/* === PAGINATION COMPONENTS === */

/* Pagination Container */
.tw-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #e5e7eb;
    background-color: white;
    padding: 0.75rem 1rem;
}

@media (min-width: 640px) {
    .tw-pagination {
        padding: 0.75rem 1.5rem;
    }
}

/* Mobile Pagination (Previous/Next only) */
.tw-pagination-mobile {
    display: flex;
    flex: 1;
    justify-content: space-between;
}

@media (min-width: 640px) {
    .tw-pagination-mobile {
        display: none;
    }
}

/* Desktop Pagination */
.tw-pagination-desktop {
    display: none;
}

@media (min-width: 640px) {
    .tw-pagination-desktop {
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: space-between;
    }
}

/* Pagination Info Text */
.tw-pagination-info {
    font-size: 0.875rem;
    color: #374151;
}

.tw-pagination-info .tw-font-medium {
    font-weight: 500;
}

/* Pagination Navigation */
.tw-pagination-nav {
    isolation: isolate;
    display: inline-flex;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Pagination Link Base */
.tw-pagination-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    border: 1px solid #d1d5db;
    background-color: white;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    margin-left: -1px;
}

.tw-pagination-link:hover {
    background-color: #f9fafb;
    text-decoration: none;
    color: #111827;
}

.tw-pagination-link:focus {
    z-index: 20;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Mobile Pagination Links */
.tw-pagination-mobile .tw-pagination-link {
    border-radius: 0.375rem;
    margin-left: 0;
    padding: 0.5rem 1rem;
}

.tw-pagination-mobile .tw-pagination-link:last-child {
    margin-left: 0.75rem;
}

/* Navigation Arrow Links */
.tw-pagination-arrow {
    padding: 0.5rem;
    color: #6b7280;
}

.tw-pagination-arrow svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* First/Last Navigation Links */
.tw-pagination-nav .tw-pagination-link:first-child,
.tw-pagination-nav .tw-pagination-arrow:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
    margin-left: 0;
}

.tw-pagination-nav .tw-pagination-link:last-child,
.tw-pagination-nav .tw-pagination-arrow:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Current Page Link */
.tw-pagination-link.active {
    z-index: 10;
    background-color: #2563eb;
    color: white;
}

.tw-pagination-link.active:hover {
    background-color: #1d4ed8;
    color: white;
}

.tw-pagination-link.active:focus {
    outline-color: #2563eb;
}

/* Disabled Pagination Links */
.tw-pagination-disabled {
    color: #9ca3af !important;
    background-color: #f9fafb !important;
    border-color: #e5e7eb !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.tw-pagination-disabled:hover {
    color: #9ca3af !important;
    background-color: #f9fafb !important;
    border-color: #e5e7eb !important;
}

/* Pagination Ellipsis */
.tw-pagination-ellipsis {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    border: 1px solid #d1d5db;
    background-color: white;
    margin-left: -1px;
}

/* Hidden on Mobile */
.tw-pagination-hidden-mobile {
    display: none;
}

@media (min-width: 768px) {
    .tw-pagination-hidden-mobile {
        display: inline-flex;
    }
}

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

/* Compact Pagination Variant */
.tw-pagination-compact {
    padding: 0.5rem 1rem;
}

.tw-pagination-compact .tw-pagination-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.tw-pagination-compact .tw-pagination-arrow {
    padding: 0.375rem;
}

/* Large Pagination Variant */
.tw-pagination-large {
    padding: 1rem 1.5rem;
}

.tw-pagination-large .tw-pagination-link {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
}

.tw-pagination-large .tw-pagination-arrow {
    padding: 0.75rem;
}

/* === STICKY TABLE OF CONTENTS === */

/* Fixed Table of Contents */
.tw-toc-sidebar {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 280px;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1500; /* Tooltips/Dropdowns layer */
    padding: 1.5rem;
}

.tw-toc-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1400; /* UI controls layer */
    transition: all 0.2s ease-in-out;
}

.tw-toc-toggle:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

.tw-toc-toggle i {
    font-size: 1.25rem;
}

/* TOC Header */
.tw-toc-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.tw-toc-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

/* TOC Content */
.tw-toc-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tw-toc-section h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.tw-toc-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tw-toc-links li {
    margin: 0;
}

.tw-toc-links a {
    display: block;
    padding: 0.375rem 0;
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: none;
    border-radius: 0.25rem;
    transition: all 0.2s ease-in-out;
}

.tw-toc-links a:hover {
    color: #2563eb;
    background-color: #f3f4f6;
    text-decoration: none;
    padding-left: 0.5rem;
}

.tw-toc-links a.active {
    color: #2563eb;
    font-weight: 500;
    background-color: #eff6ff;
    padding-left: 0.5rem;
}

/* Hide TOC when closed */
.tw-toc-sidebar.hidden {
    display: none;
}

/* Responsive behavior */
@media (max-width: 1200px) {
    .tw-toc-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        height: 100vh;
        max-height: none;
        border-radius: 0;
        border-right: none;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .tw-toc-sidebar.show {
        transform: translateX(0);
    }
    
    .tw-toc-sidebar.hidden {
        display: block;
        transform: translateX(100%);
    }
}

@media (max-width: 768px) {
    .tw-toc-sidebar {
        width: 100%;
    }
    
    .tw-toc-toggle {
        top: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
    }
}

/* Close button for mobile */
.tw-toc-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1.5rem;
}

@media (max-width: 1200px) {
    .tw-toc-close {
        display: block;
    }
}

/* === SEARCH BAR COMPONENTS === */

/* Search Bar Container */
.tw-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 400px;
    width: 100%;
}

/* Search Input */
.tw-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-left: 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: white;
    color: #374151;
    transition: all 0.2s ease-in-out;
}

.tw-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tw-search-input::placeholder {
    color: #9ca3af;
}

/* Search Icon */
.tw-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 1rem;
    pointer-events: none;
}

/* Search Clear Button */
.tw-search-clear {
    flex-shrink: 0;
    padding: 0 1rem;
    background-color: #ef4444;
    color: white;
    border: 1px solid #ef4444;
    border-left: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tw-search-clear:hover {
    background-color: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.tw-search-clear:focus {
    outline: none;
    background-color: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Adjust search input when clear button is present */
.tw-search-bar:has(.tw-search-clear) .tw-search-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

/* Search clear button connects to clear-filters button */
.tw-search-bar:has(.tw-clear-filters-button) .tw-search-clear {
    border-right: none;
}

/* Adjust search input when followed by clear-filters button (no search-clear) */
.tw-search-bar:has(.tw-clear-filters-button):not(:has(.tw-search-clear)) .tw-search-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

/* Search Bar Variants */
.tw-search-bar-compact {
    max-width: 300px;
}

.tw-search-bar-expanded {
    max-width: 600px;
}

.tw-search-bar-full {
    max-width: none;
}

/* Search Bar with Button */
.tw-search-with-button {
    display: flex;
    max-width: 500px;
    width: 100%;
}

.tw-search-with-button .tw-search-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

/* Search input inside filter bar with clear button */
.tw-filter-bar .tw-search-bar .tw-search-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.tw-search-with-button .tw-search-button,
.tw-search-button {
    padding: 0.80rem 1rem;
    background-color: #1f2937;
    color: white;
    border: 1px solid #1f2937;
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
}

.tw-search-with-button .tw-search-button:hover,
.tw-search-button:hover {
    background-color: #111827;
    border-color: #111827;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tw-search-with-button .tw-search-button:focus,
.tw-search-button:focus {
    outline: none;
    background-color: #111827;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(75, 85, 99, 0.1);
}

/* Search Button Active/Ready State */
.tw-search-button.ready {
    background-color: #2563eb;
    border-color: #2563eb;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.tw-search-button.ready:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    box-shadow: 0 6px 16px rgba(29, 78, 216, 0.4);
}

/* Clear All Filters Button */
.tw-clear-filters-button {
    padding: 0.80rem 1rem;
    background-color: #1f2937;
    color: white;
    border: 1px solid #1f2937;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Clear All Filters Button inside search bar - connected styling */
.tw-search-bar .tw-clear-filters-button {
    margin-left: 0;
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.tw-clear-filters-button:hover {
    background-color: #111827;
    border-color: #111827;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.tw-clear-filters-button:focus {
    outline: none;
    background-color: #111827;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(75, 85, 99, 0.1);
}

/* Clear Filters Button Active State (when filters are applied) */
.tw-clear-filters-button.filters-active {
    background-color: #dc2626;
    border-color: #dc2626;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}
.tw-clear-filters-button.filters-active:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
    box-shadow: 0 6px 16px rgba(185, 28, 28, 0.4);
}
.tw-clear-filters-button.filters-active:focus {
    outline: none;
    background-color: #b91c1c;
    border-color: #b91c1c;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tw-search-bar {
        max-width: none;
    }
    
    .tw-search-with-button {
        max-width: none;
    }
}

/* === FILTER BAR COMPONENTS === */

/* List Controls Container */
.tw-list-controls {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* List Controls Left Section */
.tw-list-controls-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* List Controls Right Section */
.tw-list-controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Connected Button Group Filter Tabs */
.tw-filter-tabs {
    display: flex;
}

.tw-filter-tab {
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #64748b;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.tw-filter-tab:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    color: white;
    background-color: #1e293b;
    text-decoration: none;
    z-index: 2;
}

.tw-filter-tab:focus {
    color: white;
    background-color: #1e293b;
    z-index: 2;
    outline: none;
}

.tw-filter-tab.active {
    color: white;
    background-color: #1e293b;
    z-index: 2;
}

.tw-filter-tab.active:hover {
    background-color: #0f172a;
}

.tw-filter-tab:disabled {
    pointer-events: none;
    opacity: 0.5;
    box-shadow: none;
}

/* First tab (Active) - rounded left, straight right */
.tw-filter-tab:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

/* Middle tab (Archive) - no border radius, add left border divisor */
.tw-filter-tab:nth-child(2) {
    border-radius: 0;
    border-left: 1px solid #cbd5e1;
}

.tw-filter-tab:nth-child(2):hover {
    border-left: 1px solid #1e293b;
}

.tw-filter-tab:nth-child(2):focus,
.tw-filter-tab:nth-child(2).active {
    border-left: 1px solid #1e293b;
}

/* Last tab (All) - straight left, rounded right, add left border divisor */
.tw-filter-tab:last-child {
    border-radius: 0 0.375rem 0.375rem 0;
    border-left: 1px solid #cbd5e1;
}

.tw-filter-tab:last-child:hover {
    border-left: 1px solid #1e293b;
}

.tw-filter-tab:last-child:focus,
.tw-filter-tab:last-child.active {
    border-left: 1px solid #1e293b;
}

/* Responsive adjustments for list controls */
@media (max-width: 768px) {
    .tw-list-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .tw-list-controls-left,
    .tw-list-controls-right {
        justify-content: center;
    }
    
    .tw-filter-tabs {
        justify-content: center;
    }
}

/* === NEW FILTER BAR STYLES === */

/* Filter Bar Container */
.tw-filter-bar {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    margin-top: 1.5rem; /* 48px spacing from filter cards */
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

/* Filter Bar Left Section - Search and Filters */
.tw-filter-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

/* Filter Bar Right Section - Status Tabs and Counter */
.tw-filter-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Filter Bar Field Group */
.tw-filter-field-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Filter Bar Field Label */
.tw-filter-field-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

/* Filter Bar Counter */
.tw-filter-counter {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
}

/* Filter Bar Date Input */
.tw-filter-date-input {
    padding: 0.375rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: white;
    width: 140px;
    transition: border-color 0.15s ease-in-out;
}

.tw-filter-date-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Responsive adjustments for filter bar */
@media (max-width: 768px) {
    .tw-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .tw-filter-bar-left {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .tw-filter-bar-right {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .tw-filter-field-group {
        justify-content: space-between;
    }
    
    .tw-filter-date-input {
        width: auto;
        flex: 1;
    }
}

/* === CARD COMPONENTS === */
.tw-card {
    @apply bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden;
}

.tw-card-header {
    @apply px-6 py-4 border-b border-gray-200 bg-gray-50;
}

.tw-card-title {
    @apply text-lg font-semibold text-gray-900 mb-0;
}

.tw-card-body {
    @apply px-6 py-4;
}

.tw-card-footer {
    @apply px-6 py-4 border-t border-gray-200 bg-gray-50;
}

/* === BUTTON COMPONENTS === */
.tw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.25;
    min-height: 38px;
}

.tw-btn-primary {
    background-color: #2563eb;
    color: white;
}
.tw-btn-primary:hover {
    background-color: #1d4ed8;
    text-decoration: none;
    color: white;
}

.tw-btn-secondary {
    background-color: #4b5563;
    color: white;
}
.tw-btn-secondary:hover {
    background-color: #374151;
    text-decoration: none;
    color: white;
}

.tw-btn-success {
    background-color: #059669;
    color: white;
    border-color: #059669;
}
.tw-btn-success:hover {
    background-color: #047857;
    color: white;
    border-color: #047857;
    text-decoration: none;
}
.tw-btn-success:focus {
    background-color: #047857;
    color: white;
    border-color: #047857;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.tw-btn-danger {
    @apply bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
}

.tw-btn-warning {
    @apply bg-yellow-600 text-white hover:bg-yellow-700 focus:ring-yellow-500;
}

.tw-btn-info {
    background-color: #0891b2;
    color: white;
    border-color: #0891b2;
}
.tw-btn-info:hover {
    background-color: #0e7490;
    color: white;
    border-color: #0e7490;
    text-decoration: none;
}
.tw-btn-info:focus {
    background-color: #0e7490;
    color: white;
    border-color: #0e7490;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.tw-btn-light {
    @apply bg-gray-100 text-gray-900 hover:bg-gray-200 focus:ring-gray-500;
}

.tw-btn-dark {
    @apply bg-gray-900 text-white hover:bg-gray-800 focus:ring-gray-700;
}

/* Outline buttons */
.tw-btn-outline-primary {
    @apply border-blue-600 text-blue-600 hover:bg-blue-600 hover:text-white focus:ring-blue-500;
}

.tw-btn-outline-secondary {
    @apply border-gray-600 text-gray-600 hover:bg-gray-600 hover:text-white focus:ring-gray-500;
}

/* Solid slate button for headers */
.tw-btn-slate {
    background-color: #64748b;
    border: 1px solid #64748b;
    color: white;
    transition: all 0.2s ease-in-out;
}

.tw-btn-slate:hover {
    background-color: #475569;
    border-color: #475569;
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tw-btn-slate:focus {
    background-color: #475569;
    border-color: #475569;
    color: white;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
}

.tw-btn-slate.active {
    background-color: #334155;
    border-color: #334155;
    color: white;
}

/* Slate outline button to match filter tabs */
.tw-btn-outline-slate {
    border: 1px solid #cbd5e1;
    color: #64748b;
    background: transparent;
    transition: all 0.2s ease-in-out;
}

.tw-btn-outline-slate:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    background-color: #1e293b;
    border-color: #1e293b;
    color: white;
    text-decoration: none;
}

.tw-btn-outline-slate:focus {
    background-color: #1e293b;
    border-color: #1e293b;
    color: white;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.1);
}

.tw-btn-outline-slate.active {
    background-color: #1e293b;
    border-color: #1e293b;
    color: white;
}

.tw-btn-outline-success {
    @apply border-green-600 text-green-600 hover:bg-green-600 hover:text-white focus:ring-green-500;
}

.tw-btn-outline-danger {
    @apply border-red-600 text-red-600 hover:bg-red-600 hover:text-white focus:ring-red-500;
}

.tw-btn-outline-blue {
    @apply border-blue-600 text-blue-600 hover:bg-blue-600 hover:text-white focus:ring-blue-500;
}

.tw-btn-outline-green {
    @apply border-green-600 text-green-600 hover:bg-green-600 hover:text-white focus:ring-green-500;
}

.tw-btn-outline-red {
    @apply border-red-600 text-red-600 hover:bg-red-600 hover:text-white focus:ring-red-500;
}

.tw-btn-outline-yellow {
    @apply border-yellow-600 text-yellow-600 hover:bg-yellow-600 hover:text-white focus:ring-yellow-500;
}

.tw-btn-outline-purple {
    @apply border-purple-600 text-purple-600 hover:bg-purple-600 hover:text-white focus:ring-purple-500;
}

.tw-btn-outline-orange {
    @apply border-orange-600 text-orange-600 hover:bg-orange-600 hover:text-white focus:ring-orange-500;
}

.tw-btn-outline-pink {
    @apply border-pink-600 text-pink-600 hover:bg-pink-600 hover:text-white focus:ring-pink-500;
}

.tw-btn-outline-indigo {
    @apply border-indigo-600 text-indigo-600 hover:bg-indigo-600 hover:text-white focus:ring-indigo-500;
}

.tw-btn-outline-gray {
    @apply border-gray-600 text-gray-600 hover:bg-gray-600 hover:text-white focus:ring-gray-500;
}

/* White solid button for dark backgrounds */
.tw-btn-white {
    background-color: white;
    border: 1px solid white;
    color: #1f2937;
    transition: all 0.2s ease-in-out;
}

.tw-btn-white:hover {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.tw-btn-white:focus {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.tw-btn-white.active {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.95);
    color: #1f2937;
}

/* Button sizes */
.tw-btn-sm {
    @apply px-3 py-1.5 text-xs;
}

.tw-btn-lg {
    @apply px-6 py-3 text-lg;
}

/* Info/Help Button - Small circular button for card headers */
.tw-info-btn {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    background-color: white;
    border: 1px solid #d1d5db;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.tw-info-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    color: #1f2937;
    text-decoration: none;
}

.tw-info-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.2);
}

/* === UTILITY CLASSES === */
.tw-opacity-50 {
    opacity: 0.5;
}

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

/* === ACTION BUTTONS === */
.tw-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: white;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}

/* Ensure anchor tags in action buttons are properly centered */
a.tw-action-btn {
    text-decoration: none;
    line-height: 1;
}

a.tw-action-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    width: 100%;
    height: 100%;
}

.tw-action-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tw-action-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.tw-action-btn:focus {
    outline: none;
    ring: 2px solid #3b82f6;
    ring-offset: 2px;
}

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

/* Action Button Variants */
.tw-action-btn-view {
    color: #3b82f6;
    border-color: #3b82f6;
}

.tw-action-btn-view:hover {
    background-color: #3b82f6;
    color: white;
}

.tw-action-btn-edit {
    color: #059669;
    border-color: #059669;
}

.tw-action-btn-edit:hover {
    background-color: #059669;
    color: white;
}

.tw-action-btn-archive {
    color: #d97706;
    border-color: #d97706;
}

.tw-action-btn-archive:hover {
    background-color: #d97706;
    color: white;
}

.tw-action-btn-duplicate {
    color: #7c3aed;
    border-color: #7c3aed;
}

.tw-action-btn-duplicate:hover {
    background-color: #7c3aed;
    color: white;
}

.tw-action-btn-restore {
    color: #059669;
    border-color: #059669;
}

.tw-action-btn-restore:hover {
    background-color: #059669;
    color: white;
}

.tw-action-btn-clone {
    color: #7c3aed;
    border-color: #7c3aed;
}

.tw-action-btn-clone:hover {
    background-color: #7c3aed;
    color: white;
}

.tw-action-btn-merge {
    color: #dc2626;
    border-color: #dc2626;
}

.tw-action-btn-merge:hover {
    background-color: #dc2626;
    color: white;
}

.tw-action-btn-pdf {
    color: #dc2626;
    border-color: #dc2626;
}

.tw-action-btn-pdf:hover {
    background-color: #dc2626;
    color: white;
}

.tw-action-btn-email {
    color: #0891b2;
    border-color: #0891b2;
}

.tw-action-btn-email:hover {
    background-color: #0891b2;
    color: white;
}

.tw-action-btn-print {
    color: #374151;
    border-color: #374151;
}

.tw-action-btn-print:hover {
    background-color: #374151;
    color: white;
}

/* Action Button Group */
.tw-action-btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    overflow: visible; /* Allow tooltips to escape */
    position: relative; /* Create positioning context for tooltips */
    z-index: 100; /* Ensure action buttons are above other content */
}

.tw-action-btn-group .tw-action-btn {
    flex-shrink: 0;
}

/* === FORM COMPONENTS === */
.tw-form-group {
    @apply mb-4;
}

.tw-form-label {
    @apply block text-sm font-medium text-gray-700 mb-2;
}

.tw-form-control {
    @apply w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 disabled:bg-gray-100 disabled:cursor-not-allowed;
}

.tw-form-select {
    @apply w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm bg-white focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 disabled:bg-gray-100 disabled:cursor-not-allowed;
}

.tw-form-check {
    @apply flex items-center;
}

.tw-form-check-input {
    @apply h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded;
}

.tw-form-check-label {
    @apply ml-2 text-sm text-gray-700;
}

/* Form validation states */
.tw-is-valid {
    @apply border-green-500 focus:ring-green-500 focus:border-green-500;
}

.tw-is-invalid {
    @apply border-red-500 focus:ring-red-500 focus:border-red-500;
}

.tw-valid-feedback {
    @apply text-sm text-green-600 mt-1;
}

.tw-invalid-feedback {
    @apply text-sm text-red-600 mt-1;
}

/* === TOGGLE SWITCHES === */
.tw-form-switch {
    @apply flex items-center space-x-3;
}

.tw-switch-input {
    position: relative;
    display: inline-flex;
    width: 2.5rem;
    height: 1.25rem;
    background-color: #dee2e6;
    border-radius: 50rem;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    border: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.tw-switch-input:checked {
    background-color: #667eea;
}

.tw-switch-input:focus {
    box-shadow: 0 0 0 2px #667eea40;
}

.tw-switch-input::before {
    content: '';
    position: absolute;
    top: 0.125rem;
    left: 0.125rem;
    width: 1rem;
    height: 1rem;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.15s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tw-switch-input:checked::before {
    transform: translateX(1.25rem);
}

.tw-switch-input::after {
    display: none !important;
}

.tw-switch-input:checked::after {
    display: none !important;
    content: none !important;
}

/* Ensure no external CSS adds checkmarks to our toggle switches */
.tw-switch-input:checked {
    background-image: none !important;
}

.tw-switch-input:checked::before,
.tw-switch-input:checked::after {
    font-family: inherit !important;
    content: '' !important;
}

.tw-switch-label {
    @apply text-sm text-gray-700 font-medium;
    cursor: pointer;
}

/* Column Toggle Switch - Used in Column Visibility Panels */
.column-toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    background-color: #ccc;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
    border: none;
    outline: none;
}

.column-toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.column-toggle-switch.active {
    background-color: #2196F3;
}

.column-toggle-switch.active::after {
    transform: translateX(16px);
}

/* === BULK EDIT BOOLEAN TOGGLE SWITCH === */
/* Toggle switch with dynamic text labels for bulk edit modals */
.bulk-edit-toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    border: 2px solid #e9ecef;
}

.bulk-edit-toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
    flex-shrink: 0;
}

.bulk-edit-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.bulk-edit-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #6c757d;
    transition: all 0.3s ease;
    border-radius: 34px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.bulk-edit-toggle-input:checked + .bulk-edit-toggle-slider {
    background-color: #28a745;
}

.bulk-edit-toggle-input:checked + .bulk-edit-toggle-slider:before {
    transform: translateX(28px);
}

.bulk-edit-toggle-input:focus + .bulk-edit-toggle-slider {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}

.bulk-edit-toggle-input:disabled + .bulk-edit-toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dynamic text label that changes based on toggle state */
.bulk-edit-toggle-text {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    transition: color 0.3s ease;
    flex-grow: 1;
}

.bulk-edit-toggle-input:checked ~ .bulk-edit-toggle-text {
    color: #28a745;
}

/* Icon support (optional) */
.bulk-edit-toggle-icon {
    font-size: 1.25rem;
    margin-right: 0.5rem;
    transition: color 0.3s ease;
}

.bulk-edit-toggle-input:checked ~ .bulk-edit-toggle-icon {
    color: #28a745;
}

/* === RADIO BUTTON GROUPS === */
.tw-radio-group {
    @apply space-y-3;
}

.tw-radio-item {
    @apply flex items-center;
}

.tw-radio-input {
    @apply h-4 w-4 text-blue-600 border-gray-300 focus:ring-blue-500;
    cursor: pointer;
}

.tw-radio-label {
    @apply ml-3 text-sm text-gray-700;
    cursor: pointer;
}

.tw-radio-group-inline {
    @apply flex space-x-6;
}

.tw-radio-group-inline .tw-radio-item {
    @apply mb-0;
}

/* === SMALL ACTION BUTTONS === */
.tw-btn-sm {
    @apply px-2 py-1 text-xs font-medium rounded border transition-colors duration-200;
}

.tw-action-btn-sm {
    @apply inline-flex items-center px-2 py-1 text-xs font-medium rounded-md border transition-colors duration-200 cursor-pointer;
}

.tw-action-btn-sm:hover {
    @apply transform -translate-y-0.5 shadow-sm;
}

/* Small Action Button Variants */
.tw-action-btn-edit {
    @apply bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100 hover:border-blue-300;
}

.tw-action-btn-add {
    @apply bg-green-50 text-green-700 border-green-200 hover:bg-green-100 hover:border-green-300;
}

.tw-action-btn-delete {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.tw-action-btn-delete:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
}

.tw-action-btn-view {
    @apply bg-gray-50 text-gray-700 border-gray-200 hover:bg-gray-100 hover:border-gray-300;
}

.tw-category-action-btn {
    @apply inline-flex items-center px-2 py-1 text-xs font-semibold rounded-full border-2 transition-all duration-200;
}

/* === ENHANCED FORM CONTROLS WITH ICONS === */
.tw-form-control-with-icon {
    @apply relative;
}

.tw-form-control-with-icon .tw-form-control {
    @apply pl-10;
}

.tw-form-icon {
    @apply absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 pointer-events-none;
    font-size: 0.875rem;
}

.tw-form-control-with-icon .tw-form-control:focus + .tw-form-icon,
.tw-form-control-with-icon .tw-form-control:not(:placeholder-shown) + .tw-form-icon {
    @apply text-blue-500;
}

/* === ALERT COMPONENTS === */
.tw-alert {
    @apply px-4 py-3 rounded-md border-l-4 mb-4;
}

.tw-alert-primary {
    @apply bg-blue-50 border-blue-400 text-blue-700;
}

.tw-alert-success {
    @apply bg-green-50 border-green-400 text-green-700;
}

.tw-alert-warning {
    @apply bg-yellow-50 border-yellow-400 text-yellow-700;
}

.tw-alert-danger {
    @apply bg-red-50 border-red-400 text-red-700;
}

.tw-alert-info {
    @apply bg-cyan-50 border-cyan-400 text-cyan-700;
}

/* === MODAL COMPONENTS === */
/* Z-Index Hierarchy:
 * 1-999: Base content
 * 1000-1999: Dropdowns, tooltips, popovers
 * 2000-2999: Modals (handled by unified-modal.css)
 * 3000-3999: Toast notifications, top-level alerts
 */

/* === UNIFIED MODAL SYSTEM === */
/* Modal styles are now handled by unified-modal.css */
@import url('unified-modal.css');

/* Contact Edit Modal - Tabbed Interface */
.um-body .section-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
}

.um-body .nav-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.um-body .nav-btn.active {
    background-color: #667eea;
    color: white;
}

.um-body .nav-btn:hover:not(.active) {
    background-color: #e9ecef;
    color: #495057;
}

.um-body .section-content {
    display: none;
}

.um-body .section-content.active {
    display: block;
}

.um-body .section-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.um-body .section-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.um-body .form-section {
    margin-bottom: 2rem;
}

.um-body .card {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.um-body .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem;
}

.um-body .card-body {
    padding: 1.5rem;
}

/* === TABLE COMPONENTS === */
/* Note: Main table definition is in the LIST VIEW COMPONENTS section below */

/* === BADGE COMPONENTS === */
.tw-badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.tw-badge-primary {
    @apply bg-blue-100 text-blue-800;
}

.tw-badge-secondary {
    @apply bg-gray-100 text-gray-800;
}

.tw-badge-success {
    @apply bg-green-100 text-green-800;
}

.tw-badge-danger {
    @apply bg-red-100 text-red-800;
}

.tw-badge-warning {
    @apply bg-yellow-100 text-yellow-800;
}

.tw-badge-info {
    @apply bg-cyan-100 text-cyan-800;
}

/* Status Badge Color Variants for Beleg Status */
.tw-badge-gray {
    @apply bg-gray-100 text-gray-800;
}

.tw-badge-blue {
    @apply bg-blue-100 text-blue-800;
}

.tw-badge-green {
    @apply bg-green-100 text-green-800;
}

.tw-badge-purple {
    @apply bg-purple-100 text-purple-800;
}

.tw-badge-orange {
    @apply bg-orange-100 text-orange-800;
}

.tw-badge-red {
    @apply bg-red-100 text-red-800;
}

.tw-badge-yellow {
    @apply bg-yellow-100 text-yellow-800;
}

.tw-badge-pink {
    @apply bg-pink-100 text-pink-800;
}

.tw-badge-indigo {
    @apply bg-indigo-100 text-indigo-800;
}

/* Status Editing Components */
.status-field-wrapper {
    display: inline-block;
    position: relative;
}

.status-badge.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-badge.clickable:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-dropdown {
    min-width: 150px;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.status-dropdown:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Filter Chip Components */
.tw-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: #dbeafe;
    color: #1e40af;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #93c5fd;
    transition: all 0.15s ease;
}

.tw-filter-chip:hover {
    background-color: #bfdbfe;
    border-color: #60a5fa;
}

.tw-filter-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    background-color: transparent;
    color: #60a5fa;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    padding: 0;
}

.tw-filter-chip-remove:hover {
    background-color: #93c5fd;
    color: #1e40af;
}

.tw-filter-chip-remove svg {
    width: 0.75rem;
    height: 0.75rem;
}

.tw-filter-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.tw-filter-chips-container:empty {
    display: none;
}

/* Collapsible Filter Section */
.tw-filter-collapsible {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.tw-filter-collapsible.collapsed {
    max-height: 0;
}

.tw-filter-collapsible.expanded {
    max-height: 500px;
}

.tw-filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tw-filter-toggle-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.tw-filter-toggle-btn svg {
    width: 1rem;
    height: 1rem;
    transition: transform 0.3s ease;
}

.tw-filter-toggle-btn.expanded svg {
    transform: rotate(180deg);
}

/* === COLUMN VISIBILITY TOGGLE === */
.tw-column-toggle-dropdown {
    position: relative;
    display: inline-block;
}

.tw-column-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tw-column-toggle-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.tw-column-toggle-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 50;
    min-width: 200px;
    display: none;
}

.tw-column-toggle-menu.show {
    display: block;
}

.tw-column-toggle-menu-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.tw-column-toggle-menu-item {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.tw-column-toggle-menu-item:hover {
    background-color: #f9fafb;
}

.tw-column-toggle-menu-item input[type="checkbox"] {
    cursor: pointer;
}

.tw-column-toggle-menu-item label {
    cursor: pointer;
    user-select: none;
    margin: 0;
    font-size: 0.875rem;
    color: #374151;
}

/* Hidden columns */
.column-hidden {
    display: none !important;
}

/* Sortable column headers */
.tw-sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.tw-sortable-header:hover {
    background-color: #e5e7eb !important;
}

.tw-sort-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
    opacity: 0.3;
    transition: opacity 0.15s ease;
}

.tw-sortable-header:hover .tw-sort-icon {
    opacity: 0.6;
}

.tw-sortable-header.sorted .tw-sort-icon {
    opacity: 1;
}

.tw-sort-icon svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* === FILTER CARDS === */
.tw-filter-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
}

.tw-filter-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.tw-filter-card:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Filter Card Color Variants */
.tw-filter-card-blue {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.tw-filter-card-green {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.tw-filter-card-red {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.tw-filter-card-yellow {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.tw-filter-card-purple {
    border-color: #a855f7;
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    color: #6b21a8;
}

.tw-filter-card-pink {
    border-color: #ec4899;
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #9f1239;
}

.tw-filter-card-indigo {
    border-color: #6366f1;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #3730a3;
}

.tw-filter-card-gray {
    border-color: #6b7280;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
}

/* Filter Card Action Buttons */
.tw-filter-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.8);
    color: inherit;
    opacity: 0.6;
    transition: all 0.15s ease;
    cursor: pointer;
}

.tw-filter-card-action:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.tw-filter-card-action:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Filter Cards Grid */
.tw-filter-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Filter Card Collection */
.tw-filter-card-collection {
    margin-bottom: 2rem;
}

.tw-filter-card-collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tw-filter-card-collection-header:hover {
    background: #f3f4f6;
}

.tw-filter-card-collection-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-filter-card-collection-count {
    font-size: 0.875rem;
    color: #6b7280;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.tw-filter-card-collection-toggle {
    transition: transform 0.2s;
}

.tw-filter-card-collection.collapsed .tw-filter-card-collection-toggle {
    transform: rotate(-90deg);
}

.tw-filter-card-collection-body {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tw-filter-card-collection.collapsed .tw-filter-card-collection-body {
    max-height: 0;
}

/* === FILTER CARD TABS === */
.tw-filter-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tw-filter-tab {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-filter-tab:hover {
    color: #374151;
    background: #f9fafb;
}

.tw-filter-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
    font-weight: 600;
}

.tw-filter-tab i {
    font-size: 1rem;
}

.tw-filter-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 9999px;
}

.tw-filter-tab.active .tw-filter-tab-badge {
    background: #ede9fe;
    color: #7c3aed;
}

.tw-filter-tab-content {
    display: none;
}

.tw-filter-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* === ENHANCED STATUS BADGES === */
.tw-status-badge {
    @apply inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold;
}

.tw-status-company {
    @apply bg-blue-100 text-blue-800 border border-blue-200;
}

.tw-status-department {
    @apply bg-purple-100 text-purple-800 border border-purple-200;
}

.tw-status-motif {
    @apply bg-orange-100 text-orange-800 border border-orange-200;
}

.tw-status-person {
    @apply bg-green-100 text-green-800 border border-green-200;
}

/* Enhanced badge with icons */
.tw-status-badge-with-icon {
    @apply tw-status-badge space-x-1;
}

.tw-status-badge-with-icon i {
    @apply text-xs;
}

/* === DROPDOWN COMPONENTS === */
.tw-dropdown {
    @apply relative inline-block;
}

.tw-dropdown-menu {
    @apply absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 divide-y divide-gray-100 focus:outline-none z-50;
}

.tw-dropdown-item {
    @apply block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 cursor-pointer;
}

.tw-dropdown-header {
    @apply px-4 py-2 text-sm text-gray-500 font-medium;
}

.tw-dropdown-divider {
    @apply border-t border-gray-100 my-1;
}

/* === PAGINATION COMPONENTS === */
.tw-pagination {
    @apply flex items-center justify-between border-t border-gray-200 bg-white px-4 py-3 sm:px-6;
}

.tw-pagination-info {
    @apply text-sm text-gray-700;
}

.tw-pagination-nav {
    @apply relative z-0 inline-flex rounded-md shadow-sm -space-x-px;
}

.tw-pagination-item {
    @apply relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50;
}

.tw-pagination-item.active {
    @apply z-10 bg-blue-50 border-blue-500 text-blue-600;
}

.tw-pagination-prev {
    @apply rounded-l-md;
}

.tw-pagination-next {
    @apply rounded-r-md;
}

/* === LIST VIEW COMPONENTS === */
.tw-list-view {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow: visible;
}

.tw-list-view-header {
    background-color: #f9fafb;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.tw-bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-list-view-table {
    /* No horizontal scrolling - use responsive design instead */
}

.tw-table {
    width: 100%;
    border-collapse: separate; /* Changed from collapse to allow tooltip overflow */
    border-spacing: 0; /* Maintain visual appearance with no gaps */
    font-size: 0.875rem;
    overflow: visible; /* Allow tooltips to escape */
}

.tw-table-header {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.tw-table-header th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.75rem;
}

/* Allow alignment override on table headers */
.tw-table-header th.tw-text-center {
    text-align: center;
}

.tw-table-header th.tw-text-right {
    text-align: right;
}

/* Sticky Table Header - sticks to top when scrolling */
/* Apply to individual th elements for best browser compatibility */
.tw-table-sticky-header th {
    position: -webkit-sticky; /* Safari compatibility */
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f9fafb;
    /* Add shadow when stuck to indicate header is sticky */
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    /* Ensure proper layering */
    background-clip: padding-box;
}

/* Sticky Header Clone Styles - for viewport-fixed sticky headers */
.sticky-header-clone {
    /* Ensure proper overflow handling for horizontal scroll */
    overflow: hidden;
    /* Prevent pointer events on the clone (except for interactive elements) */
    pointer-events: none;
}

.sticky-header-clone th {
    /* Re-enable pointer events for interactive th elements (like sorting) */
    pointer-events: auto;
    /* Prevent text wrapping to maintain consistent height */
    white-space: nowrap;
    /* Ensure background is opaque */
    background-color: #f9fafb;
}

/* Add visual distinction to sticky clone */
.sticky-header-clone thead {
    background: linear-gradient(to bottom, #f9fafb 0%, #f3f4f6 100%);
}

/* Sticky Bulk Toolbar - appears below sticky header when items are selected */
.bulk-toolbar-sticky {
    position: fixed !important;
    z-index: 99; /* Just below sticky header (z-index: 100) */
    transition: all 0.15s ease-in-out;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tw-table-checkbox {
    width: 3rem;
    text-align: center;
}

.tw-table-sortable {
    position: relative;
}

.tw-sort-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-weight: inherit;
    font-size: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
    width: 100%;
    justify-content: flex-start;
}

.tw-sort-button:hover {
    color: #1f2937;
}

.tw-sort-icon {
    opacity: 0.5;
    font-size: 0.75rem;
}

.tw-sort-button:hover .tw-sort-icon {
    opacity: 1;
}

/* Icon-only header styles for centered, larger icons */
.tw-table-sortable.tw-text-center .tw-sort-button,
.tw-table-cell.tw-text-center {
    justify-content: center;
}

.tw-table-sortable.tw-text-center .tw-sort-button > i:first-child,
.tw-table-cell.tw-text-center > i {
    font-size: 1.125rem; /* Larger icon size (18px) */
}

.tw-table-sortable.tw-text-center .tw-sort-button {
    gap: 0.375rem; /* Tighter gap for icon headers */
}

.tw-table-actions {
    width: 8rem;
    text-align: right;
    overflow: visible; /* Allow tooltips to escape */
}

.tw-table-body tr {
    border-bottom: 1px solid #f3f4f6;
    overflow: visible; /* Allow tooltips to escape table rows */
}

.tw-table-body tr:last-child {
    border-bottom: none;
}

.tw-table-row:hover {
    background-color: #f9fafb;
}

.tw-row-selected {
    background-color: #eff6ff !important;
}

.tw-row-selected:hover {
    background-color: #dbeafe !important;
}

.tw-table-cell {
    padding: 0.75rem 1rem;
    vertical-align: top;
    overflow: visible; /* Allow tooltips to escape */
}

.tw-action-buttons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
}

/* Center action buttons when cell has tw-text-center */
.tw-text-center .tw-action-buttons {
    justify-content: center;
}

.tw-checkbox {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: white;
    transition: all 0.15s ease-in-out;
}

.tw-checkbox:checked {
    background-color: #2563eb;
    border-color: #2563eb;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='m13.854 3.646-7.5 7.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6 10.293l7.146-7.147a.5.5 0 0 1 .708.708z'/%3e%3c/svg%3e");
    background-size: 0.75rem;
    background-position: center;
    background-repeat: no-repeat;
}

.tw-checkbox:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Text truncation utilities for table cells */
.tw-truncate-text {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

.tw-truncate-email {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

.tw-truncate-date {
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

/* Responsive adjustments for list view */
@media (max-width: 768px) {
    .tw-list-view-header {
        padding: 0.75rem 1rem;
    }
    
    .tw-table-header th,
    .tw-table-cell {
        padding: 0.5rem 0.5rem;
    }
    
    .tw-action-buttons {
        gap: 0.125rem;
    }
    
    /* Tighter truncation on mobile */
    .tw-truncate-text {
        max-width: 100px;
    }
    
    .tw-truncate-email {
        max-width: 80px;
    }
    
    .tw-truncate-date {
        max-width: 70px;
    }
}

/* === UTILITY CLASSES === */
.tw-sr-only {
    @apply sr-only;
}

.tw-shadow {
    @apply shadow;
}

.tw-shadow-sm {
    @apply shadow-sm;
}

.tw-shadow-md {
    @apply shadow-md;
}

.tw-shadow-lg {
    @apply shadow-lg;
}

.tw-shadow-xl {
    @apply shadow-xl;
}

.tw-rounded {
    @apply rounded;
}

.tw-rounded-sm {
    @apply rounded-sm;
}

.tw-rounded-md {
    @apply rounded-md;
}

.tw-rounded-lg {
    @apply rounded-lg;
}

.tw-rounded-xl {
    @apply rounded-xl;
}

.tw-border {
    @apply border;
}

.tw-border-t {
    @apply border-t;
}

.tw-border-b {
    @apply border-b;
}

.tw-border-l {
    @apply border-l;
}

.tw-border-r {
    @apply border-r;
}

.tw-w-full {
    @apply w-full;
}

.tw-h-full {
    @apply h-full;
}

.tw-max-w-sm {
    @apply max-w-sm;
}

.tw-max-w-md {
    @apply max-w-md;
}

.tw-max-w-lg {
    @apply max-w-lg;
}

.tw-max-w-xl {
    @apply max-w-xl;
}

.tw-max-w-2xl {
    @apply max-w-2xl;
}

.tw-max-w-4xl {
    @apply max-w-4xl;
}

.tw-transition {
    @apply transition;
}

.tw-duration-150 {
    @apply duration-150;
}

.tw-duration-200 {
    @apply duration-200;
}

.tw-duration-300 {
    @apply duration-300;
}

.tw-ease-in-out {
    @apply ease-in-out;
}

.tw-transform {
    @apply transform;
}

.tw-scale-95 {
    @apply scale-95;
}

.tw-scale-100 {
    @apply scale-100;
}

.tw-opacity-0 {
    @apply opacity-0;
}

.tw-opacity-100 {
    @apply opacity-100;
}

/* Tom Select Integration */
.tw-tom-select {
    @apply w-full;
}

.tw-tom-select .ts-dropdown {
    @apply border border-gray-300 rounded-md shadow-lg bg-white z-50;
}

.tw-tom-select .ts-dropdown-content {
    @apply max-h-60 overflow-y-auto;
}

.tw-tom-select .ts-dropdown .option {
    @apply px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 cursor-pointer;
}

.tw-tom-select .ts-dropdown .option.active {
    @apply bg-blue-600 text-white;
}

.tw-tom-select .ts-control {
    @apply border border-gray-300 rounded-md px-3 py-2 focus:ring-1 focus:ring-blue-500 focus:border-blue-500;
}

/* Show/Hide utilities */
.tw-show {
    @apply block;
}

.tw-hide {
    @apply hidden;
}

/* Focus utilities */
.tw-focus-within\:ring-2:focus-within {
    @apply focus-within:ring-2;
}

.tw-focus\:ring-2:focus {
    @apply focus:ring-2;
}

.tw-focus\:ring-blue-500:focus {
    @apply focus:ring-blue-500;
}

.tw-focus\:outline-none:focus {
    @apply focus:outline-none;
}

/* Hover utilities */
.tw-hover\:bg-gray-50:hover {
    @apply hover:bg-gray-50;
}

.tw-hover\:bg-blue-600:hover {
    @apply hover:bg-blue-600;
}

.tw-hover\:text-white:hover {
    @apply hover:text-white;
}

/* Animation utilities */
.tw-fade {
    @apply transition-opacity duration-300 ease-in-out;
}

.tw-fade.tw-show {
    @apply opacity-100;
}

/* Tabbed Form Components */
.tw-tab-content {
    @apply mt-4;
}

.tw-tab-pane {
    @apply transition-all duration-200 ease-in-out;
}

.tw-tab-pane.active {
    @apply block;
}

.tw-tab-pane:not(.active) {
    display: none;
}

/* === CUSTOM TOOLTIPS === */
.tw-tooltip {
    position: relative;
    display: inline-block;
    z-index: 10; /* Ensure tooltip container is above other content */
}

.tw-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px; /* Space between icon and tooltip */
    background-color: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99999; /* Above everything including sticky headers */
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tw-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 3px; /* Arrow sits just below tooltip */
    border: 5px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99998; /* Just below tooltip */
    pointer-events: none;
}

.tw-tooltip:hover::after,
.tw-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* CRITICAL: Hide tooltips immediately on click - prevents blob artifact */
/* :active pseudo-class overrides :hover BEFORE JavaScript runs */
.tw-tooltip:active::after,
.tw-tooltip:active::before {
    opacity: 0 !important;
    visibility: hidden !important;
    display: none !important;
    transition: none !important;
}

/* Hide tooltip when button is clicked (applied via JavaScript) */
/* This persists until mouse actually leaves the button */
.tw-tooltip-suppress::after,
.tw-tooltip-suppress::before {
    opacity: 0 !important;
    visibility: hidden !important;
    display: none !important;
    transition: none !important;
}

/* Window unfocused - immediate hide without transition */
/* CRITICAL: This prevents tooltips from getting "frozen" when window.open() shifts focus */
/* The key is to override the transition with "none" to hide instantly */
body.window-unfocused .tw-tooltip::after,
body.window-unfocused .tw-tooltip::before {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: none !important; /* CRITICAL: Remove transition to hide instantly */
}

/* Tooltip positioning variants */
.tw-tooltip-top::after {
    bottom: 125%;
    top: auto;
}

.tw-tooltip-top::before {
    bottom: 115%;
    top: auto;
    border-top-color: #1f2937;
    border-bottom-color: transparent;
}

.tw-tooltip-bottom::after {
    top: 125%;
    bottom: auto;
}

.tw-tooltip-bottom::before {
    top: 115%;
    bottom: auto;
    border-bottom-color: #1f2937;
    border-top-color: transparent;
}

.tw-tooltip-left::after {
    right: 100%;
    left: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    margin-right: 8px;
    margin-bottom: 0;
}

.tw-tooltip-left::before {
    right: 100%;
    left: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    margin-right: 3px;
    margin-bottom: 0;
    border-left-color: #1f2937;
    border-top-color: transparent;
}

.tw-tooltip-right::after {
    left: 100%;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    margin-left: 8px;
    margin-bottom: 0;
}

.tw-tooltip-right::before {
    left: 100%;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    margin-left: 3px;
    margin-bottom: 0;
    border-right-color: #1f2937;
    border-top-color: transparent;
}

/* Ensure tooltips remain above modal content and sticky elements */
.modal .tw-tooltip::after,
.modal-content .tw-tooltip::after,
.unified-modal .tw-tooltip::after,
[role="dialog"] .tw-tooltip::after {
    z-index: 99999; /* Above all modal content and sticky headers */
}

.modal .tw-tooltip::before,
.modal-content .tw-tooltip::before,
.unified-modal .tw-tooltip::before,
[role="dialog"] .tw-tooltip::before {
    z-index: 99998; /* Just below tooltip content */
}

/* === DEPRECATED TOOLTIP SYSTEMS === */
/* ⛔ DEPRECATED: Bootstrap tooltips are no longer used in this project */
/* All tooltips should use the .tw-tooltip CSS system above */
/* These rules help detect accidental use of deprecated tooltip systems */

/* Deprecation warning for Bootstrap 5 tooltips (visual indicator in development) */
[data-bs-toggle="tooltip"] {
    /* Uncomment the line below to show red border in development */
    /* border: 2px solid red !important; */
    /* Add warning comment to make it obvious in inspector */
}

/* Deprecation warning for Bootstrap 4 tooltips (legacy) */
[data-toggle="tooltip"] {
    /* Uncomment the line below to show red border in development */
    /* border: 2px solid red !important; */
}

/* Z-index utilities for modals and dropdowns */
.tw-z-40 {
    @apply z-40;
}

.tw-z-50 {
    @apply z-50;
}

/* Modal animations and component integration are now handled by unified-modal.css */

/* === TAB COMPONENTS === */

/* Tab Container */
.tw-tabs {
    margin-bottom: 1.5rem;
}

/* Tab Navigation */
.tw-tabs-nav {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    background-color: white;
    border-radius: 0.5rem 0.5rem 0 0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Tab Button */
.tw-tab-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    text-decoration: none;
}

.tw-tab-button:hover {
    color: #374151;
    background-color: #f9fafb;
    text-decoration: none;
}

.tw-tab-button:focus {
    outline: none;
    color: #374151;
    background-color: #f9fafb;
}

/* Active Tab Button */
.tw-tab-button.tw-tab-active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background-color: white;
}

.tw-tab-button.tw-tab-active:hover {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
    background-color: white;
}

/* Tab Content */
.tw-tab-content {
    margin-top: 0;
}

/* Tab Pane */
.tw-tab-pane {
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.tw-tab-pane.tw-tab-show {
    display: block;
    opacity: 1;
}

/* Responsive adjustments for tabs */
@media (max-width: 768px) {
    .tw-tabs-nav {
        flex-direction: column;
        border-radius: 0.5rem;
    }
    
    .tw-tab-button {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #e5e7eb;
        border-right: none;
        justify-content: flex-start;
        text-align: left;
    }
    
    .tw-tab-button:last-child {
        border-bottom: none;
    }
    
    .tw-tab-button.tw-tab-active {
        border-bottom-color: #e5e7eb;
        border-left: 3px solid #2563eb;
        background-color: #eff6ff;
    }
}

/* === ENHANCED LIST VIEW COMPONENTS === */

/* List View Header Info */
.tw-list-header-info {
    flex: 1;
    min-width: 0;
}

/* List Title */
.tw-list-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
    line-height: 1.25;
}

/* List Subtitle */
.tw-list-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* List Header Actions */
.tw-list-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Table Row Variants */
.tw-table-row-archived {
    background-color: #f9fafb;
    opacity: 0.8;
}

.tw-table-row-archived:hover {
    background-color: #f3f4f6;
    opacity: 0.9;
}

.tw-table-row-highlight {
    background-color: #fefce8;
    border-left: 3px solid #eab308;
}

.tw-table-row-highlight:hover {
    background-color: #fef3c7;
}

/* === TEXT UTILITIES === */

/* Text Muted */
.tw-text-muted {
    color: #6b7280;
}

/* Text Truncate */
.tw-text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    display: inline-block;
}

/* Link Styling */
.tw-link {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.tw-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.tw-link:focus {
    color: #1d4ed8;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* === APPOINTMENT-SPECIFIC COMPONENTS === */

/* Appointment Info Container */
.tw-appointment-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Appointment Headline */
.tw-appointment-headline {
    font-weight: 500;
    color: #111827;
    line-height: 1.25;
}

/* Appointment Subjects */
.tw-appointment-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

/* Date Time Styling */
.tw-date-time {
    font-family: 'Courier New', Monaco, monospace;
    white-space: nowrap;
}

/* === EMPTY STATE COMPONENTS === */

/* Empty State Container */
.tw-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    background-color: white;
    border-radius: 0.5rem;
    border: 2px dashed #e5e7eb;
    margin: 1rem 0;
}

/* Empty State Icon */
.tw-empty-icon {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

/* Empty State Title */
.tw-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

/* Empty State Text */
.tw-empty-text {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    max-width: 400px;
    line-height: 1.5;
}

/* === ADDITIONAL BADGE VARIANTS === */

/* Status-specific badges */
.tw-badge-canceled {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.tw-badge-past {
    background-color: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.tw-badge-upcoming {
    background-color: #f0fdf4;
    color: #059669;
    border: 1px solid #bbf7d0;
}

/* === ACTION BUTTON SUCCESS VARIANT === */
.tw-action-btn-success {
    color: #059669;
    border-color: #059669;
}

.tw-action-btn-success:hover {
    background-color: #059669;
    color: white;
    text-decoration: none;
}

.tw-action-btn-primary {
    color: #667eea;
    border-color: #667eea;
}

.tw-action-btn-primary:hover {
    background-color: #667eea;
    color: white;
    text-decoration: none;
}

.tw-action-btn-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.tw-action-btn-danger:hover {
    background-color: #dc3545;
    color: white;
    text-decoration: none;
}

/* === RESPONSIVE TABLE ADJUSTMENTS === */
@media (max-width: 768px) {
    .tw-list-view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .tw-list-header-actions {
        justify-content: center;
    }
    
    .tw-appointment-info {
        gap: 0.25rem;
    }
    
    .tw-appointment-subjects {
        gap: 0.125rem;
    }
    
    .tw-text-truncate {
        max-width: 120px;
    }
    
    .tw-date-time {
        font-size: 0.75rem;
    }
    
    .tw-empty-state {
        padding: 2rem 1rem;
    }
    
    .tw-empty-icon {
        font-size: 2rem;
    }
    
    .tw-empty-title {
        font-size: 1rem;
    }
    
    .tw-empty-text {
        font-size: 0.75rem;
    }
}

/* === FILTER CARDS COMPONENTS === */

/* Base Filter Card */
.tw-filter-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

.tw-filter-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* Filter Card Header */
.tw-filter-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    min-height: 2.5rem;
}

.tw-filter-card-title-area {
    flex: 1;
    min-width: 0;
}

.tw-filter-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.25;
    margin: 0 0 0.5rem 0;
    word-wrap: break-word;
}

.tw-filter-card-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #f3f4f6;
    color: #374151;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
}

.tw-filter-card-badge.tw-badge-count {
    background-color: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.tw-filter-card-badge.tw-badge-sum {
    background-color: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

/* Filter Card Actions */
.tw-filter-card-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tw-filter-card:hover .tw-filter-card-actions {
    opacity: 1;
}

.tw-filter-card-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tw-filter-card-settings-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.tw-filter-card-settings-btn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Filter Card Content */
.tw-filter-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tw-filter-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    line-height: 1;
    margin: 0;
}

.tw-filter-card-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    margin: 0;
    line-height: 1.5;
}

/* Create New Filter Card */
.tw-filter-card-create {
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 8rem;
    color: #6b7280;
}

.tw-filter-card-create:hover {
    border-color: #2563eb;
    background-color: #fafbff;
    color: #2563eb;
}

.tw-filter-card-create:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-color: #2563eb;
}

.tw-filter-create-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 300;
}

.tw-filter-create-text {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
}

/* Filter Cards Grid */
.tw-filter-cards-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .tw-filter-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .tw-filter-cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .tw-filter-cards-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .tw-filter-cards-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* Saved Filter Card (Clickable) */
.tw-filter-card-saved {
    cursor: pointer;
    border: 2px solid transparent;
}

.tw-filter-card-saved:hover {
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.tw-filter-card-saved:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-color: #2563eb;
}

.tw-filter-card-saved:active {
    transform: translateY(0px);
}

/* Saved Filter Card - Enhanced Layout */
.tw-filter-card-saved {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
}

.tw-filter-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tw-filter-card-icon i {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.tw-filter-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
}

.tw-filter-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tw-filter-card-description {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tw-filter-card-count {
    font-size: 0.75rem;
    color: #9ca3af;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Filter Card Action Buttons */
.tw-filter-card-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tw-filter-card-saved:hover .tw-filter-card-actions {
    opacity: 1;
}

.tw-filter-card-edit-btn,
.tw-filter-card-delete-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0.375rem;
    background-color: white;
    color: #6b7280;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tw-filter-card-edit-btn:hover {
    background-color: #2563eb;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tw-filter-card-delete-btn:hover {
    background-color: #dc2626;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tw-filter-card-edit-btn:active,
.tw-filter-card-delete-btn:active {
    transform: scale(0.95);
}

.tw-filter-card-edit-btn:focus,
.tw-filter-card-delete-btn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Create New Filter Card - Enhanced */
.tw-filter-card-create {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 88px;
}

.tw-filter-card-create-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.tw-filter-card-create-icon {
    font-size: 1.5rem;
    font-weight: 300;
}

.tw-filter-card-create-text {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
}

/* Mobile: Always show actions */
@media (max-width: 640px) {
    .tw-filter-card-actions {
        opacity: 1;
    }
}

/* Filter Card Dropdown Menu */
.tw-filter-card-dropdown {
    position: relative;
    display: inline-block;
}

.tw-filter-card-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    min-width: 160px;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1500; /* Dropdowns layer */
    margin-top: 0.25rem;
}

.tw-filter-card-dropdown.show .tw-filter-card-dropdown-content {
    display: block;
}

.tw-filter-card-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tw-filter-card-dropdown-item:hover {
    background-color: #f3f4f6;
}

.tw-filter-card-dropdown-item:first-child {
    border-radius: 0.375rem 0.375rem 0 0;
}

.tw-filter-card-dropdown-item:last-child {
    border-radius: 0 0 0.375rem 0.375rem;
}

.tw-filter-card-dropdown-item.destructive {
    color: #dc2626;
}

.tw-filter-card-dropdown-item.destructive:hover {
    background-color: #fef2f2;
}

.tw-filter-card-dropdown-item i {
    margin-right: 0.5rem;
    width: 1rem;
    text-align: center;
}

/* Filter Cards Section */
.tw-filter-cards-section {
    margin-bottom: 2rem;
}

.tw-filter-cards-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-filter-cards-section-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

/* Value Formatting Utilities */
.tw-value-currency::before {
    content: "€";
    margin-right: 0.125rem;
    opacity: 0.8;
}

.tw-value-large {
    font-size: 2.25rem;
}

.tw-value-medium {
    font-size: 1.875rem;
}

.tw-value-small {
    font-size: 1.5rem;
}

/* Status Variants */
.tw-filter-card-status-active {
    border-left: 4px solid #10b981;
}

.tw-filter-card-status-inactive {
    border-left: 4px solid #6b7280;
}

.tw-filter-card-status-warning {
    border-left: 4px solid #f59e0b;
}

.tw-filter-card-status-error {
    border-left: 4px solid #ef4444;
}

/* Loading State */
.tw-filter-card-loading {
    opacity: 0.6;
    pointer-events: none;
}

.tw-filter-card-loading .tw-filter-card-value {
    background: linear-gradient(90deg, #f3f4f6, #e5e7eb, #f3f4f6);
    background-size: 200% 100%;
    animation: tw-loading-shimmer 1.5s ease-in-out infinite;
    border-radius: 0.25rem;
    height: 2rem;
    width: 4rem;
}

@keyframes tw-loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Compact Filter Cards */
.tw-filter-cards-grid-compact {
    gap: 1rem;
}

.tw-filter-cards-grid-compact .tw-filter-card {
    padding: 1rem;
}

.tw-filter-cards-grid-compact .tw-filter-card-value {
    font-size: 1.5rem;
}

.tw-filter-cards-grid-compact .tw-filter-card-title {
    font-size: 0.8125rem;
}

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
    .tw-filter-cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tw-filter-card {
        padding: 1.25rem;
    }
    
    .tw-filter-card-value {
        font-size: 1.75rem;
    }
    
    .tw-filter-card-create {
        padding: 1.5rem;
        min-height: 6rem;
    }
    
    .tw-filter-create-icon {
        font-size: 1.5rem;
    }
    
    .tw-filter-card-actions {
        opacity: 1; /* Always visible on mobile */
    }
}

/* Filter Settings Modal - now handled by unified modal system */
/* All modal functionality handled by unified-modal.css and unified-modal.js */

.tw-form-group {
    margin-bottom: 1.5rem;
}

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

.tw-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.tw-form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: white;
}

.tw-form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tw-form-input::placeholder {
    color: #9ca3af;
}

/* Radio Button Group */
.tw-radio-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tw-radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    padding: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.tw-radio-option:hover {
    border-color: #2563eb;
    background-color: #f8faff;
}

.tw-radio-option input[type="radio"] {
    display: none;
}

.tw-radio-indicator {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.tw-radio-option input[type="radio"]:checked + .tw-radio-indicator {
    border-color: #2563eb;
    background-color: #2563eb;
}

.tw-radio-option input[type="radio"]:checked + .tw-radio-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.375rem;
    height: 0.375rem;
    background-color: white;
    border-radius: 50%;
}

.tw-radio-option input[type="radio"]:checked ~ .tw-radio-label {
    color: #2563eb;
}

.tw-radio-label {
    flex: 1;
    font-size: 0.875rem;
    color: #374151;
    transition: color 0.2s;
}

.tw-text-muted {
    color: #6b7280;
    font-size: 0.8125rem;
}

/* Responsive adjustments for form components */
@media (max-width: 640px) {
    .tw-form-group {
        margin-bottom: 1rem;
    }
}

/* Dark Mode Support for form components */
@media (prefers-color-scheme: dark) {
    .tw-form-label {
        color: #d1d5db;
    }

    .tw-form-input {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .tw-form-input:focus {
        border-color: #2563eb;
    }

    .tw-form-input::placeholder {
        color: #6b7280;
    }

    .tw-radio-option {
        border-color: #4b5563;
        background-color: #374151;
    }

    .tw-radio-option:hover {
        border-color: #2563eb;
        background-color: #1e3a8a;
    }

    .tw-radio-indicator {
        border-color: #6b7280;
    }
    
    .tw-radio-label {
        color: #d1d5db;
    }
    
    .tw-text-muted {
        color: #9ca3af;
    }
    
    .tw-filter-card {
        background-color: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .tw-filter-card-title {
        color: #f9fafb;
    }
    
    .tw-filter-card-value {
        color: #f9fafb;
    }
    
    .tw-filter-card-label {
        color: #9ca3af;
    }
    
    .tw-filter-card-badge {
        background-color: #374151;
        color: #d1d5db;
        border-color: #4b5563;
    }
    
    .tw-filter-card-create {
        background-color: #1f2937;
        border-color: #4b5563;
        color: #9ca3af;
    }
    
    .tw-filter-card-create:hover {
        background-color: #111827;
        border-color: #2563eb;
        color: #2563eb;
    }
    
    .tw-filter-card-dropdown-content {
        background-color: #1f2937;
        border-color: #374151;
    }
    
    .tw-filter-card-dropdown-item {
        color: #d1d5db;
    }
    
    .tw-filter-card-dropdown-item:hover {
        background-color: #374151;
    }
    
    .tw-filter-card-dropdown-item.destructive {
        color: #f87171;
    }
    
    .tw-filter-card-dropdown-item.destructive:hover {
        background-color: #422532;
    }
}

/* === SLIDESHOW COMPONENTS === */
/* DEPRECATED 2025-10-25: Slideshow functionality removed - use full-page views instead */
/*
.tw-slideshow-container {
    position: relative;
    overflow: hidden;
    min-height: 400px;
}

/* Slides */
.tw-slide {
    display: none;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
}

.tw-slide.tw-active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* Slide Content */
.tw-slide-content {
    padding: 1rem;
    animation: slideIn 0.3s ease-in-out;
}

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

/* Slide Headings */
.tw-slide-heading {
    color: #1e40af;
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Progress Components */
.tw-progress-bar-container {
    background-color: #f8fafc;
    padding: 0;
}

.tw-progress {
    width: 100%;
    background-color: #e2e8f0;
    border-radius: 0.25rem;
    overflow: hidden;
}

.tw-progress-bar {
    height: 100%;
    background-color: #10b981;
    transition: width 0.3s ease-in-out;
}

/* Progress Steps */
.tw-progress-steps {
    background-color: #f8fafc;
    font-size: 0.9rem;
    border-bottom: 1px solid #e2e8f0;
}

.tw-step {
    display: flex;
    align-items: center;
    color: #64748b;
    transition: color 0.3s ease;
}

.tw-step.active {
    color: #2563eb;
    font-weight: 600;
}

.tw-step.completed {
    color: #10b981;
}

.tw-step-text {
    font-size: 0.85rem;
}

/* Progress Indicator */
.tw-progress-indicator {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Icon Sizing */
.tw-fa-3x {
    font-size: 3rem;
    opacity: 0.8;
}

/* Form Control Large */
.tw-form-control-lg,
.tw-form-select-lg {
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    border-radius: 0.5rem;
    min-height: 3rem;
}

/* Button Group */
.tw-btn-group {
    display: flex;
    border-radius: 0.5rem;
    overflow: hidden;
}

.tw-btn-group .tw-btn {
    flex: 1;
    border-radius: 0;
}

.tw-btn-group .tw-btn:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.tw-btn-group .tw-btn:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* Button Check (Radio Button styling) */
.tw-btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.tw-btn-check:checked + .tw-btn-outline-primary {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

/* Close Button Variants */
.tw-btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .tw-slideshow-container {
        min-height: 350px;
    }
    
    .tw-slide-content {
        padding: 0.5rem;
    }
    
    .tw-btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
    
    .tw-progress-steps {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
    
    .tw-step-text {
        display: none;
    }
    
    .tw-slide-heading {
        font-size: 1.25rem;
    }
    
    .tw-fa-3x {
        font-size: 2rem;
    }
}
*/
/* End of deprecated slideshow CSS */

@media (max-width: 576px) {
    .tw-btn-group .tw-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .tw-form-control-lg,
    .tw-form-select-lg {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
        min-height: 2.5rem;
    }
}

/* === 8. BASE LAYOUT STYLES (from base_standardized.html) === */

/* Body Layout - Space for Fixed Navigation */
body.tw-layout-body {
    padding-top: 64px; /* Space for fixed navigation header */
    min-height: 100vh;
}

/* Content Wrapper - Full Height Layout */
.content-wrapper {
    min-height: calc(100vh - 64px);
    padding: 2rem 0;
}

/* Bootstrap Tab Pane Display Fixes */
.tab-content {
    display: block !important;
}

.tab-pane {
    display: none !important;
}

.tab-pane.active,
.tab-pane.show.active {
    display: block !important;
}

/* Table Responsive Display Fixes */
.table-responsive {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.table {
    width: 100% !important;
    margin-bottom: 1rem !important;
}

/* === DASHBOARD COMPONENTS (dashboard-rebooted) === */

/* Main Content Wrappers - Allow tooltips to overflow */
.content-wrapper,
.tw-content-wrapper,
.container,
.tw-main-container {
    overflow: visible !important;
}

/* Dashboard Container */
.tw-dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    overflow: visible; /* Allow tooltips to overflow */
}

/* Dashboard Quick Action Bar */
.tw-dashboard-quick-action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .tw-dashboard-quick-action-bar {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Dashboard Grid Layout */
.tw-dashboard-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Stats Cards Grid - 4 columns on desktop, responsive */
.tw-dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Dashboard Stat Card */
.tw-dashboard-stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: visible;
}

.tw-dashboard-stat-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    border-color: #e5e7eb;
    z-index: 1;
}

.tw-dashboard-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: currentColor;
    opacity: 0.3;
}

/* Stat Card Header */
.tw-dashboard-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.tw-dashboard-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;
    font-size: 1.75rem;
    color: white;
    flex-shrink: 0;
}

.tw-dashboard-stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* Stat Card Body */
.tw-dashboard-stat-body {
    display: flex;
    flex-direction: column;
}

.tw-dashboard-stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #111827;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.tw-dashboard-stat-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.tw-dashboard-stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.tw-dashboard-stat-change.positive {
    color: #059669;
}

.tw-dashboard-stat-change.negative {
    color: #dc2626;
}

/* Stat Card Color Variants */
.tw-dashboard-stat-card.primary {
    color: #2563eb;
}

.tw-dashboard-stat-card.primary .tw-dashboard-stat-icon {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.tw-dashboard-stat-card.success {
    color: #059669;
}

.tw-dashboard-stat-card.success .tw-dashboard-stat-icon {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.tw-dashboard-stat-card.warning {
    color: #d97706;
}

.tw-dashboard-stat-card.warning .tw-dashboard-stat-icon {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.tw-dashboard-stat-card.danger {
    color: #dc2626;
}

.tw-dashboard-stat-card.danger .tw-dashboard-stat-icon {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.tw-dashboard-stat-card.info {
    color: #0891b2;
}

.tw-dashboard-stat-card.info .tw-dashboard-stat-icon {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

.tw-dashboard-stat-card.purple {
    color: #7c3aed;
}

.tw-dashboard-stat-card.purple .tw-dashboard-stat-icon {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* Quick Actions Panel */
.tw-dashboard-quick-actions {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.tw-dashboard-quick-actions-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-dashboard-quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.tw-dashboard-quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    text-decoration: none;
    color: #374151;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tw-dashboard-quick-action-btn:hover {
    background: white;
    border-color: #2563eb;
    color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.tw-dashboard-quick-action-icon {
    font-size: 2rem;
    color: currentColor;
}

.tw-dashboard-quick-action-label {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

/* Activity Feed */
.tw-dashboard-activity-feed {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.tw-dashboard-activity-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-dashboard-activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tw-dashboard-activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.tw-dashboard-activity-item:hover {
    background: #f9fafb;
}

.tw-dashboard-activity-icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    color: white;
}

.tw-dashboard-activity-content {
    flex: 1;
    min-width: 0;
}

.tw-dashboard-activity-main {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.25rem;
}

.tw-dashboard-activity-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

.tw-dashboard-activity-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tw-dashboard-activity-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.tw-dashboard-activity-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.tw-dashboard-activity-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.tw-dashboard-activity-badge.info {
    background: #dbeafe;
    color: #1e40af;
}

/* Widget Panel */
.tw-dashboard-widget {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

/* All widgets in tab panel have consistent spacing and rounding */
.tw-tab-panel > .tw-dashboard-widget {
    margin-top: 1.5rem;
}

.tw-tab-panel > .tw-dashboard-widget:first-child {
    margin-top: 0;
}

.tw-dashboard-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.tw-dashboard-widget-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-dashboard-widget-action {
    font-size: 0.875rem;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tw-dashboard-widget-action:hover {
    color: #1d4ed8;
}

.tw-dashboard-widget-body {
    padding: 0;
}

/* Fix table rounding inside widget */
.tw-dashboard-widget-body .tw-table-responsive {
    overflow-x: auto;
    overflow-y: visible; /* Allow tooltips to overflow vertically */
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
    border-radius: 0.5rem;
}

.tw-dashboard-widget-body .tw-table {
    border-radius: 0.5rem;
    overflow: visible; /* Allow tooltips to overflow */
}

.tw-dashboard-widget-body .tw-table thead th:first-child {
    border-top-left-radius: 0.5rem;
}

.tw-dashboard-widget-body .tw-table thead th:last-child {
    border-top-right-radius: 0.5rem;
}

/* Allow tooltips to overflow the widget body */
.tw-dashboard-widget-body {
    overflow: visible;
}

.tw-dashboard-widget {
    overflow: visible;
}

/* Widget Highlight Animations for Email Notifications */
@keyframes widgetPulseSuccess {
    0% {
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2), 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    }
    100% {
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    }
}

@keyframes widgetPulseInfo {
    0% {
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    }
    100% {
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    }
}

@keyframes textHighlightInfo {
    0%, 100% {
        background-color: transparent;
        color: inherit;
    }
    50% {
        background-color: #dbeafe;
        color: #1e40af;
    }
}

.tw-dashboard-widget-highlight-success {
    animation: widgetPulseSuccess 1s ease-in-out 2;
    border: 2px solid #22c55e;
    transition: all 0.3s ease;
}

.tw-dashboard-widget-highlight-info {
    animation: widgetPulseInfo 1s ease-in-out 2;
    border: 2px solid #3b82f6;
    transition: all 0.3s ease;
}

.tw-text-highlight-info {
    animation: textHighlightInfo 1s ease-in-out 2;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: inline-block;
    transition: all 0.3s ease;
}

/* Copy Info Widget Specific Styling - Separated Header and Scrollable Body */
.copy-info-table-container {
    overflow: visible;
}

/* Header table - non-scrolling */
.copy-info-header-table {
    border-bottom: 2px solid #e5e7eb;
}

/* Scrollable body container */
.copy-info-body-scroll {
    overflow-x: hidden !important;
    overflow-y: auto;
    max-height: 400px;
    scroll-behavior: smooth;
}

/* Remove top border from body table to avoid double border */
.copy-info-body-table tbody tr:first-child td {
    border-top: none;
}

.copy-info-table-container .tw-action-btn {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.copy-info-table-container .tw-action-buttons {
    gap: 0.15rem;
}

.copy-info-table-container .tw-table td,
.copy-info-table-container .tw-table th {
    padding: 0.5rem 0.75rem;
}

/* Empty State */
.tw-dashboard-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #9ca3af;
}

.tw-dashboard-empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.tw-dashboard-empty-state-text {
    font-size: 0.875rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .tw-dashboard-container {
        padding: 1rem;
    }

    .tw-dashboard-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tw-dashboard-stat-card {
        padding: 1.25rem;
    }

    .tw-dashboard-stat-value {
        font-size: 1.875rem;
    }

    .tw-dashboard-stat-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.5rem;
    }

    .tw-dashboard-quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ====================================================================
 * 10. TAB NAVIGATION COMPONENTS (For Update Pages)
 * ==================================================================== */

/* Section Navigation - Used in appointment/contact update pages */
/* Pill-style tabs matching contact modal design */
.section-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn.active {
    background-color: #667eea;
    color: white;
}

.nav-btn:hover:not(.active) {
    background-color: #e9ecef;
    color: #495057;
}

.nav-btn i {
    font-size: 0.9rem;
}

/* Section Content - Tab Panels */
.section-content {
    display: none;
}

.section-content.active {
    display: block;
}

/* Section Titles and Descriptions */
.section-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.section-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Form Sections */
.form-section {
    margin-bottom: 2rem;
}

/* Responsive Tab Navigation */
@media (max-width: 768px) {
    .section-nav {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ====================================================================
 * 11. APPOINTMENT UPDATE PAGE COMPONENTS
 * ==================================================================== */

/* Info Grid - Summary Cards */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.info-value {
    font-size: 1rem;
    color: #212529;
    font-weight: 600;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-canceled {
    background-color: #f8d7da;
    color: #721c24;
}

/* Invoice-Specific Status Badges */
.invoice-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.invoice-status-paid {
    background: #10b981;
    color: white;
}

.invoice-status-sent {
    background: #10b981;
    color: white;
}

.invoice-status-finalized {
    background: #3b82f6;
    color: white;
}

.invoice-status-draft {
    background: #f59e0b;
    color: #1f2937;
}

/* Invoice Page Layout Styles */
.invoice-header-rounded-top {
    margin-bottom: 0;
    border-radius: 0.5rem 0.5rem 0 0;
}

.invoice-summary-card {
    margin-bottom: 1.5rem;
    border-radius: 0 0 0.5rem 0.5rem;
    margin-top: 0;
}

.invoice-summary-card-body {
    background-color: white;
}

.invoice-amount-total {
    color: #10b981;
    font-weight: 700;
}

/* Action Buttons Container */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

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

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}


/* ========================================
 * 12. BOOTSTRAP-FREE COMPONENTS
 * Custom implementations to replace Bootstrap
 * ======================================== */

/* === TAB SYSTEM === */

.tw-tabs-nav {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    background: white;
    border: 1px solid #e5e7eb;
    border-bottom: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.tw-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    font-size: 1rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-tab:hover {
    color: #3b82f6;
    border-bottom-color: #bfdbfe;
    background: transparent;
}

.tw-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: transparent;
}

.tw-tab i {
    font-size: 1.1rem;
}

.tw-tab .tw-badge {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: #e5e7eb;
    color: #374151;
    font-weight: 600;
}

.tw-tab.active .tw-badge {
    background: #bfdbfe;
    color: #1e40af;
}

.tw-tab-content {
    position: relative;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    overflow: visible; /* Allow tooltips to overflow */
}

/* Remove padding when tab content has dashboard widgets - let widgets show their backgrounds */
.tw-tab-content:has(.tw-dashboard-widget),
.tw-tab-content:has(.tw-tab-panel .tw-dashboard-widget) {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible; /* Allow tooltips to overflow */
}

/* Remove padding/styling when tab content has cards - let cards show directly */
.tw-tab-content:has(.card),
.tw-tab-content:has(.tw-tab-panel .card) {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible; /* Allow tooltips to overflow */
}

.tw-tab-panel {
    display: none;
    animation: tabFadeIn 0.2s ease-in-out;
    overflow: visible; /* Allow tooltips to overflow */
}

.tw-tab-panel.active {
    display: block;
    overflow: visible; /* Allow tooltips to overflow */
}

/* Nested tabs inside tab panels - lighter, more integrated styling */
.tw-tab-panel .tw-tabs-nav {
    border: none;
    border-bottom: 2px solid #e5e7eb;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
    margin-bottom: 1rem;
    padding: 0;
}

.tw-tab-panel .tw-tab {
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    margin-bottom: -2px;
    background: transparent;
}

.tw-tab-panel .tw-tab.active {
    border-bottom-color: #3b82f6;
    background: transparent;
}

.tw-tab-panel .tw-tab:hover:not(.active) {
    background: rgba(59, 130, 246, 0.05);
}

.tw-tab-panel .tw-tab-content {
    border: 1px solid #e5e7eb;
    box-shadow: none;
    padding: 1.5rem;
    margin-top: 0;
    background: #f9fafb;
    border-radius: 0.5rem;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .tw-tabs-nav {
        flex-direction: column;
        border-bottom: none;
        gap: 0.25rem;
    }

    .tw-tab {
        border-bottom: none;
        border-left: 3px solid transparent;
        padding: 0.75rem 1rem;
        width: 100%;
        justify-content: flex-start;
    }

    .tw-tab:hover {
        border-left-color: #bfdbfe;
        border-bottom-color: transparent;
    }

    .tw-tab.active {
        border-left-color: #3b82f6;
        border-bottom-color: transparent;
        background: #f3f4f6;
    }
}


/* === FK CRUD BUTTONS === */
/* Foreign Key field CRUD action buttons (New, Edit, Duplicate, Move to Bin)
   Used in modal forms for inline foreign key management
   See: item_modal_form.html, invoice_profile_modal_tabbed.html */

/* Layout: Side-by-side with field */
.profile-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

/* Layout: Row of buttons below field (most common) */
.profile-actions-row {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* Base button style */
.btn-profile-action {
    padding: 0.375rem 0.5rem;
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 40px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
}

.btn-profile-action:hover:not(:disabled) {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-profile-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-profile-action:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.25);
}

.btn-profile-action i {
    margin-right: 0.25rem;
}

/* Create/New button (green) */
.btn-profile-create {
    background-color: #d1e7dd;
    border-color: #a3cfbb;
    color: #0f5132;
}

.btn-profile-create:hover:not(:disabled) {
    background-color: #b8d9c7;
}

.btn-profile-create:focus {
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

/* Edit button (blue) */
.btn-profile-edit {
    background-color: #cfe2ff;
    border-color: #9ec5fe;
    color: #084298;
}

.btn-profile-edit:hover:not(:disabled) {
    background-color: #b6d4fe;
}

.btn-profile-edit:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Duplicate button (yellow) */
.btn-profile-duplicate {
    background-color: #fff3cd;
    border-color: #ffda6a;
    color: #664d03;
}

.btn-profile-duplicate:hover:not(:disabled) {
    background-color: #ffe69c;
}

.btn-profile-duplicate:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

/* Archive/Move to Bin button (red) */
.btn-profile-archive {
    background-color: #f8d7da;
    border-color: #f1aeb5;
    color: #842029;
}

.btn-profile-archive:hover:not(:disabled) {
    background-color: #f5c2c7;
}

.btn-profile-archive:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Responsive adjustments for FK buttons */
@media (max-width: 576px) {
    .profile-actions-row {
        flex-direction: column;
        gap: 0.375rem;
    }

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


/* === LOADING BUTTON STATES === */
/* Submit button loading spinner states for modal forms
   Pattern: Button contains .btn-text (normal), .btn-spinner (loading)
   JavaScript toggles visibility on form submit
   See: contact_detailed_edit_modal.html */

.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Ensure spinner is properly hidden when not loading */
.btn-spinner.d-none {
    display: none !important;
}

/* Loading state button */
button[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Spinner animation (if not using Bootstrap spinner) */
@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.125rem solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

.spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 0.1rem;
}

/* Button with spinner should maintain width to prevent layout shift */
.um-btn:has(.btn-spinner),
.btn:has(.btn-spinner) {
    min-width: 120px;
    justify-content: center;
}

/* === UNIFIED MODAL ALERT STYLES === */

.um-alert-body {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 8px 0;
}

.um-alert-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}

.um-alert-message {
    margin: 0;
    flex: 1;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
}

.um-alert-error .um-alert-icon {
    color: #ef4444;
}

.um-alert-warning .um-alert-icon {
    color: #f59e0b;
}

.um-alert-success .um-alert-icon {
    color: #10b981;
}

.um-alert-info .um-alert-icon {
    color: #3b82f6;
}


/* === AI CONFIG MODAL STYLES === */

/* Model suggestions visibility toggle */
.ai-model-suggestions {
    display: inline;
}

.ai-model-suggestions-hidden {
    display: none !important;
}

/* Model suggestion links */
.ai-model-suggestions a {
    text-decoration: none;
    color: #0d6efd;
    cursor: pointer;
}

.ai-model-suggestions a:hover {
    text-decoration: underline;
}


/* === COLLAPSE/ACCORDION SYSTEM === */

.tw-collapse-trigger {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.tw-collapse-trigger:hover {
    opacity: 0.8;
}

.tw-collapse-trigger .tw-collapse-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.tw-collapse-trigger.expanded .tw-collapse-icon {
    transform: rotate(180deg);
}

.tw-collapse-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

.tw-collapse-content.expanded {
    max-height: 10000px;
    opacity: 1;
    overflow: visible; /* Allow tooltips and other absolutely positioned elements to escape */
    transition: max-height 0.5s ease-in, opacity 0.3s ease-in;
}

/* Specific collapse for year panels */
.tw-year-collapse {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.tw-year-collapse.collapsed {
    max-height: 0;
}

.tw-year-collapse.expanded {
    max-height: 5000px;
}


/* === FORM SWITCHES === */

.tw-switch-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.tw-switch-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.tw-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 24px;
}

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

.tw-switch-input:checked + .tw-switch-slider {
    background-color: #10b981;
}

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

.tw-switch-input:disabled + .tw-switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.tw-switch-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.tw-switch-input:checked ~ .tw-switch-label {
    color: #10b981;
    font-weight: 500;
}


/* === TABLE COMPONENTS === */

.tw-table-responsive {
    overflow-x: auto;
    overflow-y: visible; /* Allow tooltips to overflow vertically */
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.tw-table {
    width: 100%;
    border-collapse: separate; /* Changed from collapse to allow tooltip overflow */
    border-spacing: 0; /* Maintain visual appearance with no gaps */
    background-color: white;
    overflow: visible; /* Allow tooltips to escape */
}

.tw-table thead {
    background-color: #f3f4f6;
    overflow: visible; /* Allow tooltips in table header */
}

.tw-table tbody {
    overflow: visible; /* Allow tooltips in table body */
}

.tw-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    overflow: visible; /* Allow tooltips to escape */
}

.tw-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    overflow: visible; /* Allow tooltips to escape */
    position: relative; /* Create stacking context for proper tooltip rendering */
}

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

.tw-table tbody tr:hover {
    background-color: #f9fafb;
}

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

.tw-table tfoot {
    background-color: #f3f4f6;
    font-weight: 600;
}

.tw-table tfoot td {
    padding: 0.75rem 1rem;
    border-top: 2px solid #e5e7eb;
    border-bottom: none;
}

/* Table sizes */
.tw-table-sm th,
.tw-table-sm td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.tw-table-lg th,
.tw-table-lg td {
    padding: 1rem 1.25rem;
}

@media (max-width: 768px) {
    .tw-table {
        font-size: 0.875rem;
    }

    .tw-table th,
    .tw-table td {
        padding: 0.5rem 0.75rem;
    }
}


/* === BUTTON GROUP === */

.tw-btn-group {
    display: inline-flex;
    gap: 0;
}

.tw-btn-group .tw-btn,
.tw-btn-group .tw-action-btn,
.tw-btn-group button,
.tw-btn-group a {
    border-radius: 0;
    margin: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.tw-btn-group .tw-btn:first-child,
.tw-btn-group .tw-action-btn:first-child,
.tw-btn-group button:first-child,
.tw-btn-group a:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.tw-btn-group .tw-btn:last-child,
.tw-btn-group .tw-action-btn:last-child,
.tw-btn-group button:last-child,
.tw-btn-group a:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-right: none;
}

.tw-btn-group .tw-btn:only-child,
.tw-btn-group .tw-action-btn:only-child,
.tw-btn-group button:only-child,
.tw-btn-group a:only-child {
    border-radius: 0.375rem;
}


/* === UTILITY CLASSES === */

/* Spacing utilities */
.tw-mb-1 { margin-bottom: 0.25rem; }
.tw-mb-2 { margin-bottom: 0.5rem; }
.tw-mb-3 { margin-bottom: 0.75rem; }
.tw-mb-4 { margin-bottom: 1rem; overflow: visible; }
.tw-mb-5 { margin-bottom: 1.5rem; }
.tw-mb-6 { margin-bottom: 2rem; }

.tw-mt-1 { margin-top: 0.25rem; }
.tw-mt-2 { margin-top: 0.5rem; }
.tw-mt-3 { margin-top: 0.75rem; }
.tw-mt-4 { margin-top: 1rem; }

.tw-p-2 { padding: 0.5rem; }
.tw-p-3 { padding: 0.75rem; }
.tw-p-4 { padding: 1rem; }
.tw-p-5 { padding: 1.5rem; }

.tw-py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.tw-py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.tw-py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.tw-py-5 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

.tw-pb-2 { padding-bottom: 0.5rem; }
.tw-pb-3 { padding-bottom: 0.75rem; }

/* Flexbox utilities */
.tw-flex { display: flex; }
.tw-inline-flex { display: inline-flex; }
.tw-items-center { align-items: center; }
.tw-items-start { align-items: flex-start; }
.tw-items-end { align-items: flex-end; }
.tw-justify-center { justify-content: center; }
.tw-justify-between { justify-content: space-between; }
.tw-justify-end { justify-content: flex-end; }
.tw-flex-wrap { flex-wrap: wrap; }
.tw-gap-1 { gap: 0.25rem; }
.tw-gap-2 { gap: 0.5rem; }
.tw-gap-3 { gap: 0.75rem; }
.tw-gap-4 { gap: 1rem; }

/* Text utilities */
.tw-text-center { text-align: center; }
.tw-text-left { text-align: left; }
.tw-text-right { text-align: right; }
.tw-text-muted { color: #6b7280; }
.tw-text-success { color: #10b981; }
.tw-text-danger { color: #ef4444; }
.tw-text-warning { color: #f59e0b; }
.tw-font-semibold { font-weight: 600; }
.tw-font-bold { font-weight: 700; }

/* Display utilities */
.tw-d-inline { display: inline; }
.tw-d-inline-block { display: inline-block; }
.tw-d-block { display: block; }

/* Border utilities */
.tw-border-bottom { border-bottom: 1px solid #e5e7eb; }


/* ========================================
 * 9. CLOUD INTEGRATION COMPONENTS
 * ======================================== */

/* Cloud Provider Cards */
.tw-cloud-provider-card {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    background: white;
}

.tw-cloud-provider-card:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

/* Provider Icons */
.tw-provider-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: white;
}

.tw-provider-icon-microsoft {
    background: linear-gradient(45deg, #00a1f1, #0078d4);
}

.tw-provider-icon-google {
    background: linear-gradient(45deg, #4285f4, #34a853);
}

.tw-provider-icon-icloud {
    background: linear-gradient(45deg, #007aff, #5ac8fa);
}

/* Account Status Badges */
.tw-account-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.tw-account-status-connected {
    background: #d4edda;
    color: #155724;
}

.tw-account-status-error {
    background: #f8d7da;
    color: #721c24;
}

.tw-account-status-not-connected {
    background: #f8f9fa;
    color: #6c757d;
}

/* Connection Status (for auto-testing) */
.tw-connection-status {
    display: inline-block;
}

.tw-status-connected .tw-account-status,
.tw-status-connected {
    background: #d4edda;
    color: #155724;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.tw-status-error .tw-account-status,
.tw-status-error {
    background: #f8d7da;
    color: #721c24;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.tw-status-testing .tw-account-status,
.tw-status-testing {
    background: #fff3cd;
    color: #856404;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.tw-status-testing i {
    animation: spin 1s linear infinite;
}

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

/* Account Items */
.tw-account-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.tw-account-item:last-child {
    margin-bottom: 0;
}

/* Feature Badges */
.tw-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tw-feature-badge {
    background: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tw-feature-badge-available {
    background: #d1ecf1;
    color: #0c5460;
}

.tw-feature-badge-coming-soon {
    background: #fff3cd;
    color: #856404;
}

/* Provider Description */
.tw-provider-description {
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* Cloud Connection Buttons */
.tw-btn-connect {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tw-btn-connect:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    color: white;
}

.tw-btn-connect:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tw-btn-disconnect {
    background: #dc3545;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tw-btn-disconnect:hover {
    background: #c82333;
    color: white;
}

.tw-btn-test {
    background: #17a2b8;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-right: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tw-btn-test:hover {
    background: #138496;
    color: white;
}

/* Sync Statistics */
.tw-sync-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.tw-sync-stat {
    text-align: center;
}

.tw-sync-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #007bff;
}

.tw-sync-stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Empty State */
.tw-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.tw-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}


/* ===================================================================
 * 12. FOREIGN KEY CRUD COMPONENTS
 * ===================================================================
 * Styles for foreign key fields with CRUD action buttons
 * Used in invoice/offer creation forms and other forms with FK fields
 */

/* Profile field and action buttons styles */
.profile-field-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.profile-select-wrapper {
    flex: 1;
}

.btn-create-from-profile {
    margin-top: 0;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-create-from-profile:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.btn-create-from-profile:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-create-from-profile i {
    font-size: 0.875rem;
}

/* Profile actions button row */
.profile-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Contact creation button styles */
.field-with-button {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.field-with-button > div:first-child {
    flex: 1;
}

.btn-create-contact {
    margin-top: 1.875rem; /* Aligns with form field after label */
    padding: 0.625rem 1rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.btn-create-contact:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-create-contact i {
    font-size: 0.875rem;
}

/* Success notification for CRUD actions */
.contact-success-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000; /* Notifications layer - above modals (2000+) */
    font-weight: 500;
}

.contact-success-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.contact-success-notification i {
    font-size: 1.25rem;
}

/* Profile selection notice */
.profile-selection-notice {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    display: none;
}

.profile-selection-notice.active {
    display: block;
}

.profile-selection-notice i {
    color: #0284c7;
    margin-right: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .field-with-button {
        flex-direction: column;
    }

    .btn-create-contact {
        margin-top: 0.5rem;
        width: 100%;
        justify-content: center;
    }

    .contact-success-notification {
        left: 10px;
        right: 10px;
        transform: translateY(-100px);
    }

    .contact-success-notification.show {
        transform: translateY(0);
    }
}

/* Invoice/Offer Creation Page Specific Styles */
.invoice-create-container,
.offer-create-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.invoice-create-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.offer-create-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.invoice-create-header h1,
.offer-create-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.invoice-create-header p,
.offer-create-header p {
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.invoice-create-body,
.offer-create-body {
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 2rem;
}

.form-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-section-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.form-section-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1rem;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.form-section-description {
    color: #64748b;
    font-size: 0.875rem;
    margin: 0.25rem 0 0 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 2px solid #e2e8f0;
    margin-top: 2rem;
}

.btn-create-invoice,
.btn-create-offer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-create-invoice:hover,
.btn-create-offer:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
    color: white;
}

.btn-cancel {
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    border-color: #cbd5e1;
    color: #475569;
}

/* Collapsible sections */
.section-collapsible {
    cursor: pointer;
}

.section-collapsible .form-section-icon {
    transition: transform 0.3s;
}

.section-collapsible.collapsed .form-section-icon {
    transform: rotate(-90deg);
}

.section-content.collapse:not(.show) {
    display: none;
}

.section-content.collapse.show {
    display: block;
}

/* Required field indicator */
.required-indicator {
    color: #dc2626;
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Responsive adjustments for invoice/offer creation */
@media (max-width: 768px) {
    .invoice-create-container,
    .offer-create-container {
        margin: 1rem auto;
    }

    .invoice-create-header,
    .offer-create-header {
        padding: 1.5rem;
    }

    .invoice-create-body,
    .offer-create-body {
        padding: 1rem;
    }

    .form-section {
        padding: 1rem;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .btn-create-invoice,
    .btn-create-offer,
    .btn-cancel {
        width: 100%;
    }
}

/* ===============================================
   EMAIL NOTIFICATION ICON
   ===============================================
   Notification icon for unprocessed emails in the navigation header
   =============================================== */

.email-notification-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: transparent;
}

.email-notification-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-1px);
}

.email-notification-icon i {
    font-size: 1.1rem;
}

/* Notification Badge */
.email-notification-icon .notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    transform: translate(25%, -25%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Loading state */
.email-notification-icon .fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* Mobile responsive */
@media (max-width: 768px) {
    .email-notification-icon {
        width: 44px;
        height: 44px;
    }

    .email-notification-icon .notification-badge {
        min-width: 20px;
        height: 20px;
        font-size: 0.75rem;
        line-height: 20px;
        border-radius: 10px;
    }
}


/* === INVOICE MANAGEMENT COMPONENTS (Buchhaltung) === */

/* Fixed Header Scrollable Table Components */
.tw-invoice-table-container {
    max-height: 70vh;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tw-invoice-table-scroll {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.tw-invoice-pagination-area {
    flex-shrink: 0;
    border-top: 1px solid #e5e7eb;
    background: white;
}

/* Sticky table headers within scrollable area */
.tw-invoice-table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f3f4f6;
    backdrop-filter: blur(8px);
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table row hover effects - no transform to prevent layout shifts */
.tw-invoice-table-scroll tbody tr:hover {
    background-color: #f8fafc;
    transform: none;
}

.tw-invoice-table-scroll tbody tr {
    border-bottom: 1px solid #f3f4f6;
}

.tw-invoice-table-scroll tbody tr:first-child td {
    border-top: none;
}

/* Connected Expenses Components */
.tw-connected-expenses-container {
    min-width: 200px;
}

.tw-expense-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #dbeafe;
    color: #1e40af;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.tw-expense-badge-remove {
    margin-left: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 0.75rem;
    width: 0.75rem;
    border-radius: 9999px;
    color: #60a5fa;
    cursor: pointer;
}

.tw-expense-badge-remove:hover {
    background-color: #bfdbfe;
    color: #1e40af;
}

/* Invoice Badge Styles */
.tw-invoice-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background-color: #dbeafe;
    color: #1e40af;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.tw-invoice-badge-clickable {
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.tw-invoice-badge-clickable:hover {
    background-color: #bfdbfe;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

.tw-invoice-badge-clickable:active {
    transform: translateY(0);
}

.tw-invoice-badge-remove {
    margin-left: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
}

.tw-invoice-badge-remove:hover {
    background-color: #bfdbfe;
    color: #1e40af;
}

/* Transaction Badge Styles */
.tw-transaction-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background-color: #d1fae5;
    color: #065f46;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.tw-transaction-badge-clickable {
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.tw-transaction-badge-clickable:hover {
    background-color: #a7f3d0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(6, 95, 70, 0.2);
}

.tw-transaction-badge-clickable:active {
    transform: translateY(0);
}

.tw-transaction-badge-remove {
    margin-left: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
}

.tw-transaction-badge-remove:hover {
    background-color: #a7f3d0;
    color: #065f46;
}

/* Confidence Badge Colors */
.tw-confidence-badge {
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 2px;
    display: inline-block;
}

.tw-confidence-badge-high {
    background-color: #10b981; /* Green for >=80% */
}

.tw-confidence-badge-medium {
    background-color: #f59e0b; /* Yellow for >=60% */
}

.tw-confidence-badge-low {
    background-color: #6b7280; /* Gray for <60% */
}

/* Table Column Widths */
.tw-col-checkbox {
    width: 40px;
}

.tw-col-sm {
    max-width: 200px;
}

.tw-col-md {
    max-width: 300px;
}

/* Utility Classes */
.tw-cursor-pointer {
    cursor: pointer;
}

/* Tom Select Styling for Invoice Page */
.tw-expense-selector .ts-control {
    min-height: 32px;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}

.tw-expense-selector .ts-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.tw-expense-selector .ts-control.disabled {
    opacity: 0.6;
    background-color: #f9fafb;
    color: #6b7280;
}

.ts-dropdown {
    z-index: 1050;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Invoice Action Buttons */
.tw-invoice-action-btn {
    cursor: pointer;
    min-width: 32px;
    min-height: 32px;
    border: 1px solid #e5e7eb;
    background: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.tw-invoice-action-btn:hover {
    border-color: #fbbf24;
    background: #fef3c7;
}

.tw-invoice-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    background: #f9fafb;
}

/* Finanzamt Copy Button */
.finanzamt-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.375rem;
    padding: 0;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s ease;
    vertical-align: middle;
    border-radius: 0.25rem;
}

.finanzamt-copy-btn:hover {
    color: #3b82f6;
    background-color: #eff6ff;
    transform: scale(1.1);
}

.finanzamt-copy-btn:active {
    transform: scale(0.95);
}

.finanzamt-copy-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Finanzamt copy button icon */
.finanzamt-copy-btn i {
    pointer-events: none;
}

/* Auto-save Indicator Styling */
.tw-alert-auto-save {
    border-left: 4px solid #10b981;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Bootstrap Icons Support */
.bi::before {
    display: inline-block;
    font-family: bootstrap-icons !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: -.125em;
}

/* === PRINT PREVIEW COMPONENTS === */

/* Print Controls Sticky Bar */
.tw-print-controls {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Draft Banner */
.tw-draft-banner {
    background: #fff3cd;
    color: #856404;
    padding: 10px 20px;
    text-align: center;
    margin-bottom: 10px;
    border-radius: 4px;
    font-weight: 600;
}

/* Print Controls Button Container */
.tw-print-controls-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

/* Print Control Buttons */
.tw-print-btn {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.2s ease;
}

.tw-print-btn:hover {
    background: #0b5ed7;
}

.tw-print-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tw-download-btn {
    background: #198754;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s ease;
}

.tw-download-btn:hover {
    background: #146c43;
    color: white;
    text-decoration: none;
}

/* Payment Toggle in Print Controls */
.tw-payment-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
    transition: background 0.2s ease;
}

.tw-payment-toggle:hover {
    background: #e9ecef;
}

.tw-payment-toggle input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
}

.tw-payment-toggle span {
    color: #495057;
    font-weight: 500;
}

/* Payment rows in invoice print */
.document-payment-header {
    padding-top: 0.5rem;
    font-size: 0.95em;
    text-align: left;
}

.document-payment-row td {
    font-size: 0.9em;
    color: #555;
}

.document-payment-summary td,
.document-payment-remaining td {
    padding-top: 0.25rem;
}

/* Print Content Container */
.tw-print-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tw-print-controls {
        padding: 10px 0;
    }

    .tw-print-btn,
    .tw-download-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* Print Media Queries */
@media print {
    .tw-print-controls {
        display: none !important;
    }

    /* Hide navigation and other non-print elements */
    nav, .navbar, .nav, header, footer {
        display: none !important;
    }

    /* Ensure content uses full page */
    body {
        margin: 0;
        padding: 0;
    }

    .tw-print-content {
        margin: 0;
        padding: 0;
        max-width: none;
    }
}

/* Hide controls on load if URL has print parameter */
.print-mode .tw-print-controls {
    display: none !important;
}


/* ========================================================================
   14. LIST VIEW PREFERENCES COMPONENTS
   ======================================================================== */

/* Preset Selector Dropdown */
.preset-selector-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preset-selector-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

#preset-selector {
    min-width: 200px;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: white;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    appearance: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

#preset-selector:hover {
    border-color: #9ca3af;
}

#preset-selector:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Column Settings Button */
#column-settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

#column-settings-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

#column-settings-btn:active {
    background-color: #f3f4f6;
}

#column-settings-btn i {
    font-size: 1rem;
}

/* Manager Toolbar with Preferences */
.manager-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    gap: 1rem;
    flex-wrap: wrap;
}

.manager-toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.manager-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Column Settings Modal Styles */
.column-item {
    padding: 0.75rem 1rem;
    background-color: white;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
    cursor: move;
}

.column-item:hover {
    background-color: #f9fafb;
}

.column-item.dragging {
    opacity: 0.5;
    background-color: #e0e7ff;
}

.column-item .drag-handle {
    cursor: grab;
    user-select: none;
}

.column-item .drag-handle:active {
    cursor: grabbing;
}

.column-item .form-check-label {
    cursor: pointer;
    user-select: none;
}

.column-item .small {
    font-size: 0.75rem;
    line-height: 1.25;
}

/* Filter Toggle Switch */
.filter-toggle {
    cursor: pointer;
}

.filter-toggle:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

/* Column List Container */
#column-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

#column-list .list-group-item {
    border-left: none;
    border-right: none;
    border-radius: 0;
}

#column-list .list-group-item:first-child {
    border-top: none;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

#column-list .list-group-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* Preset Action Buttons */
#save-as-new-preset-btn,
#delete-preset-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

#save-as-new-preset-btn:hover {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

#delete-preset-btn:hover:not(:disabled) {
    background-color: #dc2626;
    color: white;
    border-color: #dc2626;
}

#delete-preset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Select All/Deselect All Buttons */
#select-all-columns,
#deselect-all-columns {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Reset to Defaults Button */
#reset-to-defaults-btn {
    margin-right: auto;
}

#reset-to-defaults-btn:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .manager-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .manager-toolbar-left,
    .manager-toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .preset-selector-container {
        flex: 1;
    }

    #preset-selector {
        flex: 1;
    }

    #column-list {
        max-height: 300px;
    }
}

/* Animation for drag-drop feedback */
@keyframes columnDragEnter {
    0% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
    }
}

.column-item.drag-over {
    animation: columnDragEnter 0.3s ease;
    border-color: #3b82f6;
}

/* ============================================================================
   BULK EDIT - Expense Table Column Hover
   ============================================================================
   Styles for bulk-editable column headers with keyboard shortcuts.
   Hover over column header + press "b" to trigger bulk edit modal.
*/

.bulk-editable-column {
    position: relative;
    transition: all 0.2s ease;
}

/* Hover state - indicates column is bulk-editable */
.bulk-editable-column:hover {
    background-color: #eff6ff !important;  /* Light blue background */
    box-shadow: inset 0 0 0 2px #3b82f6;   /* Blue border effect */
}

/* Active hover state when JavaScript detects hover */
.bulk-editable-column.bulk-edit-hover {
    background-color: #dbeafe !important;  /* Slightly darker blue */
    box-shadow: inset 0 0 0 2px #2563eb;   /* Darker blue border */
    cursor: pointer;
}

/* Add visual indicator for keyboard shortcut */
.bulk-editable-column::after {
    content: 'B';
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    font-weight: bold;
    color: #94a3b8;  /* Gray text */
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.bulk-editable-column:hover::after {
    opacity: 1;
}

/* Bulk edit modal enhancements */
.bulk-edit-form .btn-group label {
    flex: 1;
    text-align: center;
}

.bulk-edit-form .alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* ========================================
   EXPENSE TABBED VIEW STYLES
   ======================================== */

/* Locked Field Styling (CSV Import Fields) */
.locked-field {
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
    border: 1px solid #ddd !important;
    color: #666 !important;
    position: relative;
}

.locked-field::before {
    content: "\f023";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    pointer-events: none;
}

/* Import Metadata Banner */
.import-metadata-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.import-metadata-banner i {
    font-size: 18px;
}

.import-metadata-banner strong {
    font-weight: 600;
}

/* Info Card (View Mode Display) */
.info-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px 15px;
    min-height: 38px;
    display: flex;
    align-items: center;
    color: #495057;
    font-size: 14px;
}

.info-card.empty {
    color: #999;
    font-style: italic;
}

/* Tab Section Organization */
.tab-section {
    padding: 20px 0;
}

.tab-section:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.tab-section-header {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

/* CSV Import Data Display */
.csv-import-section {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.import-data-display dl {
    margin-bottom: 0;
}

.import-data-display dt {
    font-weight: 600;
    color: #495057;
    font-size: 13px;
}

.import-data-display dd {
    color: #6c757d;
    font-size: 13px;
    margin-bottom: 10px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.page-header h1 {
    font-size: 24px;
    margin: 0;
    color: #212529;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Invoice Cards */
.invoice-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.invoice-card {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px 15px;
    transition: all 0.2s;
}

.invoice-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.invoice-card a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.invoice-card a:hover {
    text-decoration: underline;
}

/* Keyword Badges */
.keyword-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-badges .badge {
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
}

/* Tab Content Styling */
.tab-content {
    padding: 20px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-link {
    color: #6c757d;
    font-weight: 500;
    border: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    padding: 12px 20px;
}

.nav-tabs .nav-link:hover {
    color: #667eea;
    border-bottom-color: #667eea;
}

.nav-tabs .nav-link.active {
    color: #667eea;
    background-color: transparent;
    border-bottom-color: #667eea;
}

/* Form Elements in Locked State */
select.locked-field,
input.locked-field,
textarea.locked-field {
    opacity: 0.7;
}

/* Progress Bar in Business Classification */
.progress {
    background-color: #e9ecef;
    border-radius: 4px;
}

.progress-bar {
    transition: width 0.3s ease;
}

/* === CLOUD SYNC STATUS BADGES === */

/* Sync provider row container */
.sync-provider-row {
    transition: all 0.2s ease-in-out;
}

.sync-provider-row:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Status badge styles */
.badge-success {
    background-color: #28a745;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.badge-danger {
    background-color: #dc3545;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.badge-secondary {
    background-color: #6c757d;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

/* Error message styling */
.sync-provider-row .tw-bg-red-50 {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        margin-top: 15px;
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
    }

    /* Stack sync provider elements on mobile */
    .sync-provider-row .form-check-switch {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .sync-provider-row .tw-ml-4 {
        margin-left: 0 !important;
        margin-top: 0.5rem;
        width: 100%;
        justify-content: flex-start;
    }
}

/* === CONTACT MERGE DRAG-DROP STYLES === */

/* Draggable sync cards */
.sync-card[draggable="true"] {
    cursor: grab;
    transition: all 0.2s ease;
}

.sync-card[draggable="true"]:active {
    cursor: grabbing;
}

/* Card being dragged */
.sync-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Valid drop target */
.sync-card.drop-target {
    border: 2px dashed #2563eb !important;
    background-color: rgba(37, 99, 235, 0.05);
    transform: scale(1.01);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Invalid drop target (same card or different source) */
.sync-card.drop-invalid {
    border: 2px dashed #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05);
}

/* Drag handle icon indicator */
.sync-card .drag-handle {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sync-card:hover .drag-handle {
    opacity: 0.5;
}

.sync-card:hover .drag-handle:hover {
    opacity: 1;
}

/* === CONTACT MERGE DRAG-DROP STYLES (Table Rows) === */

/* Make table rows draggable with visual cue */
.tw-merge-draggable {
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
}

.tw-merge-draggable:active {
    cursor: grabbing;
}

/* Row being dragged */
.tw-merge-draggable.tw-merge-dragging {
    opacity: 0.5;
    background-color: #e0e7ff !important;
    transform: scale(0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Valid drop target */
.tw-merge-draggable.tw-merge-drop-target {
    background-color: rgba(37, 99, 235, 0.08) !important;
    outline: 2px dashed #2563eb;
    outline-offset: -2px;
    transform: scale(1.01);
}

/* Invalid drop target (same row) */
.tw-merge-draggable.tw-merge-drop-invalid {
    background-color: rgba(220, 53, 69, 0.08) !important;
    outline: 2px dashed #dc3545;
    outline-offset: -2px;
}

/* Merge preview form - fields that received data from source contact */
.merge-field-changed {
    border-left: 3px solid #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05);
    padding-left: 0.75rem;
    transition: all 0.2s ease;
}

.merge-field-changed:focus-within {
    background-color: rgba(220, 53, 69, 0.1);
}

/* Merge field label indicator */
.merge-field-indicator {
    display: inline-block;
    font-size: 0.75rem;
    color: #dc3545;
    margin-left: 0.5rem;
}

/* Merge arrow indicator between contacts */
.merge-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background-color: #e5e7eb;
    border-radius: 50%;
    color: #6b7280;
    margin: 0 0.75rem;
}

/* Contact preview cards in merge confirmation */
.merge-contact-preview {
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
}

.merge-contact-preview.source {
    border-color: #fbbf24;
    background-color: #fffbeb;
}

.merge-contact-preview.target {
    border-color: #22c55e;
    background-color: #f0fdf4;
}

/* === AI IMAGE UPLOAD STYLES === */

/* Drop zone for image upload */
.ai-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.ai-drop-zone:hover,
.ai-drop-zone.drag-over {
    border-color: var(--tw-primary-color, #2563eb);
    background: #eff6ff;
}

.ai-drop-zone i {
    font-size: 2rem;
    color: #9ca3af;
}

.ai-drop-zone span {
    color: #6b7280;
    font-size: 0.875rem;
}

/* File upload label (clickable) */
.ai-image-upload-label {
    color: var(--tw-primary-color, #2563eb);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.ai-image-upload-label:hover {
    color: #1d4ed8;
}

/* Image preview container */
.ai-image-preview {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    max-width: 100%;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    padding: 0.5rem;
}

.ai-image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 0.375rem;
    display: block;
    margin: 0 auto;
}

/* Remove image button */
.ai-remove-image {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.ai-remove-image:hover {
    background: rgba(0, 0, 0, 0.8);
}

.ai-remove-image i {
    font-size: 0.875rem;
}

/* Image upload section container */
.ai-image-upload-section {
    margin-bottom: 1rem;
}

/* === AI ASSIST PANEL - PROGRESSIVE DISCLOSURE === */

/* Main panel container */
.ai-assist-panel {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Mode buttons row (Text eingeben / Aufnehmen) */
.ai-mode-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: center;
}

.ai-mode-buttons .tw-btn {
    flex: 1;
    max-width: 200px;
}

.ai-mode-buttons .tw-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Text section container (hidden by default) */
.ai-text-section {
    margin-top: 1rem;
    animation: slideDown 0.2s ease-out;
}

.ai-text-section .form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.ai-text-section textarea {
    resize: vertical;
    min-height: 120px;
}

/* Compact drop zone (shown in text-first mode) */
.ai-compact-drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    border: 1px dashed #d1d5db;
    border-radius: 0.375rem;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    font-size: 0.875rem;
}

.ai-compact-drop-zone:hover,
.ai-compact-drop-zone.drag-over {
    border-color: var(--tw-primary-color, #2563eb);
    background: #eff6ff;
    color: var(--tw-primary-color, #2563eb);
}

.ai-compact-drop-zone i {
    font-size: 1rem;
}

/* Submit buttons row (Extract / Clear) */
.ai-submit-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    animation: slideDown 0.2s ease-out;
}

/* Slide down animation for progressive disclosure */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
