/* Global CSS & Design System - Modern Multitenant Cotizador */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --bg-body: #f1f5f9;
    --surface-bg: #f8fafc;
    --card-bg: #ffffff;
    --paper-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --heading-color: #0f172a;
    --input-bg: #f8fafc;
    --input-readonly-bg: #e2e8f0;
    --table-th-bg: #f1f5f9;
    --modal-bg: #ffffff;
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 30px -10px rgba(79, 70, 229, 0.15);
}

[data-theme="dark"] {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.25);
    --secondary: #38bdf8;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    
    --bg-body: #0b0f19;
    --surface-bg: #111827;
    --card-bg: #1e293b;
    --paper-bg: #1e293b;
    --border-color: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --heading-color: #ffffff;
    --input-bg: #0f172a;
    --input-readonly-bg: #1e293b;
    --table-th-bg: #0f172a;
    --modal-bg: #1e293b;
    
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.5);
    --shadow-lg: 0 20px 30px -10px rgba(0,0,0,0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.25s ease, color 0.25s ease;
    overflow-x: hidden;
    margin-left: 280px;
}

@media (max-width: 1024px) {
    body {
        margin-left: 0;
    }
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
}

/* Layout Header / Navbar */
.navbar {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    color: white;
    padding: 0.75rem 1.75rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
    flex-shrink: 0;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

/* LEFT SIDEBAR */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: none;
}

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

.left-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    color: white;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.35);
}

@media (max-width: 1024px) {
    .left-sidebar {
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        transform: translateX(-100%);
    }

    .left-sidebar.mobile-hidden {
        transform: translateX(-100%);
    }

    .left-sidebar:not(.mobile-hidden) {
        transform: translateX(0);
    }
}

.sidebar-header {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    gap: 1rem;
    height: 58px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: white;
    font-weight: 700;
    flex: 1;
    min-width: 0;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    transform: translateY(-5px);
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar-content {
    padding: 1.5rem 1rem;
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: none;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 1024px) {
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    width: 100%;
}

.sidebar-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.4rem 0.65rem;
    font-size: 0.9rem;
    width: 100%;
    justify-content: flex-start;
}

.sidebar-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
}

.sidebar-actions form button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.4rem 0.65rem;
    width: 100%;
    justify-content: flex-start;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.navbar-brand .logo-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    margin-right: 0.25rem;
}

.tenant-pill {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.825rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.tenant-pill strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-nav-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}

.mobile-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.nav-links-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-direction: row;
}

.left-sidebar .nav-links-wrapper {
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
}

.left-sidebar .nav-link {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    justify-content: flex-start;
    border-radius: var(--radius-md);
}

.user-profile-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 1rem;
}

.left-sidebar .user-profile-section {
    border-left: none;
    padding-left: 0;
    flex-direction: column;
    align-items: flex-start;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.18);
}


/* Container */
.container {
    max-width: 1200px;
    width: calc(100% - 2.5rem);
    margin: 1.75rem auto;
    padding: 0 1.25rem;
    flex: 1;
    transition: all 0.3s ease;
}

/* Responsive Grids */
.responsive-layout-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
}

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

/* Table Responsive Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

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

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

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.825rem;
}

/* STICKY NOTIFICATIONS */
.sticky-notification-container {
    position: fixed;
    top: 5rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

.sticky-toast {
    pointer-events: auto;
    background: var(--card-bg);
    color: var(--text-main);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.25);
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    border-left: 5px solid var(--primary);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
}

.sticky-toast.toast-success {
    border-left-color: var(--success);
}

.sticky-toast.toast-info {
    border-left-color: var(--secondary);
}

.sticky-toast.toast-error {
    border-left-color: var(--danger);
}

.sticky-toast .toast-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.sticky-toast .toast-body {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-main);
}

.sticky-toast .toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 0.2rem;
    opacity: 0.6;
}

.sticky-toast .toast-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* CUSTOM CONFIRMATION MODAL */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    padding: 1rem;
}

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

.modal-content {
    background: var(--modal-bg);
    color: var(--text-main);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 1.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    transform: scale(0.95);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.modal-header .modal-icon-danger {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--heading-color);
}

