/* =================================================================
   Price Intelligence — App Shell V5
   Dark, dense, mint-accent. Tokens, atoms, layout.
   ================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

/* === Design Tokens ============================================== */
:root {
    /* Surfaces */
    --bg-0: #07080A;
    --bg-1: #0C0E12;
    --bg-2: #11141A;
    --bg-3: #161A21;
    --bg-4: #1C2129;
    --bg-5: #232932;

    /* Borders */
    --line-1: #1A1F27;
    --line-2: #232932;
    --line-3: #2E3540;
    --line-4: #3A4250;

    /* Text */
    --fg-1: #F4F6F8;
    --fg-2: #C8CED7;
    --fg-3: #8990A0;
    --fg-4: #5A6273;
    --fg-5: #3F4654;

    /* Accent — mint */
    --acc: #6EE7C5;
    --acc-dim: #3DA88A;
    --acc-soft: rgba(110, 231, 197, 0.12);
    --acc-glow: rgba(110, 231, 197, 0.18);
    --acc-fg: #06120F;

    /* Semantic */
    --ok: #4ADE80;
    --ok-soft: rgba(74, 222, 128, 0.13);
    --warn: #FBBF24;
    --warn-soft: rgba(251, 191, 36, 0.13);
    --bad: #F87171;
    --bad-soft: rgba(248, 113, 113, 0.15);
    --info: #60A5FA;
    --info-soft: rgba(96, 165, 250, 0.16);
    --src-supplier: #F472B6;
    --src-supplier-soft: rgba(244, 114, 182, 0.16);

    /* Selection */
    --sel: rgba(110, 231, 197, 0.07);
    --sel-line: rgba(110, 231, 197, 0.35);

    /* Type */
    --font-ui: "Manrope", ui-sans-serif, system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    /* Radii */
    --r-xs: 3px;
    --r-sm: 5px;
    --r-md: 8px;
    --r-lg: 12px;

    /* Density — drives row height/padding */
    --row-h: 44px;
    --row-pad-y: 10px;
    --row-pad-x: 16px;

    /* Shell */
    --sidebar-w: 56px;
    --header-h: 48px;
}

[data-density="compact"] {
    --row-h: 32px;
    --row-pad-y: 4px;
    --row-pad-x: 12px;
}

[data-density="comfy"] {
    --row-h: 56px;
    --row-pad-y: 16px;
    --row-pad-x: 20px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg-0);
    color: var(--fg-1);
    font-family: var(--font-ui);
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.005em;
    min-height: 100vh;
}

body {
    overflow: hidden;
}

a { color: inherit; }

/* === Typography helpers ========================================= */
.mono { font-family: var(--font-mono); font-feature-settings: "zero", "ss01"; }
.tab-nums { font-variant-numeric: tabular-nums; }
.uc { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.t-11 { font-size: 11px; line-height: 1; }
.t-12 { font-size: 12px; line-height: 1.3; }
.t-13 { font-size: 13px; line-height: 1.35; }
.t-14 { font-size: 14px; line-height: 1.4; }
.t-15 { font-size: 15px; line-height: 1.4; }
.t-16 { font-size: 16px; line-height: 1.4; }
.t-20 { font-size: 20px; line-height: 1.2; }
.t-24 { font-size: 24px; line-height: 1.15; letter-spacing: -0.015em; }
.w-500 { font-weight: 500; }
.w-600 { font-weight: 600; }
.w-700 { font-weight: 700; }
.fg-1 { color: var(--fg-1); }
.fg-2 { color: var(--fg-2); }
.fg-3 { color: var(--fg-3); }
.fg-4 { color: var(--fg-4); }
.fg-5 { color: var(--fg-5); }
.fg-acc { color: var(--acc); }
.fg-ok { color: var(--ok); }
.fg-warn { color: var(--warn); }
.fg-bad { color: var(--bad); }
.fg-info { color: var(--info); }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.label-uc {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-4);
}

/* === Atoms ====================================================== */

