/* ============================================================
   Tender Show Page Styles
   Used by: resources/views/tenders/show.blade.php
   ============================================================ */

/* ---------- Page Header ---------- */
.ts-page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ts-page-title {
    font-size: 18px;
}

/* ---------- Step Tracker (navigable circles) ---------- */
.step-navigable { cursor: pointer; }
.step-navigable .step-circle.completed {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.step-navigable:hover .step-circle.completed {
    transform: scale(1.1);
    box-shadow: 0 0 0 5px rgba(0, 113, 227, 0.2);
}
.step-navigable .step-label { transition: color 0.15s ease; }
.step-navigable:hover .step-label { color: #0071E3; }

/* ---------- Reusable: Empty / Centered State Card ---------- */
.ts-state {
    text-align: center;
    padding: 52px 24px;
}

.ts-state-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}
.ts-state-icon--success { background: #E3F9EC; }
.ts-state-icon--info    { background: #EAF0FF; }
.ts-state-icon--danger  { background: #FFECEE; }

.ts-state-icon--lg {
    width: 60px;
    height: 60px;
    margin: 0 auto 24px;
    position: relative;
}

.ts-state-icon-ping {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid #0071E3;
    opacity: 0.25;
    animation: ts-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ts-ping {
    75%, 100% { transform: scale(1.8); opacity: 0; }
}

.ts-state-title {
    font-size: 18px;
    font-weight: 700;
    color: #1D1D1F;
    margin: 0 0 8px;
}

.ts-state-text {
    font-size: 13.5px;
    color: #6E6E73;
    max-width: 420px;
    margin: 0 auto 24px;
    line-height: 1.6;
}
.ts-state-text--wide { max-width: 500px; }
.ts-state-text--mid  { max-width: 440px; }

.ts-state-footnote {
    font-size: 12px;
    color: #AEAEB2;
    margin-top: 14px;
}

/* ---------- Extraction: Progress ---------- */
.ts-progress-message {
    font-size: 14px;
    color: #0071E3;
    font-weight: 600;
    margin: 0 0 18px;
}

.ts-progress-wrap {
    max-width: 380px;
    margin: 0 auto 14px;
}

.ts-progress-track {
    height: 4px;
    background: #F0F0F2;
    border-radius: 4px;
    overflow: hidden;
}

.ts-progress-fill {
    height: 100%;
    background: #0071E3;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.ts-progress-step {
    font-size: 12px;
    color: #86868B;
    margin-top: 6px;
}

.ts-progress-hint {
    font-size: 12.5px;
    color: #86868B;
}

/* ---------- Extraction Failed: Error Details ---------- */
.ts-error-details {
    max-width: 480px;
    margin: 0 auto 24px;
    text-align: left;
}

.ts-error-toggle {
    font-size: 13px;
    color: #0071E3;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
}

.ts-error-pre {
    font-size: 11px;
    background: #1C1C1E;
    color: #E5E5EA;
    padding: 14px;
    border-radius: 10px;
    overflow-x: auto;
    max-height: 180px;
    margin-top: 8px;
}

/* ---------- Section Header (header bar at top of card) ---------- */
.ts-section-header {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.ts-section-header--block { display: block; }

.ts-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1D1D1F;
    margin: 0 0 4px;
}
.ts-section-title--lg { font-size: 17px; }

.ts-section-subtitle {
    font-size: 13px;
    color: #6E6E73;
    margin: 0;
    line-height: 1.5;
}

.ts-section-eyebrow {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #0071E3;
    margin-bottom: 4px;
}
.ts-section-eyebrow--success { color: #28CD41; }

.ts-section-flex {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.ts-section-grow { flex: 1; min-width: 0; }

.ts-section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.ts-section-actions--tight {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ---------- Confidence Badges (Step 3) ---------- */
.ts-conf-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.ts-conf-badge--high   { background: #E3F9EC; color: #1C7A35; }
.ts-conf-badge--medium { background: #FFF3E0; color: #A0600A; }
.ts-conf-badge--low    { background: #FFECEE; color: #CC1F18; }

.ts-conf-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ts-conf-dot--high   { background: #28CD41; }
.ts-conf-dot--medium { background: #FF9F0A; }
.ts-conf-dot--low    { background: #FF3B30; }

/* ---------- Filter Tabs (Step 3) ---------- */
.ts-filter-tabs {
    padding: 0 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    background: #FAFAFA;
}

.ts-filter-tab {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: -1px;
    outline: none;
    color: #86868B;
}

.ts-filter-tab--with-icon {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ts-filter-tab--active-blue {
    border-bottom-color: #0071E3;
    color: #0071E3;
    font-weight: 600;
}

.ts-filter-tab--active-red {
    border-bottom-color: #FF3B30;
    color: #CC1F18;
    font-weight: 600;
}

/* ---------- Table Wrap & Footer ---------- */
.ts-table-wrap { overflow-x: auto; }

/* ---------- Quotation Builder Table (Step 5) ---------- */
.ts-quotation-table thead th {
    background: #f7f7f8;
    color: #8e8e93;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    padding: 11px 14px;
}

.ts-quotation-table tbody td {
    padding: 14px;
}

.ts-quotation-table tbody tr:hover td {
    background: #f8fbff;
}

.ts-card-footer {
    padding: 14px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #FAFAFA;
    gap: 16px;
    flex-wrap: wrap;
}

.ts-card-footer-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #86868B;
}

.ts-card-footer-note--success {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: #86868B;
}

.ts-card-footer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---------- Pricing: progress meta ---------- */
.ts-pricing-progress {
    margin-top: 14px;
}

.ts-pricing-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #6E6E73;
    margin-bottom: 6px;
}

.ts-pricing-progress-pct {
    font-weight: 600;
    color: #0071E3;
    font-variant-numeric: tabular-nums;
}

.ts-pricing-spinner-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Quotation Totals Block (Step 5) ---------- */
.ts-totals-block {
    padding: 0 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: white;
}

/* ---------- Export Summary Stats (Step 6) ---------- */
.ts-stats-grid {
    padding: 20px 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.ts-stat-card {
    background: #FAFAFA;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 16px;
}

.ts-stat-card--accent {
    background: #0071E3;
    border: none;
}

.ts-stat-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #86868B;
    margin-bottom: 8px;
}

.ts-stat-card--accent .ts-stat-label { color: rgba(255, 255, 255, 0.75); }

.ts-stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #1D1D1F;
    letter-spacing: -0.5px;
}

.ts-stat-value--money {
    font-size: 22px;
    letter-spacing: -0.4px;
    font-variant-numeric: tabular-nums;
}

.ts-stat-card--accent .ts-stat-value { color: white; }

.ts-export-actions {
    padding: 16px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   Extraction loading view (step 2)
   Visual driven by Alpine `extractionTracker` state.
   ============================================================ */
.ts-extract {
    text-align: center;
    padding: 48px 24px 36px;
}

/* ---- Scanner illustration: doc + beam + aura + sparks ---- */
.ts-extract-scanner {
    position: relative;
    width: 132px;
    height: 132px;
    margin: 0 auto 22px;
}

.ts-extract-scanner-aura {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(0, 113, 227, 0.18), rgba(0, 113, 227, 0) 65%);
    animation: ts-extract-aura 2.4s ease-in-out infinite;
}

@keyframes ts-extract-aura {
    0%, 100% { transform: scale(1);    opacity: 0.85; }
    50%      { transform: scale(1.12); opacity: 1;    }
}

.ts-extract-scanner-doc {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 8px 18px rgba(0, 113, 227, 0.18));
}

/* Horizontal beam that sweeps top -> bottom -> top across the doc.
   Width is sized to the doc's textual area; vertical position is what
   animates so the beam appears to scan the page. */
.ts-extract-scanner-beam {
    position: absolute;
    left: 50%;
    top: calc(50% - 50px);   /* aligns with doc top */
    width: 76px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 4px;
    background: linear-gradient(90deg,
        rgba(0, 113, 227, 0)     0%,
        rgba(0, 113, 227, 0.9)  50%,
        rgba(0, 113, 227, 0)   100%);
    box-shadow: 0 0 14px rgba(0, 113, 227, 0.55);
    animation: ts-extract-beam 2.2s ease-in-out infinite;
}

@keyframes ts-extract-beam {
    0%       { transform: translate(-50%, 0);   opacity: 0;   }
    10%      { opacity: 1;   }
    50%      { transform: translate(-50%, 92px); opacity: 1;   }
    90%      { opacity: 1;   }
    100%     { transform: translate(-50%, 0);   opacity: 0;   }
}

/* Specks that "lift off" the doc - reinforces "items being extracted". */
.ts-extract-spark {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0071E3;
    opacity: 0;
    animation: ts-extract-spark 2.6s ease-out infinite;
}

.ts-extract-spark--1 {
    top: 36%;
    left: 32%;
    animation-delay: 0.2s;
}

.ts-extract-spark--2 {
    top: 44%;
    left: 64%;
    animation-delay: 1.0s;
    width: 5px;
    height: 5px;
}

.ts-extract-spark--3 {
    top: 56%;
    left: 48%;
    animation-delay: 1.6s;
    width: 4px;
    height: 4px;
}

@keyframes ts-extract-spark {
    0%   { transform: translateY(0)    scale(0.6); opacity: 0;   }
    20%  { opacity: 0.9;  }
    100% { transform: translateY(-46px) scale(0);   opacity: 0;   }
}

/* ---- Live ticker (message line) ---- */
.ts-extract-ticker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 20px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(0, 113, 227, 0.06);
    color: #0071E3;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    transition: background 0.25s ease;
}

.ts-extract-ticker-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0071E3;
    box-shadow: 0 0 0 0 rgba(0, 113, 227, 0.55);
    animation: ts-extract-ticker-pulse 1.4s ease-out infinite;
}

@keyframes ts-extract-ticker-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(0, 113, 227, 0.55); transform: scale(1);   }
    70%  { box-shadow: 0 0 0 8px rgba(0, 113, 227, 0);    transform: scale(1.1); }
    100% { box-shadow: 0 0 0 0   rgba(0, 113, 227, 0);    transform: scale(1);   }
}

/* ---- Rotating activity sub-line (under the main ticker) ----
   Each new hint string is a fresh DOM node thanks to the keyed x-for in
   the template, so the transition classes fire on every rotation. The
   line is intentionally muted - it must read as supplementary "we're
   still working" theatre, not as a competing status message. */
.ts-extract-subhint {
    position: relative;
    min-height: 18px;
    margin: -10px auto 22px;
    font-size: 12.5px;
    color: #86868B;
    text-align: center;
    letter-spacing: 0.005em;
    line-height: 1.45;
    max-width: 420px;
}

.ts-extract-subhint-text {
    display: inline-block;
}

/* x-transition classes - Alpine adds the *-enter class for the duration
   of the enter, plus *-enter-from at the start and *-enter-to at the end.
   We animate opacity + a small upward slide so a new hint reads as
   "fresh", not as "the same line just twitched". */
.ts-extract-subhint-enter {
    transition: opacity 320ms ease, transform 320ms ease;
}
.ts-extract-subhint-enter-from {
    opacity: 0;
    transform: translateY(4px);
}
.ts-extract-subhint-enter-to {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .ts-extract-subhint-enter,
    .ts-extract-subhint-enter-from,
    .ts-extract-subhint-enter-to {
        transition: none;
        transform: none;
        opacity: 1;
    }
}

/* ---- Stage dots ---- */
.ts-extract-stages {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    margin: 0 auto 22px;
    padding: 10px 20px;
    background: #F7F8FA;
    border-radius: 999px;
}

.ts-extract-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-extract-stage:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    width: 14px;
    height: 2px;
    margin-top: -1px;
    background: #DADDE3;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.ts-extract-stage--done:not(:last-child)::after,
.ts-extract-stage--active:not(:last-child)::after {
    background: #0071E3;
}

.ts-extract-stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #DADDE3;
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.ts-extract-stage--done .ts-extract-stage-dot {
    background: #0071E3;
}

.ts-extract-stage--active .ts-extract-stage-dot {
    background: #0071E3;
    transform: scale(1.4);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18);
    animation: ts-extract-stage-pulse 1.6s ease-in-out infinite;
}

@keyframes ts-extract-stage-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18); }
    50%      { box-shadow: 0 0 0 7px rgba(0, 113, 227, 0.08); }
}

/* ---- Progress bar with shimmer ---- */
.ts-extract-progress {
    max-width: 380px;
    margin: 0 auto 14px;
}

.ts-extract-progress-track {
    height: 6px;
    background: #F0F0F2;
    border-radius: 6px;
    overflow: hidden;
}

.ts-extract-progress-fill {
    position: relative;
    height: 100%;
    background: linear-gradient(90deg, #0071E3, #4A9DFF);
    border-radius: 6px;
    transition: width 0.5s ease;
    overflow: hidden;
}

.ts-extract-progress-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0)   0%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0) 100%);
    animation: ts-extract-shimmer 1.6s linear infinite;
}