.modal-body {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.75rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* RIGHT DRAWER MODAL SYSTEM (SUBTLE SCROLLBAR, RIGHT SLIDE) */
.left-drawer-backdrop, .right-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9400;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.left-drawer-backdrop.active, .right-drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.left-drawer, .right-drawer {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    bottom: 0;
    width: 460px;
    max-width: 90vw;
    background: var(--card-bg);
    color: var(--text-main);
    border-left: 1px solid var(--border-color);
    border-right: none;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.35);
    z-index: 9500;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.left-drawer.active, .right-drawer.active {
    transform: translateX(0);
}

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

.left-drawer-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--heading-color);
    margin: 0;
}

.left-drawer-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

[data-theme="dark"] .left-drawer-close {
    background: rgba(255, 255, 255, 0.1);
}

.left-drawer-close:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

.left-drawer-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(226, 232, 240, 0.4) transparent;
}

.left-drawer-body::-webkit-scrollbar {
    width: 4px;
}

.left-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.left-drawer-body::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.3);
    border-radius: 9999px;
    transition: background-color 0.2s ease;
}

.left-drawer-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.5);
}

[data-theme="dark"] .left-drawer-body {
    scrollbar-color: rgba(71, 85, 105, 0.3) transparent;
}

[data-theme="dark"] .left-drawer-body::-webkit-scrollbar-thumb {
    background-color: rgba(71, 85, 105, 0.3);
}

[data-theme="dark"] .left-drawer-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(71, 85, 105, 0.5);
}

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

/* CLIENT AUTOCOMPLETE COMPONENT */
.client-autocomplete-container {
    position: relative;
    width: 100%;
}

.client-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    max-height: 380px;
    overflow-y: auto;
    scroll-behavior: smooth;
    display: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(226, 232, 240, 0.4) transparent;
}

.client-autocomplete-dropdown::-webkit-scrollbar {
    width: 4px;
}

.client-autocomplete-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.client-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.3);
    border-radius: 9999px;
}

.client-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.5);
}

[data-theme="dark"] .client-autocomplete-dropdown {
    scrollbar-color: rgba(71, 85, 105, 0.3) transparent;
}

[data-theme="dark"] .client-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background-color: rgba(71, 85, 105, 0.3);
}

[data-theme="dark"] .client-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background-color: rgba(71, 85, 105, 0.5);
}

.client-autocomplete-dropdown.active {
    display: block;
}

.client-autocomplete-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.client-autocomplete-item:hover,
.client-autocomplete-item.selected {
    background: var(--primary-light);
}

.client-autocomplete-more-btn {
    padding: 0.75rem 1rem;
    text-align: center;
    background: var(--input-bg);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border-top: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

.client-autocomplete-more-btn:hover {
    background: var(--primary-light);
}

/* WYSIWYG QUOTE PAPER FORM */
.quote-paper-container {
    background: var(--paper-bg);
    color: var(--text-main);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.quote-paper-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 2rem;
    border-bottom: 2px dashed var(--border-color);
    margin-bottom: 2rem;
}

.company-brand-box h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.quote-meta-box {
    text-align: right;
}

.quote-meta-box .quote-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--heading-color);
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    font-size: 0.925rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control[readonly] {
    background: var(--input-readonly-bg) !important;
    color: var(--text-muted);
}

/* Quote Items Table */
.quote-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    min-width: 600px;
}

