.btn-accent {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    min-height: 40px;
    padding: 0.55rem 0.95rem;
    font-size: 0.88rem;
}

.btn-icon {
    width: 46px;
    min-width: 46px;
    padding: 0;
}

.search-bar {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(200px, 0.8fr) auto;
    gap: 0.9rem;
    padding: 1rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(219, 228, 240, 0.86);
    box-shadow: var(--shadow-sm);
}

.search-bar__field {
    display: grid;
    gap: 0.4rem;
    position: relative;
}

.search-bar__label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.search-bar__field--primary {
    min-width: 0;
}

.search-bar__input-shell {
    position: relative;
}

.search-bar .input {
    min-height: 54px;
    border: 0;
    background: transparent;
    padding: 0.15rem 0;
    box-shadow: none;
}

.search-bar__input {
    padding-right: 4.5rem !important;
}

.search-bar .input:focus {
    box-shadow: none;
}

.search-bar__clear {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--color-primary);
    font-weight: 700;
    cursor: pointer;
}

.search-bar__assistive {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-bar__loading {
    color: var(--color-primary);
}

.search-bar__examples {
    color: var(--color-muted);
}

.search-bar__panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.45rem);
    display: grid;
    gap: 0.75rem;
    z-index: 30;
}

.search-bar__recent,
.search-bar__suggestions {
    padding: 0.8rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(219, 228, 240, 0.96);
    box-shadow: var(--shadow-md);
}

.search-bar__recent-title,
.search-bar__suggestion-group-title {
    margin-bottom: 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.search-bar__recent-list,
.search-bar__suggestion-group {
    display: grid;
    gap: 0.35rem;
}

.search-bar__recent-chip {
    display: inline-flex;
    width: fit-content;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-soft);
    color: var(--color-heading);
    font-weight: 700;
    cursor: pointer;
}

.search-bar__suggestion {
    display: grid;
    gap: 0.2rem;
    padding: 0.7rem 0.8rem;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    width: 100%;
}

.search-bar__suggestion:hover,
.search-bar__suggestion.is-active {
    background: color-mix(in srgb, var(--color-primary-soft) 55%, white);
}

.search-bar__suggestion-title {
    color: var(--color-heading);
    font-weight: 800;
}

.search-bar__suggestion-meta {
    color: var(--color-muted);
    font-size: 0.84rem;
}

.search-bar__suggestion mark {
    padding: 0;
    background: color-mix(in srgb, var(--color-accent) 24%, white);
    color: inherit;
}

.search-bar__actions {
    display: flex;
    align-items: center;
}

.search-results-shell {
    position: relative;
}

.search-results-shell.is-loading,
.is-loading > .search-results-shell {
    opacity: 0.72;
    transition: opacity 0.2s ease;
}

.product-card,
.supplier-card {
    height: 100%;
}

.product-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Chemical / IUPAC long product name handling ──────────────────────────────
   Cards clamp to 3 lines max. The full name is always in the title attribute
   and visible via tooltip. Clicking the clamped name expands it in place.
   The product detail page (h1.product-name--full) always shows unclamped.
──────────────────────────────────────────────────────────────────────────── */

.card-title,
.product-name {
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

/* Clamped mode: used on product cards */
.product-name--clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: max-height 0.25s ease;
}

.product-name--clamped.is-expanded {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}

/* Subtle gradient fade at the bottom of clamped names */
.product-name--clamped:not(.is-expanded)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.6em;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.96));
    pointer-events: none;
}

/* The small 'expand' affordance shown below a clamped name */
.product-name-expand {
    display: none;
    margin-top: 0.25rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-primary);
    cursor: pointer;
    letter-spacing: 0.04em;
    user-select: none;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
}

/* Only show the expand toggle when the name is actually clamped (JS adds .has-overflow) */
.product-name--clamped.has-overflow ~ .product-name-expand {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.product-name--clamped.is-expanded ~ .product-name-expand {
    display: inline-flex;
}

/* Full-name mode: used on product detail page, search result page */
.product-name--full {
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    /* No clamping — always show completely */
}

/* Mono treatment for very long IUPAC strings (optional class .product-name--iupac) */
.product-name--iupac {
    font-family: var(--font-mono);
    font-size: 0.94em;
    letter-spacing: -0.01em;
}

.product-card__header,
.supplier-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}

.product-card__meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.product-card__meta {
    padding: 0.8rem 0.9rem;
    border-radius: 18px;
    background: var(--color-surface-soft);
    border: 1px solid color-mix(in srgb, var(--color-border) 88%, white);
}

