/* =========================================================================
   MODULE: ADMIN INVENTORY & SALES REPORTS (css/admin-reports.css)
   ========================================================================= */

.reports-dialog {
    max-width: 1120px;
}

.rep-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ---------- Tabs ---------- */
.rep-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-light, #e7e5e4);
}

.rep-tab {
    padding: 9px 16px;
    border: none;
    background: transparent;
    font-family: var(--font-ar);
    font-size: 0.88rem;
    font-weight: 800;
    color: #71717a;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.rep-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-gold);
}

/* ---------- KPI Cards ---------- */
.rep-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.rep-kpi-card {
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rep-kpi-card.is-gold {
    background: linear-gradient(135deg, #fffbeb, #fdf8ef);
    border-color: #f3d9a4;
}

.rep-kpi-card.is-warning {
    background: #fffbeb;
    border-color: #fde68a;
}

.rep-kpi-card.is-danger {
    background: #fef2f2;
    border-color: #fecaca;
}

.rep-kpi-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: #57534e;
}

.rep-kpi-value {
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.2;
}

.rep-kpi-value small {
    font-size: 0.78rem;
    font-weight: 800;
    color: #78716c;
}

.rep-kpi-sub {
    font-size: 0.74rem;
    font-weight: 700;
    color: #78716c;
}

.rep-kpi-compare {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px dashed #e7e5e4;
    font-size: 0.72rem;
    font-weight: 700;
    color: #57534e;
    line-height: 1.6;
}

.rep-change {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 99px;
    font-weight: 900;
    font-size: 0.72rem;
    white-space: nowrap;
}

.rep-change.up { background: #dcfce7; color: #166534; }
.rep-change.down { background: #fee2e2; color: #991b1b; }
.rep-change.flat { background: #f4f4f5; color: #52525b; }

/* ---------- Toolbar ---------- */
.rep-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.rep-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rep-chip {
    padding: 7px 14px;
    border-radius: 99px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    font-family: var(--font-ar);
    font-size: 0.8rem;
    font-weight: 800;
    color: #3f3f46;
    cursor: pointer;
    transition: all 0.15s;
}

.rep-chip:hover { border-color: var(--accent-gold); }

.rep-chip.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: #ffffff;
}

.rep-search {
    flex: 1;
    min-width: 220px;
    max-width: 360px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid #e4e4e7;
    font-family: var(--font-ar);
    font-size: 0.84rem;
    font-weight: 700;
}

.rep-search:focus { outline: none; border-color: var(--accent-gold); }

.rep-date-range {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.rep-date-range label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 800;
}

.rep-date-range input {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid #e4e4e7;
    font-family: var(--font-ar);
    font-weight: 700;
}

.rep-hint {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 12px;
    line-height: 1.6;
}

.rep-period-banner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    background: #141413;
    color: #fafaf9;
    border-radius: 14px;
    padding: 11px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.rep-period-banner strong { color: #fde68a; }

/* ---------- Sections & Tables ---------- */
.rep-section { margin-bottom: 18px; }

.rep-section-title {
    font-size: 0.95rem;
    font-weight: 900;
    margin-bottom: 8px;
    padding-right: 8px;
    border-right: 4px solid var(--accent-gold);
}

.rep-table-wrap {
    overflow-x: auto;
    border: 1px solid #e7e5e4;
    border-radius: 14px;
}

.rep-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: right;
}

.rep-table th {
    background: #fafaf9;
    color: var(--accent-gold);
    font-weight: 900;
    padding: 10px 12px;
    border-bottom: 1px solid #e7e5e4;
    white-space: nowrap;
}

.rep-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f4f4f5;
    vertical-align: middle;
}

.rep-table tbody tr:hover { background: #fffdf8; }

.rep-table tfoot td {
    background: #fafaf9;
    font-weight: 900;
    border-top: 1px solid #e7e5e4;
}

.rep-table .num {
    text-align: left;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.rep-strong { font-weight: 900; color: var(--text-primary); }
.rep-muted { font-size: 0.72rem; color: #a1a1aa; font-weight: 700; }
.rep-empty { text-align: center; padding: 22px !important; color: #a1a1aa; font-weight: 700; }
.rep-items-cell { font-size: 0.78rem; line-height: 1.7; }
.rep-pos { color: #15803d; font-weight: 900; }
.rep-neg { color: #b91c1c; font-weight: 900; }

.rep-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    margin-left: 6px;
    vertical-align: middle;
}

.rep-size-pill {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 8px;
    background: #f4f4f5;
    font-weight: 900;
    font-size: 0.78rem;
}

.rep-stock-badge {
    display: inline-block;
    min-width: 38px;
    text-align: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-weight: 900;
}

.rep-stock-badge.ok { background: #dcfce7; color: #166534; }
.rep-stock-badge.low { background: #ffedd5; color: #9a3412; }
.rep-stock-badge.out { background: #fee2e2; color: #991b1b; }

.rep-move-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 0.75rem;
    white-space: nowrap;
}

.rep-move-tag.in { background: #dcfce7; color: #166534; }
.rep-move-tag.sale { background: #e0e7ff; color: #3730a3; }
.rep-move-tag.adjust { background: #fef3c7; color: #92400e; }
.rep-move-tag.return { background: #fee2e2; color: #991b1b; }
.rep-move-tag.exchange { background: #ede9fe; color: #5b21b6; }

.rep-add-stock {
    display: flex;
    gap: 6px;
    align-items: center;
}

.rep-add-stock input {
    width: 64px;
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid #d4d4d8;
    font-family: var(--font-ar);
    font-weight: 800;
    font-size: 0.8rem;
}

.rep-add-stock input:focus { outline: none; border-color: var(--accent-gold); }

.rep-add-stock .btn-mini-dark { white-space: nowrap; }

.rep-share {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    min-width: 70px;
}

.rep-share span { font-weight: 800; font-size: 0.76rem; }

.rep-share i {
    display: block;
    height: 4px;
    border-radius: 99px;
    background: var(--accent-gold);
}

.rep-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ---------- Chart ---------- */
.rep-chart-box {
    border: 1px solid #e7e5e4;
    border-radius: 14px;
    padding: 10px 8px 4px;
    background: #ffffff;
}

.rep-chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.rep-chart-bar { fill: var(--accent-gold); }
.rep-chart-bar:hover { fill: #8a6430; }
.rep-chart-x { font-size: 11px; fill: #a1a1aa; font-weight: 700; }
.rep-chart-v { font-size: 10px; fill: #57534e; font-weight: 800; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .rep-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rep-two-cols { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .rep-kpi-grid { grid-template-columns: 1fr; }
    .rep-search { max-width: none; }
}

/* =========================================================================
   v2 — SIMPLE SALES REPORT + FULL INVENTORY (المخزن المتكامل)
   ========================================================================= */

#invoiceDetailModal { z-index: 520; }

.invoice-detail-dialog { max-width: 720px; }

/* ---------- Big search boxes ---------- */
.inv-search-big {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1.5px solid #e4e4e7;
    background: #ffffff;
    font-family: var(--font-ar);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.inv-search-big:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 4px rgba(184, 134, 68, 0.12);
}

.sr-search-wrap { margin-bottom: 14px; }

/* ---------- Sales report ---------- */
.sr-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.sr-card {
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sr-card.gold {
    background: linear-gradient(135deg, #fffbeb, #fdf8ef);
    border-color: #f3d9a4;
}

.sr-card span { font-size: 0.82rem; font-weight: 800; color: #57534e; }
.sr-card strong { font-size: 1.6rem; font-weight: 900; color: var(--text-primary); line-height: 1.2; }
.sr-card strong small { font-size: 0.8rem; color: #78716c; }
.sr-card em { font-style: normal; font-size: 0.78rem; font-weight: 700; color: #78716c; }

.sr-period-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sr-period-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    font-weight: 800;
}

.sr-period-bar select,
.sr-period-bar input[type="date"],
.inv-filters select,
.inv-filters input[type="date"] {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    font-family: var(--font-ar);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.sr-period-bar.is-dim select { opacity: 0.5; cursor: not-allowed; }

.sr-banner {
    background: #141413;
    color: #fafaf9;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.84rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.sr-banner strong { color: #fde68a; }

.sr-inv-link,
.inv-link {
    color: #1d4ed8;
    font-weight: 900;
    text-decoration: none;
    border-bottom: 1px dashed #93c5fd;
    white-space: nowrap;
}

.sr-inv-link:hover,
.inv-link:hover { color: #1e3a8a; border-bottom-style: solid; }

/* ---------- Invoice viewer ---------- */
.inv-paper {
    border: 1.5px dashed #141413;
    border-radius: 16px;
    padding: 16px;
    background: #fdfcf9;
}

.inv-paper-head {
    text-align: center;
    border: 1px solid #141413;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
    background: #ffffff;
}

.inv-paper-brand { font-family: var(--font-brand, serif); font-size: 1.25rem; font-weight: 900; letter-spacing: 2px; }
.inv-paper-tag { font-size: 0.74rem; font-weight: 800; margin-top: 4px; padding-top: 4px; border-top: 1px solid #141413; }
.inv-paper-pills { display: flex; gap: 6px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.inv-paper-pills span { border: 1px solid #141413; border-radius: 99px; padding: 2px 10px; font-size: 0.76rem; font-weight: 900; }

.inv-paper-info { width: 100%; margin-bottom: 12px; font-size: 0.86rem; }
.inv-paper-info td { padding: 3px 0; vertical-align: top; }
.inv-paper-info td:first-child { width: 80px; color: #57534e; font-weight: 700; }

.inv-paper-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    background: #141413;
    color: #ffffff;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 800;
}

.inv-paper-total strong { font-size: 1.2rem; color: #fde68a; }

.inv-paper-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.inv-paper-actions button { flex: 1; padding: 11px; font-size: 0.86rem; }

/* ---------- Inventory: KPIs ---------- */
.inv-tab-body { min-height: 260px; }

.inv-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.inv-kpi {
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.inv-kpi span { font-size: 0.8rem; font-weight: 800; color: #57534e; }
.inv-kpi strong { font-size: 1.6rem; font-weight: 900; line-height: 1.2; }
.inv-kpi small { font-size: 0.72rem; font-weight: 700; color: #78716c; }
.inv-kpi.warn { background: #fffbeb; border-color: #fde68a; }
.inv-kpi.danger { background: #fef2f2; border-color: #fecaca; }

.inv-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.inv-click-row { cursor: pointer; }
.inv-click-row:hover td { background: #fffaf0; }

/* ---------- Inventory: cells & badges ---------- */
.inv-cell {
    display: inline-block;
    min-width: 34px;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 900;
    font-style: normal;
    text-align: center;
    font-size: 0.82rem;
}

.inv-cell.ok { background: #f0fdf4; color: #166534; }
.inv-cell.low { background: #ffedd5; color: #9a3412; }
.inv-cell.out { background: #fee2e2; color: #b91c1c; }
.inv-cell.none { background: transparent; color: #d4d4d8; }

.inv-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.74rem;
    font-weight: 900;
    white-space: nowrap;
}

.inv-status.ok { background: #dcfce7; color: #166534; }
.inv-status.low { background: #ffedd5; color: #9a3412; }
.inv-status.out { background: #fee2e2; color: #991b1b; }

.inv-thumb {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    background: #f4f4f5;
    display: block;
}

.inv-total-num { font-size: 0.95rem; }

.inv-matrix th.c,
.inv-matrix td.c { text-align: center; }

.inv-matrix tfoot td { font-weight: 900; }
.inv-grand { font-size: 1rem; color: var(--accent-gold); }

/* ---------- Inventory: picker ---------- */
.inv-picker { position: relative; margin-bottom: 14px; }

.inv-pick-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.inv-pick-results:empty { display: none; }

.inv-pick-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e7e5e4;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    font-family: var(--font-ar);
    text-align: right;
}

.inv-pick-item:hover { border-color: var(--accent-gold); background: #fffbf3; }

.inv-pick-item img {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    object-fit: cover;
    background: #f4f4f5;
}

.inv-pick-name {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-weight: 900;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.inv-pick-name small { font-size: 0.72rem; color: #a1a1aa; font-weight: 700; }
.inv-pick-qty { font-weight: 900; font-size: 0.8rem; color: #57534e; white-space: nowrap; }

.inv-pick-empty {
    padding: 12px;
    text-align: center;
    color: #a1a1aa;
    font-weight: 700;
    font-size: 0.84rem;
}

.inv-empty-state {
    text-align: center;
    padding: 36px 16px;
    color: #57534e;
    border: 1.5px dashed #e7e5e4;
    border-radius: 18px;
    background: #fafaf9;
}

.inv-empty-state div { font-size: 2rem; }
.inv-empty-state p { font-weight: 900; font-size: 0.95rem; margin: 6px 0; }
.inv-empty-state span { font-size: 0.8rem; font-weight: 700; color: #a1a1aa; }

/* ---------- Inventory: product card ---------- */
.inv-card {
    border: 1px solid #e7e5e4;
    border-radius: 18px;
    padding: 16px;
    background: #ffffff;
}

.inv-card-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.inv-card-head.compact { align-items: center; }

.inv-card-img {
    width: 92px;
    height: 92px;
    border-radius: 14px;
    object-fit: cover;
    background: #f4f4f5;
    flex-shrink: 0;
}

.inv-card-head.compact .inv-card-img { width: 60px; height: 60px; }

.inv-card-info { flex: 1; min-width: 0; }
.inv-card-info h4 { font-size: 1.1rem; font-weight: 900; margin-bottom: 4px; }

.inv-card-meta,
.inv-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 0.8rem;
    color: #57534e;
    font-weight: 700;
}

.inv-card-chips { margin-top: 8px; gap: 6px; }

.inv-card-chips span {
    background: #f4f4f5;
    border-radius: 99px;
    padding: 3px 10px;
}

.inv-card-total {
    text-align: center;
    background: #141413;
    color: #ffffff;
    border-radius: 16px;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 120px;
}

.inv-card-total span { font-size: 0.74rem; font-weight: 800; color: #d6d3d1; }
.inv-card-total strong { font-size: 2rem; font-weight: 900; color: #fde68a; line-height: 1.1; }
.inv-card-total small { font-size: 0.72rem; color: #d6d3d1; margin-bottom: 4px; }

.inv-card-section-title {
    font-size: 0.9rem;
    font-weight: 900;
    margin: 14px 0 8px;
    padding-right: 8px;
    border-right: 4px solid var(--accent-gold);
}

.inv-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #78716c;
}

.inv-legend .inv-cell { min-width: 26px; padding: 1px 6px; font-size: 0.7rem; margin-left: 4px; }

.inv-equation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 14px;
}

.inv-equation div {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 76px;
}

.inv-equation div span { font-size: 0.74rem; font-weight: 800; color: #78716c; }
.inv-equation div strong { font-size: 1.15rem; font-weight: 900; }
.inv-equation b { font-size: 1.2rem; color: #a1a1aa; }
.inv-equation .eq-result strong { color: var(--accent-gold); font-size: 1.35rem; }

.inv-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.inv-card-actions button { padding: 9px 16px; font-size: 0.82rem; }

.inv-btn-outline {
    background: #ffffff !important;
    color: var(--text-primary) !important;
    border: 1.5px solid #d4d4d8 !important;
}

.inv-change-btn {
    border: 1px solid #e4e4e7;
    background: #fafaf9;
    border-radius: 99px;
    padding: 6px 12px;
    font-family: var(--font-ar);
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

/* ---------- Inventory: entry / correction grid ---------- */
.inv-grid-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.inv-grid-cell small {
    font-size: 0.68rem;
    font-weight: 800;
    color: #a1a1aa;
    white-space: nowrap;
}

.inv-grid-input {
    width: 64px;
    padding: 7px 6px;
    border-radius: 9px;
    border: 1.5px solid #d4d4d8;
    text-align: center;
    font-family: var(--font-ar);
    font-weight: 900;
    font-size: 0.9rem;
}

.inv-grid-input:focus { outline: none; border-color: var(--accent-gold); background: #fffbf3; }
.inv-grid-input.invalid { border-color: #ef4444; background: #fef2f2; }

.inv-entry-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

/* ---------- Inventory: filters & moves ---------- */
.inv-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inv-filters label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 800;
}

.inv-moves-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 14px;
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.rep-tabs { flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .inv-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inv-two-cols { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .sr-cards { grid-template-columns: 1fr; }
    .inv-kpi-row { grid-template-columns: 1fr 1fr; }
    .inv-card-head { flex-wrap: wrap; }
    .inv-card-total { width: 100%; }
    .inv-entry-footer { flex-direction: column; align-items: stretch; }
    .inv-paper-actions { flex-direction: column; }
}

/* =========================================================================
   v3 — DATE RANGE FILTER + ALL-ITEMS GRID + DETAILED VIEW
   ========================================================================= */

.sr-date-filter {
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.sr-date-filter.is-dim { opacity: 0.55; }

.sr-date-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.sr-date-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 900;
}

.sr-date-row input[type="date"] {
    padding: 9px 12px;
    border-radius: 11px;
    border: 1.5px solid #d4d4d8;
    background: #ffffff;
    font-family: var(--font-ar);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
}

.sr-date-row input[type="date"]:focus { outline: none; border-color: var(--accent-gold); }

.sr-apply-btn {
    padding: 10px 20px !important;
    font-size: 0.86rem !important;
}

.sr-apply-btn:disabled,
.sr-presets .rep-chip:disabled { cursor: not-allowed; }

.sr-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.sr-presets > span {
    font-size: 0.78rem;
    font-weight: 800;
    color: #78716c;
    margin-left: 4px;
}

.sr-presets .rep-chip { padding: 5px 12px; font-size: 0.76rem; }

/* ---------- All items grid (tiles) ---------- */
.inv-grid-title {
    font-size: 0.86rem;
    font-weight: 900;
    color: #57534e;
    margin-bottom: 10px;
}

.inv-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}

.inv-item-tile {
    display: flex;
    flex-direction: column;
    border: 1px solid #e7e5e4;
    border-radius: 16px;
    background: #ffffff;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    text-align: right;
    font-family: var(--font-ar);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.inv-item-tile:hover {
    transform: translateY(-2px);
    border-color: var(--accent-gold);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.07);
}

.inv-item-tile.low { border-color: #fed7aa; }
.inv-item-tile.out { border-color: #fecaca; }
.inv-item-tile.out .inv-tile-img img { filter: grayscale(0.85); opacity: 0.6; }

.inv-tile-img {
    aspect-ratio: 1 / 1;
    background: #f5f5f4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inv-tile-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inv-tile-body {
    padding: 9px 10px 11px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.inv-tile-name {
    font-weight: 900;
    font-size: 0.86rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-tile-code { font-size: 0.72rem; font-weight: 700; color: #a1a1aa; }
.inv-tile-meta { font-size: 0.72rem; font-weight: 700; color: #78716c; }

.inv-tile-qty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #57534e;
}

.inv-tile-qty strong { font-size: 1rem; color: var(--text-primary); }
.inv-tile-note { font-size: 0.7rem; font-weight: 800; color: #b91c1c; }

/* ---------- Detailed view (every item with its matrix) ---------- */
.inv-detail-block {
    border: 1px solid #e7e5e4;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
    background: #ffffff;
}

.inv-detail-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.inv-detail-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.inv-detail-title .inv-link { font-size: 0.95rem; border-bottom: none; color: var(--text-primary); }
.inv-detail-title .inv-link:hover { color: var(--accent-gold); }

.inv-detail-total {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    font-weight: 800;
    white-space: nowrap;
}

.inv-detail-total strong { font-size: 1.15rem; }

@media (max-width: 600px) {
    .inv-items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inv-detail-head { flex-wrap: wrap; }
    .sr-date-row label { flex: 1 1 45%; }
    .sr-date-row input[type="date"] { flex: 1; }
}