@keyframes ts-extract-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(200%);  }
}

.ts-extract-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #86868B;
    margin-top: 8px;
}

.ts-extract-progress-pct {
    color: #0071E3;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---- "Searching live prices…" pricing-row text shimmer ---- */
.ts-pricing-live-text {
    background: linear-gradient(90deg, #4F46E5 0%, #818CF8 40%, #4F46E5 80%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: ts-pricing-live-shimmer 2.4s linear infinite;
}

/* KB-sweep variant - green palette so it reads "library" (free, fast)
   rather than "market call" (paid, slow). Same shimmer animation, just
   different colour stops. */
.ts-pricing-live-text--kb {
    background: linear-gradient(90deg, #1F8B4C 0%, #4FC97F 40%, #1F8B4C 80%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ts-px-price-loading--kb {
    color: #1F8B4C;
}

@keyframes ts-pricing-live-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: -100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .ts-extract-scanner-aura,
    .ts-extract-scanner-beam,
    .ts-extract-spark,
    .ts-extract-ticker-dot,
    .ts-extract-stage--active .ts-extract-stage-dot,
    .ts-extract-progress-shimmer,
    .ts-pricing-live-text {
        animation: none;
    }
}

/* ============================================================
   Step 4 - Pricing (Apple-inspired KB-first redesign)
   Generous whitespace, single-layer shadows, restrained color,
   one accent (system blue). Anything in this block prefixed
   .ts-px- to keep it isolated from the legacy pricing styles.
   ============================================================ */

.ts-px-stage {
    --ts-px-bg:        #FFFFFF;
    --ts-px-bg-soft:   #F9FAFB;
    --ts-px-border:    rgba(0, 0, 0, 0.06);
    --ts-px-border-strong: rgba(0, 0, 0, 0.10);
    --ts-px-ink:       #1D1D1F;
    --ts-px-ink-soft:  #6E6E73;
    --ts-px-ink-mute:  #86868B;
    --ts-px-accent:    #0071E3;
    --ts-px-accent-hover: #0077ED;
    --ts-px-accent-soft: rgba(0, 113, 227, 0.08);
    --ts-px-success:   #1F8B4C;
    --ts-px-warn:      #B45309;
    --ts-px-danger:    #C7382B;
    --ts-px-radius:    14px;
    --ts-px-radius-sm: 8px;
    --ts-px-shadow:    0 1px 2px rgba(0,0,0,0.04), 0 0 0 0.5px rgba(0,0,0,0.04);
    --ts-px-shadow-lg: 0 8px 32px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.06);

    display: flex;
    flex-direction: column;
    gap: 16px;

    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
    color: var(--ts-px-ink);
}

.ts-px-card {
    background: var(--ts-px-bg);
    border-radius: var(--ts-px-radius);
    box-shadow: var(--ts-px-shadow);
    overflow: hidden;
}

.ts-px-card--header { padding: 24px 28px 20px; }

/* ── Header titleblock ─────────────────────────────────── */
.ts-px-header-row {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.ts-px-header-titleblock { flex: 1; min-width: 240px; }

.ts-px-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ts-px-accent);
    margin-bottom: 6px;
}

