/* ==========================================================================
   Stock report page (Stock position / Ledger / Summary)
   Uses the shared "of-" classes and colour variables from order-flow.css;
   the classes here start with "sr-".
   ========================================================================== */

.sr-kpis *,
.sr-filters * {
    box-sizing: border-box;
}

/* ── KPI cards (the No / Low / High stock cards are buttons that open that report) ── */
.sr-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.sr-kpi {
    --sr-accent: var(--of-brand);
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--of-line);
    border-left: 4px solid var(--sr-accent);
    border-radius: 14px;
    background: var(--of-surface);
    box-shadow: var(--of-shadow);
    color: var(--of-ink);
    text-align: left;
    font: inherit;
}

button.sr-kpi {
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}

button.sr-kpi:hover {
    transform: translateY(-1px);
}

button.sr-kpi:focus-visible {
    outline: 2px solid var(--sr-accent);
    outline-offset: 2px;
}

.sr-kpi--active {
    outline: 2px solid var(--sr-accent);
    outline-offset: 1px;
}

.sr-kpi--red   { --sr-accent: #c0392b; }
.sr-kpi--amber { --sr-accent: #d08a0b; }
.sr-kpi--blue  { --sr-accent: #2563c9; }
.sr-kpi--green { --sr-accent: #1f8a4c; }

.sr-kpi__label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--of-muted);
}

.sr-kpi__value {
    display: block;
    margin-top: 4px;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.sr-kpi__sub {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--of-muted);
}

/* ── Filter panel ── */
.sr-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px 12px;
    align-items: end;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--of-line);
    border-radius: 14px;
    background: var(--of-panel);
}

.sr-filters .of-select,
.sr-filters .of-input {
    width: 100%;
}

.sr-filters__wide {
    grid-column: span 2;
}

.sr-filters__full {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sr-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    font-size: 12px;
    color: var(--of-ink);
    cursor: pointer;
}

.sr-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--of-brand);
}

.sr-range-note {
    margin-left: auto;
    font-size: 12px;
    color: var(--of-muted);
}

/* ── Table extras ── */
.sr-in {
    color: #17713c;
    font-weight: 700;
}

.sr-out {
    color: #a8281c;
    font-weight: 700;
}

[data-theme-mode="dark"] .sr-in  { color: #7fd9a2; }
[data-theme-mode="dark"] .sr-out { color: #f39a92; }

.sr-stock {
    font-size: 13px;
    font-weight: 800;
}

.of-table tfoot td {
    padding: 9px 12px;
    border-top: 2px solid var(--of-line);
    background: var(--of-panel);
    font-weight: 800;
    font-size: 12px;
}

.sr-wrap {
    display: block;
    min-width: 170px;
    max-width: 260px;
    white-space: normal;
}

/* ── Add / remove stock dialog ── */
.sr-seg {
    display: flex;
    margin-bottom: 14px;
    border: 1px solid var(--of-line);
    border-radius: 10px;
    overflow: hidden;
}

.sr-seg button {
    flex: 1;
    padding: 8px;
    border: none;
    background: var(--of-surface);
    color: var(--of-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.sr-seg button.sr-seg--in-active {
    background: #1f8a4c;
    color: #fff;
}

.sr-seg button.sr-seg--out-active {
    background: #c0392b;
    color: #fff;
}

.sr-stock-now {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: var(--of-panel);
    font-size: 12px;
}

.sr-stock-now strong {
    font-size: 14px;
}

@media (max-width: 600px) {
    .sr-filters__wide {
        grid-column: span 1;
    }
}

/* ── Searchable dropdowns inside the report ── */
.sr-filters .searchable-dropdown-wrapper,
.sr-toolbar-dd .searchable-dropdown-wrapper {
    width: 100%;
}

.sr-toolbar-dd {
    width: 220px;
}
