:root {
  --vc-navy: #1a2e44;
  --vc-navy-dark: #12212f;
  --vc-teal: #17a398;
  --vc-teal-hover: #149288;
  --vc-teal-active: #12857c;
  --vc-teal-bright: #4fd1c5;
  --vc-teal-dark: #17505c;
  --vc-teal-tint: #f0faf8;
  --vc-green: #2ecc71;
  --vc-red: #e74c3c;
  --vc-cerulean: #1a3f8f;
  --vc-cerulean-hover: #122d68;
}

/* Bootstrap's own root link color — this is what plain/inactive links fall
   back to (e.g. an inactive nav-pills tab like "Outpatient Queue" before it's
   selected), separately from the .btn-primary overrides above. Overriding it
   here at :root, after bootstrap.min.css, re-colors every clickable name/
   link across the app at once (patient names, invoice rows, etc.) rather
   than needing a rule per component. Deliberately cerulean blue, not the
   teal used for buttons/badges elsewhere — links need to read as distinct
   from the brand accent, not blend into it. */
:root {
  --bs-link-color: var(--vc-cerulean);
  --bs-link-color-rgb: 26, 63, 143;
  --bs-link-hover-color: var(--vc-cerulean-hover);
  --bs-link-hover-color-rgb: 18, 45, 104;
}

/* ===== Primary buttons/badges — teal instead of Bootstrap's default blue =====
   Bootstrap 5.3 sets these as literal per-component variables on .btn-primary
   itself (not derived from a root color at runtime), so they're overridden
   here rather than by changing a single root variable. This file loads after
   bootstrap.min.css, so same-specificity rules below win by source order. */
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--vc-teal);
  --bs-btn-border-color: var(--vc-teal);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--vc-teal-hover);
  --bs-btn-hover-border-color: var(--vc-teal-hover);
  --bs-btn-focus-shadow-rgb: 23, 163, 152;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--vc-teal-active);
  --bs-btn-active-border-color: var(--vc-teal-active);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--vc-teal);
  --bs-btn-disabled-border-color: var(--vc-teal);
}
.btn-outline-primary {
  --bs-btn-color: var(--vc-teal);
  --bs-btn-border-color: var(--vc-teal);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--vc-teal);
  --bs-btn-hover-border-color: var(--vc-teal);
  --bs-btn-focus-shadow-rgb: 23, 163, 152;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--vc-teal);
  --bs-btn-active-border-color: var(--vc-teal);
  --bs-btn-disabled-color: var(--vc-teal);
  --bs-btn-disabled-border-color: var(--vc-teal);
}
.badge.bg-primary {
  background-color: var(--vc-teal) !important;
}
/* Outline buttons (action bars like the patient chart's +Admit/+Invoice/
   +Lab Order row) — thicker border and bolder text than Bootstrap's
   default, same reasoning as .complaint-chip below: these are read and
   tapped quickly, often by someone standing at a workstation rather than
   sitting close to it, so they need to be legible at a glance. */
.btn-outline-primary, .btn-outline-secondary, .btn-outline-warning,
.btn-outline-success, .btn-outline-danger, .btn-outline-info, .btn-outline-dark {
  border-width: 2px;
  font-weight: 700;
}
/* Pill-style tab navs (e.g. Outpatient Queue / Active Admissions) —
   Bootstrap bakes this as a component variable on .nav-pills itself. */
.nav-pills {
  --bs-nav-pills-link-active-bg: var(--vc-teal);
}
/* Checked checkboxes/radios (e.g. Role Permissions grid) */
.form-check-input:checked {
  background-color: var(--vc-teal);
  border-color: var(--vc-teal);
}
.form-check-input:focus {
  border-color: var(--vc-teal-bright);
  box-shadow: 0 0 0 0.25rem rgba(23, 163, 152, 0.25);
}

body {
  background-color: #f4f6f9;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  background-color: var(--vc-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 3px;
}
.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
  color: #fff;
}
.brand-sub {
  font-size: 0.72rem;
  color: var(--vc-teal-bright);
  letter-spacing: 0.03em;
}

.sidebar-search {
  position: relative;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-search i {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
}
.sidebar-search input {
  width: 100%;
  background-color: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  padding: 7px 10px 7px 30px;
  font-size: 0.85rem;
}
.sidebar-search input::placeholder {
  color: rgba(255,255,255,0.5);
}
.sidebar-search input:focus {
  outline: none;
  border-color: var(--vc-teal-bright);
  background-color: rgba(255,255,255,0.12);
}

.sidebar-nav {
  list-style: none;
  padding: 10px 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}
.sidebar-nav > li > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.93rem;
  border-left: 3px solid transparent;
}
.sidebar-nav > li > a:hover,
.sidebar-nav > li > a.active {
  background-color: rgba(255,255,255,0.08);
  color: #fff;
  border-left-color: var(--vc-teal-bright);
}
.sidebar-nav .dropdown-toggle::after {
  content: "\f282";
  font-family: "bootstrap-icons";
  margin-left: auto;
  border: none;
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.sidebar-nav .dropdown-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}
.sub-nav {
  list-style: none;
  padding: 4px 0 4px 0;
  margin: 0;
  background-color: rgba(0,0,0,0.18);
}
.sub-nav li a {
  display: block;
  padding: 8px 18px 8px 46px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.86rem;
}
.sub-nav li a:hover {
  color: #fff;
  background-color: rgba(255,255,255,0.06);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
  color: #fff;
  font-size: 0.85rem;
}