/* Chip */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--r-xs);
    background: var(--bg-3);
    color: var(--fg-2);
    border: 1px solid var(--line-2);
    font-family: var(--font-mono);
    white-space: nowrap;
    text-decoration: none;
    cursor: default;
}
.chip--xs { height: 18px; padding: 0 6px; font-size: 10.5px; }
.chip--ghost { background: transparent; }
.chip--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip--bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip--info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip--acc { background: var(--acc-soft); color: var(--acc); border-color: transparent; }
.chip--supplier { background: var(--supplier-bg, var(--src-supplier-soft)); color: var(--supplier-fg, var(--src-supplier)); border-color: transparent; font-weight: 600; }
.chip .num {
    color: var(--fg-3);
    font-variant-numeric: tabular-nums;
}
.chip--ok .num, .chip--warn .num, .chip--bad .num, .chip--info .num, .chip--acc .num {
    color: inherit;
    opacity: 0.7;
}

a.chip,
button.chip {
    cursor: pointer;
}
a.chip:hover,
button.chip:hover {
    filter: brightness(1.15);
}

/* Status dot */
.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.dot--ok { background: var(--ok); box-shadow: 0 0 8px rgba(74, 222, 128, 0.55); }
.dot--warn { background: var(--warn); box-shadow: 0 0 8px rgba(251, 191, 36, 0.55); }
.dot--bad { background: var(--bad); box-shadow: 0 0 8px rgba(248, 113, 113, 0.55); }
.dot--info { background: var(--info); box-shadow: 0 0 8px rgba(96, 165, 250, 0.55); }
.dot--acc { background: var(--acc); box-shadow: 0 0 8px var(--acc-glow); }
.dot--off { background: var(--fg-5); }

/* Checkbox */
.cb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid var(--line-3);
    border-radius: 3px;
    background: var(--bg-2);
    cursor: pointer;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    margin: 0;
    transition: all 0.12s ease;
}
.cb:hover { border-color: var(--line-4); }
.cb:checked {
    background: var(--acc);
    border-color: var(--acc);
}
.cb:checked::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 0;
    width: 5px;
    height: 9px;
    border: solid var(--acc-fg);
    border-width: 0 1.8px 1.8px 0;
    transform: rotate(45deg);
}
.cb--mixed:checked::after {
    width: 8px;
    height: 0;
    border: none;
    border-bottom: 1.8px solid var(--acc-fg);
    left: 2px;
    top: 6px;
    transform: none;
}
.cb:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--fg-2);
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover {
    background: var(--bg-4);
    border-color: var(--line-3);
    color: var(--fg-1);
}
.btn:focus-visible {
    outline: 2px solid var(--acc);
    outline-offset: 1px;
}
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn--ghost {
    background: transparent;
}
.btn--ghost:hover {
    background: var(--bg-3);
}
.btn--primary {
    background: var(--acc);
    color: var(--acc-fg);
    border-color: transparent;
    font-weight: 600;
}
.btn--primary:hover {
    background: #82F0D2;
    color: var(--acc-fg);
}
.btn--danger {
    color: var(--bad);
}
.btn--icon {
    width: 28px;
    padding: 0;
    justify-content: center;
}
.btn--sm {
    height: 24px;
    padding: 0 8px;
    font-size: 11.5px;
}

/* Input */
.input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--fg-1);
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    outline: none;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.input:focus {
    border-color: var(--acc-dim);
    background: var(--bg-3);
}
.input::placeholder { color: var(--fg-5); }

/* Panel */
.panel {
    background: var(--bg-1);
    border: 1px solid var(--line-1);
    border-radius: var(--r-md);
}

/* Icons */
.icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.6;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
.icon--sm { width: 12px; height: 12px; }
.icon--lg { width: 16px; height: 16px; }

/* Scrollbar */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}
.scroll::-webkit-scrollbar-thumb:hover {
    background: var(--line-3);
    background-clip: padding-box;
    border: 3px solid transparent;
}
.scroll::-webkit-scrollbar-track { background: transparent; }

