  :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;
    transition: background-color 0.3s ease, color 0.3s ease;
  }

  /* Header styling */
  .header {
    background: var(--primary-color);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    min-height: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-wrap: nowrap;
  }
  .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 .header-subtext {
    font-size: 0.8em;
    font-weight: normal;
    color: var(--accent-color);
    margin-left: 10px;
    white-space: nowrap;
  }
  .header .right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
  }
  .header .welcome {
    font-size: 0.9em;
    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;
    }

    /* 🆕 v1 — Back link styled to match other detail pages */
    .header .back-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--accent-color);
      text-decoration: none;
      font-size: 0.95em;
      font-weight: 500;
      padding: 8px 14px;
      border-radius: 6px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.15);
      transition: background 0.2s, transform 0.15s;
    }
    .header .back-link:hover {
      background: rgba(255, 255, 255, 0.16);
      transform: translateX(-2px);
    }
    .header .back-link:focus-visible {
      outline: 2px solid var(--accent-color);
      outline-offset: 2px;
    }
    .header .back-link .arrow {
      font-size: 1.1em;
      line-height: 1;
    }

    /* Navigation bar */
  .nav {
    background: var(--secondary-color);
    display: flex;
    gap: 8px;
    padding: 0 16px;
    align-items: center;
    height: 48px;
    flex-wrap: wrap;
  }
  .nav a {
    color: #fff;
    text-decoration: none;
    padding: 0 16px;
    line-height: 48px;
    border-radius: 4px 4px 0 0;
    font-weight: 600;
    font-size: 1em;
  }
  .nav a:hover,
  .nav a.active { background: #204d74; }
  .nav .actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }
  .nav .actions button {
    padding: 10px 16px;
    border: none;
    background: var(--warning-color);
    color: #444;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.95em;
    min-height: 40px;
    white-space: nowrap;
  }
  .nav .actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }

  /* Burger menu and side navigation */
  .burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 12px;
    z-index: 1001;
    border-radius: 4px;
    transition: background-color 0.2s;
    min-width: 44px;
    min-height: 44px;
  }
  .burger:hover { background: rgba(255,255,255,0.1); }
  .burger:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
  }
  .burger span {
    display: block;
    height: 3px;
    width: 24px;
    background: #fff;
    margin: 3px auto;
    border-radius: 2px;
    transition: 0.3s ease;
    transform-origin: center;
  }
  .burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }
  .burger.active span:nth-child(2) { opacity: 0; }
  .burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }
  .side-menu-backdrop {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
  }
  .side-menu {
    position: fixed;
    right: -320px;
    top: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--secondary-color);
    color: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
  }
  .side-menu::-webkit-scrollbar { width: 6px; }
  .side-menu::-webkit-scrollbar-track { background: transparent; }
  .side-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
  }
  .side-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }
  .side-menu.open { right: 0; }
  .side-menu .side-header {
    background: #204d74;
    padding: 20px 18px 16px;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .side-menu .side-header img {
    height: 28px;
    width: 28px;
    object-fit: contain;
  }
  .side-menu .side-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
    padding-bottom: 20px;
  }
  .side-menu .side-link {
    color: #fff;
    text-decoration: none;
    padding: 14px 16px;
    font-size: 1em;
    border-radius: 6px;
    margin: 1px 0;
    font-weight: 500;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    flex-shrink: 0;
  }
  .side-menu .side-link.active,
  .side-menu .side-link:hover,
  .side-menu .side-link:focus { background: #204d74; outline: none; }
  .theme-dropdown {
    position: relative;
    margin: 4px 12px 8px 12px;
    flex-shrink: 0;
  }
  .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; }

  /* Main container styling */
  .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;
  }
  .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:last-child {
    background: var(--success-color);
    color: #fff;
  }
  .topbar .top-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }

  /* Table styling */
  .parts-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--table-bg);
    font-size: 0.95em;
    min-width: 900px;
    transition: background-color 0.3s ease;
  }
  .parts-table th,
  .parts-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--table-border);
    text-align: left;
    vertical-align: middle;
  }
  .parts-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;
  }
  .parts-table td { color: var(--theme-text); transition: color 0.3s ease; }
  .parts-table td a {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
  }
  .parts-table td a:hover { text-decoration: underline; }
  .parts-table td .edit-link {
    color: #1976d2;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
  }
  .parts-table td .edit-link:hover {
    background: #e3f2fd;
    text-decoration: none;
  }
  .parts-table tr:last-child td { border-bottom: none; }
  .parts-table tr:hover { background: rgba(33, 150, 243, 0.04); }

  /* Footer styling */
  .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; }
  /* Paywall locked state */
  .paywall-locked {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
  }
  /* Responsive styles */
  @media (max-width: 1024px) {
    .container { margin: 16px auto; padding: 20px; width: calc(100% - 24px); }
    .topbar h2 { font-size: 1.3em; }
    .side-menu { width: 280px; max-width: 80vw; }
  }
  @media (max-width: 768px) {
    .header { padding: 10px 12px; min-height: 56px; }
    .header .logo { font-size: 1.2em; margin-right: 12px; }
    .header .logo img { height: 28px; width: 28px; }
    .topbar h2 { font-size: 1.2em; }
    .topbar, .topbar .top-actions { flex-direction: column; gap: 12px; }
    .container { margin: 12px auto; padding: 16px; width: calc(100% - 16px); border-radius: 6px; }
    .parts-table { font-size: 0.9em; min-width: 800px; }
    .parts-table th, .parts-table td { padding: 10px 8px; }
    .side-menu { width: 300px; max-width: 85vw; }
  }
  @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: 28px; width: 28px; }
    .header .header-subtext { display: none; }
    .right .welcome { display: none; }
    .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 button { font-size: 0.9em; padding: 8px 12px; }
    .parts-table { font-size: 0.85em; min-width: 800px; }
    .parts-table th, .parts-table td { padding: 8px 6px; }
  }
  @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%; }
    .parts-table { font-size: 12px; }
  }
  @media (prefers-contrast: high) {
    .header, .side-menu, .footer { border: 1px solid; }
    .parts-table th, .parts-table td { border: 1px solid; }
  }
  @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;
    }
  }