.ts-px-title {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.022em;
    line-height: 1.15;
    color: var(--ts-px-ink);
    margin: 0 0 6px;
}

.ts-px-subtitle {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ts-px-ink-soft);
    margin: 0;
    max-width: 60ch;
}

.ts-px-subtitle strong { color: var(--ts-px-ink); font-weight: 600; }

/* ── Metric chips ──────────────────────────────────────── */
.ts-px-metrics {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ts-px-metric {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--ts-px-bg-soft);
    border: 0.5px solid var(--ts-px-border);
}

.ts-px-metric-value {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ts-px-ink);
    letter-spacing: -0.01em;
}
.ts-px-metric-label {
    font-size: 11.5px;
    color: var(--ts-px-ink-soft);
    text-transform: lowercase;
}

.ts-px-metric--library .ts-px-metric-value { color: var(--ts-px-success); }
.ts-px-metric--manual  .ts-px-metric-value { color: var(--ts-px-warn); }
.ts-px-metric--awaiting .ts-px-metric-value { color: var(--ts-px-accent); }
.ts-px-metric--failed   .ts-px-metric-value { color: var(--ts-px-danger); }
.ts-px-metric--matching .ts-px-metric-value { color: var(--ts-px-success); }
.ts-px-metric--matching {
    /* Subtle pulse to telegraph "live work in progress" without being noisy. */
    animation: ts-px-metric-pulse 1.6s ease-in-out infinite;
}
@keyframes ts-px-metric-pulse {
    0%, 100% { opacity: 1;   }
    50%      { opacity: 0.65; }
}

