/* ==========================================================================
    Global Reset & CSS Variables
    ========================================================================== */
:root {
  --color-brand-dark: #0f172a;
  --color-brand-blue: #0044aa;
  --color-brand-blue-light: #217aff;
  --color-bg-light: #f8fafc;
  --color-border: #e2e8f0;
  --color-text-muted: #8da1be;
  --color-success-bg: #f4f8ff;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: #ffffff;
  color: var(--color-brand-dark);
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Sticky Header & Scroll-Shrink Transition (Flicker-Free)
   ========================================================================== */
/* ==========================================================================
   Sticky Header & Scroll-Shrink Transition (Centered Brand + Right Nav)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); /* logo centred; side columns grow to fit the nav instead of wrapping it */
  align-items: center;
  padding: 1.5rem 1rem 1rem;
  gap: 1rem;
  background-color: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid transparent;
  will-change: padding, background-color, border-color;
  transition: padding 0.2s ease, 
              background-color 0.2s ease, 
              border-color 0.2s ease, 
              box-shadow 0.2s ease;
}

/* Scrolled State */
.site-header.is-scrolled {
  padding: 0.6rem 1rem;
  background-color: #ffffff;
  border-bottom-color: var(--color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Center Column Alignment */
.header-brand-group {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo img,
.brand-logo .logo-img {
  height: clamp(28px, 4vw, 36px);
  width: auto;
  display: block;
  transition: height 0.2s ease;
}

/* Shrink logo when scrolled */
.site-header.is-scrolled .logo-img {
  height: 24px;
}

.by-line {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.15em;
  margin-bottom: 0.15rem;
  text-transform: lowercase;
  white-space: nowrap;
  transition: font-size 0.2s ease, margin-bottom 0.2s ease;
}

.site-header.is-scrolled .by-line {
  font-size: 0.75rem;
  margin-bottom: 0;
}

/* Right Column Alignment */
.header-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.25rem;
  min-width: max-content;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  line-height: 1.25; /* room for descenders (the "g" of catalogue) */
  white-space: nowrap;
  color: var(--color-brand-blue);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.header-nav a:hover {
  text-decoration: none;
  color: var(--color-brand-blue-light);
  background-color: var(--color-success-bg);
}

.header-nav a:focus-visible {
  outline: 2px solid var(--color-brand-blue-light);
  outline-offset: 2px;
}

.header-nav .active {
  background: var(--color-success-bg);
  border-color: var(--color-brand-blue-light);
  color: var(--color-brand-blue-light);
}

/* Between tablet and wide desktop the five items need a little less room */
@media (min-width: 769px) and (max-width: 1100px) {
  .header-nav {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    gap: 0.1rem;
  }

  .header-nav a {
    padding: 0.4rem 0.6rem;
  }
}

.text-blue-light {
  color: var(--color-brand-blue-light);
  font-weight: 600;
}

a {
  color: var(--color-brand-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-brand-blue-light);
  text-decoration: underline;
}

/* ==========================================================================
    Main & Footer Layout
    ========================================================================== */
.site-main {
  display: grid;
  place-items: stretch center;
  padding: 1.5rem 1rem 3rem;
  width: 100%;
  max-width: 80vw;
  margin: 0 auto;
}

/* ==========================================================================
    Footer Layout & Alignment
    ========================================================================== */
.site-footer {
  width: 100%;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background-color: #ffffff;
  color: var(--color-text-muted);
}

.footer-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 1.5rem;
}

/* Desktop: Left (Brand), Middle (Links), Right (Copyright) */
@media (min-width: 1024px) {
  .footer-container {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    text-align: left;
    gap: 2rem;
  }
}

/* Left Group */
.footer-brand-group {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

@media (min-width: 1024px) {
  .footer-brand-group {
    justify-items: start;
  }
}

.footer-brand-link {
  display: inline-block;
  text-decoration: none;
}

.footer-logo {
  height: 24px;
  width: auto;
  display: block;
}

/* Middle Group (Navigation) */
.footer-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--color-brand-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--color-brand-blue-light);
}

.footer-nav .separator {
  color: #cbd5e1;
  font-size: 0.65rem;
}

/* Right Group (Copyright) */
.footer-meta {
  display: grid;
  justify-items: center;
  font-size: 0.8rem;
}

@media (min-width: 1024px) {
  .footer-meta {
    justify-items: end;
  }
}

.copyright {
  font-size: 0.775rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Right group: 1-click initiative badge (image + label, one link) */
.footer-initiative {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-decoration: none;
  text-align: left;
  transition: color 0.2s ease;
}

/* Two lines, as on the other 1-click tools: "Part of the" over a bold "1 click initiative" */
.footer-initiative-text {
  display: grid;
  line-height: 1.35;
}

.footer-initiative strong {
  font-weight: 700;
  color: var(--color-brand-blue);
}

.footer-initiative:hover,
.footer-initiative:hover strong {
  color: var(--color-brand-blue-light);
  text-decoration: none; /* overrides the global a:hover underline */
}

.footer-initiative-logo {
  display: block;
  height: 48px;
  width: auto;
}

/* ==========================================================================
    Vue App Grid & Result Box Layout
    ========================================================================== */
.vue-mount-point {
  width: 100%;
}

#cra-scoping.app-layout {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  #cra-scoping.app-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    align-items: stretch;
  }
}

.scoping-card {
  background-color: #ffffff;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: grid;
  align-content: start;
  gap: 1.25rem;
  width: 100%;
  height: 100%;
}

.loading-card {
  text-align: center;
  color: var(--color-text-muted);
  padding: 3rem 1.5rem;
  font-weight: 500;
}

.input-header-group {
  display: grid;
  gap: 0.35rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-brand-dark);
  letter-spacing: -0.025em;
}

.section-subtitle {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.5;
}

/* Inputs & Buttons */
.search-fieldset {
  border: none;
  display: grid;
  gap: 1rem;
}

.search-input-container {
  display: grid;
  gap: 0.375rem;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-light);
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  color: var(--color-brand-dark);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea.text-input-field {
  min-height: 120px;
  resize: vertical;
}

.text-input-field:focus {
  border-color: var(--color-brand-blue-light);
  box-shadow: 0 0 0 3px rgba(33, 122, 255, 0.15);
}

.button-wrapper {
  display: grid;
  justify-content: end;
}

.btn {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 0.75rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.submit-analyze-btn {
  background-color: var(--color-brand-blue);
  color: #ffffff;
}

.submit-analyze-btn:hover:not(:disabled) {
  background-color: var(--color-brand-blue-light);
}

.submit-analyze-btn:disabled, 
.submit-analyze-btn.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.kbd-shortcut {
  opacity: 0.8;
  font-size: 0.8em;
  margin-left: 0.25rem;
}

/* Sample Pills */
.sample-pills-container {
  display: grid;
  gap: 0.5rem;
}

.sample-pills-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

.sample-label {
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.75rem;
  margin-right: 0.25rem;
}

.sample-pill-btn {
  padding: 0.25rem 0.625rem;
  background-color: var(--color-bg-light);
  color: #475569;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid var(--color-border);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: normal;
  text-align: center;
  flex-shrink: 0;
}

.sample-pill-btn:hover:not(:disabled) {
  background-color: #eef4ff;
  color: var(--color-brand-blue);
  border-color: #c0d8ff;
}

.shuffle-samples-btn {
  background-color: #eff6ff;
  color: var(--color-brand-blue);
  border-color: #bfdbfe;
}

.shuffle-samples-btn:hover:not(:disabled) {
  background-color: #dbeafe;
  border-color: #93c5fd;
}

/* Recent Scopes List */
.recent-scopes-box {
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: 0.5rem;
}

.recent-scopes-stack {
  display: grid;
  gap: 0.375rem;
}

.recent-scope-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  gap: 0.5rem;
}

