/* admin-reports — Report Center (owned by one agent; see index.html).
   Layout: a report picker (grouped sidebar ≥900px, a <select> below that) + a filter bar + KPI cards + a
   table that becomes a stacked card list under 640px (only place that collapses — the table itself still
   scrolls horizontally on in-between widths instead of breaking the page). */

.rptc-shell{display:grid;grid-template-columns:240px 1fr;gap:16px;align-items:start}
@media (max-width:900px){.rptc-shell{grid-template-columns:1fr}}

/* ---- picker ---- */
.rptc-picker{position:sticky;top:12px}
@media (max-width:900px){.rptc-picker{position:static}}
.rptc-nav{display:flex;flex-direction:column;gap:14px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px;max-height:calc(100vh - 140px);overflow:auto}
.rptc-group>b{display:block;font-size:11px;color:var(--mut);font-weight:700;margin-bottom:6px;padding:0 4px}
.rptc-group a{display:block;padding:8px 10px;border-radius:9px;font-size:13.5px;font-weight:600;color:#334155;text-decoration:none;margin-bottom:2px;cursor:pointer}
.rptc-group a:hover{background:#f1f5f9}
.rptc-group a.on{background:var(--pri);color:#fff}
.rptc-nav-mobile{display:none}
.rptc-nav-mobile select{width:100%;height:44px;border:1px solid var(--line);border-radius:10px;background:#fff;padding:0 12px;font-size:14px;font-weight:600}
@media (max-width:900px){.rptc-nav{display:none}.rptc-nav-mobile{display:block;margin-bottom:4px}}

/* ---- filter bar ---- */
.rptc-filters{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;margin-bottom:14px}
.rptc-filters select,.rptc-filters input{height:38px;border:1px solid var(--line);border-radius:10px;background:#fff;padding:0 12px;min-width:140px;font-size:13.5px}
.rptc-filters .dt{display:flex;flex-direction:column;gap:3px;font-size:11px;color:var(--mut)}
.rptc-filters .dt input{min-width:0}
.rptc-range{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end}
.rptc-presets{display:flex;flex-wrap:wrap;gap:6px}
.rptc-preset{font-size:12px;padding:5px 12px;cursor:pointer}
.rptc-preset.on{background:var(--pri);color:#fff;border-color:var(--pri)}
@media (max-width:640px){.rptc-filters{gap:8px}.rptc-filters select,.rptc-filters input{min-width:0;flex:1 1 140px}}

/* ---- KPI row above the table ---- */
.rptc-kpis{margin-bottom:14px}

/* ---- loading / empty states ---- */
.rptc-loading{text-align:center;padding:40px 20px;color:var(--mut);font-size:14px}
.rptc-empty{display:block;text-align:center;padding:36px 16px;color:var(--mut)}

/* ---- table card ---- */
.rptc-table-card{padding:0;overflow:hidden}
.rptc-table-card .tbl-wrap{border:0;border-radius:0}
.rptc-table-card tfoot td{font-weight:700;background:#f8fafc;border-top:2px solid var(--line)}
.rptc-table-card tfoot td:first-child{color:var(--mut);font-weight:600}

/* ---- mobile stacked cards (replace the table under 640px) ---- */
.rptc-cards{display:none}
@media (max-width:640px){
  .rptc-table-card .tbl-wrap{display:none}
  .rptc-cards{display:flex;flex-direction:column;gap:10px;padding:12px}
}
.rptc-card{border:1px solid var(--line);border-radius:12px;padding:10px 12px;background:#fff}
.rptc-card-row{display:flex;justify-content:space-between;gap:10px;padding:4px 0;font-size:13px;border-bottom:1px dashed #eef2f7}
.rptc-card-row:last-child{border-bottom:0}

/* ---- stock position reports (الوارد / المنصرف / الرصيد / العجز) ---- */
.rptc-table-card td.stkn,.rptc-table-card td.stkq{line-height:1.35}
.rptc-table-card td.stkn b{display:block;font-weight:700}
.rptc-table-card td.stkq .qq{margin-top:3px}
.qbig{display:block;font-size:16px;font-weight:700;color:#000;line-height:1.25;direction:rtl}
.qbig em{font-style:normal;font-size:11px;font-weight:600;color:#475569}
.qbig i{font-style:normal;font-size:11px;font-weight:600;color:var(--mut)}
.qbig.bad,.qbig.bad i{color:#b91c1c}
.qbig.ok{color:#15803d}
.rptc-card-row .v .qbig{text-align:left}
table.rptt .qbig{font-size:13px}
.rptc-table-card td.stkn small,.rptc-table-card td.stkq small,.rptc-card-row .v small{display:block;color:var(--mut);font-size:11px;font-weight:500}
.stk-none{color:var(--mut)}
.tag.stk-bad{background:#fee2e2;color:#b91c1c}
.tag.stk-ok{background:#dcfce7;color:#15803d}
.tag.stk-idle{background:#f1f5f9;color:#64748b}
.rpt-meta+table.rptt td b{display:block}
table.rptt td small{display:block;color:#64748b;font-size:10px}
table.rptt .tag{font-size:10px;padding:1px 6px;border:1px solid #cbd5e1;border-radius:10px}
.rptc-card-row .k{color:var(--mut)}
.rptc-card-row .v{font-weight:700;text-align:left;direction:ltr;unicode-bidi:plaintext}

/* one line: N قطعة = [دستة | قطعة] (owner request 2026-10-25, trial of the chips next to the piece count) */
.qrow{display:inline-flex;align-items:center;gap:10px;direction:rtl;white-space:nowrap}
.qrow .qbig{display:inline-block;min-width:74px;font-size:16px}
.qrow .qeq{color:var(--mut);font-weight:700;font-size:15px}
.rptc-card-row .v .qrow{flex-wrap:wrap;justify-content:flex-end}
table.rptt .qrow{gap:5px}table.rptt .qrow .qbig{min-width:0;font-size:12.5px}
.qrow{flex-wrap:wrap;row-gap:4px;column-gap:8px}
.qrow .qbig{min-width:0}
.rptc-table-card .qrow .qq>span{min-width:36px;padding:2px 6px}
.rptc-table-card .qrow .qq b{font-size:13px}
.rptc-table-card .qrow .qq i{font-size:9.5px}
.rptc-table-card td.stkq{min-width:120px}

/* ---- كارت صنف (stk_card): model header + movement table ---- */
.cardhd{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:14px;padding:14px 18px;border-right:5px solid var(--pri)}
.ch-id{display:flex;align-items:baseline;gap:12px}
.ch-code{font-family:ui-monospace,Consolas,monospace;font-size:22px;font-weight:800;color:var(--pri)}
.ch-name{font-size:20px;font-weight:700;color:#000}
.ch-meta{display:flex;gap:18px;flex-wrap:wrap;color:var(--mut);font-size:13px}
.ch-meta b{color:#000}
.qdz{display:block;color:var(--mut);font-size:11px;font-weight:500;margin-top:2px}
.ch-meta .qdz{display:inline;margin:0 4px}
td.stkq .qbig.bad{color:#b91c1c}
.rptc-table-card td.stkq small.qdz{display:block}
table.rptt .cardhd{display:flex;margin:6px 0;padding:6px 10px;border:1px solid #94a3b8}
table.rptt .qdz,.a4 .qdz{font-size:9px}
.a4 .cardhd{display:flex;gap:16px;margin:8px 0;padding:8px 12px;border:1px solid #94a3b8;border-radius:6px}
.a4 .ch-code{font-size:16px}.a4 .ch-name{font-size:15px}