.sidebar-toggle-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1040;
  background: var(--vc-navy);
  color: #fff;
  border-radius: 8px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1020;
}
.sidebar-backdrop.show { display: block; }

.main-content {
  margin-left: 250px;
  min-height: 100vh;
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding-top: 46px;
  }
}

/* ===== Vitals & Biometrics panel ===== */
.vitals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 6px;
}
.vital-box {
  background-color: #f4f6f9;
  border: 1px solid #e5e9ee;
  border-radius: 6px;
  padding: 5px 8px;
  height: 100%;
}
.vital-label {
  font-size: 0.62rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.vital-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1a2e44;
  line-height: 1.3;
  white-space: nowrap;
}
.vital-unit {
  font-size: 0.62rem;
  font-weight: 400;
  color: #6c757d;
}
.vital-abnormal {
  background-color: #fbe4e2;
  border-color: #d32f2f;
}
.vital-abnormal .vital-value {
  color: #d32f2f;
}

.permission-category {
  background-color: var(--vc-teal-tint);
  color: #1a2e44;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 1rem;
  border-left: 4px solid var(--vc-teal);
}

.page-header-bar {
  background-color: #1a2e44;
  color: #fff;
  padding: 16px 24px;
  border-radius: 12px;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header-bar h3, .page-header-bar h4 {
  color: #fff;
  margin-bottom: 0;
}
.page-header-bar .text-muted {
  color: rgba(255,255,255,0.65) !important;
}
.page-header-bar .btn-outline-secondary {
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}
.page-header-bar .btn-outline-secondary:hover {
  background-color: rgba(255,255,255,0.15);
  color: #fff;
}

.consult-header {
  background-color: #1a2e44;
  color: #fff;
  padding: 16px 24px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Symptom/duration/phrase chips on Outpatient Consultation — bolder text and
   thicker borders for readability, since these are tapped quickly and need
   to be easy to read at a glance, including for users with poor eyesight. */
.complaint-chip, .duration-chip, .phrase-chip {
  font-weight: 700;
  font-size: 0.95rem;
  border-width: 2px;
  color: #1a2e44;
}
.complaint-chip.active, .complaint-chip.btn-secondary {
  color: #fff;
}

/* Documentation & Records navigation cards on the patient chart */
.history-nav-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background-color: #f8fafc;
  color: #1a2e44;
  transition: all 0.15s ease;
  width: 100%;
}
.history-nav-card:hover {
  background-color: #fff;
  border-color: var(--vc-teal);
  box-shadow: 0 4px 14px rgba(23,163,152,0.18);
  transform: translateY(-2px);
  color: var(--vc-navy);
}
.history-nav-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--vc-navy) 0%, var(--vc-teal-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.consult-thumb {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  object-fit: cover;
}

.pharm-stat {
  border-radius: 10px;
  padding: 14px 16px;
  color: #fff;
  text-align: center;
}
.pharm-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}
.pharm-stat-label {
  font-size: 0.78rem;
  opacity: 0.9;
}
.pharm-stat-dark { background-color: #1a2e44; }
.pharm-stat-teal { background-color: #17a398; }
.pharm-stat-purple { background-color: #6f42c1; }
.pharm-stat-red { background-color: var(--vc-red); }
.pharm-stat-amber { background-color: #b8860b; }
.pharm-stat-green { background-color: var(--vc-green); }
.pharm-stat {
  cursor: pointer;
  transition: transform 0.1s ease;
}
.pharm-stat:hover {
  transform: translateY(-2px);
}
.pharm-stat-active {
  outline: 3px solid #fff;
  box-shadow: 0 0 0 5px rgba(26,46,68,0.5);
}

.mar-grid th, .mar-grid td {
  vertical-align: middle;
  padding: 8px;
}
.mar-cell {
  min-width: 90px;
}
.mar-given {
  background-color: #e6f7ec;
}
.mar-given .small.fw-bold {
  color: #1e7e34;
}
.mar-unavailable {
  background-color: #fff8e6;
}
.mar-unavailable .small.fw-bold {
  color: #b8860b;
}
.mar-discontinued {
  background-color: #fdecea;
}
.mar-discontinued .small.fw-bold {
  color: var(--vc-red);
}
.mar-pending {
  background-color: #fff8e6;
}
.mar-pending .small.fw-bold {
  color: #b8860b;
}
.btn-xs {
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.4;
  border-radius: 4px;
}

/* ===== Cards / tables ===== */
.card-stat {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.card-stat .stat-number {
  font-size: 2rem;
  font-weight: 700;
}
table.table thead {
  background-color: var(--vc-teal-tint);
}
.badge-status {
  text-transform: capitalize;
}

/* ===== Login ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--vc-navy-dark) 0%, var(--vc-navy) 55%, var(--vc-teal-dark) 100%);
}
.login-card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  max-width: 420px;
  width: 100%;
}
.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}