.recent-scope-standard {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-brand-blue);
  text-align: right;
}

.recent-scope-muted {
  color: var(--color-text-muted);
  font-weight: 500;
  font-family: var(--font-sans);
}

/* Category Badges */
.custom-badge {
  display: inline-grid;
  align-items: center;
  font-weight: 700;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: nowrap;
  text-align: center;
}

.badge-lg { padding: 0.35rem 0.85rem; font-size: 0.75rem; }
.badge-sm { padding: 0.15rem 0.5rem; font-size: 0.675rem; }

.badge-critical { background-color: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-class2 { background-color: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.badge-class1 { background-color: #fef3c7; color: #92400e; border: 1px solid #fde047; }
.badge-out-of-scope { background-color: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.badge-impossible { background-color: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-default { background-color: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

/* Results Section & Placeholder Container */
.results-wrapper {
  display: grid;
  width: 100%;
  height: 100%;
}

.results-placeholder-card {
  background-color: var(--color-bg-light);
  border: 2px dashed #cbd5e1;
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  gap: 0.5rem;
  height: 100%;
  min-height: 100%;
}

.placeholder-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.placeholder-description {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  max-width: 360px;
  line-height: 1.5;
}

.results-banner {
  display: grid;
  gap: 1.25rem;
  align-content: start;
  height: 100%;
}

.result-header-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

@media (min-width: 640px) {
  .result-header-row {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

.result-category-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.evaluated-product-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-brand-dark);
}

.result-badge-holder {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
}

@media (min-width: 640px) {
  .result-badge-holder {
    justify-items: end;
  }
}

.confidence-text {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.confidence-value {
  color: var(--color-brand-dark);
  font-weight: 700;
}

.statutory-match-box {
  background-color: var(--color-bg-light);
  border-radius: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  display: grid;
  gap: 0.75rem;
}

.statutory-details-content {
  display: grid;
  gap: 0.5rem;
}

.statutory-finding-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.statutory-finding-reasoning {
  font-size: 0.825rem;
  color: #475569;
  line-height: 1.6;
}

.statutory-source-footer {
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.725rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.source-tag {
  font-weight: 700;
  color: #475569;
}

/* Routes Section & Conformity Cards */
.routes-section {
  display: grid;
  gap: 0.75rem;
}

.routes-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-brand-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.routes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .routes-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.route-card-primary, 
.route-card-secondary {
  border-radius: 0.75rem;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
  align-content: space-between;
}

.route-card-primary {
  border: 2px solid var(--color-brand-blue);
  background-color: #f4f8ff;
}

.route-card-secondary {
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
}

.route-card-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.route-badge-primary {
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 800;
  background-color: var(--color-brand-blue);
  color: #ffffff;
}

.route-badge-secondary {
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 800;
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid var(--color-border);
}

.route-standard-code {
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--color-brand-blue);
  font-family: var(--font-mono);
  text-align: right;
}

.route-method-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.route-description {
  font-size: 0.775rem;
  color: #334155;
  line-height: 1.5;
}

.route-footer-row {
  padding-top: 0.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  font-size: 0.725rem;
  font-weight: 600;
}

.primary-footer { border-top: 1px solid #c0d8ff; }
.secondary-footer { border-top: 1px solid var(--color-border); }

.status-mandatory { color: #92400e; font-weight: 700; }
.status-optional { color: #047857; font-weight: 700; }
.status-neutral { color: var(--color-brand-dark); font-weight: 700; }

.notified-bodies-banner {
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
}

.notified-bodies-content {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.notified-bodies-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
}

.notified-bodies-link {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-brand-blue);
  text-decoration: none;
}

.notified-bodies-link:hover {
  color: var(--color-brand-blue-light);
  text-decoration: underline;
}

.reassessment-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.confirm-pill-btn {
  background-color: #f4f8ff;
  color: var(--color-brand-blue);
  border-color: #c0d8ff;
}

.disagree-toggle-btn {
  background-color: var(--color-bg-light);
  color: var(--color-brand-dark);
  border-color: #cbd5e1;
}

.confirmed-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-brand-blue);
  background-color: #f4f8ff;
  padding: 0.35rem 0.65rem;
  border-radius: 0.375rem;
  border: 1px solid var(--color-brand-blue);
}

.disagreement-title {
  color: var(--color-brand-blue);
}

.reassessment-form-actions {
  display: grid;
  grid-auto-flow: column;
  justify-content: end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.reassess-cancel-button {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.reassess-cancel-button:hover {
  background-color: #e2e8f0;
}

.error-message-box {
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  background-color: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.spinner-container {
  display: grid;
  place-content: center;
}

.spinner-svg {
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.spinner-path {
  stroke: var(--color-brand-blue);
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* ==========================================================================
   Pricing 
   ========================================================================== */
#pricing .app-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: stretch;
}
@media (min-width: 768px) {
    #pricing .app-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2rem;
    }
}
#pricing .scoping-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
}
#pricing .scoping-card .input-header-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 110px; /* Locks equivalent height for card headers */
}
#pricing .scoping-card .statutory-match-box {
    margin-top: 1rem;
    margin-bottom: 1.5rem; /* Guarantees the pricing boxes start at the exact same vertical grid line */
}
#pricing .scoping-card .legal-list {
    flex-grow: 1; /* Absorbs variable heights so feature lists take up remaining inner space cleanly */
    margin-bottom: 1.5rem;
}
#pricing .scoping-card .button-wrapper {
    margin-top: auto; /* Pins the subscribe buttons perfectly to the bottom of both cards */
}

/* Align sponsorship & support cards on the pricing page (mobile-first) */
#pricing .recent-scopes-box .recent-scope-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-radius: 1rem;
}

#pricing .recent-scopes-box .recent-scope-row .btn {
  justify-self: start;
  white-space: nowrap;
}

@media (min-width: 480px) {
  #pricing .recent-scopes-box .recent-scope-row {
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
  }
  #pricing .recent-scopes-box .recent-scope-row .btn {
    justify-self: end;
  }
}

/* Common Utility Classes replacing inline styles */
.btn-full-width {
  width: 100%;
}

.chat-mode-session {
  font-size: 0.8rem;
  color: #6a737d;
}

.chat-mode-apikey {
  font-size: 0.8rem;
  color: #0044aa;
  font-weight: 600;
}

.icon-key {
  color: #0044aa;
}

.popover-footer-link {
  margin-top: 10px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
}

/* Pricing Grid Asymmetric Setup */
@media (min-width: 640px) {
  .app-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 1.5rem;
  }
}

.price-pro {
  border: 2px solid var(--color-brand-blue);
  background-color: var(--color-success-bg);
}

.pricing-alert, .pricing-signed-in {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #0044aa;
  background: #f0f7ff;
  padding: 0.5rem 1rem;
  border-color: #c8e1ff;
  border-radius: 6px; display: inline-block;
}

.pricing-signed-in {
  margin-top: 1rem;
  margin-bottom: 0;
}

