/* BOM Test Tool — visual system reuses the existing BOM Generator tokens.
   See e:\_RMPAC\wrangler\admin\quote_generator.css for the source-of-truth
   token set; kept locally here so the test worker is self-contained. */

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

:root {
    --red:        #C41717;
    --red-hover:  #A61212;
    --red-dim:    #3d0909;
    --red-glow:   rgba(196, 23, 23, 0.15);
    --bg-deep:    #0e0e0e;
    --bg-surface: #161616;
    --bg-raised:  #1e1e1e;
    --border:     #272727;
    --border-hi:  #333333;
    --text-hi:    #f0eded;
    --text-mid:   #a09898;
    --text-dim:   #4a4444;

    --green:      #4ade80;
    --amber:      #e07070;
}

html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-deep);
    color: var(--text-hi);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-surface);
    border-bottom: 2px solid var(--red);
    flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.topbar-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 9px;
    border-radius: 20px;
    background: var(--red-dim);
    color: #f87171;
    border: 1px solid rgba(196, 23, 23, 0.4);
}
.topbar-pipeline { font-size: 12px; color: var(--text-dim); }

/* ── Layout: two panels, left fixed-width, right flexes ──────────────── */
.layout { display: flex; flex: 1; overflow: hidden; }
.panel { padding: 18px; overflow-y: auto; }
.panel-left {
    width: 380px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.panel-right { flex: 1; display: flex; flex-direction: column; gap: 14px; }

/* ── Drop zone ───────────────────────────────────────────────────────── */
.drop {
    border: 2px dashed var(--border-hi);
    border-radius: 12px;
    background: var(--bg-raised);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.drop.drag-over { border-color: var(--red); background: #1a0f0f; }
.drop-icon { font-size: 40px; opacity: 0.4; margin-bottom: 10px; }
.drop-title { font-size: 14px; font-weight: 600; color: var(--text-mid); margin-bottom: 4px; }
.drop-sub { font-size: 11px; color: var(--text-dim); margin-bottom: 14px; }
.drop-btn {
    background: var(--bg-deep);
    border: 1px solid var(--red);
    color: #f87171;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.drop-btn:hover { background: var(--red); color: #fff; }

/* ── File info card ──────────────────────────────────────────────────── */
.file-info {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}
.file-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
}
.file-info-label { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; }
.file-info-value { color: var(--text-hi); font-variant-numeric: tabular-nums; }

/* ── Section titles ──────────────────────────────────────────────────── */
.cfg-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--red);
    margin-bottom: 10px;
}

/* ── Triage bar ──────────────────────────────────────────────────────── */
.triage-bar {
    display: flex;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: var(--bg-deep);
    overflow: hidden;
    margin-bottom: 10px;
}
.triage-seg { height: 100%; transition: width 0.3s ease-out; }
.triage-text { background: #4ade80; }
.triage-draw { background: var(--red); }
.triage-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-mid);
    padding: 3px 0;
}
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.legend-text { background: #4ade80; }
.legend-draw { background: var(--red); }
.triage-legend strong { color: var(--text-hi); font-variant-numeric: tabular-nums; }

/* ── Step list ───────────────────────────────────────────────────────── */
.step-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.step {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.step.is-done   { border-color: rgba(74, 222, 128, 0.35); }
.step.is-running { border-color: rgba(196, 23, 23, 0.55); }
.step-marker {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--border-hi);
    background: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-dim);
}
.step.is-done .step-marker { background: rgba(74, 222, 128, 0.18); border-color: var(--green); color: var(--green); }
.step.is-running .step-marker {
    background: rgba(196, 23, 23, 0.22);
    border-color: var(--red);
    color: #f87171;
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.step-body { display: flex; flex-direction: column; gap: 2px; }
.step-label { font-size: 12px; font-weight: 600; color: var(--text-hi); }
.step-detail { font-size: 11px; color: var(--text-dim); line-height: 1.4; }

/* ── Cost grid ───────────────────────────────────────────────────────── */
.cost-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.cost-cell {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cost-cell.cost-total { grid-column: span 2; border-color: rgba(196, 23, 23, 0.4); }
.cost-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; }
.cost-val { font-size: 14px; color: var(--text-hi); font-variant-numeric: tabular-nums; }
.cost-cell.cost-total .cost-val { color: var(--green); font-size: 17px; font-weight: 700; }

/* ── Result panel ────────────────────────────────────────────────────── */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.result-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.result-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.result-actions { display: flex; gap: 8px; }

.btn-ghost {
    background: none;
    border: 1px solid var(--border-hi);
    color: var(--text-mid);
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--red); color: var(--text-hi); }
.btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary {
    background: var(--red);
    border: 1px solid var(--red);
    color: #fff;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--red-hover); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.result-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    text-align: center;
    padding: 60px 30px;
}
.result-empty-icon { font-size: 48px; opacity: 0.3; margin-bottom: 16px; }
.result-empty p { font-size: 13px; max-width: 380px; line-height: 1.55; margin-bottom: 8px; }
.result-empty-sub { font-size: 11.5px; color: var(--text-dim); max-width: 420px; }

/* ── Result table ────────────────────────────────────────────────────── */
.result-table {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.rt-head,
.rt-row {
    display: grid;
    grid-template-columns: 60px 50px 1fr 140px 130px 80px;
    gap: 10px;
    align-items: center;
    padding: 8px 14px;
}
.rt-head {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-raised);
}
.rt-body { flex: 1; overflow-y: auto; }
.rt-cat {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #f87171;
    padding: 12px 14px 6px;
    background: var(--bg-deep);
    border-top: 1px solid var(--border);
}
.rt-cat:first-child { border-top: none; }
.rt-row {
    font-size: 12.5px;
    color: var(--text-hi);
    border-top: 1px solid var(--border);
}
.rt-row:hover { background: rgba(255, 255, 255, 0.02); }
.rt-qty, .rt-unit {
    font-variant-numeric: tabular-nums;
    color: var(--text-mid);
}
.rt-qty { font-weight: 600; color: var(--text-hi); }
.rt-desc { color: var(--text-hi); }
.rt-mfr, .rt-part { color: var(--text-mid); font-size: 12px; }
.rt-pages {
    font-size: 11px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.footer {
    padding: 8px 24px;
    font-size: 11px;
    color: var(--text-dim);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    text-align: center;
}

/* ── Scrollbars ──────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red-dim); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .layout { flex-direction: column; overflow-y: auto; }
    .panel-left { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    .rt-head, .rt-row {
        grid-template-columns: 44px 40px 1fr 100px 100px;
    }
    .rt-pages { display: none; }
}
