
@font-face { font-family: 'InterLocal'; src: url('fonts/Inter-Regular.otf') format('opentype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'InterLocal'; src: url('fonts/Inter-SemiBold.otf') format('opentype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'InterLocal'; src: url('fonts/Inter-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'InterLocal'; src: url('fonts/Inter-ExtraBold.otf') format('opentype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'MonoLocal'; src: url('fonts/DejaVuSansMono.ttf') format('truetype'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'MonoLocal'; src: url('fonts/DejaVuSansMono-Bold.ttf') format('truetype'); font-weight: 700 800; font-display: swap; }
@font-face { font-family: 'ArabicLocal'; src: url('fonts/NotoSansArabic-Regular.ttf') format('truetype'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'ArabicLocal'; src: url('fonts/NotoSansArabic-Bold.ttf') format('truetype'); font-weight: 700 800; font-display: swap; }


:root {
  --bg-page: #eef2f6;
  --bg-shell: #f7f9fc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border: rgba(15, 23, 42, 0.08);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --panzea: #0d9488;
  --e300: #2563eb;
  --fungamyl: #7c3aed;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -10px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] {
  --bg-page: #110c09;
  --bg-shell: #17100c;
  --bg-card: #211812;
  --bg-subtle: #2b1f18;
  --border: rgba(245, 232, 212, 0.10);
  --text-main: #f5efe6;
  --text-muted: #b8a898;
  --panzea: #2dd4bf;
  --e300: #60a5fa;
  --fungamyl: #a78bfa;
  --shadow-card: 0 14px 34px -12px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; overflow-x: hidden;
  background-color: var(--bg-page); color: var(--text-main);
  font-family: 'InterLocal', 'ArabicLocal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.45; -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}
html[lang="ar"] body {
  font-family: 'ArabicLocal', 'InterLocal', -apple-system, BlinkMacSystemFont, sans-serif;
}
h1, h2, h3, p { margin: 0; }
button, input { font-family: inherit; }
button { cursor: pointer; border: none; background: transparent; color: inherit; }
img, svg { display: block; max-width: 100%; }

.font-mono-num {
  font-family: 'MonoLocal', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  direction: ltr; unicode-bidi: isolate;
}

/* Layout & Shell */
.app-body { min-height: 100vh; padding: 12px 10px; }
@media (min-width: 640px) { .app-body { padding: 20px; } }
.app-shell {
  max-width: 1152px; margin: 0 auto; border-radius: 28px;
  padding: 14px; background: var(--bg-shell);
  border: 1px solid var(--border);
  box-shadow: 0 20px 35px -15px rgba(15, 23, 42, 0.14);
}
@media (min-width: 640px) { .app-shell { padding: 24px; } }

/* Cards */
.bento-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 22px; box-shadow: var(--shadow-card);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.bento-hero-card {
  background: linear-gradient(135deg, #13315c 0%, #1d4e89 55%, #0f766e 100%);
  border-radius: 22px; color: #ffffff;
  box-shadow: 0 16px 34px -12px rgba(19, 49, 92, 0.45);
}
html[data-theme="dark"] .bento-hero-card {
  background: linear-gradient(135deg, #3a2313 0%, #5b3617 55%, #8f5b22 100%);
  box-shadow: 0 16px 34px -12px rgba(217, 155, 67, 0.25);
}
.subtle-box { background: var(--bg-subtle); border: 1px solid var(--border); }
.text-muted { color: var(--text-muted); }

/* Inputs */
.input-modern {
  background: var(--bg-card); color: var(--text-main);
  border: 1px solid var(--border); transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input-modern:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16); }
.input-modern.input-err { border-color: #e11d48 !important; box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.15); }

/* Pills */
.nav-pill { transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1); color: var(--text-muted); }
.nav-pill.active { background: #13315c; color: #ffffff; box-shadow: 0 4px 12px rgba(19, 49, 92, 0.25); }
html[data-theme="dark"] .nav-pill.active { background: #d99b43; color: #160f0a; box-shadow: 0 4px 16px rgba(217, 155, 67, 0.32); }
.unit-pill { color: var(--text-muted); transition: all 0.18s ease; }
.unit-pill.active { background: #0ea5e9; color: #ffffff; }
html[data-theme="dark"] .unit-pill.active { background: #d99b43; color: #160f0a; }

/* Sliders */
.slider-wrap { position: relative; height: 30px; display: flex; align-items: center; direction: ltr; }
.slider-track {
  position: absolute; left: 0; right: 0; height: 10px;
  border-radius: 999px; background: var(--bg-subtle); overflow: hidden; pointer-events: none;
}
.slider-zone { position: absolute; top: 0; bottom: 0; border-radius: 999px; transition: left 0.2s ease, width 0.2s ease, opacity 0.2s ease; }
input[type="range"].bento-slider {
  -webkit-appearance: none; appearance: none; position: relative; z-index: 2;
  width: 100%; height: 30px; background: transparent; margin: 0; cursor: pointer;
}
input[type="range"].bento-slider:disabled { cursor: not-allowed; opacity: 0.45; }
input[type="range"].bento-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #0f172a; border: 3px solid #ffffff; box-shadow: 0 3px 10px rgba(15, 23, 42, 0.3);
  transition: transform 0.15s ease;
}
html[data-theme="dark"] input[type="range"].bento-slider::-webkit-slider-thumb { background: #e5a94c; border-color: #17100c; }
input[type="range"].bento-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #0f172a; border: 3px solid #ffffff; box-shadow: 0 3px 10px rgba(15, 23, 42, 0.3);
}
html[data-theme="dark"] input[type="range"].bento-slider::-moz-range-thumb { background: #e5a94c; border-color: #17100c; }

.vbar-fill { transition: height 0.38s cubic-bezier(0.22, 1, 0.36, 1); }
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 60;
  pointer-events: none; opacity: 0; transform: translateY(8px);
  background: #0f172a; color: #ffffff; font-size: 13px; font-weight: 600;
  padding: 12px 16px; border-radius: 16px; box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  display: flex; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,0.1);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }
.relative { position: relative; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.z-50 { z-index: 50; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.self-start { align-self: flex-start; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gap-1 { gap: 4px; } .gap-1-5 { gap: 6px; } .gap-2 { gap: 8px; } .gap-2-5 { gap: 10px; }
.gap-3 { gap: 12px; } .gap-3-5 { gap: 14px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; }

.stack-1 > * + * { margin-top: 4px; }
.stack-1-5 > * + * { margin-top: 6px; }
.stack-2 > * + * { margin-top: 8px; }
.stack-2-5 > * + * { margin-top: 10px; }
.stack-3 > * + * { margin-top: 12px; }
.stack-3-5 > * + * { margin-top: 14px; }
.stack-4 > * + * { margin-top: 16px; }
.stack-5 > * + * { margin-top: 20px; }

.p-1 { padding: 4px; } .p-2 { padding: 8px; } .p-3 { padding: 12px; } .p-3-5 { padding: 14px; } .p-4 { padding: 16px; } .p-5 { padding: 20px; }
.px-2 { padding-left: 8px; padding-right: 8px; } .px-2-5 { padding-left: 10px; padding-right: 10px; }
.px-3 { padding-left: 12px; padding-right: 12px; } .px-3-5 { padding-left: 14px; padding-right: 14px; }
.px-4 { padding-left: 16px; padding-right: 16px; } .px-5 { padding-left: 20px; padding-right: 20px; }
.py-0-5 { padding-top: 2px; padding-bottom: 2px; } .py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-1-5 { padding-top: 6px; padding-bottom: 6px; } .py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; } .py-5 { padding-top: 20px; padding-bottom: 20px; }
.pt-2 { padding-top: 8px; } .pt-3 { padding-top: 12px; } .pb-1 { padding-bottom: 4px; } .pb-3 { padding-bottom: 12px; } .pb-5 { padding-bottom: 20px; }

.mt-0-5 { margin-top: 2px; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-2-5 { margin-top: 10px; }
.mb-0-5 { margin-bottom: 2px; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; }
.my-1-5 { margin-top: 6px; margin-bottom: 6px; } .my-2 { margin-top: 8px; margin-bottom: 8px; }
.neg-mt-1 { margin-top: -4px; }

.w-full { width: 100%; } .w-3 { width: 12px; } .w-4 { width: 16px; } .w-5 { width: 20px; } .w-6 { width: 24px; }
.w-8 { width: 32px; } .w-9 { width: 36px; } .w-11 { width: 44px; } .w-16 { width: 64px; } .w-24 { width: 96px; } .w-32 { width: 128px; }
.h-3 { height: 12px; } .h-4 { height: 16px; } .h-5 { height: 20px; } .h-8 { height: 32px; } .h-9 { height: 36px; } .h-11 { height: 44px; } .h-36 { height: 144px; }
.min-h-kpi { min-height: 152px; }
.max-w-arc { max-width: 190px; }
.max-w-modal { max-width: 672px; }
.max-w-sm-modal { max-width: 440px; }
.max-h-modal { max-height: 88vh; }

.rounded-lg { border-radius: 8px; } .rounded-xl { border-radius: 12px; } .rounded-2xl { border-radius: 16px; } .rounded-full { border-radius: 999px; }
.rounded-t-xl { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.overflow-hidden { overflow: hidden; } .overflow-y-auto { overflow-y: auto; }
.object-cover { object-fit: cover; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.text-center { text-align: center; } .text-left { text-align: left; }

.text-10 { font-size: 10px; } .text-11 { font-size: 11px; } .text-xs { font-size: 12px; } .text-sm { font-size: 14px; }
.text-base { font-size: 16px; } .text-xl { font-size: 20px; } .text-2xl { font-size: 24px; } .text-4xl { font-size: 36px; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; } .font-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; } .tracking-wider { letter-spacing: 0.05em; } .tracking-tight { letter-spacing: -0.025em; }
.leading-none { line-height: 1; } .leading-tight { line-height: 1.2; } .leading-relaxed { line-height: 1.55; }

.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-t-white-15 { border-top: 1px solid rgba(255,255,255,0.16); }

/* Semantic Colors */
.text-white { color: #ffffff; } .text-white-80 { color: rgba(255,255,255,0.82); } .text-white-70 { color: rgba(255,255,255,0.72); }
.text-teal-200 { color: #99f6e4; } .text-teal-100 { color: #ccfbf1; } .text-teal-600 { color: #0d9488; }
.text-blue-600 { color: #2563eb; } .text-violet-600 { color: #7c3aed; } .text-amber-600 { color: #d97706; } .text-amber-700 { color: #b45309; }
.text-emerald-600 { color: #059669; } .text-emerald-700 { color: #047857; } .text-rose-500 { color: #f43f5e; } .text-rose-600 { color: #e11d48; }
html[data-theme="dark"] .text-teal-600 { color: #2dd4bf; }
html[data-theme="dark"] .text-blue-600 { color: #60a5fa; }
html[data-theme="dark"] .text-violet-600 { color: #a78bfa; }
html[data-theme="dark"] .text-amber-600, html[data-theme="dark"] .text-amber-700 { color: #fbbf24; }
html[data-theme="dark"] .text-emerald-600, html[data-theme="dark"] .text-emerald-700 { color: #34d399; }
html[data-theme="dark"] .text-rose-600, html[data-theme="dark"] .text-rose-500 { color: #fb7185; }

.bg-white-15 { background: rgba(255,255,255,0.16); }
.bg-teal-400-25 { background: rgba(45,212,191,0.25); }
.bg-teal-500 { background: #14b8a6; } .bg-blue-500 { background: #3b82f6; } .bg-violet-500 { background: #8b5cf6; }
.bg-teal-soft { background: rgba(20,184,166,0.12); } .bg-blue-soft { background: rgba(59,130,246,0.12); }
.bg-violet-soft { background: rgba(139,92,246,0.12); } .bg-emerald-soft { background: rgba(16,185,129,0.14); }
.bg-amber-soft { background: rgba(245,158,11,0.14); } .bg-rose-soft { background: rgba(244,63,94,0.12); }
.bg-slate-soft { background: rgba(100,116,139,0.12); }
.bg-zone-teal { background: rgba(20,184,166,0.35); } .bg-zone-blue { background: rgba(59,130,246,0.35); }
.bg-ref-bar { background: rgba(148,163,184,0.45); }
.bg-bar-teal { background: linear-gradient(to top, #0d9488, #5eead4); }
.bg-bar-blue { background: linear-gradient(to top, #2563eb, #7dd3fc); }
.bg-bar-violet { background: linear-gradient(to top, #7c3aed, #d8b4fe); }

.btn-primary-blue { background: linear-gradient(90deg, #0ea5e9, #2563eb); color: #ffffff; box-shadow: 0 4px 12px rgba(37,99,235,0.25); }
.btn-emerald { background: #059669; color: #ffffff; }
.btn-teal { background: #0d9488; color: #ffffff; }
.btn-dark { background: #0f172a; color: #ffffff; }
html[data-theme="dark"] .btn-dark { background: #d99b43; color: #160f0a; }
.btn-amber { background: #f59e0b; color: #0f172a; }
.btn-blue { background: #2563eb; color: #ffffff; }
.modal-backdrop { background: rgba(2, 6, 23, 0.62); backdrop-filter: blur(4px); }
.border-rose-soft { border: 1px solid rgba(244, 63, 94, 0.35); }
.border-amber-soft { border: 1px solid rgba(245, 158, 11, 0.35); }
.shadow-md { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12); }

/* Responsive Breakpoints */
.sm-hidden { display: inline; }
.sm-inline { display: none; }
.lg-hidden-flex { display: flex; }
.lg-inline-flex { display: none; }

@media (min-width: 640px) {
  .sm-inline { display: inline; }
  .sm-flex-row { flex-direction: row; }
  .sm-items-center { align-items: center; }
  .sm-items-end { align-items: flex-end; }
  .sm-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm-grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .sm-col-span-5 { grid-column: span 5 / span 5; }
  .sm-col-span-3 { grid-column: span 3 / span 3; }
  .sm-col-span-2 { grid-column: span 2 / span 2; }
  .sm-inline-flex { display: inline-flex; }
  .sm-flex-none { flex: none; }
  .sm-text-3xl { font-size: 30px; }
  .sm-text-sm { font-size: 14px; }
  .sm-text-xs { font-size: 12px; }
  .sm-px-4 { padding-left: 16px; padding-right: 16px; }
  .sm-p-5 { padding: 20px; }
}

@media (min-width: 768px) {
  .md-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg-hidden-flex { display: none; }
  .lg-inline-flex { display: inline-flex; }
  .lg-flex-row { flex-direction: row; }
  .lg-items-center { align-items: center; }
  .lg-justify-between { justify-content: space-between; }
  .lg-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg-grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .lg-col-span-7 { grid-column: span 7 / span 7; }
  .lg-col-span-5 { grid-column: span 5 / span 5; }
}

/* Print */
/* Compact mobile install banner (hidden on desktop >= 1024px and in standalone mode) */
.install-banner {
  position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 45;
  max-width: 480px; margin: 0 auto;
  background: var(--bg-card); color: var(--text-main);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 10px 12px; box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
@media (min-width: 1024px) { .install-banner { display: none !important; } }
body.has-install-banner { padding-bottom: 84px; }
@media (min-width: 1024px) { body.has-install-banner { padding-bottom: 20px; } }

.print-only { display: none; }
.print-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.print-table th, .print-table td { border: 1px solid #cbd5e1; padding: 8px; }
.print-table th { background: #0f172a; color: #ffffff; }
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  html, body { background: #ffffff !important; color: #0f172a !important; }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
}