.document-title.price-pro-cost, .document-meta.price-pro-cost {
  color: var(--color-brand-blue);
}

/* Spacer Utility */
.pricing-section-spacer {
  margin-top: 1.5rem;
}

/* ==========================================================================
   Document & Legal Page Styling (Semantic Additions)
   ========================================================================== */
.document-card {
  background-color: #ffffff;
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

@media (min-width: 768px) {
  .document-card {
    padding: 3rem 3.5rem;
  }
}

.document-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  display: grid;
  gap: 0.5rem;
}

.document-title {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--color-brand-dark);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.document-meta {
  font-size: 0.825rem;
  color: #64748b;
  font-family: var(--font-mono);
}

.document-content {
  display: grid;
  gap: 2.25rem;
}

.legal-section {
  display: grid;
  gap: 0.85rem;
}

.legal-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-brand-dark);
  letter-spacing: -0.015em;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #f1f5f9;
}

.legal-section p {
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.65;
}

.legal-list {
  display: grid;
  gap: 0.65rem;
  padding-left: 1.25rem;
}

.legal-list li {
  font-size: 0.875rem;
  color: #334155;
  line-height: 1.6;
}

.legal-list li strong,
.legal-section p strong {
  color: var(--color-brand-dark);
}

.legal-list code,
.legal-section p code {
  font-family: var(--font-mono);
  font-size: 0.825em;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  color: var(--color-brand-blue);
}

/* Callout Box for the Anti-Poisoning Guarantee */
.callout-box {
  background-color: #f8fafc;
  border: 1px solid #c7d2fe;
  border: 3px solid var(--color-brand-blue);
  padding: 1.15rem 1.25rem;
  display: grid;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

.callout-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-brand-blue);
}

.callout-text {
  font-size: 0.85rem;
  color: #1e293b;
  line-height: 1.6;
}

/* ==========================================================================
  External Link Icon Styling
  ========================================================================== */
a.external-link::after {
content: "";
display: inline-block;
width: 1.25em;
height: 1.25em;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230044aa'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14'%3E%3C/path%3E%3C/svg%3E");
background-size: contain;
background-repeat: no-repeat;
margin-left: 0.25rem;
margin-bottom: 0.25rem;
vertical-align: middle;
}

a.external-link:hover::after {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23217aff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14'%3E%3C/path%3E%3C/svg%3E");
}

/* ===
Account portal
=== */

      .portal-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; width: 100%; margin: 0 auto; }
      @media (min-width: 1024px) {
          .portal-layout {
              grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
              align-items: stretch;
          }
      }
      .portal-card { background-color: #ffffff; border-radius: 1rem; padding: 1.25rem 1.5rem; border: 1px solid var(--color-border); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); display: grid; align-content: start; gap: 1.25rem; width: 100%; height: 100%; }
      
      .success-message-box {
          background-color: var(--color-success-bg);
          border: 2px solid var(--color-brand-blue);
          color: var(--color-brand-blue);
          padding: 0.875rem 1rem;
          border-radius: 0.75rem;
          font-size: 0.875rem;
          font-weight: 400;
          line-height: 1.5;
      }

      .success-message-box strong {
          font-weight: 600;
      }

      .alert-key { background: var(--color-success-bg); border: 1px solid var(--color-success-border); padding: 1.25rem; border-radius: 0.75rem; display: grid; gap: 0.5rem; }
      .key-save { margin-top: 1rem; }
      .key-code { font-family: var(--font-mono); font-size: 0.875rem; background: #ffffff; padding: 0.75rem 1rem; border: 1px solid #cbd5e1; border-radius: 0.5rem; display: block; word-break: break-all; color: var(--color-brand-dark); }
      .key-table-wrapper { width: 100%; overflow-x: auto; }
      .key-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.875rem; }
      .key-table th { padding: 0.75rem 1rem; border-bottom: 1px solid var(--color-border); text-align: left; font-weight: 700; color: #475569; background-color: var(--color-bg-light); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
      .key-table td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: middle; color: #334155; }
      
      .badge-active { display: inline-grid; padding: 0.15rem 0.5rem; font-size: 0.675rem; font-weight: 700; border-radius: 9999px; background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; text-transform: uppercase; letter-spacing: 0.025em; }
      .badge-revoked { display: inline-grid; padding: 0.15rem 0.5rem; font-size: 0.675rem; font-weight: 700; border-radius: 9999px; background-color: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; text-transform: uppercase; letter-spacing: 0.025em; }
      
      .btn-sm { display: inline-grid; align-items: center; justify-content: center; padding: 0.4rem 0.8rem; font-size: 0.75rem; font-weight: 700; border-radius: 0.5rem; cursor: pointer; border: none; transition: all 0.2s ease; }
      .btn-primary-action { background-color: var(--color-brand-blue); color: white; }
      .btn-primary-action:hover { background-color: var(--color-brand-blue-light); color: white;}
      .btn-secondary-action { background-color: var(--color-bg-light); color: #334155; border: 1px solid #cbd5e1; }
      .btn-secondary-action:hover { background-color: #e2e8f0; }
      .btn-danger-action { background-color: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
      .btn-danger-action:hover { background-color: #fecaca; }
      
      .portal-form-group { display: grid; gap: 0.375rem; }
      .portal-input-field { width: 100%; padding: 0.75rem 1rem; background-color: var(--color-bg-light); border: 1px solid #cbd5e1; border-radius: 0.75rem; color: var(--color-brand-dark); font-size: 0.875rem; font-weight: 500; font-family: var(--font-sans); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
      .portal-input-field:focus { border-color: var(--color-brand-blue-light); box-shadow: 0 0 0 3px rgba(33, 122, 255, 0.15); }
      
      /* Curl Documentation Box Styles */
      .api-docs-box { background: var(--color-bg-light); border: 1px solid var(--color-border); padding: 1rem; border-radius: 0.75rem; margin-top: 1rem; display: grid; gap: 0.5rem; }
      .api-docs-code { font-family: var(--font-mono); font-size: 0.775rem; background: #0f172a; color: #f8fafc; padding: 0.75rem; border-radius: 0.5rem; overflow-x: auto; white-space: pre-wrap; }

      /* === Login form 
      ===
      */
      .login-form {
        display: grid;
        gap: 1rem;
      }

/* ==========================================================================
   Mobile Navigation & Off-Canvas Drawer (Best-Practice UX)
   ========================================================================== */

/* Hide mobile toggle and drawer on desktop by default */
.mobile-menu-toggle,
.mobile-nav-drawer,
.mobile-nav-backdrop {
  display: none;
}

/* --------------------------------------------------------------------------
   Mobile Media Query (Screens <= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Switch header to fluid flex on mobile to prevent logo squishing */
  .site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
  }

  .site-header.is-scrolled {
    padding: 0.65rem 1.25rem;
  }

  .header-left {
    display: none;
  }

  /* Hide the horizontal desktop nav links */
  .header-nav.desktop-nav {
    display: none;
  }

  /* Hamburger Toggle Button */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--color-brand-dark);
    padding: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .mobile-menu-toggle:hover,
  .mobile-menu-toggle:focus-visible {
    background-color: var(--color-bg-light);
    color: var(--color-brand-blue);
    outline: none;
  }

  /* Dimmed Backdrop */
  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .mobile-nav-backdrop.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Off-Canvas Drawer (Slides in from Right) */
  .mobile-nav-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(82vw, 340px);
    height: 100vh;
    background-color: #ffffff;
    z-index: 999;
    padding: 1.5rem;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.3s ease;
  }

  .mobile-nav-drawer.is-active {
    transform: translateX(0);
    visibility: visible;
  }

  /* Drawer Top Header (Title + Close Button) */
  .mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
  }

  .mobile-drawer-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
  }

  .mobile-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-brand-dark);
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .mobile-nav-close:hover,
  .mobile-nav-close:focus-visible {
    background-color: #fee2e2;
    color: #dc2626;
    outline: none;
  }

  /* Drawer Navigation Links */
  .mobile-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 0;
  }

  .mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-brand-blue);
    text-decoration: none;
    border-radius: 0.75rem;
    text-transform: uppercase;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .mobile-nav-link:hover,
  .mobile-nav-link:focus-visible {
    background-color: var(--color-bg-light);
    color: var(--color-brand-blue-light);
    text-decoration: none;
  }

  .mobile-nav-link.active {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-brand-blue-light);
    color: var(--color-brand-blue-light);
  }

  /* Drawer Footer */
  .mobile-drawer-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
  }
}