/* ── Progress bar ──────────────────────────────────────── */
.ts-px-progress { margin-top: 18px; }

.ts-px-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    color: var(--ts-px-ink-soft);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.ts-px-progress-pct {
    font-weight: 600;
    color: var(--ts-px-ink);
    letter-spacing: -0.01em;
}

.ts-px-progress-track {
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.ts-px-progress-fill {
    height: 100%;
    background: var(--ts-px-accent);
    border-radius: 999px;
    transition: width 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Bulk-action toolbar ───────────────────────────────── */
.ts-px-bulkbar {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1),
                opacity 200ms ease,
                margin 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ts-px-bulkbar.is-visible {
    max-height: 80px;
    opacity: 1;
}

.ts-px-bulkbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: rgba(0, 113, 227, 0.06);
    border: 1px solid rgba(0, 113, 227, 0.18);
    border-radius: var(--ts-px-radius);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.ts-px-bulkbar-count {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    color: var(--ts-px-ink);
}
.ts-px-bulkbar-count strong { font-weight: 600; }

.ts-px-bulkbar-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--ts-px-accent);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.16);
}

.ts-px-bulkbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Buttons (Apple-flat) ──────────────────────────────── */
.ts-px-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: -0.005em;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background 160ms ease, transform 80ms ease, box-shadow 160ms ease;
    white-space: nowrap;
}
.ts-px-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ts-px-btn:active:not(:disabled) { transform: scale(0.98); }

