/* Executive report — print + on-screen preview styles. */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600;700&family=Noto+Kufi+Arabic:wght@400;500;600;700&display=swap');

:root {
  --rp-navy: #0B2545;
  --rp-navy-soft: #13315C;
  --rp-gold: #B8860B;
  --rp-gold-soft: #D4A84B;
  --rp-ink: #0F172A;
  --rp-muted: #64748B;
  --rp-line: #E2E8F0;
  --rp-hair: #CBD5E1;
  --rp-bg-soft: #F8FAFC;
}

.report-root {
  background: #E6EAF0;
  min-height: 100vh;
  padding: 28px 16px 48px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--rp-ink);
}
.report-root[dir="rtl"] { font-family: 'Noto Kufi Arabic', 'Inter', system-ui, sans-serif; }

.report-page {
  position: relative;
  background: #fff;
  width: 210mm;
  height: 297mm;
  margin: 0 auto;
  padding: 14mm 14mm 12mm;
  box-shadow: 0 20px 60px rgba(15,23,42,0.18), 0 2px 6px rgba(15,23,42,0.06);
  color: var(--rp-ink);
  font-size: 10pt;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

/* Top brand bar — navy with gold accent */
.report-page::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5mm;
  background: var(--rp-navy);
}
.report-page::after {
  content: "";
  position: absolute;
  top: 5mm; left: 0; right: 0;
  height: 0.8mm;
  background: var(--rp-gold);
}

/* ----- Header ----- */
.report-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 3mm;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rp-line);
  position: relative;
}
.report-brand { display: flex; align-items: center; gap: 14px; }
.report-brand-logo {
  width: 44px; height: 44px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--rp-navy) 0%, var(--rp-navy-soft) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 20pt;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 0 var(--rp-gold) inset, 0 0 0 1px rgba(184,134,11,0.25);
  object-fit: cover;
}
img.report-brand-logo { padding: 0; }
.report-brand-title {
  font-family: 'Cormorant Garamond', 'Noto Kufi Arabic', serif;
  font-weight: 600;
  font-size: 15pt;
  line-height: 1.1;
  color: var(--rp-navy);
  letter-spacing: 0.2px;
}
[dir="rtl"] .report-brand-title { font-weight: 700; }
.report-brand-sub {
  font-size: 8.5pt;
  color: var(--rp-gold);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 600;
  margin-top: 3px;
}

