:root {
    --accent: #008080;
    --accent-hover: #006766;
    --bg-page: #fafafa;
    --bg-card: #ffffff;
    --text: #333333;
  }
  
  *, *::before, *::after {
    box-sizing: border-box;
  }
  
  body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text);
    line-height: 1.6;
  }
  
  .site-wordmark {
    text-decoration: none;
    color: #1a1f26;
    font-family: 'Inter', 'Avenir Next', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    font-feature-settings: "kern" 1, "liga" 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
  .site-wordmark:hover {
    color: #1e242c;
    background-color: transparent;
  }

  @keyframes disco-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }


  
  nav {
    background: var(--bg-card);
    border-bottom: 1px solid #ececec;
  }
  nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  nav li {
    position: relative;
  }
  nav a {
    display: block;
    padding: 0.55rem 0.95rem;
    text-decoration: none;
    color: #6b7280;
    font-size: 0.9375rem;
    font-weight: 400;
    border-radius: 8px;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  nav a:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: #374151;
  }
  .dropdown:hover .dropdown-menu {
    display: block;
  }
  .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin: 0;
    padding: 0;
    z-index: 10;
    border-radius: 8px;
    overflow: hidden;
    min-width: 160px;
  }
  .dropdown-menu li a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: #6b7280;
    border-radius: 0;
    white-space: nowrap;
    text-align: left;
  }
  .dropdown-menu li a:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #374151;
    border-radius: 0;
  }
  
  .container {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
  }
  
  .section {
    background: var(--bg-card);
    padding: 24px;
    margin-bottom: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  }
  
  /* Hero on home page */
  #hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    align-items: center;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  #hero img {
    width: 100%;
    max-width: 400px;
    object-fit: contain;
    border-radius: 8px;
  }
  .hero-text p {
    font-size: 0.95rem;
  }
  
  /* Forms */
  .form-group {
    margin-bottom: 15px;
  }
  label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
  }
  input[type="email"],
  textarea,
  select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
  }
  textarea {
    resize: vertical;
    min-height: 120px;
  }
  button {
    background: var(--accent);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
  }
  button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
  }

  button:disabled {
    background: #e0e0e0;
    color: #999;
    border-color: #ccc;
    cursor: not-allowed;
    transform: none;
  }

  button:disabled:hover {
    background: #e0e0e0;
    transform: none;
  }
  
  /* Annotate page extras */
  #how-it-works .how-it-works-heading {
    margin: 0;
  }
  #how-it-works .how-it-works-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    padding: 0;
  }
  #how-it-works .how-it-works-toggle:hover {
    background: none;
    color: var(--accent);
    transform: none;
  }
  #how-it-works .how-it-works-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
  }
  #how-it-works .how-it-works-chevron {
    display: inline-block;
    transition: transform 0.2s ease;
  }
  #how-it-works .how-it-works-toggle[aria-expanded="true"] .how-it-works-chevron {
    transform: rotate(180deg);
  }
  #howItWorksSteps[hidden] {
    display: none !important;
  }
  .steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    margin-top: 16px;
  }
  .step {
    text-align: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }
  
 /* file picker */
 /* hide the real file input */

 /* hide the real file input */