.ts-px-btn--primary {
    background: var(--ts-px-accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 113, 227, 0.25);
}
.ts-px-btn--primary:hover:not(:disabled) { background: var(--ts-px-accent-hover); }

.ts-px-btn--ghost {
    background: transparent;
    color: var(--ts-px-ink);
    border: 0.5px solid var(--ts-px-border-strong);
}
.ts-px-btn--ghost:hover:not(:disabled) { background: var(--ts-px-bg-soft); }

.ts-px-btn--sm {
    height: 30px;
    padding: 0 12px;
    font-size: 12.5px;
    border-radius: 8px;
}

.ts-px-icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 0.5px solid transparent;
    background: transparent;
    color: var(--ts-px-ink-soft);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.ts-px-icon-btn:hover {
    background: var(--ts-px-bg-soft);
    color: var(--ts-px-ink);
    border-color: var(--ts-px-border);
}

/* ── Table ─────────────────────────────────────────────── */
.ts-px-card--table { padding: 0; }

.ts-px-tablewrap {
    overflow-x: auto;
}

.ts-px-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

.ts-px-table thead th {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ts-px-ink-mute);
    text-align: left;
    padding: 14px 16px;
    border-bottom: 0.5px solid var(--ts-px-border);
    background: var(--ts-px-bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.ts-px-table tbody tr {
    transition: background 140ms ease;
}
.ts-px-table tbody tr + tr td {
    border-top: 0.5px solid var(--ts-px-border);
}
.ts-px-table tbody tr:hover { background: var(--ts-px-bg-soft); }
.ts-px-table tbody tr.is-checked { background: rgba(0, 113, 227, 0.04); }
.ts-px-table tbody tr.is-checked:hover { background: rgba(0, 113, 227, 0.07); }

.ts-px-table td { padding: 16px; vertical-align: top; }

/* Column widths. The price + actions cells need an explicit max-width so a
   long supplier_name (KB rows pack the source-tender title in there) or a
   verbose <option> label inside .ts-px-option-select can't drag the column
   wider than the viewport - the inner truncation rules below only kick in
   once their parent has a bound to truncate against. */
.ts-px-cell-check   { width: 44px;  padding-right: 0 !important; }
.ts-px-cell-item    { min-width: 280px; max-width: 280px; }
.ts-px-cell-qty     { width: 90px;  text-align: right; white-space: nowrap; }
.ts-px-cell-price   { min-width: 200px; max-width: 200px; }
.ts-px-cell-total   { width: 130px; text-align: right; white-space: nowrap; }
.ts-px-cell-actions { width: 220px; text-align: right; }

/* ── Custom checkbox (rounded, iOS-flavored) ───────────── */
.ts-px-checkbox {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    cursor: pointer;
    user-select: none;
}
.ts-px-checkbox.is-disabled { cursor: not-allowed; opacity: 0.3; }

.ts-px-checkbox input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: inherit;
}