.product-card__meta strong,
.supplier-card__metric strong {
    display: block;
    margin-bottom: 0.22rem;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.product-card__meta span {
    color: var(--color-heading);
    font-size: 0.95rem;
    font-weight: 700;
}

.supplier-card__metric span {
    color: var(--color-heading);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: break-word;
}

.product-card__footer,
.supplier-card__footer {
    margin-top: auto;
    display: grid;
    gap: 0.85rem;
}

.product-card__supplier-line,
.supplier-card__location {
    color: var(--color-muted);
    font-size: 0.92rem;
}

.supplier-card__metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.supplier-card__metric {
    padding: 0.8rem 0.9rem;
    border-radius: 18px;
    background: var(--color-surface-soft);
    border: 1px solid color-mix(in srgb, var(--color-border) 88%, white);
}

.form-group {
    display: grid;
    gap: 0.45rem;
}

.input-field,
.select-field,
.textarea-field {
    width: 100%;
    min-height: 50px;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

.input-field:focus,
.select-field:focus,
.textarea-field:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--color-primary) 40%, white);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 14%, white);
}

.input-icon {
    padding-left: 2.6rem;
}

.form-error {
    color: var(--color-danger);
    font-size: 0.84rem;
}

.form-success {
    color: var(--color-success);
    font-size: 0.84rem;
}

.badge-admin {
    background: color-mix(in srgb, #7c3aed 16%, white);
    color: #7c3aed;
}

.badge-buyer {
    background: color-mix(in srgb, #2563eb 16%, white);
    color: #2563eb;
}

.badge-supplier {
    background: color-mix(in srgb, #0f766e 16%, white);
    color: #0f766e;
}

.badge-verified::before {
    content: "\2713";
    margin-right: 0.35rem;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.feature-points {
    display: grid;
    gap: 0.45rem;
    padding-left: 1rem;
    color: var(--color-muted);
}

.feature-points li {
    line-height: 1.55;
}

.stats-link-card {
    color: inherit;
    display: block;
}

.table-stack {
    display: grid;
    gap: 0.7rem;
}

.progress-meter {
    width: min(100%, 280px);
    height: 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-border) 78%, white);
    overflow: hidden;
    appearance: none;
    border: 0;
}

.progress-meter::-webkit-progress-bar {
    background: color-mix(in srgb, var(--color-border) 78%, white);
    border-radius: 999px;
}

.progress-meter::-webkit-progress-value {
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
}

.progress-meter::-moz-progress-bar {
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
}

.inline-response-panel {
    display: none;
}

.inline-response-panel.is-open {
    display: grid;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.98);
    z-index: 1;
}

.data-table tbody tr:hover {
    background: color-mix(in srgb, var(--color-primary-soft) 35%, white);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
    z-index: 80;
}

.modal-overlay.is-open {
    display: grid;
}

.modal-box {
    width: min(100%, 680px);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
}

.modal-card {
    width: min(100%, 640px);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    padding: 1.25rem;
    border: 1px solid var(--color-border);
}

.modal-card--compact {
    width: min(100%, 520px);
}

.modal-close {
    margin-left: auto;
    border: 0;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text);
}

.modal-header,
.modal-body,
.modal-footer {
    padding: 1.25rem;
}

.modal-header,
.modal-footer {
    border-bottom: 1px solid var(--color-border);
}

.modal-footer {
    border-top: 1px solid var(--color-border);
    border-bottom: 0;
}

.filter-panel {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}

.onboarding-shell {
    align-items: start;
}

.onboarding-steps {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}

.card-warning {
    border-color: color-mix(in srgb, var(--color-warning, #f59e0b) 45%, var(--color-border));
    background: linear-gradient(180deg, #fffef8, #ffffff);
}

.dashboard-card,
.stats-card {
    position: relative;
    overflow: hidden;
}

.dashboard-card::after,
.stats-card::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: rgba(52, 87, 245, 0.08);
}

.empty-state .btn {
    width: auto;
}

.privacy-gate {
    display: grid;
    gap: 0.9rem;
    padding: 1rem;
    border: 1px dashed color-mix(in srgb, var(--color-primary) 26%, white);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), var(--color-primary-soft));
}

.privacy-gate-compact {
    padding: 0.9rem;
}

.privacy-gate-preview {
    display: grid;
    gap: 0.45rem;
}

.privacy-gate-line {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    padding: 0.2rem 0;
    color: rgba(15, 23, 42, 0.75);
    filter: blur(6px);
    user-select: none;
    pointer-events: none;
}

