:root {
  --green: #065f46;
  --green2: #064e3b;
  --deep: #022c22;
  --amber: #f59e0b;
  --bg: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --font: 'IBM Plex Sans Arabic', Cairo, system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 12px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button,
input,
select,
textarea {
  outline-offset: 3px;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--green);
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #a7f3d0;
  border-color: var(--green);
}
input,
select,
textarea {
  color: var(--text);
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  max-width: 100%;
  width: 100%;
}
textarea {
  resize: vertical;
  min-height: 64px;
}
input[type='checkbox'] {
  width: 14px;
  accent-color: var(--green);
  padding: 0;
}
input[type='number'] {
  min-width: 65px;
}
input[type='date'] {
  min-width: 140px;
}
label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  color: #334155;
}
.field {
  min-width: 0;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}
h2 {
  font-size: 14px;
}
h3,
h4 {
  font-size: 12px;
}
a {
  color: var(--green);
}
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 11px;
}
.strong {
  font-weight: 700;
}
.green {
  color: var(--green);
}
.red {
  color: #e11d48;
}
.amber {
  color: #92400e;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wrap {
  flex-wrap: wrap;
}
.space {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px #00000005;
}
.pad {
  padding: 20px;
}
.notice {
  padding: 12px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 10px;
  color: #92400e;
  font-size: 11px;
}
.pagehead {
  padding: 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.pagehead p {
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: white;
  color: #334155;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.btn:hover {
  background: #f1f5f9;
}
.btn.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 700;
  box-shadow: 0 1px 3px #0001;
}
.btn.primary:hover {
  background: var(--green2);
}
.btn.light {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.btn.light:hover {
  background: #d1fae5;
}
.btn.gold {
  background: #fffbeb;
  color: #78350f;
  border-color: #fcd34d;
}
.btn.purple {
  background: #faf5ff;
  color: #6b21a8;
  border-color: #e9d5ff;
}
.btn.sm {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge.amber {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
.badge.red {
  background: #fff1f2;
  border-color: #fda4af;
  color: #9f1239;
}
.badge.purple {
  background: #faf5ff;
  border-color: #e9d5ff;
  color: #6b21a8;
}
.tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: #f1f5f9;
  border-radius: 4px;
  color: #334155;
  display: inline-block;
}
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 288px;
  background: white;
  border-inline-end: 1px solid var(--border);
  z-index: 30;
  display: flex;
  flex-direction: column;
}
.brand {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc80;
  display: flex;
  align-items: center;
  gap: 12px;
}
.side-nav {
  flex: 1;
  overflow: auto;
  padding: 16px 12px;
}
.nav-group {
  margin-bottom: 4px;
}
.nav-item {
  border: 0;
  padding: 6px 12px;
  width: 100%;
  background: transparent;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: start;
  font-size: 12px;
  border-radius: 8px;
}
.nav-item:hover {
  background: #f1f5f9;
}
.nav-item.active {
  background: #065f46;
  color: white;
  box-shadow: 0 1px 2px #0001;
}
.layout {
  margin-inline-start: 288px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  height: 64px;
  min-height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 20;
}
kbd {
  font-family: inherit;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  color: #94a3b8;
  font-size: 10px;
  white-space: nowrap;
}
.main {
  padding: 32px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  flex: 1;
  min-width: 0;
}
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(to left, #064e3b, #022c22);
  padding: 24px;
  border-radius: 16px;
  color: white;
  box-shadow: 0 4px 6px #0001;
}
.hero h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.35;
}
.hero p {
  color: #d1fae5cc;
  font-size: 12px;
  margin-top: 4px;
}
.hero .date {
  color: #a7f3d0;
  font-size: 12px;
}
.hero .btn {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 12px;
}
.hero .btn.primary {
  background: #f59e0b;
  border: 0;
  color: #0f172a;
}
.hero .btn.light {
  background: #065f46;
  border-color: #059669;
  color: #fff;
}
.hero .btn.gold {
  background: #ffffff1a;
  border-color: #fff3;
  color: white;
}
.dash {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.stat {
  padding: 16px;
  border: 1px solid #e2e8f0e6;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-align: start;
}
.stat:hover {
  border-color: #6ee7b7;
  box-shadow: 0 4px 6px #0001;
}
.stat .caption {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}
.stat .symbol {
  padding: 6px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
}
.stat .value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 8px;
}
.charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.chart {
  padding: 16px;
  min-width: 0;
}
.chart h3 {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}
.bars {
  height: 144px;
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding-top: 16px;
}
.progress-row {
  margin-bottom: 8px;
}
.track {
  height: 8px;
  background: #f1f5f9;
  border-radius: 100px;
  overflow: hidden;
  margin-top: 4px;
}
.track > div {
  height: 100%;
  background: #d97706;
  border-radius: 100px;
}
.progress-row.blue .track {
  height: 6px;
}
.progress-row.blue .track > div {
  background: #0284c7;
}
.table-wrap {
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
  font-size: 12px;
}
.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr:hover {
  background: #f8fafccc;
}
.data-table .center {
  text-align: center;
}
.data-table .title-cell {
  font-weight: 700;
  color: #0f172a;
}
.data-table .sub-cell {
  display: block;
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}
.chip {
  border: 0;
  background: #f1f5f9;
  color: #475569;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.chip.active {
  background: #065f46;
  color: white;
}
.tabs {
  display: flex;
  align-items: center;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}
