/* 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)
 * 14. Auth Pages (Login, Register, Password Reset, Landing)
 * 15. Admin Panel Components
 * 16. Footer Components
 * 17. User Profile Page
 */


/* === 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: 0.75rem 1rem;
        margin-bottom: 0.75rem;
    }
    .tw-page-title {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
    .tw-page-subtitle {
        font-size: 0.813rem;
        line-height: 1.4;
    }
}

/* === Blended Page Header (flush below navbar, no floating card) === */
.tw-page-header-blended {
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    background: linear-gradient(135deg, #2d3748 0%, #1a2332 50%, #2d3748 100%);
    padding: 22px 1.5rem 24px;
    overflow: visible;
}

.tw-page-header-blended::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    /* Override gradient overlay from base .tw-page-header */
    bottom: auto;
    opacity: 1;
}

/* Subtle noise grain overlay for depth */
.tw-page-header-blended::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.tw-page-header-blended .tw-page-title {
    font-size: 1.65rem;
    letter-spacing: -0.3px;
}

.tw-page-header-blended .tw-page-subtitle {
    font-size: 14px;
    opacity: 0.7;
}

/* Header buttons — pink outline, white text (uses --theme-brand-primary) */
.tw-btn-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: #fff;
    border: 1px solid rgba(255, 0, 255, 0.30);
    background: rgba(255, 0, 255, 0.06);
    transition: all 160ms cubic-bezier(0.2, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.1px;
}

.tw-btn-header:hover {
    background: rgba(255, 0, 255, 0.14);
    border-color: rgba(255, 0, 255, 0.5);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 0, 255, 0.12);
}

.tw-btn-header i {
    font-size: 12px;
}

/* Primary variant — bolder pink fill */
.tw-btn-header-primary {
    background: rgba(255, 0, 255, 0.12);
    border-color: rgba(255, 0, 255, 0.40);
}

.tw-btn-header-primary:hover {
    background: rgba(255, 0, 255, 0.22);
    border-color: rgba(255, 0, 255, 0.6);
}

/* Use theme brand color when available */
@supports (color: var(--theme-brand-primary)) {
    .tw-btn-header {
        border-color: color-mix(in srgb, var(--theme-brand-primary) 30%, transparent);
        background: color-mix(in srgb, var(--theme-brand-primary) 6%, transparent);
    }
    .tw-btn-header:hover {
        border-color: color-mix(in srgb, var(--theme-brand-primary) 50%, transparent);
        background: color-mix(in srgb, var(--theme-brand-primary) 14%, transparent);
    }
    .tw-btn-header-primary {
        border-color: color-mix(in srgb, var(--theme-brand-primary) 40%, transparent);
        background: color-mix(in srgb, var(--theme-brand-primary) 12%, transparent);
    }
    .tw-btn-header-primary:hover {
        border-color: color-mix(in srgb, var(--theme-brand-primary) 60%, transparent);
        background: color-mix(in srgb, var(--theme-brand-primary) 22%, transparent);
    }
}

/* Hard shadow edge below header */
.tw-header-edge {
    height: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 1;
}

/* === MANAGER PAGE VARIANTS === */