.file-group input[type="file"] {
    display: none !important;
  }
  
  /* container for the custom picker */
  .file-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }
  
  /* the always-visible "Browse" button */
  .file-btn {
    padding: 8px 12px;
    background: linear-gradient(135deg, #00b3b3, #008080);
    color: #fff;
    border: 1px solid #00b3b3;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  /* dropdown menu (hidden by default) */
  .file-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin: 0;
    padding: 0;
    z-index: 10;
  }
  
  /* each menu item */
  .file-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    text-align: left;
    color: var(--accent);
    cursor: pointer;
  }
  
  /* hover state for both Browse and menu items */
  .file-btn:hover,
  .file-menu button:hover {
    background: linear-gradient(135deg, #009999, #006666);
    color: #fff;
    border-color: #009999;
  }
  
  /* keep the filename from wrapping and constrain its width */
  .file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: inline-block;
    flex-shrink: 1;
  }

  /* Test data button styling */
  .test-data-btn {
  background: #eef2f7;
  color: #334155;
  border: 1px solid #cbd5e1;
  box-shadow: none;
  animation: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  }

  .test-data-btn:hover {
  background: #e2e8f0;
  color: #1f2937;
  border-color: #94a3b8;
  box-shadow: none;
    transform: translateY(-1px);
  }

  .test-data-btn.clicked {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
    color: #fff;
    border: 1px solid #6b7280;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: none;
  }

  .test-data-btn.clicked:hover {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
    border-color: #6b7280;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: none;
  }

  @keyframes pulse-glow {
    0% {
      box-shadow: 0 0 10px rgba(79, 70, 229, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    100% {
      box-shadow: 0 0 15px rgba(79, 70, 229, 0.5), 0 2px 4px rgba(0, 0, 0, 0.1);
    }
  }
  
  /* Progress */
  #progress-container {
    margin-top: 10px;
    display: none;
    background: transparent;
    padding: 10px 2px 0;
    border-radius: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }
  #progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
  }
  #progress-fill {
    width: 0%;
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
  }
  #progress-messages {
    max-height: 300px;
    overflow-y: auto;
  }
  .progress-message {
    padding: 8px;
    margin: 4px 0;
    border-radius: 4px;
    background: #fff;
    border-left: 4px solid var(--accent);
  }
  .progress-message.error {
    border-left-color: #dc3545;
  }
  .progress-message.success {
    border-left-color: #28a745;
  }
  .progress-message.info {
    border-left-color: #17a2b8;
  }
  .progress-message.warning {
    border-left-color: #fbbf24;
    background: #fef3c7;
  }
  
  /* Custom tooltip for cell warnings */
  .cell-warning-tooltip {
    position: relative;
    cursor: help;
    color: #d97706;
    font-weight: 500;
  }
  
  .cell-warning-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 8px 12px;
    background-color: #1f2937;
    color: #fff;
    font-size: 13px;
    font-weight: normal;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  }
  
  .cell-warning-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    border: 6px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
  }
  
  .cell-warning-tooltip:hover::after,
  .cell-warning-tooltip:hover::before {
    opacity: 1;
  }
  
  @media (max-width: 600px) {
    .nav-menu {
      flex-direction: column;
      align-items: flex-start;
    }
    .container {
      padding: 0 10px;
    }
  }

  /* ============================================================================
     MODERN MODAL SYSTEM - Notion/Linear Style
     Unified, clean, compact design for all modals
     ============================================================================ */
  
  /* Modal Overlay - Dark backdrop with blur */
  .modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 16px;
    overflow-y: auto;
  }
  
  .modal[style*="display: flex"],
  .modal[style*="display: block"] {
    display: flex !important;
  }
  
  /* Modal Container - Compact, centered, clean */
  .modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px; /* Compact default: 520-680px range */
    max-height: calc(100vh - 32px);
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 
                0 8px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: auto;
    animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  /* Size variants for different modal types */
  .modal-content.modal-sm {
    max-width: 480px;
  }
  
  .modal-content.modal-md {
    max-width: 600px;
  }
  
  .modal-content.modal-lg {
    max-width: 900px;
  }
  
  .modal-content.modal-xl {
    max-width: 1200px;
  }
  
  @keyframes modalFadeIn {
    from {
      opacity: 0;
      transform: scale(0.96) translateY(8px);
    }
    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }
  
  /* Modal Header - Minimal, no heavy chrome */
  .modal-header {
    padding: 24px 24px 20px 24px;
    border-bottom: none; /* Remove thick dividers */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
  }
  
  .modal-header h2,
  .modal-header h3 {
    margin: 0;
    font-size: 1.125rem; /* Smaller, calmer title */
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
    letter-spacing: -0.01em;
  }
  
  /* Small Icon Close Button */
  .modal-close,
  .modal-header .close {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    border-radius: 6px;
    transition: all 0.15s ease;
    padding: 0;
    font-size: 1.125rem;
    line-height: 1;
    flex-shrink: 0;
  }
  
  .modal-close:hover,
  .modal-header .close:hover {
    background: #f5f5f5;
    color: #1a1a1a;
  }
  
  .modal-close:active,
  .modal-header .close:active {
    background: #e8e8e8;
  }
  
  /* Modal Body - Compact padding, uses 8px scale */
  .modal form,
  .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
  }
  
  /* Form Group Styles - Smaller, calmer inputs */
  .modal .form-group {
    margin-bottom: 16px; /* 8px scale spacing */
  }
  
  .modal .form-group:last-child {
    margin-bottom: 0;
  }
  
  .modal .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #666; /* Muted label color */
    font-size: 0.8125rem; /* Smaller labels */
    line-height: 1.4;
  }
  
  .modal .form-group input,
  .modal .form-group textarea,
  .modal .form-group select {
    width: 100%;
    max-width: 100%; /* Constrain inside modal */
    padding: 10px 12px;
    height: 42px; /* 40-44px height range */
    border: 1.5px solid #e5e5e5;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.15s ease;
    box-sizing: border-box;
    color: #1a1a1a;
    background: #ffffff;
    font-family: inherit;
  }
  
  .modal .form-group textarea {
    height: auto;
    min-height: 80px;
    padding: 10px 12px;
  }
  
  .modal .form-group input:focus,
  .modal .form-group textarea:focus,
  .modal .form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.08);
  }
  
  .modal .form-group input::placeholder {
    color: #999;
  }

  .modal .form-group input:disabled,
  .modal .form-group input[readonly] {
    background: #f5f5f5;
    color: #888;
    cursor: not-allowed;
    border-color: #e5e5e5;
  }

  .modal .form-group small,
  .modal .form-text {
    display: block;
    margin-top: 6px;
    font-size: 0.8125rem;
    color: #888; /* Subtle helper text */
    line-height: 1.4;
  }
  
  /* Secondary Action Links - Minimal, subtle */
  .modal .secondary-action {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.875rem;
    color: #888;
  }
  
  .modal .secondary-action a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
  }
  
  .modal .secondary-action a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
  }
  
  /* Modal Buttons - Full width, consistent 44px height */
  .btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0 24px;
    height: 44px;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  
  .btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 128, 128, 0.2);
  }
  
  .btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 128, 128, 0.2);
  }
  
  .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  
  .btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 1.5px solid #e0e0e0;
    padding: 0 24px;
    height: 44px;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  
  .btn-secondary:hover:not(:disabled) {
    background: #e8e8e8;
    border-color: #d0d0d0;
  }
  
  .btn-secondary:active:not(:disabled) {
    background: #e0e0e0;
  }
  
  .btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  
  /* Modal Footer - Minimal spacing, uses 8px scale */
  .modal-footer {
    padding: 16px 24px 24px 24px;
    border-top: none; /* Remove border, use whitespace */
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
  }
  
  .modal-footer .btn,
  .modal-footer .btn-primary,
  .modal-footer .btn-secondary {
    min-width: 100px;
    width: auto;
  }
  
  /* Modal Error/Success Messages - Subtle, compact */
  .modal-error {
    color: #dc3545;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 16px;
    font-size: 0.875rem;
    display: none;
    line-height: 1.5;
  }
  
  .modal-success {
    color: #059669;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
    animation: fadeIn 0.2s ease-in;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* Responsive Modal Adjustments */
  @media (max-width: 768px) {
    .modal {
      padding: 0;
      align-items: flex-end;
    }

    .modal-content {
      max-width: 100%;
      max-height: 92vh;
      border-radius: 20px 20px 0 0;
      margin: 0;
    }

    .modal-header {
      padding: 22px 22px 16px 22px;
    }

    .modal-header h2,
    .modal-header h3 {
      font-size: 1.15rem;
    }

    .modal form,
    .modal-body {
      padding: 0 22px 22px 22px;
    }

    .modal .form-group {
      margin-bottom: 18px;
    }

    .modal .form-group label {
      font-size: 0.875rem;
      margin-bottom: 7px;
    }

    .modal .form-group input,
    .modal .form-group textarea,
    .modal .form-group select {
      font-size: 16px; /* prevents iOS auto-zoom */
      height: 48px;
      padding: 12px 14px;
      border-radius: 10px;
    }

    .modal .form-group textarea {
      height: auto;
      min-height: 90px;
    }

    .btn-primary {
      height: 50px;
      font-size: 1rem;
      border-radius: 10px;
    }

    .modal .secondary-action {
      font-size: 0.9375rem;
      padding-top: 18px;
      margin-top: 18px;
    }

    .modal-footer {
      padding: 14px 22px 24px 22px;
    }
  }

  @media (max-width: 480px) {
    .modal-header {
      padding: 20px 18px 14px 18px;
    }

    .modal form,
    .modal-body {
      padding: 0 18px 18px 18px;
    }

    .modal-footer {
      padding: 12px 18px 20px 18px;
    }

    .modal .form-group {
      margin-bottom: 16px;
    }
  }
  
  .spinner {
    display: none;
    margin-right: 8px;
  }
  
  /* ============================================================================
     PRICING PLANS STYLES (used in modals)
     ============================================================================ */
  .form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
  }
  
  .form-section:last-of-type {
    margin-bottom: 1rem;
  }
  
  .form-section-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
  }
  
  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
  }
  
  .form-row .form-group:last-child {
    margin-bottom: 0;
  }
  
  .form-check-group {
    padding: 1.25rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }
  
  .form-check-group .checkbox-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    margin-bottom: 0.75rem;
    cursor: pointer;
    user-select: none;
  }
  
  .form-check-group input[type="checkbox"] {
    margin-right: 0.75rem;
    transform: scale(1);
  }
  
  .checkbox-with-text {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
  }
  
  .checkbox-with-text:hover {
    border-color: #007bff;
    box-shadow: 0 4px 16px rgba(0,123,255,0.15);
    transform: translateY(-1px);
  }
  
  .checkbox-with-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #28a745);
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .checkbox-with-text:hover::before {
    opacity: 1;
  }
  
  .checkbox-with-text .checkbox-container {
    position: relative;
    flex-shrink: 0;
    margin-top: 0.125rem;
  }
  
  .checkbox-with-text input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
  }
  
  .checkbox-with-text .checkbox-custom {
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
  }
  
  .checkbox-with-text input[type="checkbox"]:checked + .checkbox-custom {
    background-color: #007bff;
    border-color: #007bff;
  }
  
  .checkbox-with-text input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
  }
  
  .checkbox-with-text .checkbox-custom:hover {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
  }
  
  .checkbox-with-text .description-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .checkbox-with-text .description-text {
    color: #495057;
    font-size: 1rem;
    line-height: 1.4;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  
  .checkbox-with-text .description-subtitle {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0;
    font-weight: 400;
    opacity: 0.8;
  }
  
  .form-check-group .form-text {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-left: 1.75rem;
  }
  
  /* Enhanced Modal Footer */
  .modal-footer {
    padding: 1.5rem 0 0 0;
    border-top: 1px solid #e9ecef;
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    align-items: center;
  }
  
  .modal-footer .btn {
    padding: 0;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    height: 44px;
    width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-size: 1rem;
    line-height: 1;
    border: none;
    cursor: pointer;
    margin: 0;
  }
  
  .modal-footer .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  }
  
  /* Modal input styles are now handled by .modal .form-group input */
  /* Placeholder and autofill styles are now handled by .modal .form-group input */
  
  /* Modal input styles are now handled by .modal .form-group input */
  /* Modal input styles are now handled by .modal .form-group input */