.tab.active {
  color: #064e3b;
  border-bottom-color: #065f46;
}
.workflow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.workflow > div {
  padding: 10px;
  text-align: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.step {
  width: 20px;
  height: 20px;
  background: #065f46;
  color: white;
  border-radius: 50%;
  margin: 0 auto 4px;
  font-size: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.clinic-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}
.visit-card {
  padding: 12px;
  background: #f8fafc80;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  margin-top: 8px;
}
.visit-card.active {
  border-color: #047857;
  background: #ecfdf5b3;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 12px;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #0f172a99;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.overlay.top {
  align-items: flex-start;
  padding-top: 64px;
}
.dialog {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 25px 50px #0004;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dialog.wide {
  max-width: 1024px;
}
.dialog-head {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.dialog-head h3 {
  font-size: 14px;
  font-weight: 700;
}
.dialog-body {
  padding: 24px;
  overflow: auto;
  min-height: 0;
}
.dialog-foot {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dialog .tabs {
  padding: 0 20px;
  flex-shrink: 0;
}
.dialog table th,
.dialog table td {
  padding: 10px;
}
.empty {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
}
.search-result {
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.search-result:hover {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.search-form {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.search-form input {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
  outline: 0;
}
.report-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.permissions .no {
  display: inline-flex;
  background: #f1f5f9;
  color: #cbd5e1;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.financial {
  max-width: 768px;
  margin: 0 auto;
  padding: 24px;
}
.fin-total {
  background: #064e3b;
  color: white;
  padding: 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.fin-total strong {
  color: #fcd34d;
}
.login {
  min-height: 100vh;
  background: #0f172a;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}
.print-workspace {
  padding: 32px;
  overflow: auto;
  flex: 1;
}
.paper {
  width: 210mm;
  max-width: 100%;
  min-height: 297mm;
  margin: 0 auto;
  background: white;
  color: #0f172a;
  box-shadow: 0 10px 25px #0003;
  border: 1px solid #cbd5e1;
  padding: 40px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.paper.compact {
  padding: 24px;
}
.paper.wide {
  padding: 56px;
}
.paper-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 2px solid #3c2527;
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.paper-head h1 {
  font-size: 20px;
  font-weight: 800;
  color: #b28a00;
}
.paper-head h2 {
  font-size: 14px;
}
.paper-logo {
  width: 60px;
  height: 60px;
  background: #3c2527;
  color: #c59a08;
  border: 2px solid #c59a08;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.paper-logo .icon {
  width: 38px;
  height: 38px;
}
.paper-label {
  background: #c59a08;
  color: #020617;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 8px;
}
.paper .terms {
  border: 1px solid #cbd5e1;
  padding: 12px;
  font-size: 11px;
  line-height: 1.8;
}
.paper .summary {
  border: 1px solid #cbd5e1;
  padding: 16px;
}
.paper .summary .spread {
  padding: 4px 0;
}
.paper .summary .total {
  font-weight: 800;
  border-top: 2px solid #3c2527;
  font-size: 14px;
  margin-top: 8px;
  padding-top: 8px;
}
.paper-foot {
  border-top: 2px solid #3c2527;
  margin-top: 24px;
  padding-top: 14px;
}
.paper-footer-note {
  border-top: 1px solid #e2e8f0;
  margin-top: 14px;
  padding-top: 8px;
  font-size: 9px;
  color: #64748b;
}
.paper.lab-paper {
  padding: 32px;
}
.lab-paper .paper-head {
  border-color: #022c22;
}
.lab-paper .paper-head h1 {
  color: #022c22;
  font-size: 18px;
}
.lab-paper .paper-logo {
  background: #064e3b;
  color: #fff;
  border-color: #047857;
  border-radius: 12px;
}
.lab-paper .paper-label {
  background: #022c22;
  color: #fff;
}
.lab-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  break-inside: avoid;
}
.lab-section h3 {
  background: #064e3b;
  color: white;
  padding: 6px 12px;
}
.lab-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.lab-section th {
  background: #f8fafc;
  padding: 8px;
  text-align: start;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
}
.lab-section td {
  padding: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.lab-section td small {
  display: block;
  color: #64748b;
  font-size: 9px;
}
.lab-section .badge {
  font-size: 9px;
  padding: 2px 5px;
}
#toasts {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  background: #064e3b;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px #0003;
  max-width: 400px;
}
.toast.error {
  background: #9f1239;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}
@media (max-width: 1279px) {
  .charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .workflow {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 1023px) {
  .sidebar {
    width: 250px;
  }
  .layout {
    margin-inline-start: 250px;
  }
  .main {
    padding: 24px;
  }
  .topbar {
    padding: 0 16px;
  }
  .pagehead {
    flex-direction: column;
    align-items: flex-start;
  }
  .clinic-layout {
    grid-template-columns: 1fr;
  }
  .clinic-list {
    display: flex;
    gap: 10px;
    overflow: auto;
  }
  .clinic-list > div {
    min-width: 240px;
  }
}
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(100%);
    transition: transform 0.2s;
    width: 288px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: -10px 0 25px #0003;
  }
  .layout {
    margin-inline-start: 0;
  }
  .topbar {
    height: 60px;
    min-height: 60px;
    padding: 0 12px;
    gap: 8px;
  }
  .main {
    padding: 20px 16px;
  }
  .hero {
    padding: 20px;
  }
  .hero h1 {
    font-size: 21px;
  }
  .hero .date {
    font-size: 10px;
  }
  .stat {
    padding: 12px;
  }
  .stat .caption {
    font-size: 11px;
  }
  .stat .value {
    font-size: 17px;
  }
  .charts {
    grid-template-columns: 1fr;
  }
  .grid3 {
    grid-template-columns: 1fr;
  }
  .grid2 {
    grid-template-columns: 1fr;
  }
  .dialog {
    max-height: 94vh;
  }
  .dialog-body {
    padding: 16px;
  }
  .dialog-head {
    padding: 14px;
  }
  .dialog-foot {
    flex-wrap: wrap;
  }
  .dialog-head .small {
    display: none;
  }
  .print-workspace {
    padding: 12px;
    overflow-x: auto;
  }
  .paper {
    width: 794px;
    max-width: none;
  }
  .workflow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-actions {
    flex-wrap: wrap;
  }
  .pagehead h1 {
    font-size: 19px;
  }
}
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #app,
  #toasts,
  .no-print,
  .overlay {
    display: none !important;
  }
  .print-workspace {
    padding: 0;
    overflow: visible;
    background: white;
  }
  .paper,
  .paper.compact,
  .paper.wide,
  .paper.lab-paper {
    border: 0;
    box-shadow: none;
    width: 100%;
    max-width: none;
    padding: 0;
    min-height: 0;
    display: block;
  }
  .paper .grid2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .paper-head {
    break-inside: avoid;
  }
  .lab-section {
    break-inside: auto;
  }
  .lab-section h3 {
    break-after: avoid;
  }
  .lab-section tr,
  .paper-foot {
    break-inside: avoid;
  }
  .lab-section thead {
    display: table-header-group;
  }
  .paper-footer-note {
    font-size: 9px;
  }
  button {
    display: none !important;
  }
}