.quote-table th {
    background: var(--table-th-bg);
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.quote-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

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

/* Totals Summary Box */
.totals-box {
    width: 100%;
    max-width: 360px;
    margin-left: auto;
    background: var(--input-bg);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.925rem;
    color: var(--text-muted);
}

.totals-row.final-total {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    border-top: 2px solid var(--border-color);
    padding-top: 0.8rem;
    margin-top: 0.5rem;
}

/* Status Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    white-space: nowrap;
}

.badge-draft { background: #e2e8f0; color: #475569; }
.badge-sent { background: #e0f2fe; color: #0369a1; }
.badge-approved { background: #d1fae5; color: #047857; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }

[data-theme="dark"] .badge-draft { background: #334155; color: #cbd5e1; }
[data-theme="dark"] .badge-sent { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
[data-theme="dark"] .badge-approved { background: rgba(16, 185, 129, 0.2); color: #34d399; }
[data-theme="dark"] .badge-rejected { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* Mobile Left Drawer & Backdrop System */
.mobile-drawer-header,
.mobile-drawer-tenant {
    display: none;
}

.mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* MEDIA QUERIES FOR MOBILE & TABLET RESPONSIVENESS */

@media (max-width: 1100px) {
    .navbar-brand .logo-badge {
        display: none;
    }
    .tenant-pill {
        max-width: 190px;
    }
}

@media (max-width: 1200px) {
    body {
        margin-left: 0;
    }

    .navbar {
        margin-left: 0;
    }

    .left-sidebar {
        width: 280px;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        transform: translateX(-100%);
    }

    .left-sidebar:not(.mobile-hidden) {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .left-sidebar.mobile-hidden {
        transform: translateX(-100%);
    }

    .sidebar-backdrop {
        display: block;
    }

    .sidebar-close {
        display: flex;
    }
}

@media (max-width: 850px) {
    .navbar {
        padding: 0.75rem 1rem;
    }

    .responsive-layout-grid {
        grid-template-columns: 1fr;
    }
}

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

@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 0 0.85rem;
    }

    .card {
        padding: 1.15rem;
        border-radius: var(--radius-md);
    }

    .quote-paper-container {
        padding: 1.25rem 1rem;
    }

    div[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }

    .quote-paper-header {
        flex-direction: column;
        gap: 1.25rem;
        align-items: flex-start;
    }

    .quote-meta-box {
        text-align: left;
    }

    .totals-box {
        max-width: 100%;
    }

    .sticky-notification-container {
        top: 1rem;
        right: 0.75rem;
        left: 0.75rem;
        max-width: none;
    }

    .modal-content {
        padding: 1.25rem;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .navbar-brand {
        font-size: 1.1rem;
    }

    .logo-badge {
        display: none;
    }

    .tenant-pill {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.55rem 1rem;
    }
}

/* Pagination Styling */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    gap: 0.35rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
}

.pagination .page-item .page-link,
.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
    min-width: 36px;
    height: 36px;
}

.pagination .page-item.active .page-link,
.pagination li.active span,
.pagination li.active a {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.pagination .page-item .page-link:hover,
.pagination li a:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}

.pagination .page-item.disabled .page-link,
.pagination li.disabled span {
    color: var(--text-muted);
    opacity: 0.5;
    background: var(--table-th-bg);
    cursor: not-allowed;
}

/* DASHBOARD STYLES */
.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

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

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

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
}

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

.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-info {
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.kpi-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--heading-color);
    line-height: 1.1;
}

.kpi-description {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* RECENT QUOTES PANEL */
.recent-quotes-panel {
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.recent-quotes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.recent-quotes-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    overflow-y: auto;
    max-height: 145px;
    padding-right: 4px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.recent-quotes-list::-webkit-scrollbar {
    width: 4px;
}

.recent-quotes-list::-webkit-scrollbar-track {
    background: transparent;
}

.recent-quotes-list::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.3);
    border-radius: 9999px;
}

.recent-quotes-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.5);
}

.recent-quote-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.recent-quote-item:hover {
    border-color: var(--primary);
    transform: translateX(2px);
}

.quote-number-link {
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
}

.quote-number-link:hover {
    text-decoration: underline;
}

.recent-quote-client {
    font-size: 0.775rem;
    color: var(--heading-color);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* DASHBOARD SECONDARY GRID (CLIENTS & PRODUCTS) */
.dashboard-secondary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

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

.dashboard-card-secondary {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

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

.dashboard-mini-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dashboard-mini-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.dashboard-mini-item:hover {
    border-color: var(--primary);
    transform: translateX(2px);
}

/* SLEEK CONGRUENT SCROLLBAR FOR DARK/LIGHT THEME */
.recent-quotes-list::-webkit-scrollbar,
.heatmap-scroll-wrapper::-webkit-scrollbar,
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.recent-quotes-list::-webkit-scrollbar-track,
.heatmap-scroll-wrapper::-webkit-scrollbar-track,
::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 9999px;
}

.recent-quotes-list::-webkit-scrollbar-thumb,
.heatmap-scroll-wrapper::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    transition: background 0.2s ease;
}

.recent-quotes-list::-webkit-scrollbar-thumb:hover,
.heatmap-scroll-wrapper::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

[data-theme="light"] .recent-quotes-list::-webkit-scrollbar-thumb,
[data-theme="light"] .heatmap-scroll-wrapper::-webkit-scrollbar-thumb,
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .recent-quotes-list::-webkit-scrollbar-thumb:hover,
[data-theme="light"] .heatmap-scroll-wrapper::-webkit-scrollbar-thumb:hover,
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* MAIN DASHBOARD CARD & SPLIT LAYOUT */
.dashboard-main-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.dashboard-split-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.75rem;
    align-items: stretch;
}

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