/* === App Shell ================================================== */
.app-shell {
    width: 100%;
    height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    overflow: hidden;
    background: var(--bg-0);
    color: var(--fg-1);
    font-family: var(--font-ui);
}

/* Sidebar */
.sidebar {
    background: var(--bg-1);
    border-right: 1px solid var(--line-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
}
.sidebar-logo { margin-bottom: 10px; }
.sidebar-nav-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--fg-3);
    border-radius: 7px;
    display: grid;
    place-items: center;
    cursor: pointer;
    position: relative;
    text-decoration: none;
    transition: all 0.12s ease;
}
.sidebar-nav-btn:hover {
    background: var(--bg-3);
    color: var(--fg-1);
}
.sidebar-nav-btn--active {
    background: var(--bg-3);
    color: var(--acc);
}
.sidebar-nav-btn--active::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--acc);
    border-radius: 999px;
}
.sidebar-nav-btn .icon { width: 18px; height: 18px; }
.sidebar-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--bad);
    border: 2px solid var(--bg-1);
}
.sidebar-spacer { flex: 1; }
.sidebar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    margin-top: 6px;
    background: linear-gradient(135deg, var(--acc), var(--acc-dim));
    color: var(--acc-fg);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
}

/* Workspace (main area) */
.workspace {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-1);
    min-width: 0;
}

/* Workspace header */
.workspace-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line-1);
    flex-shrink: 0;
    min-height: var(--header-h);
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--fg-3);
    flex-wrap: wrap;
    min-width: 0;
}
.breadcrumb-sep { color: var(--fg-5); }
.breadcrumb-active { color: var(--fg-1); font-weight: 600; }
.workspace-header-spacer { flex: 1; min-width: 0; }
.workspace-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--fg-4);
    white-space: nowrap;
}
.workspace-req {
    font-size: 12px;
    color: var(--fg-4);
    white-space: nowrap;
}

/* Workspace content — centered max 1280px, header stays full-width */
.workspace-content {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-left: max(0px, calc((100% - 1280px) / 2));
    padding-right: max(0px, calc((100% - 1280px) / 2));
}

/* === Search toolbar ============================================= */
.search-toolbar {
    padding: 20px 24px 8px;
    flex-shrink: 0;
}
.search-toolbar-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.search-field {
    position: relative;
    flex: 1;
    max-width: 720px;
    min-width: 280px;
}
.search-field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fg-3);
    pointer-events: none;
}
.search-field input.input {
    height: 42px;
    padding-left: 42px;
    padding-right: 100px;
    font-size: 14px;
}
.search-field-kbd {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--fg-4);
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 3px;
    padding: 3px 6px;
}
.search-field-clear {
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--fg-4);
    cursor: pointer;
    padding: 4px;
    display: grid;
    place-items: center;
    border-radius: 4px;
}
.search-field-clear:hover {
    color: var(--fg-1);
    background: var(--bg-3);
}

.source-toggles {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.source-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--fg-3);
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.12s ease;
    user-select: none;
    white-space: nowrap;
}
.source-toggle input { display: none; }
.source-toggle:hover {
    background: var(--bg-3);
    color: var(--fg-1);
}
.source-toggle--on-info {
    background: var(--info-soft);
    color: var(--info);
    border-color: transparent;
}
.source-toggle--on-warn {
    background: var(--warn-soft);
    color: var(--warn);
    border-color: transparent;
}
.source-toggle--on-acc {
    background: var(--acc-soft);
    color: var(--acc);
    border-color: transparent;
}

.result-counter {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-left: auto;
}
.result-counter-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 22px;
    color: var(--fg-1);
    font-variant-numeric: tabular-nums;
}
.result-counter-label {
    font-size: 12px;
    color: var(--fg-4);
}