/* Prevent document background scroll when mobile menu is active */
body.mobile-menu-open {
  overflow: hidden;
}

/**** CHAT BOT ****
*
*******************/

.chat-container { 
    width: 100%;
    max-width: 88vw; 
    height: 82vh;    
    min-height: 600px;
    margin: 20px auto 30px; 
    display: flex; 
    flex-direction: column; 
    background: #fff; 
    border-radius: 10px; 
    box-shadow: 0 4px 18px rgba(0,0,0,0.06); 
    border: 1px solid #e1e4e8; 
    overflow: visible;
    box-sizing: border-box;
}
.chat-header { 
    padding: 14px 22px; 
    border-bottom: 1px solid #e1e4e8; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: #f8f9fa; 
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    position: relative;
}
.chat-header-left { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.chat-header-actions { display: flex; align-items: center; gap: 10px; position: relative; }

.chat-messages { 
    flex: 1; 
    padding: 24px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
    background: #fafbfc;
    min-height: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.message { 
    max-width: 82%; 
    padding: 16px 20px; 
    border-radius: 8px; 
    line-height: 1.6; 
    font-size: 0.95rem; 
    word-break: break-word; 
}
.message.user { 
    background: #0044aa; 
    color: #fff; 
    align-self: flex-end; 
    border-bottom-right-radius: 2px;
    white-space: pre-wrap;
}
.message.assistant { 
    background: #fff; 
    color: #24292e; 
    align-self: flex-start; 
    border: 1px solid #e1e4e8; 
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    border-bottom-left-radius: 2px;
}

.message.assistant p { margin: 0 0 12px 0; line-height: 1.65; }
.message.assistant p:last-child { margin-bottom: 0; }
.message.assistant h1, 
.message.assistant h2, 
.message.assistant h3, 
.message.assistant h4 { 
    margin: 18px 0 8px 0; 
    color: #0044aa; 
    font-size: 1.05rem;
    font-weight: 700;
    border-bottom: 1px solid #f0f2f5;
    padding-bottom: 4px;
}
.message.assistant h3:first-child, 
.message.assistant h4:first-child { margin-top: 0; }
.message.assistant strong { color: #111827; font-weight: 600; }
.message.assistant ul, 
.message.assistant ol { margin: 8px 0 14px 0; padding-left: 22px; }
.message.assistant li { margin-bottom: 6px; line-height: 1.55; }
.message.assistant code { 
    background: #f1f3f5; 
    color: #0044aa; 
    font-weight: 600;
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 0.88em; 
    font-family: monospace; 
}
.message.assistant pre { 
    background: #f8f9fa; 
    border: 1px solid #e1e4e8; 
    padding: 12px; 
    border-radius: 6px; 
    overflow-x: auto; 
    margin: 12px 0; 
}
.message.assistant blockquote {
    border-left: 4px solid #0044aa;
    background: #f0f7ff;
    padding: 10px 14px;
    margin: 12px 0;
    border-radius: 0 6px 6px 0;
    color: #0044aa;
}

.message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #f0f2f5;
}
.btn-copy-msg {
    background: #fff;
    border: 1px solid #d1d5da;
    color: #586069;
    padding: 3px 9px;
    font-size: 0.74rem;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}
.btn-copy-msg:hover {
    background: #f6f8fa;
    border-color: #0044aa;
    color: #0044aa;
}
.btn-copy-msg.copied {
    background: #e6fffa;
    border-color: #79d5cc;
    color: #047481;
}

.suggestions-wrapper {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed #e1e4e8;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.suggestions-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6a737d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
}
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.btn-suggestion {
    background: #f0f7ff;
    border: 1px solid #c8e1ff;
    color: #0044aa;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    line-height: 1.35;
}
.btn-suggestion:hover {
    background: #0044aa;
    color: #fff;
    border-color: #0044aa;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,68,170,0.15);
}

.message.error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.message.error .error-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.message.error .error-body {
    font-size: 0.9rem;
    color: #742a2a;
    line-height: 1.45;
}

.chat-input-area { 
    padding: 14px 20px; 
    border-top: 1px solid #e1e4e8; 
    display: flex; 
    align-items: flex-end; 
    gap: 12px; 
    background: #fff; 
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}
.chat-input-area textarea { 
    flex: 1; 
    padding: 14px 16px; 
    border: 1px solid #d1d5da; 
    border-radius: 8px; 
    font-size: 1rem; 
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    resize: none;
    min-height: 72px; 
    max-height: 200px; 
    box-sizing: border-box;
    overflow-y: auto;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-input-area textarea:focus { 
    border-color: #0044aa; 
    box-shadow: 0 0 0 3px rgba(0,68,170,0.1); 
}

.chat-input-area button { 
    padding: 0 24px; 
    height: 72px; 
    background: #0044aa; 
    color: #fff; 
    border: none; 
    border-radius: 8px; 
    font-size: 1rem;
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.chat-input-area button:hover { 
    background: #003388; 
    transform: translateY(-1px);
}
.chat-input-area button:disabled { opacity: 0.6; cursor: not-allowed; }

.kbd-enter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    width: 22px;
    height: 22px;
    padding-bottom: 1px;
    line-height: 1;
}

.btn-reset {
    background: transparent;
    border: 1px solid #d1d5da;
    color: #586069;
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.btn-reset:hover { background: #e1e4e8; color: #24292e; }

.user-logged-badge {
    background: var(--color-success-bg);
    color: var(--color-brand-blue);
    border: 1px solid var(--color-border);
    padding: 4px 10px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popover-container { position: relative; display: inline-block; }
.popover-container[hidden] { display: none; } /* signed-in customers never see the API-key control */
.btn-popover-trigger {
    background: #fff;
    border: 1px solid #d1d5da;
    color: #24292e;
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn-popover-trigger:hover { background: #f3f4f6; border-color: #bac0c7; }
.btn-popover-trigger.active { background: #e8f0fe; border-color: #0044aa; color: #0044aa; }

.popover-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 310px;
    max-width: min(310px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid #d1d5da;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 16px;
    z-index: 100;
    box-sizing: border-box;
}
.popover-menu.open { display: block; }
.popover-menu h4 { margin: 0 0 6px 0; font-size: 0.85rem; color: #24292e; display: flex; align-items: center; gap: 6px; }
.popover-menu p { font-size: 0.76rem; color: #6a737d; margin: 0 0 10px 0; line-height: 1.4; }
.popover-menu a { color: #0044aa; text-decoration: underline; }
.popover-menu input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: monospace;
    box-sizing: border-box;
    margin-bottom: 10px;
}
.popover-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn-sm-primary { background: #0044aa; color: #fff; border: none; padding: 5px 12px; border-radius: 4px; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.btn-sm-primary:hover { background: #003388; }
.btn-sm-secondary { background: #f3f4f6; color: #586069; border: 1px solid #d1d5da; padding: 5px 10px; border-radius: 4px; font-size: 0.78rem; cursor: pointer; }
.btn-sm-secondary:hover { background: #e5e7eb; color: #24292e; }

@media (max-width: 768px) {
    .site-main { max-width: 100% !important; padding: 0.75rem !important; }
    .chat-container { max-width: 100%; height: 82dvh; min-height: 480px; margin: 0 auto; border-radius: 8px; }
    .chat-header { padding: 10px 14px; }
    .chat-messages { padding: 16px 12px; gap: 12px; }
    .message { max-width: 90%; padding: 12px 14px; font-size: 0.92rem; }
    .chat-input-area { padding: 10px 12px; gap: 8px; }
    .chat-input-area textarea { font-size: 16px; min-height: 56px; padding: 4px 16px; }
    .chat-input-area button { height: 56px; padding: 0 16px; }
}

.typing-dots { display: inline-flex; align-items: center; gap: 5px; padding: 4px 2px; }
.typing-dots span {
    width: 7px;
    height: 7px;
    background-color: #0044aa;
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Account Portal & Dashboard Component Enhancements
   ========================================================================== */
:root {
  --color-cetome-accent: #0044aa; /* Ensures variable reference consistency */
}

/* Auth / Login Centering Containers */
.auth-card-wrapper {
  max-width: 450px;
  margin: 0 auto;
  width: 100%;
}

.auth-card {
  text-align: center;
}

.auth-header-group {
  display: grid;
  gap: 0.35rem;
  text-align: center;
}

.auth-subtitle {
  margin: 0 auto;
}

.auth-confirm-form {
  margin-top: 1.5rem;
}

.btn-full-width {
  width: 100%;
}

.auth-footer-prompt {
  text-align: center;
  margin-top: 0.25rem;
}

/* Checkbox Alignment */
.portal-checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.portal-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-cetome-accent);
  cursor: pointer;
}

.portal-checkbox-label {
  font-size: 0.825rem;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

/* User Account Profile Summary Header */
.account-profile-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
  gap: 1rem;
}

.account-user-email {
  font-size: 0.875rem;
  color: #475569;
  margin: 0;
}

.account-user-email strong {
  color: var(--color-brand-dark);
}

.account-tier-badge {
  font-size: 0.75rem;
  background: var(--color-bg-light);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-weight: 600;
  color: var(--color-cetome-accent);
}

.account-actions-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Links, buttons and buttons-in-forms in the group share one height, one font and one baseline */
.account-actions-group .inline-form {
  display: flex;
}

.account-actions-group .btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 2.25rem;
  padding-top: 0;
  padding-bottom: 0;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Global Usage Meter Card */
.usage-meter-card {
  margin-top: 1rem;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1rem;
}

.usage-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.usage-meter-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.usage-meter-stat {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-cetome-accent);
}

.usage-progress-track {
  width: 100%;
  background-color: #e2e8f0;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}

.usage-progress-fill {
  height: 100%;
  background-color: var(--color-cetome-accent);
  transition: width 0.3s ease;
}

.usage-progress-fill.is-critical {
  background-color: #ef4444;
}

.usage-meter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #64748b;
}

/* API Key Generation Card & Form */
.key-gen-box {
  display: grid;
  gap: 1rem;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-top: 1rem;
}

.key-gen-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-brand-dark);
  margin: 0;
}

.limit-warning-box {
  font-size: 0.825rem;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  padding: 0.75rem;
  border-radius: 0.5rem;
}

.key-gen-form {
  display: grid;
  gap: 1rem;
}

.key-gen-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.key-gen-actions, .key-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.btn-copy-key {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

/* API Documentation Box Header & Details */
.api-docs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.api-docs-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-brand-dark);
  margin: 0;
}

.api-docs-btn-copy {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
}

.api-docs-instruction {
  font-size: 0.775rem;
  color: #475569;
  margin: 0 0 0.5rem 0;
}

/* Registry Header & Filter Form */
.registry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.key-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
  background: var(--color-bg-light);
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
}

.filter-search-group {
  flex: 1;
  min-width: 180px;
}

.filter-input, .filter-select {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.filter-btn-submit {
  padding: 0.5rem 1rem;
}

.filter-reset-link {
  background: transparent;
  color: var(--color-cetome-accent);
  text-decoration: underline;
  margin-left: 0.25rem;
  font-size: 0.75rem;
}

/* Keys Table Row Data Styling */
.key-empty-cell {
  text-align: center;
  color: var(--color-text-muted);
  padding: 2rem;
}

.key-name {
  color: var(--color-brand-dark);
}

.btn-revoke {
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.revoke-icon {
  font-size: 0.85rem;
}

.key-description {
  font-size: 0.775rem;
  color: var(--color-text-muted);
  display: block;
  margin-top: 0.15rem;
}

.key-masked-display {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--color-cetome-accent);
}

.key-calls-primary {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-brand-dark);
}

.key-calls-total {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}

.key-created-date {
  font-size: 0.825rem;
  color: #64748b;
}

.ask-chatbot {
  margin-left: 0.25rem;
}
/* ==========================================================================
   Contact Form
   ========================================================================== */
.contact-card-wrapper {
  max-width: 920px;
}

.contact-card,
.contact-card .auth-header-group {
  text-align: left;
}

.contact-card .auth-subtitle {
  margin: 0;
}

textarea.portal-input-field {
  min-height: 160px;
  resize: vertical;
  line-height: 1.5;
}

.field-optional {
  font-weight: 400;
  color: var(--color-text-muted);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.field-error {
  font-size: 0.8rem;
  font-weight: 600;
  color: #dc2626;
}

.contact-locked-email {
  font-size: 0.875rem;
  color: #334155;
}

/* Anti-spam check runs silently; this line only appears when it fails */
.contact-verify-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: #dc2626;
}

/* Honeypot: visually removed for people, still present in the DOM for bots */
.hp-field {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Wide screens: labels sit on the left of their field, hints and errors stay under the field */
@media (min-width: 768px) {
  .contact-form .portal-form-group {
    grid-template-columns: 10rem minmax(0, 1fr);
    column-gap: 1.5rem;
    align-items: start;
  }

  .contact-form .portal-form-group > .field-label {
    grid-column: 1;
    padding-top: 0.9rem;
  }

  .contact-form .portal-form-group > :not(.field-label) {
    grid-column: 2;
  }

  .contact-form .contact-locked-email {
    padding-top: 0.8rem;
  }
}

/* ==========================================================================
   Customer products page (account/products.php)
   ========================================================================== */
.products-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
  margin: 0 auto;
}

.products-messages {
  display: grid;
  gap: 0.75rem;
}

.products-page kbd {
  font-family: var(--font-mono);
  font-size: 0.75em;
  padding: 0.1rem 0.35rem;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 0.3rem;
  background-color: var(--color-bg-light);
  color: var(--color-brand-dark);
}

/* KPIs */
.products-stats {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}

@media (min-width: 480px) {
  .products-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.products-stat {
  display: grid;
  gap: 0.125rem;
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
}

.products-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-brand-blue);
}

.products-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.products-quota,
.products-upgrade-note {
  margin: 0;
  font-size: 0.85rem;
  color: #334155;
}

.products-hint,
.products-field-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}

/* Quick add */
.products-add-form {
  display: grid;
  gap: 1rem;
}

.products-textarea {
  min-height: 6rem;
  resize: vertical;
  font-family: var(--font-sans);
}

.products-add-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

/* The button and the Auto-scope toggle share one fixed height, so they line up whatever the font metrics */
.products-add-actions .btn,
.products-add-actions .products-checkbox-label {
  box-sizing: border-box;
  height: 2.75rem;
  padding-top: 0;
  padding-bottom: 0;
}

.products-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #334155;
  cursor: pointer;
}

.products-add-feedback,
.products-batch-status {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-brand-blue);
}

.products-add-feedback.is-error,
.products-batch-status.is-error {
  color: #b91c1c;
}

/* Toolbar, batch */
.products-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.products-toolbar a[aria-disabled="true"],
.products-import-actions a[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* Excel drop zone */
.products-import-form {
  display: grid;
  gap: 0.75rem;
}

.products-dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  border: 2px dashed var(--color-brand-blue-light);
  border-radius: 1rem;
  background-color: var(--color-success-bg);
  color: var(--color-brand-dark);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.products-dropzone:hover,
.products-dropzone:focus-within {
  background-color: #e8f0fe;
  border-color: var(--color-brand-blue);
}

.products-dropzone.is-dragover {
  background-color: #dbe8ff;
  border-color: var(--color-brand-blue);
  border-style: solid;
  transform: scale(1.01);
}

.products-dropzone.is-uploading {
  opacity: 0.7;
  pointer-events: none;
}

.products-dropzone-icon {
  font-size: 2.25rem;
  color: var(--color-brand-blue);
}

.products-dropzone-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-brand-blue);
}

.products-dropzone-hint {
  font-size: 0.78rem;
  color: #64748b;
}

.products-dropzone-file {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-brand-dark);
}

/* The real file input stays focusable for the keyboard but is not drawn */
.products-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.products-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.products-upgrade-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1rem;
  background-color: var(--color-bg-light);
}

.products-upgrade-icon {
  color: var(--color-brand-blue);
  font-size: 1.75rem;
}

.products-upgrade-note a {
  font-weight: 600;
}

.products-import-errors {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.8rem;
  font-weight: 400;
}

/* Allowance notice */
.products-quota-notice {
  display: grid;
  gap: 0.5rem;
}

.products-quota-notice-text {
  margin: 0;
}

.products-quota-options {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.85rem;
}

.products-quota-options a {
  font-weight: 600;
}

/* Filters */
.products-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: end;
}

