html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f3f6fa;
  color: #1e293b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (min-width: 768px) {
  form.row.g-3:has([name="NewDoctorVisit.VisitedOn"]) > div:nth-of-type(-n+4),
  form.row.g-3:has([name="NewVaccination.VaccinationId"]) > div:nth-of-type(-n+4) {
    flex: 0 0 auto;
    width: 25%;
  }

  form.row.g-3:has([name^="NewCondition."]) > div:nth-of-type(-n+3),
  tr[id^="editCondition-"] form.row > div.col-md-3,
  tr[id^="editCondition-"] form.row > div.col-md-4,
  tr[id^="editCondition-"] form.row > div.col-md-5 {
    flex: 0 0 auto;
    width: 33.333333%;
  }

  tr[id^="editVaccination-"] form.row > div:nth-of-type(-n+4),
  tr[id^="editVisit-"] form.row > div:nth-of-type(-n+4) {
    flex: 0 0 auto;
    width: 25%;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus, .form-select:focus {
  box-shadow: 0 0 0 0.15rem #ffffff, 0 0 0 0.25rem #3b82f6;
  border-color: #3b82f6;
}

.navbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%) !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-link {
  font-weight: 500;
  padding: 0.5rem 0.85rem !important;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.22);
  font-weight: 600;
}

@media (max-width: 991.98px) {
  .navbar-brand {
    min-width: 0;
    flex: 1;
    margin-right: 0.5rem;
  }

  .navbar-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-account-toggle,
  .navbar-toggler {
    min-width: 44px;
    min-height: 44px;
  }

  .app-navigation {
    --bs-offcanvas-width: min(360px, 100vw);
    color: #1e293b;
  }

  .app-navigation .offcanvas-header {
    border-bottom: 1px solid #e2e8f0;
  }

  .app-navigation .btn-close {
    padding: 0.875rem;
  }

  .app-navigation .navbar-nav,
  .app-navigation .nav-item {
    width: 100%;
    align-items: stretch !important;
  }

  .app-navigation .nav-link,
  .app-navigation .dropdown-item {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    color: #1e293b;
    white-space: normal;
  }

  .app-navigation .nav-link:hover,
  .app-navigation .dropdown-item:hover {
    background: #eff6ff;
  }

  .app-navigation .nav-link.active,
  .app-navigation .dropdown-item.active {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
  }

  .app-navigation .dropdown-menu {
    display: flex;
    flex-direction: column;
    position: static !important;
    transform: none !important;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none !important;
  }

  .mobile-nav-heading {
    margin: 1rem 0 0.35rem;
    padding: 0.5rem 0.85rem;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 700;
  }

  .mobile-account-logout {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
  }

  .app-navigation [role="search"] {
    margin-top: 1rem;
  }

  .app-navigation [role="search"] .form-control,
  .app-navigation [role="search"] .btn {
    min-height: 44px;
  }

  .app-navigation [role="search"] .btn {
    color: #1e40af;
    border-color: #93c5fd;
  }
}

