/* ========================================
   WiseLogic - Modern Layout without Scrollbars
   Version: 2.0.0
   ======================================== */

/* ========================================
   CSS Variables & Theme
   ======================================== */

:root[data-theme="light"],
:root {
    /* Colors - Light Mode */
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f7fafc;
    --bg-hover: #f9fafb;

    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;

    --border-color: #e2e8f0;
    --border-hover: #cbd5e0;

    --primary: #667eea;
    --primary-hover: #5a67d8;
    --primary-light: #eef2ff;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

:root[data-theme="dark"] {
    /* Colors - Dark Mode */
    --bg-primary: #1a202c;
    --bg-secondary: #1a202c;
    --bg-tertiary: #2d3748;
    --bg-hover: #374151;

    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #cbd5e0;

    --border-color: #4a5568;
    --border-hover: #718096;

    --primary: #667eea;
    --primary-hover: #7c3aed;
    --primary-light: #2d3748;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
}

/* ========================================
   Custom Scrollbar Styling
   ======================================== */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

::-webkit-scrollbar-corner {
    background: var(--bg-tertiary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-tertiary);
}

/* Thin scrollbar variant for smaller containers */
.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

/* Auto-hide scrollbar - shows only on hover */
.scrollbar-auto {
    overflow-y: auto;
}

.scrollbar-auto::-webkit-scrollbar-thumb {
    background: transparent;
}

.scrollbar-auto:hover::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.scrollbar-auto:hover::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Primary colored scrollbar */
.scrollbar-primary::-webkit-scrollbar-thumb {
    background: var(--primary);
}

.scrollbar-primary::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* ========================================
   Base Styles
   ======================================== */

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

html {
    font-size: 16px;
    overflow: hidden;
    height: 100vh;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ========================================
   Application Container - NO SCROLLBARS
   ======================================== */

.app-container {
    display: none;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-secondary);
}

body.authenticated .app-container {
    display: block;
}

body.authenticated .login-container {
    display: none !important;
}

/* ========================================
   Top Bar - Fixed Header
   ======================================== */

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1000;
    transition: all 0.2s;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 600px;
    margin: 0 1rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Menu Toggle Button */
.menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-secondary);
    transition: all 0.3s;
}

/* Logo */
.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Mobile search toggle - hidden on desktop */
.mobile-search-toggle {
    display: none;
}

/* Mobile search overlay - hidden on desktop */
.mobile-search-overlay {
    display: none;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    width: 100%;
    max-width: 500px;
    transition: all 0.2s;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-bar i {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

/* Icon Buttons */
.icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    line-height: 1;
}

/* Tenant Info */
.tenant-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
}

.tenant-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.tenant-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    font-weight: 500;
}

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

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.user-menu-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 240px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1100;
}

