:root {
    /* Color Palette - Kawan Kita Brand (Blue) */
    --primary: #3b82f6;
    /* Blue 500 */
    --primary-dark: #2563eb;
    /* Blue 600 */
    --primary-light: #60a5fa;
    /* Blue 400 */
    --secondary: #64748b;
    /* Slate 500 */
    --success: #10b981;
    /* Emerald 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --danger: #ef4444;
    /* Red 500 */
    --info: #0ea5e9;
    /* Sky 500 */

    /* Backgrounds - Modern Deep Charcoal / Zinc */
    --bg-primary: #0f172a;
    /* Slate 900 */
    --bg-secondary: #1e293b;
    /* Slate 800 */
    --bg-card: #1e293b;
    /* Slate 800 */
    --bg-hover: #334155;
    /* Slate 700 */
    --bg-input: #0f172a;
    /* Slate 900 */

    /* Text Colors */
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #cbd5e1;
    /* Slate 300 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    /* Borders */
    --border-color: #334155;
    /* Slate 700 */
    --border-light: #475569;
    /* Slate 600 */

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
    /* Blue Glow */

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

.theme-light {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;
    --bg-input: #ffffff;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --border-color: #cbd5e1;
    --border-light: #e2e8f0;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 15px rgba(15, 23, 42, 0.10);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.theme-light .card-footer,
.theme-light .table th,
.theme-light .invoice-summary {
    background: rgba(15, 23, 42, 0.04);
}

.theme-light .loading-overlay {
    background: rgba(241, 245, 249, 0.8);
}

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

.p-0 {
    padding: 0 !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

/* Theme Toggle Styles */
.theme-toggle-btn .sun-icon,
.theme-toggle-btn .moon-icon {
    display: none;
}

.theme-toggle-btn .theme-text-light,
.theme-toggle-btn .theme-text-dark {
    display: none;
}

/* Default state (Dark Mode) - Show Sun icon and 'Mode Terang' text */
.sun-icon {
    display: block !important;
}
.theme-text-light {
    display: block !important;
}

/* Light Mode state - Hide Sun, show Moon and 'Mode Gelap' text */
.theme-light .sun-icon {
    display: none !important;
}
.theme-light .theme-text-light {
    display: none !important;
}
.theme-light .moon-icon {
    display: block !important;
}
.theme-light .theme-text-dark {
    display: block !important;
}

/* =============================================
   Login Page Styles
   ============================================= */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    padding: 20px;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo h1 {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 5px;
}

/* =============================================
   Form Elements
   ============================================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 20px;
}


/* =============================================
   Buttons
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    position: relative;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 10px;
    border-radius: var(--radius-md);
}

/* =============================================
   Dashboard Layout
   ============================================= */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    height: 70px;
    display: flex;
    align-items: center;
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
}

.sidebar-logo span {
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    padding-bottom: 40px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.nav-section {
    margin-bottom: 32px;
}

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

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: 6px;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md), 0 0 15px rgba(59, 130, 246, 0.4);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

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

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.user-actions {
    display: flex;
    gap: 6px;
    padding-top: 12px;
    justify-content: flex-start;
}

.user-actions .btn-icon {
    padding: 6px;
}



/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: calc(100vw - var(--sidebar-width));
}

/* Desktop Header with Profile */
.desktop-header {
    position: sticky;
    top: 0;
    right: 0;
    width: 100%;
    height: 70px;
    padding: 0 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    z-index: 51;
}

.profile-menu {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 16px 8px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
}

.profile-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.profile-trigger .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
}

.profile-trigger .user-details {
    text-align: left;
}

.profile-trigger .user-name {
    font-size: 0.85rem;
}

.profile-trigger .user-role {
    font-size: 0.7rem;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    overflow: hidden;
    z-index: 999;
}

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

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 0.9rem;
}

.profile-dropdown-item:hover {
    background: var(--bg-hover);
}

.profile-dropdown-item svg {
    color: var(--text-muted);
}

.profile-dropdown-item:hover svg {
    color: var(--primary);
}

/* Mobile Header */
.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}