.report-meta { text-align: right; font-size: 8.5pt; color: var(--rp-muted); line-height: 1.7; }
.report-meta-row { display: flex; gap: 6px; justify-content: flex-end; }
.report-meta-label {
  color: var(--rp-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 7.5pt;
  font-weight: 600;
}
.report-meta-value {
  color: var(--rp-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
[dir="rtl"] .report-meta { text-align: left; }
[dir="rtl"] .report-meta-row { justify-content: flex-start; }

/* ----- Cover ----- */
.report-cover {
  width: 100%;
  aspect-ratio: 16 / 4.5;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 0 1px var(--rp-line);
}
.report-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.report-cover-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #94A3B8; font-size: 9.5pt;
  background: repeating-linear-gradient(45deg, #F1F5F9 0 10px, #E2E8F0 10px 11px);
}

/* ----- Title row ----- */
.report-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-top: 4px;
}
.report-project-name {
  font-family: 'Cormorant Garamond', 'Noto Kufi Arabic', serif;
  font-size: 20pt;
  font-weight: 600;
  line-height: 1.1;
  color: var(--rp-navy);
  letter-spacing: 0.2px;
}
.report-client-line {
  font-size: 9pt;
  color: var(--rp-muted);
  margin-top: 3px;
}

/* ----- Section headings ----- */
.report-section-title {
  font-size: 8pt;
  font-weight: 700;
  color: var(--rp-navy);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-section-title::before {
  content: "";
  width: 14px;
  height: 2px;
  background: var(--rp-gold);
  flex-shrink: 0;
}

/* ----- KPI grid ----- */
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  break-inside: avoid;
}
.report-kpi {
  border: 1px solid var(--rp-line);
  border-top: 2px solid var(--rp-gold);
  border-radius: 3px;
  padding: 7px 10px 9px;
  background: #fff;
  position: relative;
}
.report-kpi-label {
  font-size: 7pt;
  color: var(--rp-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.report-kpi-value {
  font-size: 13pt;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--rp-navy);
  line-height: 1.1;
}
.report-kpi-unit {
  font-size: 8.5pt;
  font-weight: 500;
  color: var(--rp-muted);
  margin-right: 3px;
}
[dir="rtl"] .report-kpi-unit { margin-right: 0; margin-left: 3px; }

/* ----- Utilization bar ----- */
.report-bar-wrap {
  border: 1px solid var(--rp-line);
  border-radius: 3px;
  padding: 8px 12px;
  background: var(--rp-bg-soft);
}
.report-bar-row {
  display: flex;
  justify-content: space-between;
  font-size: 8.5pt;
  margin-bottom: 6px;
  color: var(--rp-ink);
}
.report-bar-row strong { color: var(--rp-navy); font-weight: 700; font-variant-numeric: tabular-nums; }
.report-bar {
  height: 7px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.report-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--rp-navy) 0%, var(--rp-navy-soft) 100%);
}
.bar-amber { background: linear-gradient(90deg, #B45309 0%, #D97706 100%) !important; }
.bar-red   { background: linear-gradient(90deg, #991B1B 0%, #B91C1C 100%) !important; }

/* ----- Lists ----- */
.report-list { display: flex; flex-direction: column; gap: 3px; }
.report-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--rp-line);
  border-left: 3px solid var(--rp-hair);
  border-radius: 3px;
  font-size: 9pt;
  break-inside: avoid;
}
[dir="rtl"] .report-list-item { border-left: 1px solid var(--rp-line); border-right: 3px solid var(--rp-hair); }
.report-list-item.sev-red    { border-left-color: #B91C1C; }
.report-list-item.sev-amber  { border-left-color: #D97706; }
.report-list-item.sev-green  { border-left-color: #047857; }
.report-list-item.sev-blue   { border-left-color: var(--rp-navy); }
[dir="rtl"] .report-list-item.sev-red    { border-right-color: #B91C1C; }
[dir="rtl"] .report-list-item.sev-amber  { border-right-color: #D97706; }
[dir="rtl"] .report-list-item.sev-green  { border-right-color: #047857; }
[dir="rtl"] .report-list-item.sev-blue   { border-right-color: var(--rp-navy); }

.report-list-item-left { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.report-list-title { font-weight: 600; color: var(--rp-ink); line-height: 1.3; }
.report-list-meta { font-size: 8pt; color: var(--rp-muted); font-variant-numeric: tabular-nums; line-height: 1.3; }

/* ----- Chips ----- */
.report-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 8pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip-green  { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.chip-amber  { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.chip-red    { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.chip-blue   { background: #EFF6FF; color: var(--rp-navy); border-color: #BFDBFE; }
.chip-gray   { background: #F8FAFC; color: #475569; border-color: var(--rp-line); }

/* Status chip — in title row, a touch larger */
.report-title-row .report-chip {
  padding: 4px 11px;
  font-size: 8.5pt;
}

/* ----- Empty state ----- */
.report-empty {
  padding: 10px;
  text-align: center;
  color: var(--rp-muted);
  font-size: 9pt;
  background: var(--rp-bg-soft);
  border: 1px dashed var(--rp-line);
  border-radius: 3px;
  font-style: italic;
}

/* ----- Portfolio table ----- */
.report-projects-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
  background: #fff;
}
.report-projects-table thead th {
  font-size: 7pt;
  font-weight: 700;
  color: var(--rp-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid var(--rp-line);
  white-space: nowrap;
}
[dir="rtl"] .report-projects-table thead th { text-align: right; }
.report-projects-table tbody td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--rp-line);
  vertical-align: middle;
}
.report-projects-table tbody tr:last-child td { border-bottom: none; }
.report-projects-table .col-name { width: 30%; }
.report-projects-table .col-status { width: 14%; }
.report-projects-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 13%;
  color: var(--rp-ink);
  font-weight: 600;
}
[dir="rtl"] .report-projects-table .col-num { text-align: left; }
.report-projects-table .col-bar { width: 15%; }
.report-projects-table .col-date {
  width: 14%;
  font-variant-numeric: tabular-nums;
  color: var(--rp-muted);
  font-size: 8pt;
  white-space: nowrap;
}
.report-projects-table .report-list-title { font-size: 9pt; }
.report-projects-table .report-list-meta { font-size: 7.5pt; }
.mini-bar-row { font-size: 7.5pt; color: var(--rp-muted); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.mini-bar { height: 4px; background: #E2E8F0; border-radius: 999px; overflow: hidden; }
.mini-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rp-navy) 0%, var(--rp-navy-soft) 100%);
  border-radius: 999px;
}

/* ----- Tax Invoice ----- */
.tax-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.tax-party {
  border: 1px solid var(--rp-line);
  border-left: 3px solid var(--rp-gold);
  border-radius: 3px;
  padding: 8px 12px;
  background: var(--rp-bg-soft);
}
[dir="rtl"] .tax-party { border-left: 1px solid var(--rp-line); border-right: 3px solid var(--rp-gold); }
.tax-party-label {
  font-size: 7pt;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--rp-muted);
  font-weight: 700;
}
.tax-party-name {
  font-family: 'Cormorant Garamond', 'Noto Kufi Arabic', serif;
  font-size: 12pt;
  font-weight: 600;
  color: var(--rp-navy);
  margin-top: 2px;
  line-height: 1.15;
}
.tax-party-meta {
  font-size: 8pt;
  color: var(--rp-ink);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.tax-lines thead th:first-child { width: 55%; }
.tax-lines thead th { text-align: left; }
[dir="rtl"] .tax-lines thead th { text-align: right; }
.tax-lines thead th.col-num { text-align: right; }
[dir="rtl"] .tax-lines thead th.col-num { text-align: left; }

.tax-totals-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}
.tax-totals {
  border: 1px solid var(--rp-line);
  border-radius: 3px;
  overflow: hidden;
}
.tax-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  font-size: 9pt;
  border-bottom: 1px solid var(--rp-line);
}
.tax-total-row:last-child { border-bottom: none; }
.tax-total-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--rp-ink); }
.tax-total-grand {
  background: var(--rp-navy);
  color: #fff;
  font-weight: 700;
  font-size: 10pt;
}
.tax-total-grand span:last-child { color: #fff; }

.tax-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--rp-line);
  border-radius: 3px;
}
.tax-qr img { display: block; }
.tax-qr-placeholder {
  width: 150px; height: 150px;
  background: #F1F5F9;
  display: flex; align-items: center; justify-content: center;
  color: var(--rp-muted);
  font-size: 18pt;
  font-weight: 700;
}
.tax-qr-hint {
  font-size: 7pt;
  color: var(--rp-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  max-width: 150px;
}

/* ----- Footer ----- */
.report-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--rp-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7pt;
  color: var(--rp-muted);
  letter-spacing: 0.06em;
}
.report-footer-mark {
  display: flex; align-items: center; gap: 6px;
  text-transform: uppercase; font-weight: 600;
}
.report-footer-mark::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--rp-gold);
  border-radius: 50%;
}
.report-footer-page { font-variant-numeric: tabular-nums; }

/* ----- RTL overrides ----- */
[dir="rtl"] .report-title-row { flex-direction: row-reverse; }
[dir="rtl"] .report-header { flex-direction: row-reverse; }
[dir="rtl"] .report-section-title::before { order: 1; }

/* ----- Toolbar (screen only) ----- */
.report-toolbar {
  max-width: 210mm;
  margin: 0 auto 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}
.report-toolbar-title {
  font-size: 11pt;
  font-weight: 600;
  color: var(--rp-navy);
  font-family: 'Cormorant Garamond', serif;
  font-size: 14pt;
}
.report-toolbar-actions { display: flex; gap: 8px; }
.report-btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 9.5pt;
  font-weight: 600;
  border: 1px solid var(--rp-line);
  background: #fff;
  color: var(--rp-ink);
  cursor: pointer;
  transition: all 0.15s;
}
.report-btn:hover { background: var(--rp-bg-soft); }
.report-btn-primary {
  background: var(--rp-navy);
  color: #fff;
  border-color: var(--rp-navy);
}
.report-btn-primary:hover { background: var(--rp-navy-soft); }

/* ----- Print ----- */
@page { size: A4; margin: 0; }

@media print {
  html, body { background: #fff !important; }
  .no-print { display: none !important; }
  .report-root { background: #fff !important; padding: 0 !important; }
  .report-page {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 210mm;
    height: 297mm;
    padding: 14mm 14mm 12mm;
  }
  .report-kpi, .report-list-item, .report-bar-wrap, .report-header { break-inside: avoid; }
}
