/* Pro Drywall Business Management System - Main Stylesheet */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #f59e0b;
    --secondary-dark: #d97706;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --info-color: #3b82f6;
    --info-light: #dbeafe;
    
    --dark-color: #1f2937;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

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

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

img {
    max-width: 100%;
    height: auto;
}

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

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--white);
}

.sidebar-logo-text small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--gray-400);
}

/* Company Branding in Sidebar */
.company-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    text-align: center;
}

.company-branding img.sidebar-logo {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
    border-radius: 8px;
}

.company-branding h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.3;
}

/* Sidebar header adjustments */
.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}


.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-300);
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--gray-700);
    color: var(--white);
}

.nav-item.active {
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary-light);
    border-left-color: var(--primary-color);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger-color);
    color: var(--white);
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-600);
    cursor: pointer;
}

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

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

.header-search {
    position: relative;
}

.header-search input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    width: 250px;
    font-size: 0.875rem;
}

.header-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

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

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.header-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--danger-color);
    color: var(--white);
    font-size: 0.65rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    display: none;
}

/* Content Area */
.content {
    padding: 1.5rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

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

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

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

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.primary {
    background: var(--info-light);
    color: var(--primary-color);
}

.stat-icon.success {
    background: var(--success-light);
    color: var(--success-color);
}

.stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning-color);
}

.stat-icon.danger {
    background: var(--danger-light);
    color: var(--danger-color);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-change {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

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

.btn-warning:hover:not(:disabled) {
    background: var(--secondary-dark);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-100);
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover:not(:disabled) {
    background: var(--primary-color);
    color: var(--white);
}

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

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-label.required::after {
    content: '*';
    color: var(--danger-color);
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--white);
    transition: var(--transition);
}

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

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-control.error {
    border-color: var(--danger-color);
}

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

select.form-control {
    cursor: pointer;
}

.form-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.875rem;
    color: var(--danger-color);
    margin-top: 0.25rem;
}

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