/* FAQ Styles */
.faq-item {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.faq-item:last-child {
  margin-bottom: 0;
}

.faq-item h3 {
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.3em;
}

.faq-item h4 {
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.2em;
}

.faq-item p {
  line-height: 1.6;
  color: #555;
}

.faq-category {
  margin-bottom: 3rem;
}

.faq-category:last-child {
  margin-bottom: 0;
}

.faq-category h3 {
  color: var(--accent);
  font-size: 1.5em;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

/* ============================================================================
   LEGACY MODAL SUPPORT - Maps old classes to new unified system
   Keep for backward compatibility during transition
   ============================================================================ */

/* Inference Modal - now uses unified modal system */
.inference-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow-y: auto;
}

.inference-modal[style*="display: block"] {
  display: flex !important;
}

.inference-modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 1200px; /* Wider for data table */
  max-height: calc(100vh - 32px);
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 
              0 8px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: auto;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.inference-modal-header {
  padding: 24px 24px 20px 24px;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.inference-modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.inference-modal .close {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  border-radius: 6px;
  transition: all 0.15s ease;
  padding: 0;
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
}

.inference-modal .close:hover,
.inference-modal .close:focus {
  background: #f5f5f5;
  color: #1a1a1a;
}

.inference-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

#inferenceTableContainer {
  overflow-x: auto;
  width: 100%;
}

/* Inference Table Styles */
#inferenceTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  min-width: 800px;
}

/* Column width adjustments */
#inferenceTable th:nth-child(1) { width: 32%; } /* Run */
#inferenceTable th:nth-child(2) { width: 11%; } /* Status */
#inferenceTable th:nth-child(3) { width: 8%; }  /* Cells */
#inferenceTable th:nth-child(4) { width: 17%; } /* Started At */
#inferenceTable th:nth-child(5) { width: 12%; } /* Time */
#inferenceTable th:nth-child(6) { width: 20%; } /* Results */

#inferenceTable th,
#inferenceTable td {
  border: 1px solid #e5eaf0;
  padding: 14px 12px;
  text-align: left;
  white-space: nowrap;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #1f2937;
}

#inferenceTable th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #333;
}

#inferenceTable th.time-column,
#inferenceTable th.results-column {
  position: relative;
}

#inferenceTable .column-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}

#inferenceTable th.time-column::before,
#inferenceTable th.time-column::after,
#inferenceTable th.results-column::before,
#inferenceTable th.results-column::after {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  position: absolute;
  left: 50%;
  z-index: 20;
}

#inferenceTable th.time-column::before,
#inferenceTable th.results-column::before {
  content: "";
  top: calc(100% + 2px);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #334155;
}

#inferenceTable th.time-column::after {
  content: attr(data-tooltip);
  top: calc(100% + 10px);
  transform: translateX(-50%);
  background: #334155;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

#inferenceTable th.results-column::after {
  content: attr(data-tooltip);
  top: calc(100% + 10px);
  transform: translateX(-50%);
  background: #334155;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: pre-line;
  width: 300px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

#inferenceTable th.time-column:hover::before,
#inferenceTable th.time-column:hover::after,
#inferenceTable th.time-column:focus-within::before,
#inferenceTable th.time-column:focus-within::after,
#inferenceTable th.results-column:hover::before,
#inferenceTable th.results-column:hover::after,
#inferenceTable th.results-column:focus-within::before,
#inferenceTable th.results-column:focus-within::after {
  opacity: 1;
}

#inferenceTable tr:nth-child(even) {
  background-color: #fcfdff;
}

#inferenceTable tr:hover {
  background-color: #f7faff;
}

#inferenceTable td.run-cell {
  white-space: normal;
}

#inferenceTable .run-model {
  display: block;
  font-weight: 600;
  color: #111827;
}

#inferenceTable .run-filename {
  display: block;
  margin-top: 2px;
  color: #6b7280;
  font-size: 0.92em;
}

/* Status badges */
.status-pending {
  background-color: #ffd700;
  color: #000;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

.status-completed {
  background-color: #28a745;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

.status-error {
  background-color: #dc3545;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

/* Inference Slider Styles */
.inference-slider {
  position: fixed;
  right: -200px;
  top: 50%;
  transform: translateY(-50%);
  width: 200px;
  height: 60px;
  background: linear-gradient(135deg, #7c8798 0%, #667085 100%);
  color: white;
  cursor: pointer;
  transition: right 0.3s ease;
  border-radius: 8px 0 0 8px;
  box-shadow: -1px 0 6px rgba(15, 23, 42, 0.12);
  opacity: 0.92;
  z-index: 999;
}

.inference-slider:hover {
  right: -180px;
}

.inference-slider.show {
  right: 0;
}

.slider-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 10px;
  font-size: 14px;
  font-weight: bold;
}

.slider-content span:first-child {
  font-size: 20px;
  margin-bottom: 5px;
}


/* Responsive design for inference components */
@media (max-width: 768px) {
  .inference-modal-content {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  
  .inference-modal-header {
    padding: 20px 20px 16px 20px;
  }
  
  .inference-modal-body {
    padding: 20px;
  }
  
  .inference-slider {
    width: 150px;
    right: -150px;
  }
  
  .inference-slider:hover {
    right: -130px;
  }
}

@media (max-width: 480px) {
  .inference-modal-header {
    padding: 16px 16px 12px 16px;
  }
  
  .inference-modal-header h2 {
    font-size: 1rem;
  }
  
  .inference-modal-body {
    padding: 16px;
  }
}


/* Mobile-only direct tool links (replaces dropdown on small screens) */
.nav-tools-mobile {
  display: none;
}

/* Navigation Layout */
.nav-container {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 24px;
  height: 64px;
  position: relative;
}

.site-wordmark {
  flex-shrink: 0;
  padding-left: 0;
  padding-right: 1.5rem;
  margin-right: 1.75rem;
  border: none;
  border-radius: 0;
}

.nav-admin-badge {
  flex-shrink: 0;
  margin-right: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  background: #e6f3f8;
  border: 1.5px solid #b6d9eb;
  color: #1a5f7a !important;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
}

.nav-admin-badge:hover {
  background: #d4eaf5;
  border-color: #8fc5df;
  text-decoration: none;
}

.nav-admin-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #1a5f7a;
}

.nav-menu {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-account {
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-account-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-dropdown-right {
  right: 0;
  left: auto;
  min-width: 140px;
}

/* Account Page Styles */
.account-header {
  margin-top: 40px;
  text-align: center;
}

.avatar-circle {
  width: 100px;
  height: 100px;
  font-size: 3rem;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 128, 128, 0.3);
}

.account-title {
  font-size: 2.5em;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: bold;
}

.account-subtitle {
  font-size: 1.2em;
  color: #666;
  margin-bottom: 30px;
}

.edit-account-btn {
  background: var(--accent);
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1.1em;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 128, 128, 0.2);
}

.edit-account-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 128, 128, 0.3);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.account-card {
  background: white;
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.account-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.account-card-title {
  font-size: 1.8em;
  margin-bottom: 25px;
  text-align: center;
  color: var(--accent);
  font-weight: bold;
}

.account-info-item {
  display: flex;
  align-items: flex-start;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.account-info-item:hover {
  background: #e8f4f8;
  transform: translateX(4px);
}

.account-info-icon {
  font-size: 1.5em;
  margin-right: 15px;
  color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
}

.account-info-label {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 8px;
  display: block;
}

.account-info-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.account-info-value {
  font-weight: bold;
  font-size: 1.1em;
  color: var(--text);
  display: block;
}

.plan-item {
  margin-bottom: 0;
  padding: 6px 12px;
  background: #f8f9fa;
  border-radius: 6px;
}

.plan-item:last-child {
  margin-bottom: 0;
}

.plan-item small {
  color: #6c757d;
  font-size: 0.85em;
  margin-left: 8px;
}

/* Edit Account Modal Styles - DEPRECATED, use unified .modal system */
/* Legacy styles removed - now using unified modal system */

.edit-form-spinner {
  display: none;
}

/* Settings Page Styles */
.settings-container {
  margin-top: 1.5rem;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.settings-title {
  margin: 0;
}

.settings-back-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid #6c757d;
  background: transparent;
  color: #6c757d;
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.settings-card {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
}

.settings-card-header {
  padding: 1rem 1.25rem;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  border-radius: 0.375rem 0.375rem 0 0;
}

.settings-card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
}

.settings-card-body {
  padding: 1.25rem;
}

.settings-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-form-group {
  margin-bottom: 1rem;
}

.settings-form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #212529;
}

.settings-form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.settings-form-control:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.settings-form-control:read-only {
  background-color: #e9ecef;
}

.settings-form-text {
  color: #6c757d;
  font-size: 0.875rem;
}

.settings-form-check {
  display: flex;
  align-items: center;
  margin-top: 1rem;
}

.settings-form-check-input {
  margin-right: 0.5rem;
  transform: scale(1.2);
}

.settings-form-check-label {
  font-weight: 500;
  color: #212529;
  cursor: pointer;
}

.settings-alert {
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
}

.settings-alert-info {
  color: #055160;
  background-color: #cff4fc;
  border-color: #b6effb;
}

.settings-alert-success {
  color: #0f5132;
  background-color: #d1e7dd;
  border-color: #badbcc;
}

.settings-alert-dismissible {
  position: relative;
  padding-right: 4rem;
}

.settings-btn-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: #000;
  opacity: 0.5;
  cursor: pointer;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.settings-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.settings-btn-secondary {
  color: #6c757d;
  background-color: transparent;
  border-color: #6c757d;
  margin-right: 0.5rem;
}

.settings-btn-primary {
  color: #fff;
  background-color: #0d6efd;
  border-color: #0d6efd;
}

.settings-spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
  border: 0.125em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to {
    transform: rotate(360deg);
  }
}

/* Benchmark Page Styles */
.test-set-item {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.test-set-item:hover {
  background: #e9ecef;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.test-set-item.selected {
  background: #e8f4f8;
  border-color: var(--accent);
  border-width: 2px;
  box-shadow: 0 4px 12px rgba(0, 128, 128, 0.2);
}

.test-set-name {
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 1.1em;
}

.test-set-description {
  color: #666;
  font-size: 0.9em;
  line-height: 1.4;
}

.loading-message {
  color: #666;
  font-style: italic;
  text-align: center;
}

/* Benchmark Modal - uses unified modal system with custom size */
.benchmark-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow-y: auto;
}

.benchmark-modal.show {
  display: flex;
}

.benchmark-modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 1400px;
  max-height: calc(100vh - 32px);
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 
              0 8px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: auto;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.benchmark-modal-header {
  padding: 24px 24px 20px 24px;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.benchmark-modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.benchmark-close-button {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  border-radius: 6px;
  transition: all 0.15s ease;
  padding: 0;
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
}

.benchmark-close-button:hover {
  background: #f5f5f5;
  color: #1a1a1a;
}

.benchmark-close-button:active {
  background: #e8e8e8;
}

.benchmark-comparison-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 30px;
  flex: 1;
  overflow: hidden;
  align-items: stretch;
}

.benchmark-comparison-side {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.benchmark-model-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #dee2e6;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.benchmark-model-header h3 {
  margin: 0;
  color: var(--accent);
  font-size: 1.25rem;
}

.header-with-select {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: center;
  white-space: nowrap;
}

.header-with-select select {
  padding: 8px 12px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: white;
  font-size: 0.9rem;
  min-width: 180px;
}

.benchmark-chart-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  overflow: hidden;
  position: relative;
  height: 600px;
  min-height: 600px;
  max-height: 600px;
}

.benchmark-chart-container img {
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: auto;
}

.benchmark-chart-container img:not([src=""]) {
  display: block;
}

.benchmark-chart-container .loading-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  white-space: nowrap;
  z-index: 10;
}