/* Facets row */
.facets-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.facet-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 8px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--fg-2);
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.12s ease;
    text-decoration: none;
    white-space: nowrap;
}
.facet-chip:hover {
    background: var(--bg-3);
    color: var(--fg-1);
}
.facet-chip--active {
    background: var(--acc-soft);
    color: var(--acc);
    border-color: transparent;
}
.facet-chip .num {
    color: var(--fg-3);
    font-variant-numeric: tabular-nums;
    margin-left: 2px;
    opacity: 0.7;
}
.facet-chip--active .num { color: inherit; }
.facet-hint {
    font-size: 11px;
    color: var(--fg-5);
    margin-left: 8px;
}
.facet-reset {
    background: transparent;
    border: none;
    color: var(--fg-4);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: auto;
}
.facet-reset:hover { color: var(--bad); }

/* === Selection bar ============================================== */
.selection-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    margin: 8px 24px 0;
    border-radius: var(--r-md);
    background: var(--bg-2);
    border: 1px solid var(--line-1);
    flex-shrink: 0;
    transition: all 0.12s ease;
}
.selection-bar--active {
    background: var(--sel);
    border-color: var(--sel-line);
}
.selection-bar-text {
    font-size: 13px;
    color: var(--fg-3);
}
.selection-bar--active .selection-bar-text { color: var(--fg-1); }
.selection-bar-spacer { flex: 1; }
.selection-bar-divider {
    width: 1px;
    height: 16px;
    background: var(--line-2);
}

/* === Results area =============================================== */
.results-container {
    padding: 8px 24px 24px;
    flex: 1;
    min-height: 0;
}
.results-panel {
    background: var(--bg-2);
    border: 1px solid var(--line-1);
    border-radius: var(--r-md);
    overflow: hidden;
}
.results-empty {
    padding: 64px 24px;
    text-align: center;
    color: var(--fg-3);
}
.results-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-1);
    margin: 12px 0 4px;
}
.results-empty-hint {
    font-size: 13px;
    color: var(--fg-3);
}

/* Results table */
.tbl {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.tbl th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-4);
    padding: 10px var(--row-pad-x);
    border-bottom: 1px solid var(--line-2);
    background: var(--bg-2);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}
.tbl td {
    padding: var(--row-pad-y) var(--row-pad-x);
    border-bottom: 1px solid var(--line-1);
    vertical-align: top;
    font-size: 13px;
}
.tbl tbody tr {
    transition: background 0.08s ease;
}
.tbl tbody tr:hover { background: var(--bg-3); }
.tbl tbody tr[data-sel="true"] {
    background: var(--sel);
    box-shadow: inset 2px 0 0 var(--acc);
}
.tbl tbody tr[data-sel="true"]:hover {
    background: rgba(110, 231, 197, 0.10);
}

/* Source colour band on the leading checkbox cell — visually groups rows by origin */
tr.result-row > td:first-child {
    box-shadow: inset 3px 0 0 transparent;
}
tr.result-row[data-src="drom"] > td:first-child,
tr.result-row[data-src="drom-details"] > td:first-child {
    box-shadow: inset 3px 0 0 var(--warn);
}
tr.result-row[data-src="1c"] > td:first-child {
    box-shadow: inset 3px 0 0 var(--info);
}
tr.result-row[data-src="supplier"] > td:first-child {
    box-shadow: inset 3px 0 0 var(--supplier-fg, var(--src-supplier));
}
.num-r {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Result row cell helpers */
.cell-codes {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.cell-sku {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-1);
    word-break: break-all;
}
.cell-codes-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.cell-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-1);
    line-height: 1.35;
    max-width: 100%;
    /* Show the full product name — wrap onto multiple lines, never clip.
       overflow-wrap: anywhere breaks long unbroken tokens so they cannot
       overflow the fixed-layout results table. */
    white-space: normal;
    overflow-wrap: anywhere;
}
.cell-name-meta {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--fg-3);
    margin-top: 4px;
    word-break: break-all;
}
.cell-name-meta a { color: var(--info); text-decoration: none; }
.cell-name-meta a:hover { text-decoration: underline; }
.cell-name-id {
    color: var(--fg-5);
    margin-right: 4px;
}
/* Clickable part-number codes (code_search_link macro) */
.code-link {
    color: var(--info);
    text-decoration: none;
    cursor: pointer;
}
.code-link:hover {
    text-decoration: underline;
}
/* Code rendered as a chip keeps the chip's own colours */
.code-link.chip {
    color: inherit;
}
.code-static {
    color: var(--fg-3);
}
/* Replacement numbers — discrete, individually clickable tokens */
.code-token {
    display: inline-block;
    margin-right: 8px;
}
/* Sortable column headers + active-direction indicator */
.th-sort {
    cursor: pointer;
    user-select: none;
}
.th-sort:hover {
    color: var(--fg-2);
}
.th-sort.sort-asc::after {
    content: " \25B2";
}
.th-sort.sort-desc::after {
    content: " \25BC";
}
.cell-source-tag-wrap {
    margin-top: 4px;
    display: flex;
    justify-content: flex-end;
}
.cell-seller {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--fg-2);
    margin-top: 5px;
    max-width: 26ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-seller--empty { color: var(--fg-5); font-weight: 400; }