.user-menu-toggle:focus + .user-dropdown,
.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.user-avatar.large {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.user-dropdown a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.user-dropdown a i {
    width: 18px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

.logout-link {
    color: var(--danger) !important;
}

/* ========================================
   Side Navigation - HIDDEN BY DEFAULT
   ======================================== */

.side-nav {
    position: fixed;
    top: 56px;
    left: -280px;
    bottom: 0;
    width: 260px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    transition: left 0.3s ease;
    z-index: 900;
}

.side-nav.open {
    left: 0;
    box-shadow: var(--shadow-lg);
}

.nav-section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.nav-section:last-child {
    border-bottom: none;
}

.nav-section h3 {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.nav-item a:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.nav-item.active a {
    background: var(--primary-light);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 10px;
    font-weight: 600;
}

.nav-badge.warning {
    background: var(--warning);
    color: white;
}

.nav-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.usage-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-item i {
    color: var(--primary);
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

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

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.upgrade-prompt {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.upgrade-prompt strong {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.upgrade-prompt small {
    font-size: 0.75rem;
    opacity: 0.9;
}

.upgrade-prompt .btn {
    margin-top: 0.75rem;
    width: 100%;
}

/* ========================================
   Main Content Area - NO SCROLLBARS
   ======================================== */

.main-content {
    margin-left: 0;
    margin-top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-secondary);
    transition: margin-left 0.3s ease;
}

.side-nav.open ~ .main-content {
    margin-left: 260px;
}

.content-view {
    display: none;
    padding: 1.5rem;
    min-height: 100%;
}

.content-view.active {
    display: block;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.content-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ========================================
   KPI Cards
   ======================================== */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    transition: all 0.2s;
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.kpi-icon.revenue { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.kpi-icon.invoices { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.kpi-icon.expenses { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.kpi-icon.balance { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

.kpi-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-change {
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--danger); }

/* ========================================
   Section Header
   ======================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.view-all {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.view-all:hover {
    gap: 0.75rem;
}

/* ========================================
   Apps Grid
   ======================================== */

.apps-slider-container {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 1.5rem;
    position: relative;
}

.apps-nav-btn {
    width: 32px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1rem;
}

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

.apps-nav-prev {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.apps-nav-next {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.apps-grid {
    display: flex;
    overflow-x: auto;
    gap: 1.25rem;
    padding: 0.5rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
}

.apps-grid::-webkit-scrollbar {
    display: none;
}

.apps-grid::-webkit-scrollbar {
    height: 6px;
}

.apps-grid::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.apps-grid::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.apps-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.app-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    min-width: 160px;
    flex-shrink: 0;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.app-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.contacts-icon { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.invoicing-icon { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.catalog-icon { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.expenses-icon { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.reports-icon { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
.quotes-icon { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.meetings-icon { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.vehicles-icon { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.mail-icon { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.hv-icon { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }

.app-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.app-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* ========================================
   Activity Timeline
   ======================================== */

.activity-section {
    margin-top: 2rem;
}

.activity-timeline {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    color: white;
}

.timeline-icon.success { background: var(--success); }
.timeline-icon.info { background: var(--info); }
.timeline-icon.warning { background: var(--warning); }

.timeline-content {
    flex: 1;
}

.timeline-content strong {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.timeline-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

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

/* ========================================
   Date Range Picker
   ======================================== */

.date-range-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.date-range-picker:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ========================================
   Overlay
   ======================================== */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 850;
}

.overlay.active {
    display: block;
}

/* ========================================
   Popups/Modals
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 1.25rem;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ========================================
   Connection Status Indicator
   ======================================== */

.connection-status {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    background: var(--success);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.connection-status i {
    font-size: 0.875rem;
}

/* ========================================
   Loading Spinner
   ======================================== */

.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1024px) {
    .tenant-info {
        display: none;
    }

    .user-name,
    .user-role {
        display: none;
    }

    .top-bar-center {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 0 0.75rem;
    }

    .top-bar-left {
        gap: 0.5rem;
    }

    .logo-text {
        display: none;
    }

    .search-bar {
        display: none;
    }

    /* Mobile search toggle button */
    .mobile-search-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--bg-tertiary);
        border: none;
        border-radius: 8px;
        color: var(--text-secondary);
        cursor: pointer;
    }

    .mobile-search-toggle:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }

    /* Mobile search overlay */
    .mobile-search-overlay {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        padding: 0.75rem;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        z-index: 999;
        box-shadow: var(--shadow-md);
    }

    .mobile-search-overlay.active {
        display: block;
    }

    .mobile-search-overlay .search-bar {
        display: flex;
        max-width: 100%;
    }

    .mobile-search-overlay .search-bar input {
        flex: 1;
    }

    .mobile-search-overlay .search-close {
        background: none;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        padding: 0.5rem;
        margin-left: 0.5rem;
    }

    .mobile-search-overlay .search-close:hover {
        color: var(--text-primary);
    }

    .top-bar-right {
        gap: 0.5rem;
    }

    .content-view {
        padding: 1rem;
    }

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

    .header-actions {
        width: 100%;
    }

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

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

    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .app-card {
        padding: 1rem;
    }

    .app-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    /* Modal fix for small phones */
    .modal-content {
        min-width: auto;
        width: 95%;
        margin: 0.5rem;
    }

    .modal-header,
    .modal-footer {
        padding: 0.75rem 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Touch targets - min 44px */
    .btn,
    .nav-item a,
    .menu-toggle,
    .sidebar-close {
        min-height: 44px;
        min-width: 44px;
    }

    /* Form inputs touch friendly */
    .form-input,
    .form-select,
    .form-textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Very small phones (iPhone SE, older devices) */
@media (max-width: 375px) {
    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .top-bar {
        padding: 0 0.5rem;
    }

    .user-name {
        display: none;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }
}

/* Extra small phones (320px) */
@media (max-width: 320px) {
    .modal-header h3 {
        font-size: 0.95rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .nav-item a {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   Disable text selection on UI elements
   ======================================== */
.logo-text,
.logo-container,
.nav-menu,
.nav-item,
.nav-item a,
.btn,
.modal-header,
.modal-title,
.calendar-nav,
.calendar-day-header,
.menu-toggle,
.user-info,
.header-actions,
.app-card,
.stat-card .stat-label,
.stat-card .stat-change {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ========================================
   Inactivity Warning Widget
   ======================================== */
.inactivity-warning {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    z-index: 1000;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    transition: transform 0.3s ease;
    user-select: none;
}

.inactivity-warning.visible {
    transform: translateX(-50%) translateY(0);
}

.inactivity-warning-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
}

.inactivity-warning-content i {
    font-size: 1.25rem;
    animation: pulse 1s ease-in-out infinite;
}

.inactivity-message {
    font-size: 0.9rem;
}

.inactivity-message strong {
    font-size: 1.1rem;
    margin: 0 0.25rem;
}

.inactivity-warning .btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.inactivity-warning .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

@media (max-width: 768px) {
    .inactivity-warning {
        left: 0;
        right: 0;
        transform: translateX(0) translateY(-100%);
        border-radius: 0;
        padding: 0.5rem 1rem;
    }
    
    .inactivity-warning.visible {
        transform: translateX(0) translateY(0);
    }
    
    .inactivity-warning-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
}

/* ========================================
   Connection Overlay (Offline/Online)
   ======================================== */
.connection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.connection-overlay-content {
    text-align: center;
    color: white;
    padding: 3rem;
    max-width: 400px;
}

.connection-overlay-content.reconnected .connection-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: none;
}

.connection-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    position: relative;
    animation: pulse-error 2s ease-in-out infinite;
}

.connection-icon.online {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: pulse-success 0.5s ease-out;
}

.connection-icon i {
    font-size: 2.5rem;
    color: white;
}

.connection-icon-slash {
    position: absolute;
    width: 70%;
    height: 4px;
    background: white;
    transform: rotate(-45deg);
    border-radius: 2px;
}

.connection-overlay-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.connection-overlay-content p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
}

.connection-loader {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.connection-loader-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    animation: loader-bounce 1.4s ease-in-out infinite;
}

.connection-loader-dot:nth-child(1) { animation-delay: 0s; }
.connection-loader-dot:nth-child(2) { animation-delay: 0.2s; }
.connection-loader-dot:nth-child(3) { animation-delay: 0.4s; }

.connection-status-text {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
}

@keyframes pulse-error {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }
}

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

@keyframes loader-bounce {
    0%, 80%, 100% { 
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   Notifications Dropdown
   ======================================== */
.notifications-dropdown {
    position: fixed;
    top: 56px;
    right: 200px;
    width: 360px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.notifications-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

.notifications-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
}

.mark-all-read:hover {
    text-decoration: underline;
}

.notifications-list {
    max-height: 350px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}

.notification-item:hover {
    background: var(--bg-secondary);
}

.notification-item.unread {
    background: rgba(102, 126, 234, 0.05);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.notification-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.notification-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.notification-icon.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notifications-footer {
    padding: 0.75rem 1.25rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.notifications-footer a {
    color: var(--primary);
    font-size: 0.875rem;
    text-decoration: none;
}

.notifications-footer a:hover {
    text-decoration: underline;
}

/* ========================================
   Right Sidebar Tabs
   ======================================== */
.right-sidebar-tabs {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: 0.5rem;
}

.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.sidebar-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-tab.active {
    background: var(--primary);
    color: white;
}

.sidebar-tab .tab-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-tab.active .tab-badge {
    background: white;
    color: var(--primary);
}

.right-sidebar-tabs .sidebar-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.right-sidebar-tabs .sidebar-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-tab-content {
    display: none;
    height: calc(100% - 60px);
    overflow-y: auto;
}

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

/* ========================================
   Sidebar Chat
   ======================================== */
.sidebar-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-status-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.chat-status-bar i {
    font-size: 1.5rem;
    color: var(--primary);
}

.chat-status-bar strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.chat-online-status {
    font-size: 0.75rem;
    color: #10b981;
}

.chat-online-status i {
    font-size: 0.5rem;
    margin-right: 0.25rem;
}

.sidebar-chat .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-chat .chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.sidebar-chat .chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.sidebar-chat .chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.sidebar-chat .chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sidebar-chat .chat-send:hover {
    background: var(--primary-dark);
}

/* Chat messages styling */
.chat-message {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.chat-message-support {
    flex-direction: row;
}

.chat-message-user {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar i {
    font-size: 0.875rem;
    color: var(--primary);
}

.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    background: var(--bg-secondary);
}

.chat-message-user .chat-bubble {
    background: var(--primary);
    color: white;
}

.chat-bubble p {
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.chat-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chat-message-user .chat-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Chat icon badge in header */
.chat-icon-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-btn {
    position: relative;
}

@media (max-width: 768px) {
    .notifications-dropdown {
        right: 10px;
        left: 10px;
        width: auto;
    }
}

/* ========================================
   Mini Calendar in Sidebar
   ======================================== */
.calendar-widget {
    padding: 1rem;
}

.calendar-widget .calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.calendar-widget .calendar-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-widget .calendar-nav {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.calendar-widget .calendar-nav:hover {
    background: var(--primary);
    color: white;
}

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

.calendar-widget .calendar-day-header {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.25rem 0;
    text-transform: uppercase;
}

#miniCalendarDays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.mini-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.mini-calendar-day:hover:not(.empty) {
    background: var(--bg-tertiary);
}

.mini-calendar-day.empty {
    cursor: default;
}

.mini-calendar-day.today {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.mini-calendar-day.today:hover {
    background: var(--primary-dark);
}

.mini-calendar-day.weekend {
    color: var(--text-muted);
}

.mini-calendar-day.holiday {
    color: #ef4444;
    font-weight: 600;
}

.mini-calendar-day.has-events::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--success);
    border-radius: 50%;
}

.mini-calendar-day.today.has-events::after {
    background: white;
}

.mini-day-num {
    display: block;
}

/* Today's nameday display */
.today-nameday-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0 1rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.today-nameday-widget i {
    color: var(--primary);
    font-size: 1rem;
}

.today-nameday-widget .nameday-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.today-nameday-widget .nameday-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Events list in sidebar */
.events-list-sidebar {
    padding: 0 1rem 1rem;
}

.events-list-sidebar h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.events-list-sidebar h4 i {
    color: var(--text-muted);
}

.event-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.625rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.event-item:last-child {
    margin-bottom: 0;
}

.event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.25rem;
    background: var(--primary);
    border-radius: 6px;
    color: white;
}

.event-date .event-day {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

.event-date .event-month {
    font-size: 0.6rem;
    text-transform: uppercase;
    opacity: 0.9;
}

.event-details {
    flex: 1;
    min-width: 0;
}

.event-details strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-details p {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.event-details p i {
    font-size: 0.65rem;
}


/* ========================================
   Contact Detail Modal
   ======================================== */
.contact-detail-modal .modal-content {
    max-width: 1000px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.contact-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.contact-detail-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.contact-detail-ico {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.contact-detail-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.contact-detail-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    flex-shrink: 0;
}

.detail-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.detail-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.detail-tab.active {
    background: var(--primary);
    color: white;
}

.detail-tab i {
    font-size: 0.9rem;
}

.contact-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.detail-tab-content {
    display: none;
}

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

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-section h3 i {
    color: var(--primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Financial Tab Styles */
.financial-loading,
.financial-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.loading-spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.financial-error {
    color: var(--text-muted);
}

.financial-error i {
    font-size: 3rem;
    color: #f59e0b;
    margin-bottom: 1rem;
}

.financial-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.financial-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.financial-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.financial-card-icon.revenue {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.financial-card-icon.profit {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.financial-card-icon.assets {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.financial-card-icon.equity {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.financial-card-data {
    display: flex;
    flex-direction: column;
}

.financial-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.financial-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.financial-year {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sparkline {
    margin-top: 8px;
    width: 100%;
    max-width: 120px;
    height: 30px;
    opacity: 0.9;
}

.sparkline-tooltip {
    position: absolute;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.7rem;
    color: var(--text-primary);
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    white-space: nowrap;
}

.ratios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.ratio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.ratio-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ratio-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.statements-table-container {
    overflow-x: auto;
}

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

.statements-table th,
.statements-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.statements-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bg-secondary);
}

.statements-table td {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.statements-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* Notes styles */
.notes-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.note-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.note-input-container textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    resize: vertical;
}

.note-input-container textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.note-input-container .btn {
    align-self: flex-end;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-item {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.note-author {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.note-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Empty states */
.empty-state-small {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-small i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state-small p {
    font-size: 0.9rem;
}

/* History timeline */
.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.history-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-icon i {
    font-size: 0.75rem;
    color: var(--primary);
}

.history-content {
    flex: 1;
}

.history-text {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Meetings list */
.meetings-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.meeting-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.meeting-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    padding: 0.5rem;
    background: var(--primary);
    border-radius: 8px;
    color: white;
}

.meeting-day {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.meeting-month {
    font-size: 0.7rem;
    text-transform: uppercase;
}

.meeting-details {
    flex: 1;
}

.meeting-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.meeting-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Contracts list */
.contracts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contract-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.contract-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.contract-icon i {
    color: var(--primary);
}

.contract-details {
    flex: 1;
}

.contract-title {
    font-weight: 500;
    color: var(--text-primary);
}

.contract-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.contract-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.contract-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.contract-status.expired {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Contact persons */
.contact-persons-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-person-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.contact-person-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.contact-person-info {
    flex: 1;
}

.contact-person-name {
    font-weight: 500;
    color: var(--text-primary);
}

.contact-person-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.contact-person-contacts {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.contact-person-contacts a {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
}

.contact-person-contacts a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .contact-detail-tabs {
        padding: 0.5rem;
    }

    .detail-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .detail-tab span {
        display: none;
    }

    .contact-detail-body {
        padding: 1rem;
    }

    .financial-summary {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Contact Detail Inline Styles
   ======================================== */
.contact-detail-header-inline {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.contact-detail-back {
    flex-shrink: 0;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.contact-detail-title-inline {
    flex: 1;
    min-width: 200px;
}

.contact-detail-title-inline h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.contact-detail-tabs-inline {
    display: flex;
    gap: 0.25rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    flex-wrap: nowrap;
    margin-bottom: 1.5rem;
}

.contact-detail-tabs-inline .detail-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.contact-detail-tabs-inline .detail-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary);
}

.contact-detail-tabs-inline .detail-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.contact-detail-tabs-inline .detail-tab i {
    font-size: 0.9rem;
}

.contact-detail-body-inline {
    padding: 0;
}

.detail-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.detail-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.detail-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-card h3 i {
    color: var(--primary);
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Financial Summary Cards */
.financial-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.financial-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.financial-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.financial-card-icon.revenue {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.financial-card-icon.profit {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.financial-card-icon.assets {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.financial-card-icon.equity {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.financial-card-data {
    display: flex;
    flex-direction: column;
}

.financial-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.financial-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.financial-year {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Ratios Grid */
.ratios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.ratio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.ratio-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ratio-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Statements Table */
.statements-table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

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

.statements-table th,
.statements-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.statements-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bg-tertiary);
}

.statements-table td {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.statements-table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Loading and Error States */
.financial-loading,
.financial-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.loading-spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.financial-error {
    color: var(--text-muted);
}

.financial-error i {
    font-size: 3rem;
    color: #f59e0b;
    margin-bottom: 1rem;
}

/* Notes Container */
.notes-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.note-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-input-container textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
}

.note-input-container textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.note-input-container .btn {
    align-self: flex-end;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-item {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.note-author {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.note-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Empty States */
.empty-state-small {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-small i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state-small p {
    font-size: 0.9rem;
}

/* History Timeline */
.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.history-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-icon i {
    font-size: 0.75rem;
    color: var(--primary);
}

.history-content {
    flex: 1;
}

.history-text {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .contact-detail-header-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .contact-detail-tabs-inline {
        padding: 0.5rem 0;
    }

    .contact-detail-tabs-inline .detail-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .contact-detail-tabs-inline .detail-tab span {
        display: none;
    }

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

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

    .financial-summary {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   ACCORDION STATEMENTS
   ========================================== */
.statements-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.statement-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-primary);
}

.statement-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    background: var(--bg-secondary);
    transition: background 0.2s;
}

.statement-card-header:hover {
    background: var(--bg-tertiary);
}

.statement-card-header .year {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.statement-card-header .year i {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.statement-card.expanded .statement-card-header .year i {
    transform: rotate(90deg);
}

.statement-card-header .summary {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.statement-card-header .summary-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.statement-card-header .summary-item .label {
    font-size: 0.7rem;
    text-transform: uppercase;
}

.statement-card-header .summary-item .value {
    font-weight: 600;
    color: var(--text-primary);
}

.statement-card-body {
    display: none;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.statement-card.expanded .statement-card-body {
    display: block;
}

.statement-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.statement-section {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
}

.statement-section h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.statement-section h4 i {
    color: var(--primary);
}

.statement-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.statement-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.statement-item:last-child {
    border-bottom: none;
}

.statement-item .label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.statement-item .value {
    font-weight: 500;
    font-size: 0.9rem;
}

.statement-item .value.positive {
    color: var(--success);
}

.statement-item .value.negative {
    color: var(--danger);
}

/* ==========================================
   INLINE EDIT FORM
   ========================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.checkbox-group {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ==========================================
   MEETINGS & CONTRACTS FORMS
   ========================================== */
.meeting-form-container,
.contract-form-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* ==========================================
   NOTES WITH AUTHOR
   ========================================== */
.note-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.note-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.85rem;
}

.note-author i {
    color: var(--primary);
}

.note-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-text {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}

/* ==========================================
   MEETING ITEMS
   ========================================== */
.meeting-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.meeting-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.meeting-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.meeting-datetime {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    font-size: 0.85rem;
}

.meeting-location {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.meeting-description {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meeting-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.meeting-status.upcoming {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.meeting-status.completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.meeting-status.cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* ==========================================
   CONTRACT ITEMS
   ========================================== */
.contract-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.contract-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.contract-title {
    font-weight: 600;
    font-size: 1rem;
}

.contract-number {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.contract-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.contract-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
}

.contract-meta-item i {
    color: var(--primary);
}

.contract-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.contract-status.draft {
    background: rgba(156, 163, 175, 0.2);
    color: var(--text-muted);
}

.contract-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.contract-status.expired {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

@media (max-width: 768px) {
    .statement-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .statement-card-header .summary {
        display: none;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   CALENDAR STYLES
   ========================================== */

.calendar-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-nav h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.calendar-grid {
    width: 100%;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 0.5rem;
}

.calendar-day-name {
    text-align: center;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

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

.calendar-day {
    min-height: 100px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    position: relative;
    transition: var(--transition);
}

.calendar-day:hover:not(.empty) {
    background: var(--bg-hover);
}

.calendar-day.empty {
    background: transparent;
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.1);
    border: 2px solid var(--primary);
}

.calendar-day.has-events {
    background: rgba(16, 185, 129, 0.05);
}

.calendar-day-number {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.calendar-day.today .calendar-day-number {
    color: var(--primary);
}

.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-event {
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event:hover {
    opacity: 0.9;
    transform: translateX(2px);
}

.calendar-event .event-time {
    font-weight: 600;
    margin-right: 4px;
}

.calendar-event .event-title {
    opacity: 0.9;
}

/* Meeting actions in meeting item */
.meeting-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meeting-author {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Contract actions */
.contract-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Modal large */
.modal-lg {
    max-width: 1000px;
    width: 95%;
}

/* Calendar button in header */
.calendar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
}

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

@media (max-width: 768px) {
    .calendar-day {
        min-height: 60px;
        padding: 0.25rem;
    }

    .calendar-day-number {
        font-size: 0.75rem;
    }

    .calendar-event {
        font-size: 0.6rem;
    }

    .calendar-event .event-title {
        display: none;
    }
}

/* ========================================
   CALENDAR - NAMEDAYS, HOLIDAYS, TAX
======================================== */

/* Calendar day nameday display */
.calendar-nameday {
    font-size: 0.65rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
    margin-top: 2px;
}

/* Calendar holiday indicator */
.calendar-holiday {
    font-size: 0.6rem;
    color: var(--danger);
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    padding: 1px 3px;
    border-radius: 2px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Calendar tax deadline indicator */
.calendar-tax {
    font-size: 0.6rem;
    color: var(--warning);
    font-weight: 500;
    background: rgba(245, 158, 11, 0.1);
    padding: 1px 3px;
    border-radius: 2px;
    margin-top: 2px;
}

/* Day with holiday styling */
.calendar-day.has-holiday {
    background: rgba(239, 68, 68, 0.05);
}

/* Day with tax deadline styling */
.calendar-day.has-tax {
    border-left: 3px solid var(--warning);
}

/* ========================================
   DAY DETAIL MODAL
======================================== */

.day-detail-content {
    padding: 1.5rem;
}

.day-detail-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.day-detail-date {
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.day-detail-weekday {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.day-detail-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.day-detail-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text);
}

.day-detail-section h3 i {
    color: var(--primary);
}

/* Nameday highlight */
.nameday-highlight {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

/* Holiday section */
.holiday-section {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger);
}

.holiday-section h3 i {
    color: var(--danger);
}

/* Tax section */
.tax-section {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning);
}

.tax-section h3 i {
    color: var(--warning);
}

.tax-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tax-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.tax-list li:last-child {
    border-bottom: none;
}

.tax-type {
    display: inline-block;
    font-weight: 600;
    color: var(--warning);
    min-width: 150px;
}

/* Meetings section */
.meetings-section {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--info);
}

.meetings-section h3 i {
    color: var(--info);
}

.meetings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.meetings-list li {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

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

.meeting-status {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 0.5rem;
}

.meeting-status.status-scheduled {
    background: var(--info);
    color: white;
}

.meeting-status.status-completed {
    background: var(--success);
    color: white;
}

.meeting-status.status-cancelled {
    background: var(--danger);
    color: white;
}

/* Events section */
.events-section {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success);
}

.events-section h3 i {
    color: var(--success);
}

.events-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.events-list li {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary);
}

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

.events-list li small {
    color: var(--text-muted);
}

/* Day detail actions */
.day-detail-actions {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Empty state for day detail */
.day-detail-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.day-detail-empty i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Modal medium size */
.modal-md {
    max-width: 500px;
    width: 90%;
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 1rem;
}

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

/* Color input styling */
input[type="color"] {
    height: 40px;
    padding: 4px;
    cursor: pointer;
}

/* Calendar clickable day cursor */
.calendar-day:not(.empty) {
    cursor: pointer;
}

/* Day info badges in calendar */
.calendar-day-badges {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
    overflow: hidden;
}

.calendar-badge {
    font-size: 0.55rem;
    padding: 1px 3px;
    border-radius: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-badge-holiday {
    background: var(--danger);
    color: white;
}

.calendar-badge-tax {
    background: var(--warning);
    color: white;
}

.calendar-badge-meeting {
    background: var(--info);
    color: white;
}

.calendar-badge-event {
    background: var(--success);
    color: white;
}

@media (max-width: 768px) {
    .day-detail-section {
        padding: 0.75rem;
    }

    .tax-type {
        min-width: auto;
        display: block;
        margin-bottom: 0.25rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .calendar-nameday {
        display: none;
    }
}
/* ========================================
   Invoice Module Styles - v2.0
   Including Dark Mode Fixes
   ======================================== */

/* Invoice Statistics Cards */
.invoice-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #667eea 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

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

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

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

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Invoice Filters */
.invoice-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.invoice-filters .filter-group {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.invoice-filters select,
.invoice-filters input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.invoice-filters select:focus,
.invoice-filters input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Invoices Table */
.invoices-table-container {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

.invoices-table thead th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.invoices-table thead th:hover {
    background: var(--bg-hover);
}

.invoices-table thead th[data-sort]::after {
    content: '';
    display: inline-block;
    margin-left: 0.5rem;
    opacity: 0.3;
}

.invoices-table thead th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.invoices-table thead th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

.invoices-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
    cursor: pointer;
}

.invoices-table tbody tr:hover {
    background: var(--bg-hover);
}

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

.invoices-table td {
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.invoices-table .text-right {
    text-align: right;
}

.invoices-table .text-muted {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.invoices-table .text-success {
    color: var(--success);
}

.invoices-table .text-danger {
    color: var(--danger);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.status-draft {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.status-badge.status-sent {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.status-badge.status-viewed {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.status-badge.status-partially_paid {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.status-badge.status-paid {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge.status-overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-badge.status-cancelled {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
    text-decoration: line-through;
}

.status-badge.status-booked {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.btn-icon.success:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Invoice Detail Panel */
.invoice-detail-panel {
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

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

.invoice-header-info h2 {
    margin: 0;
}

/* Tabs */
.invoice-detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 0 1rem;
}

.tab-btn {
    padding: 0.875rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

.tab-btn:hover:not(.disabled) {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tab Content */
.invoice-tab-content {
    flex: 1;
    overflow: auto;
}

.tab-pane {
    display: none;
    padding: 1.5rem;
    height: 100%;
}

.tab-pane.active {
    display: block;
}

/* PDF Preview */
.pdf-preview-container {
    position: relative;
    height: 500px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
}

.pdf-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}

/* Invoice Detail Content */
.invoice-detail-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.party-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.party-box h4 {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.invoice-dates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.vs-highlight {
    background: rgba(245, 158, 11, 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    color: var(--warning);
}

/* Invoice Totals */
.invoice-totals {
    margin-top: 1rem;
    max-width: 400px;
    margin-left: auto;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.total-row.grand-total {
    border-top: 2px solid var(--border-color);
    border-bottom: none;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.total-row.paid {
    border-bottom: none;
    color: var(--success);
}

/* Edit Warning */
.edit-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.edit-warning i {
    color: var(--warning);
    font-size: 1.5rem;
}

.edit-blocked-warning {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.edit-blocked-warning i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.hidden {
    display: none !important;
}

/* Invoice Detail Footer */
.invoice-detail-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-left,
.footer-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Invoice Notes */
.invoice-notes {
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    margin-top: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    margin-bottom: 1.5rem;
}

/* ========================================
   Dark Mode Fixes
   ======================================== */

[data-theme="dark"] .invoices-table-container {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .invoices-table thead th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .invoices-table tbody tr {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .invoices-table tbody tr:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .invoices-table td {
    color: var(--text-primary);
}

[data-theme="dark"] .stat-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .stat-value {
    color: var(--text-primary);
}

[data-theme="dark"] .invoice-filters select,
[data-theme="dark"] .invoice-filters input {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .party-box {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .invoice-dates-grid {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-icon {
    color: var(--text-secondary);
}

[data-theme="dark"] .btn-icon:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .invoice-notes {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .pdf-preview-container {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .modal-content {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-header {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .modal-footer {
    background: var(--bg-secondary);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .data-table {
    background: var(--bg-primary);
}

[data-theme="dark"] .data-table thead th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

[data-theme="dark"] .data-table tbody tr {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .data-table tbody tr:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .items-table {
    background: var(--bg-primary);
}

[data-theme="dark"] .items-table thead th {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .items-table tbody tr:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .customer-info-box {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

/* Status badges - same for both themes */
[data-theme="dark"] .status-badge.status-booked {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

/* Responsive */
@media (max-width: 768px) {
    .invoice-parties {
        grid-template-columns: 1fr;
    }

    .invoice-dates-grid {
        grid-template-columns: 1fr 1fr;
    }

    .invoice-detail-footer {
        flex-direction: column;
    }

    .footer-left,
    .footer-right {
        justify-content: center;
    }
}

/* Status badges - UPPERCASE variants */
.status-badge.status-DRAFT {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.status-badge.status-SENT {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.status-badge.status-VIEWED {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.status-badge.status-PARTIALLY_PAID {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.status-badge.status-PAID {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge.status-OVERDUE {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-badge.status-CANCELLED {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
    text-decoration: line-through;
}

.status-badge.status-BOOKED {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

[data-theme="dark"] .status-badge.status-BOOKED {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

/* ========== INVOICE DETAIL STYLES - Added Wed Nov 26 13:01:56 UTC 2025 ==========
/* ========== INVOICE DETAIL STYLES ========== */

/* PDF Preview */
.pdf-preview-wrapper {
    position: relative;
    width: 100%;
    height: calc(100vh - 280px);
    min-height: 600px;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.invoice-pdf-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #f5f5f5;
}

.pdf-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    gap: 1rem;
    color: var(--text-secondary);
}

.pdf-loading-overlay .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Edit warnings */
.edit-blocked-warning {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    background: var(--card-bg);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
    color: var(--text-secondary);
}

.edit-blocked-warning i {
    color: var(--warning);
    margin-bottom: 1rem;
}

.edit-blocked-warning h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.edit-warning {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid var(--warning);
    border-radius: 8px;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.edit-warning i {
    color: var(--warning);
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Payments tab */
.payments-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.payment-stats {
    display: flex;
    gap: 2rem;
}

.payment-stats .stat-item {
    text-align: center;
}

.payment-stats .stat-item label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.payment-stats .stat-item span {
    font-size: 1.25rem;
    font-weight: 600;
}

.payment-form-container {
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.payment-form-container h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.payments-list {
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
}

.payments-list h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.status-draft, .status-badge.status-DRAFT {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

.status-badge.status-sent, .status-badge.status-SENT {
    background: rgba(0, 123, 255, 0.15);
    color: #007bff;
}

.status-badge.status-viewed, .status-badge.status-VIEWED {
    background: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
}

.status-badge.status-partially_paid, .status-badge.status-PARTIALLY_PAID {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.status-badge.status-paid, .status-badge.status-PAID {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.status-badge.status-overdue, .status-badge.status-OVERDUE {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.status-badge.status-cancelled, .status-badge.status-CANCELLED {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
    text-decoration: line-through;
}

.status-badge.status-booked, .status-badge.status-BOOKED {
    background: rgba(111, 66, 193, 0.15);
    color: #6f42c1;
}

/* Variable symbol highlight */
.vs-highlight-box {
    background: rgba(255, 193, 7, 0.1);
    border-radius: 4px;
    padding: 0.5rem;
}

/* Item type badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-info {
    background: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
}

.badge-secondary {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

/* Table footer totals */
.totals-row td {
    background: var(--bg-secondary);
    font-weight: 600;
    border-top: 2px solid var(--border-color);
}

/* Disabled tab */
.detail-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Invoice list section wrapper */
#invoicesListSection {
    display: block;
}

/* Form grid improvements */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .invoice-pdf-frame {
    /* PDF should stay white even in dark mode */
    /* filter: invert(0.9) hue-rotate(180deg); - disabled to keep PDF white */
}

[data-theme="dark"] .pdf-loading-overlay {
    background: var(--card-bg);
}

/* PDF Preview - ensure white background in dark mode */
[data-theme="dark"] .pdf-preview-wrapper {
    background: #ffffff;
}

[data-theme="dark"] .pdf-preview-container {
    background: #f5f5f5;
}

/* Sticky table headers for invoice items */
#invoiceItemsTab .table-container {
    max-height: 400px;
    overflow-y: auto;
}

#invoiceItemsTab .data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

#invoiceItemsTab .data-table thead th {
    background: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="dark"] #invoiceItemsTab .data-table thead th {
    background: var(--bg-secondary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Also make tfoot sticky at bottom */
#invoiceItemsTab .data-table tfoot {
    position: sticky;
    bottom: 0;
    z-index: 10;
}

#invoiceItemsTab .data-table tfoot td {
    background: var(--card-bg);
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

[data-theme="dark"] #invoiceItemsTab .data-table tfoot td {
    background: var(--bg-secondary);
    box-shadow: 0 -2px 4px rgba(0,0,0,0.3);
}

/* Expense Detail CSS Fixes */
.detail-card.full-width {
    grid-column: 1 / -1;
}

#expenseDetailSection .content-header {
    padding: 1rem 0;
}

#expenseDetailSection .detail-tab-content {
    padding: 1rem 0;
}

#expenseDetailSection pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.status-badge.status-uploaded {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.status-badge.status-extracted {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.status-badge.status-verified {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.status-booked {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.ocr-confidence {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ocr-confidence.high {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.ocr-confidence.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.ocr-confidence.low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.overdue {
    color: var(--danger) !important;
    font-weight: 500;
}
/* ============================================
   QUOTES (Cenové ponuky) Styles
   ============================================ */

/* Status badges for quotes */
.status-badge.draft {
    background-color: #6c757d;
    color: white;
}

.status-badge.sent {
    background-color: #0d6efd;
    color: white;
}

.status-badge.viewed {
    background-color: #17a2b8;
    color: white;
}

.status-badge.accepted {
    background-color: #198754;
    color: white;
}

.status-badge.rejected {
    background-color: #dc3545;
    color: white;
}

.status-badge.expired {
    background-color: #ffc107;
    color: #212529;
}

.status-badge.converted {
    background-color: #6f42c1;
    color: white;
}

/* Detail grid layout */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-section {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.detail-section.full-width {
    grid-column: 1 / -1;
}

.detail-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-section h3 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row.total {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--primary-color);
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.detail-value {
    font-weight: 500;
    text-align: right;
}

/* Quote text content */
.quote-text-content {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 6px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Items table footer */
.totals-row td {
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
}

.totals-row.grand-total td {
    font-weight: 600;
    font-size: 1.05rem;
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Notes section */
.notes-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.notes-public, .notes-internal, .notes-terms {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.notes-internal {
    border-color: var(--warning-color);
}

.notes-internal h3 i {
    color: var(--warning-color);
}

.notes-content {
    min-height: 100px;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.6;
}

.notes-content .empty-state {
    color: var(--text-muted);
    font-style: italic;
}

/* Activity list */
.activity-list {
    max-height: 500px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-description {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.activity-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Form styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.form-section {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.form-section.full-width {
    grid-column: 1 / -1;
}

.form-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section h3 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

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

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/* Customer preview */
.customer-preview {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.preview-row {
    margin-bottom: 0.25rem;
}

/* Items toolbar */
.items-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Items edit table */
.items-table-container {
    overflow-x: auto;
}

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

.items-edit-table th {
    background: var(--bg-secondary);
    padding: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.items-edit-table td {
    padding: 0.35rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.items-edit-table .form-input-sm {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.items-edit-table .form-input-sm:focus {
    outline: none;
    border-color: var(--primary-color);
}

.items-edit-table .item-total {
    font-weight: 500;
    min-width: 80px;
}

.btn-danger-icon {
    color: var(--danger-color);
    opacity: 0.6;
}

.btn-danger-icon:hover {
    opacity: 1;
}

/* Tabs */
.detail-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.detail-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.detail-tab:hover {
    color: var(--primary-color);
}

.detail-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.detail-tab i {
    margin-right: 0.5rem;
}

.detail-tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Header actions */
.detail-header, .form-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-header h2, .form-header h2 {
    flex: 1;
    margin: 0;
    font-size: 1.25rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Button link style */
.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 0.9rem;
}

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

.btn-link i {
    margin-right: 0.35rem;
}

/* Responsive */
@media (max-width: 768px) {
    .detail-grid,
    .form-grid,
    .notes-section {
        grid-template-columns: 1fr;
    }

    .detail-header,
    .form-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .detail-tabs {
        flex-wrap: wrap;
    }

    .detail-tab {
        flex: 1;
        text-align: center;
        padding: 0.5rem;
    }
}

/* ============================================
   MODAL OVERLAY STYLES
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    background: var(--bg-secondary, #f5f5f5);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-header h3 i {
    margin-right: 0.5rem;
    color: var(--primary-color, #0066cc);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
    background: var(--bg-secondary, #f5f5f5);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* fadeOut animation for dialogs */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Form input styling for dialogs */
.prompt-dialog .form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #333);
}

.prompt-dialog .form-input:focus {
    outline: none;
    border-color: var(--primary-color, #0066cc);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

/* Confirm dialog styles */
.confirm-dialog .modal-content {
    animation: slideIn 0.2s ease;
}

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

/* PDF preview container */
.pdf-preview-container {
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 8px;
    padding: 1rem;
    min-height: 600px;
}

.pdf-preview-container iframe {
    width: 100%;
    height: 700px;
    border: none;
    border-radius: 8px;
    background: white;
}

/* ============================================
   REPORTS MODULE STYLES
   ============================================ */

.report-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.report-category-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.report-category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.report-category-card .report-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--info));
    color: white;
}

.report-category-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.report-category-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Stat icons colors */
.stat-icon.income {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.stat-icon.expense {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.stat-icon.profit {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.stat-icon.invoices {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

/* Report detail section */
.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.report-header h2 {
    margin: 0;
    flex: 1;
    text-align: center;
    color: var(--text-primary);
}

.report-actions {
    display: flex;
    gap: 0.5rem;
}

#reportContent {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

/* Report tables */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.report-table th,
.report-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.report-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
}

.report-table tr:hover {
    background: var(--bg-hover);
}

.report-table .text-right {
    text-align: right;
}

.report-table .total-row {
    font-weight: 700;
    background: var(--bg-tertiary);
}

/* Summary cards in reports */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.report-summary-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--primary);
}

.report-summary-card .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.report-summary-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.report-summary-card.positive .value {
    color: var(--success);
}

.report-summary-card.negative .value {
    color: var(--danger);
}



/* ========================================
   Sortable Table Headers
   ======================================== */

.sortable-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable-table th.sortable:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sortable-table th.sortable i {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.5;
}

.sortable-table th.sortable i.fa-sort-up,
.sortable-table th.sortable i.fa-sort-down {
    opacity: 1;
    color: var(--primary-color);
}

/* ========================================
   API Verification Badges
   ======================================== */

.verification-success {
    color: #10b981;
    font-weight: 500;
}

.verification-success i {
    margin-right: 0.35rem;
}

.verification-error {
    color: #ef4444;
    font-weight: 500;
}

.verification-error i {
    margin-right: 0.35rem;
}

.verification-pending {
    color: #f59e0b;
    font-weight: 500;
}

.verification-pending i {
    margin-right: 0.35rem;
}


/* All Apps View */
.all-apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.app-card-large {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.app-card-large:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.app-card-large .app-icon {
    width: 72px;
    height: 72px;
    font-size: 2rem;
    margin: 0 auto 1.25rem;
}

.app-card-large h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.app-card-large p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* Dashboard apps slider wrapper */
.apps-slider-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 0.5rem;
}

/* Financial Warnings */
.financial-warnings {
    margin-bottom: 1rem;
}
.financial-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.financial-warning i {
    color: #d97706;
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}
.financial-warning-text {
    color: #92400e;
    font-size: 0.9rem;
    line-height: 1.4;
}
.financial-warning-text a {
    color: #b45309;
    text-decoration: underline;
}
.financial-warning-text a:hover {
    color: #92400e;
}

/* ========================================
   Dark Mode - Select Elements (Global Fix)
   ======================================== */

/* All select elements in dark mode */
[data-theme="dark"] select,
[data-theme="dark"] .form-group select {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] select:focus,
[data-theme="dark"] .form-group select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Select options in dark mode */
[data-theme="dark"] select option,
[data-theme="dark"] .form-group select option {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Disabled select */
[data-theme="dark"] select:disabled,
[data-theme="dark"] .form-group select:disabled {
    background-color: var(--bg-primary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Filter selects */
[data-theme="dark"] .filter-group select,
[data-theme="dark"] .filters select {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .filter-group select option,
[data-theme="dark"] .filters select option {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Small select variant */
[data-theme="dark"] .form-select-sm,
[data-theme="dark"] select.form-select-sm {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Multiple select */
[data-theme="dark"] select[multiple],
[data-theme="dark"] select[multiple] option {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] select[multiple] option:checked {
    background-color: var(--primary);
    color: white;
}

/* Select arrow/dropdown indicator fix for dark mode */
[data-theme="dark"] select {
    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='%239ca3af' 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;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Financial warnings in dark mode */
[data-theme="dark"] .financial-warning {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    border-color: #d97706;
}

[data-theme="dark"] .financial-warning i {
    color: #fbbf24;
}

[data-theme="dark"] .financial-warning-text {
    color: #fef3c7;
}

[data-theme="dark"] .financial-warning-text a {
    color: #fde68a;
}

[data-theme="dark"] .financial-warning-text a:hover {
    color: #fef3c7;
}

/* ========================================
   Bank Accounts Section Styles
   ======================================== */

.bank-accounts-list {
    padding: 0;
}

.bank-accounts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.accounts-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.bank-accounts-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bank-account-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    transition: all 0.2s;
}

.bank-account-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.bank-account-iban {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.iban-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iban-value {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.iban-value:hover {
    background: var(--bg-hover);
}

.iban-value .copy-icon {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
}

.iban-value:hover .copy-icon {
    opacity: 1;
}

.bank-account-bank {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-left: 0.25rem;
}

.bank-account-bank i {
    margin-right: 0.5rem;
    color: var(--text-muted);
}

.bank-accounts-error {
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.bank-accounts-error i {
    margin-right: 0.5rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .bank-account-item {
    background: var(--bg-primary);
}

[data-theme="dark"] .iban-label {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .accounts-count {
    background: var(--bg-primary);
}

/* ========================================
   Turnover Reports (Súhrnné obraty)
   ======================================== */

.turnover-report-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Upload Dropzone */
.turnover-upload-section {
    margin-bottom: 1rem;
}

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: var(--bg-tertiary);
    transition: all 0.3s;
    cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-content i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.dropzone-content h3 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.dropzone-content p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.upload-status {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.upload-status.uploading {
    background: var(--info);
    color: white;
}

.upload-status.success {
    background: var(--success);
    color: white;
}

.upload-status.error {
    background: var(--danger);
    color: white;
}

.upload-status i {
    margin-right: 0.5rem;
}

/* Year Filter */
.turnover-year-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.turnover-year-filter label {
    font-weight: 500;
    color: var(--text-secondary);
}

.turnover-year-filter select {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Summary Cards */
.turnover-summary .summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.turnover-summary .summary-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.2s;
}

.turnover-summary .summary-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.turnover-summary .summary-card.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
}

.turnover-summary .summary-card.highlight .summary-icon,
.turnover-summary .summary-card.highlight .summary-value,
.turnover-summary .summary-card.highlight .summary-label {
    color: white;
}

.summary-icon {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.summary-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* VAT Breakdown */
.vat-breakdown {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.vat-breakdown h4 {
    margin: 0 0 1rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.vat-breakdown h4 i {
    margin-right: 0.5rem;
    color: var(--primary);
}

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

.vat-table th,
.vat-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.vat-table th {
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
}

.vat-table tbody tr:hover {
    background: var(--bg-hover);
}

.vat-table tfoot .total-row {
    background: var(--bg-primary);
}

.vat-table tfoot .total-row td {
    border-bottom: none;
}

/* Turnover Table */
.turnover-table-container {
    margin-top: 1rem;
}

.turnover-table-container h4 {
    margin: 0 0 1rem;
    color: var(--text-primary);
}

.turnover-table-container h4 i {
    margin-right: 0.5rem;
    color: var(--primary);
}

.turnover-table {
    width: 100%;
    background: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
}

/* Empty state for turnover */
.turnover-summary .empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.turnover-summary .empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.turnover-summary .empty-state p {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
}

.turnover-summary .empty-state small {
    color: var(--text-muted);
}

/* Dark mode adjustments */
[data-theme="dark"] .upload-dropzone {
    background: var(--bg-primary);
}

[data-theme="dark"] .upload-dropzone:hover,
[data-theme="dark"] .upload-dropzone.drag-over {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .turnover-year-filter select {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .vat-table tfoot .total-row {
    background: var(--bg-tertiary);
}

/* ========================================
   Tax Calculation (Hospodarsky vysledok)
   ======================================== */

.tax-calc-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tax-year-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.year-tabs {
    display: flex;
    gap: 0.5rem;
}

.year-tab {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.year-tab:hover {
    background: var(--bg-hover);
}

.year-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tax-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tax-empty-state i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.tax-empty-state h3 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.tax-empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.tax-calc-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .tax-calc-layout {
        grid-template-columns: 1fr;
    }
}

.tax-input-panel,
.tax-result-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.tax-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tax-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.tax-section h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 1rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.tax-section h4 i {
    margin-right: 0.5rem;
    color: var(--primary);
}

.tax-settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tax-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.tax-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.tax-checkbox.warning span {
    color: var(--warning);
}

.tax-deadline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tax-deadline label {
    color: var(--text-secondary);
}

.tax-deadline select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.tax-input-group {
    margin-bottom: 0.75rem;
}

.tax-input-group label {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.tax-input-group input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.tax-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.tax-items-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 0.5rem;
}

.tax-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.tax-item:last-child {
    margin-bottom: 0;
}

.tax-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.tax-item-code {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.tax-item-name {
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tax-item-amount {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0.5rem;
    white-space: nowrap;
}

.tax-item-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.tax-items-total {
    text-align: right;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
    color: var(--text-secondary);
}

.tax-items-total strong {
    color: var(--text-primary);
}

/* Result Panel */
.tax-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
}

.tax-result-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.tax-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.tax-status.draft {
    background: var(--warning);
    color: #000;
}

.tax-status.submitted {
    background: var(--info);
    color: white;
}

.tax-status.final {
    background: var(--success);
    color: white;
}

.tax-calculation-table {
    margin-bottom: 1.5rem;
}

.tax-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.tax-label {
    color: var(--text-secondary);
}

.tax-value {
    font-weight: 500;
    color: var(--text-primary);
}

.tax-value.positive {
    color: var(--success);
}

.tax-value.negative {
    color: var(--danger);
}

.tax-row.subtotal {
    background: var(--bg-primary);
    margin: 0 -1.5rem;
    padding: 0.75rem 1.5rem;
    border-bottom: none;
}

.tax-row.subtotal .tax-label,
.tax-row.subtotal .tax-value {
    font-weight: 600;
    color: var(--text-primary);
}

.tax-row.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    margin: 0.5rem -1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border-bottom: none;
}

.tax-row.highlight .tax-label,
.tax-row.highlight .tax-value {
    color: white;
    font-weight: 600;
}

.tax-row.total {
    margin: 0.5rem -1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border-bottom: none;
}

.tax-row.total.to-pay {
    background: var(--danger);
}

.tax-row.total.refund {
    background: var(--success);
}

.tax-row.total .tax-label,
.tax-row.total .tax-value {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.tax-result-footer {
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.tax-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tax-result-row span {
    color: var(--text-secondary);
}

.tax-result-row strong {
    font-size: 1.25rem;
}

.tax-result-row strong.positive {
    color: var(--success);
}

.tax-result-row strong.negative {
    color: var(--danger);
}

.tax-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tax-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid var(--warning);
    border-radius: 8px;
    color: var(--warning);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.tax-warning i {
    font-size: 1.25rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .tax-year-selector,
[data-theme="dark"] .tax-input-panel,
[data-theme="dark"] .tax-result-panel,
[data-theme="dark"] .tax-empty-state {
    background: var(--bg-secondary);
}

[data-theme="dark"] .year-tab {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .tax-item,
[data-theme="dark"] .tax-result-footer,
[data-theme="dark"] .tax-row.subtotal {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .tax-input-group input,
[data-theme="dark"] .tax-deadline select {
    background: var(--bg-tertiary);
}

/* ========================================
   Help Panel - Slide-in Drawer
   ======================================== */

.help-btn {
    position: relative;
}

.help-btn i {
    font-size: 1.1rem;
}

/* Help Panel Container */
.help-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    overflow: hidden;
}

.help-panel.active {
    right: 0;
}

/* Help Panel Header */
.help-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.help-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-panel-header h3 i {
    color: var(--primary);
}

.help-panel-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-panel-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Help Panel Search */
.help-panel-search {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.help-search-input {
    width: 100%;
    padding: 0.625rem 1rem;
    padding-left: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.help-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.help-search-input::placeholder {
    color: var(--text-muted);
}

.help-panel-search {
    position: relative;
}

.help-panel-search i {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

/* Help Panel Content */
.help-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

/* Help Sections */
.help-section {
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.help-section.hidden {
    display: none;
}

.help-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: background 0.2s ease;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
}

.help-section-header:hover {
    background: var(--bg-hover);
}

.help-section-header i {
    font-size: 1rem;
    color: var(--primary);
    width: 20px;
    text-align: center;
}

.help-section-header span {
    flex: 1;
    font-weight: 500;
    font-size: 0.95rem;
}

.help-section-header .fa-chevron-down {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.help-section.expanded .help-section-header .fa-chevron-down {
    transform: rotate(180deg);
}

.help-section-content {
    display: none;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.help-section.expanded .help-section-content {
    display: block;
}

.help-section-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.help-section-content h4:not(:first-child) {
    margin-top: 1rem;
}

.help-section-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

.help-section-content ul {
    margin: 0 0 0.75rem 0;
    padding-left: 1.25rem;
}

.help-section-content li {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    line-height: 1.5;
}

.help-section-content li strong {
    color: var(--text-primary);
}

/* Keyboard Shortcuts */
.help-shortcuts {
    display: grid;
    gap: 0.5rem;
}

.help-shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.help-shortcut:last-child {
    border-bottom: none;
}

.help-shortcut span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.help-shortcut kbd + kbd {
    margin-left: 0.25rem;
}

/* Help Tips */
.help-tip {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--primary-light);
    border-radius: 6px;
    margin-top: 0.75rem;
}

.help-tip i {
    color: var(--warning);
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.help-tip p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Help Panel Overlay */
.help-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1099;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.help-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Dark mode adjustments for help panel */
[data-theme="dark"] .help-panel {
    background: var(--bg-primary);
    border-left-color: var(--border-color);
}

[data-theme="dark"] .help-section-header {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .help-section-header:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] kbd {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .help-tip {
    background: rgba(102, 126, 234, 0.15);
}

/* Mobile responsive help panel */
@media (max-width: 480px) {
    .help-panel {
        width: 100vw;
        right: -100vw;
    }

    .help-panel-header {
        padding: 0.875rem 1rem;
    }

    .help-panel-search {
        padding: 0.75rem 1rem;
    }

    .help-panel-content {
        padding: 0.75rem 1rem;
    }

    .help-section-header {
        padding: 0.75rem;
    }

    .help-section-content {
        padding: 0.75rem;
    }

    .help-panel-close {
        min-width: 44px;
        min-height: 44px;
    }
}
