  :root {
    --primary-color: #222;
    --secondary-color: #286090;
    --accent-color: #b3e5fc;
    --success-color: #43a047;
    --warning-color: #ffe082;
    --info-color: #5bc0de;
    --background-color: #f5f5f5;
    --container-bg: #fff;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #e2e8f0;
    --table-bg: #f8fafd;
    --table-header-bg: #e3eaf5;
    --table-border: #e2e8f0;
    
    /* Theme colors */
    --theme-bg: var(--background-color);
    --theme-surface: var(--container-bg);
    --theme-text: var(--text-primary);
    --theme-text-secondary: var(--text-secondary);
    --theme-border: var(--border-color);
    
    /* Responsive breakpoints */
    --mobile-sm: 480px;
    --mobile-md: 768px;
    --tablet: 1024px;
    --desktop: 1200px;
  }

  /* Dark theme variables */
  [data-theme="dark"] {
    --primary-color: #1a1a1a;
    --background-color: #121212;
    --container-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --table-bg: #2a2a2a;
    --table-header-bg: #333333;
    --table-border: #404040;
    --accent-color: #81d4fa;
    --secondary-color: #3498db;
    
    /* Update theme colors for dark mode */
    --theme-bg: var(--background-color);
    --theme-surface: var(--container-bg);
    --theme-text: var(--text-primary);
    --theme-text-secondary: var(--text-secondary);
    --theme-border: var(--border-color);
  }

  /* Reset and base styles */
  *, *::before, *::after {
    box-sizing: border-box;
  }

  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
  }

  body {
    background: var(--theme-bg);
    color: var(--theme-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
  }

  /* Enhanced header with better responsive behavior */
  .header {
    background: var(--primary-color);
    color: #fff;
    padding: 0 16px; /* Reduced vertical padding to let height control it */
    display: flex;
    align-items: center;
    position: relative;
    height: 60px; /* Force fixed height */
    overflow: hidden; /* Cut off excess logo height */
    flex-wrap: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }

  .header .logo {
    display: flex;
    align-items: center;
    font-size: 1.4em;
    font-weight: 600;
    flex: 0 0 auto;
    margin-right: 16px;
  }

  .header .logo img {
    height: 132px;
    width: 132px;
    margin-right: 8px;
    object-fit: contain;
  }

  .header-title-center {
    flex: 1 1 0;
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--accent-color);
    margin: 0;
    z-index: 1;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header .right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
  }

  .header .welcome {
    font-size: 0.9em;
    margin-right: 8px;
    white-space: nowrap;
  }

  .header .logout {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9em;
    margin-left: 6px;
    transition: opacity 0.2s;
  }

  .header .logout:hover {
    opacity: 0.8;
  }

  .header .garage {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1em;
    white-space: nowrap;
  }

  .header .garage img {
    height: 24px;
    width: 24px;
    margin-right: 6px;
    object-fit: contain;
  }
  /* Theme dropdown in side menu */
  .theme-dropdown {
    position: relative;
    margin: 4px 12px 8px 12px;
    flex-shrink: 0; /* Prevent dropdown from shrinking */
  }

  .theme-toggle {
    color: #fff;
    text-decoration: none;
    padding: 14px 16px;
    font-size: 1em;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
  }

  .theme-toggle:hover,
  .theme-toggle:focus {
    background: #204d74;
    outline: none;
  }

  .theme-toggle .arrow {
    transition: transform 0.2s ease;
    font-size: 0.8em;
  }

  .theme-toggle.active .arrow {
    transform: rotate(180deg);
  }

  .theme-options {
    display: none;
    background: #1a4a6b;
    border-radius: 6px;
    margin-top: 4px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }

  .theme-options.show {
    display: block;
    animation: slideDown 0.2s ease;
  }

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

  .theme-option {
    color: #fff;
    text-decoration: none;
    padding: 12px 20px;
    font-size: 0.95em;
    font-weight: 500;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    min-height: 40px;
  }

  .theme-option:hover,
  .theme-option:focus {
    background: #204d74;
    outline: none;
  }

  .theme-option.active {
    background: #204d74;
    position: relative;
  }

  .theme-option.active::after {
    content: '✓';
    margin-left: auto;
    font-weight: bold;
    color: var(--accent-color);
  }

  .theme-icon {
    font-size: 1.1em;
    width: 16px;
    text-align: center;
  }

  /* Enhanced container */
  .container {
    max-width: var(--desktop);
    margin: 24px auto;
    background: var(--theme-surface);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 24px;
    min-height: 60vh;
    flex: 1 0 auto;
    width: calc(100% - 32px);
    transition: background-color 0.3s ease;
  }

  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
  }

  .topbar h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
    color: var(--theme-text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
  }

  .topbar .top-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .topbar .top-actions button {
    background: var(--warning-color);
    color: #444;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95em;
    min-height: 40px;
    white-space: nowrap;
  }

  .topbar .top-actions button:nth-child(2) {
    background: var(--success-color);
    color: #fff;
  }

  .topbar .top-actions button:last-child {
    background: var(--info-color);
    color: #fff;
  }

  .topbar .top-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }

  /* Enhanced table styling */
  .table-container {
    overflow-x: auto;
    margin-top: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    /* Enhanced mobile scrolling */
    -webkit-overflow-scrolling: touch;
  }

  .estimates-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--table-bg);
    font-size: 0.95em;
    min-width: 1000px;
    transition: background-color 0.3s ease;
  }

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

  .estimates-table th {
    background: var(--table-header-bg);
    color: var(--theme-text);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background-color 0.3s ease;
  }

  .estimates-table td {
    color: var(--theme-text);
    transition: color 0.3s ease;
  }

  .estimates-table td a {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
  }

  .estimates-table td a:hover {
    text-decoration: underline;
  }

  .estimates-table td .edit-link {
    color: #1976d2;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
  }

  .estimates-table td .edit-link:hover {
    background: #e3f2fd;
    text-decoration: none;
  }

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

  .estimates-table tr:hover {
    background: rgba(33, 150, 243, 0.04);
    cursor: pointer;
  }

  /* Status indicators */
  .status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
  }

  .status.draft {
    background: #e0e0e0;
    color: #616161;
  }

  .status.sent {
    background: #e3f2fd;
    color: #1976d2;
  }

  .status.accepted {
    background: #d4edda;
    color: #155724;
  }

  .status.pending {
    background: #fff3cd;
    color: #856404;
  }

  .status.declined {
    background: #f8d7da;
    color: #721c24;
  }

  /* Loading state */
  .loading-message {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1em;
  }

  .no-estimates {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
  }

  .no-estimates h3 {
    margin: 0 0 16px 0;
    font-size: 1.3em;
    color: var(--theme-text);
  }

  .no-estimates p {
    margin: 0 0 24px 0;
  }

  /* Enhanced footer */
  .footer {
    background: var(--primary-color);
    color: var(--accent-color);
    font-size: 0.9em;
    text-align: center;
    padding: 20px 16px;
    margin-top: auto;
    letter-spacing: 0.3px;
    border-top: 1px solid #2c5070;
    width: 100%;
  }

  .footer a {
    color: var(--accent-color);
    text-decoration: none;
    margin: 0 8px;
    font-weight: 500;
    transition: opacity 0.2s;
  }

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

  .footer .sep {
    color: #4fc3f7;
    font-weight: 700;
    margin: 0 8px;
  }

  /* Responsive Design */
  
  /* Large tablets and small desktops */
  @media (max-width: 1024px) {
    .container {
      margin: 16px auto;
      padding: 20px;
      width: calc(100% - 24px);
    }
    
    .header-title-center {
      font-size: 1.1em;
    }
    
    .side-menu {
      width: 280px;
      max-width: 80vw;
    }
  }

  /* Tablets */
  @media (max-width: 768px) {
    .header {
      padding: 10px 12px;
      min-height: 56px;
    }
    
    .header .logo {
      font-size: 1.2em;
      margin-right: 12px;
    }
    /* ADD THIS RULE TO FIX THE THICKNESS */
    .header .logo img {
      height: 132px;
      width: 132px;
    }
    .header-title-center {
      font-size: 1em;
    }
    
    .header .welcome {
      font-size: 0.85em;
    }
    
    .header .garage {
      font-size: 0.9em;
    }
    
    .container {
      margin: 12px auto;
      padding: 16px;
      width: calc(100% - 16px);
      border-radius: 6px;
    }
    
    .topbar {
      flex-direction: column;
      align-items: stretch;
      gap: 12px;
    }
    
    .topbar h2 {
      font-size: 1.3em;
    }
    
    .estimates-table {
      font-size: 0.9em;
    }
    
    .estimates-table th,
    .estimates-table td {
      padding: 10px 8px;
    }
    
    .side-menu {
      width: 300px;
      max-width: 85vw;
    }
  }

  /* Mobile phones */
  @media (max-width: 480px) {
    body {
      font-size: 14px;
    }
    
    .header {
      padding: 8px 12px;
      min-height: 52px;
    }
    
    .header .logo {
      font-size: 1.1em;
      margin-right: 8px;
    }
    
    .header .logo img {
      height: 132px;
      width: 132px;
    }
    
    .header-title-center {
      font-size: 0.9em;
      letter-spacing: 0.2px;
    }
    
    .header .welcome {
      display: none;
    }
    
    .header .garage {
      font-size: 0.85em;
    }
    
    .header .garage img {
      height: 20px;
      width: 20px;
    }
    
    .burger {
      width: 40px;
      height: 40px;
      margin-left: 8px;
    }
    
    .container {
      margin: 8px auto;
      padding: 12px;
      width: calc(100% - 12px);
      border-radius: 4px;
    }
    
    .topbar h2 {
      font-size: 1.2em;
    }
    
    .topbar .top-actions {
      width: 100%;
    }
    
    .topbar .top-actions button {
      flex: 1;
      font-size: 0.9em;
      padding: 8px 12px;
    }
    
    .estimates-table {
      font-size: 0.85em;
      min-width: 900px;
    }
    
    .estimates-table th,
    .estimates-table td {
      padding: 8px 6px;
    }
    
    .side-menu {
      width: 280px;
      max-width: 90vw;
      /* Enhanced mobile scrolling */
      height: calc(100vh - env(safe-area-inset-top));
      height: calc(100dvh - env(safe-area-inset-top));
    }
    
    .side-menu .side-links {
      /* Extra padding for mobile scrolling */
      padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    
    .footer {
      padding: 16px 12px;
      font-size: 0.85em;
    }
    
    .footer a {
      display: inline-block;
      margin: 4px 6px;
    }
  }

  /* Very small phones */
  @media (max-width: 360px) {
    .header-title-center {
      font-size: 0.8em;
    }
    
    .side-menu {
      width: 260px;
      max-width: 95vw;
    }
    
    .container {
      padding: 10px;
      width: calc(100% - 8px);
    }
    
    .estimates-table {
      min-width: 800px;
    }
  }

  /* iOS specific fixes for menu scrolling */
  @supports (-webkit-touch-callout: none) {
    .side-menu {
      /* Fix for iOS Safari viewport units */
      height: -webkit-fill-available;
    }
    
    /* Prevent bounce scrolling on body when menu is open */
    body.menu-open {
      position: fixed;
      width: 100%;
      overflow: hidden;
    }
  }

  /* Print styles */
  @media print {
    .header,
    .burger,
    .side-menu,
    .side-menu-backdrop,
    .footer,
    .topbar .top-actions {
      display: none !important;
    }
    
    .container {
      margin: 0;
      padding: 0;
      box-shadow: none;
      max-width: none;
      width: 100%;
    }
    
    .estimates-table {
      font-size: 12px;
    }
  }

  /* High contrast mode support */
  @media (prefers-contrast: high) {
    .header,
    .side-menu,
    .footer {
      border: 1px solid;
    }
    
    .estimates-table th,
    .estimates-table td {
      border: 1px solid;
    }
  }

  /* Reduced motion support */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