@media (min-width: 768px) {
  .products-filters { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
  .products-filter-count { grid-column: 1 / -1; }
}

.products-filter {
  display: grid;
  gap: 0.375rem;
}

.products-filter-count {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}

/* Table (desktop) */
.products-table-wrapper {
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
}

.products-table {
  margin-top: 0;
  table-layout: auto;
  min-width: 56rem;
}

.products-table th {
  white-space: nowrap;
}

.products-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.products-cell-ref { white-space: nowrap; width: 1%; }
.products-cell-product { min-width: 14rem; max-width: 22rem; }
.products-cell-scoping { min-width: 11rem; }
.products-cell-standards { min-width: 10rem; max-width: 16rem; }
.products-cell-rationale { min-width: 12rem; max-width: 24rem; }
.products-cell-review { min-width: 14rem; max-width: 22rem; }
.products-cell-actions { width: 1%; }

.products-ident {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.products-ref {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #64748b;
}

.products-description-wrap {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.products-description,
.products-longtext {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #475569;
  white-space: pre-wrap;
}

.products-description.is-collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}

.products-longtext {
  margin-top: 0.5rem;
}

.products-link-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-brand-blue);
  cursor: pointer;
  justify-self: start;
}

.products-link-btn:hover {
  text-decoration: underline;
}