/* Error and Status Messages */
.error-message {
  color: red;
  text-align: center;
  padding: 20px;
}

.no-data-message {
  text-align: center;
  padding: 20px;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

.download-link {
  color: #2563eb;
  text-decoration: underline;
}

#inferenceTable .results-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

#inferenceTable .result-link {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  text-decoration: none;
  font-size: 11px;
  font-weight: 450;
  line-height: 1.5;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#inferenceTable .result-link:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

/* Account Info List */
.account-info-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Duplicate modal error/success styles removed - using unified system above */

/* Location Form Footer */
.location-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Detected Location Time */
.detected-location-time {
  display: block;
  margin-top: 0.25rem;
}

/* Annotation Example Image */
.annotation-example-img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.annotate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.annotate.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.75rem;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 2rem;
  align-items: start;
  position: relative;
}

.info h2 {
  border-bottom: 2px solid #008080;
  padding-bottom: 0.25rem;
  margin-bottom: 0;
}

/* Header row: title left, History button right */
.interpret-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.interpret-header h2 {
  flex: 1;
  min-width: 0;
}

/* Ghost history button — desktop hidden, mobile visible */
.history-inline-btn {
  display: none;
  flex-shrink: 0;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid rgba(0, 128, 128, 0.35);
  border-radius: 8px;
  color: #6b7280;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.history-inline-btn:hover {
  background: rgba(0, 128, 128, 0.06);
  border-color: rgba(0, 128, 128, 0.55);
  color: #008080;
}

.preview {
  justify-self: end;
  align-self: start;
  max-width: 270px;
  width: min(100%, 270px);
  margin: 3.25rem 0 0;
  cursor: pointer;
}

.preview img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.preview:hover img {
  transform: scale(1.02);
}

/* Primary button styling */
#submitButton {
  padding: 0.85rem 2.2rem;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0, 102, 102, 0.22);
  background: linear-gradient(135deg, #008080, #006666);
  color: #fff;
  border: 1px solid #008080;
  margin-top: 1.25rem;
  position: relative;
}

#submitButton:hover {
  background: linear-gradient(135deg, #006666, #004d4d);
  border-color: #006666;
  transform: translateY(-1px);
}

/* Disabled submit button styling */
#submitButton:disabled {
  background: #e0e0e0 !important;
  color: #999 !important;
  border-color: #ccc !important;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.7;
}

#submitButton:disabled:hover {
  background: #e0e0e0 !important;
  transform: none !important;
  opacity: 0.8;
}





/* Custom tooltip for disabled button */
#submitButton:disabled::after {
  content: "Wait until model is finished processing";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-weight: 500;
  min-width: 200px;
  text-align: center;
}

#submitButton:disabled::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  margin-bottom: 2px;
}

#submitButton:disabled:hover::after,
#submitButton:disabled:hover::before {
  opacity: 1;
}

/* Annotate workspace spacing */
.annotate.grid #uploadForm .form-group {
  margin-bottom: 1.25rem;
}

.annotate.grid #uploadForm > .form-group:last-of-type {
  margin-top: 0.75rem;
}

.annotate.grid #filePicker.file-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.45rem;
}

.annotate.grid #filePicker .file-name {
  flex-basis: 100%;
  max-width: 100%;
  display: block;
  color: #6b7280;
  font-size: 0.92rem;
  line-height: 1.35;
}

/* Form spacing improvements */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.1);
}

.form-group select:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

/* Ensure button container has proper positioning for tooltip */
.form-group {
  position: relative;
}

/* Consistent teal for file buttons */
.file-btn {
  padding: 8px 12px;
  background: linear-gradient(135deg, #008080, #006666);
  color: #fff;
  border: 1px solid #008080;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  display: inline-block;
}

.file-btn:hover,
.file-menu button:hover {
  background: linear-gradient(135deg, #006666, #004d4d);
  color: #fff;
  border-color: #006666;
}

@media (max-width: 900px) {
  .history-inline-btn {
    display: inline-flex;
    min-height: 44px;
  }

  .interpret-header h2 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 768px) {
  .annotate.grid {
    grid-template-columns: 1fr;
    align-items: start;
  }
  
  .preview {
    margin: 1.5rem 0 0 0;
    max-width: 60%;
    justify-self: center;
  }
}

@media (max-width: 576px) {
  .preview {
    display: none;
  }
}

/* ============================================================================
   PRICING MODAL STYLES
   ============================================================================ */

/* Pricing Plans Container */
.pricing-plans-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 0;
}

/* Individual Pricing Card */
.pricing-plan-card {
  background: #ffffff;
  border: 1.5px solid #e8e8e8;
  border-radius: 12px;
  padding: 24px;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pricing-plan-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 128, 128, 0.1);
  transform: translateY(-2px);
}

