:root {
  --app-primary: #0f766e;
  --app-primary-dark: #115e59;
  --bs-body-bg: #f5f7f8;
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color-rgb: 17, 94, 89;
}

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
}

.app-navbar {
  background-color: var(--app-primary);
}

.btn-primary {
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary-dark);
  --bs-btn-hover-border-color: var(--app-primary-dark);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
  --bs-btn-disabled-bg: var(--app-primary);
  --bs-btn-disabled-border-color: var(--app-primary);
}

.btn-outline-primary {
  --bs-btn-color: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary);
  --bs-btn-hover-border-color: var(--app-primary);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
}

.dropdown-item.active,
.dropdown-item:active,
.page-item.active .page-link {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

.btn:focus-visible,
.form-control:focus,
.form-select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.25);
}

.card {
  border: 0;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

.card-link-tile {
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card-link-tile:hover,
.card-link-tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.12);
}

.tile-count {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--app-primary);
}

.login-card {
  max-width: 26rem;
  margin: 8vh auto 0;
}

/* International codes are always written left to right, also inside right-to-left pages. */
.code {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: Consolas, "Courier New", monospace;
  white-space: nowrap;
}

.table > :not(caption) > * > * {
  vertical-align: middle;
}

.otp-input {
  width: 9rem;
  font-size: 1.25rem;
  letter-spacing: 0.3em;
  text-align: center;
}

.new-code {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: 0.3em;
}

/* Keeps the line breaks the doctor typed. */
.pre-line {
  white-space: pre-line;
}

.lookup-results {
  z-index: 1000;
  max-height: 18rem;
  overflow-y: auto;
}

/* A result shown under the request it answers. */
.result-box {
  padding-inline-start: 0.75rem;
  border-inline-start: 3px solid var(--app-primary);
}

/* The patient's latest events as a vertical line with a dot per event, newest at the top. */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-event {
  position: relative;
  padding-inline-start: 1.75rem;
  padding-bottom: 1.25rem;
  border-inline-start: 2px solid #d5dde0;
  margin-inline-start: 0.5rem;
}

.timeline-event:last-child {
  padding-bottom: 0;
  border-inline-start-color: transparent;
}

.timeline-event::before {
  content: "";
  position: absolute;
  inset-inline-start: -0.5rem;
  top: 0.2rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid #fff;
  background-color: var(--timeline-color, var(--app-primary));
  box-shadow: 0 0 0 2px var(--timeline-color, var(--app-primary));
}

.timeline-Visit { --timeline-color: #0f766e; }
.timeline-Vitals { --timeline-color: #2563eb; }
.timeline-LabResult { --timeline-color: #7c3aed; }
.timeline-RadiologyResult { --timeline-color: #475569; }
.timeline-Dispensing { --timeline-color: #b45309; }
.timeline-History { --timeline-color: #be123c; }

.timeline-kind {
  color: #fff;
  background-color: var(--timeline-color, var(--app-primary));
}

/* The steps of the visit form: numbered tabs, the current one filled, the ones already used ticked. */
.visit-steps {
  gap: 0.5rem;
}

.visit-steps .nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  color: #475569;
  background-color: #fff;
  border: 1px solid #d5dde0;
  border-radius: 2rem;
  padding: 0.45rem 1rem 0.45rem 0.6rem;
}

[dir="rtl"] .visit-steps .nav-link {
  padding: 0.45rem 0.6rem 0.45rem 1rem;
}

.visit-steps .nav-link:hover {
  border-color: var(--app-primary);
}

.visit-steps .nav-link.active {
  color: #fff;
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

.visit-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  background-color: #e8edef;
}

.visit-steps .nav-link.is-filled .visit-step-number {
  color: #fff;
  background-color: #16a34a;
}

.visit-steps .nav-link.active .visit-step-number {
  color: var(--app-primary);
  background-color: #fff;
}

.visit-step-count {
  color: var(--app-primary);
  background-color: #d7efec;
}

.vital-tile {
  height: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid #d5dde0;
  border-radius: 0.6rem;
  background-color: #fbfcfc;
}

.vital-tile .form-control,
.vital-output {
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
}

.vital-tile .form-control::placeholder {
  font-weight: 400;
  color: #c3cdd1;
}

.vital-output {
  display: block;
  padding: 0.375rem 0;
  color: #475569;
}

.vital-tile-readonly {
  background-color: #f1f5f6;
}

.visit-review-block {
  padding: 0.9rem 0;
  border-top: 1px solid #e8edef;
}

.visit-review-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.visit-review-line {
  padding: 0.35rem 0.75rem;
  margin-top: 0.35rem;
  border-inline-start: 3px solid var(--app-primary);
}

/* The shortcuts at the top of a patient file, and the arrow back to the top of any page. */
html {
  scroll-behavior: smooth;
}

#timeline,
#visits,
#history {
  scroll-margin-top: 1rem;
}

.quick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 7.25rem;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--app-primary-dark);
  text-decoration: none;
  background-color: #fff;
  border: 1px solid #d5dde0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.quick-tile:hover,
.quick-tile:focus-visible {
  color: var(--app-primary-dark);
  border-color: var(--app-primary);
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18);
  transform: translateY(-2px);
}

.quick-tile svg,
.back-to-top svg {
  width: 1.7rem;
  height: 1.7rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-tile-primary,
.quick-tile-primary:hover,
.quick-tile-primary:focus-visible {
  color: #fff;
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

.back-to-top {
  position: fixed;
  inset-inline-end: 1.5rem;
  bottom: 1.5rem;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: #fff;
  background-color: var(--app-primary);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top:hover {
  background-color: var(--app-primary-dark);
}

.dispense-cell {
  min-width: 11rem;
}

.qr-image {
  image-rendering: pixelated;
}

/* Printing a patient file prints only the card with the QR code. */
@media print {
  header,
  .alert,
  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  body {
    background: #fff;
  }

  .patient-card {
    max-width: 8cm;
    border: 1px solid #000;
    box-shadow: none;
  }
}
