    * { margin: 0; padding: 0; box-sizing: border-box; }
    :root {
      --bg-primary: #0f172a;
      --bg-secondary: #1e293b;
      --bg-tertiary: rgba(51, 65, 85, 0.5);
      --text-primary: #e2e8f0;
      --text-secondary: #94a3b8;
      --border: rgba(148, 163, 184, 0.1);
      --accent: #0ea5e9;
      --accent-gradient: linear-gradient(135deg, #0ea5e9, #10b981);
      --success: #22c55e;
      --warning: #f59e0b;
      --error: #ef4444;
      --sidebar-width: 220px;
      --sidebar-collapsed: 56px;
    }
    body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; font-size: 13px; }

    /* Login */
    .login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
    .login-box { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 100%; max-width: 360px; }
    .login-logo { font-size: 22px; font-weight: 700; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-align: center; margin-bottom: 24px; }

    /* Layout */
    .app-container { display: none; }
    .app-container.active { display: flex; }

    /* Sidebar */
    .sidebar { width: var(--sidebar-width); background: var(--bg-secondary); border-right: 1px solid var(--border); height: 100vh; position: fixed; left: 0; top: 0; display: flex; flex-direction: column; transition: width 0.2s; z-index: 100; overflow-x: hidden; overflow-y: auto; }
    .sidebar.collapsed { width: var(--sidebar-collapsed); }
    .sidebar-header { padding: 14px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; min-height: 52px; flex-shrink: 0; }
    .sidebar-logo { font-size: 17px; font-weight: 800; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; white-space: nowrap; letter-spacing: -0.02em; }
    .sidebar.collapsed .sidebar-logo { display: none; }
    .collapse-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 4px; transition: all 0.2s; }
    .collapse-btn:hover { background: var(--bg-tertiary); color: var(--accent); }
    .sidebar-nav { flex: 1; padding: 6px 0; }
    /* old nav-section-title rule removed — replaced by collapsible version */
    
    .nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; transition: all 0.2s; border-left: 3px solid transparent; color: var(--text-secondary); font-size: 12px; position: relative; }
    .nav-item:hover { background: rgba(14, 165, 233, 0.08); color: var(--text-primary); padding-left: 16px; }
    .nav-item.active { background: linear-gradient(90deg, rgba(14,165,233,0.12), transparent); border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
    .nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
    .nav-label { white-space: nowrap; }
    .sidebar.collapsed .nav-label { display: none; }
    .nav-badge { margin-left: auto; background: var(--error); color: white; font-size: 9px; padding: 2px 6px; border-radius: 10px; font-weight: 600; }
    .sidebar.collapsed .nav-badge { display: none; }

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

    /* Header */
    .header { background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 50; gap: 12px; backdrop-filter: blur(12px); background: rgba(15,23,42,0.85); }
    .search-input { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text-primary); width: 240px; font-size: 12px; outline: none; transition: border-color 0.2s, box-shadow 0.2s, width 0.3s; }
    .search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,0.12); width: 300px; }
    .header-actions { display: flex; gap: 8px; align-items: center; }
    .user-menu { position: relative; }
    .user-btn { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; color: var(--text-primary); font-size: 12px; }
    .user-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-gradient); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; }
    .user-dropdown { position: absolute; top: calc(100% + 4px); right: 0; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; min-width: 150px; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all 0.15s; box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 200; }
    .user-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }
    .dropdown-item { padding: 9px 14px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 8px; }
    .dropdown-item:hover { background: var(--bg-tertiary); }

    /* Content */
    .content { padding: 16px; }

    /* Cards */
    .card { background: var(--bg-secondary); border-radius: 10px; border: 1px solid var(--border); margin-bottom: 14px; transition: border-color 0.2s, box-shadow 0.2s; animation: fadeSlideUp 0.3s ease both; }
    .card:hover { border-color: rgba(56,189,248,0.15); box-shadow: 0 2px 12px rgba(0,0,0,0.12); }
    .card-header { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
    .card-title { font-size: 13px; font-weight: 600; }
    .card-body { padding: 14px; }

    /* Stats */
    .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
    .stat-card { background: var(--bg-secondary); border-radius: 10px; padding: 16px; border: 1px solid var(--border); position: relative; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; animation: fadeSlideUp 0.35s ease both; }
    .stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent-gradient, linear-gradient(135deg, #0ea5e9, #8b5cf6)); opacity: 0; transition: opacity 0.2s; }
    .stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.15); border-color: rgba(56,189,248,0.2); }
    .stat-card:hover::before { opacity: 1; }
    .stat-value { font-size: 24px; font-weight: 800; margin-bottom: 2px; letter-spacing: -0.02em; }
    .stat-label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
    .stat-card .sparkline { position: absolute; bottom: 0; right: 0; opacity: 0.12; }
    .stats-grid .stat-card:nth-child(1) { animation-delay: 0s; }
    .stats-grid .stat-card:nth-child(2) { animation-delay: 0.05s; }
    .stats-grid .stat-card:nth-child(3) { animation-delay: 0.1s; }
    .stats-grid .stat-card:nth-child(4) { animation-delay: 0.15s; }
    .stats-grid .stat-card:nth-child(5) { animation-delay: 0.2s; }
    .stats-grid .stat-card:nth-child(6) { animation-delay: 0.25s; }
    
    /* Animations */
    @keyframes fadeSlideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes countPulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

    /* Tables */
    .table-container { overflow-x: auto; }
    table { width: 100%; border-collapse: collapse; }
    th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 12px; }
    th { font-weight: 600; color: var(--text-secondary); text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
    tr { transition: background 0.15s; }
    tr:hover { background: rgba(56,189,248,0.04); }

    /* Buttons */
    .btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; }
    .btn-primary { background: var(--accent); color: white; box-shadow: 0 1px 3px rgba(14,165,233,0.25); }
    .btn-primary:hover { background: #0284c7; box-shadow: 0 2px 8px rgba(14,165,233,0.35); transform: translateY(-1px); }
    .btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
    .btn-secondary:hover { border-color: rgba(56,189,248,0.3); background: rgba(56,189,248,0.06); }
    .btn-success { background: var(--success); color: white; }
    .btn-warning { background: var(--warning); color: white; }
    .btn-danger { background: var(--error); color: white; }
    .btn-sm { padding: 4px 8px; font-size: 11px; }
    .btn-icon { padding: 5px; min-width: 26px; }

    /* Badges */
    .badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
    .badge-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
    .badge-info { background: rgba(14,165,233,0.15); color: #0ea5e9; }
    .badge-success { background: rgba(34,197,94,0.15); color: #22c55e; }
    .badge-secondary { background: var(--bg-tertiary); color: var(--text-muted); }
    .badge-error { background: rgba(239,68,68,0.15); color: #ef4444; }

    /* Forms */
    .form-group { margin-bottom: 10px; }
    .form-label { display: block; font-size: 11px; font-weight: 500; margin-bottom: 4px; color: var(--text-secondary); }
    .form-input, .form-select, .form-textarea { width: 100%; padding: 8px 10px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-size: 12px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
    .form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,0.1); }
    .form-textarea { min-height: 70px; resize: vertical; }
    .form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
    .form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

    /* Autocomplete */
    .autocomplete-wrapper { position: relative; }
    .autocomplete-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; max-height: 200px; overflow-y: auto; z-index: 100; display: none; }
    .autocomplete-results.active { display: block; }
    .autocomplete-item { padding: 8px 12px; cursor: pointer; font-size: 12px; border-bottom: 1px solid var(--border); }
    .autocomplete-item:hover { background: var(--bg-tertiary); }
    .autocomplete-item:last-child { border-bottom: none; }

    /* Modal */
    .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.25s ease; padding: 16px; }
    .modal-overlay.active { opacity: 1; visibility: visible; }
    .modal { background: var(--bg-secondary); border-radius: 12px; width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; transform: translateY(16px) scale(0.97); transition: transform 0.3s cubic-bezier(0.16,1,0.3,1); box-shadow: 0 20px 60px rgba(0,0,0,0.3); border: 1px solid var(--border); }
    .modal-lg { max-width: 700px; }
    .modal-overlay.active .modal { transform: translateY(0) scale(1); }
    .modal-header { padding: 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
    .modal-title { font-size: 15px; font-weight: 600; }
    .modal-close { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 18px; }
    .modal-close:hover { color: var(--error); }
    .modal-body { padding: 14px; }
    .modal-footer { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

    /* Grids */
    .grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
    .grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

    /* Section */
    .section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
    .section-title { font-size: 17px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }

    /* Empty */
    .empty-state { text-align: center; padding: 28px; color: var(--text-secondary); }
    .empty-icon { font-size: 32px; margin-bottom: 8px; }

    /* Alert */
    .alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; font-size: 12px; }
    .alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--error); color: #fca5a5; }
    .alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid var(--success); color: #86efac; }
    .alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid var(--warning); color: #fcd34d; }

    /* Line Items */
    .line-items { margin-bottom: 10px; }
    .line-item { display: grid; grid-template-columns: 1fr 60px 80px 70px 28px; gap: 6px; align-items: center; margin-bottom: 6px; padding: 6px; background: var(--bg-tertiary); border-radius: 6px; }
    .line-item input, .line-item select { margin: 0; padding: 6px 8px; font-size: 11px; }
    .line-total { text-align: right; font-weight: 600; color: var(--success); font-size: 11px; }
    .remove-line { background: var(--error); color: white; border: none; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 12px; }

    /* Totals */
    .totals-box { background: var(--bg-tertiary); padding: 10px; border-radius: 6px; margin-top: 10px; }
    .total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12px; }
    .total-row:last-child { font-weight: 700; font-size: 14px; border-top: 1px solid var(--border); margin-top: 5px; padding-top: 8px; }

    /* Renewal Alert */
    .renewal-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: var(--bg-tertiary); border-radius: 6px; margin-bottom: 8px; border-left: 3px solid var(--warning); }
    .renewal-item.urgent { border-left-color: var(--error); }
    .renewal-item.ok { border-left-color: var(--success); }

    /* Tab nav */
    .tab-nav { display: flex; gap: 4px; margin-bottom: 14px; background: var(--bg-tertiary); padding: 3px; border-radius: 6px; width: fit-content; }
    .tab-btn { padding: 5px 10px; border: none; background: none; color: var(--text-secondary); cursor: pointer; border-radius: 4px; font-size: 11px; }
    .tab-btn.active { background: var(--accent); color: white; }

    /* Schedule */
    .schedule-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
    .schedule-title { font-size: 13px; font-weight: 600; min-width: 180px; }
    .week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
    .day-cell { background: var(--bg-tertiary); border-radius: 6px; padding: 6px; min-height: 90px; border: 1px solid var(--border); }
    .day-cell.today { border-color: var(--accent); background: rgba(14, 165, 233, 0.1); }
    .day-header { font-weight: 600; font-size: 10px; margin-bottom: 4px; }
    .day-date { font-size: 14px; font-weight: 700; }
    .day-job { background: var(--bg-secondary); padding: 4px 6px; border-radius: 4px; margin-top: 4px; font-size: 10px; border-left: 2px solid var(--accent); }

    /* File upload */
    .file-upload { border: 2px dashed var(--border); border-radius: 8px; padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s; }
    .file-upload:hover { border-color: var(--accent); background: rgba(14, 165, 233, 0.05); }
    .file-upload input { display: none; }

    /* Mobile */
    @media (max-width: 768px) {
      .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
      .sidebar.mobile-open { transform: translateX(0); }
      .main-content { margin-left: 0; }
      .search-input { display: none; }
      .content { padding: 10px; }
      .week-grid { grid-template-columns: 1fr; }
      .line-item { grid-template-columns: 1fr; gap: 4px; }
      .user-name { display: none; }
      .form-row-3 { grid-template-columns: 1fr; }
    }
    .mobile-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 18px; cursor: pointer; }
    @media (max-width: 768px) { .mobile-toggle { display: block; } }
    .mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
    .mobile-overlay.active { display: block; }
    /* Staff Chips */
    .staff-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: #0ea5e9; color: white; border-radius: 16px; font-size: 12px; cursor: pointer; transition: all 0.2s; }
    .staff-chip:hover { background: #0284c7; }
    .staff-chip .remove { font-weight: bold; opacity: 0.7; }
    .staff-chip .remove:hover { opacity: 1; }
    .staff-chip-available { background: #334155; color: #e2e8f0; }
    .staff-chip-available:hover { background: #475569; }
    /* Settings Tabs */
    .tabs { display: flex; gap: 2px; background: var(--bg-tertiary); padding: 4px; border-radius: 10px; margin-bottom: 14px; }
    .tab { padding: 8px 18px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-secondary); border-radius: 8px; transition: all 0.25s ease; border: 1px solid transparent; letter-spacing: 0.01em; }
    .tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
    .tab.active { color: #fff; background: var(--accent); box-shadow: 0 2px 8px rgba(99,102,241,0.35); border-color: rgba(255,255,255,0.08); }
    /* Toast animation */
    @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
    @keyframes pulse-highlight { 
      0%, 100% { background: var(--success); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
      50% { background: #16a34a; box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    }
    .btn-highlight { animation: pulse-highlight 1s infinite; color: white !important; }
    
    /* Cause checkboxes - mobile friendly */
    .cause-checkbox { display:flex;align-items:center;gap:6px;font-size:11px;color:var(--text-secondary);cursor:pointer;padding:4px;border-radius:4px;transition:background 0.15s }
    .cause-checkbox:hover { background:rgba(14,165,233,0.1) }
    .cause-checkbox input { width:16px;height:16px;cursor:pointer }
    .cause-checkbox input:checked + span, .cause-checkbox:has(input:checked) { color:var(--accent) }
    
    /* Modal scroll fix */
    .modal { max-height: 85vh; display: flex; flex-direction: column; }
    .modal-body { flex: 1; overflow-y: auto; overflow-x: hidden; }
    .modal-body::-webkit-scrollbar { width: 6px; }
    .modal-body::-webkit-scrollbar-track { background: transparent; }
    .modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    #roomDetailModal .modal { max-width: 550px; max-height: 80vh; }
    #inspectionEditorModal .modal { max-width: 600px; max-height: 85vh; display: flex; flex-direction: column; }
    #inspectionEditorModal .modal-body { flex: 1; overflow-y: auto; overflow-x: hidden; }
    #inspectionEditorModal .modal-body::-webkit-scrollbar { width: 6px; }
    #inspectionEditorModal .modal-body::-webkit-scrollbar-track { background: transparent; }
    #inspectionEditorModal .modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
/* INSPECTION MODULE - DARK UI STYLES */
/* Add these styles to your existing CSS */


.tab:hover {
  color: var(--text-primary);
}

.tab-content { 
  display: none; 
}

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

.severity-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.severity-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.severity-btn[data-level="LOW"] {
  background: #052e16;
  color: #22c55e;
}

.severity-btn[data-level="MODERATE"] {
  background: #422006;
  color: #eab308;
}

.severity-btn[data-level="HIGH"] {
  background: #431407;
  color: #f97316;
}

.severity-btn[data-level="CRITICAL"] {
  background: #450a0a;
  color: #dc2626;
}

.severity-btn.active {
  border-color: currentColor;
}

.severity-btn:hover {
  opacity: 0.8;
}

/* Ensure stats are in one row */
@media (min-width: 768px) {
  .stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
  }
}

@media (max-width: 767px) {
  .stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
  }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

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

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.form-row-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}

.calc-display {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
}

/* ========== WORLD-CLASS UI IMPROVEMENTS ========== */

/* A2: Button improvements */
.btn { min-height: 36px; }
.btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
.btn-success:hover { background: linear-gradient(135deg, #16a34a, #15803d); }
.btn-primary { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.btn-primary:hover { background: linear-gradient(135deg, #0284c7, #0369a1); }

/* Focus rings for accessibility */
.form-input:focus, .form-select:focus, .form-textarea:focus { 
  outline: 2px solid var(--accent); 
  outline-offset: 1px; 
  border-color: transparent; 
}

/* B1: Sticky action bar */
.sticky-action-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
  padding: 12px 20px;
  margin: 0 -20px -20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 10;
  border-radius: 0 0 12px 12px;
}
.sticky-action-bar .save-state {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 500;
}
.sticky-action-bar .save-state.loaded { background: var(--bg-tertiary); color: var(--text-muted); }
.sticky-action-bar .save-state.unsaved { background: #fef3c7; color: #92400e; }
.sticky-action-bar .save-state.saving { background: #dbeafe; color: #1e40af; }
.sticky-action-bar .save-state.saved { background: #d1fae5; color: #065f46; }
.sticky-action-bar .save-state.failed { background: #fee2e2; color: #991b1b; }
.sticky-action-bar .action-buttons { display: flex; gap: 8px; }

/* C1: Photo dropzone */
.photo-dropzone {
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.photo-dropzone:hover, .photo-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(14, 165, 233, 0.1);
}
.photo-dropzone .icon { font-size: 32px; color: var(--text-muted); margin-bottom: 4px; }
.photo-dropzone .text { font-size: 11px; color: var(--text-muted); }
.photo-dropzone.uploading { pointer-events: none; opacity: 0.7; }
.photo-dropzone.uploading .text { color: var(--accent); }

/* C3: Photo grid polish */
.photo-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .actions {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  padding: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}
.photo-tile:hover .actions { opacity: 1; }
.photo-tile .action-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-tile .action-btn.delete { background: rgba(220,38,38,0.9); color: white; }
.photo-tile .action-btn.edit { background: rgba(255,255,255,0.9); color: #333; }
.photo-tile .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 10px;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* D1: Findings cards */
.finding-card {
  background: var(--bg-tertiary);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 4px solid var(--text-muted);
}
.finding-card.severity-low { border-left-color: #22c55e; }
.finding-card.severity-moderate { border-left-color: #eab308; }
.finding-card.severity-high { border-left-color: #f97316; }
.finding-card.severity-critical { border-left-color: #dc2626; }
.finding-card .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.finding-card .severity-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }
.finding-card .severity-badge.low { background: rgba(34,197,94,0.2); color: #22c55e; }
.finding-card .severity-badge.moderate { background: rgba(234,179,8,0.2); color: #eab308; }
.finding-card .severity-badge.high { background: rgba(249,115,22,0.2); color: #f97316; }
.finding-card .severity-badge.critical { background: rgba(220,38,38,0.2); color: #dc2626; }
.finding-card .body { font-size: 13px; color: var(--text-secondary); }
.finding-card .actions { display: flex; gap: 4px; }

/* D2: Status badges */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.status-badge.draft { background: rgba(148,163,184,0.2); color: #94a3b8; }
.status-badge.in_progress, .status-badge.in-progress { background: rgba(14,165,233,0.2); color: #0ea5e9; }
.status-badge.ready { background: rgba(234,179,8,0.2); color: #eab308; }
.status-badge.finalized, .status-badge.complete { background: rgba(34,197,94,0.2); color: #22c55e; }

/* E1: Table improvements */
.table-container { position: relative; max-height: 500px; overflow: auto; }
.table-container table { border-collapse: separate; border-spacing: 0; }
.table-container th { position: sticky; top: 0; background: var(--bg-secondary); z-index: 5; }
.table-container tr:hover td { background: rgba(14,165,233,0.08); }
.table-container td { transition: background 0.15s; }
.table-container .actions-col { width: 100px; text-align: right; white-space: nowrap; }

/* Upload state indicator */
.upload-status { 
  font-size: 11px; 
  padding: 4px 8px; 
  border-radius: 4px; 
  margin-top: 8px;
  text-align: center;
}
.upload-status.uploading { background: #dbeafe; color: #1e40af; }
.upload-status.success { background: #d1fae5; color: #065f46; }
.upload-status.error { background: #fee2e2; color: #991b1b; }

/* ==================== V1.9.33 COMPREHENSIVE FIXES ==================== */

/* Universal scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }
::-webkit-scrollbar-corner { background: var(--bg-tertiary); }

/* Improved table container with scroll */
.table-container { 
  position: relative; 
  max-height: 65vh; 
  overflow: auto; 
  border-radius: 6px;
}
.card-body .table-container { max-height: 60vh; }

/* Fix for dropdown colors in tables - neutral styling */
table .form-select {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border);
  color: var(--text-primary);
}
table .form-select:focus {
  border-color: var(--accent);
  background-color: var(--bg-secondary) !important;
}

/* Line item autocomplete improvements */
.autocomplete-results {
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.autocomplete-results.line-search-results {
  max-height: 250px;
  width: calc(100% + 100px);
}
.autocomplete-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:hover {
  background: var(--accent);
  color: white;
}
.autocomplete-item:hover span { color: rgba(255,255,255,0.8) !important; }

/* Click outside to close autocomplete */
.autocomplete-results.active::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
}

/* Discount row in estimates/invoices */
.discount-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  margin-top: 8px;
}
.discount-row select { width: 100px; }
.discount-row input { width: 80px; }
.discount-row .discount-amount { font-weight: 600; color: var(--error); margin-left: auto; }

/* Print CSS for estimates/invoices */
@media print {
  body { 
    background: white !important; 
    color: black !important; 
    font-size: 12pt !important;
  }
  .sidebar, .header, .no-print, .btn, .nav-item { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; }
  .modal-overlay { 
    position: static !important; 
    background: none !important; 
    padding: 0 !important;
  }
  .modal { 
    max-width: none !important; 
    max-height: none !important; 
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
  }
  .card { 
    border: none !important; 
    box-shadow: none !important;
    background: white !important;
  }
  table { border-collapse: collapse !important; width: 100% !important; }
  th, td { 
    border: 1px solid #ddd !important; 
    padding: 8px !important;
    color: black !important;
    background: white !important;
  }
  th { background: #f5f5f5 !important; font-weight: bold !important; }
  .badge { 
    border: 1px solid currentColor !important; 
    background: transparent !important;
  }
  .print-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
  }
  .print-header h1 { font-size: 24pt; margin-bottom: 5px; }
  .print-header .company { font-size: 14pt; color: #666; }
  .print-footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-size: 10pt;
    color: #666;
    text-align: center;
  }
  .totals-box {
    background: #f9f9f9 !important;
    border: 1px solid #ddd !important;
  }
  @page { 
    margin: 0.75in; 
    size: letter;
  }
}

/* Inspection editor bottom alignment */
#inspectionEditorModal .modal-body {
  padding-bottom: 80px;
}
.sticky-action-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
  padding: 12px 20px;
  margin: 0 -20px -20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 10;
  border-radius: 0 0 12px 12px;
}

/* Room detail modal fix */
#roomDetailModal .modal-body {
  padding-bottom: 0;
}

/* Main search autocomplete */
.header .search-wrapper {
  position: relative;
}
.header .search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.header .search-results.active {
  display: block;
}
.header .search-result-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.header .search-result-item:hover {
  background: var(--bg-tertiary);
}
.header .search-result-item .type {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.header .search-result-item .name {
  font-weight: 500;
}
.header .search-result-item .detail {
  font-size: 11px;
  color: var(--text-secondary);
}
.search-result-group {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

/* Better card scrolling for clients/jobs */
.card-body.scrollable {
  max-height: 65vh;
  overflow-y: auto;
}

/* Service items in line item search */
.line-search-results .autocomplete-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.line-search-results .autocomplete-item strong {
  font-size: 12px;
}
.line-search-results .autocomplete-item span {
  font-size: 10px;
}

/* Payment method display */
.payment-method { text-transform: capitalize; }

/* Settings pill tabs */
.spill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.spill:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.spill.active {
  background: linear-gradient(135deg, #0c4a6e, #0e7490);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(14,116,144,0.3);
}

/* Fleet accordion */
.fleet-detail.open { max-height: 300px !important; }
.fleet-detail.open ~ div .fleet-chevron,
.fleet-detail.open + .fleet-chevron { transform: rotate(180deg); }

/* Email module */
.email-tabs { display:flex; gap:4px; margin-bottom:20px; border-bottom:1px solid var(--border); padding-bottom:8px; }
.email-tab { display:flex; align-items:center; gap:6px; padding:8px 16px; border:none; background:none; color:var(--text-secondary); font-size:12px; font-weight:500; cursor:pointer; border-radius:6px 6px 0 0; transition:all 0.2s; }
.email-tab:hover { background:var(--bg-tertiary); color:var(--text-primary); }
.email-tab.active { color:var(--text-primary); background:var(--bg-tertiary); border-bottom:2px solid #3b82f6; }
.email-tab-icon { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.email-schedule-group { display:flex; gap:4px; align-items:center; padding-left:8px; border-left:1px solid var(--border); }
.email-alert { padding:8px 12px; border-radius:6px; font-size:12px; margin-top:4px; }
.email-alert.success { background:#22c55e12; color:#22c55e; border:1px solid #22c55e30; }
.email-alert.error { background:#ef444412; color:#ef4444; border:1px solid #ef444430; }
.email-alert.info { background:#3b82f612; color:#3b82f6; border:1px solid #3b82f630; }
.email-status-badge { font-size:10px; padding:2px 8px; border-radius:10px; font-weight:600; }
.email-status-badge.sent { background:#22c55e15; color:#22c55e; }
.email-status-badge.failed { background:#ef444415; color:#ef4444; }
.email-status-badge.scheduled { background:#3b82f615; color:#3b82f6; }
.email-status-badge.pending { background:#f59e0b15; color:#f59e0b; }
.email-type-badge { font-size:8px; padding:1px 5px; border-radius:6px; font-weight:600; text-transform:uppercase; flex-shrink:0; }
.email-type-badge.client { background:#0ea5e915; color:#0ea5e9; }
.email-type-badge.lead { background:#f59e0b15; color:#f59e0b; }
.mass-contact-row { display:flex; align-items:center; gap:8px; padding:6px 12px; cursor:pointer; border-bottom:1px solid var(--border); transition:background 0.15s; }
.mass-contact-row:hover { background:var(--bg-tertiary); }
.email-tpl-card { transition:transform 0.15s, box-shadow 0.15s; }
.email-tpl-card:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,0.1); }
.email-tpl-add { border:2px dashed var(--border); cursor:pointer; transition:border-color 0.2s; }
.email-tpl-add:hover { border-color:#3b82f6; }

/* Schedule - World Class Calendar */
.schedule-nav { display:flex; align-items:center; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.schedule-title { font-size:14px; font-weight:700; min-width:180px; text-align:center; }
.sched-day { display:flex; flex-direction:column; min-height:120px; border-radius:8px; background:var(--bg-tertiary); border:1px solid transparent; transition:all 0.2s; cursor:pointer; overflow:hidden; }
.sched-day:hover { border-color:var(--border); box-shadow:0 2px 8px rgba(0,0,0,0.08); }
.sched-today { border-color:#3b82f6 !important; box-shadow:0 0 0 1px #3b82f630; }
.sched-weekend { opacity:0.7; }
.sched-day-head { display:flex; justify-content:space-between; align-items:center; padding:6px 8px; border-bottom:1px solid var(--border); }
.sched-day-name { font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-secondary); }
.sched-day-num { font-size:13px; font-weight:700; }
.sched-today-num { background:#3b82f6; color:white; width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:11px; }
.sched-day-body { flex:1; padding:4px; display:flex; flex-direction:column; gap:3px; overflow-y:auto; }
.sched-empty { font-size:10px; color:var(--text-secondary); text-align:center; padding:12px 4px; opacity:0.5; }
.sched-job { padding:5px 6px; border-radius:5px; cursor:pointer; transition:transform 0.15s, box-shadow 0.15s; }
.sched-job:hover { transform:translateY(-1px); box-shadow:0 2px 6px rgba(0,0,0,0.1); }
.sched-job-top { display:flex; align-items:center; gap:4px; }
.sched-job-icon { font-size:11px; flex-shrink:0; }
.sched-job-name { font-size:11px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sched-job-meta { display:flex; gap:6px; font-size:9px; color:var(--text-secondary); margin-top:2px; }
.sched-job-loc { font-size:8px; color:var(--text-secondary); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sched-month-header { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; text-align:center; font-size:10px; font-weight:700; color:var(--text-secondary); margin-bottom:4px; text-transform:uppercase; letter-spacing:0.05em; }
.sched-month-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; }
.sched-month-cell { background:var(--bg-tertiary); border-radius:6px; padding:4px; min-height:72px; cursor:pointer; transition:all 0.15s; border:1px solid transparent; }
.sched-month-cell:hover { border-color:var(--border); }
.sched-month-today { border-color:#3b82f6 !important; background:rgba(59,130,246,0.04); }
.sched-month-pad { opacity:0.2; cursor:default; }
.sched-month-num { font-weight:700; font-size:12px; margin-bottom:2px; }
.sched-month-jobs { display:flex; flex-direction:column; gap:2px; }
.sched-month-job { font-size:9px; padding:2px 5px; border-radius:3px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:500; }
.sched-month-job:hover { opacity:0.8; }
.sched-month-dots { display:flex; gap:3px; margin-top:4px; flex-wrap:wrap; }

/* ===== PERFEX-STYLE TABLE REDESIGN ===== */
.status-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.status-pill {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 11px; font-weight: 600; cursor: pointer; background: transparent;
  color: var(--text-secondary); transition: all 0.2s ease; display: inline-flex;
  align-items: center; gap: 6px; white-space: nowrap;
}
.status-pill:hover { border-color: var(--pill-color, var(--accent)); color: var(--pill-color, var(--accent)); background: color-mix(in srgb, var(--pill-color, var(--accent)) 8%, transparent); }
.status-pill.active { background: var(--pill-color, var(--accent)); color: #fff; border-color: var(--pill-color, var(--accent)); box-shadow: 0 2px 6px color-mix(in srgb, var(--pill-color, var(--accent)) 30%, transparent); }
.pill-count { background: rgba(255,255,255,0.25); padding: 1px 6px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.status-pill:not(.active) .pill-count { background: var(--bg-tertiary); }

.status-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; background: color-mix(in srgb, var(--badge-color) 12%, transparent);
  color: var(--badge-color);
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--badge-color); }

.doc-number {
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; font-weight: 600;
  color: var(--accent); text-decoration: none; transition: color 0.15s;
}
.doc-number:hover { color: #818cf8; text-decoration: underline; }

.client-cell { display: flex; flex-direction: column; gap: 1px; }
.client-cell strong { font-size: 13px; font-weight: 600; }
.client-sub { font-size: 10px; color: var(--text-secondary); }

.item-count {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 20px; border-radius: 4px; background: var(--bg-tertiary);
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
}

.row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0.3; transition: opacity 0.15s; }
.table-row:hover .row-actions { opacity: 1; }
.action-btn {
  width: 28px; height: 28px; border: none; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-secondary); transition: all 0.15s;
  font-size: 13px; font-weight: 700;
}
.action-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.action-btn.action-success { color: #22c55e; }
.action-btn.action-success:hover { background: #22c55e18; }
.action-btn.action-danger { color: #ef4444; }
.action-btn.action-danger:hover { background: #ef444418; }

.table-row { transition: background 0.1s; }
.table-row:hover { background: color-mix(in srgb, var(--accent) 4%, transparent) !important; }

/* Equipment dropdown overflow fix */
#qeEquipmentBody select.form-input { font-size:10px !important; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#qeEquipmentBody .form-input { font-size:11px !important; }

    /* ── COLLAPSIBLE NAV SECTIONS ─────────────────────────────────────────── */
    .nav-section { margin-bottom: 2px; }
    .nav-section-title { font-size: 9px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 14px 4px; opacity: 0.7; cursor: pointer; display: flex; align-items: center; justify-content: space-between; transition: opacity 0.2s; user-select: none; }
    .nav-section-title:hover { opacity: 1; }
    .nav-chevron { font-size: 12px; font-weight: 700; transition: transform 0.25s ease; display: inline-block; }
    .nav-section.open .nav-chevron { transform: rotate(90deg); }
    .nav-section-items { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
    .nav-section-items { max-height: 0; overflow: hidden; }
    .nav-section.open .nav-section-items { max-height: 500px; overflow: visible; }

    .sidebar.collapsed .nav-section-title { display: none; }
    .sidebar.collapsed .nav-section-items { max-height: 500px !important; }

/* ============================================================================
   Settings: side-rollout submenu (added 2026-05-08)
   Converts .settings-pills horizontal pill bar into a vertical left sidebar
   matching the main app menu's orientation. Content rolls out to the right.
   ============================================================================ */
.settings-pills {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  gap: 2px !important;
  width: 220px;
  position: sticky;
  top: 16px;
  float: left;
  margin-right: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 8px !important;
}
.settings-pills .spill {
  width: 100% !important;
  justify-content: flex-start !important;
  text-align: left !important;
  padding: 10px 12px !important;
  gap: 8px;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.settings-pills .spill:hover { background: var(--bg-tertiary); }
.settings-pills .spill.active {
  background: var(--accent) !important;
  color: #fff !important;
}
#settingsTabContent {
  margin-left: 244px;
  min-height: 400px;
}
@media (max-width: 900px) {
  .settings-pills {
    width: 100%; position: static; float: none;
    flex-direction: row !important; flex-wrap: wrap !important;
    margin-right: 0; margin-bottom: 16px;
  }
  .settings-pills .spill { width: auto !important; }
  #settingsTabContent { margin-left: 0; }
}