.card {
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-header {
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 9px 9px 0 0 !important;
  padding: 0.7rem 1rem;
  background-color: #ffffff;
  font-weight: 600;
}

.stat-card {
  border-radius: 14px;
  background: #ffffff;
  padding: 0.9rem 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  border-left: 4px solid #3b82f6;
}

.stat-card.stat-success { border-left-color: #10b981; }
.stat-card.stat-warning { border-left-color: #f59e0b; }
.stat-card.stat-danger { border-left-color: #ef4444; }
.stat-card.stat-purple { border-left-color: #8b5cf6; }
.stat-card.stat-teal { border-left-color: #14b8a6; }

.js-background-job-stack {
  width: min(380px, 100vw);
  z-index: 1100;
  pointer-events: none;
}

.js-background-job-notice {
  width: 100%;
  max-width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid #d6e1ef;
  border-left: 3px solid #147d91;
  border-radius: 8px;
  background: #fff;
  color: #1e293b;
  box-shadow: 0 10px 28px rgba(20, 40, 70, 0.16);
  cursor: pointer;
  pointer-events: auto;
}

.js-background-job-notice[data-state="success"] { border-left-color: #16815b; }
.js-background-job-notice[data-state="error"] { border-left-color: #bc4949; }
.js-background-job-notice .js-background-job-icon { color: #147d91; font-size: 1.3rem; }
.js-background-job-notice[data-state="success"] .js-background-job-icon { color: #16815b; }
.js-background-job-notice[data-state="error"] .js-background-job-icon { color: #bc4949; }
.js-background-job-notice .js-background-job-message { overflow-wrap: anywhere; }
.js-background-job-notice .js-background-job-actions:empty { display: none; }

@media (max-width: 480px) {
  .js-background-job-stack { width: 100%; }
}

.dashboard-widget-option {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  cursor: grab;
}

.dashboard-widget-settings {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 0.5rem;
  padding: 0.5rem 0 0 2rem;
  cursor: default;
}

.dashboard-widget-settings > label {
  display: block;
  min-width: 0;
  overflow: hidden;
}

.dashboard-widget-settings .dashboard-widget-filters {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
}

.dashboard-widget-settings .form-check {
  min-width: 0;
  margin: 0;
  padding: 0.25rem 0;
  white-space: nowrap;
}

.dashboard-widget-option + .dashboard-widget-option {
  margin-top: 0.5rem;
}

.dashboard-widget-option:active {
  cursor: grabbing;
}

.dashboard-widget-surface {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.dashboard-kpi-link {
  position: relative;
}

.dashboard-kpi-link:hover {
  background-color: #f8fafc;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
}

.dashboard-kpi-link:focus-within {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}

.app-content {
  max-width: 1600px;
}

.app-content main > .d-flex h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
}

.grid-toolbar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.dashboard-widget-surface .dashboard-widget.mb-4 {
  margin-bottom: 0 !important;
}

.dashboard-widget-surface .card-header {
  padding: 0.65rem 0.85rem;
}

.dashboard-health-status-grid {
  padding-top: 0.75rem;
}

.app-content .table-responsive {
  position: relative;
  max-width: 100%;
  overscroll-behavior-x: contain;
}

.dashboard-widget-surface .list-group-item {
  padding: 0.6rem 0.85rem !important;
  gap: 0.75rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-widget-surface .list-group-item > span:first-child {
  min-width: 0;
}

.dashboard-widget-surface time {
  flex-shrink: 0;
}

.dashboard-widget-surface .dashboard-attention-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  max-height: 23rem;
  overflow-y: auto;
}

.dashboard-attention-list .list-group-item {
  border-width: 0 0 1px;
}

.adherence-trends,
.adherence-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.adherence-trends > div,
.adherence-metrics > div {
  min-width: 0;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.adherence-trends strong {
  display: block;
  font-size: 1rem;
}

.adherence-metrics dt {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.adherence-metrics dd {
  margin: 0.25rem 0 0;
  font-weight: 650;
  font-size: 1.15rem;
}

@media (min-width: 1200px) {
  .adherence-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .adherence-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .adherence-trends {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .adherence-trends > div {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    border-radius: 0;
  }

  .app-content main > .d-flex .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .grid-toolbar .btn {
    min-width: 44px;
    min-height: 44px;
  }

  .dashboard-widget-surface .btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .dashboard-widget-surface .list-group-item {
    min-height: 44px;
  }
}

.dashboard-widget-title,
.dashboard-widget-surface .dashboard-widget .card-header strong {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.dashboard-widget-state {
  padding: 0.8rem 1rem;
  text-align: center;
}

.text-purple { color: #6b21a8; }

.btn-outline-purple {
  color: #6b21a8;
  border-color: #c084fc;
}

.btn-outline-purple:hover,
.btn-outline-purple:focus-visible {
  color: #ffffff;
  background-color: #7e22ce;
  border-color: #7e22ce;
}

.dashboard-suggestions-toggle {
  position: relative;
  padding-right: 1.5rem !important;
}

.dashboard-suggestions-chevron {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.dashboard-widget-surface > .dashboard-widget-item {
  grid-column: span 12;
  min-width: 0;
}

.dashboard-widget-surface > .dashboard-widget-item[data-dashboard-widget^="kpi-"] {
  grid-column: span 3;
}

.dashboard-widget-surface > .dashboard-widget-item[data-dashboard-widget="therapies"],
.dashboard-widget-surface > .dashboard-widget-item[data-dashboard-widget="recent-exams"],
.dashboard-widget-surface > .dashboard-widget-item[data-dashboard-widget="vaccinations"],
.dashboard-widget-surface > .dashboard-widget-item[data-dashboard-widget="goals"] {
  grid-column: span 6;
}

.dashboard-widget-surface > .dashboard-widget-item[data-widget-width="quarter"] {
  grid-column: span 3;
}

.dashboard-widget-surface > .dashboard-widget-item[data-widget-width="half"] {
  grid-column: span 6;
}

.dashboard-widget-surface > .dashboard-widget-item[data-widget-width="full"] {
  grid-column: span 12;
}

.dashboard-widget-surface .stat-card {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-widget-surface .row {
  min-width: 0;
}

.dashboard-widget-surface .table-responsive {
  max-width: 100%;
}

.dashboard-summary-item {
  display: flex;
  min-height: 4.5rem;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.dashboard-customize-dialog {
  height: calc(100vh - 2rem);
  max-height: calc(100vh - 2rem);
  max-width: 760px;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.dashboard-customize-dialog .modal-content {
  display: flex;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.dashboard-customize-dialog form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.dashboard-customize-dialog .modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.dashboard-customize-dialog .modal-footer {
  flex: 0 0 auto;
}

@media (max-width: 575.98px) {
  .dashboard-customize-dialog {
    height: calc(100vh - 1rem);
    max-height: calc(100vh - 1rem);
    max-width: calc(100vw - 1rem);
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .dashboard-widget-surface {
    display: block;
  }

  .dashboard-widget-surface > .dashboard-widget-item {
    margin-bottom: 1rem;
  }

  .dashboard-widget-settings {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
    padding-left: 0;
  }

  .dashboard-widget-settings .dashboard-widget-filters {
    grid-column: auto;
  }
}

.reports-breadcrumb .breadcrumb {
  font-size: 0.875rem;
}

.reports-page-intro {
  max-width: 52rem;
}

.reports-page-stack {
  display: grid;
  gap: 1.25rem;
}

.reports-tabs {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.reports-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.6rem 0.75rem 0;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.reports-tab-list .nav-link {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  color: #475569;
  font-weight: 600;
}

.reports-tab-list .nav-link:hover,
.reports-tab-list .nav-link:focus-visible {
  color: #1d4ed8;
  background: #eff6ff;
}

.reports-tab-list .nav-link.active {
  border-bottom-color: #2563eb;
  color: #1d4ed8;
  background: #ffffff;
}

.reports-tab-content > .tab-pane {
  padding: 1.25rem;
}

.reports-tab-content .reports-section {
  border: 0;
  box-shadow: none;
}

.reports-tab-content .reports-section-heading {
  margin: -1.25rem -1.25rem 0;
}

.reports-section {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.reports-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.reports-section-heading h2 {
  margin: 0.2rem 0 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.reports-section-kicker {
  display: block;
  color: #2563eb;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reports-section-kicker i {
  margin-right: 0.4rem;
}

.reports-format-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #475569;
  background: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
}

.reports-panel {
  padding: 1.25rem;
}

.report-preview-loading {
  width: min(100%, 760px);
  margin-inline: auto;
  padding: 1.5rem 0 1.25rem;
  border-top: 1px solid #dbe5ed;
}

.report-preview-loading-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.report-preview-loading-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  height: 42px;
  border-radius: 6px;
  color: #137c73;
  background: #e6f3f0;
  font-size: 1.2rem;
}

.report-preview-loading-title {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.report-preview-loading-text { color: #56687a; font-size: 0.875rem; }
.report-preview-loading .spinner-border { color: #137c73; width: 1rem; height: 1rem; }
.report-preview-loading-error .report-preview-loading-icon { color: #aa3e43; background: #f9ecec; }
.report-preview-loading-error .report-preview-loading-text { color: #9b3038; }

.report-preview-skeleton {
  display: grid;
  gap: 0.65rem;
  margin: 1.35rem 0 0 3.55rem;
}

.report-preview-skeleton[hidden] { display: none; }
.report-preview-skeleton-line {
  display: block;
  width: 67%;
  height: 0.65rem;
  border-radius: 3px;
  background: linear-gradient(90deg, #e5edf2 25%, #f2f6f8 50%, #e5edf2 75%);
  background-size: 200% 100%;
  animation: report-preview-shimmer 2s ease-in-out infinite;
}

.report-preview-skeleton-line-wide { width: 92%; }
.report-preview-skeleton-line-short { width: 43%; }

@keyframes report-preview-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .report-preview-skeleton-line { animation: none; }
}

.reports-export-list {
  display: grid;
  gap: 0.65rem;
}

.reports-export-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.reports-export-item strong,
.reports-export-item span {
  display: block;
}

.reports-export-item strong {
  color: #1e293b;
}

.reports-export-item strong i {
  width: 1.25rem;
  margin-right: 0.45rem;
  text-align: center;
}

.reports-export-item span {
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.8125rem;
}

.reports-export-actions,
.reports-export-actions form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reports-icon-purple {
  color: #7e22ce;
}

@media (max-width: 767.98px) {
  .reports-tab-list {
    flex-direction: column;
    padding: 0.5rem;
  }

  .reports-tab-list .nav-link {
    width: 100%;
    border-bottom: 0;
    border-left: 3px solid transparent;
    border-radius: 6px;
    text-align: left;
  }

  .reports-tab-list .nav-link.active {
    border-left-color: #2563eb;
  }

  .reports-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .reports-export-item,
  .reports-export-actions,
  .reports-export-actions form {
    align-items: stretch;
    flex-direction: column;
  }

  .reports-export-item .btn {
    width: 100%;
  }
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table td, .table th {
  vertical-align: middle;
  padding: 0.55rem 0.75rem;
}

.table thead th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.875rem;
  border-bottom: 1px solid #e2e8f0;
}

.table thead th.js-sortable-column {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.table thead th.js-sortable-column:hover,
.table thead th.js-sortable-column:focus-visible {
  background-color: #eef2f7;
  color: #1d4ed8;
  outline: none;
}

.js-sort-indicator {
  margin-left: 0.3rem;
  color: #94a3b8;
  font-size: 0.75rem;
}

[aria-sort="ascending"] .js-sort-indicator,
[aria-sort="descending"] .js-sort-indicator {
  color: #2563eb;
}

.table thead .js-column-filters th {
  padding: 0.4rem 0.5rem;
  background-color: #ffffff;
}

.js-column-filter {
  min-width: 7rem;
  font-weight: 400;
}

.vitals-chart-container {
  position: relative;
  width: 100%;
  height: clamp(18rem, 42vh, 30rem);
}

.vitals-chart-mode-group {
  display: flex;
  flex-wrap: wrap;
}

.badge-normal {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-abnormal {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-weight: 600;
}

.badge-warning-custom {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.trend-up {
  color: #dc2626;
  font-weight: 600;
}

.trend-down {
  color: #2563eb;
  font-weight: 600;
}

.trend-stable {
  color: #64748b;
}

.footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.btn {
  border-radius: 8px;
  font-weight: 500;
  padding: 0.45rem 0.95rem;
}

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.btn-icon {
  box-sizing: border-box;
  display: inline-flex;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  line-height: 1;
}

.btn-icon > .bi {
  display: block;
  font-size: 1rem;
  line-height: 1;
}

.clinical-share-header h2 {
  letter-spacing: -0.02em;
}

.clinical-share-readonly {
  display: inline-flex;
  align-items: center;
  max-width: 24rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background-color: #eff6ff;
  color: #1d4ed8;
  font-size: 0.8125rem;
  font-weight: 600;
}

.clinical-share-notice {
  padding: 1rem 1.15rem;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background-color: #ecfeff;
  color: #155e75;
}

.clinical-share-notice-icon {
  color: #0284c7;
  font-size: 1.2rem;
}

.clinical-share-section {
  overflow: hidden;
}

.clinical-share-section .card-header {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.25rem;
  color: #1e293b;
}

.clinical-share-profile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.clinical-share-profile span,
.clinical-share-list {
  color: #64748b;
}

.clinical-share-table {
  min-width: 42rem;
}

.clinical-share-history-area {
  color: #1e293b;
}

.clinical-share-table tbody tr:last-child td {
  border-bottom: 0;
}

.clinical-share-audit-list {
  padding-left: 1.25rem;
}

.clinical-share-audit-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  padding: 0.45rem 0;
}

.clinical-share-list ul {
  padding-left: 1.25rem;
}

.clinical-share-list li + li {
  margin-top: 0.45rem;
}

@media (max-width: 767.98px) {
  .stat-card .stat-label {
    align-items: flex-start !important;
    flex-wrap: wrap;
    gap: 0.35rem !important;
    overflow-wrap: anywhere;
  }

  .stat-card .stat-label > span:first-child {
    flex: 1 1 100%;
  }

  .stat-card .stat-label .badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .vitals-chart-mode-group {
    width: 100%;
  }

  .vitals-chart-mode-group .btn {
    flex: 1 1 auto;
  }

  .clinical-share-readonly {
    max-width: none;
  }

  .clinical-share-table {
    min-width: 36rem;
  }
}

.health-history-tabs table.js-paginated > tbody > tr:not(.collapse) > td:last-child {
  white-space: nowrap;
}

.health-history-tabs table.js-paginated > tbody > tr:not(.collapse) td form.d-inline {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0;
}

main > div:first-of-type h1:first-of-type,
main > div:first-of-type h2:first-of-type {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

main > div:first-of-type h1:first-of-type > .bi,
main > div:first-of-type h2:first-of-type > .bi {
  vertical-align: 0.04em;
}

.table td.text-end {
  white-space: nowrap;
}

.table td.text-end > * {
  vertical-align: middle;
}

.table td.text-end > form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.table td.text-end > .btn,
.table td.text-end > form > .btn {
  box-sizing: border-box;
  display: inline-flex;
  min-width: 2.5rem;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.table tbody > tr.collapse form.row.g-2,
.table tbody > tr.collapse form > .row.g-2 {
  align-items: flex-end;
}

.table-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  margin: 0;
  vertical-align: middle;
}

.table-actions > form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.table-actions .me-1,
.table-actions .me-2 {
  margin-right: 0 !important;
}

.table-actions .btn {
  box-sizing: border-box;
  display: inline-flex;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  vertical-align: middle;
}

.table-actions .btn > .bi {
  display: block;
  font-size: 1rem;
  line-height: 1;
}

.table-actions .btn.table-action-text {
  width: auto;
  padding-inline: 0.65rem;
  gap: 0.25rem;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .table-actions .btn {
    min-width: 44px;
    min-height: 44px;
  }
}

.table-row-action > .bi,
.table td.text-end .btn > .bi,
.table .btn-group > .btn > .bi {
  font-size: 1rem;
  line-height: 1;
}

.table-row-action {
  box-sizing: border-box;
  display: inline-flex;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
}

.table td.text-end .btn-group {
  gap: 0.25rem;
}

.table td.text-end .btn-group > .btn {
  border-radius: 0.375rem;
}

.health-history-tabs table.js-paginated > tbody > tr:not(.collapse) td .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.25rem 0.6rem;
  line-height: 1;
  vertical-align: middle;
}

.health-history-tabs table.js-paginated > tbody > tr:not(.collapse) > td:last-child,
.health-history-tabs #visits table.js-paginated > tbody > tr:not(.collapse) > td:nth-last-child(3) {
  display: flex;
  align-items: center;
  min-height: 4.25rem;
  gap: 0.25rem;
}

.health-history-tabs table.js-paginated > tbody > tr:not(.collapse) > td:last-child {
  justify-content: flex-end;
}

.health-history-tabs table.js-paginated > tbody > tr:not(.collapse) > td:last-child form.d-inline,
.health-history-tabs #visits table.js-paginated > tbody > tr:not(.collapse) > td:nth-last-child(3) .d-flex,
.health-history-tabs #visits table.js-paginated > tbody > tr:not(.collapse) > td:nth-last-child(3) form.d-inline {
  margin: 0;
}

.health-history-tabs table.js-paginated > tbody > tr.collapse.show {
  display: table-row;
}

.health-history-tabs table.js-paginated > tbody > tr.collapsing {
  display: table-row;
  height: auto !important;
  overflow: visible;
  transition: none;
}

.document-center .text-bg-light {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
}

.badge.document-ocr-status {
  background-color: #e2e8f0;
  color: #1e293b;
  border: 1px solid #64748b;
  white-space: normal;
  text-align: left;
  line-height: 1.4;
}

.document-center .text-bg-success {
  background-color: #198754 !important;
  color: #ffffff !important;
}

.document-center .btn-group .btn {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-width: 2.25rem;
}

.document-center .btn-group .btn i {
  color: currentColor;
  opacity: 1;
}

.document-center {
  overflow: hidden;
  border-color: #dce4ed;
  border-radius: 0.75rem;
}

.document-center .document-list thead th {
  padding: 0.85rem 0.9rem;
  background: #f4f7fb;
  border-bottom-color: #dfe6ee;
  color: #42566d;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.document-center .document-list tbody td {
  padding: 0.9rem;
  border-color: #e8edf2;
}

.document-center .document-list tbody tr:hover > * {
  background: #f8faff;
}

.document-center .document-file-name {
  max-width: 34rem;
  overflow-wrap: anywhere;
  color: #20364d;
  font-weight: 600;
  line-height: 1.35;
}

.document-center .document-file-meta {
  display: block;
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.82rem;
}

.document-center .document-tag-list {
  margin-top: 0.35rem;
  overflow-wrap: anywhere;
}

.document-center-filter,
.document-edit-card,
.document-replace-card,
.document-ocr-card {
  overflow: hidden;
  border-color: #dce4ed;
  border-radius: 0.75rem;
}

.document-center-filter .card-body {
  padding: 1.1rem 1.2rem;
}

.document-file-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid #dce4ed;
  border-left: 4px solid #0d6efd;
  border-radius: 0.75rem;
  background: #f5f8fc;
}

.document-file-summary-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.document-file-icon {
  display: inline-flex;
  flex: 0 0 2.75rem;
  width: 2.75rem;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  background: #e6efff;
  color: #0d6efd;
  font-size: 1.25rem;
}

.document-file-copy {
  min-width: 0;
}

.document-file-summary .document-file-name {
  overflow-wrap: anywhere;
  color: #20364d;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
}

.document-file-summary .document-file-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  color: #64748b;
  font-size: 0.84rem;
}

.document-file-version {
  margin-left: 0.35rem;
  padding-left: 0.7rem;
  border-left: 1px solid #cbd5e1;
}

.document-edit-card .card-header,
.document-replace-card .card-header,
.document-ocr-card .card-header {
  padding: 0.9rem 1.15rem;
  border-bottom-color: #e3e9f0;
  background: #f4f7fb;
  color: #20364d;
}

.document-edit-card .card-body {
  padding: 1.25rem;
}

.document-edit-section + .document-edit-section {
  margin-top: 1.4rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e5eaf0;
}

.document-section-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.9rem;
  color: #334b63;
  font-size: 0.95rem;
  font-weight: 600;
}

.document-replace-card .card-body {
  padding: 1.1rem 1.15rem;
}

.document-ocr-card {
  margin-top: 1rem !important;
}

.saas-subscriptions-table .saas-actions {
  width: 28rem;
  min-width: 22rem;
}

.saas-plan-form,
.saas-billing-form {
  display: grid;
  grid-template-columns: minmax(10rem, 1.1fr) minmax(8rem, 1fr) 2rem;
  align-items: center;
  gap: 0.5rem;
  max-width: 28rem;
}

.saas-plan-form .form-select,
.saas-billing-form .form-control {
  min-width: 0;
}

.saas-plan-form .btn,
.saas-billing-form .btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
}

@media (max-width: 575.98px) {
  .document-file-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-file-summary > .btn {
    width: 100%;
  }

  .document-edit-card .card-body {
    padding: 1rem;
  }
}

/* Modal più largo su schermi ≥ lg (≥992px) per dare più respiro ai campi dei form */
@media (min-width: 992px) {
  .modal-form {
    max-width: 900px;
  }
}

@media (min-width: 1200px) {
  .modal-form {
    max-width: 1000px;
  }
}

/* The authenticated theme changes presentation without replacing clinical views or grid contracts. */
.app-shell {
  --app-navy: #123449;
  --app-navy-deep: #0c2637;
  --app-teal: #0f766e;
  --app-teal-soft: #eaf5f3;
  --app-ink: #1d3443;
  --app-muted: #526876;
  --app-line: #dceaf0;
  --app-accent: #0f766e;
  --app-tint: #eaf7f4;
  --bs-body-color: var(--app-ink);
  --bs-body-bg: #fff;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #245ea5;
  --bs-link-color-rgb: 36, 94, 165;
  --bs-link-hover-color: #174979;
  --bs-link-hover-color-rgb: 23, 73, 121;
  --bs-border-color: var(--app-line);
  background: #f1f7fb;
  color: var(--app-ink);
}

.app-shell[data-app-area="Vitals"],
.app-shell[data-app-area="HealthTimeline"] { --app-accent: #2164a1; --app-tint: #eaf4fe; }
.app-shell[data-app-area="Therapies"],
.app-shell[data-app-area="Reminders"],
.app-shell[data-app-area="Appointments"] { --app-accent: #946200; --app-tint: #fff6e3; }
.app-shell[data-app-area="Exams"],
.app-shell[data-app-area="Documents"],
.app-shell[data-app-area="RadiologyArchives"] { --app-accent: #7051b2; --app-tint: #f3edfc; }

.app-shell .navbar {
  background: var(--app-navy-deep) !important;
  border-bottom: 3px solid var(--app-teal);
  box-shadow: 0 3px 16px rgba(18, 52, 73, 0.1);
  padding-block: 0.85rem;
}

.app-shell .navbar-brand { letter-spacing: -0.035em; }
.app-shell .navbar-brand > .bi { color: #83d7ca !important; }
.app-shell .navbar .nav-link { font-size: 0.875rem; }
.app-shell .navbar .nav-link.active { background: rgba(255, 255, 255, 0.12); }
.app-shell .dropdown-menu {
  --bs-dropdown-link-hover-bg: #f0f6f5;
  --bs-dropdown-link-active-bg: var(--app-teal-soft);
  --bs-dropdown-link-active-color: #115c55;
  --bs-dropdown-color: var(--app-ink);
  --bs-dropdown-link-color: var(--app-ink);
  --bs-dropdown-border-color: var(--app-line);
  --bs-dropdown-border-radius: 0.75rem;
  padding: 0.5rem;
}

.app-shell .dropdown-item {
  padding: 0.55rem 0.75rem;
  border-radius: 0.4rem;
  font-size: 0.875rem;
}

.app-shell .mobile-nav-heading {
  color: var(--app-teal);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.app-shell .app-content { padding-top: 1.75rem !important; padding-bottom: 2rem !important; }
.app-shell .app-page-heading { padding-block: 0.5rem; }
.app-shell .app-page-heading.d-flex {
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 1rem;
  row-gap: 0.75rem;
}
.app-shell .app-page-heading.d-flex > :first-child {
  flex: 1 1 100%;
  min-width: 0;
}
.app-shell .app-page-heading.d-flex > :not(:first-child) {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
}
@media (min-width: 992px) {
  .app-shell .app-page-heading.d-flex { flex-wrap: nowrap; }
  .app-shell .app-page-heading.d-flex > :first-child { flex: 1 1 0; min-width: 16rem; }
  .app-shell .app-page-heading.d-flex > :not(:first-child) { flex: 0 1 auto; max-width: 60%; }
}
.app-shell .app-page-heading .btn {
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
}
.app-shell .app-page-heading :is(h1, h2):not(.text-danger) {
  color: var(--app-navy) !important;
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
  font-weight: 650 !important;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.app-shell .app-page-heading p { max-width: 65ch; }
.app-shell .app-page-heading :is(h1, h2):not(.text-danger) > .bi:not(.text-danger),
.app-shell .app-section-heading h2:not(.text-danger) > .bi:not(.text-danger) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.8rem;
  background: var(--app-tint);
  color: var(--app-accent) !important;
  font-size: 1.25rem;
  vertical-align: middle;
}
.app-shell .app-page-heading .btn { border-radius: 0.65rem; }
.app-shell .app-page-heading > div { min-width: 0; }
.app-shell .app-page-heading :is(h1, h2) { overflow-wrap: anywhere; }
.app-shell .app-section-heading { flex-wrap: wrap; }
.app-shell .app-section-heading > div { min-width: 0; }
.app-shell .app-section-heading h2 { color: var(--app-navy); font-size: 1.25rem; font-weight: 650; overflow-wrap: anywhere; }
.app-shell .app-filter-panel {
  border: 1px solid var(--app-line);
  border-radius: 0.8rem;
  background: #fff;
  box-shadow: 0 4px 20px rgba(18, 52, 73, 0.04);
}
.app-shell form.app-filter-panel:not(.card) { padding: 1.25rem; }
.app-shell form.row.app-filter-panel { margin-inline: 0; padding: 0.5rem 0.5rem 1.25rem; }
.app-shell .app-table-surface { border: 1px solid var(--app-line); border-radius: 0.8rem; background: #fff; }
.app-shell .nav-tabs {
  --bs-nav-tabs-border-color: var(--app-line);
  --bs-nav-tabs-link-active-color: var(--app-teal);
  --bs-nav-tabs-link-active-bg: #fff;
  gap: 0.25rem;
  padding: 0.5rem 0.5rem 0;
  background: #f7fafb;
  border-radius: 0.75rem 0.75rem 0 0;
}
.app-shell .nav-tabs .nav-link {
  color: var(--app-muted);
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0.5rem 0.5rem 0 0;
  white-space: normal;
  text-align: start;
  overflow-wrap: anywhere;
}
.app-shell .nav-tabs .nav-link:hover { color: var(--app-teal); background: var(--app-teal-soft); }
.app-shell .nav-tabs .nav-link.active { color: var(--app-teal); background: #fff; border-bottom-color: var(--app-teal); }
.app-shell .nav-pills {
  --bs-nav-pills-link-active-bg: var(--app-teal);
  --bs-nav-pills-link-active-color: #fff;
  --bs-nav-link-color: var(--app-muted);
  gap: 0.25rem;
}
.app-shell .nav-pills .nav-link.active { color: #fff; background: var(--app-teal); }
.app-shell .nav-pills .nav-link:not(.active):hover { color: var(--app-teal); background: var(--app-teal-soft); }
.app-shell .accordion {
  --bs-accordion-border-color: var(--app-line);
  --bs-accordion-border-radius: 0.75rem;
  --bs-accordion-btn-color: var(--app-ink);
  --bs-accordion-active-color: #115c55;
  --bs-accordion-active-bg: var(--app-teal-soft);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.18);
}
.app-shell .list-group {
  --bs-list-group-border-color: var(--app-line);
  --bs-list-group-color: var(--app-ink);
  --bs-list-group-action-hover-bg: #f0f6f5;
  --bs-list-group-action-hover-color: var(--app-ink);
  --bs-list-group-active-bg: var(--app-teal);
  --bs-list-group-active-border-color: var(--app-teal);
}
.app-shell .pagination { --bs-pagination-color: var(--app-teal); --bs-pagination-active-bg: var(--app-teal); --bs-pagination-active-border-color: var(--app-teal); --bs-pagination-disabled-color: var(--app-muted); }
.app-shell .breadcrumb { --bs-breadcrumb-divider-color: var(--app-muted); --bs-breadcrumb-item-active-color: var(--app-muted); }
.app-shell .reports-tabs, .app-shell .reports-section { border-color: var(--app-line); border-radius: 1rem; box-shadow: 0 4px 20px rgba(18, 52, 73, 0.04); }
.app-shell .reports-section-heading { background: #f7fafb; border-color: var(--app-line); }
.app-shell .reports-section-kicker { color: var(--app-teal); }
.app-shell .reports-format-badge { border-color: var(--app-line); color: var(--app-muted); }
.app-shell .document-file-summary { background: #fff; border-color: var(--app-line); border-radius: 1rem; }
.app-shell .document-file-icon { background: var(--app-teal-soft); color: var(--app-teal); }
.app-shell .document-section-title { color: var(--app-navy); }
.app-shell .text-muted, .app-shell .text-secondary { color: var(--app-muted) !important; }
.app-shell .card {
  --bs-card-border-color: var(--app-line);
  --bs-card-cap-bg: #fff;
  border-color: var(--app-line);
  border-radius: 0.8rem;
  box-shadow: 0 4px 20px rgba(18, 52, 73, 0.04);
}

.app-shell .card-header {
  border-bottom-color: #e8eef1;
  border-radius: calc(0.8rem - 1px) calc(0.8rem - 1px) 0 0 !important;
  padding: 1rem 1.25rem;
}

.app-shell:not(.app-public) .card-header:where(:not(.bg-primary, .bg-success, .bg-warning, .bg-danger, .bg-info, .bg-dark, .bg-secondary)),
.app-shell .reports-section-heading {
  background: linear-gradient(100deg, var(--app-tint), #fff 75%) !important;
  color: var(--app-navy);
}
.app-shell .modal-header { background: linear-gradient(100deg, var(--app-tint), #fff 75%); }
.app-shell .modal-title { color: var(--app-navy); }

.app-shell .card.shadow-sm, .app-shell .stat-card {
  box-shadow: 0 4px 20px rgba(18, 52, 73, 0.04) !important;
}

.app-shell .stat-card {
  --stat-tint: var(--app-tint);
  border: 1px solid var(--app-line);
  background: linear-gradient(135deg, #fff 60%, var(--stat-tint));
  border-radius: 0.8rem;
  padding: 1.1rem 1.25rem;
}

.app-shell .stat-card.stat-teal, .app-shell .stat-card.stat-success { --stat-tint: #eaf7f4; }
.app-shell .stat-card.stat-warning { --stat-tint: #fff6e3; }
.app-shell .stat-card.stat-purple { --stat-tint: #f3edfc; }
.app-shell .stat-card.stat-danger { --stat-tint: #fff0f2; }
.app-shell .stat-label { text-transform: none; letter-spacing: 0; color: var(--app-muted); font-weight: 550; }
.app-shell .stat-value { margin-top: 0.65rem; font-weight: 650; letter-spacing: -0.035em; }
.app-shell .stat-value, .app-shell .table { font-variant-numeric: tabular-nums; }
.app-shell .stat-unit { font-size: 0.875rem; font-weight: 400; letter-spacing: normal; color: var(--app-muted); white-space: nowrap; }
.app-shell .dashboard-widget-surface { font-size: max(0.9rem, 14px); line-height: 1.5; }
.app-shell .dashboard-widget-surface :is(.list-group-item, .table) { font-family: inherit; font-size: inherit; line-height: inherit; }
.app-shell .dashboard-widget-surface :is(small, .small) { font-size: max(0.8125rem, 12px); }
.app-shell .dashboard-item-title { font-weight: 600; }
.app-shell .dashboard-goal-item { overflow-wrap: anywhere; }
.app-shell .dashboard-goal-item .progress { margin-block: 0.35rem; }
.app-shell .clinical-record-layout > div { min-width: 0; }
.app-shell .clinical-record-layout .card-body { overflow-wrap: anywhere; }
.app-shell .therapy-editor-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start !important;
  margin: 0;
}
.app-shell .therapy-editor-fields > div { width: auto; min-width: 0; padding: 0; margin-top: 0; }
.app-shell .therapy-editor-fields > :is(.col-12, .therapy-field-full) { grid-column: 1 / -1; }
.app-shell .therapy-editor-fields :is(.form-label, .form-check-label) { font-size: 0.875rem; }
@media (min-width: 576px) {
  .app-shell .therapy-editor-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell .therapy-editor-fields > .therapy-field-wide { grid-column: span 2; }
}
@media (min-width: 992px) {
  .app-shell .therapy-editor-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.app-shell .vitals-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.app-shell .vitals-summary-grid .stat-card { height: 100%; }
.app-shell .vitals-summary-grid .stat-label { flex-wrap: wrap; }
.app-shell .vitals-chart-container canvas { max-width: 100%; }
.app-shell .dashboard-widget-surface .card.border-0 { border: 1px solid var(--app-line) !important; }
.app-shell .dashboard-widget-surface .card-header { padding: 0.9rem 1.1rem; }
.app-shell .dashboard-widget-title { font-size: 0.95rem; color: var(--app-navy); }
.app-shell .dashboard-widget-surface .list-group-item { padding: 0.85rem 1.1rem !important; }
.app-shell .dashboard-kpi-link:hover { background: #f7fbfa; }
.app-shell .dashboard-summary-item { background: #f7fafb; border-color: var(--app-line); border-radius: 0.75rem; }
.app-shell .dashboard-page-actions .btn-outline-secondary {
  --bs-btn-color: var(--app-navy);
  --bs-btn-border-color: #c5d4db;
  --bs-btn-hover-bg: #eaf5f3;
  --bs-btn-hover-color: var(--app-navy);
  --bs-btn-hover-border-color: var(--app-teal);
  --bs-btn-active-bg: #d4eae6;
  --bs-btn-active-border-color: var(--app-teal);
  --bs-btn-active-color: var(--app-navy);
}

.app-shell .dashboard-modular {
  --dashboard-accent: #0f766e;
  --dashboard-tint: #eaf7f4;
  padding: clamp(0rem, 1vw, 0.75rem);
  background: radial-gradient(ellipse at top right, #eaf6fb, transparent 60%);
}

.app-shell .dashboard-modular .dashboard-page-heading { padding: 0.5rem 0 0; }
.app-shell .dashboard-welcome { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.app-shell .dashboard-welcome > div { min-width: 0; }
.app-shell .dashboard-today { font-size: 0.875rem; padding-top: 0.5rem; text-align: right; }
.app-shell .dashboard-modular .dashboard-page-actions { margin-top: 1.25rem; gap: 0.6rem; }
.app-shell .dashboard-modular .dashboard-page-actions .btn { border-radius: 0.65rem; }
.app-shell .dashboard-modular .dashboard-page-actions [data-bs-target] { margin-left: auto; }
.app-shell .dashboard-modular .dashboard-widget-surface { gap: 1rem; }
.app-shell .dashboard-modular [data-dashboard-widget] {
  --dashboard-accent: #0f766e;
  --dashboard-tint: #eaf7f4;
}
.app-shell .dashboard-modular [data-dashboard-widget="kpi-active-therapies"],
.app-shell .dashboard-modular [data-dashboard-widget="therapies"],
.app-shell .dashboard-modular [data-dashboard-widget="kpi-upcoming-deadlines"],
.app-shell .dashboard-modular [data-dashboard-widget="todo"] {
  --dashboard-accent: #946200;
  --dashboard-tint: #fff6e3;
}
.app-shell .dashboard-modular [data-dashboard-widget="kpi-recent-exams"],
.app-shell .dashboard-modular [data-dashboard-widget="recent-exams"] {
  --dashboard-accent: #7051b2;
  --dashboard-tint: #f3edfc;
}
.app-shell .dashboard-modular [data-dashboard-widget="kpi-bmi"],
.app-shell .dashboard-modular [data-dashboard-widget="vital-trend"] {
  --dashboard-accent: #2164a1;
  --dashboard-tint: #eaf4fe;
}
.app-shell .dashboard-modular [data-dashboard-widget="kpi-out-of-range"],
.app-shell .dashboard-modular [data-dashboard-widget="attention"] {
  --dashboard-accent: #b93849;
  --dashboard-tint: #fff0f2;
}
.app-shell .dashboard-modular .stat-card {
  border: 1px solid #dceaf0;
  border-radius: 0.8rem;
  background: linear-gradient(135deg, #fff 60%, var(--dashboard-tint));
  padding: 1rem;
}
.app-shell .dashboard-modular .stat-label { display: flex; align-items: center; gap: 0.5rem; line-height: 1.4; }
.app-shell .dashboard-modular .stat-label > .bi,
.app-shell .dashboard-modular .dashboard-widget-title > .bi {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  background: var(--dashboard-tint);
  color: var(--dashboard-accent) !important;
  margin-right: 0 !important;
}
.app-shell .dashboard-modular .stat-value { color: var(--app-navy) !important; font-weight: 700; }
.app-shell .dashboard-modular .card { border-radius: 0.8rem; }
.app-shell .dashboard-modular .card-header {
  background: linear-gradient(100deg, var(--dashboard-tint), #fff 70%) !important;
  border-radius: calc(0.8rem - 1px) calc(0.8rem - 1px) 0 0 !important;
}
.app-shell .dashboard-modular .dashboard-widget-title { display: flex; align-items: center; gap: 0.6rem; }
.app-shell .dashboard-modular .table > thead > tr > th { background: #f1f8fc; color: #415e6e; font-weight: 600; }
.app-shell .dashboard-modular .table > tbody > tr > td { border-color: #edf3f7; }
.app-shell .dashboard-modular [data-dashboard-widget="health-suggestions"] .card { border-color: #b8dedc !important; }
.app-shell .dashboard-modular .dashboard-suggestions-toggle { font-size: inherit; }
.app-shell .dashboard-modular .dashboard-summary-item { background: #f3fafb; border-color: #dceaf0; }

@media (max-width: 767.98px) {
  .app-shell .dashboard-welcome { flex-direction: column; gap: 0.5rem; }
  .app-shell .dashboard-today { padding-top: 0; text-align: left; }
}

.app-shell .btn-primary {
  --bs-btn-bg: var(--app-teal);
  --bs-btn-border-color: var(--app-teal);
  --bs-btn-hover-bg: #115e59;
  --bs-btn-hover-border-color: #115e59;
  --bs-btn-active-bg: #134e4a;
  --bs-btn-active-border-color: #134e4a;
  --bs-btn-disabled-bg: var(--app-teal);
  --bs-btn-disabled-border-color: var(--app-teal);
}

.app-shell .btn-outline-primary {
  --bs-btn-color: var(--app-teal);
  --bs-btn-border-color: #8dbbb5;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--app-teal);
  --bs-btn-hover-border-color: var(--app-teal);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #115e59;
  --bs-btn-active-border-color: #115e59;
  --bs-btn-disabled-color: var(--app-teal);
  --bs-btn-disabled-border-color: #8dbbb5;
}

.app-shell .btn { font-weight: 550; }
.app-shell .btn:focus-visible,
.app-shell .form-control:not(.is-invalid):not(.is-valid):not(.input-validation-error):focus,
.app-shell .form-select:not(.is-invalid):not(.is-valid):not(.input-validation-error):focus {
  border-color: var(--app-teal);
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.18);
}

.app-shell a:focus-visible, .app-shell button:focus-visible {
  outline: 3px solid #a65d10;
  outline-offset: 3px;
}

.app-shell :where(.form-control:not(.is-invalid):not(.is-valid):not(.input-validation-error), .form-select:not(.is-invalid):not(.is-valid):not(.input-validation-error)) {
  border-color: #bfced7;
  border-radius: 0.5rem;
}

.app-shell .form-control:not(.form-control-sm), .app-shell .form-select:not(.form-select-sm) { min-height: 2.75rem; }
.app-shell input.form-control-sm, .app-shell select.form-select-sm,
.app-shell .input-group-sm > input.form-control, .app-shell .input-group-sm > span.form-control,
.app-shell .input-group-sm > .btn {
  min-height: 2rem;
  height: 2rem;
  padding-top: .25rem;
  padding-bottom: .25rem;
  font-size: .875rem;
  line-height: 1.5;
}
.app-shell .form-control::placeholder { color: #617583; opacity: 1; }
.app-shell .form-label { color: #415e6e; font-size: 0.875rem; }
.app-shell .input-group-text { color: var(--app-muted); background: #f7fafb; border-color: #bfced7; }
.app-shell .form-check-input:checked { background-color: var(--app-teal); border-color: var(--app-teal); }
.app-shell .modal-content { border-color: var(--app-line); border-radius: 1rem; }
.app-shell .modal-header, .app-shell .modal-footer { border-color: var(--app-line); }
.app-shell .table { --bs-table-color: var(--app-ink); --bs-table-border-color: #edf3f7; --bs-table-hover-bg: #f5faf9; }
.app-shell .table thead th { background: #f1f8fc; color: #415e6e; font-size: 0.8125rem; }
.app-shell .table td, .app-shell .table th { padding: 0.8rem 1rem; }
.app-shell .table thead .js-column-filters th { padding: 0.4rem 0.5rem; }
.app-shell .table thead th[aria-sort]:focus-visible { outline: 2px solid var(--app-teal); outline-offset: -2px; }
.app-shell .grid-toolbar { background: #f1f8fc; border-color: var(--app-line); }
.app-shell .badge { line-height: 1.35; }
.app-shell :where(.card-body, .list-group-item, .alert, .invalid-feedback, .field-validation-error, .validation-summary-errors) {
  overflow-wrap: anywhere;
}
.app-shell .table td { overflow-wrap: anywhere; }
.app-shell .footer { border-color: var(--app-line); background: #fff; }

.app-public main {
  background: linear-gradient(180deg, #eaf4fe 0%, #f1f7fb 18rem);
}

.app-public .card.border-0 { border: 1px solid var(--app-line) !important; box-shadow: 0 12px 36px rgba(18, 52, 73, 0.1) !important; overflow: hidden; }
.app-public .card-header.bg-primary,
.app-public .card-header.bg-success {
  background: var(--app-navy) !important;
  border-bottom: 3px solid var(--app-teal);
  padding: 1.5rem 1.25rem;
}
.app-public .card-header .bi { color: #83d7ca; }
.app-public .card-header .text-white-50 { color: #c5d6de !important; }
.app-public .btn-success {
  --bs-btn-bg: var(--app-teal);
  --bs-btn-border-color: var(--app-teal);
  --bs-btn-hover-bg: #0b5f59;
  --bs-btn-hover-border-color: #0b5f59;
  --bs-btn-active-bg: #0b5f59;
  --bs-btn-active-border-color: #0b5f59;
  --bs-btn-disabled-bg: var(--app-teal);
  --bs-btn-disabled-border-color: var(--app-teal);
}
.app-public .footer a { color: var(--app-muted); text-decoration: none; }
.app-public .footer a:hover { color: var(--app-teal); text-decoration: underline; }
.app-public .navbar .form-select { background-color: #183849; color: #fff; border-color: #617b8a; }

.app-public .legal-document {
  max-width: 62rem;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background: #fff;
  border: 1px solid var(--app-line);
  border-top: 3px solid var(--app-teal);
  border-radius: 1rem;
  box-shadow: 0 12px 36px rgba(18, 52, 73, 0.1);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.app-public .legal-document > header {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--app-line);
}

.app-public .legal-document h1,
.app-public .legal-document h2 {
  color: var(--app-navy);
  font-weight: 700;
}

.app-public .legal-document h2 {
  padding-left: 0.75rem;
  border-left: 3px solid var(--app-teal);
}

.app-public .legal-document .lead { font-size: 1.0625rem; }
.app-public .legal-document dd { color: var(--app-muted); }
.app-public .legal-document > nav { margin-top: 1.5rem; }
.app-public .legal-document > nav a { font-weight: 600; }

@media (min-width: 992px) {
  .app-shell #mainNav .nav-item.dropdown { position: static; }
  .app-shell .app-more-menu {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    width: min(52rem, calc(100vw - 3rem));
    column-gap: 1rem;
    padding: 1rem;
  }

  .app-shell .app-more-menu.show {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .app-shell .app-more-menu .mobile-nav-heading { margin: 0 0 0.5rem; padding: 0.4rem 0.75rem; }
  .app-shell .app-more-menu .dropdown-item { white-space: normal; }
  .app-shell .app-more-menu .dropdown-divider { display: none; }
  .app-shell .navbar [role="search"] { flex: 0 1 14rem; min-width: 9rem; }
  .app-shell .navbar [role="search"] .form-control { min-width: 0; background: #183849; color: #fff; border-color: #617b8a; }
  .app-shell .navbar [role="search"] .form-control::placeholder { color: #d1dfe6; }
}

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

@media (min-width: 1200px) {
  .app-shell .vitals-summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 359.98px) {
  .app-shell .vitals-summary-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 992px) and (max-width: 1399.98px) {
  .app-shell #mainNav > .offcanvas-body { flex-wrap: wrap; row-gap: 0.5rem; }
  .app-shell #mainNav .navbar-nav { flex-wrap: wrap; }
}

@media (max-width: 991.98px) {
  .app-shell .app-navigation { color: var(--app-ink); background: #fff; }
  .app-shell .app-navigation .nav-link, .app-shell .app-navigation .dropdown-item { color: var(--app-ink); }
  .app-shell .app-navigation .nav-link.active, .app-shell .app-navigation .dropdown-item.active { background: var(--app-teal-soft); color: #115c55; }
  .app-shell .app-navigation .nav-link:hover, .app-shell .app-navigation .dropdown-item:hover { background: #f0f6f5; }
  .app-shell .app-navigation [role="search"] .btn { color: var(--app-teal); border-color: #8dbbb5; }
}

@media (max-width: 575.98px) {
  .app-shell .app-content { padding-top: 1rem !important; }
  .app-shell .app-page-heading > div { min-width: 0; }
  .app-shell .app-page-heading h2 { overflow-wrap: anywhere; }
  .app-shell .stat-card { padding: 0.9rem; }
  .app-shell .stat-value { font-size: 1.5rem; overflow-wrap: anywhere; }
  .app-shell .card-header { padding: 0.85rem 1rem; }
  .app-shell .table td, .app-shell .table th { padding: 0.65rem 0.75rem; }
  .app-shell .app-page-heading .btn, .app-shell .nav-tabs .nav-link, .app-shell .nav-pills .nav-link { min-height: 44px; }
  .app-shell .app-section-heading .d-flex { flex-wrap: wrap; }
  .app-shell form.app-filter-panel:not(.card) { padding: 1rem; }
  .app-shell form.row.app-filter-panel { padding: 0.25rem 0.25rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .card, .app-shell .nav-link { transition: none; }
}

@media print {
  .app-shell { background: #fff; }
  .app-shell .navbar { display: none; }
  .app-shell .card, .app-shell .stat-card { box-shadow: none !important; }
}
