/*
 * SUPPLY — capacity, grades and live stock.
 * Tokens only: every colour, space, radius and duration below comes from public/css/er-tokens.css.
 * Nothing here defines a new colour.
 */

/* --- The three capacity numbers. Available, committed and forecast are never summed. --- */
.ersup-figures {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ersup-figure {
    background: var(--er-surface);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.ersup-figure-label {
    color: var(--er-text-secondary);
    font-size: var(--text-sm);
    margin: 0 0 var(--space-1);
}

.ersup-figure-value {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    line-height: var(--leading-tight);
    margin: 0;
}

.ersup-figure-unit {
    color: var(--er-text-secondary);
    font-size: var(--text-base);
    font-weight: 400;
}

.ersup-figure-hint {
    color: var(--er-text-secondary);
    font-size: var(--text-xs);
    margin: var(--space-1) 0 0;
}

/* Available is the number a buyer acts on, so it carries the brand weight. */
.ersup-figure--available .ersup-figure-value { color: var(--er-brand); }
.ersup-figure--committed .ersup-figure-value { color: var(--er-text-secondary); }

/* --- The availability bar: what is free against what is already spoken for. --- */
.ersup-bar {
    background: var(--er-stone-100);
    border-radius: var(--radius-pill);
    display: flex;
    height: 10px;
    margin-block: var(--space-2);
    overflow: hidden;
}

.ersup-bar-available { background: var(--er-brand); }
.ersup-bar-committed { background: var(--er-saffron-500); }
.ersup-bar-blocked { background: var(--er-danger-700); }

/* --- Declared vs evidenced. The distinction is the point, so it is visible, not a tooltip. --- */
.ersup-claim {
    align-items: flex-start;
    border-left: 3px solid var(--er-saffron-500);
    background: var(--er-saffron-50);
    border-radius: var(--radius-sm);
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3);
}

.ersup-claim-body { margin: 0; }

.ersup-claim-label {
    color: var(--er-warning-text);
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* --- Grade chips. --- */
.ersup-grades {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: 0;
}

.ersup-grade {
    background: var(--er-surface-muted);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-3);
}

.ersup-grade-code { font-weight: 600; }

.ersup-grade-meta {
    color: var(--er-text-secondary);
    font-size: var(--text-xs);
}

/* An undefined grade is shown as typed and marked uncomparable rather than faked into a tier. */
.ersup-grade--undefined { border-style: dashed; }

/* --- Low stock and holds. --- */
.ersup-note {
    align-items: center;
    display: flex;
    font-size: var(--text-sm);
    gap: var(--space-2);
    margin-block: var(--space-2);
}

.ersup-note--low { color: var(--er-warning-text); }
.ersup-note--blocked { color: var(--er-danger-700); }
.ersup-note--held { color: var(--er-text-secondary); }

/* --- Tables scroll rather than forcing the page sideways at 400px. --- */
.ersup-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    .ersup-figures { grid-template-columns: 1fr 1fr; }
    .ersup-figure { padding: var(--space-3); }
    .ersup-figure-value { font-size: var(--text-xl); }
}

@media (max-width: 400px) {
    .ersup-figures { grid-template-columns: 1fr; }
}
