/* =========================================================
   المراجع الأول | القوائم المالية الذكية — الأنماط المشتركة
   ========================================================= */

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-arabic-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-arabic-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-arabic-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-arabic-700.woff2") format("woff2");
}

:root {
  --brand-nav: #0b192c;
  --brand-blue: #2563eb;
  --brand-link: #1e60aa;
  --brand-gold: #eab308;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "IBM Plex Sans Arabic", "Tajawal Local", ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: "ss01" on;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #bfdbfe;
  color: #0b192c;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

input[inputmode="numeric"]::-webkit-outer-spin-button,
input[inputmode="numeric"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- عناصر مساعدة ---------- */
.no-print {
  display: revert;
}
.print-only {
  display: none !important;
}
.fade-in {
  animation: q-fade 0.35s ease both;
}
@keyframes q-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.spin {
  animation: q-spin 0.8s linear infinite;
}
@keyframes q-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- التوقيع ---------- */
.signature-pad {
  touch-action: none;
  background-image: linear-gradient(to bottom, transparent 95%, #e2e8f0 95%);
  background-size: 100% 2.4rem;
  cursor: crosshair;
}

/* ---------- التنبيهات ---------- */
#toast-root {
  position: fixed;
  inset-inline: 0;
  bottom: 1.25rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  padding: 0 1rem;
}
.q-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 34rem;
  border-radius: 0.6rem;
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: #0b192c;
  box-shadow: 0 18px 40px rgba(11, 25, 44, 0.25);
  animation: q-toast-in 0.25s ease both;
}
.q-toast[data-type="success"] {
  background: #065f46;
}
.q-toast[data-type="error"] {
  background: #991b1b;
}
.q-toast[data-type="warning"] {
  background: #92400e;
}
.q-toast.out {
  animation: q-toast-out 0.2s ease both;
}
@keyframes q-toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}
@keyframes q-toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* ---------- النوافذ ---------- */
.q-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(7, 15, 26, 0.55);
  backdrop-filter: blur(3px);
  animation: q-fade 0.2s ease both;
}
.q-modal {
  width: 100%;
  max-width: 32rem;
  max-height: 88vh;
  overflow: auto;
  border-radius: 1rem;
  background: #fff;
  padding: 1.35rem;
  box-shadow: 0 30px 80px rgba(7, 15, 26, 0.35);
}
.q-modal h3 {
  font-weight: 800;
  color: #0b192c;
}

/* ---------- قوائم وتفاصيل ---------- */
details > summary {
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}

/* ---------- المستند المطبوع ---------- */
.statement-doc {
  background: #fff;
  color: #0b192c;
  padding: 2.2rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}
.statement-doc h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 1.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #0b192c;
}
.statement-doc h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 1rem;
}
.statement-doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 0.6rem;
}
.statement-doc th,
.statement-doc td {
  border: 1px solid #cbd5e1;
  padding: 0.42rem 0.55rem;
  text-align: start;
}
.statement-doc thead th {
  background: #f1f5f9;
  font-weight: 700;
}
.statement-doc tr.total td {
  background: #f8fafc;
  font-weight: 800;
  border-top: 2px solid #0b192c;
}
.statement-doc .doc-muted {
  color: #64748b;
  font-size: 0.72rem;
}
.statement-doc .doc-watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 5rem;
  font-weight: 800;
  color: rgba(37, 99, 235, 0.08);
  transform: rotate(-24deg);
  letter-spacing: 0.3em;
}
.doc-wrap {
  position: relative;
  overflow: hidden;
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }
  html,
  body {
    background: #fff !important;
  }
  body * {
    visibility: hidden;
  }
  .print-area,
  .print-area * {
    visibility: visible;
  }
  .print-area {
    position: absolute;
    inset: 0;
    width: 100%;
    margin: 0;
  }
  .no-print,
  header,
  nav,
  footer,
  #toast-root {
    display: none !important;
  }
  .statement-doc {
    border: 0;
    padding: 0;
    border-radius: 0;
  }
  .statement-doc h2 {
    break-after: avoid;
  }
  .statement-doc table {
    break-inside: auto;
  }
  .statement-doc tr {
    break-inside: avoid;
  }
  .statement-doc section + section {
    break-before: page;
  }
}

/* ---------- تبويبات لوحة العميل ---------- */
.tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab-btn:hover {
  color: #0b192c;
}
.tab-btn.active {
  color: #1e60aa;
  border-bottom-color: #1e60aa;
}
.tab-count {
  display: inline-flex;
  min-width: 1.15rem;
  height: 1.15rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #f1f5f9;
  padding: 0 0.32rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748b;
}
.tab-count:empty {
  display: none;
}

/* ---------- الطباعة داخل البطاقات ---------- */
.tabular-amount {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- شاشة الدخول ---------- */
.auth-shell {
  background:
    radial-gradient(1100px 500px at 100% -10%, rgba(37, 99, 235, 0.12), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(234, 179, 8, 0.1), transparent 55%),
    #f4f6f9;
}

/* ---------- شريط التقدم ---------- */
.step-line-done {
  background: #0b192c;
}
.step-line-todo {
  background: #e2e8f0;
}

/* ---------- حزمة التنزيل ---------- */
.download-row:hover {
  background: #f8fafc;
}

/* ---------- رسم بياني بسيط ---------- */
.bar-track {
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  background: linear-gradient(90deg, #1e60aa, #38bdf8);
  height: 100%;
  border-radius: 999px;
}

/* ---------- تحسين العرض على الجوال ---------- */
@media (max-width: 640px) {
  .statement-doc {
    padding: 1.1rem;
  }
  .statement-doc table {
    font-size: 0.7rem;
  }
}
