/* Reports page (reports.js) */
.rp-page { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.rp-toolbar { display: grid; gap: 12px; }
.rp-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-chip { background: var(--nq-tint-2); border: 1px solid var(--nq-line-2); border-radius: 999px; color: var(--nq-ink-2); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; min-height: 34px; padding: 4px 13px; white-space: nowrap; }
.rp-chip:hover { border-color: var(--nq-blue); color: var(--nq-blue); }
.rp-chip.is-active { background: var(--nq-blue); border-color: var(--nq-blue); color: #fff; }
.rp-controls { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 10px; }
.rp-field { display: grid; font-size: 12px; gap: 4px; }
.rp-field span { color: var(--nq-muted); font-weight: 700; }
.rp-field input, .rp-field select, .rp-field textarea { background: #fff; border: 1px solid var(--nq-line-2); border-radius: 10px; color: var(--nq-ink); font: inherit; font-size: 13px; min-height: 38px; padding: 6px 10px; }
.rp-field.is-block { width: 100%; }
.rp-field textarea { resize: vertical; }
.rp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.rp-actions button { align-items: center; display: inline-flex; gap: 6px; }
.rp-period { color: var(--nq-muted); font-size: 13px; font-weight: 700; margin: 0; }

.rp-tabs { background: var(--nq-surface); border: 1px solid var(--nq-line); border-radius: 14px; display: flex; gap: 4px; overflow-x: auto; padding: 5px; scrollbar-width: thin; }
.rp-tab { background: transparent; border: 0; border-radius: 10px; color: var(--nq-muted); cursor: pointer; flex: 0 0 auto; font: inherit; font-size: 13.5px; font-weight: 700; padding: 8px 14px; }
.rp-tab:hover { background: var(--nq-tint-2); color: var(--nq-ink); }
.rp-tab.is-active { background: var(--nq-tint); color: var(--nq-blue); }

.rp-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.rp-row { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.rp-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rp-section-title { border-bottom: 2px solid var(--nq-line-2); color: var(--nq-navy); font-size: 18px; margin: 12px 0 0; padding-bottom: 8px; }
.rp-block { align-content: start; background: var(--nq-surface); border: 1px solid var(--nq-line); border-radius: 16px; box-shadow: 0 2px 10px rgba(11, 31, 58, 0.04); display: grid; gap: 10px; min-width: 0; padding: 16px; }
.rp-block > header { align-items: baseline; display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; }
.rp-block h3 { color: var(--nq-ink); font-size: 15px; margin: 0; }
.rp-block > header small { color: var(--nq-muted-2); font-size: 12px; }
.rp-empty { color: var(--nq-muted-2); font-size: 13px; margin: 18px 0; text-align: center; }

.rp-kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
@media (min-width: 1100px) { .rp-kpis { grid-template-columns: repeat(var(--rp-cols, 5), minmax(0, 1fr)); } }
.rp-kpi { background: var(--nq-surface); border: 1px solid var(--nq-line); border-radius: 14px; display: grid; gap: 4px; min-width: 0; padding: 13px 14px; position: relative; }
.rp-kpi::before { background: var(--nq-blue); border-radius: 3px; content: ""; height: 3px; inset-inline-start: 14px; position: absolute; top: 0; width: 26px; }
.rp-kpi-label { color: var(--nq-muted); font-size: 12.5px; font-weight: 700; }
.rp-kpi b { color: var(--nq-ink); font-size: 21px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.rp-kpi-foot { align-items: center; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.rp-prev { color: var(--nq-muted-2); font-size: 11.5px; }
.rp-delta { border-radius: 999px; color: var(--nq-muted); display: inline-block; font-size: 11.5px; font-weight: 800; padding: 1px 7px; white-space: nowrap; }
.rp-delta.is-up { background: var(--nq-ok-bg); color: var(--nq-ok); }
.rp-delta.is-down { background: var(--nq-danger-bg); color: var(--nq-danger); }
.rp-delta.is-new { background: var(--nq-tint); color: var(--nq-blue); }

.rp-plot { display: grid; grid-template-columns: 46px minmax(0, 1fr); }
.rp-yaxis { margin-bottom: 24px; position: relative; }
.rp-yaxis span { color: var(--nq-muted-2); font-size: 11px; inset-inline-end: 8px; line-height: 1; position: absolute; transform: translateY(50%); white-space: nowrap; }
.rp-area { height: 100%; min-width: 0; position: relative; }
.rp-area svg { bottom: 24px; display: block; height: calc(100% - 24px); left: 0; overflow: visible; position: absolute; right: 0; top: 0; width: 100%; }
.rp-xaxis { bottom: 0; height: 20px; inset-inline: 0; position: absolute; }
.rp-xaxis span { color: var(--nq-muted-2); font-size: 11px; position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.rp-legend { display: flex; flex-wrap: wrap; font-size: 12px; gap: 6px 14px; }
.rp-legend span { align-items: center; color: var(--nq-ink-2); display: inline-flex; gap: 6px; }
.rp-legend i { border-radius: 3px; display: inline-block; height: 4px; width: 16px; }

.rp-donut { align-items: center; display: grid; gap: 18px; grid-template-columns: 150px minmax(0, 380px); }
.rp-donut svg { height: 150px; width: 150px; }
.rp-donut ul { display: grid; gap: 7px; list-style: none; margin: 0; padding: 0; }
.rp-donut li { align-items: center; display: grid; font-size: 12.5px; gap: 8px; grid-template-columns: 10px minmax(0, 1fr) auto 44px; }
.rp-donut li i { border-radius: 3px; height: 10px; width: 10px; }
.rp-donut li span { color: var(--nq-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-donut li b { color: var(--nq-ink); font-size: 12.5px; }
.rp-donut li small { color: var(--nq-muted-2); text-align: end; }

.rp-bars { display: grid; gap: 10px; }
.rp-bar { display: grid; gap: 5px; }
.rp-bar-head { align-items: center; display: flex; font-size: 12.5px; gap: 8px; }
.rp-bar-head span { color: var(--nq-ink-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-bar-head b { color: var(--nq-ink); direction: ltr; unicode-bidi: isolate; }
.rp-bar-track { background: var(--nq-tint-2); border-radius: 999px; height: 8px; overflow: hidden; }
.rp-bar-track i { border-radius: 999px; display: block; height: 100%; }

.rp-table-wrap { max-width: 100%; overflow-x: auto; }
.rp-table { border-collapse: collapse; font-size: 13px; width: 100%; }
.rp-table th { background: var(--nq-tint-2); color: var(--nq-muted); font-size: 12px; font-weight: 800; padding: 9px 10px; text-align: start; white-space: nowrap; }
.rp-table td { border-top: 1px solid var(--nq-line); color: var(--nq-ink-2); padding: 9px 10px; vertical-align: middle; }
.rp-table tr:hover td { background: var(--nq-tint-2); }
.rp-clip { display: -webkit-box; max-width: 380px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

/* PDF export: drawn off screen at a fixed width */
.rp-export { background: #fff; display: grid; gap: 12px; left: -12000px; padding: 0; position: fixed; top: 0; width: 1040px; z-index: -1; }
.rp-export .rp-block { box-shadow: none; }
.rp-export .rp-table-wrap { overflow: visible; }
.rp-export .rp-kpis { grid-template-columns: repeat(var(--rp-cols, 5), minmax(0, 1fr)); }
.rp-export-head { background: linear-gradient(135deg, #0b2b5e, #1668e3); border-radius: 16px; color: #fff; display: grid; gap: 6px; padding: 20px 24px; }
.rp-export-head div { align-items: baseline; display: flex; gap: 14px; }
.rp-export-head b { color: #fff; font-size: 24px; }
.rp-export-head span { font-size: 18px; opacity: 0.9; }
.rp-export-head p { font-size: 14px; font-weight: 700; margin: 0; }
.rp-export-head small { font-size: 12px; opacity: 0.8; }

.rp-busy { align-items: center; background: rgba(11, 31, 58, 0.35); display: flex; inset: 0; justify-content: center; position: fixed; z-index: 3000; }
.rp-busy div { align-items: center; background: #fff; border-radius: 14px; box-shadow: var(--nq-shadow); display: flex; gap: 12px; padding: 16px 22px; }
.rp-spinner { animation: rp-spin 0.8s linear infinite; border: 3px solid var(--nq-tint); border-radius: 50%; border-top-color: var(--nq-blue); height: 22px; width: 22px; }
@keyframes rp-spin { to { transform: rotate(360deg); } }

.rp-share { display: grid; gap: 12px; max-width: 560px; }
.rp-share h2 { font-size: 19px; margin: 0; }
.rp-share p { margin: 0; }
.rp-people { border: 1px solid var(--nq-line-2); border-radius: 12px; display: grid; gap: 6px; margin: 0; max-height: 200px; overflow: auto; padding: 8px 12px; }
.rp-people legend { color: var(--nq-muted); font-size: 12px; font-weight: 700; padding: 0 4px; }
.rp-people label { align-items: center; display: flex; font-size: 13px; gap: 8px; }
.rp-people small { color: var(--nq-muted-2); margin-inline-start: auto; }
.rp-share-result { background: var(--nq-tint-2); border-radius: 12px; display: grid; gap: 8px; padding: 12px; }
.rp-share-result p { font-size: 13px; }
.rp-share-result .is-ok { color: var(--nq-ok); }
.rp-share-result .is-fail { color: var(--nq-danger); }
.rp-link { display: flex; gap: 6px; }
.rp-link input { border: 1px solid var(--nq-line-2); border-radius: 10px; flex: 1; font-size: 12px; min-width: 0; padding: 6px 10px; }
.rp-wa { justify-content: center; text-align: center; text-decoration: none; }

@media (max-width: 900px) {
  .rp-row.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .rp-actions { margin-inline-start: 0; }
}

@media (max-width: 560px) {
  .rp-presets { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .rp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-kpi b { font-size: 18px; }
  .rp-donut { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .rp-donut ul { width: 100%; }
  .rp-block { padding: 12px; }
}

/* Dashboard (home page) */
.db-page { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.db-hero { align-items: center; background: linear-gradient(135deg, #0b2b5e 0%, #123f86 60%, #1668e3 100%); border-radius: 20px; color: #fff; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; overflow: hidden; padding: 22px 26px; position: relative; }
.db-hero::after { background: radial-gradient(circle at center, rgba(255, 255, 255, 0.14), transparent 65%); content: ""; height: 320px; inset-inline-end: -80px; pointer-events: none; position: absolute; top: -160px; width: 320px; }
.db-hero > div { display: grid; gap: 4px; position: relative; z-index: 1; }
.db-date { color: rgba(255, 255, 255, 0.72); font-size: 12.5px; font-weight: 700; }
.db-hero h2 { color: #fff; font-size: 24px; margin: 0; }
.db-hero p { color: rgba(255, 255, 255, 0.86); font-size: 14px; margin: 0; }
.db-hero-actions { display: flex !important; flex-wrap: wrap; gap: 8px !important; }
.db-hero-btn { align-items: center; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 12px; color: #fff; cursor: pointer; display: inline-flex; font: inherit; font-size: 13px; font-weight: 700; gap: 7px; min-height: 40px; padding: 6px 14px; }
.db-hero-btn:hover { background: rgba(255, 255, 255, 0.2); }
.db-hero-btn.is-primary { background: #fff; border-color: #fff; color: var(--nq-navy); }
.db-section { display: grid; gap: 10px; }
.db-section-head { align-items: center; display: flex; justify-content: space-between; }
.db-section-head h3 { color: var(--nq-ink); font-size: 15px; margin: 0; }
.db-link { background: none; border: 0; color: var(--nq-blue); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; padding: 2px 4px; }
.db-link:hover { text-decoration: underline; }
.db-page .rp-block > header { align-items: center; }
.db-actions { display: grid; gap: 10px; grid-template-columns: repeat(var(--db-cols, 4), minmax(0, 1fr)); }
.db-action { background: var(--nq-surface); border: 1px solid var(--nq-line); border-inline-start: 4px solid var(--nq-blue); border-radius: 14px; cursor: pointer; display: grid; font: inherit; gap: 3px; padding: 12px 14px; text-align: start; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.db-action:hover { box-shadow: var(--nq-shadow); transform: translateY(-1px); }
.db-action span { color: var(--nq-muted); font-size: 12.5px; font-weight: 700; }
.db-action b { color: var(--nq-ink); font-size: 24px; font-weight: 800; line-height: 1.25; }
.db-action small { color: var(--nq-muted-2); font-size: 11.5px; }
.db-action.is-alert { border-inline-start-color: #e0526b; }
.db-action.is-alert b { color: #b4384e; }
.db-action.is-warn { border-inline-start-color: #f2994a; }
.db-action.is-green { border-inline-start-color: #12a38a; }
.db-action.is-clear { border-inline-start-color: var(--nq-line-2); }
.db-action.is-clear b { color: var(--nq-muted-2); }
.rp-row.db-cols-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.rp-row.db-cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.db-page .rp-donut { grid-template-columns: 130px minmax(0, 1fr); }
.db-page .rp-donut svg { height: 130px; width: 130px; }
.db-orders { display: grid; }
.db-order { align-items: center; border-top: 1px solid var(--nq-line); color: inherit; display: grid; gap: 12px; grid-template-columns: 92px minmax(0, 1fr) auto auto 64px; padding: 10px 4px; text-decoration: none; }
.db-order:first-child { border-top: 0; }
.db-order:hover { background: var(--nq-tint-2); }
.db-order-no { color: var(--nq-blue); direction: ltr; font-size: 12.5px; font-weight: 800; text-align: end; }
.db-order-main { display: grid; min-width: 0; }
.db-order-main b { color: var(--nq-ink); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-order-main small { color: var(--nq-muted-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-order-total { color: var(--nq-ink); direction: ltr; font-size: 13px; font-weight: 800; white-space: nowrap; }
.db-order .badge { white-space: nowrap; }
.db-order-age { color: var(--nq-muted-2); font-size: 11.5px; text-align: end; white-space: nowrap; }
.db-tasks { display: grid; gap: 10px; }
.db-install { display: grid; gap: 10px; }
.db-install > div { background: var(--nq-tint-2); border-radius: 12px; display: grid; gap: 2px; padding: 12px 14px; }
.db-install span { color: var(--nq-muted); font-size: 12.5px; font-weight: 700; }
.db-install b { color: var(--nq-ink); font-size: 22px; font-weight: 800; }
.db-install small { color: var(--nq-muted-2); font-size: 11.5px; }
.db-install .is-alert b { color: #b4384e; }
.db-install .is-warn b { color: #8a5a00; }
@media (max-width: 1000px) {
  .db-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .rp-row.db-cols-21 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .db-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-hero { padding: 18px; }
  .db-hero h2 { font-size: 20px; }
  .db-order { grid-template-columns: minmax(0, 1fr) auto; }
  .db-order-no, .db-order-total, .db-order-age { display: none; }
}

/* A report block never grows past its column: long names are cut with "…"
   instead of pushing the card off the screen. */
.rp-block { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.rp-bars, .rp-bar { grid-template-columns: minmax(0, 1fr); min-width: 0; }

/* «المزيد» under «الأولويات الآن» on the home page */
.db-tasks-more { justify-self: center; }