.cell-stock-wrap {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.cell-stock-divider {
    width: 1px;
    align-self: stretch;
    background: var(--line-1);
}
.cell-actions {
    text-align: right;
}

/* Match type badge */
.match-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    height: 16px;
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--fg-3);
    background: var(--bg-3);
    border-radius: var(--r-xs);
    margin-top: 4px;
}

/* === Existing freshness badge — adapted to V5 tokens ============ */
.freshness-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    width: fit-content;
    padding: 2px 8px;
    height: 22px;
    border: 1px solid transparent;
    border-radius: var(--r-xs);
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
    font-family: var(--font-ui);
    font-variant-numeric: tabular-nums;
}

.freshness-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    box-shadow: 0 0 8px currentColor;
}

.badge-fresh {
    color: var(--ok);
    background: var(--ok-soft);
}

.badge-aging {
    color: var(--warn);
    background: var(--warn-soft);
}

.badge-stale {
    color: var(--bad);
    background: var(--bad-soft);
}

.badge-unknown {
    color: var(--fg-4);
    background: var(--bg-3);
    border-color: var(--line-2);
}
.badge-unknown .freshness-dot { box-shadow: none; }

/* === Price cell (existing markup, new look) ===================== */
.result-price {
    display: inline-grid;
    gap: 2px;
    justify-items: end;
    white-space: nowrap;
}
.result-price-value {
    color: var(--fg-1);
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.result-price-empty {
    color: var(--fg-5);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
}

/* === 1C commercial context (existing markup, new look) ========== */
.onec-stock-panel {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    color: var(--fg-2);
    width: min(24rem, 100%);
}

.onec-stock-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(52px, 1fr));
    gap: 6px;
    max-width: 100%;
}

.onec-stock-item {
    position: relative;
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--bg-3);
}

.onec-stock-item-free {
    border-color: rgba(74, 222, 128, 0.32);
    background: rgba(74, 222, 128, 0.10);
}

.onec-stock-panel-empty .onec-stock-item-free {
    border-color: rgba(248, 113, 113, 0.32);
    background: rgba(248, 113, 113, 0.10);
}

.onec-stock-item-reserved {
    border-color: rgba(251, 191, 36, 0.32);
    background: rgba(251, 191, 36, 0.10);
}

.onec-stock-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ok);
}

.onec-stock-panel-empty .onec-stock-dot {
    background: var(--bad);
}

.onec-stock-label {
    min-width: 0;
    overflow: hidden;
    color: var(--fg-4);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.onec-stock-item-free .onec-stock-label {
    color: var(--ok);
}

.onec-stock-panel-empty .onec-stock-label {
    color: var(--bad);
}

.onec-stock-item-reserved .onec-stock-label {
    color: var(--warn);
}

.onec-stock-value {
    color: var(--fg-1);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.onec-stock-panel-empty .onec-stock-value {
    color: var(--bad);
}

.onec-stock-empty {
    display: inline-block;
    margin-top: 6px;
    color: var(--fg-5);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.02em;
}

.onec-cell-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    max-width: 100%;
}

.onec-cell-heading {
    grid-column: 1 / -1;
    color: var(--fg-4);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
    margin-top: 2px;
}

.onec-cell-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) max-content;
    align-items: center;
    gap: 3px 8px;
    min-width: 0;
    padding: 4px 7px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-xs);
    background: var(--bg-3);
    color: var(--fg-2);
    font-family: var(--font-mono);
    font-size: 10.5px;
    line-height: 1.2;
}