.input-group {
    display: flex;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .form-control:last-child {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.input-group-text {
    padding: 0.625rem 0.875rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.form-check-label {
    font-size: 0.875rem;
    cursor: pointer;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background: var(--info-light);
    color: var(--primary-color);
}

.badge-success {
    background: var(--success-light);
    color: var(--success-color);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--secondary-dark);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger-color);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* Status specific badges */
.status-lead { background: #e0e7ff; color: #4338ca; }
.status-scheduled { background: #dbeafe; color: #2563eb; }
.status-in_progress, .status-in-progress { background: #fef3c7; color: #d97706; }
.status-completed { background: #d1fae5; color: #059669; }
.status-invoiced { background: #e0e7ff; color: #4338ca; }
.status-paid { background: #d1fae5; color: #059669; }
.status-draft { background: #e5e7eb; color: #4b5563; }
.status-sent { background: #dbeafe; color: #2563eb; }
.status-partial { background: #fef3c7; color: #d97706; }
.status-overdue { background: #fee2e2; color: #dc2626; }
.status-cancelled { background: #e5e7eb; color: #6b7280; }
.status-accepted { background: #d1fae5; color: #059669; }
.status-declined { background: #fee2e2; color: #dc2626; }
.status-expired { background: #e5e7eb; color: #6b7280; }
.status-estimate { background: #fef3c7; color: #92400e; }
.status-job { background: #dbeafe; color: #1e40af; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

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

/* Solid background for job detail modal - hides content behind it */
#view-job-modal.active {
    background: #f5f5f5;
}

#estimate-modal.active {
    background: #fff;
    overflow-y: auto !important;
    align-items: flex-start !important;
}
#estimate-modal .modal-container {
    max-width: 900px !important;
    width: 95% !important;
    max-height: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    margin: 20px auto !important;
}

#invoice-modal.active {
    background: #fff;
    overflow-y: auto !important;
    align-items: flex-start !important;
}
#invoice-modal .modal-container {
    max-width: 900px !important;
    width: 95% !important;
    max-height: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    margin: 20px auto !important;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 600px;
    width: 90%;
    margin: auto;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-width: 850px;
    width: 95%;
    overflow: hidden;
}

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

.modal-lg {
    max-width: 900px;
}

.modal-xl {
    max-width: 1200px;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--gray-700);
}

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

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

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.pagination-btn {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-100);
}

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

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

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.tab:hover {
    color: var(--gray-700);
}

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

.tab-content {
    display: none;
}

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

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 0.5rem 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition);
}

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

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

.dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

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

.toast-success { border-left: 4px solid var(--success-color); }
.toast-error { border-left: 4px solid var(--danger-color); }
.toast-warning { border-left: 4px solid var(--warning-color); }
.toast-info { border-left: 4px solid var(--info-color); }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-color);
    border-radius: var(--border-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--white);
    margin-bottom: 1rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.login-logo p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.quick-action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quick-action-btn i {
    font-size: 1rem;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar .form-control {
    width: auto;
    min-width: 150px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* Charts placeholder */
.chart-container {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .header-search {
        display: none;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .table th,
    .table td {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar .form-control,
    .search-box {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-primary { color: var(--primary-color); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

.w-100 { width: 100%; }
.hidden { display: none !important; }
.visible { display: block !important; }


/* ============================================
   PROFESSIONAL DOCUMENT STYLES
   For Invoices and Estimates
   ============================================ */

.professional-document {
    background: #fff;
    padding: 2rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Document Header */
.document-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary);
    margin-bottom: 1.5rem;
}

.document-title-section {
    flex: 1;
}

.document-type {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 0.25rem 0;
    letter-spacing: 2px;
}

.document-number {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.document-date {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.document-status {
    margin-top: 0.75rem;
}

.company-info-section {
    text-align: right;
    flex: 1;
}

.document-logo {
    max-width: 150px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.company-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.company-info-section > div {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.4;
}

/* Bill To Section */
.bill-to-section {
    display: flex;
    gap: 3rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.bill-to, .job-info {
    flex: 1;
}

.bill-to h4, .job-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 0.5rem 0;
}

.customer-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.bill-to > div, .job-info > div {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.5;
}

/* Document Items Table */
.document-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.document-items-table thead {
    background: var(--primary);
    color: white;
}

.document-items-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.document-items-table th.qty-col,
.document-items-table th.rate-col,
.document-items-table th.amount-col {
    text-align: right;
}

.document-items-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9rem;
}

.document-items-table td.qty-col,
.document-items-table td.rate-col,
.document-items-table td.amount-col {
    text-align: right;
}

.document-items-table tbody tr:hover {
    background: var(--gray-50);
}

.description-col {
    width: 50%;
}

.qty-col {
    width: 10%;
}

.rate-col {
    width: 20%;
}

.amount-col {
    width: 20%;
}

/* Document Totals */
.document-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--gray-200);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    width: 280px;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.totals-label {
    color: var(--gray-600);
    font-weight: 500;
}

.totals-value {
    font-weight: 600;
    color: var(--gray-800);
}

.totals-row.total-row {
    border-top: 2px solid var(--gray-300);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    font-size: 1.1rem;
}

.totals-row.total-row .totals-label,
.totals-row.total-row .totals-value {
    font-weight: 700;
    color: var(--gray-900);
}

.totals-row.paid-row {
    color: var(--success);
}

.totals-row.paid-row .totals-label,
.totals-row.paid-row .totals-value {
    color: var(--success);
}

.totals-row.balance-row {
    font-size: 1.1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 0.5rem;
}

.totals-row.balance-due .totals-label,
.totals-row.balance-due .totals-value {
    color: var(--danger);
    font-weight: 700;
}

.totals-row.balance-paid .totals-label,
.totals-row.balance-paid .totals-value {
    color: var(--success);
    font-weight: 700;
}

/* Payment History */
.payment-history {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.payment-history h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 0.75rem 0;
}

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

.payments-table th {
    text-align: left;
    padding: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-300);
}

.payments-table th:last-child {
    text-align: right;
}

.payments-table td {
    padding: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
}

.payments-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: var(--success);
}

/* Document Notes */
.document-notes {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.document-notes h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 0.5rem 0;
}

.document-notes p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
}

/* Document Disclaimer */
.document-disclaimer {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--gray-100);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.document-disclaimer h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 0.5rem 0;
}

.document-disclaimer p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.5;
    font-style: italic;
}

/* Conversion Notice */
.conversion-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--success-light, #d4edda);
    border: 1px solid var(--success);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.conversion-notice i {
    color: var(--success);
}

.conversion-notice span {
    color: var(--gray-700);
    font-size: 0.9rem;
}

.conversion-notice a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.conversion-notice a:hover {
    text-decoration: underline;
}

/* Print Styles */
@media print {
    .professional-document {
        padding: 0;
        box-shadow: none;
    }

    .document-header {
        border-bottom-color: #000;
    }

    .document-items-table thead {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .btn, .modal-footer {
        display: none !important;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .document-header {
        flex-direction: column-reverse;
        gap: 1.5rem;
    }

    .company-info-section {
        text-align: left;
    }

    .bill-to-section {
        flex-direction: column;
        gap: 1.5rem;
    }

    .document-items-table {
        font-size: 0.8rem;
    }

    .document-items-table th,
    .document-items-table td {
        padding: 0.5rem;
    }

    .totals-row {
        width: 100%;
    }
}

/* ==========================================
   SETTINGS PAGE STYLES
   ========================================== */

.settings-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--gray-600);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: var(--gray-50);
}

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

/* Settings Tab Content */
.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Settings Section Card */
.settings-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--gray-200);
}

.settings-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-section h3 i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.section-description {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin: 0 0 1.5rem 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

/* Settings Form */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    gap: 1.25rem;
}

.form-row.two-col {
    grid-template-columns: 1fr 1fr;
}

.form-row.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

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

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

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gray-400);
}

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

.form-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-100);
}

/* Logo Upload Section */
.logo-upload-section {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.logo-preview-container {
    flex-shrink: 0;
}

.logo-preview {
    width: 200px;
    height: 200px;
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    overflow: hidden;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.no-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--gray-400);
}

.no-logo i {
    font-size: 3rem;
}

.no-logo span {
    font-size: 0.875rem;
}

.logo-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin: 0;
    max-width: 250px;
}

/* Button Styles for Settings */
.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Responsive Settings */
@media (max-width: 768px) {
    .settings-tabs {
        gap: 0.25rem;
    }
    
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .form-row.two-col,
    .form-row.three-col {
        grid-template-columns: 1fr;
    }
    
    .settings-section {
        padding: 1.5rem;
    }
    
    .logo-upload-section {
        flex-direction: column;
        align-items: center;
    }
    
    .logo-preview {
        width: 150px;
        height: 150px;
    }
}

/* ============================================
   DASHBOARD SPECIFIC STYLES
   ============================================ */

/* Stats Grid - Additional Styles */
.stat-info {
    flex: 1;
}

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.stat-info p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

/* Stat Icon Color Variants */
.stat-icon.customers {
    background: var(--info-light);
    color: var(--primary-color);
}

.stat-icon.jobs {
    background: var(--success-light);
    color: var(--success-color);
}

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

.stat-icon.outstanding {
    background: var(--warning-light);
    color: var(--warning-color);
}

.stat-icon.expenses {
    background: var(--danger-light);
    color: var(--danger-color);
}

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

/* Quick Actions Section */
.quick-actions {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.quick-actions h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

.action-btn i {
    font-size: 1rem;
}

/* Dashboard Grid for Recent Activity */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Dashboard Cards */
.dashboard-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dashboard-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.dashboard-card .card-content {
    padding: 1rem 1.5rem;
    max-height: 350px;
    overflow-y: auto;
}

/* Recent Activity Items */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

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

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

.activity-icon.job {
    background: var(--info-light);
    color: var(--primary-color);
}

.activity-icon.invoice {
    background: var(--success-light);
    color: var(--success-color);
}

.activity-icon.payment {
    background: #dcfce7;
    color: #16a34a;
}

.activity-icon.estimate {
    background: var(--warning-light);
    color: var(--warning-color);
}

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

.activity-title {
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-meta {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.activity-amount {
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
}

/* Recent Jobs List */
.recent-job-item,
.recent-invoice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.recent-job-item:last-child,
.recent-invoice-item:last-child {
    border-bottom: none;
}

.job-info,
.invoice-info {
    flex: 1;
    min-width: 0;
}

.job-title,
.invoice-title {
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.job-customer,
.invoice-customer {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.job-status,
.invoice-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Status Colors */
.status-pending {
    background: var(--warning-light);
    color: var(--warning-color);
}

.status-in-progress,
.status-active {
    background: var(--info-light);
    color: var(--primary-color);
}

.status-completed,
.status-paid {
    background: var(--success-light);
    color: var(--success-color);
}

.status-cancelled,
.status-overdue {
    background: var(--danger-light);
    color: var(--danger-color);
}

/* Loading State */
.loading {
    text-align: center;
    color: var(--gray-400);
    padding: 2rem;
}

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

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

.empty-state p {
    margin: 0;
}

/* Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
}

.chart-container {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

/* Dashboard Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .stat-info h3 {
        font-size: 1.25rem;
    }
    
    .dashboard-grid,
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        padding: 1rem;
    }
}

/* ===== Technicians & Permissions Styles ===== */

/* Technician Status Badges */
.tech-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.tech-status.active {
    background-color: #d4edda;
    color: #155724;
}

.tech-status.on-leave {
    background-color: #fff3cd;
    color: #856404;
}

.tech-status.terminated {
    background-color: #f8d7da;
    color: #721c24;
}

.tech-status.inactive {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Technician Cards */
.technician-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

.technician-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.technician-card .tech-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.technician-card .tech-info h5 {
    margin-bottom: 5px;
}

.technician-card .tech-contact {
    font-size: 13px;
    color: #6c757d;
}

/* Permission Matrix Table */
.permission-matrix {
    font-size: 0.85rem;
}

.permission-matrix th {
    white-space: nowrap;
    padding: 0.5rem;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.permission-matrix td {
    text-align: center;
    vertical-align: middle;
    padding: 0.4rem;
}

.permission-matrix .module-header {
    background-color: #e9ecef;
    font-weight: 600;
    text-align: left !important;
}

.permission-matrix .module-header i {
    color: #6c757d;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

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

input:checked + .toggle-slider {
    background-color: #198754;
}

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

input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Role Cards */
.role-card {
    transition: all 0.2s ease;
    border-radius: 8px;
}

.role-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.role-card.system-role {
    border-left: 4px solid #0d6efd;
}

.role-card .card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* User Management */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

/* Job Assignment */
.assigned-tech-badge {
    display: inline-flex;
    align-items: center;
    background-color: #e7f3ff;
    color: #0066cc;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    margin: 2px;
}

.assigned-tech-badge .remove-btn {
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.7;
}

.assigned-tech-badge .remove-btn:hover {
    opacity: 1;
    color: #dc3545;
}

/* Skills Tags */
.skill-tag {
    display: inline-block;
    background-color: #f0f0f0;
    color: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px;
}

/* Certification Badge */
.cert-badge {
    display: inline-block;
    background-color: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px;
}

.cert-badge i {
    margin-right: 4px;
}

/* SSN Masked Display */
.ssn-masked {
    font-family: monospace;
    letter-spacing: 1px;
}

/* Responsive adjustments for permission matrix */
@media (max-width: 768px) {
    .permission-matrix {
        font-size: 0.875rem;
    }
    
    .toggle-switch {
        width: 36px;
        height: 20px;
    }
    
    .toggle-slider:before {
        height: 14px;
        width: 14px;
    }
    
    input:checked + .toggle-slider:before {
        transform: translateX(16px);
    }
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 5px;
}

/* Quick action buttons */
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Navigation Divider and Section Title */
.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 15px 10px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    padding: 5px 20px;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

/* Form hint text */
.form-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

/* Fix: Show modal when active class is added directly */
.modal.active {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
}
/* Modal Centering and Styling Fix */
.modal.active {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 600px;
    width: 90%;
    margin: auto;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid #007bff;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    margin: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 2px solid #007bff;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.modal-body {
    padding: 25px;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    border: 2px solid #ccc;
    border-radius: 6px;
    padding: 10px;
    width: 100%;
    margin-bottom: 5px;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 5px rgba(0,123,255,0.3);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 2px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 0 0 10px 10px;
}

/* User Cards Grid */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.user-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e9ecef;
}

.user-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.user-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: #fff;
    font-size: 1.5em;
}

.user-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    color: #333;
}

.user-info .user-email {
    color: #6c757d;
    font-size: 0.9em;
}

.user-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.user-meta {
    display: flex;
    align-items: center;
    font-size: 0.85em;
    color: #6c757d;
}

.user-meta i {
    margin-right: 5px;
    width: 16px;
}

.user-card-footer {
    display: flex;
    gap: 8px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.user-card-footer .btn {
    flex: 1;
    padding: 8px;
    font-size: 0.85em;
}

/* ==========================================
   NOTIFICATION SYSTEM
   ========================================== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.notification {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    font-size: 14px;
    font-weight: 500;
}

.notification-success {
    background: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
}

.notification-error {
    background: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
}

.notification-info {
    background: #d1ecf1;
    border: 1px solid #17a2b8;
    color: #0c5460;
}

.notification-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.notification i {
    font-size: 18px;
}

.notification.fade-out {
    animation: slideOut 0.3s ease-in forwards;
}

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

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

/* Customer Table Styling - 7 columns with fixed cell sizes */
.customer-table {
    width: 100%;
    border-collapse: collapse;
}

.customer-table th {
    height: 50px;
    min-width: 100px;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.customer-table td.customer-cell {
    height: 70px;
    min-width: 100px;
    max-width: 180px;
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-row:hover {
    background-color: #f5f8ff;
}

.customer-name-link {
    color: #2563eb;
    text-decoration: none;
}

.customer-name-link:hover {
    text-decoration: underline;
}

.count-badge {
    display: inline-block;
    min-width: 28px;
    padding: 4px 10px;
    background: #e8f0fe;
    color: #1a56db;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .customer-table td.customer-cell {
        min-width: 80px;
        padding: 10px 12px;
    }
}

/* Invoice status: Current */
.status-current {
    background: #dbeafe;
    color: #2563eb;
}

/* ===== Centered Modal Override (Mar 17, 2026) ===== */
.modal-overlay .modal {
    position: relative;
    top: auto;
    left: auto;
    width: 90%;
    height: auto;
    max-height: 85vh;
    overflow-y: auto;
    display: block;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    transition: all 0.25s ease;
    padding: 0;
}
.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.modal-overlay .modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border-radius: 14px 14px 0 0;
}
.modal-overlay .modal-header .modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.modal-overlay .modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #e5e7eb;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
}
.modal-overlay .modal-close:hover {
    background: #dc2626;
    color: #fff;
}
.modal-overlay .modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    max-height: calc(85vh - 130px);
}
.modal-overlay .modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
    border-radius: 0 0 14px 14px;
}
.modal-overlay .modal-lg {
    max-width: 800px;
}