.content-header {
    padding: 32px 40px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    max-width: 100%;
    overflow-x: hidden;
    gap: 24px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

.content-body {
    flex: 1;
    padding: 32px 40px;
    max-width: 100%;
    overflow-x: hidden;
}

/* =============================================
   Cards
   ============================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    position: relative;
    max-width: 100%;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    margin-bottom: 24px;
}

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

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

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 24px;
    max-width: 100%;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-content {
    flex: 1;
    text-align: left;
}

.stat-value {
    /* Ukuran untuk Mobile (Default) */
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* =============================================
   Tables
   ============================================= */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.card .table-container {
    margin-bottom: 0;
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: separate;
    /* Changed from collapse for radius */
    border-spacing: 0;
}

.table th,
.table td {
    padding: 18px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table th:first-child,
.table td:first-child {
    padding-left: 24px;
}

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

.table th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.03);
}

.theme-light .table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.015);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

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

.table td {
    font-size: 0.9375rem;
}

.table-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    align-items: center;
}

.table-empty-state {
    text-align: center;
    padding: 60px 40px !important;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* =============================================
   Badges
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: capitalize;
    line-height: 1;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.15);
    color: var(--secondary);
}

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

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* =============================================
   Background Utilities
   ============================================= */
.bg-warning-subtle {
    background: rgba(245, 158, 11, 0.08) !important;
    border-left: 3px solid var(--warning);
}

.bg-success-subtle {
    background: rgba(16, 185, 129, 0.08) !important;
    border-left: 3px solid var(--success);
}

.bg-danger-subtle {
    background: rgba(239, 68, 68, 0.08) !important;
    border-left: 3px solid var(--danger);
}

/* =============================================
   Alerts
   ============================================= */
/* =============================================
   Alerts
   ============================================= */
.alert {
    padding: 18px 28px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;

    /* Fixed Center Positioning */
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 350px;
    max-width: 90%;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    animation: slideDownFade 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border-width: 1px;
    border-style: solid;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #065f46;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.alert-info {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    color: #075985;
}

/* =============================================
   Search & Filters
   ============================================= */
.search-box {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.search-input-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper svg {
    position: absolute;
    left: 12px;
    /* top: 50%; */
    /* transform: translateY(-50%); */
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    pointer-events: none;
    /* Ensure click goes through to input */
    z-index: 10;
}

.search-input-wrapper input {
    padding-left: 40px;
    /* Make space for icon */
    width: 100%;
}

.filter-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    min-width: 150px;
}

.filter-group .form-group {
    margin-bottom: 0;
}

/* =============================================
   Modal
   ============================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

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

/* =============================================
   Empty State
   ============================================= */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* =============================================
   Loading Spinner
   ============================================= */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* =============================================
   Invoice Specific Styles
   ============================================= */
.invoice-items-table {
    margin-top: 20px;
}

.invoice-items-table .form-control {
    padding: 10px 12px;
}

.add-item-btn {
    margin-top: 12px;
}

.remove-item-btn {
    padding: 8px;
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.remove-item-btn:hover {
    background: rgba(239, 68, 68, 0.15);
}

.invoice-summary {
    margin-top: 24px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
}

.invoice-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    color: var(--text-secondary);
}

.invoice-summary-row.total {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 8px;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

/* =============================================
   Responsive
   ============================================= */
.d-md-none {
    display: none !important;
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
}

.mobile-logo {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-light);
    padding: 4px 0;
}