.products-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-brand-blue);
}

.products-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
}

.products-stale {
  font-weight: 600;
  color: #b45309;
}

.products-standards {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #334155;
}

.products-actions,
.products-review-actions,
.products-review-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.products-review-summary {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.products-review-form {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background-color: var(--color-bg-light);
}

.products-review-form .portal-input-field {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.products-review-reason {
  min-height: 4rem;
  resize: vertical;
  font-family: var(--font-sans);
}

.products-table tr.is-scoping {
  opacity: 0.6;
}

.products-table tr.is-new > td {
  animation: products-row-highlight 2.5s ease-out;
}

@keyframes products-row-highlight {
  0% { background-color: #dbe8ff; }
  100% { background-color: transparent; }
}

.badge-unscoped {
  background-color: #f8fafc;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
}

.badge-review-no {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Table on phones and small tablets: every row becomes a card, each cell shows its column label */
@media (max-width: 767px) {
  .products-table-wrapper {
    border: none;
    overflow-x: visible;
  }

  .products-table {
    min-width: 0;
  }

  .products-table thead {
    display: none;
  }

  .products-table,
  .products-table tbody,
  .products-table tr,
  .products-table td {
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .products-table tr {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    background-color: #ffffff;
  }

  .products-table td {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-bg-light);
  }

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

  .products-table td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding-top: 0.15rem;
  }

  .products-table td.key-empty-cell {
    display: block;
  }

  .products-table td.key-empty-cell::before {
    content: none;
  }

  .products-cell-actions .products-actions {
    grid-column: 2;
  }
}

/* Buttons that mix text and counters must stay on one line */
.products-toolbar .btn-sm,
.products-bulk-actions .btn-sm,
.products-import-actions .btn-sm {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* Manufacturers panel */
.products-manufacturers {
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.6rem 0.9rem;
  background-color: #ffffff;
}

.products-manufacturers summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.products-manufacturer-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0;
  padding: 0;
}

.products-manufacturer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  background-color: var(--color-bg-light);
  font-size: 0.78rem;
}

.products-manufacturer-name {
  font-weight: 600;
  color: var(--color-brand-dark);
}

.products-manufacturer-count {
  color: #64748b;
}

.products-manufacturer {
  font-weight: 600;
  color: var(--color-brand-blue);
}

/* Selection column and bulk bar */
.products-cell-select {
  width: 1%;
  white-space: nowrap;
}

.products-table tr.is-selected > td {
  background-color: #f4f8ff;
}

.products-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.75rem;
  background-color: #eff6ff;
}

.products-bulk-count {
  font-size: 0.85rem;
  color: var(--color-brand-dark);
}

.products-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Inline tools under a description, and the inline edit form */
.products-inline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.products-edit-form {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background-color: var(--color-bg-light);
}

.products-edit-form .portal-input-field {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

@media (max-width: 767px) {
  .products-table td.products-cell-select {
    grid-template-columns: 6.5rem minmax(0, 1fr);
  }

  .products-bulk-bar {
    justify-content: flex-start;
  }
}

/* Compact one-line filter bar */
.products-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background-color: var(--color-bg-light);
}

@media (min-width: 768px) {
  .products-filters {
    grid-template-columns: none;
    flex-wrap: nowrap;
  }
}

.products-filters .products-filter-input {
  width: auto;
  flex: 0 1 auto;
  min-width: 0;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 0.5rem;
  background-color: #ffffff;
}

.products-filters .products-filter-search {
  flex: 1 1 14rem;
}

.products-filters select.products-filter-input {
  padding-right: 1.75rem;
}

.products-filter-count {
  margin-left: auto;
  white-space: nowrap;
  font-size: 0.78rem;
  color: #64748b;
}

/* Sortable headers */
.products-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 700;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.products-sort::after {
  content: "\2195";
  font-size: 0.7rem;
  opacity: 0.35;
}

.products-sort:hover {
  color: var(--color-brand-blue);
}

.products-sort.is-sorted-asc,
.products-sort.is-sorted-desc {
  color: var(--color-brand-blue);
}

.products-sort.is-sorted-asc::after {
  content: "\25B2";
  opacity: 1;
}

.products-sort.is-sorted-desc::after {
  content: "\25BC";
  opacity: 1;
}

/* Manufacturer column and chips */
.products-cell-manufacturer {
  min-width: 8rem;
  max-width: 12rem;
}

.products-manufacturer-chip .products-link-btn {
  font-size: 0.72rem;
}

.products-link-danger {
  color: #b91c1c;
}

/* Native controls in the brand colour */
.products-page input[type="checkbox"],
.products-page input[type="search"],
.products-page select {
  accent-color: var(--color-brand-blue);
}

.products-page .portal-checkbox {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.products-checkbox-label {
  /* Same radius and text size as the "+ Add product" button next to it; the height is fixed above */
  padding: 0 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  background-color: var(--color-bg-light);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-brand-dark);
  user-select: none;
}

.products-checkbox-label:has(input:checked) {
  border-color: var(--color-brand-blue-light);
  background-color: #e8f0fe;
  color: var(--color-brand-blue);
}


.products-checkbox-label:hover {
  background-color: #e8f0fe;
  border-color: var(--color-brand-blue-light);
}

/* Actions stay compact and on one line each */
.products-cell-actions .products-actions {
  flex-direction: column;
  align-items: stretch;
}

.products-cell-actions .btn-sm {
  display: inline-flex;
  justify-content: center;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .products-cell-actions .products-actions {
    flex-direction: row;
  }

  .products-filters {
    padding: 0.5rem;
  }

  .products-filters .products-filter-input {
    flex: 1 1 100%;
  }

  .products-filter-count {
    margin-left: 0;
  }
}

/* Breakdown panels on the right card (CRA classes, harmonised standards) */
.products-breakdown {
  display: grid;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background-color: #ffffff;
}

.products-breakdown-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
}