@media (max-width: 1024px) {
    .search-bar {
        grid-template-columns: 1fr;
    }

    .product-card__meta-grid,
    .supplier-card__metrics {
        grid-template-columns: 1fr;
    }

    .filter-panel {
        position: static;
    }

    .search-bar__panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .table-wrap {
        border: 0;
        box-shadow: none;
        background: transparent;
        overflow: visible;
    }

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table tr,
    .data-table th,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: grid;
        gap: 1rem;
    }

    .data-table tbody tr {
        border-radius: var(--radius-lg);
        border: 1px solid var(--color-border);
        background: var(--color-surface);
        box-shadow: var(--shadow-sm);
        padding: 1rem;
    }

    .data-table tbody td {
        border: 0;
        padding: 0.6rem 0;
    }

    .data-table tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.3rem;
        font-size: 0.75rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--color-muted);
    }
}

.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted, var(--color-muted));
    cursor: help;
    position: relative;
    vertical-align: middle;
    transition: color 0.2s ease, background 0.2s ease;
}

.help-tip:hover,
.help-tip:focus-visible {
    color: var(--brand-primary, var(--color-primary));
    background: var(--brand-light, rgba(52, 87, 245, 0.08));
    outline: none;
}

.help-tip--warning {
    color: var(--warning, #c2410c);
}

.help-tip--warning:hover,
.help-tip--warning:focus-visible {
    background: #fff8e7;
}

.help-tip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 280px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--text-heading, #0f172a);
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 9999;
}

.help-tip::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 3px);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-heading, #0f172a);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 9999;
}

.help-tip[data-position="bottom"]::after {
    top: calc(100% + 8px);
    bottom: auto;
}

.help-tip[data-position="bottom"]::before {
    top: calc(100% + 3px);
    bottom: auto;
    border-top-color: transparent;
    border-bottom-color: var(--text-heading, #0f172a);
}

.help-tip[data-position="left"]::after {
    right: calc(100% + 8px);
    left: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

.help-tip[data-position="right"]::after {
    left: calc(100% + 8px);
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

.help-tip[data-position="left"]::before,
.help-tip[data-position="right"]::before {
    top: 50%;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
    border-top-color: transparent;
}

.help-tip[data-position="left"]::before {
    right: calc(100% + 3px);
    border-left-color: var(--text-heading, #0f172a);
}

.help-tip[data-position="right"]::before {
    left: calc(100% + 3px);
    border-right-color: var(--text-heading, #0f172a);
}

.help-tip:hover::after,
.help-tip:hover::before,
.help-tip:focus-visible::after,
.help-tip:focus-visible::before {
    opacity: 1;
}

.sidebar-toggle {
    display: none;
    width: 42px;
    height: 42px;
    margin-bottom: 10px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #fff;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-direction: column;
}

.sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--color-heading);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 999;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.admin-fab-container {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 500;
}

.admin-fab-main {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(27, 58, 107, 0.4);
}

.admin-fab-menu {
    display: none;
    position: absolute;
    right: 0;
    bottom: 60px;
    min-width: 220px;
    padding: 8px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.admin-fab-container.open .admin-fab-menu {
    display: block;
}

.fab-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--color-body);
    text-decoration: none;
}

.fab-item:hover {
    background: rgba(52, 87, 245, 0.08);
    color: var(--color-primary);
}

.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.tour-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.tour-card {
    position: relative;
    max-width: 420px;
    margin: 10vh auto 0;
    padding: 24px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
}

.tour-nav {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    align-items: center;
}

.tour-highlight {
    outline: 3px solid var(--color-primary);
    outline-offset: 4px;
    border-radius: 8px;
}
.site-announcement {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  width: min(380px, calc(100vw - 2rem));
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 1rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.site-announcement__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.site-announcement__inner {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.site-announcement__media img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 0.85rem;
}

.site-announcement__content {
  display: grid;
  gap: 0.75rem;
  padding-right: 2rem;
}

.site-announcement__title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

.site-announcement__body {
  color: #334155;
  font-size: 0.95rem;
  line-height: 1.6;
}

.site-announcement__body p,
.site-announcement__body ul,
.site-announcement__body ol {
  margin: 0;
}

.site-announcement__body a {
  color: var(--color-primary, #f97316);
}

.site-announcement__cta {
  justify-self: flex-start;
}

@media (max-width: 640px) {
  .site-announcement {
    right: 0.75rem;
    left: 0.75rem;
    bottom: 0.75rem;
    width: auto;
  }
}