.ts-px-checkbox-mark {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #fff;
    border: 1.5px solid var(--ts-px-border-strong);
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
    position: relative;
}

.ts-px-checkbox input:checked ~ .ts-px-checkbox-mark,
.ts-px-checkbox input:indeterminate ~ .ts-px-checkbox-mark {
    background: var(--ts-px-accent);
    border-color: var(--ts-px-accent);
    box-shadow: 0 1px 2px rgba(0, 113, 227, 0.3);
}

.ts-px-checkbox input:checked ~ .ts-px-checkbox-mark::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ts-px-checkbox input:indeterminate ~ .ts-px-checkbox-mark::after {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    top: 8px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

.ts-px-checkbox input:focus-visible ~ .ts-px-checkbox-mark {
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.25);
}

/* ── Item cell ─────────────────────────────────────────── */
.ts-px-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ts-px-ink);
    letter-spacing: -0.01em;
    line-height: 1.35;
}
.ts-px-item-spec {
    font-size: 12px;
    color: var(--ts-px-ink-soft);
    line-height: 1.45;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ts-px-item-tag {
    display: inline-block;
    margin-top: 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #3F3F46;
    background: rgba(0, 0, 0, 0.05);
    border: 0.5px solid rgba(0, 0, 0, 0.06);
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ── Qty cell ──────────────────────────────────────────── */
.ts-px-qty-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--ts-px-ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.005em;
}
.ts-px-qty-unit {
    font-size: 11.5px;
    color: var(--ts-px-ink-mute);
    margin-top: 2px;
}

/* ── Price cell states ─────────────────────────────────── */
.ts-px-price-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--ts-px-accent);
}