.onec-cell-code {
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
}

.onec-cell-free {
    color: var(--ok);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.onec-cell-reserved {
    grid-column: 1 / -1;
    color: var(--warn);
    font-size: 9.5px;
    font-weight: 600;
}

.onec-cell-more {
    display: flex;
    justify-content: center;
    color: var(--fg-4);
    font-weight: 600;
    background: transparent;
    border-style: dashed;
}

/* === Search progress steps ====================================== */
.progress-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}
.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-2);
    border: 1px solid var(--line-1);
    border-radius: var(--r-md);
}
.progress-header-text { display: inline-flex; align-items: center; gap: 10px; }
.progress-steps {
    background: var(--bg-2);
    border: 1px solid var(--line-1);
    border-radius: var(--r-md);
    overflow: hidden;
}
.progress-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 12.5px;
    color: var(--fg-2);
    border-bottom: 1px solid var(--line-1);
}
.progress-step:last-child { border-bottom: none; }
.progress-step-running { background: rgba(96, 165, 250, 0.06); color: var(--info); font-weight: 500; }
.progress-step-done-has-results { background: rgba(74, 222, 128, 0.04); }
.progress-step-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--info);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.progress-step-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}
.progress-step-pending {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fg-5);
    margin: 4px;
}
.progress-step-label { flex: 1; }
.progress-step-pending-text { color: var(--fg-5); }
.progress-step-message { font-size: 11px; color: var(--fg-3); }
.progress-step-message-warn { color: var(--warn); }
.progress-step-message-err { color: var(--bad); }
.progress-step-duration {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--fg-4);
    margin-left: 8px;
}
.progress-step-count {
    font-family: var(--font-mono);
    color: var(--ok);
    font-size: 11px;
    font-weight: 600;
}

/* === Banners ==================================================== */
.banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--r-md);
    border: 1px solid;
    margin: 0 24px 8px;
    font-size: 12.5px;
}
.banner-info {
    background: var(--info-soft);
    border-color: rgba(125, 211, 252, 0.32);
    color: var(--info);
}
.banner-warn {
    background: var(--warn-soft);
    border-color: rgba(251, 191, 36, 0.32);
    color: var(--warn);
}
.banner-err {
    background: var(--bad-soft);
    border-color: rgba(248, 113, 113, 0.32);
    color: var(--bad);
}
.banner-body { flex: 1; }
.banner-title { font-weight: 600; }
.banner-dismiss {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    padding: 2px;
    display: grid;
    place-items: center;
}
.banner-dismiss:hover { opacity: 1; }

/* Timeout error block */
.timeout-block {
    margin: 16px 24px;
    padding: 16px;
    border-left: 3px solid var(--warn);
    background: rgba(251, 191, 36, 0.08);
    border-radius: var(--r-md);
}
.timeout-block-title {
    font-weight: 600;
    color: var(--warn);
    margin-bottom: 6px;
}
.timeout-block-body { color: var(--fg-2); font-size: 13px; }
.timeout-block-actions { display: flex; gap: 8px; margin-top: 12px; }

/* === Fuzzy results section ====================================== */
.fuzzy-section {
    margin: 16px 24px 24px;
    padding-top: 16px;
    border-top: 1px dashed var(--line-2);
}
.fuzzy-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--fg-2);
}
.fuzzy-title {
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--info);
}
.fuzzy-meta { font-size: 12px; color: var(--fg-4); font-family: var(--font-mono); }
.fuzzy-score-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.fuzzy-score-track {
    width: 72px;
    height: 4px;
    background: var(--bg-3);
    border-radius: 999px;
    overflow: hidden;
}
.fuzzy-score-fill { height: 100%; border-radius: inherit; }
.fuzzy-score-fill--high { background: var(--ok); }
.fuzzy-score-fill--mid { background: var(--warn); }
.fuzzy-score-fill--low { background: var(--bad); }
.fuzzy-score-value {
    font-family: var(--font-mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* === Loading indicator ========================================== */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
}
.search-loading {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 24px;
    color: var(--fg-3);
    font-size: 13px;
}
.htmx-request .search-loading { display: flex; }
.search-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--acc);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
.animate-pulse { animation: pulse 1.6s ease-in-out infinite; }