.mobile-logo span {
    color: var(--text-primary);
    padding-left: 2px;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 90;
    /* Below sidebar (100) but above content */
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

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

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 1024px) {
    .d-md-none {
        display: flex !important;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
        height: 100%;
        height: 100dvh;
    }

    .sidebar-nav {
        padding-bottom: 100px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    .content-header,
    .content-body {
        padding: 20px;
        max-width: 100vw;
    }
}

/* Display Utilities */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.d-inline-flex {
    display: inline-flex !important;
}

@media (min-width: 641px) {

    /* Tablet/Desktop */
    .d-none {
        display: none !important;
    }

    /* Override potentially */
    .d-md-none {
        display: none !important;
    }

    .d-md-block {
        display: block !important;
    }

    .d-md-flex {
        display: flex !important;
    }

    .d-md-inline-flex {
        display: inline-flex !important;
    }

    .d-md-table-cell {
        display: table-cell !important;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .stat-card {
        padding: 16px !important;
    }

    .stat-value {
        font-size: 1.1rem !important;
    }

    .stat-label {
        font-size: 0.75rem !important;
    }

    .table th,
    .table td {
        padding: 12px 14px;
        font-size: 0.875rem;
    }

    .w-100-mobile {
        width: 100% !important;
        flex: none !important;
        min-width: 0 !important;
    }

    .content-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
        padding: 20px 20px !important;
    }

    .content-header .d-flex {
        width: 100%;
        gap: 12px;
    }

    .content-header .btn {
        flex: 1;
        justify-content: center;
    }

    .content-header>div:first-child {
        flex: 1;
        min-width: 0;
        /* Allows text truncation/wrapping */
        padding-right: 8px;
    }

    .content-header .page-title {
        font-size: 1.25rem;
    }

    .content-header .page-subtitle {
        font-size: 0.85rem;
        /* Slightly smaller for mobile */
        line-height: 1.2;
    }

    .content-header .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .search-box {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        /* Ensure container is full width */
    }

    .search-input-wrapper {
        width: 100%;
        min-width: 0;
        /* Override any desktop min-width */
    }

    .table th,
    .table td {
        padding: 14px 16px;
    }

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

/* =============================================
   Utilities
   ============================================= */
.text-center {
    text-align: center;
}

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

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

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

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

.text-warning {
    color: var(--warning);
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mt-4 {
    margin-top: 32px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mb-4 {
    margin-bottom: 32px;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.gap-3 {
    gap: 24px;
}

.w-100 {
    width: 100%;
}

/* =============================================
   Mobile Responsiveness Utilities
   ============================================= */
.chart-scroll-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chart-wrapper {
    min-width: 600px;
    /* Force scroll on small screens */
    height: 250px;
    position: relative;
}

@media (max-width: 640px) {

    /* Hide specific columns in Recent Invoices Table */
    .recent-invoices-table th:nth-child(3),
    /* Tanggal */
    .recent-invoices-table td:nth-child(3),
    .recent-invoices-table th:nth-child(4),
    /* Total */
    .recent-invoices-table td:nth-child(4),
    .recent-invoices-table th:nth-child(5),
    /* Status */
    .recent-invoices-table td:nth-child(5) {
        display: none;
    }

    .recent-invoices-table tr {
        cursor: pointer;
        position: relative;
    }

    /* Add indicator that row is clickable */
    .recent-invoices-table td:last-child {
        padding-right: 30px;
    }

    .recent-invoices-table td:last-child::after {
        content: '›';
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        color: var(--text-muted);
        font-weight: 300;
        display: block;
    }

    /* Hide specific columns in Clients Table - show only client name */
    .clients-table th:nth-child(2),
    /* Kontak */
    .clients-table td:nth-child(2),
    .clients-table th:nth-child(3),
    /* Status */
    .clients-table td:nth-child(3),
    .clients-table th:nth-child(4),
    /* Revenue */
    .clients-table td:nth-child(4),
    .clients-table th:nth-child(5),
    /* Aksi */
    .clients-table td:nth-child(5) {
        display: none;
    }

    .clients-table tbody tr {
        cursor: pointer;
        position: relative;
    }

    /* Make client name cell clickable with visual feedback */
    .clients-table tbody td:first-child {
        padding-right: 40px;
    }

    /* Add chevron indicator for clickable rows */
    .clients-table tbody td:first-child::after {
        content: '›';
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        color: var(--text-muted);
        font-weight: 300;
        display: block;
    }

    /* Hide specific columns in Contracts Table - mobile shows: No. Kontrak, Layanan, Status */
    /* On mobile, hide: Klien (2), Periode (4), Nilai (5), Dokumen (7), Aksi (8) */
    .contracts-table th:nth-child(2),
    .contracts-table td:nth-child(2),
    /* Klien - hidden on mobile */
    .contracts-table th:nth-child(4),
    .contracts-table td:nth-child(4),
    /* Periode */
    .contracts-table th:nth-child(5),
    .contracts-table td:nth-child(5),
    /* Nilai */
    .contracts-table th:nth-child(7),
    .contracts-table td:nth-child(7),
    /* Dokumen */
    .contracts-table th:nth-child(8),
    .contracts-table td:nth-child(8) {
        /* Aksi */
        display: none;
    }

    .contracts-table tbody tr {
        cursor: pointer;
        position: relative;
    }

    .contracts-table tbody td:first-child {
        padding-right: 40px;
    }

    .contracts-table tbody td:first-child::after {
        content: '›';
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        color: var(--text-muted);
        font-weight: 300;
        display: block;
    }

    .contracts-table tbody tr {
        cursor: pointer;
        position: relative;
    }

    .contracts-table tbody td:first-child {
        padding-right: 40px;
    }

    .contracts-table tbody td:first-child::after {
        content: '›';
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        color: var(--text-muted);
        font-weight: 300;
        display: block;
    }

    /* Hide specific columns in Website Monitoring Table - mobile shows: Nama Klien, Status */
    /* Columns: 1=Checkbox, 2=Nama Klien, 3=URL, 4=Status, 5=Response Time, 6=Last Check, 7=Aksi */
    .monitoring-table th:nth-child(1),
    .monitoring-table td:nth-child(1),
    /* Checkbox - hidden */
    .monitoring-table th:nth-child(3),
    .monitoring-table td:nth-child(3),
    /* URL - hidden on mobile (shown below Nama Klien) */
    .monitoring-table th:nth-child(5),
    .monitoring-table td:nth-child(5),
    /* Response Time - hidden */
    .monitoring-table th:nth-child(6),
    .monitoring-table td:nth-child(6),
    /* Last Check - hidden */
    .monitoring-table th:nth-child(7),
    .monitoring-table td:nth-child(7) {
        /* Aksi - hidden */
        display: none;
    }

    .monitoring-table tbody tr {
        cursor: pointer;
        position: relative;
    }

    .monitoring-table tbody td:nth-child(2) {
        padding-right: 40px;
    }

    .monitoring-table tbody td:nth-child(2)::after {
        content: '›';
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        color: var(--text-muted);
        font-weight: 300;
        display: block;
    }

    /* Hide specific columns in Services Table - show only service name and detail button */
    .services-table th:nth-child(1),
    /* Kategori */
    .services-table td:nth-child(1),
    .services-table th:nth-child(3),
    /* HPP */
    .services-table td:nth-child(3),
    .services-table th:nth-child(4),
    /* Harga Rekomendasi */
    .services-table td:nth-child(4) {
        display: none;
    }

    .services-table tbody tr {
        position: relative;
    }

    /* Expenses page mobile view */
    .expenses-stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .expenses-filter {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .expenses-filter .form-group {
        width: 100% !important;
        margin-bottom: 12px !important;
    }

    .expenses-filter .filter-buttons {
        display: flex;
        gap: 8px;
        margin-top: 8px !important;
    }

    .expenses-filter .filter-buttons .btn {
        flex: 1;
    }

    /* Hide expense table columns on mobile */
    .expenses-table th:nth-child(1),
    /* Checkbox */
    .expenses-table td:nth-child(1),
    .expenses-table th:nth-child(3),
    /* Kategori */
    .expenses-table td:nth-child(3),
    .expenses-table th:nth-child(6),
    /* Dicatat Oleh */
    .expenses-table td:nth-child(6),
    .expenses-table th:nth-child(7),
    /* Bukti */
    .expenses-table td:nth-child(7),
    .expenses-table th:nth-child(8),
    /* Aksi */
    .expenses-table td:nth-child(8) {
        display: none;
    }
}

/* =============================================
   Notification System
   ============================================= */
.notification-btn {
    position: relative !important;
    overflow: visible !important;
}

.notification-badge {
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 4px !important;
    background: #ef4444 !important;
    color: #ffffff !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    border-radius: 100px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid var(--bg-secondary) !important;
    z-index: 100 !important;
    pointer-events: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
    animation: badgePulse 2s infinite !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

@keyframes badgePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1.2);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

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

.notification-dropdown {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 380px;
    max-height: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 2001; /* Above almost everything */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

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

.notification-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.notification-tabs {
    display: flex;
    padding: 0 8px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.notification-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
    position: relative;
}

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

.notification-tab span {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 4px;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-card);
}

.notification-item {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    position: relative;
}

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

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

/* Unread indicator dot */
.notification-item.unread-style::after {
    content: '';
    position: absolute;
    top: 20px;
    right: 20px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

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

.notification-icon.contract {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.notification-icon.invoice {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
}

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

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--text-primary);
    line-height: 1.3;
}

.notification-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.notification-message {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    display: inline-block;
    color: var(--text-muted);
}

.notification-item.expired, 
.notification-item.overdue {
    border-left: 3px solid var(--danger);
}

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

.notification-item.expired .notification-message,
.notification-item.overdue .notification-message {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.notification-item.warning .notification-message {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

/* Mobile specific overrides */
@media (max-width: 640px) {
    .notification-dropdown {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: none;
        height: 70vh;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        border: none;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
    }

    .notification-dropdown.active {
        transform: translateY(0);
    }

    .notification-header {
        padding: 20px;
    }

    .notification-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--border-color);
        border-radius: 2px;
    }
}

/* Desktop notification dropdown positioning */
@media (min-width: 769px) {
    .notification-dropdown {
        position: fixed;
        top: auto;
        left: auto;
        right: 20px;
        bottom: 80px;
        transform: translateY(10px);
        width: 380px;
    }

    .notification-dropdown.active {
        transform: translateY(0);
    }
}

/* Monitoring Table Mobile URL */
.monitoring-mobile-url {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.monitoring-mobile-url a {
    font-size: 12px;
}

/* =============================================
   Client Autocomplete Styles
   ============================================= */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.autocomplete-input {
    width: 100%;
    padding-right: 40px;
    /* Space for clear button */
}

.autocomplete-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000; /* Increased to ensure it stays on top of everything */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

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

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: var(--bg-hover);
}

.autocomplete-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

.autocomplete-item-details {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

.autocomplete-loading {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.autocomplete-loading .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.autocomplete-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Scrollbar for autocomplete dropdown */
.autocomplete-dropdown::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: var(--bg-card);
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

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

/* Action Dropdown */
.action-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    overflow: hidden;
    text-align: left;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 0.8125rem;
    line-height: 1.4;
}

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

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

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

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

/* =============================================
   Premium Mobile & Responsiveness Enhancements
   ============================================= */

@media (max-width: 1024px) {
    :root {
        --header-height: 60px;
    }

    .mobile-header {
        height: var(--header-height);
        padding: 0 16px;
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
        z-index: 101; /* Above sidebar overlay */
    }

    .content-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .content-header .d-flex {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .content-body {
        padding: 16px;
    }

    .card-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .card-body {
        padding: 16px;
    }

    .p-0 {
        padding: 0 !important;
    }

    /* Mobile Profile Dropdown Positioning */
    .mobile-profile .profile-dropdown {
        position: fixed;
        top: var(--header-height);
        right: 16px;
        left: 16px;
        width: auto;
        transform: translateY(-10px);
    }

    .mobile-profile .profile-dropdown.active {
        transform: translateY(10px);
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }

    .search-box {
        flex-direction: column;
        gap: 12px;
    }

    .search-input-wrapper, 
    .filter-group,
    .filter-select {
        width: 100% !important;
        min-width: 0 !important;
    }

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

    .btn-sm, .btn-icon {
        width: auto;
    }

    /* Table Scrolling Enhancements */
    .table-container {
        border-radius: var(--radius-sm);
        margin: 0 -16px; /* Bleed to edges for more space */
        width: calc(100% + 32px);
        border-left: none;
        border-right: none;
    }
    
    .p-0 .table-container,
    .card-body[style*="padding: 0"] .table-container {
        margin: 0;
        width: 100%;
        border-radius: 0;
    }

    .table th, .table td {
        padding: 12px 16px;
        font-size: 0.875rem;
    }

    /* Indicators for horizontal scroll */
    .table-container {
        background: linear-gradient(to right, var(--bg-card) 30%, rgba(255,255,255,0)),
                    linear-gradient(to right, rgba(255,255,255,0), var(--bg-card) 70%) 0 100%,
                    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.2), rgba(0,0,0,0)),
                    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;
        background-repeat: no-repeat;
        background-color: var(--bg-card);
        background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
        background-attachment: local, local, scroll, scroll;
    }
}

@media (max-width: 768px) {
    .stat-card {
        padding: 16px;
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: 12px;
        background: rgba(30, 41, 59, 0.7);
        backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        margin-bottom: 0;
        border-radius: 10px;
    }

    .stat-icon svg {
        width: 20px;
        height: 20px;
    }

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

    .stat-value {
        font-size: 1.15rem;
        font-weight: 700;
        color: #fff;
        line-height: 1.2;
    }

    .stat-label {
        font-size: 0.75rem;
        color: var(--text-secondary);
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.025em;
    }
}

@media (min-width: 1024px) {
    .stat-value {
        font-size: 21px;
    }
}


@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .modal {
        margin: 10px;
        width: calc(100% - 20px);
        max-height: 95vh;
    }

    .login-box {
        padding: 24px;
    }
}

/* Animation for Sidebar */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.open {
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

/* Better Touch Targets */
.nav-link, .btn, .form-control, .dropdown-item {
    min-height: 48px;
}

.table-actions {
    gap: 14px !important;
}

/* Prevent zoom on focus on iOS */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* =============================================
   Responsive Item Tables (Invoices/Proposals)
   ============================================= */
@media (max-width: 768px) {
    .invoice-items-table thead,
    #itemsTable thead {
        display: none !important;
    }

    .invoice-items-table tr.item-row,
    #itemsTable tr.item-row {
        display: block !important;
        padding: 20px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--radius-lg) !important;
        margin-bottom: 24px !important;
        background: rgba(255, 255, 255, 0.03) !important;
        position: relative;
    }

    .invoice-items-table td,
    #itemsTable td {
        display: block !important;
        width: 100% !important;
        padding: 10px 0 !important;
        border: none !important;
        text-align: left !important;
    }

    .invoice-items-table td:before,
    #itemsTable td:before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--primary-light);
        margin-bottom: 6px;
    }

    /* Action button positioning on mobile */
    .invoice-items-table .remove-item-btn,
    #itemsTable .btn-danger {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 50% !important;
    }

    /* Subtotal highlight */
    .item-subtotal {
        font-weight: 600;
        color: var(--success) !important;
    }

    /* Form & Card Compactness for Mobile */
    .form-group {
        margin-bottom: 16px !important;
    }
    .card-body {
        padding: 16px !important;
    }
    .card-header {
        padding: 14px 16px !important;
    }
    .form-control {
        padding: 10px 14px !important;
    }
    .autocomplete-item {
        padding: 14px 16px !important;
        min-height: auto !important;
    }
    .autocomplete-dropdown {
        max-height: 280px !important;
    }

    /* Global Responsive Table (Cards on Mobile) */
    .responsive-table table, 
    .responsive-table thead, 
    .responsive-table tbody, 
    .responsive-table th, 
    .responsive-table td, 
    .responsive-table tr {
        display: block;
    }

    .responsive-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .responsive-table tr {
        margin-bottom: 16px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 8px;
        position: relative;
    }

    .responsive-table td {
        border: none;
        position: relative;
        padding-left: 45% !important;
        text-align: left !important;
        min-height: 35px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .responsive-table td:last-child {
        border-bottom: none;
    }

    .responsive-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
    }

    .responsive-table .table-actions {
        justify-content: flex-start !important;
        width: 100%;
    }

    /* Header Actions Responsive */
    .content-header-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
        margin-top: 10px;
    }

    .content-header-actions .btn {
        flex: 1 0 auto !important;
        min-width: 0 !important;
        padding: 10px 12px !important;
        font-size: 0.8rem !important;
    }
}

/* Hide button text on very small screens to keep layout clean */
@media (max-width: 480px) {
    .content-header-actions .btn-text {
        display: none !important;
    }
    .content-header-actions .btn {
        flex: 0 0 calc(20% - 7px) !important; /* 5 buttons per row roughly */
        padding: 10px !important;
    }
}