/* ── "Searching live prices" - skeleton placeholder + status row.
   Replaces the previous gradient shimmer text. Styled to read as
   "professional data-loading state" (think Linear / Stripe) rather
   than playful - neutral skeleton bars, single-tone pulsing dot,
   small uppercase status label. The two variants (--market / --kb)
   only swap the dot colour so the source of the search is still
   visually distinct.                                                  */
.ts-px-search {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 220px;
}

.ts-px-search-skeleton {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.045) 0%,
        rgba(0, 0, 0, 0.09)  50%,
        rgba(0, 0, 0, 0.045) 100%
    );
    background-size: 200% 100%;
    animation: ts-px-skeleton-sweep 1.4s ease-in-out infinite;
}
.ts-px-search-skeleton--lg { width: 70%; height: 14px; }
.ts-px-search-skeleton--sm { width: 45%; height: 9px;  }

.ts-px-search-meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 2px;
}

.ts-px-search-pulse {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ts-px-accent);
    box-shadow: 0 0 0 0 rgba(0, 113, 227, 0.45);
    animation: ts-px-search-pulse 1.6s ease-out infinite;
}

.ts-px-search-label {
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--ts-px-ink-soft);
}

.ts-px-search--kb .ts-px-search-pulse {
    background: var(--ts-px-success);
    box-shadow: 0 0 0 0 rgba(31, 139, 76, 0.45);
}

@keyframes ts-px-skeleton-sweep {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@keyframes ts-px-search-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(0, 113, 227, 0.45); transform: scale(1);    }
    70%  { box-shadow: 0 0 0 6px rgba(0, 113, 227, 0);    transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0   rgba(0, 113, 227, 0);    transform: scale(1);    }
}

.ts-px-search--kb .ts-px-search-pulse {
    animation-name: ts-px-search-pulse-kb;
}
@keyframes ts-px-search-pulse-kb {
    0%   { box-shadow: 0 0 0 0   rgba(31, 139, 76, 0.45); transform: scale(1);    }
    70%  { box-shadow: 0 0 0 6px rgba(31, 139, 76, 0);    transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0   rgba(31, 139, 76, 0);    transform: scale(1);    }
}

@media (prefers-reduced-motion: reduce) {
    .ts-px-search-skeleton,
    .ts-px-search-pulse {
        animation: none;
    }
}

.ts-px-price-awaiting {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ts-px-price-empty-slot {
    display: inline-block;
    border: 1.5px dashed var(--ts-px-border-strong);
    border-radius: 6px;
    padding: 4px 10px;
    color: var(--ts-px-ink-mute);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.1em;
    width: fit-content;
}
.ts-px-price-hint {
    font-size: 11.5px;
    color: var(--ts-px-ink-mute);
}

/* Post-search empty state: distinct visual signal so the user can tell
   "we searched and got nothing" apart from "I haven't searched yet".
   Amber/warn tone, leading icon, and a sub-line with the relative time
   of the last attempt. */
.ts-px-price-awaiting--searched .ts-px-price-empty-slot {
    border-color: rgba(180, 83, 9, 0.45);
    color: var(--ts-px-warn);
}
.ts-px-price-hint--warn {
    display: inline-flex;
    align-items: flex-start;
    gap: 5px;
    color: var(--ts-px-warn);
    font-weight: 500;
    line-height: 1.45;
    max-width: 280px;
}
.ts-px-price-hint--warn svg {
    flex-shrink: 0;
    margin-top: 2px;
}
.ts-px-price-hint-meta {
    font-size: 10.5px;
    color: var(--ts-px-ink-mute);
    margin-top: 2px;
    letter-spacing: 0.01em;
}

.ts-px-price-failed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ts-px-danger);
    font-weight: 500;
}