/* Highlighted Plan */
.pricing-plan-card.highlighted {
  border-color: var(--accent);
  border-width: 2px;
  padding: 23px; /* Maintain same visual size */
}

/* Plan Badge */
.pricing-plan-card .highlight-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--accent);
  color: white;
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0 11px 0 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Plan Name/Title */
.pricing-plan-card h3,
.pricing-plan-card h4 {
  color: #1a1a1a;
  font-size: 1.125rem;
  margin: 0 0 4px 0;
  font-weight: 600;
  line-height: 1.4;
}

/* Plan Price */
.pricing-plan-card .price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin: 12px 0 16px 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.pricing-plan-card .price .currency {
  font-size: 1.25rem;
  vertical-align: top;
  font-weight: 600;
}

.pricing-plan-card .price .period {
  font-size: 0.875rem;
  color: #666;
  font-weight: 500;
  margin-left: 4px;
}

/* Plan Description */
.pricing-plan-card .description {
  color: #666;
  margin-bottom: 24px;
  line-height: 1.6;
  font-size: 0.9375rem;
  flex: 1;
}

/* Plan Features List (optional) */
.pricing-plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
  flex: 1;
}

.pricing-plan-features li {
  padding: 8px 0;
  color: #666;
  font-size: 0.875rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
}



/* Plan Select Button */
.pricing-plan-card .select-plan-btn,
.pricing-plan-card button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0 20px;
  height: 44px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  box-sizing: border-box;
}

.pricing-plan-card .select-plan-btn:hover,
.pricing-plan-card button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 128, 128, 0.2);
}

.pricing-plan-card .select-plan-btn:active,
.pricing-plan-card button:active {
  transform: translateY(0);
}

/* Responsive Pricing Grid */
@media (max-width: 768px) {
  .pricing-plans-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Upgrade Modal - uses unified modal system */
.upgrade-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow-y: auto;
}

.upgrade-modal[style*="display: block"],
.upgrade-modal[style*="display: flex"] {
  display: flex !important;
}

.upgrade-modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 32px);
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 
              0 8px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: auto;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.upgrade-modal-header {
  padding: 24px 24px 20px 24px;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.upgrade-modal-header h2,
.upgrade-modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.upgrade-modal-header .close {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  border-radius: 6px;
  transition: all 0.15s ease;
  padding: 0;
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
}

.upgrade-modal-header .close:hover {
  background: #f5f5f5;
  color: #1a1a1a;
}

.upgrade-modal-header .close:active {
  background: #e8e8e8;
}

.upgrade-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.upgrade-modal .pricing-plans-container {
  margin-top: 20px;
}

@media (max-width: 768px) {
  .upgrade-modal {
    padding: 0;
    align-items: stretch;
  }
  
  .upgrade-modal-content {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  
  .upgrade-modal-header {
    padding: 20px 20px 16px 20px;
  }
  
  .upgrade-modal-body {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .upgrade-modal-header {
    padding: 16px 16px 12px 16px;
  }
  
  .upgrade-modal-header h2,
  .upgrade-modal-header h3 {
    font-size: 1rem;
  }
  
  .upgrade-modal-body {
    padding: 16px;
  }
}

.upgrade-message {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 0.9375rem;
  color: #92400e;
  line-height: 1.6;
}

.current-plan-info,
.available-plans {
  margin-bottom: 32px;
}

.current-plan-info h3,
.available-plans h3 {
  color: #1a1a1a;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1.5px solid #e8e8e8;
}

.plan-details {
  background: #fafafa;
  border-radius: 8px;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #666;
}

/* Upgrade Actions */
.upgrade-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1.5px solid #e8e8e8;
}

.upgrade-actions .btn {
  min-width: 140px;
  width: auto;
}

@media (max-width: 480px) {
  .upgrade-actions {
    flex-direction: column;
  }
  
  .upgrade-actions .btn {
    width: 100%;
  }
}

/* Plan Limits Display - Discrete version */
.plan-limits-discrete {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  font-size: 12px;
  color: #888;
  line-height: 1.8;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.plan-limits-discrete div {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .plan-limits-discrete {
    font-size: 11px;
    bottom: 0.75rem;
    right: 0.75rem;
    padding: 6px 10px;
  }
}

/* Pagination Controls */
#paginationControls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 15px 10px;
  border-top: 1px solid #ddd;
  background: #f8f9fa;
}

#paginationControls button {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 100px;
}

#paginationControls button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 128, 128, 0.2);
}

#paginationControls button:disabled {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
  opacity: 0.5;
}

#pageInfo {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

@media (max-width: 576px) {
  #paginationControls {
    flex-direction: column;
    gap: 10px;
  }
  
  #paginationControls button {
    width: 100%;
  }
}

/* ============================================================================
   MODERN ACCOUNT PAGE STYLES - Notion/Linear/Stripe Aesthetic
   ============================================================================ */

/* Container */
.modern-account-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px;
}

/* Header */
.modern-account-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 32px;
  border-bottom: 1px solid #e8e8e8;
  margin-bottom: 40px;
}

.modern-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #008080 0%, #006666 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 600;
  flex-shrink: 0;
}

.modern-account-header-info {
  flex: 1;
  min-width: 0;
}

.modern-account-name {
  margin: 0 0 4px 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.3;
}

.modern-account-email {
  margin: 0;
  font-size: 0.9375rem;
  color: #666;
  line-height: 1.5;
}

.modern-btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0 20px;
  height: 44px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.modern-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.modern-btn-primary:active {
  transform: translateY(0);
}

/* Sections */
.modern-account-section {
  margin-bottom: 48px;
}

.modern-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin: 0 0 16px 0;
}

/* Info Rows */
.modern-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 24px;
}

.modern-info-row:last-child {
  border-bottom: none;
}

.modern-info-label {
  font-size: 0.9375rem;
  color: #666;
  min-width: 140px;
  flex-shrink: 0;
}

.modern-info-value {
  font-size: 0.9375rem;
  color: #1a1a1a;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

/* Upgrade Section */
.modern-upgrade-section {
  padding: 24px;
  background: #fafafa;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
}

.modern-upgrade-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.modern-upgrade-text {
  margin: 0;
  font-size: 0.9375rem;
  color: #666;
  line-height: 1.5;
  flex: 1;
}

.modern-btn-secondary {
  background: white;
  color: var(--accent);
  border: 1.5px solid #e0e0e0;
  padding: 0 20px;
  height: 44px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.modern-btn-secondary:hover {
  background: #fafafa;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.modern-btn-secondary:active {
  transform: translateY(0);
}

/* Form Sections in Modal */
.modern-form-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #f0f0f0;
}

.modern-form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.modern-form-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin: 0 0 20px 0;
}

/* Modern Checkbox */
.modern-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.modern-checkbox-row input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.modern-checkbox-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  flex: 1;
}

.modern-checkbox-text {
  font-size: 0.9375rem;
  color: #1a1a1a;
  font-weight: 400;
  line-height: 1.5;
}

.modern-checkbox-subtitle {
  font-size: 0.9375rem;
  font-weight: 400;
  color: #1a1a1a;
  line-height: 1.5;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .modern-account-container {
    padding: 32px 20px;
  }
  
  .modern-account-header {
    flex-wrap: wrap;
  }
  
  .modern-btn-primary {
    width: 100%;
    order: 3;
  }
  
  .modern-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .modern-info-label {
    min-width: auto;
  }
  
  .modern-info-value {
    text-align: left;
  }
  
  .modern-upgrade-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .modern-btn-secondary {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .modern-account-container {
    padding: 24px 16px;
  }
  
  .modern-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }
  
  .modern-account-name {
    font-size: 1.25rem;
  }
}