/* Default variant — constrained width, floating card header */
.manager-page-default {
    max-width: 80rem;        /* 1280px, same as tw-max-w-7xl */
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
@media (min-width: 640px) {
    .manager-page-default { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 1024px) {
    .manager-page-default { padding-left: 2rem; padding-right: 2rem; }
}
.manager-page-default .tw-filter-bar {
    margin-top: 1.5rem;      /* spacing below floating card header */
}

/* Modern variant — wider, flush header, tighter spacing */
.manager-page-modern {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
@media (min-width: 640px) {
    .manager-page-modern { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* Dashboard modern variant — flush header, constrained content */
.dashboard-page-modern {
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
@media (min-width: 640px) {
    .dashboard-page-modern { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.dashboard-page-modern .tw-page-header-blended .tw-page-header-content {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.manager-page-modern .tw-page-header-content {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
.manager-page-modern .tw-filter-bar {
    margin-top: 0.75rem;     /* tighter after blended header + edge */
}
.manager-page-modern .tw-filter-cards-section {
    margin-top: 0.5rem;
}

/* ── Concept G Component Overrides (modern variant only) ───────────── */

/* --- 1. Filter Bar ------------------------------------------------- */
.manager-page-modern .tw-filter-bar {
    padding: 10px 14px;
    gap: 10px;
    border: 1px solid #eceef2;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Search bar container — compact fixed width, expands on focus */
.manager-page-modern .tw-filter-bar .tw-search-bar {
    flex: 0 0 auto;
    width: 180px;
    max-width: 180px;
    margin-right: 0;
    transition: width 200ms ease, max-width 200ms ease;
}

.manager-page-modern .tw-filter-bar .tw-search-bar:focus-within {
    width: 260px;
    max-width: 260px;
}

/* Search input — needs 4-class specificity to beat
   .tw-filter-bar .tw-search-bar .tw-search-input (3 classes) */
.manager-page-modern .tw-filter-bar .tw-search-bar .tw-search-input {
    height: 34px;
    padding: 0 12px 0 34px;
    background-color: #f3f4f7;
    border-radius: 7px;
    font-size: 13px;
    border: 1.5px solid transparent;
    transition: all 180ms ease;
}

.manager-page-modern .tw-filter-bar .tw-search-bar .tw-search-input::placeholder {
    color: #a0a5b5;
    font-weight: 400;
}

.manager-page-modern .tw-filter-bar .tw-search-bar .tw-search-input:focus {
    background-color: #fff;
    border-color: #4f6ef7;
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.08);
}

/* Search icon — tighter positioning */
.manager-page-modern .tw-filter-bar .tw-search-bar .tw-search-icon {
    left: 10px;
    font-size: 12px;
    color: #9298a8;
}

/* Clear-filters button in modern variant — × icon inside search bar */
.manager-page-modern .tw-search-bar .tw-clear-filters-button {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #9298a8;
    cursor: pointer;
    border-radius: 50%;
    transition: color 120ms ease, background 120ms ease;
    box-shadow: none;
    line-height: 1;
}
.manager-page-modern .tw-search-bar .tw-clear-filters-button.filters-active {
    display: inline-flex;
}
.manager-page-modern .tw-search-bar .tw-clear-filters-button.filters-active:hover {
    color: #4b5563;
    background: rgba(0, 0, 0, 0.08);
    box-shadow: none;
    transform: translateY(-50%);
}
/* Hide the text label — icon only */
.tw-clear-filters-label { display: none; }
/* Add right padding to input so text doesn't overlap the × */
.manager-page-modern .tw-search-bar:has(.tw-clear-filters-button.filters-active) .tw-search-input {
    padding-right: 34px;
}

.manager-page-modern .tw-filter-bar-tabs {
    margin-left: auto;
    background: #f3f4f7;
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}

.manager-page-modern .tw-filter-bar .tw-filter-tab {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    color: #5f6474;
    border-radius: 5px;
    border: none;
    border-left: none;
    transition: all 140ms ease;
}

.manager-page-modern .tw-filter-bar .tw-filter-tab:hover {
    color: #16171d;
    background: rgba(0, 0, 0, 0.03);
    box-shadow: none;
}

.manager-page-modern .tw-filter-bar .tw-filter-tab.active {
    color: #4f6ef7;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 600;
    border-left: none;
}

.manager-page-modern .tw-filter-bar .tw-filter-tab.active:hover {
    background: #fff;
}

/* Override connected-group radius — pills, not connected */
.manager-page-modern .tw-filter-bar .tw-filter-tab:first-child {
    border-radius: 5px;
}
.manager-page-modern .tw-filter-bar .tw-filter-tab:not(:first-child):not(:last-child) {
    border-radius: 5px;
    border-left: none;
}
.manager-page-modern .tw-filter-bar .tw-filter-tab:not(:first-child):not(:last-child):hover,
.manager-page-modern .tw-filter-bar .tw-filter-tab:not(:first-child):not(:last-child):focus,
.manager-page-modern .tw-filter-bar .tw-filter-tab:not(:first-child):not(:last-child).active {
    border-left: none;
}
.manager-page-modern .tw-filter-bar .tw-filter-tab:last-child:not(:first-child) {
    border-radius: 5px;
    border-left: none;
}
.manager-page-modern .tw-filter-bar .tw-filter-tab:last-child:not(:first-child):hover,
.manager-page-modern .tw-filter-bar .tw-filter-tab:last-child:not(:first-child):focus,
.manager-page-modern .tw-filter-bar .tw-filter-tab:last-child:not(:first-child).active {
    border-left: none;
}

/* Tab count badges */
.manager-page-modern .tw-filter-tab-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.06);
    color: #9298a8;
}

.manager-page-modern .tw-filter-tab.active .tw-filter-tab-badge {
    background: #eef1fe;
    color: #4f6ef7;
}

/* Filter field groups */
.manager-page-modern .tw-filter-bar .tw-filter-field-group {
    gap: 6px;
}

/* Filter field labels */
.manager-page-modern .tw-filter-field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #9298a8;
    font-weight: 600;
}

/* Date inputs */
.manager-page-modern .tw-filter-bar .tw-filter-date-input {
    height: 34px;
    font-size: 13px;
    border-radius: 7px;
    padding: 0 10px;
    border: 1.5px solid #e4e6eb;
    background: #fff;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.manager-page-modern .tw-filter-bar .tw-filter-date-input:focus {
    border-color: #4f6ef7;
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.08);
    outline: none;
}

/* --- Concept C: Expandable Filter Panel ----------------------------- */
.tw-filter-bar-expandable {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e4e6eb;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 2px 8px rgba(0,0,0,0.02);
    /* No overflow:hidden here — it clips focus ring box-shadows on inputs */
    /* Reset inherited padding and gap from base .tw-filter-bar */
    padding: 0;
    gap: 0;
    margin-bottom: 0;
    margin-top: 0.75rem;
}

/* The <form> child must stretch edge-to-edge — reset base flex-item sizing */
.tw-filter-bar-expandable > form {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Top bar — always visible */
.tw-filter-bar-expandable .tw-filter-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    width: 100%;
}

/* Search bar inside expandable — flex grow.
   Uses higher specificity than .manager-page-modern .tw-filter-bar .tw-search-bar
   to override the fixed 180px width set by the default filter bar overrides. */
.manager-page-modern .tw-filter-bar-expandable .tw-search-bar {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
    transition: none;
}

/* Also cancel the focus-within expansion animation that belongs to the default bar */
.manager-page-modern .tw-filter-bar-expandable .tw-search-bar:focus-within {
    width: auto;
    max-width: none;
}

/* Search input — match Concept C reference exactly.
   !important needed to beat multiple base :has() rules that flatten right side
   for the "connected button" layout used by the default filter bar. */
.tw-filter-bar-expandable .tw-search-bar .tw-search-input {
    height: 40px !important;
    border: 1.5px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 0 36px 0 36px !important;
    font-size: 14px !important;
    color: #1f2937;
    background: #f9fafb !important;
    outline: none;
    transition: all 0.2s ease;
}

.manager-page-modern .tw-filter-bar-expandable .tw-search-bar .tw-search-input::placeholder {
    color: #9ca3af;
}

.tw-filter-bar-expandable .tw-search-bar .tw-search-input:focus {
    border-color: #6366f1 !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* Search icon — match concept: 13px, gray, turns indigo on focus */
.tw-filter-bar-expandable .tw-search-bar .tw-search-icon {
    left: 12px;
    font-size: 13px;
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.2s ease;
}
.tw-filter-bar-expandable .tw-search-bar .tw-search-input:focus ~ .tw-search-icon,
.tw-filter-bar-expandable .tw-search-bar:focus-within .tw-search-icon {
    color: #6366f1;
}

/* Clear button — match concept: small rounded square, gray bg, inside the input */
.tw-filter-bar-expandable .tw-search-bar .tw-clear-filters-button,
.manager-page-modern .tw-filter-bar-expandable .tw-search-bar .tw-clear-filters-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: none;
    background: #e5e7eb;
    border-radius: 5px;
    color: #6b7280;
    font-size: 9px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    transition: all 0.2s ease;
    box-shadow: none;
    line-height: 1;
}
.tw-filter-bar-expandable .tw-search-bar .tw-clear-filters-button:hover {
    background: #d1d5db;
}
.tw-filter-bar-expandable .tw-search-bar .tw-clear-filters-button.filters-active {
    display: flex;
    background: #e5e7eb;
    color: #6b7280;
    border-color: transparent;
    transform: translateY(-50%);
    box-shadow: none;
}
.tw-filter-bar-expandable .tw-search-bar .tw-clear-filters-button.filters-active:hover {
    background: #d1d5db;
    color: #4b5563;
    box-shadow: none;
    transform: translateY(-50%);
}

/* Tabs in expandable topbar — reset the margin-left: auto from the modern override
   so the tabs sit naturally at the end of the flex row (the search flex:1 pushes them) */
.manager-page-modern .tw-filter-bar-expandable .tw-filter-bar-tabs {
    margin-left: 0;
}

/* Filter toggle button */
.tw-filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border: 1.5px solid #e4e6eb;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #5f6474;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tw-filter-toggle-btn i.fa-sliders { font-size: 12px; }
.tw-filter-toggle-btn .tw-toggle-chevron { font-size: 10px; transition: transform 0.25s ease; }
.tw-filter-toggle-btn:hover { border-color: #ccc; background: #f9fafb; }

.tw-filter-toggle-btn.panel-open {
    border-color: #4f6ef7;
    color: #4f6ef7;
    background: #eef0ff;
}
.tw-filter-toggle-btn.panel-open .tw-toggle-chevron { transform: rotate(180deg); }

/* Badge count on toggle button */
.tw-filter-badge-count {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    background: #4f6ef7;
    color: #fff;
}
.tw-filter-toggle-btn.has-filters .tw-filter-badge-count { display: inline-flex; }

/* Tabs inside expandable topbar — reuse existing tab styles but wrap in container */
.tw-filter-bar-expandable .tw-filter-bar-tabs {
    margin-left: auto;
}

/* Expandable panel */
.tw-filter-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.tw-filter-panel.tw-filter-panel-open {
    max-height: 420px;
    overflow: visible;
}
@media (max-width: 768px) {
    .tw-filter-panel.tw-filter-panel-open {
        max-height: 800px;
    }
}

.tw-filter-panel-inner {
    padding: 0 14px 14px;
    border-top: 1px solid #f0f1f4;
}

/* Quick presets */
.tw-filter-presets {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 0 14px;
    flex-wrap: wrap;
}

.tw-filter-presets-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    margin-right: 4px;
}

.tw-filter-preset-btn {
    height: 28px;
    padding: 0 12px;
    border: 1px solid #e4e6eb;
    border-radius: 999px;
    background: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: #5f6474;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.tw-filter-preset-btn:hover { border-color: #a5b4fc; color: #4f6ef7; background: #eef0ff; }
.tw-filter-preset-btn.-active {
    border-color: #4f6ef7;
    background: #eef0ff;
    color: #3b4ec4;
}
.tw-filter-preset-btn i { margin-right: 4px; font-size: 10px; }

/* Custom preset with delete button */
.tw-filter-preset-custom {
    position: relative;
    padding-right: 24px;
}
.tw-filter-preset-delete {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.15s;
}
.tw-filter-preset-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Create "+" button */
.tw-filter-preset-create {
    background: transparent;
    border: 1.5px dashed #d1d5db;
    color: #9ca3af;
    min-width: 32px;
    padding: 0 8px;
}
.tw-filter-preset-create:hover {
    border-color: #4f6ef7;
    color: #4f6ef7;
    background: rgba(79, 110, 247, 0.05);
}

/* Inline name input */
.tw-quick-filter-input {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tw-quick-filter-input input {
    height: 28px;
    border: 1.5px solid #4f6ef7;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    width: 140px;
    outline: none;
    background: white;
}
.tw-quick-filter-save {
    height: 28px;
    width: 28px;
    border-radius: 50%;
    border: none;
    background: #4f6ef7;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}
.tw-quick-filter-save:hover {
    background: #3b4ec4;
}

/* Filter grid */
.tw-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.tw-filter-grid .tw-filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8b8fa3;
    margin-bottom: 6px;
}
.tw-filter-grid .tw-filter-group label i { margin-right: 4px; font-size: 10px; }

.tw-filter-grid .tw-filter-select,
.tw-filter-grid .tw-filter-date {
    width: 100%;
    height: 38px;
    border: 1.5px solid #e4e6eb;
    border-radius: 8px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 13px;
    color: #374151;
    background: #f9fafb;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}
.tw-filter-grid .tw-filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.tw-filter-grid .tw-filter-select:focus,
.tw-filter-grid .tw-filter-date:focus {
    border-color: #4f6ef7;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.08);
}

/* Panel actions (Reset + Apply) */
.tw-filter-panel-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f0f1f4;
}

.tw-filter-panel-actions .tw-btn-reset {
    height: 34px;
    padding: 0 14px;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #5f6474;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tw-filter-panel-actions .tw-btn-reset:hover { background: #f9fafb; border-color: #ccc; }

.tw-filter-panel-actions .tw-btn-apply {
    height: 34px;
    padding: 0 18px;
    border: none;
    border-radius: 8px;
    background: #4f6ef7;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tw-filter-panel-actions .tw-btn-apply:hover { background: #3b5de7; }

/* Applied filters summary row — lives INSIDE .tw-filter-bar-expandable */
.tw-applied-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: #f6f7f9;
    border-top: 1px solid #eceef2;
    border-radius: 0 0 10px 10px;
    transition: all 0.25s ease;
}
.tw-applied-filters.tw-hidden { display: none; }

.tw-applied-filters-label {
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
    margin-right: 2px;
}

.tw-applied-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    padding: 0 8px 0 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    animation: twFilterSlideIn 0.2s ease;
}

@keyframes twFilterSlideIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.tw-applied-filter-tag--search  { background: #fffbeb; color: #d97706; }
.tw-applied-filter-tag--date    { background: #ecfdf5; color: #059669; }
.tw-applied-filter-tag--select  { background: #eef0ff; color: #3b4ec4; }
.tw-applied-filter-tag--preset  { background: #fff1f2; color: #e11d48; }
.tw-applied-filter-tag--per_page { background: #f3f4f6; color: #6b7280; }

.tw-applied-filter-remove {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 8px;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    padding: 0;
}
.tw-applied-filter-remove:hover { opacity: 1; }

.tw-applied-filters-clear {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: auto;
    transition: all 0.2s ease;
}
.tw-applied-filters-clear:hover { color: #5f6474; background: #e5e7eb; }

/* Responsive: Expandable Filter Panel */
@media (max-width: 768px) {
    .tw-filter-bar-expandable .tw-filter-topbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }
    .tw-filter-bar-expandable .tw-search-bar { order: 1; width: 100%; flex: auto; }
    .tw-filter-toggle-btn { order: 2; }
    .tw-filter-bar-expandable .tw-filter-bar-tabs { order: 3; flex: 1; margin-left: 0; }
    .tw-filter-bar-expandable .tw-filter-bar-tabs .tw-filter-tab { flex: 1; justify-content: center; padding: 0 8px; font-size: 12px; }

    .tw-filter-grid { grid-template-columns: 1fr; }
    .tw-filter-panel-inner { padding: 0 12px 12px; }

    .tw-filter-presets { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 10px; }
    .tw-filter-preset-btn { flex-shrink: 0; }
}

/* --- 2. Table ------------------------------------------------------ */
.manager-page-modern .tw-list-view-table {
    background: #fff;
    border: 1px solid #e4e6eb;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.02);
}

.manager-page-modern .tw-table {
    font-size: 13.5px;
}

.manager-page-modern .tw-table-header {
    background: linear-gradient(180deg, #fafbfc 0%, #f6f7f9 100%);
    border-bottom: 1px solid #e4e6eb;
}

.manager-page-modern .tw-table-header th {
    padding: 11px 14px;
    font-size: 10.5px;
    font-weight: 700;
    color: #8b8fa3;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.manager-page-modern .tw-table-cell {
    padding: 13px 14px;
}

.manager-page-modern .tw-table-body tr {
    border-bottom: 1px solid #f0f1f4;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}
.manager-page-modern .tw-table-body tr:last-child {
    border-bottom: none;
}

.manager-page-modern .tw-table-row:hover {
    background-color: #f8f9fc;
    box-shadow: inset 3px 0 0 0 #4f6ef7;
}

.manager-page-modern .tw-row-selected {
    background-color: #eef1fe !important;
}

.manager-page-modern .tw-row-selected:hover {
    background-color: #e4e9fd !important;
}

/* Row stagger animation */
@keyframes conceptG-row-enter {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.manager-page-modern .tw-table-body tr {
    animation: conceptG-row-enter 250ms ease both;
}

.manager-page-modern .tw-table-body tr:nth-child(1)  { animation-delay:  25ms; }
.manager-page-modern .tw-table-body tr:nth-child(2)  { animation-delay:  50ms; }
.manager-page-modern .tw-table-body tr:nth-child(3)  { animation-delay:  75ms; }
.manager-page-modern .tw-table-body tr:nth-child(4)  { animation-delay: 100ms; }
.manager-page-modern .tw-table-body tr:nth-child(5)  { animation-delay: 125ms; }
.manager-page-modern .tw-table-body tr:nth-child(6)  { animation-delay: 150ms; }
.manager-page-modern .tw-table-body tr:nth-child(7)  { animation-delay: 175ms; }
.manager-page-modern .tw-table-body tr:nth-child(8)  { animation-delay: 200ms; }
.manager-page-modern .tw-table-body tr:nth-child(9)  { animation-delay: 225ms; }
.manager-page-modern .tw-table-body tr:nth-child(10) { animation-delay: 250ms; }
.manager-page-modern .tw-table-body tr:nth-child(n+11) { animation-delay: 250ms; }

/* Strip card chrome from outer list-view — the card lives on .tw-list-view-table */
.manager-page-modern .tw-list-view {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Pagination — lightweight, floats below the table card */
.manager-page-modern .tw-pagination {
    background: transparent;
    border-top: none;
    border: none;
    box-shadow: none;
    padding: 12px 4px;
}

/* --- 3. Bulk-actions header (hidden until selection) --------------- */
.manager-page-modern .tw-list-view-header {
    display: none;
}
.manager-page-modern .tw-list-view-header.has-selection {
    display: flex;
    padding: 8px 14px;
    background: #f8f9fb;
    border-bottom: 1px solid #e4e6eb;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

/* --- 3b. Row Actions (always visible) ------------------------------ */
.manager-page-modern .tw-action-buttons {
    opacity: 1;
}

.manager-page-modern .tw-action-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #d1d5db;
    background: white;
    font-size: 13px;
    border-radius: 6px;
    box-shadow: none;
    transition: all 140ms cubic-bezier(0.2, 0, 0.2, 1);
}

/* Color-coded action buttons — match dashboard style */
.manager-page-modern .tw-action-btn.tw-action-btn-edit {
    color: #059669;
    border-color: #059669;
}

.manager-page-modern .tw-action-btn.tw-action-btn-view {
    color: #3b82f6;
    border-color: #3b82f6;
}

.manager-page-modern .tw-action-btn.tw-action-btn-duplicate,
.manager-page-modern .tw-action-btn.tw-action-btn-clone {
    color: #7c3aed;
    border-color: #7c3aed;
}

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

.manager-page-modern .tw-action-btn.tw-action-btn-delete {
    color: #dc2626;
    border-color: #dc2626;
}

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

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

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

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

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

.manager-page-modern .tw-action-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Color-coded hover backgrounds */
.manager-page-modern .tw-action-btn-edit:hover {
    background-color: #059669;
    color: white;
    border-color: #059669;
}

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

.manager-page-modern .tw-action-btn-duplicate:hover,
.manager-page-modern .tw-action-btn-clone:hover {
    background-color: #7c3aed;
    color: white;
    border-color: #7c3aed;
}

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

.manager-page-modern .tw-action-btn-delete:hover {
    background-color: #dc2626;
    color: white;
    border-color: #dc2626;
}

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

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

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

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

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

/* --- 4. Badges (dot indicator) ------------------------------------- */
.manager-page-modern .tw-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    gap: 5px;
}

.manager-page-modern .tw-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Dot colors per badge variant */
.manager-page-modern .tw-badge-success::before { background: #1a9a5c; }
.manager-page-modern .tw-badge-warning::before { background: #3574e8; }
.manager-page-modern .tw-badge-danger::before  { background: #d63a3a; }
.manager-page-modern .tw-badge-secondary::before { background: #7c8294; }
.manager-page-modern .tw-badge-primary::before { background: #4f6ef7; }
.manager-page-modern .tw-badge-info::before    { background: #0891b2; }
.manager-page-modern .tw-badge-gray::before    { background: #7c8294; }
.manager-page-modern .tw-badge-blue::before    { background: #3574e8; }
.manager-page-modern .tw-badge-green::before   { background: #1a9a5c; }
.manager-page-modern .tw-badge-purple::before  { background: #6c47d6; }
.manager-page-modern .tw-badge-orange::before  { background: #c07b1a; }
.manager-page-modern .tw-badge-red::before     { background: #d63a3a; }
.manager-page-modern .tw-badge-yellow::before  { background: #c07b1a; }
.manager-page-modern .tw-badge-pink::before    { background: #db2777; }
.manager-page-modern .tw-badge-indigo::before  { background: #4f46e5; }

/* Appointment-specific badge variants */
.manager-page-modern .tw-badge-upcoming::before  { background: #3574e8; }
.manager-page-modern .tw-badge-canceled::before  { background: #d63a3a; }
.manager-page-modern .tw-badge-past::before      { background: #7c8294; }

/* --- 5. Pagination (separated buttons) ----------------------------- */
.manager-page-modern .tw-pagination-nav {
    display: flex;
    gap: 4px;
    box-shadow: none;
}

.manager-page-modern .tw-pagination-link {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e4e6eb;
    margin-left: 0;
    background-color: #fff;
    color: #5f6474;
}

.manager-page-modern .tw-pagination-link:hover {
    background-color: #f3f4f7;
    border-color: #d0d4de;
}

.manager-page-modern .tw-pagination-link.active {
    background-color: #4f6ef7;
    color: #fff;
    border-color: #4f6ef7;
    font-weight: 600;
}

.manager-page-modern .tw-pagination-link.active:hover {
    background-color: #3d5ce5;
    color: #fff;
}

.manager-page-modern .tw-pagination-disabled {
    opacity: 0.35;
}

.manager-page-modern .tw-pagination-ellipsis {
    min-width: 32px;
    height: 32px;
    border: none;
    color: #9298a8;
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.manager-page-modern .tw-pagination-info {
    font-size: 13px;
    color: #9298a8;
}

/* Remove connected-group radius overrides */
.manager-page-modern .tw-pagination-nav .tw-pagination-link:first-child,
.manager-page-modern .tw-pagination-nav .tw-pagination-arrow:first-child {
    border-radius: 6px;
    margin-left: 0;
}

.manager-page-modern .tw-pagination-nav .tw-pagination-link:last-child,
.manager-page-modern .tw-pagination-nav .tw-pagination-arrow:last-child {
    border-radius: 6px;
}

/* --- 6. Filter Cards (tighter grid) -------------------------------- */
.manager-page-modern .tw-filter-cards-grid {
    gap: 14px;
}

.manager-page-modern .tw-filter-card {
    padding: 14px 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    position: relative;
}

.manager-page-modern .tw-filter-card.active {
    border-color: #4f6ef7;
    box-shadow: 0 0 0 1px #4f6ef7, 0 2px 8px rgba(79, 110, 247, 0.12);
}

.manager-page-modern .tw-filter-card.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #4f6ef7;
    border-radius: 8px 0 0 8px;
}

.manager-page-modern .tw-filter-card-create {
    min-height: 68px;
    border-radius: 8px;
}

/* --- 6b. Filter cards — collapsible on desktop (modern only) ------ */
.manager-page-modern .tw-filter-cards-section .mobile-collapse-trigger {
    pointer-events: auto;
    cursor: pointer;
}
.manager-page-modern .tw-filter-cards-section .tw-collapse-icon {
    display: block !important;
}
.manager-page-modern .tw-filter-cards-section .mobile-collapse-content.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
}

/* --- 6d. Inline save-filter button -------------------------------- */
.manager-page-modern .tw-save-filter-inline-btn {
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #4f6ef7;
    background: #eef1fe;
    border: 1px solid #dde3fc;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.manager-page-modern .tw-save-filter-inline-btn:hover {
    background: #dde3fc;
}

/* --- 7. Responsive Overrides --------------------------------------- */
@media (max-width: 768px) {
    .manager-page-modern .tw-filter-bar {
        padding: 0 0 10px 0;
    }

    .manager-page-modern .tw-filter-bar .tw-search-bar,
    .manager-page-modern .tw-filter-bar .tw-search-bar:focus-within {
        width: 100%;
        max-width: none;
    }

    .manager-page-modern .tw-filter-bar-tabs {
        width: 100%;
        margin-left: 0;
    }

    .manager-page-modern .tw-filter-bar .tw-filter-tab {
        flex: 1;
        justify-content: center;
    }

    /* Disable row animation on mobile */
    .manager-page-modern .tw-table-body tr {
        animation: none;
    }
}

@media (max-width: 1024px) {
    .manager-page-modern .tw-filter-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

/* --- 8. Table Header Sort Buttons ---------------------------------- */
.manager-page-modern .tw-sort-button {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    transition: color 120ms ease;
}

.manager-page-modern .tw-sort-button:hover {
    color: #4f6ef7;
}

.manager-page-modern .tw-sort-icon {
    font-size: 10px;
    margin-left: 3px;
    opacity: 0.5;
    transition: opacity 120ms ease;
}

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

/* --- 9. Empty State ------------------------------------------------ */
.manager-page-modern .tw-table-body td[colspan] {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #9298a8;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.1px;
}

/* --- 10. Checkbox Refinement --------------------------------------- */
.manager-page-modern .tw-checkbox {
    accent-color: #4f6ef7;
    width: 15px;
    height: 15px;
    cursor: pointer;
    border-radius: 3px;
}

/* --- 11. Blended Header Content z-index fix ----------------------- */
.manager-page-modern .tw-page-header-blended .tw-page-header-content {
    position: relative;
    z-index: 1;
}

/* ── End Concept G Component Overrides ──────────────────────────────── */

/* Break modern variant out of Bootstrap .container constraint */
.container.tw-main-container:has(> .manager-page-modern),
.container.tw-main-container:has(> .dashboard-page-modern) {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Full-bleed breakout for blended header inside content-wrapper > container */
.manager-header-bleed {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding-left: calc(50vw - 50%);
    padding-right: calc(50vw - 50%);
}

/* Bulk action bar */
.tw-bulk-bar {
    display: none;
    background: #16171d;
    border-radius: 12px;
    padding: 10px 18px;
    margin-bottom: 16px;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 13px;
    animation: tw-bulk-in 200ms ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.tw-bulk-bar.visible {
    display: flex;
}

@keyframes tw-bulk-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tw-bulk-bar-count {
    font-weight: 600;
    margin-right: 4px;
}

.tw-bulk-bar-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
}

.tw-bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 160ms ease;
}

.tw-bulk-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tw-bulk-btn.danger:hover {
    background: #d63a3a;
    border-color: #d63a3a;
}

.tw-bulk-bar-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    cursor: pointer;
    transition: all 160ms ease;
    background: none;
    border: none;
}

.tw-bulk-bar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Checkbox column for bulk selection */
.col-check {
    width: 40px;
    text-align: center;
}

.row-check {
    width: 16px;
    height: 16px;
    accent-color: #4f6ef7;
    cursor: pointer;
}

/* Selected row highlight */
.table tbody tr.is-selected {
    background: #eef1fe;
}

/* Responsive blended header */
@media (max-width: 640px) {
    .tw-page-header-blended .tw-page-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .tw-page-header-blended .tw-page-header-actions {
        width: 100%;
    }
}

/* === Generic Unified Header Wrapper === */
/* Two-tier header: dark gradient top + white action bar bottom, shared shadow */
.tw-unified-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);
    margin-bottom: 1.5rem;
    overflow: visible;
}

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

/* If header is the last child (no action bar), restore full radius */
.tw-unified-header .tw-page-header:last-child {
    border-radius: 0.5rem;
}

/* Generic Action Bar - white bar below header */
.tw-unified-action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0 0 0.5rem 0.5rem;
}

.tw-unified-action-bar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-unified-action-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

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

/* Modern variant sub-header action bar */
.tw-modern-action-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}

.tw-modern-action-bar .tw-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 13px;
}

/* Full-width background but buttons aligned with header title */
.tw-modern-action-bar.manager-header-bleed {
    padding-left: calc(50vw - 50% + 1.5rem);
    padding-right: calc(50vw - 50% + 1.5rem);
}

/* Vertical separator between action button groups */
.tw-action-bar-separator {
    width: 1px;
    height: 20px;
    background: #d1d5db;
    margin: 0 0.25rem;
    flex-shrink: 0;
}

/* Push settings button to far right (manager pages have settings gear as last button) */
.tw-modern-action-bar .tw-action-btn:last-child {
    margin-left: auto;
}

/* Dashboard doesn't have a settings gear — disable the auto margin */
.dashboard-page-modern .tw-modern-action-bar .tw-action-btn:last-child {
    margin-left: 0;
}

/* Dashboard: align action bar buttons with body content (1400px centered) */
.dashboard-page-modern .tw-modern-action-bar.manager-header-bleed {
    padding-left: max(1.5rem, calc(50vw - 700px + 1.5rem));
    padding-right: max(1.5rem, calc(50vw - 700px + 1.5rem));
}

/* Dashboard content area — constrained width below flush header */
.tw-dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    position: relative; /* anchor for skeleton overlay */
}
@media (max-width: 768px) {
    .tw-dashboard-content { padding: 0.5rem; }
}

/* Hide manager-toolbar for modern pages (settings are in the modal) */
.manager-page-modern .manager-toolbar {
    display: none;
}

/* Settings modal sections */
.tw-settings-modal-section {
    margin-bottom: 0.75rem;
}

.tw-settings-modal-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* DEPRECATED 2026-03-02: Old floating-card dashboard header — replaced by dashboard-page-modern + tw-page-header-blended */
.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);
    margin-bottom: 1.5rem;
    overflow: visible;
}

.tw-dashboard-header-unified .tw-page-header {
    border-radius: 0.5rem 0.5rem 0 0;
    margin-bottom: 0;
    box-shadow: none;
}

.tw-dashboard-header-unified .tw-dashboard-quick-action-bar {
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: none;
    margin-bottom: 0;
    overflow: visible;
}

/* === 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:visited {
    color: #6a1b9a;
}

a:active {
    color: #004085;
}

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

.btn a:visited,
a.btn:visited,
button a:visited {
    color: inherit;
}

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

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

/* === 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 Tabs Wrapper — sits at end of row 1 */
.tw-filter-bar-tabs {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

/* Search bar grows to fill row 1 (default variant only) */
.manager-page-default .tw-filter-bar .tw-search-bar {
    flex: 1 1 auto;
    min-width: 200px;
    max-width: none;
}

/* Detail filters flow inline with tabs on desktop, wrap to next row only if needed */
.tw-filter-bar .manager-detail-filters-collapse .mobile-collapse-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

/* === Connected Button Group — Filter Bar Tabs === */
.tw-filter-bar .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-bar .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-bar .tw-filter-tab:focus {
    color: white;
    background-color: #1e293b;
    z-index: 2;
    outline: none;
}

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

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

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

/* First tab — rounded left */
.tw-filter-bar .tw-filter-tab:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

/* Middle tabs — no radius, left border */
.tw-filter-bar .tw-filter-tab:not(:first-child):not(:last-child) {
    border-radius: 0;
    border-left: 1px solid #cbd5e1;
}

.tw-filter-bar .tw-filter-tab:not(:first-child):not(:last-child):hover,
.tw-filter-bar .tw-filter-tab:not(:first-child):not(:last-child):focus,
.tw-filter-bar .tw-filter-tab:not(:first-child):not(:last-child).active {
    border-left: 1px solid #1e293b;
}

/* Last tab — rounded right, left border */
.tw-filter-bar .tw-filter-tab:last-child:not(:first-child) {
    border-radius: 0 0.375rem 0.375rem 0;
    border-left: 1px solid #cbd5e1;
}

.tw-filter-bar .tw-filter-tab:last-child:not(:first-child):hover,
.tw-filter-bar .tw-filter-tab:last-child:not(:first-child):focus,
.tw-filter-bar .tw-filter-tab:last-child:not(:first-child).active {
    border-left: 1px solid #1e293b;
}

/* Single tab — fully rounded */
.tw-filter-bar .tw-filter-tab:first-child:last-child {
    border-radius: 0.375rem;
}

/* 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-wrap: wrap;
        gap: 0.75rem;
    }

    .tw-filter-bar .tw-search-bar {
        flex: 1 1 100%;
        max-width: none;
    }

    .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;
    padding: 0;
    margin: 0;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: white;
    color: #374151;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .tw-action-btn {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.15rem;
    }
}

/* Ensure all action button icons are properly centered */
a.tw-action-btn {
    text-decoration: none;
}

.tw-action-btn i,
.tw-action-btn .fas,
.tw-action-btn .far,
.tw-action-btn .fab {
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.tw-action-btn svg {
    width: 1em;
    height: 1em;
    pointer-events: none;
}

.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-clickable {
    cursor: pointer;
}

.tw-row-clickable:hover {
    background-color: #eef2ff;
}

.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 === */
/* Tooltip display handled by JS portal system (style-guide.js) */
/* Direction classes (tw-tooltip-top/bottom/left/right) are read by JS, not CSS */
.tw-tooltip {
    cursor: default;
}

/* CSS pseudo-element tooltips disabled — JS portal system handles all tooltips */
.tw-tooltip::after,
.tw-tooltip::before {
    display: none !important;
}

/* Bootstrap tooltip deprecation markers removed 2026-03-22 (all tooltips use .tw-tooltip now) */

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

/* ===== Dashboard Page Loading Skeleton ===== */
.tw-dashboard-container {
    position: relative;
}

.tw-dashboard-skeleton-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--bs-body-bg, #f3f4f6);
    padding: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

.tw-dashboard-skeleton-overlay.tw-skeleton-hidden {
    opacity: 0;
}

.tw-skeleton-app-icon {
    display: none;
}

@media (max-width: 768px) {
    .tw-dashboard-skeleton-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        display: flex;
        flex-direction: column;
    }

    .tw-skeleton-app-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
    }

    .tw-skeleton-app-icon img {
        border-radius: 1.25rem;
        animation: tw-skeleton-pulse 1.8s ease-in-out infinite;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    }

    .tw-skeleton-shimmer-rows {
        display: none;
    }
}

@keyframes tw-skeleton-pulse {
    0%, 100% { opacity: 0.9; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.96); }
}

.tw-skeleton-block {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: tw-loading-shimmer 1.4s ease-in-out infinite;
    border-radius: 0.75rem;
}

/* 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 CSS removed 2026-03-22 (deprecated 2025-10-25) */

@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: 67px; /* Exact navbar height: 64px nav + 3px accent bar */
    min-height: 100vh;
}

/* Content Wrapper - Full Height Layout */
.content-wrapper {
    flex: 1 0 auto;
    padding-top: 1rem;
}

@media (max-width: 768px) {
    .content-wrapper {
        padding-top: 0.5rem;
    }
}

/* Zero out top padding for pages with flush/blended headers */
.content-wrapper:has(.manager-page-modern),
.content-wrapper:has(.dashboard-page-modern),
.content-wrapper:has(.fotoledger-page) {
    padding-top: 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;
}

@media (max-width: 768px) {
    .container.tw-main-container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* DEPRECATED 2026-03-02: Old dashboard container — replaced by dashboard-page-modern + tw-dashboard-content */
/* Dashboard Container */
.tw-dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    overflow: visible; /* Allow tooltips to overflow */
}

/* DEPRECATED 2026-03-02: Old action bar — replaced by tw-modern-action-bar manager-header-bleed */
/* 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;
}

@media (max-width: 768px) {
    .tw-dashboard-widget {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .tw-dashboard-widget-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .tw-dashboard-widget-title {
        font-size: 1rem;
        flex-wrap: wrap;
        line-height: 1.4;
    }

    .tw-tab-panel > .tw-dashboard-widget {
        margin-top: 0.75rem;
    }
}

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

/* Copy Info Widget — Mobile Card Layout */
@media (max-width: 768px) {
    /* Hide the fixed header table on mobile — labels come from card layout */
    .copy-info-header-table {
        display: none;
    }

    /* Stack rows as cards */
    .copy-info-body-table,
    .copy-info-body-table tbody,
    .copy-info-body-table tr,
    .copy-info-body-table td {
        display: block;
        width: 100% !important;
    }

    .copy-info-body-table tr {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        background: #fafafa;
    }

    .copy-info-body-table td {
        padding: 0.25rem 0 !important;
        border: none !important;
        text-align: left !important;
    }

    /* Label each cell with data-label */
    .copy-info-body-table td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 0.7rem;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.125rem;
    }

    /* Actions row — horizontal layout */
    .copy-info-body-table td.copy-info-col-actions {
        margin-top: 0.5rem;
        padding-top: 0.5rem !important;
        border-top: 1px solid #e5e7eb !important;
    }

    .copy-info-body-table td.copy-info-col-actions::before {
        display: none;
    }

    /* Bigger copy buttons for touch */
    .copy-info-table-container .tw-btn-sm {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.875rem !important;
    }

    /* Bigger action buttons in copy-info */
    .copy-info-table-container .tw-action-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.875rem;
    }

    /* Reduce scroll height since cards take more vertical space */
    .copy-info-body-scroll {
        max-height: 500px;
    }
}

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

/* --- Dashboard Calendar + Appointments Layout --- */
.tw-dashboard-calendar-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 992px) {
    .tw-dashboard-calendar-layout {
        grid-template-columns: 1fr;
    }
}

/* Calendar Widget */
.tw-calendar-widget {
    background: white;
    border-radius: 0.625rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    padding: 1.125rem 1.25rem;
    position: sticky;
    top: 1rem;
}

@media (max-width: 992px) {
    .tw-calendar-widget {
        position: static;
    }
}

.tw-calendar-widget-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 600;
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tw-calendar-widget-header i {
    color: #4f46e5;
    font-size: 0.9rem;
}

/* Month navigation bar */
.tw-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.tw-calendar-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background: white;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.75rem;
}

.tw-calendar-nav-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #374151;
}

.tw-calendar-nav-btn:active {
    transform: scale(0.94);
}

.tw-calendar-today-btn {
    font-size: 0.75rem;
    padding: 0.15rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}
.tw-calendar-today-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.tw-calendar-month-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: #111827;
    letter-spacing: -0.01em;
}

/* Calendar grid */
.tw-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.tw-calendar-day-name {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0 0.5rem;
}

/* Weekend day names (6th and 7th columns) get a subtle tint */
.tw-calendar-day-name:nth-child(6),
.tw-calendar-day-name:nth-child(7) {
    color: #c4b5fd;
}

.tw-calendar-day {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0;
    min-height: 2.25rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    cursor: default;
    transition: background 0.12s ease, transform 0.12s ease;
    -webkit-font-smoothing: antialiased;
}

/* Weekend days */
.tw-calendar-day:nth-child(7n+6),
.tw-calendar-day:nth-child(7n+7) {
    color: #6b7280;
}

.tw-calendar-day-other {
    color: #d1d5db;
}

.tw-calendar-day-other:nth-child(7n+6),
.tw-calendar-day-other:nth-child(7n+7) {
    color: #d1d5db;
}

/* Today indicator */
.tw-calendar-day-today {
    background: #4f46e5;
    color: white;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.35);
}

.tw-calendar-day-today .tw-calendar-day-dot {
    background: rgba(255,255,255,0.85);
}

/* Days with appointments */
.tw-calendar-day-has-appointment {
    cursor: pointer;
}

.tw-calendar-day-has-appointment:hover {
    background: #eef2ff;
    transform: scale(1.08);
}

.tw-calendar-day-today.tw-calendar-day-has-appointment:hover {
    background: #4338ca;
    transform: scale(1.08);
}

/* Appointment dot */
.tw-calendar-day-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #4f46e5;
    margin-top: 1px;
}

/* HTMX swap transition */
.tw-calendar-widget.htmx-swapping {
    opacity: 0.6;
    transition: opacity 0.1s ease;
}

/* Appointment list scroll-to highlight */
@keyframes tw-appointment-highlight {
    0% { background-color: #eef2ff; box-shadow: inset 3px 0 0 #4f46e5; }
    70% { background-color: #eef2ff; box-shadow: inset 3px 0 0 #4f46e5; }
    100% { background-color: transparent; box-shadow: none; }
}

.tw-appointment-highlight {
    animation: tw-appointment-highlight 2.5s ease-out;
}

/* Copy-inline pattern */
.tw-copy-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.tw-copy-inline-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    border: none;
    background: transparent;
    color: #d1d5db;
    cursor: pointer;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    transition: all 0.15s ease;
    opacity: 0;
    padding: 0;
    flex-shrink: 0;
}

tr:hover .tw-copy-inline-btn,
.tw-appointment-card:hover .tw-copy-inline-btn,
.tw-appointment-m2m-item:hover .tw-copy-inline-btn {
    opacity: 1;
}

.tw-copy-inline-btn:hover {
    background: #eef2ff;
    color: #4f46e5;
}

.tw-copy-inline-btn:active {
    transform: scale(0.9);
}

/* Appointment list widget */
.tw-appointment-list-widget {
    background: white;
    border-radius: 0.625rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    overflow: hidden;
}

.tw-appointment-list-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 600;
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tw-appointment-list-header i {
    color: #4f46e5;
    font-size: 0.9rem;
}

.tw-appointment-list-header .tw-badge {
    margin-left: auto;
    text-transform: none;
    letter-spacing: 0;
}

/* Appointment table */
.tw-appointment-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.tw-appointment-table thead th {
    background: #f9fafb;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.675rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
    text-align: left;
}

.tw-appointment-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.12s ease;
}

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

.tw-appointment-table tbody tr:hover {
    background: #fafbfc;
}

.tw-appointment-table td {
    padding: 0.75rem 1rem;
    vertical-align: top;
    color: #374151;
}

/* Date cell */
.tw-appointment-date-cell {
    white-space: nowrap;
    font-weight: 600;
    color: #111827;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.tw-appointment-date-cell .tw-appointment-weekday {
    display: block;
    font-size: 0.65rem;
    color: #4f46e5;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 1px;
}

.tw-appointment-time {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    font-weight: 400;
    margin-top: 2px;
}

.tw-appointment-client {
    font-weight: 500;
    color: #374151;
}

.tw-appointment-titel {
    color: #4b5563;
}

/* M2M pill items */
.tw-appointment-m2m-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.tw-appointment-m2m-item {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.125rem 0.5rem;
    background: #f3f4f6;
    border-radius: 1rem;
    font-size: 0.725rem;
    color: #4b5563;
    white-space: nowrap;
    transition: background 0.12s ease;
}

.tw-appointment-m2m-item:hover {
    background: #eef2ff;
}

/* Appointment sections (upcoming / past split) */
.tw-appointment-section {
    border-top: 1px solid #f3f4f6;
}

.tw-appointment-section:first-child {
    border-top: none;
}

.tw-appointment-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fafbfc;
    border-bottom: 1px solid #f3f4f6;
}

.tw-appointment-section-header i:first-child {
    font-size: 0.8rem;
}

.tw-appointment-section-upcoming .tw-appointment-section-header i:first-child {
    color: #059669;
}

.tw-appointment-section-past .tw-appointment-section-header i:first-child {
    color: #9ca3af;
}

.tw-appointment-section-header .tw-badge {
    text-transform: none;
    letter-spacing: 0;
}

.tw-appointment-section-header-toggle {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.tw-appointment-section-header-toggle:hover {
    background: #f3f4f6;
}

.tw-appointment-section-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    color: #9ca3af;
    transition: transform 0.25s ease;
}

.tw-appointment-section-past:not(.collapsed) .tw-appointment-section-chevron {
    transform: rotate(180deg);
}

.tw-appointment-section-past.collapsed .tw-appointment-section-body {
    display: none;
}

/* Past section rows: slightly muted */
.tw-appointment-section-past .tw-appointment-table tbody tr {
    opacity: 0.7;
}

.tw-appointment-section-past .tw-appointment-table tbody tr:hover {
    opacity: 1;
}

.tw-appointment-section-past .tw-mobile-card {
    opacity: 0.7;
}

/* Empty sub-section message */
.tw-appointment-section-empty {
    padding: 1rem 1.25rem;
    font-size: 0.8rem;
    color: #9ca3af;
    text-align: center;
}

.tw-appointment-section-empty i {
    margin-right: 0.25rem;
    color: #d1d5db;
}

/* Dashboard mobile cards — reuse standard tw-mobile-card system */
@media (max-width: 768px) {
    .tw-appointment-table-desktop {
        display: none;
    }

    .tw-dashboard-mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .tw-copy-inline-btn {
        opacity: 1;
    }
}

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

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

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

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

    .tw-dashboard-stat-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }

    .tw-dashboard-stat-label {
        font-size: 0.7rem;
    }

    .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: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-bottom: 2px solid #e5e7eb;
        gap: 0;
    }

    .tw-tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .tw-tab {
        flex-shrink: 0;
        border-bottom: 3px solid transparent;
        border-left: none;
        padding: 0.625rem 1rem;
        font-size: 0.813rem;
        white-space: nowrap;
        width: auto;
    }

    .tw-tab:hover {
        border-left-color: transparent;
        border-bottom-color: #bfdbfe;
    }

    .tw-tab.active {
        border-left-color: transparent;
        border-bottom-color: #3b82f6;
        background: transparent;
    }
}


/* === CONTACT ACCORDION (Progressive Disclosure) === */

.contact-accordion {
    padding: 16px 0;
}

.contact-accordion-section {
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 150ms ease;
}

.contact-accordion-section:hover {
    border-color: #4f6ef7;
}

.contact-accordion-section .acc-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    border: none;
    background: #ffffff;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 150ms ease;
}

.contact-accordion-section .acc-header:hover {
    background: #f9fafb;
}

.contact-accordion-section .acc-title {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

.contact-accordion-section .acc-title .acc-icon {
    font-size: 15px;
    color: #6b7280;
    width: 20px;
    text-align: center;
}

.contact-accordion-section .acc-chevron {
    width: 20px;
    height: 20px;
    color: #9ca3af;
    transition: transform 250ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-accordion-section.open .acc-chevron {
    transform: rotate(180deg);
}

.contact-accordion-section .acc-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 350ms ease;
}

.contact-accordion-section.open .acc-content {
    max-height: 2000px;
}

.contact-accordion-section .acc-content-inner {
    padding: 0 18px 18px;
}

/* Colored left borders per section */
.contact-accordion-section:nth-child(1) { border-left: 3px solid #4f6ef7; } /* Basisdaten - blue */
.contact-accordion-section:nth-child(2) { border-left: 3px solid #10b981; } /* Kontaktdaten - green */
.contact-accordion-section:nth-child(3) { border-left: 3px solid #f59e0b; } /* Adressen - amber */
.contact-accordion-section:nth-child(4) { border-left: 3px solid #8b5cf6; } /* Organisation - purple */
.contact-accordion-section:nth-child(5) { border-left: 3px solid #ec4899; } /* Finanzen - pink */
.contact-accordion-section:nth-child(6) { border-left: 3px solid #14b8a6; } /* Verknüpfungen - teal */
.contact-accordion-section:nth-child(7) { border-left: 3px solid #f97316; } /* Statistik - orange */

/* Contact type field visibility toggles */
/* Person mode: hide company expand button, show person-primary row */
.contact-accordion[data-contact-type="person"] .contact-type-company-expand,
.contact-accordion[data-contact-type="other"] .contact-type-company-expand { display: none !important; }

/* Company/department mode: hide person-primary row, show expand in company row */
.contact-accordion[data-contact-type="company"] .contact-type-person-primary,
.contact-accordion[data-contact-type="department"] .contact-type-person-primary { display: none !important; }

/* Motiv mode: hide person-primary, show company name as primary */
.contact-accordion[data-contact-type="motiv"] .contact-type-person-primary { display: none !important; }

/* In person/other mode, company name row styled as secondary (smaller) */
.contact-accordion[data-contact-type="person"] .contact-type-company-name-row,
.contact-accordion[data-contact-type="other"] .contact-type-company-name-row {
    order: 10;
}

/* Contact name details expand/collapse */
.contact-name-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 0.8rem;
}
.contact-name-expand-btn:hover,
.contact-name-expand-btn:focus-visible {
    border-color: #4f6ef7;
    color: #4f6ef7;
    background: #f0f4ff;
}
.contact-name-expand-btn.expanded {
    border-color: #4f6ef7;
    color: #4f6ef7;
}
.contact-name-expand-btn:focus-visible {
    outline: 2px solid #4f6ef7;
    outline-offset: 2px;
}

.contact-name-details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}
.contact-name-details-expanded {
    max-height: 500px;
    opacity: 1;
    overflow: visible;
}
.contact-name-details-inner {
    padding: 4px 0 8px;
}

/* Contact modal identity header */
.contact-modal-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.contact-modal-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.contact-modal-identity .modal-title {
    margin-bottom: 2px;
}

.contact-modal-identity .contact-meta-badges {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 2px;
}
.contact-header-description {
    font-size: 0.82rem;
    color: #6b7280;
    line-height: 1.3;
}
.contact-header-description:empty::after {
    content: attr(data-placeholder);
    font-style: italic;
    color: #9ca3af;
}
.contact-header-description-input {
    font-size: 0.82rem;
    color: #6b7280;
    border: 1px solid #4f6ef7;
    border-radius: 4px;
    padding: 2px 6px;
    background: #fff;
    width: 100%;
    max-width: 400px;
    outline: none;
}
.contact-header-description-input:focus {
    box-shadow: 0 0 0 2px rgba(79, 110, 247, 0.2);
}

/* Contact header editable title */
.contact-header-title-group {
    flex: 1;
    min-width: 0;
}
.contact-header-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.contact-header-title-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 350px;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}
.contact-header-title-display:hover {
    border-color: #d1d5db;
}
.contact-header-title-input {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    border: 1px solid #4f6ef7;
    border-radius: 4px;
    padding: 2px 6px;
    max-width: 400px;
    outline: none;
    background: #fff;
    flex: 1;
    min-width: 0;
}
.contact-header-title-input:focus {
    box-shadow: 0 0 0 2px rgba(79, 110, 247, 0.2);
}
.contact-header-title-edit,
.contact-header-title-regen {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
    flex-shrink: 0;
}
.contact-header-title-edit:hover,
.contact-header-title-regen:hover {
    color: #4f6ef7;
    background: #f0f4ff;
}
.contact-header-title-regen.spinning i {
    animation: contactTitleSpin 0.6s linear;
}
@keyframes contactTitleSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === Contact View Mode (label:value summaries) === */

/* View mode: show summary, hide form */
.contact-accordion-section[data-view-mode="true"] .acc-content { display: none; }
.contact-accordion-section[data-view-mode="true"].open .acc-view-summary {
    max-height: 500px;
    opacity: 1;
}
.contact-accordion-section[data-view-mode="true"] .acc-view-summary {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

/* Edit mode: show form, hide summary */
.contact-accordion-section[data-view-mode="false"] .acc-view-summary { display: none; }
/* Hide empty view summaries (no content rows inside) */
.acc-view-summary-inner:empty { display: none; }

/* Summary field styling */
.acc-view-summary-inner { padding: 4px 0 8px; }
.contact-view-row {
    display: flex;
    padding: 4px 18px;
    border-bottom: 1px solid #f3f4f6;
}
.contact-view-row:last-child { border-bottom: none; }
.contact-view-label {
    width: 120px;
    color: #6b7280;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.contact-view-value {
    font-size: 0.9rem;
    color: #1f2937;
}
.contact-view-empty {
    padding: 4px 18px;
    color: #9ca3af;
    font-size: 0.85rem;
    font-style: italic;
    margin: 0;
}

/* Accordion header actions (edit button + chevron) */
.acc-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: flex-end;
}
.acc-header-actions .acc-edit-btn,
.acc-header-actions .acc-add-btn {
    margin-right: auto;
}
.acc-edit-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.acc-edit-btn:hover {
    color: #4f6ef7;
    background: #f0f4ff;
}
.acc-add-btn {
    background: none;
    border: none;
    color: #4f6ef7;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.acc-add-btn:hover {
    background: #f0f4ff;
    color: #3b5ce4;
}
.acc-add-label {
    font-weight: 500;
}

/* Scrollable accordion body */
#contactForm-accordion-body {
    max-height: 70vh;
    overflow-y: auto;
}


/* === ITEM ACCORDION OVERRIDES === */
/* Override contact-accordion-section border colors when used inside .item-accordion wrapper */

/* Scrollable accordion body for item modal */
#itemForm-accordion-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* Template selectors area (Product + Discount side by side) */
.item-template-selectors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.item-template-selector {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 14px 16px;
    background: #fafbfc;
    transition: border-color 200ms ease;
}
.item-template-selector:focus-within {
    border-color: #4f6ef7;
    background: #fff;
}
.item-template-selector .profile-actions-row {
    margin-top: 8px;
}
.item-template-selector-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 4px;
    display: block;
}

/* Allgemein section: Always-Edit Flow (Concept A) */
/* Pricing fields: compact 5-column row, always editable */
.item-field-row-5 {
    display: grid;
    grid-template-columns: 140px 70px 1fr 100px 70px;
    gap: 8px;
    margin-bottom: 12px;
}

/* Total strip: horizontal bar with subtotal | discount | VAT | grand total */
.item-total-strip {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 0.8rem;
}
.item-total-strip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0 8px;
    position: relative;
}
.item-total-strip-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 2px;
    bottom: 2px;
    width: 1px;
    background: #e2e8f0;
}
.item-total-strip-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.item-total-strip-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
}
.item-total-strip-item.item-total-final .item-total-strip-value {
    color: #4f6ef7;
    font-size: 1rem;
}
.item-total-strip-item.item-total-discount .item-total-strip-value {
    color: #dc2626;
}

/* Section divider between pricing and secondary fields */
.item-section-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 14px 0;
}

@media (max-width: 600px) {
    .item-field-row-5 {
        grid-template-columns: 1fr 1fr;
    }
    .item-field-row-5 > :first-child {
        grid-column: 1 / -1;
    }
    .item-total-strip { flex-wrap: wrap; }
    .item-total-strip-item { min-width: 33%; padding: 4px 6px; }
}

/* Expense toggle switch */
.item-expense-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 6px;
}
.item-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.item-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.item-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #d1d5db;
    border-radius: 22px;
    transition: background-color 200ms ease;
}
.item-toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 200ms ease;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.item-toggle-switch input:checked + .item-toggle-slider {
    background-color: #4f6ef7;
}
.item-toggle-switch input:checked + .item-toggle-slider::before {
    transform: translateX(18px);
}
.item-toggle-label {
    font-size: 0.85rem;
    color: #374151;
}

/* Item-specific section border colors (4 sections, Die Presse conditional) */
.item-accordion .contact-accordion-section:nth-child(1) { border-left: 3px solid #4f6ef7; } /* Allgemein - blue */
.item-accordion .contact-accordion-section:nth-child(2) { border-left: 3px solid #f59e0b; } /* Die Presse - amber */
.item-accordion .contact-accordion-section:nth-child(3) { border-left: 3px solid #8b5cf6; } /* Verknüpfungen - purple */
.item-accordion .contact-accordion-section:nth-child(4) { border-left: 3px solid #ec4899; } /* Anhänge - pink */

/* When Die Presse addon is disabled, shift colors for sections 2-3 */
.item-accordion-no-presse .contact-accordion-section:nth-child(2) { border-left: 3px solid #8b5cf6; } /* Verknüpfungen takes purple */
.item-accordion-no-presse .contact-accordion-section:nth-child(3) { border-left: 3px solid #ec4899; } /* Anhänge takes pink */

/* Addon badge for Die Presse section header */
.acc-addon-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 3px;
    background: #fef3c7;
    color: #92400e;
    margin-left: 6px;
}

/* Item field compact rows */
.item-field-row-3 {
    display: grid;
    grid-template-columns: 120px 1fr 90px;
    gap: 10px;
}
.item-field-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Expense info tooltip styling */
.item-expense-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 4px;
}


/* === PRODUCT ACCORDION OVERRIDES === */
#productForm-accordion-body { max-height: 75vh; overflow-y: auto; }

.product-accordion .contact-accordion-section:nth-child(1) { border-left: 3px solid #4f6ef7; } /* Basic - blue */
.product-accordion .contact-accordion-section:nth-child(2) { border-left: 3px solid #10b981; } /* Pricing - green */
.product-accordion .contact-accordion-section:nth-child(3) { border-left: 3px solid #f59e0b; } /* Content - amber */
.product-accordion .contact-accordion-section:nth-child(4) { border-left: 3px solid #8b5cf6; } /* Settings - purple */

.product-accordion-modal .contact-modal-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}


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

/* Mobile: CRUD buttons become icon-only squares */
@media (max-width: 768px) {
    .btn-profile-action {
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0;  /* hides text */
    }
    .btn-profile-action i {
        margin-right: 0;
        font-size: 0.875rem;
    }
}


/* Email Template Selector Row - inline layout with CRUD buttons */
.email-tpl-selector-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.email-tpl-crud-btns {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* Squared icon-only CRUD buttons */
.email-tpl-crud-btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}

.email-tpl-crud-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.email-tpl-crud-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.email-tpl-crud-btn:focus {
    outline: none;
}

/* Override margin-right from .btn-profile-action i */
.email-tpl-crud-btn i {
    margin-right: 0;
}

@media (max-width: 576px) {
    .email-tpl-selector-row {
        flex-wrap: wrap;
    }
    .email-tpl-selector-row > select {
        flex: 1 1 100%;
        order: 1;
    }
    .email-tpl-selector-row > label {
        order: 0;
    }
    .email-tpl-crud-btns {
        order: 2;
    }
}

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

/* Spinner icon inside fixed-size action buttons */
.tw-action-btn[disabled] .fa-spinner { font-size: inherit; }

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

/* === MOBILE-ONLY COLLAPSE GROUPS === */
/* Desktop (>768px): always visible, trigger is plain header, no chevron */
.mobile-collapse-group .mobile-collapse-trigger {
    pointer-events: none;
}

.mobile-collapse-group .mobile-collapse-trigger .tw-collapse-icon {
    display: none;
}

.mobile-collapse-group .mobile-collapse-content {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
}

@media (max-width: 768px) {
    .mobile-collapse-group .mobile-collapse-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        pointer-events: auto;
        padding: 0.75rem 0;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 0.5rem;
    }

    .mobile-collapse-group .mobile-collapse-trigger .tw-collapse-icon {
        display: inline-block;
        transition: transform 0.3s ease;
        font-size: 1rem;
        color: #6b7280;
    }

    .mobile-collapse-group .mobile-collapse-trigger.expanded .tw-collapse-icon {
        transform: rotate(180deg);
    }

    .mobile-collapse-group .mobile-collapse-content {
        max-height: 0 !important;
        opacity: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    }

    .mobile-collapse-group .mobile-collapse-content.expanded {
        max-height: 10000px !important;
        opacity: 1 !important;
        overflow: visible !important;
        transition: max-height 0.5s ease-in, opacity 0.3s ease-in;
    }
}

/* Desktop: hide the detail filters collapse trigger (filters always visible inline) */
@media (min-width: 769px) {
    .manager-detail-filters-collapse .mobile-collapse-trigger {
        display: none;
    }
}

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

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

/* Tax Report Buchungen Link */
.tax-report-buchungen-link {
    color: #2563eb;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.tax-report-buchungen-link:hover {
    color: #1d4ed8;
    text-decoration-style: solid;
}

.tax-report-buchungen-link--card {
    color: inherit;
    text-decoration-color: currentColor;
}

.tax-report-buchungen-link--card:hover {
    color: #2563eb;
    text-decoration-color: #2563eb;
}

/* 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,
    .modern-nav-wrapper,
    .nav-accent-bar {
        display: none !important;
    }

    /* Hide modal containers and other UI chrome */
    #unified-modal-container,
    #modal {
        display: none !important;
    }

    /* Ensure content uses full page */
    body {
        margin: 0;
        padding: 0;
    }

    .content-wrapper,
    .tw-content-wrapper {
        padding: 0 !important;
        margin: 0 !important;
    }

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

/* ============================================
   EXPENSE FORM STYLES
   Centralized from expense_detail_edit_modal.html
   and expense_tabbed_unified.html inline styles
   ============================================ */

/* Expense field grid (2-column responsive) */
.expense-field-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (max-width: 768px) {
    .expense-field-grid { grid-template-columns: 1fr; }
}

.expense-field-full {
    grid-column: span 2;
}
@media (max-width: 768px) {
    .expense-field-full { grid-column: span 1; }
}

/* 3-column flag row */
.expense-field-trio {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    grid-column: span 2;
}
@media (max-width: 768px) {
    .expense-field-trio { grid-template-columns: 1fr; grid-column: span 1; }
}

/* Scoped form input styling */
.expense-form .form-control,
.expense-form .form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.expense-form .form-control:focus,
.expense-form .form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.expense-form .form-control:disabled,
.expense-form .form-select:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}
.expense-form .form-check-input {
    height: 1rem;
    width: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    accent-color: #3b82f6;
}

/* Financial summary cards (view mode) */
.expense-summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    grid-column: span 2;
}
@media (max-width: 768px) {
    .expense-summary-row { grid-template-columns: 1fr; grid-column: span 1; }
}
.expense-summary-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 1rem;
}
.expense-summary-card h6 {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}
.expense-summary-card p {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

/* Section headers within expense tabs */
.expense-section-header {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #d1d5db;
}
.expense-section-header:first-child {
    margin-top: 0;
}

/* Overview tab cards (modal) */
.info-card-overview {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.info-card-overview .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
}
.info-card-overview .card-body {
    padding: 1rem;
}

/* Field rows in overview cards */
.field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.field-row:last-child { border-bottom: none; }
.field-row.flex-col { flex-direction: column; align-items: flex-start; }
.field-row .label { color: #6b7280; font-size: 0.875rem; font-weight: 500; }
.field-row .value { color: #111827; font-size: 0.875rem; font-weight: 600; }
.field-row .value.amount { font-size: 1.125rem; }
.field-row .value.amount.negative { color: #dc2626; }
.field-row .value.amount.positive { color: #16a34a; }

/* Connected data sections */
.connected-section {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}
.connected-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}
.connected-item:last-child { margin-bottom: 0; }
.connected-item .item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.items-table {
    width: 100%;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    border-collapse: collapse;
}
.items-table th {
    background: #f3f4f6;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}
.items-table td {
    padding: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Progress bar */
.progress-bar-expense {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill-expense {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transition: width 0.3s ease;
}

/* Backwards compatibility aliases */
.modal-field-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (max-width: 768px) {
    .modal-field-grid { grid-template-columns: 1fr; }
}
.field-full-width {
    grid-column: span 2;
}
@media (max-width: 768px) {
    .field-full-width { grid-column: span 1; }
}

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

/* === SYNC CENTER MODERN LAYOUT === */

/* Break out of container constraint for blended header */
.container.tw-main-container:has(> .sync-center-page-modern) {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Content padding below header */
.sync-center-page-modern .tw-filter-bar,
.sync-center-page-modern #tab-content-area,
.sync-center-page-modern > .tw-card {
    margin-left: 1.5rem;
    margin-right: 1.5rem;
}

/* Dropdown z-index fix inside blended header */
.sync-center-page-modern .tw-page-header-blended .tw-dropdown {
    z-index: 10;
}

.sync-center-page-modern .tw-page-header-blended .tw-dropdown-menu {
    color: #374151;
}

/* Sync card hover effect */
.sync-center-page-modern .sync-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Fixed positioning for bulk bar in sync center */
.sync-bulk-bar-fixed {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    border-radius: 12px;
}

/* Colored badge variants for filter tabs */
.tw-filter-tab-badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.tw-filter-tab-badge-warning {
    background: #ffedd5;
    color: #c2410c;
}

.tw-filter-tab.active .tw-filter-tab-badge-danger {
    background: #fecaca;
    color: #991b1b;
}

.tw-filter-tab.active .tw-filter-tab-badge-warning {
    background: #fed7aa;
    color: #9a3412;
}

/* === SYNC CENTER SPLIT VIEW (Bold Split View) === */

/* Stats strip */
.tw-sync-stats-strip {
    display: flex;
    gap: 0;
    background: #1e293b;
    border-bottom: 2px solid #e11d48;
    margin-left: 1.5rem;
    margin-right: 1.5rem;
    border-radius: 8px 8px 0 0;
    margin-top: 1rem;
}
.tw-sync-stat-item {
    flex: 1;
    padding: 12px 20px;
    text-align: center;
    border-right: 1px solid rgba(255,255,255,.06);
}
.tw-sync-stat-item:last-child { border-right: none; }
.tw-sync-stat-num {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
}
.tw-sync-stat-num.green { color: #10b981; }
.tw-sync-stat-num.orange { color: #f59e0b; }
.tw-sync-stat-num.red { color: #ef4444; }
.tw-sync-stat-num.blue { color: #0ea5e9; }
.tw-sync-stat-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
    font-weight: 600;
    margin-top: 2px;
}

/* Split layout container */
.tw-sync-split {
    display: grid;
    grid-template-columns: 1fr 360px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    min-height: 480px;
    margin-left: 1.5rem;
    margin-right: 1.5rem;
}

/* Main panel (contact list) */
.tw-sync-main {
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    margin: 0 !important;
}

/* Override the default content area margins when inside split */
.tw-sync-split .tw-sync-main #contacts-list,
.tw-sync-split .tw-sync-main .tw-flex {
    margin-left: 0;
    margin-right: 0;
}

/* Contact rows */
.tw-sync-row {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 12px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 150ms ease;
    cursor: pointer;
}
.tw-sync-row:hover { background: #fafbfc; }
.tw-sync-row-selected {
    background: #fff1f2 !important;
    border-left: 3px solid #e11d48;
    padding-left: 17px;
}

/* Status dot */
.tw-sync-row-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.tw-sync-row-status-synced { background: #10b981; }
.tw-sync-row-status-conflict { background: #f59e0b; }
.tw-sync-row-status-failed { background: #ef4444; }
.tw-sync-row-status-pending { background: #3b82f6; }
.tw-sync-row-status-unlinked { background: #d1d5db; }
.tw-sync-row-status-mixed { background: #8b5cf6; }

/* Row info */
.tw-sync-row-info { flex: 1; min-width: 0; }
.tw-sync-row-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tw-sync-row-sub {
    font-size: 12px;
    color: #64748b;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tw-sync-row-sub i { font-size: 11px; margin-right: 3px; }

/* Row badge */
.tw-sync-row-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 5px;
    flex-shrink: 0;
}
.tw-sync-row-badge-synced { background: #ecfdf5; color: #059669; }
.tw-sync-row-badge-conflict { background: #fffbeb; color: #d97706; }
.tw-sync-row-badge-failed { background: #fef2f2; color: #dc2626; }
.tw-sync-row-badge-pending { background: #eff6ff; color: #2563eb; }
.tw-sync-row-badge-unlinked { background: #f0f2f5; color: #64748b; }
.tw-sync-row-badge-mixed { background: #f5f3ff; color: #7c3aed; }

/* Row hover actions */
.tw-sync-row-actions {
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 150ms ease;
    flex-shrink: 0;
}
.tw-sync-row:hover .tw-sync-row-actions,
.tw-sync-row-selected .tw-sync-row-actions { opacity: 1; }
.tw-sync-row-action {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #64748b;
    transition: all 150ms ease;
    border: none;
    background: transparent;
    cursor: pointer;
}
.tw-sync-row-action:hover { background: #f0f2f5; color: #1e293b; }
.tw-sync-row-action.primary:hover { background: #fff1f2; color: #e11d48; }

/* Drag-drop on rows */
.tw-sync-row[draggable="true"] { cursor: grab; }
.tw-sync-row[draggable="true"]:active { cursor: grabbing; }
.tw-sync-row.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.tw-sync-row.drop-target {
    outline: 2px dashed #2563eb;
    outline-offset: -2px;
    background-color: rgba(37,99,235,0.05) !important;
}
.tw-sync-row.drop-invalid {
    outline: 2px dashed #dc3545;
    outline-offset: -2px;
    background-color: rgba(220,53,69,0.05) !important;
}

/* Sidebar panel */
.tw-sync-sidebar {
    background: #fafbfc;
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
    margin: 0 !important;
}

/* Sidebar empty state */
.tw-sync-side-empty {
    text-align: center;
    padding: 80px 20px;
    color: #94a3b8;
}
.tw-sync-side-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
    opacity: .4;
}
.tw-sync-side-empty p { font-size: 13px; }

/* Sidebar detail content */
.tw-sync-side-detail { padding: 24px; }
.tw-sync-side-avatar {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 14px;
}
.tw-sync-side-avatar-person { background: linear-gradient(135deg, #e11d48, #be185d); }
.tw-sync-side-avatar-company { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.tw-sync-side-name {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}
.tw-sync-side-type {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 16px;
}
.tw-sync-side-type i { margin-right: 4px; }

/* Sidebar sections */
.tw-sync-side-section { margin-bottom: 18px; }
.tw-sync-side-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 8px;
}
.tw-sync-side-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: #1e293b;
}
.tw-sync-side-field i {
    width: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    margin-top: 2px;
}

/* Sidebar sync status block */
.tw-sync-side-sync-status {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 8px;
}
.tw-sync-side-sync-status.warning-border { border-color: #f59e0b; }
.tw-sync-side-sync-status.danger-border { border-color: #ef4444; }
.tw-sync-side-sync-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    padding: 4px 0;
    color: #1e293b;
}
.tw-sync-side-sync-row i { width: 16px; text-align: center; color: #94a3b8; }
.tw-sync-side-sync-row .synced-icon { color: #10b981; }
.tw-sync-side-sync-row .conflict-icon { color: #f59e0b; }
.tw-sync-side-sync-row .failed-icon { color: #ef4444; }
.tw-sync-side-sync-row .pending-icon { color: #3b82f6; }

/* Sidebar actions */
.tw-sync-side-actions {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.tw-sync-side-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #1e293b;
    transition: all 150ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}
.tw-sync-side-btn:hover {
    border-color: #e11d48;
    background: #fff1f2;
    color: #e11d48;
}
.tw-sync-side-btn.primary {
    background: #e11d48;
    border-color: #e11d48;
    color: #fff;
}
.tw-sync-side-btn.primary:hover { background: #be123c; }
.tw-sync-side-btn.warning {
    border-color: #f59e0b;
    color: #d97706;
}
.tw-sync-side-btn.warning:hover { background: #fffbeb; }
.tw-sync-side-btn.danger {
    border-color: #ef4444;
    color: #dc2626;
}
.tw-sync-side-btn.danger:hover { background: #fef2f2; }

/* Sidebar candidates container */
.tw-sync-side-candidates { margin-top: 16px; }

/* Responsive: hide sidebar on narrow screens */
@media (max-width: 900px) {
    .tw-sync-split { grid-template-columns: 1fr; }
    .tw-sync-sidebar { display: none; }
    .tw-sync-sidebar.mobile-visible {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 360px;
        max-width: 90vw;
        z-index: 45;
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
        background: #fafbfc;
    }
    .tw-sync-sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 44;
    }
    .tw-sync-stats-strip {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        flex-wrap: wrap;
    }
    .tw-sync-stat-item { min-width: 80px; }
    .tw-sync-split {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
}

/* Override default tab-content-area margin when inside split */
.sync-center-page-modern .tw-sync-split #tab-content-area {
    margin-left: 0;
    margin-right: 0;
}

/* === END SYNC CENTER SPLIT VIEW === */

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

/* Email processing table — no horizontal scroll needed, allow tooltip overflow */
.email-processing-table.tw-table-responsive {
    overflow: visible;
}

/* === EMAIL PROCESSING TABLE - MOBILE === */
@media (max-width: 768px) {
    .email-processing-table table,
    .email-processing-table thead,
    .email-processing-table tbody,
    .email-processing-table tr,
    .email-processing-table td,
    .email-processing-table th {
        display: block;
        width: 100%;
    }

    .email-processing-table thead {
        display: none;
    }

    .email-processing-table tr {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        background: white;
    }

    .email-processing-table td {
        padding: 0.25rem 0;
        border: none;
        text-align: left;
    }

    .email-processing-table td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 0.7rem;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.125rem;
    }

    /* Actions row — wrap buttons, hide text labels */
    .email-processing-table .email-col-actions {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid #e5e7eb;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .email-processing-table .email-col-actions::before {
        display: none;
    }

    /* Ensure buttons have proper touch targets */
    .email-processing-table .tw-action-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    /* Subject truncation — allow wrapping on mobile */
    .email-processing-table .email-col-subject {
        word-break: break-word;
    }
}

/* AI Processing Overlay — fullscreen dimmed backdrop with centered card */
.ai-processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ai-processing-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ai-processing-overlay-card {
    background: var(--card-bg, #fff);
    border-radius: 1rem;
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.85);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 400px;
    width: 90%;
}

.ai-processing-overlay.active .ai-processing-overlay-card {
    transform: scale(1);
}

.ai-processing-overlay-icon {
    font-size: 2.5rem;
    color: var(--primary-color, #6366f1);
    margin-bottom: 1rem;
    animation: ai-pulse 2s ease-in-out infinite;
}

.ai-processing-overlay-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color, #1e293b);
    margin-bottom: 1rem;
}

.ai-processing-overlay-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted, #64748b);
    margin: 0.75rem 0 0;
}

.ai-processing-overlay-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
}

.ai-processing-overlay-dots span {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--primary-color, #6366f1);
    animation: ai-dot-bounce 1.4s ease-in-out infinite;
}

.ai-processing-overlay-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.ai-processing-overlay-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes ai-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes ai-dot-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-0.5rem); }
}


/* ==========================================================================
   14. AUTH PAGES (Login, Register, Password Reset, Landing)
   ========================================================================== */

/* Auth page wrapper — vertically centered layout */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 3rem 1rem 2rem;
}

/* Puggle brand logo above card */
.auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo-text {
    font-family: var(--theme-logo-font, 'Doto', sans-serif);
    font-weight: var(--theme-logo-font-weight, 800);
    font-size: 2.5rem;
    letter-spacing: 0.02em;
    background: var(--theme-logo-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Auth card — clean white */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.auth-card-header {
    padding: 1.25rem 1.5rem;
    background: #1f2937;
    border-bottom: none;
    text-align: center;
}

.auth-card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
}

.auth-card-header h3 i {
    color: rgba(255, 255, 255, 0.7);
}

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

.auth-card-footer {
    padding: 1rem 1.5rem;
    background: #1f2937;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

.auth-card-footer a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
}

.auth-card-footer a:hover {
    text-decoration: underline;
    color: #ffffff;
}

.auth-card-footer .auth-btn-secondary {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

.auth-card-footer .auth-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}

.auth-card-footer .auth-divider {
    border-top-color: rgba(255, 255, 255, 0.15);
}

.auth-card-footer .auth-text-muted {
    color: rgba(255, 255, 255, 0.5);
}

/* Auth form groups */
.auth-form-group {
    margin-bottom: 1rem;
}

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

/* Auth inputs — clean white */
.auth-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #1f2937;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: var(--theme-input-focus-border);
    box-shadow: 0 0 0 3px rgba(var(--theme-input-focus-border), 0.15);
}

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

/* Auth primary button — gradient bg */
.auth-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--theme-brand-gradient);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    text-decoration: none;
}

.auth-btn-primary:hover {
    opacity: 0.9;
    color: #ffffff;
    text-decoration: none;
}

.auth-btn-primary:active {
    transform: scale(0.98);
}

/* Auth secondary/outline button */
.auth-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--theme-brand-primary);
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
}

.auth-btn-secondary:hover {
    background: #f9fafb;
    border-color: var(--theme-brand-primary);
    color: var(--theme-brand-primary);
    text-decoration: none;
}

/* Auth links — themed color */
.auth-link {
    color: var(--theme-brand-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.auth-link:hover {
    opacity: 0.8;
    color: var(--theme-brand-primary);
    text-decoration: underline;
}

/* Auth divider */
.auth-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1.25rem 0;
}

/* Auth alerts — themed */
.auth-alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.auth-alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.auth-alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.auth-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

/* Auth text helpers */
.auth-text-muted {
    color: #6b7280;
    font-size: 0.8125rem;
}

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

.auth-text-danger {
    color: var(--theme-danger, #ef4444);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* Auth icon color in card context */
.auth-card .auth-icon-accent {
    color: var(--theme-brand-primary);
}

/* Auth steps list for info pages */
.auth-steps {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    text-align: left;
}

.auth-steps li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.auth-steps li i {
    color: var(--theme-brand-primary);
    width: 1.25rem;
    text-align: center;
}

/* Auth success icon (large) */
.auth-success-icon {
    color: var(--theme-success, #22c55e);
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

/* Auth password requirements */
.auth-password-hints {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.auth-password-hints ul {
    padding-left: 1.25rem;
    margin: 0.375rem 0 0;
}

.auth-password-hints li {
    margin-bottom: 0.125rem;
}

/* Auth footer (links below card) */
.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-page {
        padding: 2rem 0.75rem 1.5rem;
    }

    .auth-logo-text {
        font-size: 2rem;
    }

    .auth-card-body {
        padding: 1.25rem;
    }
}

/* Auth pages are always white-mode — no per-theme overrides needed */


/* ==========================================================================
   15. ADMIN PANEL COMPONENTS
   Always light — like auth pages, no per-theme overrides needed.
   ========================================================================== */

/* --- Page Header --- */
.admin-page-header {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.admin-page-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.admin-page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.3;
}

.admin-page-header p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0.125rem 0 0 0;
}

/* --- Stat Cards --- */
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
    .admin-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .admin-stats-row {
        grid-template-columns: 1fr;
    }
}

.admin-stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
}

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

.admin-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.625rem;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.admin-stat-icon.icon-brand {
    background: #ede9fe;
    color: #7c3aed;
}

.admin-stat-icon.icon-success {
    background: #dcfce7;
    color: #16a34a;
}

.admin-stat-icon.icon-warning {
    background: #fef3c7;
    color: #d97706;
}

.admin-stat-icon.icon-info {
    background: #dbeafe;
    color: #2563eb;
}

.admin-stat-info {
    display: flex;
    flex-direction: column;
}

.admin-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
}

.admin-stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.125rem;
}

/* --- Filter Bar --- */
.admin-filter-bar {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.admin-filter-bar label {
    color: #374151;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.admin-filter-bar .form-select,
.admin-filter-bar .form-control {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-filter-bar .form-select:focus,
.admin-filter-bar .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    outline: none;
}

.admin-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1.25rem;
    background: #6366f1;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.admin-filter-btn:hover {
    background: #4f46e5;
}

/* --- Table Card --- */
.admin-table-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.admin-table-card-header {
    padding: 0.875rem 1.5rem;
    background: #1f2937;
    display: flex;
    align-items: center;
}

.admin-table-card-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #ffffff;
}

.admin-table-card-header h5 i {
    color: rgba(255, 255, 255, 0.6);
    margin-right: 0.5rem;
}

.admin-table-card-body {
    padding: 0;
}

/* --- Admin Table --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    color: #374151;
    font-size: 0.875rem;
}

.admin-table thead th {
    padding: 0.625rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

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

.admin-table tbody tr {
    transition: background-color 0.1s ease;
}

.admin-table tbody tr:hover {
    background: #f9fafb;
}

.admin-table .text-muted {
    color: #9ca3af !important;
}

.admin-table .text-end {
    text-align: right;
}

.admin-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Admin Badges --- */
.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.admin-badge-superuser {
    background: #fef2f2;
    color: #dc2626;
}

.admin-badge-staff {
    background: #fffbeb;
    color: #d97706;
}

.admin-badge-user {
    background: #f3f4f6;
    color: #6b7280;
}

.admin-badge-active {
    background: #f0fdf4;
    color: #16a34a;
}

.admin-badge-blocked {
    background: #fef2f2;
    color: #dc2626;
}

.admin-badge-verified {
    color: #16a34a;
}

.admin-badge-unverified {
    color: #d1d5db;
}

/* --- Action Buttons --- */
.admin-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.875rem;
    height: 1.875rem;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background: #ffffff;
    color: #6b7280;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.admin-action-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #f5f3ff;
}

.admin-action-btn.action-block:hover {
    color: #d97706;
    border-color: #fbbf24;
    background: #fffbeb;
}

.admin-action-btn.action-unblock:hover {
    color: #16a34a;
    border-color: #4ade80;
    background: #f0fdf4;
}

.admin-action-btn.action-export:hover {
    color: #2563eb;
    border-color: #60a5fa;
    background: #eff6ff;
}

.admin-action-btn.action-delete:hover {
    color: #dc2626;
    border-color: #f87171;
    background: #fef2f2;
}

.admin-action-group {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
}

/* --- Role Select --- */
.admin-role-select {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    min-width: 110px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.admin-role-select:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

/* --- Empty State --- */
.admin-table tbody .admin-empty-row td {
    text-align: center;
    padding: 2rem 1rem;
    color: #9ca3af;
    font-style: italic;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .admin-page-header {
        padding: 1rem 1.25rem;
        gap: 1rem;
    }
    .admin-page-header h1 {
        font-size: 1.25rem;
    }
}

/* ============================================================
   MANAGER PAGES — MOBILE UX POLISH (≤ 768px)
   Targets all ConfigurableManagerMixin list/manager pages.
   Placed last so later-position wins at equal specificity.
   ============================================================ */
@media (max-width: 768px) {

    /* --- 1. Horizontal scroll on table --- */
    .tw-list-view-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tw-list-view-table .tw-table {
        min-width: 500px;
    }

    /* --- 2. Reduce container padding (gain ~16px) --- */
    .main-container.tw-px-4 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .tw-filter-bar {
        padding: 0.75rem;
    }
    .tw-list-view-header {
        padding: 0.5rem 0.75rem;
    }
    .tw-page-header {
        padding: 0.75rem;
    }

    /* --- 3. Shrink checkbox column (48 → 32px) --- */
    .tw-table-checkbox {
        width: 2rem;
        padding: 0.25rem;
    }
    .tw-table-checkbox .tw-checkbox {
        width: 0.875rem;
        height: 0.875rem;
    }

    /* --- 4. Shrink actions column & buttons --- */
    .tw-table-actions {
        width: auto;
        min-width: 0;
        white-space: nowrap;
    }
    .tw-action-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.8rem;
    }
    .tw-action-buttons {
        gap: 2px;
    }

    /* --- 5. Icon-only toolbar buttons --- */
    .manager-toolbar-right .btn {
        font-size: 0;
        padding: 0.375rem;
        min-width: 2.25rem;
        min-height: 2.25rem;
    }
    .manager-toolbar-right .btn > i {
        font-size: 0.875rem;
        margin-right: 0 !important;
    }
    .manager-toolbar {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    .preset-selector-label {
        font-size: 0;
    }
    .preset-selector-label > i {
        font-size: 0.875rem;
    }

    /* --- 6. Icon-only create button in header --- */
    .tw-page-header-actions .tw-btn {
        font-size: 0;
        padding: 0.5rem;
        min-width: 2.5rem;
        min-height: 2.5rem;
    }
    .tw-page-header-actions .tw-btn > i {
        font-size: 1rem;
        margin-right: 0 !important;
    }
    .tw-page-header-actions .tw-btn > span {
        display: none;
    }

    /* --- 7. Date filter labels visible, inputs full width --- */
    .tw-filter-field-group .tw-filter-date-input {
        width: auto;
        flex: 1;
    }

    /* --- 8. Smaller table text & padding --- */
    .tw-table {
        font-size: 0.75rem;
    }
    .tw-table-header th {
        font-size: 0.625rem;
        padding: 0.375rem;
    }
    .tw-table-cell {
        padding: 0.375rem;
        font-size: 0.75rem;
    }
    .tw-truncate-text {
        max-width: 80px;
    }
    .tw-truncate-email {
        max-width: 70px;
    }
    .tw-truncate-date {
        max-width: 60px;
    }

    /* --- 9. Polish — filter tabs, bulk actions, filter cards --- */
    .tw-filter-bar .tw-filter-tab {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }
    .tw-filter-bar .tw-filter-tab > i {
        display: none;
    }
    .tw-bulk-actions {
        flex-wrap: wrap;
        gap: 0.375rem;
    }
    .tw-bulk-actions .tw-btn-sm {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }
    #noSelectionText {
        font-size: 0.75rem;
    }
    .tw-filter-cards-section {
        margin-top: 0.5rem;
    }
    .tw-filter-cards-grid {
        gap: 0.5rem;
    }
    .tw-filter-card {
        padding: 0.75rem;
    }

    /* --- 10. Mobile: Collapse saved filter cards --- */
    .tw-filter-cards-section .mobile-collapse-trigger {
        padding: 0.5rem 0;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 0.25rem;
    }
    .tw-filter-cards-section .mobile-collapse-trigger .tw-filter-cards-section-title {
        margin-bottom: 0 !important;
    }

    /* --- 11. Mobile: Hide preference toolbar --- */
    .manager-toolbar {
        display: none !important;
    }

    /* --- 12. Mobile: Detail filter trigger styling --- */
    .manager-detail-filters-collapse {
        width: 100%;
    }
    .manager-detail-filters-collapse .mobile-collapse-trigger {
        padding: 0.25rem 0;
        border-bottom: none;
        margin-bottom: 0;
    }
    .tw-detail-filters-label {
        font-size: 0.8125rem;
        font-weight: 500;
        color: #6b7280;
    }

    /* --- 13. Mobile: Filter bar ordering — search, tabs, detail filters --- */
    .tw-filter-bar .tw-search-bar {
        order: 1;
    }
    .tw-filter-bar .tw-filter-bar-tabs {
        width: 100%;
        justify-content: center;
        order: 2;
    }
    .tw-filter-bar .manager-detail-filters-collapse {
        order: 3;
    }
}

/* ==========================================================================
   BUCHHALTUNG MODULE — MOBILE UX POLISH
   Scoped to [data-module="buchhaltung"] so zero impact on other pages.
   ========================================================================== */
@media (max-width: 768px) {

    /* 1. General container padding reduction */
    [data-module="buchhaltung"] .container.mx-auto {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    [data-module="buchhaltung"] .max-w-full.mx-auto,
    [data-module="buchhaltung"] .max-w-none.mx-auto {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* 2. Expense list header buttons → icon-only */
    [data-module="buchhaltung"] .admin-page-header .flex-wrap > a,
    [data-module="buchhaltung"] .admin-page-header .flex-wrap > button {
        font-size: 0 !important;
        padding: 0.5rem !important;
        min-width: 2.5rem;
        min-height: 2.5rem;
    }
    [data-module="buchhaltung"] .admin-page-header .flex-wrap > a > i,
    [data-module="buchhaltung"] .admin-page-header .flex-wrap > button > i {
        font-size: 1rem;
        margin-right: 0 !important;
    }
    [data-module="buchhaltung"] .admin-page-header .flex-wrap > a > span,
    [data-module="buchhaltung"] .admin-page-header .flex-wrap > button > span {
        display: none;
    }

    /* 3. Transaction/report header buttons → icon-only */
    [data-module="buchhaltung"] .tw-page-header-actions a.inline-flex {
        font-size: 0;
        padding: 0.5rem !important;
        min-width: 2.5rem;
    }
    [data-module="buchhaltung"] .tw-page-header-actions a.inline-flex > svg,
    [data-module="buchhaltung"] .tw-page-header-actions a.inline-flex > i {
        font-size: 1rem;
        margin-right: 0 !important;
    }

    /* 4. Control panel tabs → icon-only with badges preserved */
    [data-module="buchhaltung"] .control-panel-tab,
    [data-module="buchhaltung"] .transaction-control-panel-tab {
        font-size: 0 !important;
        padding: 0.5rem 0.625rem !important;
    }
    [data-module="buchhaltung"] .control-panel-tab > i,
    [data-module="buchhaltung"] .transaction-control-panel-tab > i {
        font-size: 0.875rem;
        margin-right: 0.25rem !important;
    }
    [data-module="buchhaltung"] .control-panel-tab > span,
    [data-module="buchhaltung"] .transaction-control-panel-tab > span {
        font-size: 0.625rem !important;
        padding: 0.125rem 0.375rem !important;
        margin-left: 0.125rem !important;
    }
    /* Tab header row — reduce padding */
    [data-module="buchhaltung"] #controlPanelContainer > .border-b > .flex {
        padding: 0.5rem 0.75rem !important;
    }

    /* 5. Bulk action toolbar → compact */
    [data-module="buchhaltung"] #bulk-action-toolbar-expenses {
        padding: 0.5rem !important;
    }
    [data-module="buchhaltung"] #bulk-action-toolbar-expenses button {
        font-size: 0;
        padding: 0.375rem 0.5rem !important;
    }
    [data-module="buchhaltung"] #bulk-action-toolbar-expenses button > i {
        font-size: 0.875rem;
        margin-right: 0 !important;
    }
    [data-module="buchhaltung"] #bulk-action-toolbar-expenses .selected-count {
        font-size: 0.75rem !important;
    }

    /* 6. Table cells → compact padding */
    [data-module="buchhaltung"] table thead th {
        padding: 0.5rem !important;
        font-size: 0.625rem !important;
    }
    [data-module="buchhaltung"] table tbody td {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.75rem !important;
    }

    /* 7. Stats cards → compact text & padding */
    /* Gradient stats cards (SVS, transaction list) */
    [data-module="buchhaltung"] .bg-gradient-to-br .p-6 {
        padding: 1rem !important;
    }
    [data-module="buchhaltung"] .bg-gradient-to-br .text-3xl {
        font-size: 1.25rem !important;
    }
    /* Flat stats cards */
    [data-module="buchhaltung"] .border-l-4 {
        padding: 0.625rem !important;
    }
    [data-module="buchhaltung"] .border-l-4 .text-2xl {
        font-size: 1.125rem !important;
    }
    /* Stats bar header */
    [data-module="buchhaltung"] .bg-gray-800.text-white {
        padding: 0.75rem !important;
    }
    [data-module="buchhaltung"] .bg-gray-800 .text-lg {
        font-size: 0.875rem !important;
    }
    /* Inner stat values */
    [data-module="buchhaltung"] .text-lg.font-bold {
        font-size: 1rem !important;
    }

    /* 8. Filter forms → compact */
    [data-module="buchhaltung"] form .flex.items-center {
        gap: 0.5rem !important;
    }
    [data-module="buchhaltung"] .p-6 > form {
        padding: 0 !important;
    }
    [data-module="buchhaltung"] form select,
    [data-module="buchhaltung"] form input[type="date"] {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    /* Card containers with p-6 → p-3 */
    [data-module="buchhaltung"] .bg-white.rounded-lg.shadow-md > .p-6 {
        padding: 0.75rem !important;
    }

    /* 9. Finance calendar → compact header controls */
    /* View toggle buttons */
    [data-module="buchhaltung"] .tw-page-header-actions .inline-flex.rounded-md a {
        padding: 0.375rem 0.5rem !important;
        font-size: 0 !important;
    }
    [data-module="buchhaltung"] .tw-page-header-actions .inline-flex.rounded-md a > i {
        font-size: 0.875rem;
        margin-right: 0 !important;
    }
    /* Add Event + Info buttons → icon-only */
    [data-module="buchhaltung"] .tw-page-header-actions > button {
        font-size: 0 !important;
        padding: 0.375rem !important;
        min-width: 2.25rem;
    }
    [data-module="buchhaltung"] .tw-page-header-actions > button > i {
        font-size: 0.875rem;
        margin-right: 0 !important;
    }
    /* Navigation bar */
    [data-module="buchhaltung"] .p-4.flex.items-center.justify-between {
        padding: 0.75rem !important;
        gap: 0.5rem !important;
    }
    /* Legend — smaller */
    [data-module="buchhaltung"] .flex.items-center.gap-4.text-sm.flex-wrap {
        gap: 0.375rem !important;
        font-size: 0.625rem !important;
    }

    /* 10. Matching manager → compact cards */
    /* Filter panel padding */
    [data-module="buchhaltung"] .bg-white.rounded-lg.shadow-sm.border > .p-4 {
        padding: 0.75rem !important;
    }
    /* Expense match cards */
    [data-module="buchhaltung"] [data-expense-id] > .grid {
        padding: 1rem !important;
        gap: 0.75rem !important;
    }
    [data-module="buchhaltung"] [data-expense-id] .p-5 {
        padding: 0.75rem !important;
    }
    /* Toggle labels */
    [data-module="buchhaltung"] .toggle-label {
        font-size: 0.75rem;
    }
}


/* === FOOTER COMPONENTS === */

/* Sticky footer layout */
body.tw-layout-body {
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1 0 auto;
}

.tw-footer {
    flex-shrink: 0;
    background: var(--theme-nav-bg, #1e293b);
    border-top: 1px solid var(--theme-card-border, rgba(255, 255, 255, 0.1));
    color: var(--theme-menu-text, #cbd5e1);
    padding: 1rem 0;
    font-size: 0.8125rem;
}

.tw-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tw-footer a {
    color: var(--theme-menu-text, #cbd5e1);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
    opacity: 0.85;
}

.tw-footer a:hover {
    color: var(--theme-menu-text-hover, #ffffff);
    opacity: 1;
    text-decoration: none;
}

.tw-footer-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.tw-footer-links a {
    font-weight: 500;
}

.tw-footer-copy,
.tw-footer-contact {
    opacity: 0.7;
}

@media (max-width: 768px) {
    .tw-footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        padding: 0 1rem;
    }
}

/* ============================================================================
   TRANSACTION CONSOLIDATION
   ============================================================================ */

.consolidation-child-row {
    background-color: #eff6ff; /* bg-blue-50 */
    border-left: 3px solid #93c5fd; /* border-blue-300 */
}

.consolidation-child-row td {
    color: #6b7280; /* text-gray-500 */
    font-size: 0.8125rem;
}

.consolidation-child-row:hover {
    background-color: #dbeafe; /* bg-blue-100 */
}

.consolidation-summary-row {
    background-color: #f0f9ff; /* bg-sky-50 */
    border-left: 3px solid #93c5fd;
    border-top: 1px dashed #bfdbfe;
}

.consolidation-reference-row {
    border-left: 3px solid #c4b5fd; /* border-violet-300 */
}

.consolidation-toggle-btn {
    line-height: 1;
    white-space: nowrap;
}

/* ==========================================================================
   TAX REPORT CLARITY IMPROVEMENTS
   ========================================================================== */

/* 1A: Connected Header + Filter Group */
.tax-report-header-group {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.tax-report-header-group .tw-page-header {
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.tax-report-header-group .tax-report-filter-bar {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* 1B: Sticky Section Navigation */
.tax-report-section-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tax-report-section-nav::-webkit-scrollbar {
    display: none;
}

.tax-report-section-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 9999px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.tax-report-section-nav a:hover {
    color: #374151;
    background: #e5e7eb;
    text-decoration: none;
}

.tax-report-section-nav a.active {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
    font-weight: 600;
}

.tax-report-section-nav a i {
    margin-right: 0.375rem;
    font-size: 0.75rem;
}

/* Section scroll offset for sticky nav */
.tax-report-section {
    scroll-margin-top: 3.5rem;
}

/* 1C: Validation Warnings Banner */
.tax-report-warnings {
    margin-bottom: 1.5rem;
}

.tax-report-warning-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: white;
    background: #ef4444;
    border-radius: 9999px;
    margin-left: 0.5rem;
}

/* 1D: Copy Button Hover-Reveal */
.finanzamt-copy-btn {
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.tw-dashboard-stat-card:hover .finanzamt-copy-btn,
.tw-table-row:hover .finanzamt-copy-btn,
.kz-row:hover .finanzamt-copy-btn,
tr:hover .finanzamt-copy-btn,
td:hover .finanzamt-copy-btn {
    opacity: 1;
}

@media (hover: none) {
    .finanzamt-copy-btn {
        opacity: 0.5;
    }
}

/* 1E: Section Accent Borders */
.tax-section-accent-vorsteuer {
    border-left: 4px solid #ef4444;
}

.tax-section-accent-umsatzsteuer {
    border-left: 4px solid #22c55e;
}

.tax-section-accent-eu {
    border-left: 4px solid #3b82f6;
}

.tax-section-accent-e1a {
    border-left: 4px solid #a855f7;
}

.tax-section-accent-afa {
    border-left: 4px solid #f97316;
}

.tax-section-accent-uva {
    border-left: 4px solid #06b6d4;
}

.tax-section-accent-einkommensteuer {
    border-left: 4px solid #ec4899;
}

.tax-section-accent-pauschalierung {
    border-left: 4px solid #6366f1;
}

/* Pauschalierung comparison columns */
.pausch-comparison-actual {
    border-color: #d1d5db;
    background: #f9fafb;
}

.pausch-comparison-pausch {
    border-color: #c7d2fe;
    background: #eef2ff;
}

/* Pauschalierung result indicators */
.pausch-better {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.pausch-worse {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fde68a;
}

/* Pauschalierung config details toggle */
.pausch-config-details summary {
    list-style: none;
    cursor: pointer;
}

.pausch-config-details summary::-webkit-details-marker {
    display: none;
}

.pausch-config-details summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s;
    font-size: 0.75rem;
}

.pausch-config-details[open] summary::before {
    transform: rotate(90deg);
}

/* 1G: Print Support */
@media print {
    .tax-report-section-nav,
    .tax-report-filter-bar,
    .finanzamt-copy-btn,
    .kz-detail-btn,
    .copy-btn,
    .tax-report-header-group form,
    [data-tax-dropdown-toggle],
    [data-tax-dropdown],
    button[onclick*="openCreate"],
    button[onclick*="copyUVA"],
    .no-print {
        display: none !important;
    }

    .tax-report-header-group {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    .tax-report-section {
        page-break-inside: avoid;
    }

    .tw-dashboard-stats-grid {
        page-break-inside: avoid;
    }

    body {
        font-size: 11pt;
    }
}

/* ==========================================================================
   U30 FORM STYLES (migrated from inline <style> block)
   ========================================================================== */

.u30-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.u30-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.u30-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.u30-header h1 i {
    margin-right: 0.5rem;
}

.u30-header p {
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
}

.u30-period-selector {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.u30-period-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 0.95rem;
}

.u30-period-selector form {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.u30-period-selector .form-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.u30-period-selector label {
    font-weight: 500;
    color: #334155;
}

.u30-period-selector .period-info {
    margin-left: auto;
    color: #64748b;
    font-size: 0.9rem;
}

.u30-tabs-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.u30-tab-buttons {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    background: #f8f9fa;
}

.u30-tab-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.u30-tab-button:hover {
    background: #e2e8f0;
    color: #334155;
}

.u30-tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.u30-tab-content {
    display: none;
    padding: 2rem;
}

.u30-tab-content.active {
    display: block;
}

.u30-section-header {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    margin: 1.5rem 0 0.75rem 0;
    border-left: 4px solid #667eea;
    font-weight: 600;
    color: #334155;
    border-radius: 4px;
}

.u30-section-header:first-child {
    margin-top: 0;
}

.kz-row {
    display: grid;
    grid-template-columns: 80px 1fr 250px;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.kz-row:hover {
    background: #fafafa;
}

.kz-row.has-value {
    background: #f0fdf4;
}

.kz-row.has-value .kz-badge {
    background: #10b981;
    color: white;
}

.kz-row.zero-value {
    opacity: 0.5;
}

.kz-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    background: #e2e8f0;
    color: #475569;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 60px;
}

.kz-description {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.4;
}

.kz-row.has-value .kz-description {
    font-weight: 500;
}

.kz-value-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

.kz-value {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    text-align: right;
    min-width: 100px;
}

.kz-row.has-value .kz-value {
    font-weight: 700;
    color: #059669;
}

.kz-row .copy-btn {
    padding: 0.25rem 0.5rem;
    background: #e2e8f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.kz-row .copy-btn:hover {
    background: #667eea;
    color: white;
}

.kz-detail-btn {
    padding: 0.25rem 0.5rem;
    background: #e2e8f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.kz-detail-btn:hover {
    background: #667eea;
    color: white;
}

.kz-row.zero-value .kz-detail-btn {
    display: none;
}

.kz-row .indented-row,
.kz-row.indented-row {
    padding-left: 2rem;
}

/* U30 Validation Section */
.u30-validation-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.u30-validation-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #334155;
}

.u30-validation-formula {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.u30-validation-formula.valid {
    background: #f0fdf4;
    border-left: 4px solid #10b981;
}

.u30-validation-formula.invalid {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
}

.u30-validation-icon {
    font-size: 1.5rem;
}

.u30-validation-icon.valid {
    color: #10b981;
}

.u30-validation-icon.invalid {
    color: #ef4444;
}

/* U30 Summary Section */
.u30-summary-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.u30-summary-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.u30-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.u30-summary-row:last-child {
    border-bottom: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid rgba(255, 255, 255, 0.4);
    font-size: 1.25rem;
    font-weight: 700;
}

.u30-summary-label {
    font-weight: 500;
}

.u30-summary-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 1.1rem;
}

.u30-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.u30-back-link:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
}

.u30-summary-section .copy-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.u30-summary-section .copy-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* U30 KZ Info Toggle (plain-language explanations) */
.kz-info-toggle {
    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: #94a3b8;
    cursor: pointer;
    font-size: 0.75rem;
    transition: color 0.15s ease;
    vertical-align: middle;
    border-radius: 50%;
}

.kz-info-toggle:hover {
    color: #667eea;
}

.kz-info-toggle.active {
    color: #667eea;
}

.kz-info-text {
    display: none;
    margin-top: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: #f0f4ff;
    border-radius: 6px;
    font-size: 0.8125rem;
    color: #475569;
    line-height: 1.5;
    border-left: 3px solid #667eea;
}

.kz-info-text.visible {
    display: block;
}

/* ============================================================
 * APPOINTMENT TITLE & HEADER CONTROLS
 * ============================================================ */

.appointment-title-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.8rem;
}

.appointment-title-display {
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appointment-title-input {
    font-size: 1rem;
    font-weight: 400;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #fff;
    padding: 0.15rem 0.5rem;
    max-width: 500px;
    width: 100%;
}

.appointment-title-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.appointment-title-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.appointment-title-edit-btn,
.appointment-title-regen-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.appointment-title-edit-btn:hover,
.appointment-title-regen-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.appointment-title-regen-btn.spinning i {
    animation: spin 0.8s linear infinite;
}

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

.appointment-canceled-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}

.appointment-canceled-toggle .form-check-input {
    width: 2.25rem;
    height: 1.15rem;
    margin-top: 0;
    cursor: pointer;
}

.appointment-tabs-nav.tw-tabs-nav {
    border-radius: 0;
    border-top: none;
    margin-top: 0;
    box-shadow: none;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    border-bottom: 2px solid #e5e7eb;
}

.appointment-canceled-tabbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding: 0 1rem;
    flex-shrink: 0;
}

.appointment-canceled-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6c757d;
    white-space: nowrap;
}

.appointment-canceled-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.appointment-canceled-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.appointment-canceled-slider {
    position: absolute;
    inset: 0;
    background-color: #ced4da;
    border-radius: 20px;
    transition: background-color 0.2s;
}

.appointment-canceled-slider::before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.appointment-canceled-switch input:checked + .appointment-canceled-slider {
    background-color: #dc3545;
}

.appointment-canceled-switch input:checked + .appointment-canceled-slider::before {
    transform: translateX(16px);
}

.appointment-set-default-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    font-size: 1rem;
    transition: color 0.15s;
}

.appointment-set-default-btn:hover {
    color: #ffc107;
}

.appointment-set-default-btn.is-default {
    color: #ffc107;
}

.appointment-field-edit-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.appointment-field-edit-btn:hover {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.08);
}

.appointment-summary-display {
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.6;
    padding: 0.25rem 0;
    cursor: default;
}

.appointment-summary-display p {
    margin-bottom: 0.35rem;
}

.appointment-summary-display p:last-child {
    margin-bottom: 0;
}

/* Map button highlight after generation */
.map-btn-highlight {
    animation: mapBtnHighlight 2s ease;
}

@keyframes mapBtnHighlight {
    0%   { background-color: #198754; color: #fff; border-color: #198754; }
    60%  { background-color: #198754; color: #fff; border-color: #198754; }
    100% { background-color: transparent; color: #0d6efd; border-color: #0d6efd; }
}


/* === COMMUNICATION CENTER COMPONENTS === */

/* Compose form: CC/BCC hidden by default */
#compose-cc-container[data-visible="false"],
#compose-bcc-container[data-visible="false"] {
    display: none;
}

/* Draft indicator hidden by default */
#compose-draft-indicator[data-visible="false"] {
    display: none;
}

/* Variable chips */
.compose-var-chip {
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    transition: all 0.15s ease;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #4b5563;
    border-radius: 0.25rem;
}

.compose-var-chip:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* Document search results dropdown */
#compose-document-results {
    max-height: 200px;
    overflow-y: auto;
}

/* Communication Center tab content area */
#comm-tab-content {
    min-height: 400px;
}

/* Compose form email account selector full width */
#compose-email-account {
    width: 100%;
}

/* Communication Center: seamless header-to-tabs join */
.comm-center-tabs {
    margin-top: -1px;
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Mobile card detail sections -- hidden by default, shown by overlay JS */
.tw-mobile-card-detail {
    display: none;
}

/* Detail section badge container (replaces inline flex styles in mobile cards) */
.tw-detail-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

/* Detail value size variants */
.tw-detail-value-sm { font-size: 0.85rem; }
.tw-detail-value-title { font-size: 1.1rem; font-weight: 600; }

/* Detail icon muted (replaces inline width/color styles) */
.tw-detail-icon-muted { width: 1rem; color: #6b7280; }


/* === MOBILE CARD VIEW === */
/* Responsive card layout for manager list views on small screens */

/* Desktop: hide mobile cards entirely */
.tw-mobile-card-grid {
    display: none;
}

/* Mobile (<=768px): show cards, hide table and bulk header */
@media (max-width: 768px) {
    /* Hide the desktop table when mobile cards are present */
    .tw-list-view-table:has(~ .tw-mobile-card-grid),
    .has-mobile-cards > .tw-list-view-table {
        display: none !important;
    }

    /* Hide bulk actions header on mobile (desktop-only feature) */
    .tw-list-view-header:has(~ .tw-mobile-card-grid),
    .has-mobile-cards > .tw-list-view-header {
        display: none !important;
    }

    /* Show card grid */
    .tw-mobile-card-grid {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        /* padding: 0.75rem; */
    }

    /* Individual card */
    .tw-mobile-card {
        background: white;
        border: 1px solid #e7e5e4;
        border-radius: 0.875rem;
        padding: 0.75rem;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    }

    /* Card header: badges left, date right */
    .tw-mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
    }

    .tw-mobile-card-badges {
        display: flex;
        gap: 0.375rem;
        flex-wrap: wrap;
    }

    .tw-mobile-card-date {
        font-size: 0.8rem;
        color: #6b7280;
        white-space: nowrap;
        margin-left: 0.5rem;
    }

    /* Card body */
    .tw-mobile-card-body {
        margin-bottom: 0.5rem;
    }

    .tw-mobile-card-customer {
        font-family: 'Lora', serif;
        font-weight: 600;
        color: #111827;
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .tw-mobile-card-meta {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
    }

    .tw-mobile-card-number {
        font-size: 0.8rem;
        color: #9ca3af;
    }

    .tw-mobile-card-amount {
        font-size: 1.125rem;
        font-weight: 700;
        color: #c2410c;
    }

    /* Card actions footer */
    .tw-mobile-card-actions {
        display: flex;
        gap: 0.375rem;
        padding-top: 0.5rem;
        border-top: 1px solid #f3f4f6;
        flex-wrap: wrap;
    }

    .tw-mobile-card-actions .tw-action-btn {
        width: 2.5rem;
        height: 2.5rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
    }

    /* Empty state */
    .tw-mobile-card-empty {
        text-align: center;
        color: #9ca3af;
        padding: 2rem 1rem;
        font-size: 0.95rem;
    }
}


/* === MOBILE DETAIL OVERLAY === */

.tw-mobile-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    background: #faf7f2;
    display: flex;
    flex-direction: column;
    visibility: hidden;
    opacity: 0;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease, visibility 0s 0.3s;
}

.tw-mobile-detail-overlay.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.15s ease, visibility 0s 0s;
}

/* Header bar — comfortable touch target */
.tw-mobile-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 3rem;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tw-mobile-detail-counter {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.04em;
}

.tw-mobile-detail-close {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 2.125rem;
    height: 2.125rem;
    font-size: 1.15rem;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.tw-mobile-detail-close:hover,
.tw-mobile-detail-close:active {
    background: #e2e8f0;
    color: #1e293b;
}

/* Scrollable body */
.tw-mobile-detail-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Ensure Font Awesome icons render inside overlay (prevent inheritance issues) */
.tw-mobile-detail-body .fas,
.tw-mobile-detail-body .far,
.tw-mobile-detail-body .fab,
.tw-mobile-detail-body .bi {
    display: inline;
    font-style: normal;
    line-height: 1;
}

/* Bottom nav bar */
.tw-mobile-detail-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.06);
    /* safe area for phones with gesture bars */
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.tw-mobile-detail-prev,
.tw-mobile-detail-next {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tw-mobile-detail-prev:active,
.tw-mobile-detail-next:active {
    background: #f1f5f9;
    border-color: #94a3b8;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tw-mobile-detail-prev:disabled,
.tw-mobile-detail-next:disabled {
    opacity: 0.25;
    cursor: default;
    box-shadow: none;
}

/* --- Transit-detail overlay chrome (warm theme for appointment cards) --- */
.tw-mobile-detail-overlay.transit-detail {
    background: #faf7f2;
}

.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-header {
    background: linear-gradient(135deg, #f5e6d3 0%, #faf0e6 50%, #f0e0cc 100%);
    border-bottom-color: #e8d5c0;
    box-shadow: 0 1px 4px rgba(139, 90, 43, 0.08);
}

.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-counter {
    color: #8b5a2b;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-weight: 600;
}

.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-close {
    background: rgba(139, 90, 43, 0.1);
    color: #8b5a2b;
}

.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-close:hover,
.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-close:active {
    background: rgba(139, 90, 43, 0.2);
    color: #6b3a1b;
}

.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-nav {
    background: linear-gradient(135deg, #f5e6d3 0%, #faf0e6 50%, #f0e0cc 100%);
    border-top-color: #e8d5c0;
    box-shadow: 0 -1px 4px rgba(139, 90, 43, 0.08);
}

.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-prev,
.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-next {
    background: rgba(255, 255, 255, 0.7);
    border-color: #d4b896;
    color: #8b5a2b;
}

.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-prev:active,
.tw-mobile-detail-overlay.transit-detail .tw-mobile-detail-next:active {
    background: rgba(139, 90, 43, 0.1);
    border-color: #b8956a;
}

/* Detail content sections */
.tw-detail-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.tw-detail-section:first-child {
    border-top: none;
}

.tw-detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.tw-detail-label i {
    color: #c2410c;
    font-size: 0.75rem;
}

.tw-detail-value {
    font-size: 1rem;
    color: #1e293b;
    line-height: 1.5;
}

/* Utility classes for detail overlay content */
.tw-detail-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.tw-detail-value-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.tw-detail-value-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.15rem;
}

.tw-detail-contact-line {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.tw-detail-contact-line i {
    width: 1rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8125rem;
}

.tw-detail-contact-line + .tw-detail-contact-line {
    margin-top: 0.15rem;
}

.tw-detail-inline-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.tw-detail-inline-row:last-child {
    margin-bottom: 0;
}

.tw-detail-inline-row .tw-detail-label {
    min-width: 5.5rem;
    margin-bottom: 0;
    flex-shrink: 0;
}

.tw-detail-inline-row .tw-detail-value {
    flex: 1;
}

.tw-detail-number {
    margin-left: auto;
    font-weight: 600;
    color: #1f2937;
}

.tw-detail-directions {
    font-size: 0.875rem;
    color: #3b82f6;
    margin-top: 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
}

.tw-detail-directions:hover {
    color: #2563eb;
    text-decoration: underline;
}

.tw-detail-icon-location {
    color: #ef4444;
    margin-right: 0.35rem;
}

/* Items table */
.tw-detail-items-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.tw-detail-items-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.tw-detail-items-table tr {
    border-bottom: 1px solid #f1f5f9;
}

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

.tw-detail-items-table td {
    padding: 0.5rem 0.625rem;
    vertical-align: top;
}

.tw-detail-item-desc {
    color: #334155;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 50%;
}

.tw-detail-item-qty {
    color: #64748b;
    white-space: nowrap;
    text-align: right;
    padding-right: 0.5rem !important;
    font-size: 0.75rem;
}

.tw-detail-item-total {
    color: #1e293b;
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
}

/* Financial summary */
.tw-detail-summary {
    padding: 1rem 1.25rem;
    background: #ffffff;
}

.tw-detail-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.9375rem;
    color: #64748b;
}

.tw-detail-summary-row.tw-detail-total {
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 2px solid #cbd5e1;
    font-size: 1.2rem;
    font-weight: 800;
    color: #c2410c;
}

/* Action buttons in detail view — pill buttons with icon + text */
.tw-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.25rem !important;
    background: #faf7f2;
    border-bottom: none !important;
}

.tw-detail-actions .tw-action-btn {
    width: auto;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0.5rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 0.5rem 0.875rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    text-decoration: none;
}

.tw-detail-actions .tw-action-btn:active {
    transform: scale(0.97);
}

/* Color accents for action types */
.tw-detail-actions .tw-action-btn-edit {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}

.tw-detail-actions .tw-action-btn-edit:active {
    background: #dbeafe;
}

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

.tw-detail-actions .tw-action-btn-archive:active {
    background: #fee2e2;
}

.tw-detail-actions .tw-action-btn-restore {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #16a34a;
}

.tw-detail-actions .tw-action-btn-restore:active {
    background: #dcfce7;
}

.tw-detail-actions .tw-action-btn i {
    font-size: 0.875rem;
    width: auto;
    height: auto;
    color: inherit;
}

/* Hide overlay on desktop */
@media (min-width: 769px) {
    .tw-mobile-detail-overlay {
        display: none !important;
    }
}

/* === COPY INFO MOBILE CARD === */

.tw-copy-info-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 0.875rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tw-copy-info-card-date {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.tw-copy-info-card-date i {
    color: #94a3b8;
}

.tw-copy-info-card-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.375rem 0;
    border-top: 1px solid #f1f5f9;
}

.tw-copy-info-card-row:first-of-type {
    border-top: none;
}

.tw-copy-info-card-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 4.5rem;
    flex-shrink: 0;
    padding-top: 0.2rem;
}

.tw-copy-info-card-value {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: #334155;
    line-height: 1.4;
}

.tw-copy-info-card-value .tw-copy-info-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
}

.tw-copy-info-card-value .tw-copy-info-item:last-child {
    margin-bottom: 0;
}

.tw-copy-info-card-value .tw-copy-info-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tw-copy-info-card-value .tw-copy-info-btn {
    flex-shrink: 0;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s;
}

.tw-copy-info-card-value .tw-copy-info-btn:active {
    background: #e2e8f0;
}

.tw-copy-info-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

/* === TRANSIT MODE OVERLAY === */
/* Mobile-only fullscreen overlay for upcoming appointments */

/* Journey Cards — Concept C warm theme */
.tw-transit-mode-overlay {
    --cc-bg: #faf7f2;
    --cc-surface: #ffffff;
    --cc-surface2: #f5f0e8;
    --cc-accent: #c2410c;
    --cc-accent2: #4d7c0f;
    --cc-accent3: #1d4ed8;
    --cc-text: #292524;
    --cc-muted: #78716c;
    --cc-border: #e7e5e4;

    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cc-bg);
    z-index: 1300;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    color: var(--cc-text);
    font-family: 'Sora', sans-serif;
}

.tw-transit-mode-overlay.active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .tw-transit-mode-overlay {
        display: flex;
    }
}

/* Close button — white circle */
.tw-transit-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cc-surface);
    border: none;
    color: var(--cc-text);
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.2s, color 0.2s;
}

.tw-transit-close:hover {
    background: var(--cc-accent);
    color: #fff;
}

/* Header — compact inline warm gradient */
.tw-transit-header {
    padding: 1.25rem 1.5rem 1rem;
    background: linear-gradient(180deg, #f0e6d6 0%, var(--cc-bg) 100%);
    flex-shrink: 0;
}

.tw-transit-header-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tw-transit-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--cc-accent), #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Lora', serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.tw-transit-title {
    font-family: 'Lora', serif;
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
}


/* Cards container — vertical scroll */
.tw-transit-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.25rem 1.5rem;
    -webkit-overflow-scrolling: touch;
}

/* Journey card */
.tw-transit-journey-card {
    background: var(--cc-surface);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
    overflow: hidden;
    border-left: 4px solid var(--cc-accent);
    transition: box-shadow 0.2s;
}

.tw-transit-journey-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.tw-transit-journey-card.green-accent {
    border-left-color: var(--cc-accent2);
}

.tw-transit-journey-card.blue-accent {
    border-left-color: var(--cc-accent3);
}

/* Card main (collapsed view) */
.tw-transit-card-main {
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.tw-transit-card-time-block {
    text-align: center;
    min-width: 52px;
    flex-shrink: 0;
}

.tw-transit-card-time {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cc-accent);
}

.tw-transit-journey-card.green-accent .tw-transit-card-time {
    color: var(--cc-accent2);
}

.tw-transit-journey-card.blue-accent .tw-transit-card-time {
    color: var(--cc-accent3);
}

/* Countdown banner — date left, remaining time right */
.tw-transit-card-countdown-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    background: var(--cc-surface2);
    border-bottom: 1px solid var(--cc-border);
}

.tw-transit-banner-date {
    font-size: 0.75rem;
    color: var(--cc-muted);
    font-weight: 500;
}

.tw-transit-banner-countdown {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--cc-accent);
}

.tw-transit-card-countdown-banner.imminent {
    background: #fffbeb;
}

.tw-transit-card-countdown-banner.imminent .tw-transit-banner-countdown {
    color: #d97706;
}

.tw-transit-card-countdown-banner.now {
    background: #fef2f2;
}

.tw-transit-card-countdown-banner.now .tw-transit-banner-countdown {
    color: #dc2626;
    animation: transit-pulse 2s infinite;
}

.tw-transit-card-countdown-banner.past {
    background: #f1f5f9;
}

.tw-transit-card-countdown-banner.past .tw-transit-banner-countdown {
    color: #94a3b8;
    font-style: italic;
}

.tw-transit-journey-card.green-accent .tw-transit-banner-countdown {
    color: var(--cc-accent2);
}

.tw-transit-journey-card.green-accent .tw-transit-card-countdown-banner.imminent .tw-transit-banner-countdown {
    color: #d97706;
}

.tw-transit-journey-card.green-accent .tw-transit-card-countdown-banner.now .tw-transit-banner-countdown {
    color: #dc2626;
}

.tw-transit-journey-card.blue-accent .tw-transit-banner-countdown {
    color: var(--cc-accent3);
}

.tw-transit-journey-card.blue-accent .tw-transit-card-countdown-banner.imminent .tw-transit-banner-countdown {
    color: #d97706;
}

.tw-transit-journey-card.blue-accent .tw-transit-card-countdown-banner.now .tw-transit-banner-countdown {
    color: #dc2626;
}

@keyframes transit-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.tw-transit-card-body {
    flex: 1;
    min-width: 0;
}

.tw-transit-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.tw-transit-card-client {
    font-size: 0.82rem;
    color: var(--cc-muted);
    margin-bottom: 0.5rem;
}

.tw-transit-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.tw-transit-card-tag {
    font-size: 0.68rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    background: var(--cc-surface2);
    color: var(--cc-muted);
}

.tw-transit-card-tag i {
    font-size: 0.55rem;
    margin-right: 0.15rem;
}

/* Chevron */
.tw-transit-card-chevron {
    align-self: center;
    color: var(--cc-muted);
    font-size: 0.75rem;
    transition: transform 0.25s;
    flex-shrink: 0;
}

.tw-transit-journey-card.expanded .tw-transit-card-chevron {
    transform: rotate(180deg);
}

/* Expanded section */
.tw-transit-card-expanded {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.tw-transit-journey-card.expanded .tw-transit-card-expanded {
    max-height: 1200px;
}

.tw-transit-card-expanded-inner {
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--cc-border);
    padding-top: 1rem;
}

/* Detail rows */
.tw-transit-detail-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.tw-transit-detail-item {
    flex: 1;
}

.tw-transit-detail-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cc-muted);
    margin-bottom: 0.2rem;
}

.tw-transit-detail-value {
    font-size: 0.88rem;
}

.tw-transit-detail-value a {
    color: var(--cc-accent);
    font-weight: 500;
    text-decoration: none;
}

.tw-transit-detail-value a:hover {
    text-decoration: underline;
}

/* Directions button */
.tw-transit-directions-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--cc-accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.45rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.15s;
}

.tw-transit-journey-card.green-accent .tw-transit-directions-btn {
    background: var(--cc-accent2);
}

.tw-transit-journey-card.blue-accent .tw-transit-directions-btn {
    background: var(--cc-accent3);
}

.tw-transit-directions-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: #fff;
}

/* People section */
.tw-transit-people-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--cc-border);
}

.tw-transit-people-title {
    font-family: 'Lora', serif;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.tw-transit-person-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    background: var(--cc-surface2);
    margin-bottom: 0.4rem;
    transition: background 0.15s;
}

.tw-transit-person-card:hover {
    background: #ece8e0;
}

.tw-transit-person-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

/* Avatar gradient cycling */
.tw-transit-person-card:nth-child(3n+1) .tw-transit-person-av {
    background: linear-gradient(135deg, #f472b6, #ec4899);
}

.tw-transit-person-card:nth-child(3n+2) .tw-transit-person-av {
    background: linear-gradient(135deg, #818cf8, #6366f1);
}

.tw-transit-person-card:nth-child(3n) .tw-transit-person-av {
    background: linear-gradient(135deg, #34d399, #10b981);
}

.tw-transit-person-info {
    flex: 1;
    min-width: 0;
}

.tw-transit-person-name {
    font-size: 0.82rem;
    font-weight: 500;
}

.tw-transit-person-role {
    font-size: 0.65rem;
    color: var(--cc-muted);
}

.tw-transit-person-links {
    display: flex;
    gap: 0.25rem;
}

.tw-transit-person-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: var(--cc-muted);
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    text-decoration: none;
    transition: all 0.15s;
}

.tw-transit-person-btn.google:hover {
    border-color: #4285f4;
    color: #4285f4;
}

.tw-transit-person-btn.connection:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

/* Communication toggle */
.tw-transit-comms-section {
    margin-top: 1rem;
}

.tw-transit-comms-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    background: var(--cc-surface2);
    border: 1px solid var(--cc-border);
    color: var(--cc-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.tw-transit-comms-toggle:hover {
    background: #ece8e0;
    color: var(--cc-text);
}

.tw-transit-comms-chevron {
    font-size: 0.6rem;
    transition: transform 0.25s;
}

.tw-transit-comms-chevron.open {
    transform: rotate(180deg);
}

.tw-transit-comms-box {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tw-transit-comms-box.open {
    max-height: 600px;
    overflow-y: auto;
}

.tw-transit-comms-box-inner {
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    background: var(--cc-surface2);
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--cc-text);
}

/* Prose styling for rich text inside transit comms */
.tw-transit-comms-box-inner.tw-prose p {
    margin: 0 0 0.5em;
}

.tw-transit-comms-box-inner.tw-prose p:last-child {
    margin-bottom: 0;
}

.tw-transit-comms-box-inner.tw-prose ul,
.tw-transit-comms-box-inner.tw-prose ol {
    margin: 0.3em 0 0.5em;
    padding-left: 1.4em;
}

.tw-transit-comms-box-inner.tw-prose li {
    margin-bottom: 0.15em;
}

.tw-transit-comms-box-inner.tw-prose h1,
.tw-transit-comms-box-inner.tw-prose h2,
.tw-transit-comms-box-inner.tw-prose h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.5em 0 0.3em;
}

.tw-transit-comms-box-inner.tw-prose a {
    color: var(--cc-accent);
    text-decoration: underline;
}

.tw-transit-comms-box-inner.tw-prose blockquote {
    border-left: 3px solid var(--cc-border);
    margin: 0.4em 0;
    padding: 0.2em 0 0.2em 0.75em;
    color: var(--cc-muted);
}

.tw-transit-comms-box-inner.tw-prose strong {
    font-weight: 600;
}

.tw-transit-comms-box-inner.tw-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 0.4em 0;
}

.tw-transit-comms-box-inner.tw-prose th,
.tw-transit-comms-box-inner.tw-prose td {
    border: 1px solid var(--cc-border);
    padding: 0.3em 0.5em;
    text-align: left;
}

.tw-transit-comms-box-inner.tw-prose th {
    background: var(--cc-surface);
    font-weight: 600;
}

/* Footer — light theme */
.tw-transit-footer {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--cc-border);
    flex-shrink: 0;
    background: var(--cc-surface);
}

.tw-transit-edit-btn,
.tw-transit-dismiss-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    border: none;
    text-decoration: none;
}

.tw-transit-edit-btn {
    background: var(--cc-surface2);
    border: 1px solid var(--cc-border);
    color: var(--cc-text);
}

.tw-transit-edit-btn:hover {
    background: #ece8e0;
    color: var(--cc-text);
}

.tw-transit-dismiss-btn {
    background: var(--cc-accent);
    color: #fff;
}

.tw-transit-dismiss-btn:hover {
    background: #a83b09;
}

.tw-transit-edit-btn:active,
.tw-transit-dismiss-btn:active {
    transform: scale(0.97);
}

/* Transit Mode navbar button — mobile only */
.tw-transit-nav-btn {
    display: none !important;
}

@media (max-width: 768px) {
    .tw-transit-nav-btn {
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        color: var(--nav-text);
        border-radius: 0.5rem;
        font-weight: 500;
        font-size: 0.9rem;
    }

    .tw-transit-nav-btn i {
        color: var(--cc-accent);
    }
}

@media (max-width: 600px) {
    .tw-transit-header {
        padding: 1rem 1rem 0.75rem;
    }

    .tw-transit-cards {
        padding: 0 0.85rem 1rem;
    }

    .tw-transit-card-main {
        gap: 0.65rem;
    }

    .tw-transit-card-countdown-banner {
        padding: 0.4rem 0.85rem;
    }

    .tw-transit-banner-countdown {
        font-size: 0.95rem;
    }

    .tw-transit-detail-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tw-transit-card-expanded-inner {
        padding: 0 0.85rem 1rem;
        padding-top: 0.85rem;
    }
}

/* === MOBILE TRANSIT CARD (appointment detail overlay) === */
.tw-mobile-transit-card {
    --mtc-bg: #faf8f5;
    --mtc-surface: #f5f0ea;
    --mtc-accent: #b8860b;
    --mtc-text: #3d3427;
    --mtc-muted: #8b7d6b;
    --mtc-border: #e8e0d5;
    background: var(--mtc-bg);
    color: var(--mtc-text);
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
}

.tw-mobile-transit-card .tw-transit-card-countdown-banner {
    border-radius: 0;
}

.tw-mobile-transit-card .tw-transit-card-expanded {
    max-height: none;
    overflow: visible;
}

.tw-mobile-transit-card .tw-transit-card-expanded-inner {
    border-top: none;
}

.tw-mobile-transit-card .tw-mtc-time-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tw-mobile-transit-card .tw-mtc-time-block {
    text-align: center;
    min-width: 52px;
}

.tw-mobile-transit-card .tw-mtc-time-big {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--mtc-accent);
}

.tw-mobile-transit-card .tw-mtc-time-range {
    font-size: 0.72rem;
    color: var(--mtc-muted);
}

.tw-mobile-transit-card .tw-mtc-title-block {
    flex: 1;
    min-width: 0;
}

.tw-mobile-transit-card .tw-mtc-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.tw-mobile-transit-card .tw-mtc-client {
    font-size: 0.85rem;
    color: var(--mtc-muted);
}

.tw-mobile-transit-card .tw-mtc-details {
    padding: 0 1.25rem 1rem;
}

.tw-mobile-transit-card .tw-mtc-actions {
    padding: 0.75rem 1.25rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tw-mobile-transit-card .tw-mtc-actions .tw-action-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    text-align: center;
}

/* === CLICK-TO-COPY VALUES === */
.copyable-value {
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 4px;
    padding: 0 0.25rem;
}
.copyable-value:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.copyable-value.copied {
    background-color: rgba(34, 197, 94, 0.15);
}

/* === CODEMIRROR IN MODALS === */
.CodeMirror {
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 0.375rem;
    font-size: 13px;
    height: auto;
    min-height: 200px;
}

/* === AI CONSENT GATING === */
.ai-consent-required {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

#ai-consent-checkbox {
    width: 1rem;
    height: 1rem;
    min-width: 1rem;
    flex-shrink: 0;
}

/* === 17. SETUP WIZARD COMPONENTS === */

/* Progress indicator */
.setup-wizard-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.setup-wizard-step-indicator {
    display: flex;
    align-items: center;
    gap: 0;
}

.setup-wizard-step-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--card-bg, #fff);
    border: 2px solid var(--border-color, #dee2e6);
    color: var(--text-muted, #6c757d);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.setup-wizard-step-dot.active {
    background: var(--accent-1, #2563eb);
    border-color: var(--accent-1, #2563eb);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.setup-wizard-step-dot.completed {
    background: var(--success, #22c55e);
    border-color: var(--success, #22c55e);
    color: #fff;
}

.setup-wizard-step-label {
    font-size: 0.75rem;
    color: var(--text-muted, #6c757d);
    text-align: center;
    margin-top: 0.5rem;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.setup-wizard-step-indicator.active .setup-wizard-step-label {
    color: var(--accent-1, #2563eb);
    font-weight: 600;
}

.setup-wizard-step-indicator.completed .setup-wizard-step-label {
    color: var(--success, #22c55e);
}

.setup-wizard-step-connector {
    width: 4rem;
    height: 2px;
    background: var(--border-color, #dee2e6);
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.setup-wizard-step-connector.completed {
    background: var(--success, #22c55e);
}

@media (max-width: 576px) {
    .setup-wizard-step-connector { width: 1.5rem; }
    .setup-wizard-step-dot { width: 2rem; height: 2rem; font-size: 0.8rem; }
    .setup-wizard-step-label { font-size: 0.65rem; }
}

/* Step panels */
.setup-wizard-panel {
    display: none;
    animation: wizardFadeIn 0.3s ease;
}

.setup-wizard-panel.active {
    display: block;
}

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

/* Navigation buttons */
.setup-wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color, #dee2e6);
}

.setup-wizard-nav .btn {
    min-width: 8rem;
}

/* Welcome header */
.setup-wizard-welcome {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
}

.setup-wizard-welcome h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary, #1f2937);
}

.setup-wizard-welcome p {
    color: var(--text-muted, #6c757d);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}


/* === USER PROFILE PAGE (A+C Hybrid — Bright/Light) === */

/* Page wrapper — always bright regardless of theme */
.profile-page {
    /* background: #f4f5f7; */
    /* padding: 1.5rem; */
    border-radius: 0.75rem;
    min-height: 60vh;
}

/* ── Top Bar ── */
.profile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem 1.75rem;
    margin-bottom: 1.5rem;
}

.profile-topbar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

/* Avatar */
.profile-avatar {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--theme-brand-primary, #0d9488);
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: #f0fdfa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: var(--theme-brand-primary, #0d9488);
}

.profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    cursor: pointer;
}

.profile-avatar-wrapper .profile-avatar {
    width: 100%;
    height: 100%;
}

.profile-avatar-edit-overlay {
    position: absolute;
    bottom: 1px;
    right: -1px;
    width: 20px;
    height: 20px;
    background: var(--theme-brand-primary, #0d9488);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.55rem;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.15s ease;
    pointer-events: none;
}

.profile-avatar-wrapper:hover .profile-avatar-edit-overlay {
    transform: scale(1.15);
}

/* Topbar Info */
.profile-topbar-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: #1f2937;
}

.profile-topbar-email {
    font-size: 0.82rem;
    color: #6b7280;
    margin-bottom: 0.35rem;
}

.profile-topbar-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.profile-badge i { font-size: 0.45rem; }
.profile-badge-success i { color: #22c55e; }
.profile-badge-danger i { color: #ef4444; }
.profile-badge-info i { color: var(--theme-brand-primary, #0d9488); }
.profile-badge-warning i { color: #f59e0b; }
.profile-badge-muted { color: #9ca3af; border-color: #e5e7eb; }

/* Action Buttons */
.profile-topbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.profile-action-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
}

.profile-action-btn-primary {
    background: var(--theme-brand-primary, #0d9488);
    color: #ffffff;
}

.profile-action-btn-primary:hover {
    filter: brightness(1.1);
    color: #ffffff;
    text-decoration: none;
}

.profile-action-btn-outline {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.profile-action-btn-outline:hover {
    background: #f9fafb;
    border-color: var(--theme-brand-primary, #0d9488);
    color: var(--theme-brand-primary, #0d9488);
    text-decoration: none;
}

/* ── Section Headings (Concept C style) ── */
.profile-section-heading {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 0.6rem;
    padding-left: 1.0rem;
}

.profile-section-heading .profile-action-btn {
    margin-left: auto;
}

.profile-section-heading .profile-config-badge {
    margin-left: 0.4rem;
}

.profile-section-heading-collapse {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    user-select: none;
}

/* ── Stat Boxes (4-column standalone grid) ── */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.profile-stat-box {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.625rem;
    padding: 1rem 0.75rem;
    text-align: center;
}

.profile-stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
    color: #1f2937;
}

.profile-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    margin-top: 0.2rem;
}

.profile-stat-delta {
    font-size: 0.68rem;
    font-weight: 600;
    color: #16a34a;
    margin-top: 0.3rem;
}

/* ── Cards ── */
.profile-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.625rem;
    overflow: hidden;
    padding: auto;
}

/* Allow TomSelect dropdowns to overflow on admin AI config page */
#global-ai-config-form .profile-card {
    overflow: visible;
}

.profile-card-body {
    padding: 1.25rem;
}

.profile-card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #f3f4f6;
    text-align: center;
}

/* ── Field Rows ── */
.profile-field-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.profile-field-row:last-child {
    border-bottom: none;
}

.profile-field-row:hover {
    background: #fafbfc;
}

.profile-field-row-compact {
    padding: 0.5rem 1rem;
}

/* Icon Square (Concept A) */
.profile-field-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    background: #f0fdfa;
    color: var(--theme-brand-primary, #0d9488);
    font-size: 0.78rem;
    flex-shrink: 0;
}

.profile-field-label {
    width: 120px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.profile-field-value {
    flex: 1;
    font-size: 0.88rem;
    color: #1f2937;
    min-width: 0;
    word-break: break-word;
}

.profile-field-value a {
    color: var(--theme-brand-primary, #0d9488);
    text-decoration: none;
}

.profile-field-value a:hover {
    text-decoration: underline;
}

.profile-field-empty {
    color: #c4c9d1;
    font-style: italic;
    font-size: 0.82rem;
}

/* Edit Button (pencil, hidden until row hover) */
.profile-edit-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--theme-brand-primary, #0d9488);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.15s ease;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.profile-field-row:hover .profile-edit-btn {
    opacity: 0.5;
}

.profile-edit-btn:hover {
    opacity: 1 !important;
    background: #f0fdfa;
}

/* Field Divider */
.profile-field-divider {
    padding: 0.45rem 1rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-brand-primary, #0d9488);
    background: #f9fafb;
    border-bottom: 1px solid #f3f4f6;
    border-top: 1px solid #f3f4f6;
}

/* Empty State */
.profile-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #9ca3af;
}

.profile-empty-state i {
    font-size: 1.75rem;
    opacity: 0.35;
    margin-bottom: 0.75rem;
    display: block;
}

.profile-empty-state p {
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
}

/* Config Badges (inline, not Bootstrap) */
.profile-config-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
}

.profile-config-badge-active {
    background: #dcfce7;
    color: #16a34a;
}

.profile-config-badge-info {
    background: #f0fdfa;
    color: var(--theme-brand-primary, #0d9488);
}

.profile-config-badge-warn {
    background: #fef9c3;
    color: #a16207;
}

/* ── Inline Edit Form ── */
.profile-inline-form {
    flex: 1;
}

.profile-inline-input {
    font-size: 0.85rem;
    max-width: 280px;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.3rem 0.5rem;
}

.profile-inline-input:focus {
    outline: none;
    border-color: var(--theme-brand-primary, #0d9488);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

.profile-inline-save {
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
    background: var(--theme-brand-primary, #0d9488);
    color: #fff;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
}

.profile-inline-save:hover {
    filter: brightness(1.1);
}

.profile-inline-cancel {
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
    background: #ffffff;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    cursor: pointer;
}

.profile-inline-cancel:hover {
    background: #f9fafb;
}

/* ── AI Section ── */
.profile-ai-chip {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.profile-collapse-icon {
    transition: transform 0.3s ease;
    font-size: 0.7rem;
    color: #9ca3af;
    margin-left: auto;
}

[aria-expanded="true"] .profile-collapse-icon {
    transform: rotate(180deg);
}

.profile-ai-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.profile-ai-stat {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 0.5rem;
}

.profile-ai-stat-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.profile-ai-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
    margin-top: 0.15rem;
}

.profile-ai-sub-heading {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.profile-ai-provider-section {
    margin-bottom: 1.25rem;
}

.profile-ai-table {
    width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
}

.profile-ai-table thead th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.profile-ai-table tbody td {
    padding: 0.5rem 0.75rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

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

.profile-ai-recent-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.profile-ai-recent-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #f0fdfa;
    color: var(--theme-brand-primary, #0d9488);
    border: 1px solid #ccfbf1;
}

/* ── Responsive ── */
@media (max-width: 991px) {
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 768px) {
    .profile-page {
        padding: 1rem;
    }

    .profile-topbar {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }

    .profile-topbar-left {
        flex-direction: column;
    }

    .profile-topbar-badges {
        justify-content: center;
    }

    .profile-topbar-actions {
        justify-content: center;
    }

    .profile-topbar-name {
        font-size: 1.1rem;
    }

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

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

    .profile-field-label {
        width: 85px;
        font-size: 0.7rem;
    }

    .profile-edit-btn {
        opacity: 0.5;
    }
}


/* ═══════════════════════════════════════════════════════════════════════
   PROFILE PAGE - TABBED LAYOUT
   Styles for the unified profile + configuration tabbed page
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Tab Container ── */
.profile-tabs-container {
    /* background: #ffffff; */
    /* border: 1px solid #e5e7eb; */
    border-radius: 0.75rem;
    overflow: hidden;
}

.profile-page .tw-tabs-nav {
    /* background: #f9fafb; */
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 0.5rem;
    gap: 0;
    flex-wrap: nowrap;
    align-items: center;
}

.profile-page .tw-tab {
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.profile-page .tw-tab:hover:not(.active) {
    color: #374151;
    background: #f3f4f6;
}

.profile-page .tw-tab.active {
    color: var(--theme-brand-primary, #0d9488);
    border-bottom-color: var(--theme-brand-primary, #0d9488);
    background: transparent;
}

.profile-page .tw-tab i {
    margin-right: 0.35rem;
}

.profile-page .tw-tab-content {
    padding: 0;
}

.profile-page .tw-tab-panel {
    /* padding: 1.5rem; */
}

/* ── Config Profile Selector ── */
.profile-config-selector {
    display: none; /* hidden by default, shown via JS on config tabs */
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding-right: 0.5rem;
    flex-shrink: 0;
}

/* ── Profile autosave uses toast notifications (no save bar needed) ── */

/* ── Form inside tabs (don't add extra padding) ── */
.profile-page .simple-config-form .tw-tab-panel {
    /* padding: 1.5rem; */
}

.profile-section-heading.profile-section-heading-danger {
  padding-top: 1.5rem;
}

/* ── Responsive: horizontal tab scroll ── */
@media (max-width: 768px) {
    .profile-page .tw-tabs-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .profile-page .tw-tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .profile-page .tw-tab {
        font-size: 0.75rem;
        padding: 0.65rem 0.75rem;
    }

    .profile-config-selector {
        min-width: 200px;
    }

    .profile-page .tw-tab-panel {
        padding: 1rem;
    }
}


/* ═══════════════════════════════════════════════════════════════════════
   PROFILE PAGE - CONFIG TAB COMPONENTS (Concept A Unification)
   Extends the profile-* design system to config tabs so all 6 tabs
   share a unified visual language.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Config Form Rows ── */
.profile-config-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.profile-config-row:last-child {
    border-bottom: none;
}

.profile-config-label {
    width: 160px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    padding-top: 0.4rem;
}

.profile-config-value {
    flex: 1;
    min-width: 0;
}

.profile-config-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.profile-config-description {
    font-size: 0.82rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

/* ── Checkbox Rows ── */
.profile-checkbox-row {
    display: flex;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
    align-items: flex-start;
}

.profile-checkbox-row:last-child {
    border-bottom: none;
}

.profile-checkbox-row:hover {
    background: #fafbfc;
}

.profile-checkbox-row .form-check-input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.profile-checkbox-content {
    flex: 1;
    min-width: 0;
}

.profile-checkbox-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937;
}

.profile-checkbox-description {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.1rem;
}

/* ── Toggle Rows ── */
.profile-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.profile-toggle-row:last-child {
    border-bottom: none;
}

.profile-toggle-row:hover {
    background: #fafbfc;
}

.profile-toggle-row-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.profile-toggle-row-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937;
}

.profile-toggle-row-description {
    font-size: 0.75rem;
    color: #9ca3af;
}

.profile-toggle-switch {
    position: relative;
    width: 38px;
    height: 20px;
    appearance: none;
    -webkit-appearance: none;
    background: #d1d5db;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.profile-toggle-switch:checked {
    background: var(--theme-brand-primary, #0d9488);
}

.profile-toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.profile-toggle-switch:checked::before {
    transform: translateX(18px);
}

/* ── Addon Items ── */
.profile-addon-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.profile-addon-item:last-child {
    border-bottom: none;
}

.profile-addon-item:hover {
    background: #fafbfc;
}

.profile-addon-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    background: #f0fdfa;
    color: var(--theme-brand-primary, #0d9488);
}

.profile-addon-content {
    flex: 1;
    min-width: 0;
}

.profile-addon-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-addon-description {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.1rem;
}

.profile-addon-toggle {
    flex-shrink: 0;
}

/* ── Info Card ── */
.profile-info-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 3px solid var(--theme-brand-primary, #0d9488);
    border-radius: 0.625rem;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.profile-info-card i:first-child {
    font-size: 1.25rem;
    color: var(--theme-brand-primary, #0d9488);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.profile-info-card-content {
    flex: 1;
    min-width: 0;
}

.profile-info-card-content strong {
    font-size: 0.88rem;
    color: #1f2937;
    display: block;
    margin-bottom: 0.2rem;
}

.profile-info-card-content p {
    font-size: 0.82rem;
    color: #9ca3af;
    margin-bottom: 0;
}

.profile-info-card-content a {
    color: var(--theme-brand-primary, #0d9488);
}

/* ── Preview Bar ── */
.profile-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdfa;
    border: 1px solid #ccfbf1;
    border-radius: 0.5rem;
    padding: 0.65rem 1rem;
    margin-top: 0.5rem;
}

.profile-preview-bar .profile-preview-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #1f2937;
}

.profile-preview-bar .profile-preview-label i {
    color: var(--theme-brand-primary, #0d9488);
}

.profile-preview-bar .profile-preview-label strong {
    font-weight: 600;
}

/* ── Config Actions ── */
.profile-config-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #f3f4f6;
    margin-top: 0.5rem;
}

/* ══════════════════════════════════════════════════════════════════
   PROFILE FORM ROW — Config tab input layout
   Distinct from .profile-field-row (display-only, center-aligned).
   This uses flex-start alignment so labels align with input baselines.
   Structure: .profile-form-row > icon + label + content
   ══════════════════════════════════════════════════════════════════ */

.profile-form-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.profile-form-row:last-child {
    border-bottom: none;
}

.profile-form-row:hover {
    background: #fafbfc;
}

/* Icon square — reuses .profile-field-icon but nudged down to align with inputs */
.profile-form-row .profile-field-icon {
    margin-top: 0.3rem;
}

/* Label column — wide enough for German compound words like RECHNUNGSEINLEITUNG */
.profile-form-label {
    width: 180px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    padding-top: 0.45rem;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* Content column — takes remaining space, capped for readability */
.profile-form-content {
    flex: 1;
    min-width: 0;
    max-width: 560px;
}

/* Form inputs within form rows */
.profile-form-content .form-control,
.profile-form-content .form-select {
    width: 100%;
    font-size: 0.85rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-family: inherit;
    color: #1f2937;
    background: #fff;
    transition: border-color 0.15s ease;
}

.profile-form-content .form-control:focus,
.profile-form-content .form-select:focus {
    border-color: var(--theme-brand-primary, #0d9488);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.1);
    outline: none;
}

textarea.form-control {
    min-height: 72px;
    resize: vertical;
}

/* Hint text below inputs */
.profile-form-hint {
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* ── CRUD Action Bar (select + micro-buttons) ── */
.profile-form-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Select / Tom Select fills remaining space */
.profile-form-actions select,
.profile-form-actions .ts-wrapper {
    flex: 1;
    min-width: 0;
}

.profile-form-actions .ts-wrapper .ts-control {
    font-size: 0.85rem;
    padding: 0.35rem 0.6rem;
    min-height: 0;
}

/* ── Micro-Buttons (icon-only CRUD buttons in form rows) ── */
/* Must fully reset base .btn-profile-action (line ~7501) which sets
   min-width: 40px, padding, font-size, colored backgrounds, etc. */
.profile-form-row .btn-profile-action {
    width: 28px;
    height: 28px;
    min-width: 0;              /* reset base min-width: 40px */
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.3rem;
    background: transparent;
    background-color: transparent;  /* explicit reset of base background-color */
    border: 1px solid transparent;
    color: #c4c9d1;
    font-size: 0;              /* hide text labels */
    font-weight: 400;          /* reset base font-weight: 500 */
    line-height: 1;            /* reset base line-height: 1.5 */
    white-space: normal;       /* reset base white-space: nowrap */
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.profile-form-row .btn-profile-action i {
    font-size: 0.72rem;
    margin: 0;
}

.profile-form-row .btn-profile-action:focus {
    outline: none;
    box-shadow: none;
}

/* All buttons uniform at rest — reset colored base styles */
.profile-form-row .btn-profile-create,
.profile-form-row .btn-profile-edit,
.profile-form-row .btn-profile-duplicate,
.profile-form-row .btn-profile-archive {
    background: transparent;
    background-color: transparent;
    border-color: transparent;
    color: #c4c9d1;
}

/* Hover: tinted micro-backgrounds */
.profile-form-row .btn-profile-create:hover:not(:disabled) {
    background: #dcfce7; color: #16a34a; border-color: transparent;
    transform: none; box-shadow: none;
}
.profile-form-row .btn-profile-edit:hover:not(:disabled) {
    background: #f0fdfa; color: var(--theme-brand-primary, #0d9488); border-color: transparent;
    transform: none; box-shadow: none;
}
.profile-form-row .btn-profile-duplicate:hover:not(:disabled) {
    background: #fef9c3; color: #a16207; border-color: transparent;
    transform: none; box-shadow: none;
}
.profile-form-row .btn-profile-archive:hover:not(:disabled) {
    background: #fee2e2; color: #ef4444; border-color: transparent;
    transform: none; box-shadow: none;
}

.profile-form-row .btn-profile-action:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Badges inside form labels */
.profile-form-label .profile-config-badge {
    font-size: 0.62rem;
    vertical-align: middle;
    margin-left: 0.2rem;
}

/* Direct-child padding when no card-body wraps content */
.profile-card > .profile-config-description {
    padding: 0.75rem 1rem 0;
    margin-bottom: 0.5rem;
}

/* ── Scoped Bootstrap Overrides (within profile-page + profile-card) ── */
.profile-page .profile-card .form-control,
.profile-page .profile-card .form-select {
    font-size: 0.85rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease;
}

.profile-page .profile-card .form-control:focus,
.profile-page .profile-card .form-select:focus {
    border-color: var(--theme-brand-primary, #0d9488);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.1);
}

.profile-page .profile-card .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.profile-page .profile-card h5 {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-brand-primary, #0d9488);
}

.profile-page .profile-card .badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

/* ── Section Spacing within Tabs ── */
.profile-page .tw-tab-panel .profile-card {
    margin-bottom: 1.25rem;
}

.profile-page .tw-tab-panel .profile-section-heading {
    margin-top: 0.5rem;
}

.profile-page .tw-tab-panel .profile-section-heading:first-child {
    margin-top: 0;
}

/* ── AI Table Scroll Wrapper (mobile) ── */
.profile-ai-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Number Inputs: Compact Width ── */
.profile-form-content .form-control-sm-num {
    max-width: 120px;
}

/* ── AI Sub-Heading Spacing ── */
.profile-ai-sub-heading + .profile-ai-recent-chips,
.profile-ai-sub-heading + .profile-ai-table-wrap {
    margin-bottom: 0;
}

.profile-card-body .profile-ai-sub-heading:not(:first-child) {
    margin-top: 1.25rem;
}

/* ── Responsive: Config Tab Components (768px) ── */
@media (max-width: 768px) {
    .profile-config-label {
        width: 100px;
        font-size: 0.72rem;
    }

    .profile-config-row {
        flex-direction: column;
        gap: 0.3rem;
    }

    .profile-config-label {
        width: auto;
        padding-top: 0;
    }

    .profile-addon-item {
        flex-wrap: wrap;
    }

    .profile-toggle-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Config form-rows stack vertically on mobile */
    .profile-form-row {
        flex-direction: column;
        gap: 0.3rem;
    }

    .profile-form-row .profile-field-icon {
        display: none;
    }

    .profile-form-label {
        width: auto;
        padding-top: 0;
    }

    .profile-form-actions {
        flex-wrap: wrap;
    }

    .profile-form-actions select,
    .profile-form-actions .ts-wrapper {
        width: 100%;
        flex: none;
    }

    .profile-info-card {
        flex-wrap: wrap;
    }

    /* AI table: ensure readability on mobile */
    .profile-ai-table {
        font-size: 0.75rem;
    }

    .profile-ai-table thead th,
    .profile-ai-table tbody td {
        padding: 0.4rem 0.5rem;
    }

    /* AI stats: 2-col with smaller padding */
    .profile-ai-stat {
        padding: 0.5rem 0.35rem;
    }

    .profile-ai-stat-number {
        font-size: 0.95rem;
    }

    /* Section heading: allow button to wrap */
    .profile-section-heading {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .profile-section-heading .profile-action-btn {
        margin-left: 0;
    }

    /* Number inputs full width on mobile */
    .profile-form-content .form-control-sm-num {
        max-width: none;
    }
}

/* ═══════════════════════════════════════════════════════════
   ACCOUNT DELETION
   ═══════════════════════════════════════════════════════════ */

/* Danger header styling via :has() — targets the shell .um-header
   when it contains our deletion title class */
.um-header:has(.account-deletion-title) {
    background: var(--danger, #dc3545) !important;
    color: #fff !important;
}

.um-header:has(.account-deletion-title) .um-close {
    color: #fff !important;
    opacity: 0.8;
}

.um-header:has(.account-deletion-title) .um-close:hover {
    opacity: 1;
}

.account-deletion-title {
    color: #fff !important;
}

/* Profile danger zone card */
.profile-section-heading-danger {
    color: var(--danger, #dc3545);
}

.profile-card-danger {
    border: 1px solid var(--danger, #dc3545) !important;
    border-radius: 0.5rem;
}

.profile-card-danger .profile-card-body {
    padding: 1rem 1.25rem;
}

/* Danger button for unified modal footer */
.um-btn-danger {
    background: var(--danger, #dc3545);
    color: #fff;
    border: 1px solid var(--danger, #dc3545);
}

.um-btn-danger:hover {
    background: #bb2d3b;
    border-color: #bb2d3b;
    color: #fff;
}

.um-btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Erase data toggle — override green with danger red when checked */
.account-deletion-content .tw-switch-input:checked + .tw-switch-slider {
    background-color: var(--danger, #dc3545);
}

.account-deletion-content .tw-switch-input:checked ~ .tw-switch-label {
    color: var(--danger, #dc3545);
}

/* ============================================================
   CONTACT PHOTO EXTRACTION
   ============================================================ */

/* --- Step Indicator --- */
.photo-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
}

.photo-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    position: relative;
}

.photo-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color, #dee2e6);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg, #fff);
    transition: all 0.3s ease;
    position: relative;
}

.photo-step-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted, #6c757d);
    transition: color 0.3s ease;
}

.photo-step-check {
    display: none;
    font-size: 0.75rem;
    color: #fff;
}

.photo-step-label {
    font-size: 0.7rem;
    color: var(--text-muted, #6c757d);
    font-weight: 500;
    transition: color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.photo-step-line {
    flex: 1;
    height: 2px;
    background: var(--border-color, #dee2e6);
    margin: 0 0.5rem;
    margin-bottom: 1.2rem;
    transition: background 0.3s ease;
    min-width: 40px;
}

/* Active step */
.photo-step.active .photo-step-circle {
    border-color: #2563eb;
    background: #2563eb;
}

.photo-step.active .photo-step-number {
    color: #fff;
}

.photo-step.active .photo-step-label {
    color: var(--text-color, #212529);
    font-weight: 600;
}

/* Completed step */
.photo-step.completed .photo-step-circle {
    border-color: #059669;
    background: #059669;
}

.photo-step.completed .photo-step-number {
    display: none;
}

.photo-step.completed .photo-step-check {
    display: block;
}

.photo-step.completed .photo-step-label {
    color: #059669;
}

.photo-step-line.completed {
    background: #059669;
}

/* --- Dropzone (unified, full width) --- */
.contact-photo-dropzone {
    border: 2px dashed var(--border-color, #dee2e6);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02) 0%, rgba(118, 75, 162, 0.02) 100%);
}

.contact-photo-dropzone.dragover {
    border-color: #2563eb;
    background-color: rgba(37, 99, 235, 0.06);
}

.photo-dropzone-heading {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-color, #212529);
}

.photo-dropzone-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.tw-btn-outline {
    background: transparent;
    border: 1px solid var(--border-color, #dee2e6);
    color: var(--text-color, #212529);
    cursor: pointer;
}

.tw-btn-outline:hover {
    background: var(--hover-bg, rgba(0,0,0,0.04));
    border-color: var(--text-muted, #6c757d);
}

/* --- Preview state (replaces dropzone content) --- */
.contact-photo-preview-state {
    text-align: center;
}

.photo-preview-image-wrap {
    display: inline-block;
    position: relative;
}

.contact-photo-preview {
    max-width: 100%;
    max-height: 250px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color, #dee2e6);
}

.photo-change-btn {
    background: none;
    border: none;
    color: var(--text-muted, #6c757d);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem 0;
    transition: color 0.2s;
}

.photo-change-btn:hover {
    color: var(--primary, #667eea);
}

/* .photo-extract-btn-full removed — button now lives in um-footer */

/* --- Loading / Scanning Animation --- */
.photo-loading-container {
    text-align: center;
    padding: 1.5rem 0;
}

.photo-scan-image-wrap {
    display: inline-block;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.photo-scan-image-wrap .contact-photo-preview {
    display: block;
    border-radius: 10px;
    box-shadow: none;
    border: none;
}

.photo-scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.6) 0%, rgba(37, 99, 235, 0) 100%);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
    animation: photoScanLine 2s ease-in-out infinite;
}

@keyframes photoScanLine {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: calc(100% - 4px); opacity: 0; }
}

.photo-loading-status {
    margin-top: 1rem;
    color: var(--text-muted, #6c757d);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.photo-loading-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.photo-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2563eb;
    animation: photoLoadingPulse 1.4s ease-in-out infinite;
}

.photo-loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.photo-loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes photoLoadingPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* --- Results: Contact Card --- */
.photo-result-card {
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg, #fff);
}

.photo-result-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.photo-result-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.photo-result-name-block {
    flex: 1;
    min-width: 0;
}

.photo-result-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color, #212529);
    line-height: 1.3;
}

.photo-result-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted, #6c757d);
    line-height: 1.3;
}

/* --- Results: Grouped Fields --- */
.photo-result-fields {
    padding: 0.5rem 0;
}

.photo-result-field {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    transition: background 0.15s;
}

.photo-result-field:hover {
    background: var(--hover-bg, rgba(0,0,0,0.02));
}

.photo-result-field-icon {
    width: 20px;
    text-align: center;
    color: var(--text-muted, #6c757d);
    padding-top: 2px;
    flex-shrink: 0;
}

.photo-result-field-content {
    flex: 1;
    min-width: 0;
}

.photo-result-field-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6c757d);
    margin-bottom: 0.1rem;
}

.photo-result-field-value {
    font-size: 0.9rem;
    color: var(--text-color, #212529);
    word-break: break-word;
}

/* --- Results: Duplicates Card --- */
.photo-duplicates-card {
    border: 1px solid #f59e0b33;
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-bg, #fff);
}

.photo-duplicates-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #92400e;
    padding: 0.6rem 1rem;
    background: #fef3c7;
    border-bottom: 1px solid #f59e0b33;
}

.photo-duplicate-row {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
    transition: background 0.15s;
}

.photo-duplicate-row:last-child {
    border-bottom: none;
}

.photo-duplicate-row:hover {
    background: var(--hover-bg, rgba(0,0,0,0.02));
}

.photo-duplicate-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-color, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6c757d);
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.photo-duplicate-info {
    flex: 1;
    min-width: 0;
}

.photo-duplicate-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color, #212529);
}

.photo-duplicate-meta {
    font-size: 0.75rem;
    color: var(--text-muted, #6c757d);
}

.photo-duplicate-action {
    flex-shrink: 0;
}

/* --- Photo Merge Preview --- */
.photo-merge-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 8px;
    margin-bottom: 16px;
}
.photo-merge-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color, #4f46e5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}
.photo-merge-header-name {
    font-weight: 600;
    font-size: 15px;
}
.photo-merge-header-subtitle {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
}
.photo-merge-section {
    margin-bottom: 16px;
}
.photo-merge-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #6b7280);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.photo-merge-row {
    display: grid;
    grid-template-columns: 100px 1fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color-light, #f3f4f6);
}
.photo-merge-row:last-child {
    border-bottom: none;
}
.photo-merge-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted, #6b7280);
}
.photo-merge-existing,
.photo-merge-extracted {
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    min-height: 32px;
    display: flex;
    align-items: center;
    word-break: break-word;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.15s, border-color 0.15s, background 0.15s;
    border: 2px solid transparent;
    position: relative;
}
.photo-merge-existing {
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-secondary, #4b5563);
}
.photo-merge-extracted {
    background: #eff6ff;
    color: #1e40af;
}
/* Selected state — highlighted border + checkmark */
.photo-merge-existing.photo-merge-selected,
.photo-merge-extracted.photo-merge-selected {
    border-color: var(--primary-color, #4f46e5);
    background: rgba(79, 70, 229, 0.06);
}
.photo-merge-existing.photo-merge-selected::after,
.photo-merge-extracted.photo-merge-selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 9px;
    position: absolute;
    top: 3px;
    right: 5px;
    color: var(--primary-color, #4f46e5);
    opacity: 0.7;
}
/* Dimmed state — unselected */
.photo-merge-existing.photo-merge-dimmed,
.photo-merge-extracted.photo-merge-dimmed {
    opacity: 0.4;
    border-color: transparent;
}
.photo-merge-existing:hover,
.photo-merge-extracted:hover {
    border-color: var(--primary-color, #4f46e5);
    opacity: 1;
}
/* Array merge items */
.photo-merge-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.photo-merge-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #e5e7eb);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.15s, border-color 0.15s;
    border-left: 3px solid transparent;
}
.photo-merge-item.is-new {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-left-color: transparent;
}
.photo-merge-item.is-selected {
    border-left-color: var(--primary-color, #4f46e5);
}
.photo-merge-item.is-deselected {
    opacity: 0.4;
    border-left-color: transparent;
}
.photo-merge-item.is-deselected .photo-merge-item-value {
    text-decoration: line-through;
}
.photo-merge-item:hover {
    opacity: 1;
}
.photo-merge-item-value {
    flex: 1;
    word-break: break-word;
}
.photo-merge-badge-new,
.photo-merge-badge-exists {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.photo-merge-badge-new {
    background: #dbeafe;
    color: #1d4ed8;
}
.photo-merge-badge-exists {
    background: #e5e7eb;
    color: #6b7280;
}
.photo-merge-empty {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    font-style: italic;
    padding: 8px 0;
}
@media (max-width: 576px) {
    .photo-merge-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .photo-merge-label {
        font-weight: 600;
    }
    .photo-merge-existing::before {
        content: 'Aktuell: ';
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--text-muted, #6b7280);
    }
    .photo-merge-extracted::before {
        content: 'Neu: ';
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        color: #1e40af;
    }
    .photo-merge-item {
        min-height: 44px;
    }
    .photo-merge-existing,
    .photo-merge-extracted {
        min-height: 44px;
    }
}

/* --- Product Document Extraction Results --- */
.product-doc-results-table {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
}
.product-doc-header-row {
    display: flex;
    background: var(--bg-secondary, #f8f9fa);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6b7280);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.product-doc-row {
    display: flex;
    border-bottom: 1px solid var(--border-color-light, #f3f4f6);
    transition: background 0.15s;
}
.product-doc-row:last-child {
    border-bottom: none;
}
.product-doc-row:hover {
    background: var(--hover-bg, rgba(0,0,0,0.02));
}
.product-doc-cell {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    min-width: 0;
}
.product-doc-checkbox-cell {
    flex: 0 0 36px;
    justify-content: center;
}
.product-doc-editable {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.15s, background 0.15s;
}
.product-doc-editable:focus {
    border-color: var(--primary-color, #4f46e5);
    background: #fff;
    outline: none;
}
.product-doc-editable:hover {
    border-color: var(--border-color, #e5e7eb);
    background: #fff;
}
@media (max-width: 768px) {
    .product-doc-header-row {
        display: none;
    }
    .product-doc-row {
        flex-wrap: wrap;
        padding: 8px;
        gap: 4px;
    }
    .product-doc-cell {
        flex: 1 1 45% !important;
    }
    .product-doc-checkbox-cell {
        flex: 0 0 100% !important;
    }
    .product-doc-editable {
        border-color: var(--border-color, #e5e7eb);
        background: #fff;
    }
}

/* ====================================================================
   ADMIN MESSAGE — TABBED WORKSPACE (Concept C)
   ==================================================================== */

/* Workspace Container */
.admin-msg-workspace {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Header */
.admin-msg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.admin-msg-header h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1c1917;
    margin: 0;
}
.admin-msg-save-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    background: #f59e0b;
    color: #1c1917;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.15s;
}
.admin-msg-save-btn:hover {
    background: #fbbf24;
    color: #1c1917;
}

/* Tab Bar */
.admin-msg-tab-bar {
    display: flex;
    border-bottom: 2px solid #e7e5e4;
    margin-bottom: 0;
}
.admin-msg-tab-btn {
    padding: 0.625rem 1.5rem;
    border: none;
    background: transparent;
    color: #78716c;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    position: relative;
    transition: color 0.2s;
}
.admin-msg-tab-btn:hover {
    color: #1c1917;
}
.admin-msg-tab-btn.active {
    color: #1c1917;
}
.admin-msg-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #f59e0b;
}
.admin-msg-tab-btn .admin-msg-tab-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    color: #a8a29e;
    margin-top: 1px;
    font-family: monospace;
}
.admin-msg-tab-btn.active .admin-msg-tab-label {
    color: #f59e0b;
}

/* Tab Content */
.admin-msg-tab-content {
    display: none;
    padding: 1.5rem 0;
}
.admin-msg-tab-content.active {
    display: block;
}

/* Panels */
.admin-msg-panel {
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e7e5e4;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.admin-msg-panel-title {
    font-family: monospace;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #a8a29e;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Content Grid (DE/EN side by side) */
.admin-msg-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .admin-msg-content-grid {
        grid-template-columns: 1fr;
    }
}

/* Language Badges */
.admin-msg-lang-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.1875rem;
    font-family: monospace;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}
.admin-msg-lang-badge.de {
    background: #fef3c7;
    color: #92400e;
}
.admin-msg-lang-badge.en {
    background: #dbeafe;
    color: #1e40af;
}

/* Config Grid (4 columns for settings) */
.admin-msg-config-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: end;
}
@media (max-width: 768px) {
    .admin-msg-config-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
.admin-msg-config-grid .form-group {
    margin-bottom: 0;
}

/* Toggle Wrapper */
.admin-msg-toggle-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}
.admin-msg-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    background: #fafaf9;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    border: 1px solid #f5f5f4;
}
.admin-msg-toggle-row span {
    font-size: 0.8125rem;
    color: #44403c;
    font-weight: 500;
}

/* Template Loader */
.admin-msg-template-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.admin-msg-template-row .ts-wrapper {
    flex: 1;
    min-width: 200px;
}
.admin-msg-load-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Preview Split */
.admin-msg-preview-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .admin-msg-preview-split {
        grid-template-columns: 1fr;
    }
}
.admin-msg-preview-label {
    font-family: monospace;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #a8a29e;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* Preview Card */
.admin-msg-preview-card {
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e7e5e4;
    overflow: hidden;
    max-height: 500px;
    overflow-y: auto;
}
.admin-msg-preview-card .um-header {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
}
.admin-msg-preview-card .um-body {
    padding: 1rem;
}
.admin-msg-preview-card .um-footer {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Consent fields conditional visibility */
#admin-msg-consent-fields {
    margin-top: 0.625rem;
    padding: 0.875rem;
    background: #fffbeb;
    border-radius: 0.375rem;
    border: 1px solid #fde68a;
}

/* Bottom save bar */
.admin-msg-bottom-actions {
    display: flex;
    justify-content: space-between;
    padding-top: 0.5rem;
}


/* ═══════════════════════════════════════════════════════════════════════════
   CONTACT SYNC CENTER
   Dense power-user sync tool with source tabs, alphabet rail, cloud fetching
   ═══════════════════════════════════════════════════════════════════════════ */

/* Full-bleed: break out of Bootstrap container */
.container.tw-main-container:has(> .sc-page) {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.sc-page {
    margin: -1rem 0 0;
    min-height: calc(100vh - 64px);
    background: #f4f3ef;
    display: flex;
    flex-direction: column;
}

/* ── Compact header ── */
.sc-header {
    background: #1a1a1f;
    padding: 20px 32px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-shrink: 0;
}
.sc-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.sc-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(212,175,55,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4af37;
    font-size: 15px;
    flex-shrink: 0;
}
.sc-header-text h1 {
    font-family: 'Sora', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #f0ede6;
    letter-spacing: -.3px;
    margin: 0;
    line-height: 1.3;
}
.sc-header-text p {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    color: #5a5a60;
    margin: 1px 0 0;
}
.sc-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.sc-hdr-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    color: #88888e;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.07);
    text-decoration: none;
    transition: all .15s;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
}
.sc-hdr-btn:hover {
    color: #e0ddd6;
    background: rgba(255,255,255,.1);
    text-decoration: none;
}
.sc-hdr-btn.gold {
    color: #d4af37;
    border-color: rgba(212,175,55,.25);
    background: rgba(212,175,55,.08);
}
.sc-hdr-btn.gold:hover {
    background: rgba(212,175,55,.15);
}

/* ── Source pills ── */
.sc-sources {
    background: #1a1a1f;
    padding: 0 32px 0;
    display: flex;
    gap: 6px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    overflow-x: auto;
    flex-shrink: 0;
}
.sc-src-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 8px 8px 0 0;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #5a5a60;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    position: relative;
}
.sc-src-pill:hover { color: #a0a0a6; }
.sc-src-pill.active {
    color: #f0ede6;
    background: #28282e;
}
.sc-src-pill.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 2px;
    background: #d4af37;
    border-radius: 2px 2px 0 0;
}
.sc-src-pill i {
    font-size: 13px;
    opacity: .7;
}
.sc-src-pill.active i { opacity: 1; }
.sc-src-pill .pill-icon-puggle { color: #d4af37; }
.sc-src-pill .pill-icon-ms { color: #00a4ef; }
.sc-src-pill .pill-icon-google { color: #ea4335; }
.sc-src-pill .pill-icon-apple { color: #a2aaad; }

/* ── Toolbar (sticky) ── */
.sc-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 32px;
    background: #fff;
    border-bottom: 1px solid #e8e5df;
    position: sticky;
    top: 0;
    z-index: 20;
    flex-shrink: 0;
}
.sc-search {
    position: relative;
    width: 280px;
}
.sc-search i.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #c5c3be;
    font-size: 12px;
    pointer-events: none;
}
.sc-search input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    border: 1px solid #e0ded9;
    border-radius: 6px;
    font-size: 12.5px;
    font-family: 'Outfit', sans-serif;
    color: #2a2a2e;
    background: #faf9f7;
    transition: all .15s;
}
.sc-search input:focus {
    outline: none;
    border-color: #c5b47a;
    box-shadow: 0 0 0 2px rgba(212,175,55,.08);
    background: #fff;
}
.sc-search input::placeholder { color: #c5c3be; }

.sc-sel {
    padding: 7px 28px 7px 10px;
    border: 1px solid #e0ded9;
    border-radius: 6px;
    font-size: 12.5px;
    font-family: 'Outfit', sans-serif;
    color: #555;
    background: #faf9f7;
    cursor: pointer;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.sc-sel:focus { outline: none; border-color: #c5b47a; }

.sc-toolbar-sep {
    width: 1px;
    height: 20px;
    background: #eae8e3;
    flex-shrink: 0;
}
.sc-toolbar-count {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    color: #aaa;
    margin-left: auto;
    white-space: nowrap;
}
.sc-toolbar-count b { color: #666; font-weight: 600; }
.sc-btn-clear {
    width: 28px; height: 28px; border: none; border-radius: 5px;
    background: transparent; color: #ccc; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; transition: all .12s;
}
.sc-btn-clear:hover { background: #f0efec; color: #888; }

/* ── Main layout: alphabet rail + table ── */
.sc-main {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Alphabet rail */
.sc-alpha-rail {
    width: 28px;
    background: #eceae5;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 1px;
    overflow-y: auto;
    flex-shrink: 0;
    border-right: 1px solid #e0ded9;
}
.sc-alpha-letter {
    width: 22px;
    height: 20px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #999;
    font-family: 'Sora', sans-serif;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .1s;
    padding: 0;
}
.sc-alpha-letter:hover {
    background: #ddd9d2;
    color: #555;
}
.sc-alpha-letter.has-items {
    color: #666;
}
.sc-alpha-letter.active {
    background: #d4af37;
    color: #fff;
}

/* Table area */
.sc-table-wrap {
    flex: 1;
    overflow-y: auto;
    min-width: 0;
}

/* ── Contact rows (dense table) ── */
.sc-letter-group {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 6px 20px;
    background: #eceae5;
    font-family: 'Sora', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    letter-spacing: .5px;
    text-transform: uppercase;
    border-bottom: 1px solid #e0ded9;
}

.sc-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 20px;
    height: 48px;
    border-bottom: 1px solid #f0efec;
    background: #fff;
    transition: background .1s;
}
.sc-row:hover {
    background: #fdfcfa;
}
.sc-row.sc-row-dragging {
    opacity: 0.5;
    background: #fef9e7;
}
.sc-row.sc-row-dragover {
    background: #fef3c7;
    border-top: 2px solid #d4af37;
}

/* Row cells */
.sc-row-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 11px;
    color: #fff;
    flex-shrink: 0;
    margin-right: 12px;
    background: #3a3a3f;
}
.sc-row-avatar.t-company {
    border-radius: 7px;
    background: #b8962e;
}
.sc-row-avatar.t-department {
    border-radius: 7px;
    background: #6366f1;
}

.sc-row-name {
    width: 220px;
    min-width: 140px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: #1a1a1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 12px;
    flex-shrink: 0;
    cursor: pointer;
}
.sc-row-name:hover { color: #b8962e; }

.sc-row-email {
    flex: 1;
    min-width: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 12px;
}
.sc-row-email i { font-size: 10px; margin-right: 4px; color: #ccc; }

.sc-row-phone {
    width: 140px;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 12px;
    flex-shrink: 0;
}
.sc-row-phone i { font-size: 10px; margin-right: 4px; color: #ccc; }

.sc-row-type {
    width: 70px;
    flex-shrink: 0;
    padding-right: 12px;
}
.sc-type-tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    background: #f0efec;
    color: #999;
}
.sc-type-tag.t-company { background: #fef3c7; color: #92400e; }
.sc-type-tag.t-department { background: #e0e7ff; color: #3730a3; }
.sc-type-tag.t-motiv { background: #fce7f3; color: #9d174d; }

/* Cloud link indicators */
.sc-row-cloud-links {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-shrink: 0;
    padding-right: 8px;
    min-width: 28px;
}
.sc-cloud-link-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    background: #f0efec;
    color: #999;
}
.sc-cloud-link-icon.provider-microsoft { background: #e8f4fd; color: #00a4ef; }
.sc-cloud-link-icon.provider-google { background: #fce8e6; color: #ea4335; }
.sc-cloud-link-icon.provider-icloud { background: #f0f0f0; color: #555; }

/* Cloud status badge */
.sc-cloud-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.sc-cloud-badge.linked {
    background: #d1fae5;
    color: #065f46;
}
.sc-cloud-badge.cloud-only {
    background: #f0efec;
    color: #888;
}
.sc-cloud-badge i {
    font-size: 8px;
}

/* Row actions — always visible, right-aligned */
.sc-row-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    margin-left: auto;
    position: relative;
}
.sc-act {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all .12s;
    position: relative;
}
.sc-act:hover { background: #f0efec; color: #666; }
.sc-act-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.sc-act.gold:hover { background: rgba(212,175,55,.1); color: #b8962e; }
.sc-act.green:hover { background: rgba(16,185,129,.1); color: #059669; }
.sc-act.blue:hover { background: rgba(59,130,246,.1); color: #2563eb; }
.sc-act.red:hover { background: rgba(239,68,68,.1); color: #dc2626; }

/* Action dropdown */
.sc-act-dd {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid #e8e5df;
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0,0,0,.1);
    z-index: 100;
    display: none;
    overflow: hidden;
    padding: 4px;
}
.sc-act-dd.show { display: block; }
.sc-act-dd-hd {
    padding: 6px 10px 3px;
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: #bbb;
}
.sc-act-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 12.5px;
    color: #444;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 5px;
    transition: background .08s;
    font-family: 'Outfit', sans-serif;
}
.sc-act-dd-item:hover { background: #f8f7f4; }
.sc-act-dd-item i { width: 16px; text-align: center; font-size: 12px; }
.sc-act-dd-item .fa-microsoft { color: #00a4ef; }
.sc-act-dd-item .fa-google { color: #ea4335; }
.sc-act-dd-item .fa-apple { color: #555; }
.sc-act-dd-item .fa-database { color: #d4af37; }

/* ── Empty state ── */
.sc-empty {
    padding: 80px 20px;
    text-align: center;
}
.sc-empty-icon {
    width: 52px; height: 52px; margin: 0 auto 14px;
    border-radius: 14px; background: #eae8e3;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #c5c3be;
}
.sc-empty p { font-family: 'Outfit', sans-serif; font-size: 13px; color: #aaa; }

/* ── Error state ── */
.sc-error {
    padding: 60px 20px;
    text-align: center;
}
.sc-error-icon {
    width: 52px; height: 52px; margin: 0 auto 14px;
    border-radius: 14px; background: #fef2f2;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #ef4444;
}
.sc-error p { font-family: 'Outfit', sans-serif; font-size: 13px; color: #888; }
.sc-error p b { color: #444; }
.sc-error-retry {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 12px; padding: 7px 16px; border: 1px solid #e0ded9;
    border-radius: 6px; background: #fff; color: #888; font-size: 12px;
    font-family: 'Outfit', sans-serif; cursor: pointer; transition: all .15s;
}
.sc-error-retry:hover { border-color: #d4af37; color: #b8962e; }

/* ── Loading skeleton ── */
.sc-skeleton-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 20px;
    height: 48px;
    border-bottom: 1px solid #f0efec;
    background: #fff;
}
.sc-skeleton-pulse {
    background: linear-gradient(90deg, #f0efec 25%, #e8e5df 50%, #f0efec 75%);
    background-size: 200% 100%;
    animation: scSkeletonPulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}
@keyframes scSkeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.sc-skeleton-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    margin-right: 12px; flex-shrink: 0;
}
.sc-skeleton-text {
    height: 12px; border-radius: 4px;
}
.sc-skeleton-text.w-name { width: 160px; margin-right: 24px; }
.sc-skeleton-text.w-email { width: 200px; margin-right: 24px; flex: 1; }
.sc-skeleton-text.w-phone { width: 100px; margin-right: 24px; }
.sc-skeleton-text.w-badge { width: 50px; }

/* ── Load more ── */
.sc-load-more {
    text-align: center;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #f0efec;
}
.sc-load-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 20px; border: 1px solid #e0ded9; border-radius: 6px;
    background: #fff; color: #888; font-size: 12px;
    font-family: 'Outfit', sans-serif; cursor: pointer; transition: all .15s;
}
.sc-load-btn:hover { border-color: #d4af37; color: #b8962e; }

/* ── Visit Card Modal ── */
.vc-overlay {
    position: fixed; inset: 0;
    background: rgba(10,10,12,.55);
    backdrop-filter: blur(3px);
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.vc-overlay.show { display: flex; }

.vc-card {
    width: 400px; max-width: 100%; max-height: 90vh;
    overflow-y: auto; border-radius: 14px;
    position: relative;
    box-shadow: 0 24px 64px rgba(0,0,0,.3);
    animation: vcIn .25s cubic-bezier(.16,1,.3,1);
}
@keyframes vcIn {
    from { opacity: 0; transform: translateY(16px) scale(.98); }
    to { opacity: 1; transform: none; }
}
.vc-controls {
    position: absolute; top: 12px; right: 12px;
    display: flex; gap: 3px; z-index: 2;
}
.vc-ctrl {
    width: 28px; height: 28px; border: none; border-radius: 6px;
    background: rgba(255,255,255,.08); color: #78787e;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; font-size: 11px; transition: all .12s;
}
.vc-ctrl:hover { background: rgba(255,255,255,.15); color: #f0ede6; }

.vc-top {
    background: #1a1a1f; padding: 28px 28px 20px;
    border-radius: 14px 14px 0 0; position: relative; overflow: hidden;
}
.vc-top::after {
    content: '';
    position: absolute; top: -40%; right: -15%;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(212,175,55,.06) 0%, transparent 70%);
    pointer-events: none;
}
.vc-av {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Sora', sans-serif; font-weight: 700; font-size: 17px;
    color: #1a1a1f; background: #d4af37;
    margin-bottom: 14px; position: relative; z-index: 1;
}
.vc-av.co { border-radius: 12px; }
.vc-nm {
    font-family: 'Sora', sans-serif; font-size: 18px; font-weight: 700;
    color: #f0ede6; letter-spacing: -.3px; line-height: 1.3;
}
.vc-role {
    font-family: 'Outfit', sans-serif; font-size: 12.5px;
    color: #6a6a70; margin-top: 3px;
}
.vc-pill {
    display: inline-block; padding: 2px 9px; border-radius: 5px;
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .6px; background: rgba(212,175,55,.1);
    color: #d4af37; margin-top: 8px; font-family: 'Outfit', sans-serif;
}

.vc-body { background: #fff; padding: 20px 28px 28px; border-radius: 0 0 14px 14px; }
.vc-sec { margin-bottom: 16px; }
.vc-sec:last-child { margin-bottom: 0; }
.vc-sec-hd {
    font-family: 'Outfit', sans-serif; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .7px; color: #c5c3be;
    margin-bottom: 6px;
}
.vc-f {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 4px 0; font-family: 'Outfit', sans-serif;
    font-size: 13px; color: #3a3a3f; line-height: 1.5;
}
.vc-f i { width: 14px; text-align: center; color: #d4af37; margin-top: 3px; flex-shrink: 0; font-size: 11px; }
.vc-f-type { font-size: 10.5px; color: #c5c3be; margin-left: 3px; }
.vc-f-empty { color: #ccc; justify-content: center; padding: 16px 0; }
.vc-f-empty i { color: #ddd; }

/* ── Link search modal ── */
.sc-link-search-overlay {
    position: fixed; inset: 0;
    background: rgba(10,10,12,.55);
    backdrop-filter: blur(3px);
    z-index: 1060;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.sc-link-search-overlay.show { display: flex; }
.sc-link-search-card {
    width: 480px; max-width: 100%; max-height: 80vh;
    background: #fff; border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0,0,0,.3);
    animation: vcIn .25s cubic-bezier(.16,1,.3,1);
    overflow: hidden; display: flex; flex-direction: column;
}
.sc-link-search-header {
    padding: 16px 20px; background: #1a1a1f;
    display: flex; align-items: center; justify-content: space-between;
}
.sc-link-search-header h3 {
    font-family: 'Sora', sans-serif; font-size: 14px;
    font-weight: 700; color: #f0ede6; margin: 0;
}
.sc-link-search-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.sc-link-search-input {
    width: 100%; padding: 8px 12px; border: 1px solid #e0ded9;
    border-radius: 6px; font-size: 13px; font-family: 'Outfit', sans-serif;
    margin-bottom: 12px;
}
.sc-link-search-input:focus { outline: none; border-color: #c5b47a; }
.sc-link-search-results { max-height: 300px; overflow-y: auto; }
.sc-link-search-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 6px; cursor: pointer;
    transition: background .1s; border: none; background: none;
    width: 100%; text-align: left;
}
.sc-link-search-item:hover { background: #f8f7f4; }
.sc-link-search-item-name {
    font-family: 'Outfit', sans-serif; font-weight: 600;
    font-size: 13px; color: #1a1a1f;
}
.sc-link-search-item-email {
    font-family: 'Outfit', sans-serif; font-size: 11px; color: #888;
}

/* ─── Feature Request Vote Button ─────────────────────────────────────── */
.feature-vote-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 8px 4px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.85rem;
    line-height: 1;
    gap: 2px;
}
.feature-vote-btn:hover {
    border-color: #e74c6f;
    color: #e74c6f;
    background: #fff5f7;
}
.feature-vote-btn.voted {
    border-color: #e74c6f;
    color: #e74c6f;
    background: #fff5f7;
}
.feature-vote-btn i { font-size: 1.1rem; }

/* ── Sync status left borders ── */
.sc-row-status-synced { border-left: 3px solid #22c55e; }
.sc-row-status-conflict { border-left: 3px solid #f59e0b; }
.sc-row-status-failed { border-left: 3px solid #ef4444; }
.sc-row-status-pending { border-left: 3px solid #3b82f6; }
.sc-row-status-unlinked { border-left: 3px solid #d1d5db; }
.sc-row-status-mixed { border-left: 3px solid #8b5cf6; }

/* ── Conflict badge ── */
.sc-conflict-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: #fef3c7; color: #92400e;
    font-size: 10px; font-weight: 700; font-family: 'Outfit', sans-serif;
    cursor: pointer; transition: all .15s; margin-left: 4px;
}
.sc-conflict-badge:hover { background: #fde68a; }

/* ── Row checkbox ── */
.sc-row-check {
    width: 16px; height: 16px; margin-right: 8px; flex-shrink: 0;
    accent-color: #d4af37; cursor: pointer;
}
.sc-select-all {
    width: 16px; height: 16px; margin-right: 10px; flex-shrink: 0;
    accent-color: #d4af37; cursor: pointer;
}

/* ── Retry action (orange) ── */
.sc-act-retry { color: #f59e0b !important; }
.sc-act-retry:hover { color: #d97706 !important; }

/* ── Status filter chips in toolbar ── */
.sc-status-chip {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600; font-family: 'Outfit', sans-serif;
    white-space: nowrap; margin-right: 4px;
}
.sc-status-chip.conflict { background: #fef3c7; color: #92400e; }
.sc-status-chip.failed { background: #fee2e2; color: #991b1b; }

/* ── Header dropdown for cloud actions ── */
.sc-hdr-dropdown { position: relative; display: inline-block; }
.sc-hdr-dropdown .sc-hdr-dd {
    top: 100%; right: 0; left: auto; min-width: 180px; margin-top: 4px;
}

/* ── Floating bulk action bar ── */
.sc-bulk-bar {
    display: none; align-items: center; gap: 8px;
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    padding: 10px 18px; border-radius: 12px;
    background: #1a1a1f; color: #f0ede6;
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    font-family: 'Outfit', sans-serif; font-size: 13px;
    z-index: 1040; animation: scBulkIn .2s ease;
}
.sc-bulk-bar.show { display: flex; }
@keyframes scBulkIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.sc-bulk-count {
    font-weight: 600; margin-right: 4px; color: #d4af37;
}
.sc-bulk-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px; background: transparent; color: #f0ede6;
    font-size: 12px; font-family: 'Outfit', sans-serif;
    cursor: pointer; transition: all .15s;
}
.sc-bulk-btn:hover { background: rgba(255,255,255,.1); border-color: #d4af37; }
.sc-bulk-btn i { font-size: 11px; }
.sc-bulk-close {
    width: 28px; height: 28px; border: none; border-radius: 6px;
    background: rgba(255,255,255,.08); color: #78787e;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; font-size: 12px; transition: all .12s;
    margin-left: 4px;
}
.sc-bulk-close:hover { background: rgba(255,255,255,.15); color: #ef4444; }

/* ── Account picker overlay ── */
.sc-account-picker-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(10,10,12,.4); backdrop-filter: blur(2px);
    z-index: 1060; align-items: center; justify-content: center;
}
.sc-account-picker-overlay.show { display: flex; }
.sc-account-picker-card {
    background: #fff; border-radius: 12px; padding: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,.2); min-width: 260px;
}
.sc-account-picker-title {
    font-family: 'Sora', sans-serif; font-size: 13px; font-weight: 600;
    color: #444; margin-bottom: 10px;
}
.sc-account-picker-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 12px; border: 1px solid #e0ded9; border-radius: 8px;
    background: #fff; color: #444; font-size: 13px;
    font-family: 'Outfit', sans-serif; cursor: pointer;
    transition: all .12s; margin-bottom: 6px;
}
.sc-account-picker-item:last-child { margin-bottom: 0; }
.sc-account-picker-item:hover { border-color: #d4af37; background: #fdfcfa; }
.sc-account-picker-item i { font-size: 14px; width: 18px; text-align: center; }
.sc-account-picker-item .fa-microsoft { color: #00a4ef; }
.sc-account-picker-item .fa-google { color: #ea4335; }
.sc-account-picker-item .fa-apple { color: #555; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .sc-row-phone { display: none; }
    .sc-row-type { display: none; }
    .sc-row-cloud-links { display: none; }
    .sc-row-name { width: 160px; }
    .sc-alpha-rail { display: none; }
}
@media (max-width: 600px) {
    .sc-header { padding: 14px 16px 10px; flex-wrap: wrap; }
    .sc-sources { padding: 0 16px; }
    .sc-toolbar { padding: 8px 16px; flex-wrap: wrap; }
    .sc-search { width: 100%; }
    .sc-row { padding: 0 12px; height: 44px; }
    .sc-row-name { width: 120px; min-width: 100px; font-size: 12px; }
    .sc-row-email { font-size: 11px; }
    .sc-letter-group { padding: 5px 12px; }
    .vc-card { width: 100%; }
    .sc-bulk-bar { left: 12px; right: 12px; transform: none; }
    .sc-status-chip { display: none; }
}

/* ==========================================================================
   Die Presse - Info Popup
   ========================================================================== */
.info-trigger {
    cursor: pointer;
    color: #6366f1;
    font-size: 0.85rem;
    margin-left: 0.35rem;
    position: relative;
}
.info-trigger:hover {
    color: #4f46e5;
}
.info-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
    width: max-content;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    text-align: left;
}
.info-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
}
.info-popup.active {
    display: block;
}

/* === FotoLedger Add-On === */
.fotoledger-page {
    min-height: calc(100vh - 67px);
    display: flex;
    flex-direction: column;
}
.fotoledger-body {
    padding: 1.5rem;
    flex: 1;
}
.fotoledger-accordion .contact-accordion-section.fotoledger-invoice { border-color: #4f6ef7; }
.fotoledger-accordion .contact-accordion-section.fotoledger-invoice:hover { border-color: #3b5de7; }
.fotoledger-accordion .contact-accordion-section.fotoledger-invoice .acc-icon { color: #4f6ef7; }
.fotoledger-accordion .contact-accordion-section.fotoledger-item { border-color: #6b7280; }
.fotoledger-accordion .contact-accordion-section.fotoledger-item:hover { border-color: #4b5563; }
.fotoledger-accordion .contact-accordion-section.fotoledger-item .acc-icon { color: #6b7280; }
.fotoledger-type-toggle {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}
.fotoledger-type-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
}
.fotoledger-type-btn:hover {
    color: #374151;
}
.fotoledger-type-btn.active {
    background: #fff;
    color: #1f2937;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.fotoledger-footer-bar {
    position: sticky;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #e4e6eb;
    padding: 0.7rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding-left: calc(50vw - 50%);
    padding-right: calc(50vw - 50%);
}
.fotoledger-footer-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.fotoledger-footer-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.fotoledger-footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.3;
    font-family: inherit;
}
.fotoledger-footer-btn i { font-size: 0.85rem; }
.fotoledger-footer-btn-primary {
    background: #4f6ef7;
    color: #fff;
    border-color: #4f6ef7;
}
.fotoledger-footer-btn-primary:hover { background: #3b58d4; border-color: #3b58d4; color: #fff; text-decoration: none; }
.fotoledger-footer-btn-ghost {
    background: transparent;
    color: #5f6474;
    border: 1px solid #e4e6eb;
}
.fotoledger-footer-btn-ghost:hover { background: #eeeff4; color: #16171d; text-decoration: none; }
@media (max-width: 768px) {
    .fotoledger-body { padding: 1rem; }
    .fotoledger-footer-bar { padding: 0.6rem 1rem; }
    .fotoledger-footer-btn { padding: 0.4rem 0.55rem; }
    .fotoledger-footer-left { gap: 0.5rem; }
}

/* ============================================================
   PROJECT MODAL COMPONENTS
   - Status progress indicator
   - Financial summary strip
   - Status action bar
   ============================================================ */

/* Status Progress Indicator - horizontal stepper */
.project-status-progress { display: flex; align-items: center; margin-bottom: 1rem; }
.project-status-step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.project-status-step-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #d1d5db; background: white; display: flex; align-items: center; justify-content: center; font-size: 12px; z-index: 1; transition: all 0.2s; }
.project-status-step.completed .project-status-step-dot { background: #10b981; border-color: #10b981; color: white; }
.project-status-step.current .project-status-step-dot { background: #3b82f6; border-color: #3b82f6; color: white; box-shadow: 0 0 0 4px rgba(59,130,246,0.15); }
.project-status-step-label { font-size: 11px; margin-top: 4px; color: #6b7280; }
.project-status-step.current .project-status-step-label { color: #3b82f6; font-weight: 600; }
.project-status-step.completed .project-status-step-label { color: #10b981; }
.project-status-step-connector { position: absolute; top: 14px; left: 50%; width: 100%; height: 2px; background: #d1d5db; }
.project-status-step.completed .project-status-step-connector { background: #10b981; }
.project-status-step:last-child .project-status-step-connector { display: none; }

/* Financial Summary Strip */
.project-financial-strip { display: flex; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin-bottom: 1rem; }
.project-financial-stat { flex: 1; padding: 12px 16px; text-align: center; border-right: 1px solid #e5e7eb; }
.project-financial-stat:last-child { border-right: none; }
.project-financial-stat-value { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.project-financial-stat-label { font-size: 0.75rem; color: #6b7280; margin-top: 2px; }
@media (max-width: 600px) {
    .project-financial-strip { flex-wrap: wrap; }
    .project-financial-stat { flex: 1 1 50%; border-bottom: 1px solid #e5e7eb; }
}

/* Status Action Bar */
.project-action-bar { display: flex; gap: 8px; padding: 12px 16px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; margin-top: 1rem; justify-content: flex-end; align-items: center; }
.project-action-bar .action-label { font-size: 0.8rem; color: #6b7280; margin-right: auto; }

/* ── Full-page project detail ── */
.project-detail-page { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }

/* Top bar: breadcrumb + actions on one tight line */
.project-detail-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.project-detail-topbar .breadcrumb { margin: 0; padding: 0; background: none; font-size: 0.8rem; }
.project-detail-topbar .breadcrumb a { color: #6b7280; text-decoration: none; }
.project-detail-topbar .breadcrumb a:hover { color: #374151; }
.project-detail-topbar .breadcrumb .active { color: #9ca3af; }
.project-detail-topbar-actions { display: flex; gap: 6px; align-items: center; }

/* Title block */
.project-detail-title { font-size: 1.6rem; font-weight: 700; color: #111827; line-height: 1.25; margin: 0 0 0.35rem; }
.project-detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 1.25rem; }

/* Status badge pill */
.project-status-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.project-status-pill--draft { background: #f3f4f6; color: #6b7280; }
.project-status-pill--active { background: #dbeafe; color: #1d4ed8; }
.project-status-pill--completed { background: #d1fae5; color: #047857; }
.project-status-pill--invoiced { background: #e0e7ff; color: #4338ca; }
.project-status-pill--canceled { background: #fee2e2; color: #b91c1c; }

/* Client chip */
.project-client-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 500; background: #fef3c7; color: #92400e; }

/* Two-column layout below stepper */
.project-detail-grid { display: grid; grid-template-columns: 1fr 280px; gap: 1.75rem; margin-top: 1.25rem; }
@media (max-width: 768px) { .project-detail-grid { grid-template-columns: 1fr; } }

/* Sidebar */
.project-sidebar-section { margin-bottom: 1.25rem; }
.project-sidebar-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #9ca3af; margin-bottom: 0.35rem; }
.project-sidebar-value { font-size: 0.875rem; color: #374151; line-height: 1.5; }
.project-sidebar-divider { border: none; border-top: 1px solid #f3f4f6; margin: 1rem 0; }

/* Appointment rows (full-page) */
.project-appt-row { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid #f3f4f6; }
.project-appt-row:last-child { border-bottom: none; }
.project-appt-date { flex: 0 0 60px; text-align: center; }
.project-appt-date-day { font-size: 1.25rem; font-weight: 700; color: #111827; line-height: 1; }
.project-appt-date-month { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: #9ca3af; }
.project-appt-body { flex: 1; min-width: 0; }
.project-appt-headline { font-size: 0.875rem; font-weight: 500; color: #374151; }
.project-appt-sub { font-size: 0.75rem; color: #9ca3af; margin-top: 2px; }
.project-appt-amount { flex: 0 0 auto; font-size: 0.875rem; font-weight: 600; color: #111827; white-space: nowrap; }

/* Section heading inside main column */
.project-section-heading { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #9ca3af; margin: 1.5rem 0 0.5rem; padding-bottom: 0.35rem; border-bottom: 1px solid #f3f4f6; }
.project-section-heading:first-child { margin-top: 0; }

/* Notes block */
.project-notes-block { font-size: 0.875rem; color: #4b5563; line-height: 1.7; white-space: pre-wrap; }

/* Empty state */
.project-empty { text-align: center; padding: 2rem 1rem; color: #9ca3af; font-size: 0.8rem; }

/* ============================================
   KANBAN BOARD
   ============================================ */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding: 16px 0; min-height: 60vh; align-items: flex-start; }
.kanban-column { flex: 0 0 280px; background: var(--bg-secondary, #f9fafb); border-radius: 8px; padding: 12px; min-height: 200px; }
.kanban-column-header { font-weight: 600; padding: 8px 12px; border-bottom: 3px solid; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 0.875rem; }
.kanban-column-count { font-size: 0.75rem; background: rgba(0,0,0,0.08); border-radius: 12px; padding: 2px 8px; font-weight: 500; }
.kanban-column-body { min-height: 50px; }
.kanban-card { background: var(--bg-primary, #ffffff); border-radius: 6px; padding: 12px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); cursor: grab; transition: all 0.2s; }
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.kanban-column.drag-over { background: var(--bg-accent, #eff6ff); outline: 2px dashed #3b82f6; outline-offset: -2px; }
.kanban-card-title { font-weight: 500; font-size: 0.875rem; margin-bottom: 4px; }
.kanban-card-title a:hover { color: var(--primary) !important; }
.kanban-card-meta { font-size: 0.75rem; color: var(--text-secondary, #6b7280); }
.kanban-card-footer { display: flex; gap: 12px; margin-top: 8px; font-size: 0.7rem; color: var(--text-secondary, #9ca3af); }
.kanban-card-footer i { margin-right: 2px; }
.kanban-empty { text-align: center; color: var(--text-muted, #d1d5db); padding: 24px 8px; font-size: 0.8rem; }

/* Mobile: show move dropdown, hide on desktop */
.kanban-card-mobile-move { display: none; margin-top: 8px; }
@media (max-width: 768px) {
    .kanban-board { flex-direction: column; min-height: auto; }
    .kanban-column { flex: none; width: 100%; }
    .kanban-card { cursor: default; }
    .kanban-card-mobile-move { display: block; }
}

/* Stage preset form rows */
.stage-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f3f4f6; }
.stage-row-system { background: #f9fafb; border-radius: 4px; padding: 6px 4px; }
.stage-row .form-control-sm { height: 32px; }

/* ============================================================
   PROJECT FULL PAGE
   ============================================================ */

.project-full-page {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 80px;
}

/* Header */
.project-fp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: var(--bg-primary, #fff);
    z-index: 10;
}

.project-fp-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.project-fp-header-left input[type="text"] {
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    background: transparent;
    padding: 0.25rem 0.5rem;
    width: 100%;
    max-width: 500px;
}

.project-fp-header-left input[type="text"]:focus {
    outline: none;
    border-bottom: 2px solid var(--primary, #3b82f6);
}

.project-fp-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Grid */
.project-fp-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .project-fp-grid {
        grid-template-columns: 1fr;
    }
}

/* Main column */
.project-fp-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Sections */
.project-fp-section {
    background: var(--card-bg, #fff);
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
}

.project-fp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.project-fp-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0;
}

/* Field grid */
.project-fp-field-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-fp-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 576px) {
    .project-fp-field-row {
        grid-template-columns: 1fr;
    }
}

.project-fp-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.25rem;
    display: block;
}

/* Participant chips */
.project-participant-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    font-size: 0.8125rem;
    cursor: grab;
    transition: opacity 0.2s, box-shadow 0.2s;
    user-select: none;
}

.project-participant-chip:hover {
    background: #e5e7eb;
}

.project-participant-chip.dragging {
    opacity: 0.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.project-participant-chip-name {
    font-weight: 500;
    color: var(--text-primary, #1f2937);
}

.project-participant-chip-role {
    font-size: 0.75rem;
    color: #6b7280;
    background: #e5e7eb;
    padding: 0 0.375rem;
    border-radius: 0.75rem;
}

.project-participant-chip-remove {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.75rem;
    line-height: 1;
}

.project-participant-chip-remove:hover {
    color: #ef4444;
}

/* Appointment cards */
.project-appointment-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: outline 0.2s, background 0.2s;
}

.project-appointment-card.drag-over {
    outline: 2px dashed var(--primary, #3b82f6);
    background: rgba(59, 130, 246, 0.05);
}

.project-appt-team {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.375rem;
}

.project-appt-team-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.375rem;
    background: #dbeafe;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    color: #1e40af;
}

.project-appt-team-remove {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #93c5fd;
    font-size: 0.625rem;
    line-height: 1;
}

.project-appt-team-remove:hover {
    color: #ef4444;
}

.project-appt-add-person {
    background: none;
    border: 1px dashed #d1d5db;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.6875rem;
    transition: all 0.15s;
}

.project-appt-add-person:hover {
    border-color: var(--primary, #3b82f6);
    color: var(--primary, #3b82f6);
    background: rgba(59, 130, 246, 0.05);
}

/* Assign popover */
.project-assign-popover {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 50;
    background: var(--card-bg, #fff);
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 200px;
    max-height: 250px;
    overflow-y: auto;
}

.project-assign-popover-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 1px solid #f3f4f6;
}

.project-assign-popover-list {
    padding: 0.25rem;
}

.project-assign-popover-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: none;
    background: none;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--text-primary, #1f2937);
    text-align: left;
}

.project-assign-popover-item:hover:not(:disabled) {
    background: #f3f4f6;
}

.project-assign-popover-item.assigned {
    color: #9ca3af;
    cursor: default;
}

/* Linked items (offers, invoice) */
.project-linked-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-linked-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
}

.project-linked-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-linked-item-number {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--primary, #3b82f6);
}

.project-linked-item-title {
    font-size: 0.8125rem;
    color: #6b7280;
}

.project-linked-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-linked-item-client {
    font-size: 0.75rem;
    color: #9ca3af;
}

.project-empty-hint {
    font-size: 0.8125rem;
    color: #9ca3af;
    padding: 0.5rem 0;
}

/* Sidebar */
.project-fp-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: sticky;
    top: 70px;
}

.project-fp-sidebar-card {
    background: var(--card-bg, #fff);
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.project-fp-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.project-fp-stat {
    text-align: center;
}

.project-fp-stat-value {
    font-size: 1rem;
    font-weight: 600;
}

.project-fp-stat-label {
    font-size: 0.6875rem;
    color: #6b7280;
}

/* Footer */
.project-fp-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary, #fff);
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
}

.project-fp-footer-left {
    display: flex;
    align-items: center;
}

.project-fp-footer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-fp-autosave-indicator {
    font-size: 0.75rem;
    color: #9ca3af;
}

.project-fp-autosave-indicator.saved {
    color: #10b981;
}

.project-fp-autosave-indicator.error {
    color: #ef4444;
}

/* Add participant modal overlay */
#add-participant-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
}

.project-add-participant-form {
    background: var(--card-bg, #fff);
    border-radius: 0.5rem;
    padding: 1.25rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.project-add-participant-form h5 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

/* === MIGRATED FROM LEGACY FILES (2026-03-22) === */

/* From tutorial/app.css - HTMX loading indicators */
.htmx-indicator {
    opacity: 0;
    transition: opacity 500ms ease-in;
}
.htmx-request .htmx-indicator {
    opacity: 1;
}
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* From tutorial/beleg_control_panel.css - Product detail box */
#item-box {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#item-box h4 {
    color: #333;
    border-bottom: 2px solid #4285F4;
    padding-bottom: 8px;
    margin-top: 25px;
    margin-bottom: 15px;
    font-weight: 600;
}