.ts-px-price-display { display: flex; flex-direction: column; gap: 4px; }
.ts-px-price-row    { display: flex; align-items: baseline; gap: 4px; }
.ts-px-price-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--ts-px-ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.022em;
}
.ts-px-price-per {
    font-size: 11.5px;
    color: var(--ts-px-ink-mute);
}

.ts-px-price-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.ts-px-pill {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}
.ts-px-pill--library { background: rgba(31, 139, 76, 0.10); color: var(--ts-px-success); }
.ts-px-pill--market  { background: rgba(0, 113, 227, 0.10); color: var(--ts-px-accent); }
.ts-px-pill--manual  { background: rgba(180, 83, 9, 0.10);  color: var(--ts-px-warn); }

.ts-px-meta-text { font-size: 11.5px; color: var(--ts-px-ink-soft); }
.ts-px-delta {
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.ts-px-delta.is-aligned   { color: var(--ts-px-success); }
.ts-px-delta.is-divergent { color: var(--ts-px-warn); }

.ts-px-price-source {
    font-size: 11.5px;
    color: var(--ts-px-ink-soft);
    margin-top: 2px;
    line-height: 1.4;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ts-px-source-brand { font-weight: 500; color: var(--ts-px-ink); }
.ts-px-dot { color: var(--ts-px-border-strong); margin: 0 4px; }

/* ── Line total ────────────────────────────────────────── */
.ts-px-line-total {
    font-size: 15px;
    font-weight: 600;
    color: var(--ts-px-ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.018em;
}
.ts-px-line-empty {
    color: var(--ts-px-border-strong);
    font-size: 14px;
}

/* ── Per-row actions ───────────────────────────────────── */
.ts-px-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.ts-px-option-form { display: inline-flex; }

.ts-px-option-select {
    height: 30px;
    font-family: inherit;
    font-size: 12px;
    color: var(--ts-px-ink);
    background: var(--ts-px-bg);
    border: 0.5px solid var(--ts-px-border-strong);
    border-radius: 8px;
    padding: 0 26px 0 10px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    /* Native <select> renders the selected value at intrinsic width by
       default; with the longer "Market · ₹13,500.00 (Mid)" labels that
       overflows the actions column. Cap and ellipsise inside the select
       so the column width stays predictable. */
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1l4 4 4-4' stroke='%2386868B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 9px center;
    transition: border-color 140ms ease, background-color 140ms ease;
}
.ts-px-option-select:hover  { border-color: var(--ts-px-ink-mute); }
.ts-px-option-select:focus  { outline: none; border-color: var(--ts-px-accent); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18); }

/* ── Table footer ──────────────────────────────────────── */
.ts-px-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-top: 0.5px solid var(--ts-px-border);
    background: var(--ts-px-bg-soft);
}

.ts-px-table-footer-note {
    font-size: 12.5px;
    color: var(--ts-px-ink-soft);
    flex: 1;
    min-width: 0;
}
.ts-px-table-footer-note strong { color: var(--ts-px-ink); font-weight: 500; }

.ts-px-spinner-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ts-px-accent);
}

.ts-px-table-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Tooltip (renders into <body> via JS, not a child of trigger) ─ */
.ts-px-tip-bubble {
    position: fixed;
    z-index: 80;
    background: rgba(28, 28, 30, 0.96);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.005em;
    padding: 7px 11px;
    border-radius: 7px;
    max-width: 360px;
    white-space: normal;
    word-wrap: break-word;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    pointer-events: none;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 140ms ease, transform 140ms ease;
}
.ts-px-tip-bubble.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Cursor hint that an element will reveal a tooltip when hovered. */
[data-tip] { cursor: default; }
button[data-tip], a[data-tip] { cursor: pointer; }

/* ── Responsive nudge ──────────────────────────────────── */
@media (max-width: 720px) {
    .ts-px-card--header { padding: 18px 18px 14px; }
    .ts-px-title { font-size: 22px; }
    .ts-px-table thead th,
    .ts-px-table td { padding: 12px; }
    .ts-px-cell-actions { width: auto; }
    .ts-px-tip-bubble { max-width: 260px; }
}