/* ============================================================================
   TERMS OF SERVICE — checkbox + viewer modal
   ============================================================================ */

/* TOS checkbox row inside signup form */
.tos-checkbox-group {
  margin-top: 4px;
  margin-bottom: 16px;
}

.tos-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #555;
  line-height: 1.5;
}

.tos-checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.tos-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tos-link:hover {
  color: var(--accent-hover);
}

/* TOS viewer modal — sits above the signup modal */
.tos-modal-layer {
  z-index: 1100;
}

/* Scrollable content area for the TOS text */
.tos-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px 24px 24px 24px;
  scroll-behavior: smooth;
}

.tos-loading {
  color: #888;
  font-style: italic;
  padding: 24px 0;
  text-align: center;
}

.tos-error {
  color: #dc3545;
  font-size: 0.875rem;
}

/* Rendered markdown content */
.tos-rendered {
  font-size: 0.875rem;
  line-height: 1.7;
  color: #333;
}

.tos-rendered h1,
.tos-rendered h2,
.tos-rendered h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
}

.tos-rendered h1:first-child,
.tos-rendered h2:first-child {
  margin-top: 0;
}

.tos-rendered p {
  margin: 0 0 0.85em 0;
}

.tos-rendered a {
  color: var(--accent);
}

.tos-rendered hr {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 1.25em 0;
}

.tos-rendered blockquote {
  border-left: 3px solid #e0e0e0;
  margin: 0.75em 0;
  padding: 6px 12px;
  color: #666;
  font-style: italic;
}

/* Raw markdown fallback */
.tos-raw {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #444;
}

/* Home + global mobile nav polish */
@media (max-width: 900px) {
  .nav-container {
    height: auto;
    min-height: 64px;
    padding: 10px 14px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .site-wordmark {
    margin-right: auto;
    padding-right: 0.75rem;
    font-size: 1.65rem;
  }

  .nav-menu {
    position: static;
    left: auto;
    transform: none;
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
  }

  .nav-tools-dropdown {
    display: none;
  }

  .nav-tools-mobile {
    display: list-item;
  }

  /* Hide desktop history slider on mobile */
  .inference-slider {
    display: none !important;
  }

  /* Suppress account dropdown on mobile — sheet takes over */
  .nav-account-menu .dropdown-menu {
    display: none !important;
  }

  .nav-account {
    margin-left: 0;
  }

  .nav-account-menu {
    margin-left: 0;
  }

  nav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  .dropdown-menu {
    min-width: 132px;
  }

  .container {
    margin: 18px auto;
    padding: 0 12px;
  }

  .section {
    padding: 22px;
    margin-bottom: 24px;
    border-radius: 12px;
  }

  #hero {
    gap: 1.1rem;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  #hero img {
    max-width: 100%;
    border-radius: 10px;
  }

  .hero-text h2 {
    margin: 0 0 0.9rem;
    font-size: 1.95rem;
    line-height: 1.15;
  }

  .section h2 {
    margin-bottom: 0.9rem;
  }

  .hero-text p {
    font-size: 1rem;
    line-height: 1.7;
    margin: 0;
  }

  .hero-text p + p {
    margin-top: 1rem;
  }
}

@media (max-width: 560px) {
  .site-wordmark {
    font-size: 1.45rem;
  }

  .nav-account .nav-admin-badge {
    padding: 4px 9px;
    font-size: 0.78rem;
  }

  .nav-account-menu a {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  .nav-menu {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }

  #hero {
    grid-template-columns: 1fr;
  }

  .hero-text h2 {
    font-size: 1.75rem;
  }
}

/* ============================================================================
   BENCHMARK PAGE — MOBILE DISABLED
   ============================================================================ */

.benchmark-mobile-unavailable {
  display: none;
  text-align: center;
  padding: 48px 24px;
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .benchmark-mobile-unavailable {
    display: block;
  }

  .benchmark-desktop-content {
    display: none;
  }
}

/* ============================================================================
   MOBILE HISTORY SHEET + RUN CARDS
   ============================================================================ */

/* Floating trigger button — hidden on desktop */
.mobile-history-btn {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 24px;
  padding: 0 28px;
  height: 48px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 900;
  box-shadow: 0 4px 18px rgba(0, 128, 128, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .mobile-history-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .mobile-history-btn.show {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-history-btn:hover {
    background: var(--accent-hover);
    transform: translateX(-50%) translateY(-1px);
  }
}

/* Backdrop */
.mobile-history-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1000;
}

@media (max-width: 900px) {
  .mobile-history-backdrop.open {
    display: block;
  }
}

/* Sheet — off-screen on mobile until .open */
.mobile-history-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 92vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 1001;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@media (max-width: 900px) {
  .mobile-history-sheet {
    display: flex;
  }

  .mobile-history-sheet.open {
    transform: translateY(0);
  }
}

/* Sheet header */
.mobile-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.mobile-history-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #1a1a1a;
}

.mobile-history-close {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.mobile-history-close:hover {
  background: #f5f5f5;
  color: #333;
}

/* Sheet body */
.mobile-history-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.mobile-history-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

/* Empty / error state */
.run-card-empty {
  text-align: center;
  color: #9ca3af;
  padding: 48px 0;
  font-size: 0.95rem;
}

/* Run Card */
.run-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 16px;
  position: relative;
  transition: background 0.12s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.run-card--expandable {
  cursor: pointer;
  padding-right: 38px;
}

.run-card--expandable:active {
  background: #fafafa;
}

.run-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.run-card-model {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1a1a1a;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.run-card-filename {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-card-meta {
  font-size: 0.8125rem;
  color: #9ca3af;
  line-height: 1.4;
}

/* Chevron indicator */
.run-card-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: #d1d5db;
  line-height: 1;
  transition: transform 0.2s ease;
}

.run-card--open .run-card-chevron {
  transform: translateY(-50%) rotate(90deg);
}

/* Expanded content */
.run-card-expanded {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.run-card-duration {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 10px;
}

.run-card-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

/* Mobile pagination */
.mobile-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 4px 0;
  margin-top: 4px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.mobile-pagination button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  height: 40px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 84px;
  transition: background 0.15s ease;
}

.mobile-pagination button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.mobile-pagination button:disabled {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
}

#mobilePageInfo {
  font-size: 0.875rem;
  color: #666;
}

/* ============================================================================
   ACCOUNT PAGE — SIGN OUT ROW (replaces inline styles)
   ============================================================================ */

.sign-out-section {
  border-top: 2px solid #e5e7eb;
  margin-top: 2rem;
}

.sign-out-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  gap: 24px;
}

.sign-out-heading {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
}

.sign-out-desc {
  margin: 0;
  color: #6b7280;
  font-size: 0.95rem;
}

.sign-out-btn {
  background-color: #dc3545;
  color: white;
  border: 1.5px solid #dc3545;
  text-decoration: none;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sign-out-btn:hover {
  background-color: #c82333;
  border-color: #c82333;
  color: white;
  text-decoration: none;
}

@media (max-width: 900px) {
  .modern-account-container {
    padding: 24px 16px 40px 16px;
  }

  .modern-account-header {
    gap: 14px;
    padding-bottom: 24px;
    margin-bottom: 28px;
  }

  .modern-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }

  .modern-account-name {
    font-size: 1.2rem;
  }

  .modern-account-email {
    font-size: 0.875rem;
  }

  .modern-btn-primary {
    height: 48px;
    font-size: 0.9375rem;
    border-radius: 10px;
  }

  .modern-section-title {
    font-size: 0.75rem;
    margin-bottom: 12px;
  }

  .modern-account-section {
    margin-bottom: 32px;
  }

  .modern-info-row {
    padding: 13px 0;
  }

  .modern-info-label {
    font-size: 0.875rem;
    color: #9ca3af;
  }

  .modern-info-value {
    font-size: 0.9375rem;
    font-weight: 500;
  }

  /* Sign Out — stack vertically on mobile */
  .sign-out-row {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 1.25rem 0;
  }

  .sign-out-heading {
    font-size: 1rem;
  }

  .sign-out-desc {
    font-size: 0.875rem;
  }

  .sign-out-btn {
    width: 100%;
    height: 50px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
  }
}