.products-breakdown-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.products-breakdown-hint {
  font-size: 0.72rem;
  color: #64748b;
}

.products-breakdown-bar {
  display: flex;
  height: 0.75rem;
  overflow: hidden;
  border-radius: 9999px;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
}

.products-bar-segment {
  display: block;
  height: 100%;
  min-width: 2px;
  transition: width 0.3s ease;
}

.products-bar-segment.is-out-of-scope { background-color: #cbd5e1; }
.products-bar-segment.is-default { background-color: var(--color-brand-blue-light); }
.products-bar-segment.is-class1 { background-color: #fde047; }
.products-bar-segment.is-class2 { background-color: #fdba74; }
.products-bar-segment.is-critical { background-color: #f87171; }
.products-bar-segment.is-impossible { background-color: #e5e7eb; }
.products-bar-segment.is-unscoped {
  background-color: #f8fafc;
  background-image: repeating-linear-gradient(45deg, #e2e8f0 0 4px, transparent 4px 8px);
}

.products-breakdown-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.products-breakdown-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.4rem 0.25rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  background-color: var(--color-bg-light);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.products-breakdown-chip:hover {
  border-color: var(--color-brand-blue-light);
  background-color: #e8f0fe;
}

.products-breakdown-chip.is-active {
  border-color: var(--color-brand-blue);
  background-color: #e8f0fe;
}

.products-breakdown-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.products-breakdown-percent {
  font-size: 0.72rem;
  color: #64748b;
}

.products-standards-top {
  list-style: none;
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  counter-reset: standards;
}

.products-standard-item {
  display: grid;
  gap: 0.3rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  background-color: var(--color-bg-light);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.products-standard-item:hover {
  border-color: var(--color-brand-blue-light);
  background-color: #e8f0fe;
}

.products-standard-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.products-standard-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-brand-blue);
}

.products-standard-name::before {
  counter-increment: standards;
  content: counter(standards) ". ";
  font-family: var(--font-sans);
  color: #64748b;
}

.products-standard-count {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
}

.products-standard-track {
  display: block;
  height: 0.35rem;
  border-radius: 9999px;
  background-color: #e2e8f0;
  overflow: hidden;
}

.products-standard-fill {
  display: block;
  height: 100%;
  border-radius: 9999px;
  background-color: var(--color-brand-blue);
  transition: width 0.3s ease;
}

/* Manufacturer picker: dropdown first, text field only for a new name */
.products-manufacturer-picker {
  display: grid;
  gap: 0.4rem;
}

.products-manufacturer-picker .js-manufacturer-new {
  border-color: var(--color-brand-blue-light);
  background-color: #ffffff;
}

/* Anything marked hidden stays hidden, whatever display the component rule sets (forms, bars, panels) */
.products-page [hidden] {
  display: none !important;
}

/* Fact list inside "Show details" */
.products-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
}

.products-facts dt {
  font-weight: 600;
  color: #64748b;
}

.products-facts dd {
  margin: 0;
  color: #334155;
}

/* Home page result card: "Save to my product catalogue" */
.catalogue-save-row {
  display: grid;
  gap: 0.4rem;
  justify-items: end;
  margin-top: 0.75rem;
}

.catalogue-save-btn {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.catalogue-save-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.catalogue-save-note,
.catalogue-save-hint {
  margin: 0;
  font-size: 0.8rem;
  text-align: right;
  color: #475569;
}

.catalogue-save-note {
  font-weight: 600;
  color: var(--color-brand-blue);
}

.catalogue-save-note.is-error {
  color: #b91c1c;
}

.catalogue-save-note a {
  font-weight: 700;
  text-decoration: underline;
}

/* Plan banner (guest catalogue / capped plan) and limit counters */
.products-plan-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #c0d8ff;
  border-radius: 0.75rem;
  background-color: #f4f8ff;
  color: var(--color-brand-dark);
  font-size: 0.85rem;
}

.products-plan-banner-guest {
  border-style: dashed;
}

.products-plan-banner-icon {
  color: var(--color-brand-blue);
  font-size: 1.6rem;
}

.products-plan-banner-text {
  flex: 1 1 20rem;
  line-height: 1.5;
}

.products-plan-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.products-limits {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background-color: var(--color-bg-light);
  font-size: 0.8rem;
}

.products-limit {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
}

.products-limit-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
  color: #64748b;
}

.products-limit-value {
  color: var(--color-brand-dark);
}

.products-limit-value strong {
  color: var(--color-brand-blue);
  font-size: 1rem;
}

.products-limit-link {
  margin-left: auto;
  font-weight: 700;
}

.products-message-link {
  font-weight: 700;
  text-decoration: underline;
}

.catalogue-save-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: baseline;
}

.catalogue-save-link-primary {
  padding: 0.2rem 0.6rem;
  border-radius: 0.375rem;
  background-color: var(--color-brand-blue);
  color: #ffffff;
  text-decoration: none;
}

.catalogue-save-link-primary:hover {
  background-color: var(--color-brand-blue-light);
  color: #ffffff;
}

/* Origin tag under the product ID (web / API / Excel) */
.products-source {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: #64748b;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  cursor: help;
}

.products-source.is-api {
  color: var(--color-brand-blue);
  border-color: #c0d8ff;
  background-color: #f4f8ff;
}

.products-source.is-import {
  color: #166534;
  border-color: #86efac;
  background-color: #dcfce7;
}

.products-cell-ref {
  display: table-cell;
}

.products-cell-ref .products-ref {
  display: inline-block;
}

@media (max-width: 767px) {
  .products-table td.products-cell-ref {
    display: grid;
  }
}

/* Horizontal scroll affordance for the catalogue table */
.products-scroll-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-brand-blue);
}