/* === Toast notifications ======================================== */
#toast-stack {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: min(360px, 92vw);
}
.toast-notification {
    pointer-events: auto;
    background: var(--bg-2);
    border-left: 3px solid var(--info);
    border-top: 1px solid var(--line-2);
    border-right: 1px solid var(--line-2);
    border-bottom: 1px solid var(--line-2);
    color: var(--fg-1);
    border-radius: var(--r-md);
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    animation: toastIn 0.18s ease-out;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast-notification--success { border-left-color: var(--ok); }
.toast-notification--warning { border-left-color: var(--warn); }
.toast-notification--error { border-left-color: var(--bad); }
.toast-notification--info { border-left-color: var(--info); }
.toast-row { display: flex; align-items: flex-start; gap: 10px; }
.toast-icon { flex-shrink: 0; }
.toast-icon--success { color: var(--ok); }
.toast-icon--warning { color: var(--warn); }
.toast-icon--error { color: var(--bad); }
.toast-icon--info { color: var(--info); }
.toast-body { flex: 1; min-width: 0; font-size: 13px; }
.toast-msg { font-weight: 500; }
.toast-cid { font-family: var(--font-mono); font-size: 11px; color: var(--fg-4); margin-top: 4px; }
.toast-dismiss {
    background: transparent;
    border: none;
    color: var(--fg-4);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
}
.toast-dismiss:hover { color: var(--fg-1); background: var(--bg-3); }
.toast-progress {
    height: 2px;
    background: var(--line-2);
    border-radius: 999px;
    overflow: hidden;
}
.toast-progress-bar {
    height: 100%;
    background: currentColor;
    opacity: 0.55;
    animation: toastShrink linear forwards;
}
.animate-toast-fade-out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    to { transform: translateX(20px); opacity: 0; }
}
@keyframes toastShrink {
    from { width: 100%; }
    to { width: 0%; }
}

/* === Clickable tokens (existing functionality, new look) ======== */
.clickable-token-filter {
    cursor: pointer;
    border-radius: 3px;
    padding: 0 2px;
    margin: 0 -2px;
    transition: background 0.12s ease, color 0.12s ease;
}
.clickable-token-filter:hover {
    background: var(--info-soft);
    color: var(--info);
}

/* === Skip links ================================================= */
.skip-links a {
    position: absolute;
    left: -9999px;
    top: -9999px;
}
.skip-links a:focus {
    position: fixed;
    left: 12px;
    top: 12px;
    padding: 8px 12px;
    background: var(--bg-2);
    color: var(--acc);
    border: 1px solid var(--acc);
    border-radius: var(--r-sm);
    z-index: 100;
    text-decoration: none;
    font-size: 13px;
}

/* === Highlight (fuzzy match) ==================================== */
.highlight {
    background: var(--acc-soft);
    color: var(--acc);
    padding: 0 2px;
    border-radius: 2px;
}

/* === Top results section ======================================== */
.top-results-section { margin: 0 24px 16px; }
.top-results-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--fg-1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.top-results-header .icon { color: var(--acc); }

/* === Misc compat shims (limited Tailwind drop-in for monitoring) === */
/* These keep monitoring.html readable without a full rewrite. */
.bg-white, .bg-gray-50, .bg-gray-100 { background: var(--bg-2) !important; color: var(--fg-2); }
.text-gray-500, .text-gray-600, .text-gray-700, .text-gray-800, .text-gray-900 { color: var(--fg-2); }
.dark\:bg-gray-700, .dark\:bg-gray-800, .dark\:bg-gray-900 { background: var(--bg-2); }