/* ============================================================================
   MOBILE ACCOUNT SHEET
   ============================================================================ */

.mobile-account-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1000;
}

@media (max-width: 900px) {
  .mobile-account-backdrop.open {
    display: block;
  }
}

.mobile-account-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 1001;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: env(safe-area-inset-bottom, 16px);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.12);
}

@media (max-width: 900px) {
  .mobile-account-sheet {
    display: flex;
  }

  .mobile-account-sheet.open {
    transform: translateY(0);
  }
}

.mobile-account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 14px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.mobile-account-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a1a;
}

.mobile-account-close {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.mobile-account-close:hover {
  background: #f5f5f5;
  color: #333;
}

.mobile-account-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

.mobile-account-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.mobile-account-btn--primary {
  background: var(--accent);
  color: #fff;
}

.mobile-account-btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}

.mobile-account-btn--secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid #d1d5db;
}

.mobile-account-btn--secondary:hover {
  background: #f9fafb;
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* Model helper text */
.model-helper-text {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.4;
}

/* Ontology hint */
.ontology-hint {
  font-size: 0.78rem;
  color: #999;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1;
  cursor: help;
  transition: color 0.15s ease;
  user-select: none;
}

.ontology-hint--context {
  display: flex;
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.ontology-hint:hover {
  color: #555;
}

.ontology-info-icon {
  font-size: 0.85rem;
  line-height: 1;
}

/* Ontology modal content */
.upgrade-modal-content.modal-sm {
  max-width: 480px;
}

/* ── Ontology / small modals → bottom sheet on mobile ───────────────────── */
@media (max-width: 768px) {
  .upgrade-modal:has(.modal-sm) {
    align-items: flex-end;
    padding: 0;
  }

  .upgrade-modal-content.modal-sm {
    max-width: 100%;
    width: 100%;
    max-height: 82vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
    animation: sheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Drag-handle pill */
  .upgrade-modal-content.modal-sm::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
  }

  /* Larger close-button tap target */
  .upgrade-modal-content.modal-sm .upgrade-modal-header .close {
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
  }

  /* Slightly larger chips for touch */
  .upgrade-modal-content.modal-sm .ontology-chip,
  .upgrade-modal-content.modal-sm .ontology-tree-chip {
    font-size: 0.82rem;
    padding: 5px 10px;
  }

  /* Larger tap targets on tree rows */
  .upgrade-modal-content.modal-sm .ontology-tree-row {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to   { transform: translateY(0);    opacity: 1;   }
}

.ontology-flat-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ontology-flat-list li {
  font-size: 0.875rem;
  color: #333;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}

.ontology-flat-list li:last-child {
  border-bottom: none;
}

.ontology-group {
  margin-bottom: 20px;
}

.ontology-group:last-child {
  margin-bottom: 0;
}

.ontology-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 0 0 10px 0;
}

.ontology-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ontology-chip {
  font-size: 0.78rem;
  color: #444;
  background: #f4f4f5;
  border-radius: 4px;
  padding: 3px 8px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

/* ── Ontology collapsible tree ──────────────────────────────────────────── */
.ontology-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ontology-tree-node {
  display: flex;
  flex-direction: column;
}

.ontology-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 0;
  border-radius: 7px;
  transition: background 0.12s ease;
  outline: none;
}

.ontology-tree-row--parent {
  cursor: pointer;
}

.ontology-tree-row--parent:hover {
  background: rgba(0, 0, 0, 0.04);
}

.ontology-tree-row--parent:focus-visible {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

/* SVG chevron — rotates smoothly on collapse */
.ontology-tree-chevron {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  stroke: #c0c0c0;
  fill: none;
  stroke-width: 1.8;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
              stroke 0.12s ease;
}

.ontology-tree-row--parent:hover .ontology-tree-chevron {
  stroke: #888;
}

.ontology-tree-row[aria-expanded="false"] .ontology-tree-chevron {
  transform: rotate(-90deg);
}

/* ── Typography hierarchy by depth ────────────────────────────── */
.ontology-tree-label {
  line-height: 1.4;
  font-weight: 400;
  color: #444;
  font-size: 0.875rem;
}

.ontology-tree-row[data-depth="0"] .ontology-tree-label {
  font-size: 0.9375rem;
  font-weight: 650;
  color: #111;
  letter-spacing: -0.01em;
}

.ontology-tree-row[data-depth="1"] .ontology-tree-label {
  font-size: 0.875rem;
  font-weight: 540;
  color: #1f1f1f;
}

.ontology-tree-row[data-depth="2"] .ontology-tree-label {
  font-size: 0.855rem;
  font-weight: 450;
  color: #333;
}

.ontology-tree-row[data-depth="3"] .ontology-tree-label,
.ontology-tree-row[data-depth="4"] .ontology-tree-label {
  font-size: 0.84rem;
  font-weight: 400;
  color: #555;
}

/* ── Leaf chip ──────────────────────────────────────────────────── */
.ontology-tree-chip {
  display: inline-block;
  font-size: 0.775rem;
  font-weight: 400;
  color: #666;
  background: #f1f1f2;
  border-radius: 5px;
  padding: 2px 9px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  transition: background 0.1s ease, color 0.1s ease;
}

.ontology-tree-row:hover .ontology-tree-chip {
  background: #e9e9eb;
  color: #444;
}

/* ── Children container ─────────────────────────────────────────── */
.ontology-tree-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 1px;
}

.ontology-tree-children[hidden] {
  display: none;
}

/* Slightly more vertical breathing room at the top level */
.ontology-tree > .ontology-tree-node {
  margin-bottom: 3px;
}

.ontology-tree > .ontology-tree-node:last-child {
  margin-bottom: 0;
}

/* ── Metadata detected row (read-only, inside file-group) ───── */
.metadata-hint-row {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  margin-top: 4px;
}

.metadata-groupby-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.metadata-groupby-label {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  font-weight: 400;
  cursor: default;
}

.metadata-chips-area {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.metadata-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  background: #e8f4f3;
  border: 1px solid #b2ddd7;
  border-radius: 10px;
  font-size: 0.72rem;
  color: #1a6b64;
  line-height: 18px;
  white-space: nowrap;
  font-family: "SF Mono", "Fira Mono", "Courier New", monospace;
}

.metadata-helper-text {
  font-size: 0.71rem;
  color: #c4c9d4;
  margin: 0;
  line-height: 1.4;
}

/* ============================================================================
   INSIGHTS DRAWER
   ============================================================================ */

.insights-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1100;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.insights-drawer-backdrop.open {
  display: block;
  animation: insightsBackdropIn 0.2s ease;
}
@keyframes insightsBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.insights-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 46%;
  min-width: 380px;
  max-width: 700px;
  background: #ffffff;
  z-index: 1101;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 32px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.insights-drawer.open {
  transform: translateX(0);
}

/* Header */
.insights-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
  gap: 12px;
}
.insights-drawer-title-group h2 {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 3px;
  line-height: 1.3;
}
.insights-drawer-subtitle {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}
.insights-drawer-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px 4px;
  flex-shrink: 0;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.insights-drawer-close:hover {
  color: #374151;
  background: #f3f4f6;
}

/* Body */
.insights-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.insights-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.insights-tab {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  padding: 8px 12px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.insights-tab:hover {
  background: #eef2f7;
  border-color: #cbd5e1;
  color: #334155;
  transform: none;
}

.insights-tab.active {
  background: #e0f2fe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.insight-panel[hidden] {
  display: none !important;
}

.insight-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 56px 20px;
  border: 1px dashed #dbeafe;
  border-radius: 14px;
  background: #f8fbff;
}

.insight-placeholder-icon {
  font-size: 28px;
  color: #93c5fd;
}

.insight-placeholder-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.insight-placeholder-copy {
  margin: 0;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.6;
  color: #6b7280;
}

.transitional-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fbfdff;
  padding: 18px 18px 16px;
}

.transitional-card-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: #0f766e;
  letter-spacing: 0.02em;
}