.products-scroll-hint-icon {
  font-size: 1.1rem;
}

.products-table-wrapper {
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--color-brand-blue-light) var(--color-bg-light);
  scroll-behavior: smooth;
}

.products-table-wrapper::-webkit-scrollbar {
  height: 10px;
}

.products-table-wrapper::-webkit-scrollbar-track {
  background: var(--color-bg-light);
  border-radius: 9999px;
}

.products-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--color-brand-blue-light);
  border-radius: 9999px;
  border: 2px solid var(--color-bg-light);
}

.products-table-wrapper:focus-visible {
  outline: 2px solid var(--color-brand-blue-light);
  outline-offset: 2px;
}

/* Edge fades: shown on the side that still has hidden columns */
.products-table-wrapper.is-scrollable {
  background-image:
    linear-gradient(to right, #ffffff 30%, rgba(255, 255, 255, 0)),
    linear-gradient(to left, #ffffff 30%, rgba(255, 255, 255, 0)),
    linear-gradient(to right, rgba(15, 23, 42, 0.14), rgba(15, 23, 42, 0)),
    linear-gradient(to left, rgba(15, 23, 42, 0.14), rgba(15, 23, 42, 0));
  background-position: left center, right center, left center, right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 16px 100%, 16px 100%;
  background-attachment: local, local, scroll, scroll;
}

.products-table-wrapper.is-scrollable.is-at-start {
  background-size: 40px 100%, 40px 100%, 0 100%, 16px 100%;
}

.products-table-wrapper.is-scrollable.is-at-end {
  background-size: 40px 100%, 40px 100%, 16px 100%, 0 100%;
}

.products-table-wrapper.is-scrollable.is-at-start.is-at-end {
  background-image: none;
}

.products-table-wrapper.is-scrollable .products-table td {
  background-color: transparent; /* the header row keeps its grey band */
}

@media (max-width: 767px) {
  .products-scroll-hint {
    display: none;
  }
}

/* Account entry in the header: "Sign in", or a "My account" dropdown (e-mail, account, catalogue, sign out) */
.header-account {
  position: relative;
}

.header-account-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  background: none;
  font: inherit;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--color-brand-blue);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.header-account-toggle:hover,
.header-account-toggle[aria-expanded="true"] {
  color: var(--color-brand-blue-light);
  background-color: var(--color-success-bg);
}

.header-account-toggle.active {
  background: var(--color-success-bg);
  border-color: var(--color-brand-blue-light);
  color: var(--color-brand-blue-light);
}

.header-account-toggle:focus-visible {
  outline: 2px solid var(--color-brand-blue-light);
  outline-offset: 2px;
}

/* Small chevron drawn with borders (no icon font) */
.header-account-caret {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.2rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease, margin-top 0.15s ease;
}

.header-account-toggle[aria-expanded="true"] .header-account-caret {
  margin-top: 0.2rem;
  transform: rotate(-135deg);
}

.header-account-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 120;
  min-width: 16rem;
  padding: 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background-color: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 0.85rem;
}

.header-account-email {
  margin: 0 0 0.3rem;
  padding: 0.5rem 0.75rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  overflow-wrap: anywhere;
}

.header-account-email strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.header-account-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--color-brand-dark);
  text-decoration: none;
  cursor: pointer;
}

.header-account-item:hover,
.header-account-item:focus-visible {
  background-color: var(--color-success-bg);
  color: var(--color-brand-blue);
  text-decoration: none;
  outline: none;
}

.header-account-signout {
  margin: 0.3rem 0 0;
  padding-top: 0.3rem;
  border-top: 1px solid var(--color-border);
}

.header-account-item-signout {
  color: #b91c1c;
}

.header-account-item-signout:hover,
.header-account-item-signout:focus-visible {
  background-color: #fef2f2;
  color: #991b1b;
}

.mobile-nav-account {
  overflow-wrap: anywhere;
}

/* Field list under the cURL example on the account page */
.api-docs-fields {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.api-docs-fields code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-brand-blue);
}

.products-scoped-at {
  display: block;
}

/* "Add manufacturer" form inside the Manufacturers panel */
.products-manufacturer-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.2rem 0 0.6rem;
}

.products-manufacturer-add .portal-input-field {
  flex: 1 1 12rem;
  width: auto;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 0.5rem;
}

.products-manufacturer-add .btn-sm {
  white-space: nowrap;
}

.products-breakdown-hint .products-link-btn {
  margin-left: 0.4rem;
  font-size: 0.72rem;
}

/* ==========================================================================
   Home page: one call to action under each column (scoping | results)
   ========================================================================== */
.next-step-card {
  display: grid;
  grid-template-rows: 1fr auto; /* text stretches so both buttons align across the two columns */
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  /* Same pair as the pricing page: a plain card on the left, the highlighted one on the right */
  border: 1px solid var(--color-border);
  background-color: #ffffff;
}

/* Right-hand card: the paid service, highlighted like the Pro plan (.price-pro) */
.next-step-under-results {
  border: 2px solid var(--color-brand-blue);
  background-color: var(--color-success-bg);
}

.next-step-text {
  display: grid;
  gap: 0.3rem;
  align-content: start;
}

.next-step-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-brand-blue);
}

.next-step-description {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #475569;
}

.next-step-btn {
  justify-self: stretch;
  padding: 0.7rem 1.25rem;
  font-size: 0.8rem;
  text-align: center;
  text-decoration: none;
}

/* These buttons are links, so the global a:hover colour would otherwise win and make the
   filled button unreadable (light blue text on a light blue fill). */
.next-step-btn.submit-analyze-btn,
.next-step-btn.submit-analyze-btn:hover {
  color: #ffffff;
  text-decoration: none;
}

.next-step-btn-secondary,
.next-step-btn-secondary:hover {
  color: var(--color-brand-blue);
  text-decoration: none;
}

.next-step-btn-secondary {
  background-color: #ffffff;
  border: 1px solid var(--color-brand-blue-light);
}

.next-step-btn-secondary:hover {
  background-color: var(--color-success-bg);
  border-color: var(--color-brand-blue);
}

.next-step-btn-secondary {
  background-color: #ffffff;
  border: 1px solid var(--color-brand-blue-light);
}

.next-step-btn-secondary:hover {
  background-color: var(--color-success-bg);
  border-color: var(--color-brand-blue);
}