/* HEATMAP CONTAINER */
.heatmap-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

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

.heatmap-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--heading-color);
    margin: 0;
    letter-spacing: -0.01em;
}

.heatmap-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0 0;
}

.heatmap-scroll-wrapper {
    overflow-x: hidden;
    padding-bottom: 0.25rem;
}

.heatmap-months-row {
    display: flex;
    justify-content: space-between;
    padding-left: 32px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.heatmap-month-label {
    flex: 1;
    text-align: left;
}

.heatmap-grid-body {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.heatmap-day-labels {
    display: grid;
    grid-template-rows: repeat(7, 11px);
    gap: 2px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    width: 32px;
    padding: 0;
    flex-shrink: 0;
    align-content: start;
}

.heatmap-day-labels span:nth-child(1) {
    grid-row: 1;
}

.heatmap-day-labels span:nth-child(2) {
    grid-row: 2;
}

.heatmap-day-labels span:nth-child(3) {
    grid-row: 3;
}

.heatmap-day-labels span:nth-child(4) {
    grid-row: 4;
}

.heatmap-day-labels span:nth-child(5) {
    grid-row: 5;
}

.heatmap-day-labels span:nth-child(6) {
    grid-row: 6;
}

.heatmap-day-labels span:nth-child(7) {
    grid-row: 7;
}

.heatmap-tiles-grid {
    display: grid;
    grid-template-rows: repeat(7, 11px);
    grid-auto-flow: column;
    grid-auto-columns: 11px;
    gap: 2px;
    width: 100%;
    flex: 1;
}

.heatmap-tile {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    transition: transform 0.15s ease;
    border: 0.5px solid transparent;
}

.legend-tiles .heatmap-tile {
    width: 10px;
    height: 10px;
}

.heatmap-tile:hover {
    transform: scale(1.35);
    z-index: 2;
}

/* Heatmap level colors - Light mode */
[data-theme="light"] .level-0 {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

[data-theme="light"] .level-1 {
    background: #86efac;
    border-color: #4ade80;
}

[data-theme="light"] .level-2 {
    background: #4ade80;
    border-color: #22c55e;
}

[data-theme="light"] .level-3 {
    background: #22c55e;
    border-color: #15803d;
}

[data-theme="light"] .level-out {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* Heatmap level colors - Dark mode */
[data-theme="dark"] .level-0 {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .level-1 {
    background: #4ade80;
}

[data-theme="dark"] .level-2 {
    background: #22c55e;
}

[data-theme="dark"] .level-3 {
    background: #15803d;
}

[data-theme="dark"] .level-out {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.08);
}

.heatmap-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.heatmap-streaks {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-tiles {
    display: flex;
    gap: 3px;
}

/* RECENT QUOTES PANEL */
.recent-quotes-panel {
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

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

.recent-quotes-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow-y: auto;
    max-height: 178px;
    padding-right: 6px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.recent-quote-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.recent-quote-item:hover {
    border-color: var(--primary);
    transform: translateX(2px);
}

.quote-number-link {
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.quote-number-link:hover {
    text-decoration: underline;
}

.recent-quote-client {
    font-size: 0.8rem;
    color: var(--heading-color);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* SLEEK CONGRUENT SCROLLBAR FOR DARK/LIGHT THEME */
.recent-quotes-list::-webkit-scrollbar,
.heatmap-scroll-wrapper::-webkit-scrollbar,
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.recent-quotes-list::-webkit-scrollbar-track,
.heatmap-scroll-wrapper::-webkit-scrollbar-track,
::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 9999px;
}

.recent-quotes-list::-webkit-scrollbar-thumb,
.heatmap-scroll-wrapper::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    transition: background 0.2s ease;
}

.recent-quotes-list::-webkit-scrollbar-thumb:hover,
.heatmap-scroll-wrapper::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

[data-theme="light"] .recent-quotes-list::-webkit-scrollbar-thumb,
[data-theme="light"] .heatmap-scroll-wrapper::-webkit-scrollbar-thumb,
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .recent-quotes-list::-webkit-scrollbar-thumb:hover,
[data-theme="light"] .heatmap-scroll-wrapper::-webkit-scrollbar-thumb:hover,
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