.transitional-card-summary {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #1f2937;
}

.transitional-top-states {
  margin-top: 16px;
}

.transitional-top-states-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.transitional-top-states-list {
  margin: 0;
  padding-left: 18px;
  color: #374151;
  font-size: 14px;
  line-height: 1.7;
}

.transitional-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.transitional-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  background: #e8edf5;
  color: #1e3a58;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.transitional-action-btn:hover {
  background: #dae3f0;
  border-color: #93aec8;
  color: #1e3a58;
}

.transitional-action-btn--secondary {
  background: #fff;
  color: #374151;
}

.transitional-action-btn--secondary:hover {
  background: #f8fafc;
  color: #111827;
}

/* ── Low-confidence filter control ── */
.lc-filter {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.lc-filter-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}

.lc-filter-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #6b7280;
}

.lc-filter-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Reuse the app's insights-tab pill style */
.lc-cutoff-preset {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lc-cutoff-preset:hover {
  background: #eef2f7;
  border-color: #cbd5e1;
  color: #334155;
}
.lc-cutoff-preset--active {
  background: #e0f2fe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.lc-filter-threshold-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lc-filter-threshold-label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.lc-filter-threshold-input {
  width: 52px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  background: #fff;
  text-align: center;
  -moz-appearance: textfield;
  transition: border-color 0.15s;
}
.lc-filter-threshold-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.25);
}
.lc-filter-threshold-input::-webkit-outer-spin-button,
.lc-filter-threshold-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.lc-filter-threshold-pct {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
}

.lc-filter-result {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  min-height: 20px;
}

.lc-cutoff-slider {
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 3px;
  background: linear-gradient(to right, #1d4ed8 var(--lc-fill, 5%), #e5e7eb var(--lc-fill, 5%));
  outline: none;
  margin: 4px 0 0;
}
.lc-cutoff-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1d4ed8;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(29, 78, 216, 0.3);
  cursor: pointer;
  transition: background 0.12s;
}
.lc-cutoff-slider::-webkit-slider-thumb:hover {
  background: #1e40af;
}
.lc-cutoff-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1d4ed8;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(29, 78, 216, 0.3);
  cursor: pointer;
}
.lc-cutoff-slider::-moz-range-track {
  height: 4px;
  border-radius: 3px;
  background: #e5e7eb;
}

/* ── Loading ── */
.cell_compositon-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 24px 0;
}
.cell_compositon-loading[hidden],
.cell_compositon-empty-state[hidden] {
  display: none;
}
.cell_compositon-loading-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d1d5db;
  animation: cellCompositonPulse 1.2s ease-in-out infinite;
}
.cell_compositon-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.cell_compositon-loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes cellCompositonPulse {
  0%, 80%, 100% { transform: scale(1);   opacity: 0.5; }
  40%           { transform: scale(1.4); opacity: 1;   }
}

/* ── Empty / error state ── */
.cell_compositon-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
}
.cell_compositon-empty-icon {
  font-size: 32px;
  opacity: 0.35;
}
.cell_compositon-empty-msg {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
  max-width: 260px;
  margin: 0;
}

/* ── Controls row ── */
.cell_compositon-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 10px;
}
.cell_compositon-group-by {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.cell_compositon-group-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}
.cell_compositon-group-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.cell_compositon-group-add {
  position: relative;
  flex-shrink: 0;
}
.cell_compositon-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.cell_compositon-group-chip-remove {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.cell_compositon-group-chip-remove:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
  border-radius: 999px;
}
.cell_compositon-group-label {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
}
.cell_compositon-group-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.cell_compositon-group-add-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #6b7280;
  margin-left: 2px;
}
.cell_compositon-group-add-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.cell_compositon-group-add-btn:focus {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
  border-color: transparent;
}
.cell_compositon-group-add-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.cell_compositon-group-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  max-width: 240px;
  padding: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  z-index: 20;
}
.cell_compositon-group-menu[hidden] {
  display: none;
}
.cell_compositon-group-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #1f2937;
  cursor: pointer;
  display: block;
  font-size: 12px;
  padding: 8px 10px;
  text-align: left;
}
.cell_compositon-group-menu-item:hover {
  background: #f8fafc;
}
.cell_compositon-group-menu-item:focus {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
}
.cell_compositon-group-menu-empty {
  color: #9ca3af;
  font-size: 12px;
  padding: 8px 10px;
}

/* No metadata hint */
.cell_compositon-no-meta-hint {
  font-size: 12px;
  color: #9ca3af;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  border-radius: 7px;
  padding: 10px 13px;
  line-height: 1.5;
  margin: 12px 0;
}
.cell_compositon-no-meta-hint code {
  font-family: "SF Mono", "Fira Mono", monospace;
  font-size: 11px;
  background: #e5e7eb;
  padding: 1px 4px;
  border-radius: 3px;
}

/* ── View toggle ── */
.cell_compositon-view-toggle {
  display: flex;
  background: #f3f4f6;
  border-radius: 6px;
  padding: 2px;
  flex-shrink: 0;
}
.cell_compositon-toggle-btn {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.cell_compositon-toggle-btn.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ── Key insights (drivers of variation) ── */
.cell_compositon-insights {
  background: #f8faff;
  border: 1px solid #e0e7ff;
  border-radius: 10px;
  padding: 13px 15px;
  margin: 12px 0;
}
.cell_compositon-insights-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6366f1;
  margin: 0 0 9px;
}
.cell_compositon-drivers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cell_compositon-driver-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
}
.cell_compositon-driver-icon {
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}
.cell_compositon-driver-item--enriched .cell_compositon-driver-icon { color: #4f46e5; }
.cell_compositon-driver-item--stable   .cell_compositon-driver-icon { color: #9ca3af; }
.cell_compositon-driver-item--enriched .cell_compositon-driver-text { color: #1e293b; }
.cell_compositon-driver-item--stable   .cell_compositon-driver-text { color: #6b7280; }
.cell_compositon-driver-accent { color: #4f46e5; font-weight: 500; }

/* ── Chart ── */
.cell_compositon-chart-container {
  position: relative;
  width: 100%;
}
.cell_compositon-chart-note {
  font-size: 11px;
  color: #9ca3af;
  margin: 6px 0 0;
  text-align: right;
}

/* ── Table ── */
.cell_compositon-table-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.cell_compositon-csv-btn {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s;
}
.cell_compositon-csv-btn:hover { background: #f9fafb; }
.cell_compositon-table-container { overflow-x: auto; }
.cell_compositon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.cell_compositon-table th {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}
.cell_compositon-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}
.cell_compositon-table tr:last-child td { border-bottom: none; }

/* ── Cell Compositon pill bar (legend) ── */
.cell_compositon-pill-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 1px;
  margin-top: 2px;
}
.cell_compositon-pill-segment {
  height: 100%;
  border-radius: 2px;
}

/* Button styling for result-link button variant (primary action — muted) */
.result-link--btn,
#inferenceTable .result-link--btn {
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.5;
  background: #e8edf5;
  border-color: #b8c9e0;
  color: #2d4a6e !important;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.result-link--btn:hover,
#inferenceTable .result-link--btn:hover {
  background: #dae3f0;
  border-color: #93aec8;
  color: #1e3a58 !important;
}

/* Mobile */
@media (max-width: 768px) {
  .insights-drawer {
    width: 100%;
    min-width: unset;
    max-width: unset;
  }
}
