:root {
  --bg: #f7f5f0;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-soft: #faf8f4;
  --border: rgba(51, 51, 51, 0.08);
  --border-strong: rgba(51, 51, 51, 0.12);
  --text: #333333;
  --text-soft: #5f5a54;
  --text-muted: #8a837a;
  --primary: #333333;
  --primary-2: #000000;
  --primary-3: #b0732b;
  --primary-4: #b0732b;
  --success: #00a76e;
  --danger: #7e4c8b;
  --warning: #b0732b;
  --shadow-soft: 0 18px 40px rgba(51, 51, 51, 0.08);
  --shadow-card: 0 26px 60px rgba(51, 51, 51, 0.1);
  --shadow-hover: 0 30px 70px rgba(51, 51, 51, 0.14);
  --radius-xl: 34px;
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 16px;
  --container: 1320px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Open Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(176, 115, 43, 0.1), transparent 24%),
    radial-gradient(circle at top right, rgba(51, 51, 51, 0.05), transparent 28%),
    linear-gradient(180deg, #f7f5f0 0%, #f4f1eb 100%);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: relative;
  z-index: 220;
  padding: 18px 24px 8px;
}

/* =========================================================
   4) HEADER / NAVBAR WRAPPER
   ========================================================= */
.site-header {
  position: relative;
  z-index: 200;
  padding: 18px 24px 20px;
}

.navbar-wrapper {
  width: 100%;
}

.main-navbar {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 4px;
}

.navbar-shell {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 40px rgba(51, 51, 51, 0.06);
  backdrop-filter: blur(16px);
}

.navbar-container {
  min-height: 92px;
  padding: 0 34px;
  display: flex;
  align-items: center;
  gap: 26px;
}

/* =========================================================
   5) NAVBAR BRAND / MOBILE MENU BUTTON
   ========================================================= */
.navbar-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.navbar-brand img {
  width: 128px;
  height: auto;
  object-fit: contain;
}

.menu-button {
  display: none;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff, #faf8f4);
  box-shadow: 0 8px 22px rgba(51, 51, 51, 0.06);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}

.menu-button:hover {
  transform: translateY(-1px);
  color: var(--primary-3);
  box-shadow: 0 12px 24px rgba(51, 51, 51, 0.1);
}

/* =========================================================
   6) NAVBAR LAYOUT / LINKS
   ========================================================= */
.navbar-right {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 34px;
  margin: 0 auto;
}

.nav-link,
.dropdown-toggle,
.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #333333;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.nav-link:hover,
.dropdown-toggle:hover,
.user-trigger:hover,
.nav-link:focus-visible,
.dropdown-toggle:focus-visible,
.user-trigger:focus-visible {
  color: var(--primary-3);
  outline: none;
}

.join-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  text-decoration: none;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #333333, #333333);
  box-shadow:
    0 14px 24px rgba(51, 51, 51, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    filter 0.22s ease;
}

.join-btn:hover,
.join-btn:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow:
    0 18px 30px rgba(51, 51, 51, 0.2),
    0 10px 20px rgba(176, 115, 43, 0.12);
  outline: none;
}

/* =========================================================
   7) DROPDOWNS
   ========================================================= */
.dropdown,
.user-dropdown-container {
  position: relative;
}

.dropdown-content,
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 16px);
  min-width: 240px;
  margin: 0;
  padding: 12px 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 50px rgba(51, 51, 51, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease;
  z-index: 50;
}

.dropdown-content {
  left: 0;
}

.user-dropdown-menu {
  right: 0;
}

.dropdown-content a,
.user-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  text-decoration: none;
  color: #333333;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-content a:hover,
.user-dropdown-menu a:hover,
.dropdown-content a:focus-visible,
.user-dropdown-menu a:focus-visible {
  background: #faf8f4;
  color: var(--primary-3);
  outline: none;
}

.user-dropdown-menu .divider {
  height: 1px;
  margin: 8px 14px;
  background: rgba(51, 51, 51, 0.08);
}

.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content,
.dropdown.is-open .dropdown-content,
.user-dropdown-container:hover .user-dropdown-menu,
.user-dropdown-container:focus-within .user-dropdown-menu,
.user-dropdown-container.is-open .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hello-label {
  color: var(--text-muted);
  font-weight: 400;
}

#username {
  color: #000000;
  font-weight: 700;
}

.dropdown-icon {
  font-size: 13px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.dropdown.is-open .dropdown-icon,
.user-dropdown-container.is-open .dropdown-icon {
  transform: rotate(180deg);
}

.cnp-page {
  padding: 28px 24px 72px;
}

.cnp-wrapper {
  max-width: 1180px;
  margin: 0 auto;
}

.page-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-eyebrow {
  margin: 0 0 12px;
  color: var(--primary-3);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-intro h1 {
  margin: 0 0 12px;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.04em;
  color: #333333;
}

.page-subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--text-soft);
  font-size: 1.02rem;
  line-height: 1.8;
}

.cnp-btn-secondary,
.cnp-btn-primary,
.cnp-btn-dropdown,
.cnp-btn-disabled,
.cnp-ap-submit {
  border: 0;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease, border-color 0.22s ease;
}

.cnp-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid rgba(51, 51, 51, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 250, 247, 0.96));
  color: #333333;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 12px 22px rgba(51, 51, 51, 0.07);
}

.cnp-btn-secondary:hover,
.cnp-btn-secondary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(51, 51, 51, 0.11);
  outline: none;
}

.cnp-row {
  display: grid;
  gap: 24px;
  margin-bottom: 24px;
}

.cnp-main-row {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.cnp-details-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cnp-card {
  position: relative;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.75);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 250, 247, 0.94));
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.cnp-card::before,
.cnp-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.cnp-card::before {
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.06));
  opacity: 0.85;
}

.cnp-card::after {
  top: -86px;
  right: -48px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176, 115, 43, 0.16), transparent 68%);
}

.cnp-card>* {
  position: relative;
  z-index: 1;
}

.cnp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid rgba(51, 51, 51, 0.08);
}

.cnp-card-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary-3);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cnp-card-header h2,
.cnp-card-details h3,
.cnp-card-info h3,
.cnp-ap-header h2 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  color: #333333;
}

.cnp-card-header h2 {
  font-size: 1.48rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.cnp-card-body {
  padding: 24px 26px 28px;
}

.cnp-card-body-meds {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cnp-link-small {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(176, 115, 43, 0.12);
  background: rgba(250, 248, 244, 0.85);
  color: var(--primary-3);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.cnp-link-small:hover,
.cnp-link-small:focus-visible {
  background: rgba(252, 250, 247, 1);
  outline: none;
}

.cnp-input-icon {
  position: relative;
  margin-bottom: 20px;
}

.cnp-input-icon i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
}

.cnp-input,
.cnp-textarea {
  width: 100%;
  min-height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(51, 51, 51, 0.1);
  background: linear-gradient(180deg, #ffffff, #fcfaf7);
  color: #333333;
  padding: 0 18px;
  font-size: 0.96rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.cnp-input-icon .cnp-input {
  padding-left: 48px;
}

.cnp-input:focus,
.cnp-textarea:focus,
.med-input:focus,
.rx-footer-input:focus {
  outline: none;
  border-color: rgba(176, 115, 43, 0.38);
  box-shadow:
    0 0 0 4px rgba(176, 115, 43, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.cnp-textarea {
  min-height: 124px;
  padding: 16px 18px;
  resize: vertical;
}

.cnp-patient-summary {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 24px;
  border-radius: 26px;
  border: 1px dashed rgba(176, 115, 43, 0.16);
  background: linear-gradient(180deg, rgba(252, 250, 247, 0.96), rgba(255, 255, 255, 0.98));
  text-align: center;
  color: #5f5a54;
}

.cnp-empty-state-icon {
  width: 74px;
  height: 74px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border-radius: 24px;
  font-size: 1.5rem;
  color: var(--primary-3);
  background: linear-gradient(145deg, rgba(250, 248, 244, 0.98), rgba(252, 250, 247, 0.96));
  border: 1px solid rgba(176, 115, 43, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 12px 22px rgba(176, 115, 43, 0.08);
}

.cnp-patient-summary p {
  margin: 0;
  line-height: 1.78;
}

.cnp-patient-name {
  font-family: "Montserrat", sans-serif;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #333333;
}

.cnp-muted {
  color: var(--text-soft);
}

.cnp-card-patient {
  min-height: 100%;
}

.cnp-add-patient-modal {
  position: absolute;
  inset: 18px;
  border-radius: 28px;
  border: 1px solid rgba(51, 51, 51, 0.1);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(51, 51, 51, 0.16);
  padding: 24px 24px 26px;
  display: none;
  overflow: auto;
  z-index: 40;
}

.cnp-ap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.cnp-ap-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.cnp-ap-close {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(126, 76, 139, 0.16);
  border-radius: 14px;
  color: var(--danger);
  background: rgba(247, 243, 248, 0.92);
}

.cnp-ap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.cnp-ap-field label,
.cnp-notes-block label {
  display: block;
  margin-bottom: 8px;
  color: #333333;
  font-size: 0.92rem;
  font-weight: 700;
}

.cnp-ap-field.full-width {
  grid-column: 1 / -1;
}

.cnp-ap-dob-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cnp-ap-dob-row span {
  color: var(--text-muted);
  font-weight: 700;
}

.cnp-ap-dob-input {
  max-width: 84px;
}

.cnp-ap-dob-input-year {
  flex: 1;
}

.cnp-ap-footer {
  display: flex;
  justify-content: center;
  padding-top: 18px;
  margin-top: 20px;
  border-top: 1px solid rgba(51, 51, 51, 0.08);
}

.cnp-ap-submit,
.cnp-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #333333, #333333);
  box-shadow:
    0 14px 24px rgba(51, 51, 51, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.cnp-ap-submit {
  min-width: 190px;
}

.cnp-btn-primary:hover,
.cnp-btn-primary:focus-visible,
.cnp-ap-submit:hover,
.cnp-ap-submit:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow:
    0 18px 30px rgba(51, 51, 51, 0.2),
    0 10px 20px rgba(176, 115, 43, 0.12);
  outline: none;
}

.cnp-btn-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid rgba(51, 51, 51, 0.08);
  color: #8a837a;
  font-size: 0.92rem;
  font-weight: 700;
  background: linear-gradient(180deg, #f1ede6, #ece7df);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.cnp-btn-dropdown {
  width: 52px;
  min-width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #ffffff;
  font-size: 1rem;
  background: linear-gradient(135deg, #333333, #333333);
  box-shadow:
    0 14px 24px rgba(51, 51, 51, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.cnp-btn-dropdown:hover,
.cnp-btn-dropdown:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.05);
  outline: none;
}

.med-table-wrapper {
  overflow-x: auto;
  border-radius: 24px;
  border: 1px solid rgba(51, 51, 51, 0.08);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.cnp-meds-table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
}

.cnp-meds-table thead th {
  padding: 16px 18px;
  background: linear-gradient(135deg, #b0732b, #b0732b);
  color: #ffffff;
  font-size: 0.93rem;
  font-weight: 700;
  text-align: left;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
}

.cnp-meds-table thead th:last-child {
  border-right: 0;
}

.med-icon-header {
  width: 62px;
  background: linear-gradient(135deg, #b0732b, #b0732b);
}

.cnp-meds-table tbody td {
  padding: 14px 18px;
  border-top: 1px solid rgba(51, 51, 51, 0.08);
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.96);
}

.med-icon-cell {
  width: 62px;
  text-align: center;
}

.med-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}

.circle-minus {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid #7e4c8b;
  border-radius: 50%;
}

.circle-minus::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 2px;
  background: #7e4c8b;
  transform: translate(-50%, -50%);
}

.med-field {
  position: relative;
}

.med-input {
  width: 100%;
  min-height: 44px;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 1px solid rgba(51, 51, 51, 0.12);
  background: transparent;
  color: #333333;
  font-size: 0.95rem;
}

.med-input::placeholder,
.cnp-input::placeholder,
.cnp-textarea::placeholder {
  color: #8a837a;
}

.med-input-qty {
  max-width: 88px;
  text-align: center;
}

#add-med-row td {
  background: linear-gradient(180deg, rgba(252, 250, 247, 0.9), rgba(255, 255, 255, 0.98));
}

.med-add-icon {
  color: var(--primary-3);
  font-size: 1rem;
}

.cnp-notes-block {
  display: grid;
  gap: 10px;
}

.cnp-card-actions {
  margin-bottom: 24px;
}

.cnp-actions-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 26px;
}

.cnp-strip-copy {
  max-width: 520px;
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.75;
}

.cnp-actions-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cnp-card-details,
.cnp-card-info {
  padding: 26px 26px 28px;
}

.detail-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 18px;
  color: var(--primary-3);
  font-size: 1.2rem;
  background: linear-gradient(145deg, rgba(250, 248, 244, 0.98), rgba(252, 250, 247, 0.96));
  border: 1px solid rgba(176, 115, 43, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 12px 22px rgba(176, 115, 43, 0.08);
}

.cnp-card-details h3,
.cnp-card-info h3 {
  margin-bottom: 12px;
  font-size: 1.38rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.cnp-card-details p,
.cnp-card-info li {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.98rem;
  line-height: 1.85;
}

.cnp-card-details p+p {
  margin-top: 4px;
}

.cnp-card-info ul {
  margin: 0;
  padding-left: 20px;
}

.cnp-card-info li+li {
  margin-top: 12px;
}

.rx-muted {
  color: var(--text-soft);
}

.rx-footer {
  padding: 18px 24px 28px;
}

.rx-footer-shell {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: 36px 36px 22px;
  overflow: hidden;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(51, 51, 51, 0.98), rgba(0, 0, 0, 0.96));
  box-shadow:
    0 28px 60px rgba(51, 51, 51, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.rx-footer-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(176, 115, 43, 0.12), transparent 24%),
    radial-gradient(circle at 88% 14%, rgba(255, 255, 255, 0.08), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02) 36%, rgba(255, 255, 255, 0.01));
}

.rx-footer-shell::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176, 115, 43, 0.14), transparent 68%);
  pointer-events: none;
}

.rx-footer-top,
.rx-footer-bottom {
  position: relative;
  z-index: 1;
}

.rx-footer-top {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(0, 2fr);
  gap: 34px;
  padding-bottom: 28px;
}

.rx-footer-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 154px;
  min-height: 76px;
  padding: 16px 20px;
  background: #ffffff;
}

.rx-footer-logo {
  max-width: 118px;
  height: auto;
}

.rx-footer-description {
  max-width: 390px;
  margin: 24px 0 28px;
  color: rgba(240, 236, 230, 0.88);
  font-size: 15px;
  line-height: 1.85;
}

.rx-footer-emergency {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.rx-footer-emergency-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: #b0732b;
  background: linear-gradient(180deg, rgba(176, 115, 43, 0.18), rgba(176, 115, 43, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rx-footer-emergency-label {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rx-footer-emergency-number {
  text-decoration: none;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
}

.rx-footer-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
}

.rx-footer-column h4 {
  margin: 8px 0 18px;
  padding-bottom: 14px;
  color: #ffffff;
  font-family: "Montserrat", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  position: relative;
}

.rx-footer-column h4::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 46px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(176, 115, 43, 0.95), rgba(176, 115, 43, 0));
}

.rx-footer-column a,
.rx-contact-item a {
  text-decoration: none;
  color: rgba(240, 236, 230, 0.9);
  font-size: 15px;
  line-height: 1.8;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.rx-footer-column a:hover,
.rx-contact-item a:hover,
.rx-footer-column a:focus-visible,
.rx-contact-item a:focus-visible {
  color: #b0732b;
  outline: none;
}

.rx-footer-column:not(.rx-footer-contact):not(.rx-footer-form-col) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rx-contact-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
}

.rx-contact-item+.rx-contact-item {
  margin-top: 14px;
}

.rx-contact-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: #b0732b;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rx-contact-phones {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rx-footer-form {
  display: grid;
  gap: 14px;
  max-width: 240px;
}

.rx-footer-input {
  height: 52px;
  width: 100%;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.rx-footer-input::placeholder {
  color: rgba(240, 236, 230, 0.6);
}

.rx-footer-submit {
  height: 50px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #333333, #333333);
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.22);
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.rx-footer-submit:hover,
.rx-footer-submit:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.26);
  outline: none;
}

.footer-form-feedback {
  min-height: 18px;
  margin: 0;
  color: rgba(176, 115, 43, 0.96);
  font-size: 0.85rem;
  line-height: 1.5;
}

.rx-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rx-footer-copy {
  margin: 0;
  color: rgba(240, 236, 230, 0.74);
  font-size: 0.95rem;
}

.rx-footer-socials {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rx-social-link {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  text-decoration: none;
  color: #f0ece6;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.22s ease, background 0.22s ease, color 0.22s ease;
}

.rx-social-link:hover,
.rx-social-link:focus-visible {
  transform: translateY(-2px);
  color: #b0732b;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

@media (max-width: 1180px) {
  .page-intro {
    flex-direction: column;
  }

  .cnp-main-row,
  .cnp-details-row {
    grid-template-columns: 1fr;
  }

  .rx-footer-top {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {

  .site-header,
  .cnp-page,
  .rx-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .navbar-container {
    min-height: 82px;
    padding: 0 22px;
  }

  .nav-center {
    gap: 20px;
  }

  .cnp-card-header,
  .cnp-card-body,
  .cnp-actions-inner,
  .cnp-card-details,
  .cnp-card-info {
    padding-left: 22px;
    padding-right: 22px;
  }

  .rx-footer-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
  }

  .navbar-container {
    flex-wrap: wrap;
    padding: 18px 20px;
    gap: 18px;
  }

  .navbar-right {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 10px 0 4px;
    border-top: 1px solid rgba(51, 51, 51, 0.08);
  }

  .navbar-right.is-open {
    display: flex;
  }

  .nav-center {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
  }

  .nav-link,
  .dropdown-toggle,
  .user-trigger {
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 0 4px;
  }

  .dropdown-content,
  .user-dropdown-menu {
    position: static;
    min-width: 0;
    margin-top: 8px;
    box-shadow: none;
    border-radius: 16px;
    border-color: rgba(51, 51, 51, 0.06);
    transform: none;
    display: none;
    opacity: 1;
    visibility: visible;
  }

  .dropdown.is-open .dropdown-content,
  .user-dropdown-container.is-open .user-dropdown-menu {
    display: block;
  }

  .user-dropdown-container {
    width: 100%;
  }

  .cnp-row {
    gap: 20px;
  }

  .cnp-actions-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .cnp-strip-copy {
    max-width: none;
  }

  .cnp-actions-right {
    margin-left: 0;
    justify-content: stretch;
  }

  .cnp-btn-disabled,
  .cnp-btn-primary {
    flex: 1 1 240px;
  }

  .cnp-add-patient-modal {
    inset: 12px;
    padding: 22px 18px 22px;
  }

  .cnp-ap-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {

  .cnp-card,
  .rx-footer-shell {
    border-radius: 28px;
  }

  .cnp-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .cnp-card-header h2,
  .cnp-card-details h3,
  .cnp-card-info h3 {
    font-size: 1.25rem;
  }

  .cnp-patient-summary {
    min-height: 240px;
  }

  .cnp-meds-table {
    min-width: 600px;
  }

  .rx-footer-shell {
    padding: 28px 22px 20px;
  }

  .rx-footer-links {
    grid-template-columns: 1fr;
  }

  .rx-footer-form {
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding-top: 12px;
  }

  .cnp-page {
    padding-top: 20px;
    padding-bottom: 56px;
  }

  .page-intro h1 {
    font-size: 1.95rem;
  }

  .page-subtitle,
  .cnp-strip-copy,
  .cnp-card-details p,
  .cnp-card-info li,
  .cnp-patient-summary p {
    font-size: 0.94rem;
  }

  .navbar-shell {
    border-radius: 22px;
  }

  .navbar-brand img {
    width: 112px;
  }

  .menu-button {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .cnp-card-header,
  .cnp-card-body,
  .cnp-actions-inner,
  .cnp-card-details,
  .cnp-card-info {
    padding-left: 18px;
    padding-right: 18px;
  }

  .cnp-btn-secondary,
  .cnp-btn-disabled,
  .cnp-btn-primary {
    width: 100%;
    justify-content: center;
  }

  .cnp-actions-right {
    width: 100%;
  }

  .cnp-btn-dropdown {
    min-width: 48px;
    width: 48px;
    height: 48px;
  }

  .cnp-ap-dob-row {
    flex-wrap: wrap;
  }

  .rx-footer-top {
    gap: 26px;
    padding-bottom: 24px;
  }

  .rx-footer-emergency {
    width: 100%;
  }

  .rx-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ===== Doctor-first v2 overrides ===== */
:root {
  --container: 1260px;
  --shadow-card: 0 22px 50px rgba(51, 51, 51, 0.08);
  --shadow-hover: 0 28px 60px rgba(51, 51, 51, 0.12);
}

body {
  background:
    radial-gradient(circle at top left, rgba(176, 115, 43, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(51, 51, 51, 0.04), transparent 28%),
    linear-gradient(180deg, #f7f5f0 0%, #f2eee8 100%);
}

.site-header {
  padding-bottom: 14px;
}

.navbar-container {
  gap: 18px;
  padding: 0 28px;
}

.navbar-right {
  gap: 16px;
}

.nav-center {
  gap: clamp(16px, 1.35vw, 24px);
  flex-wrap: nowrap;
}

.nav-link,
.dropdown-toggle,
.user-trigger {
  font-size: 14.5px;
}

.user-trigger {
  white-space: nowrap;
}

.cnp-page {
  padding-top: 20px;
}

.cnp-wrapper {
  max-width: 1220px;
}

.page-intro {
  align-items: flex-end;
  margin-bottom: 30px;
}

.page-subtitle {
  max-width: 720px;
  font-size: 1.04rem;
  line-height: 1.76;
}

.cnp-main-row {
  grid-template-columns: minmax(320px, 0.82fr) minmax(560px, 1.18fr);
  align-items: start;
}

.cnp-card {
  border: 1px solid rgba(255, 255, 255, 0.82);
}

.cnp-card-header {
  padding: 24px 24px 20px;
}

.cnp-card-body {
  padding: 22px 24px 26px;
}

.cnp-card-support,
.cnp-field-help {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.65;
}

.cnp-card-patient .cnp-card-body,
.cnp-card-meds .cnp-card-body {
  padding-top: 20px;
}

.cnp-input,
.cnp-textarea {
  min-height: 56px;
  border-radius: 20px;
}

.cnp-textarea {
  min-height: 140px;
}

.cnp-patient-summary {
  min-height: 334px;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
  padding: 24px 22px;
}

.cnp-patient-summary:has(.cnp-empty-state-icon) {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.cnp-patient-summary p {
  width: 100%;
}

.cnp-patient-summary p strong {
  color: #333333;
}

#rxPatientStateWrap {
  margin-top: 14px;
}

.cnp-add-patient-modal {
  position: fixed;
  inset: 0;
  z-index: 650;
  display: none;
  padding: 32px 18px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  overflow: auto;
}

/* because your JS sets modal.style.display = "block" */
.cnp-add-patient-modal[style*="display: block"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.cnp-ap-dialog {
  width: min(880px, 100%);
  max-height: calc(100vh - 48px);
  margin: 0 auto;
  overflow-y: auto;
  border-radius: 30px;
  border: 1px solid rgba(51, 51, 51, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(252, 250, 247, 0.97));
  box-shadow: 0 36px 80px rgba(51, 51, 51, 0.22);
  padding: 26px 26px 24px;
}

.cnp-ap-header {
  margin-bottom: 20px;
}

.cnp-ap-grid {
  gap: 18px;
}

.cnp-ap-field label,
.cnp-notes-block label {
  font-size: 0.93rem;
}

.cnp-ap-footer {
  justify-content: flex-end;
}

.cnp-ap-submit {
  min-width: 220px;
}

.cnp-card-body-meds {
  gap: 18px;
}

.med-table-wrapper {
  overflow: visible;
  border-radius: 26px;
}

.cnp-meds-table {
  min-width: 0;
  table-layout: fixed;
}

.med-col-icon {
  width: 58px;
}

.med-col-description {
  width: 42%;
}

.med-col-dosage {
  width: 38%;
}

.med-col-qty {
  width: 20%;
}

.cnp-meds-table thead th {
  padding: 18px 18px;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #b0732b, #b0732b);
}

.cnp-meds-table tbody td {
  padding: 16px 18px;
}

.cnp-meds-table tbody tr:hover td {
  background: rgba(252, 250, 247, 0.98);
}

.med-input {
  min-height: 50px;
  padding-bottom: 10px;
  font-size: 0.98rem;
}

.med-input-medicine-search {
  font-weight: 600;
}

.med-input-qty {
  max-width: none;
  text-align: left;
}

#add-med-row td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.cnp-notes-block {
  gap: 8px;
}

.cnp-card-actions {
  overflow: visible;
}

.cnp-actions-inner,
.cnp-actions-right {
  overflow: visible;
}

.cnp-actions-inner {
  gap: 20px;
}

.cnp-strip-copy {
  max-width: 560px;
  font-size: 0.98rem;
}

.cnp-actions-right {
  position: relative;
  flex-wrap: nowrap;
}

#rxIssueMenu {
  min-width: 290px !important;
  top: auto !important;
  bottom: calc(100% + 14px) !important;
  right: 0 !important;
  padding: 10px !important;
  border-radius: 22px !important;
  border: 1px solid rgba(51, 51, 51, 0.08) !important;
  background: rgba(255, 255, 255, 0.99) !important;
  box-shadow: 0 28px 60px rgba(51, 51, 51, 0.18) !important;
  z-index: 9999 !important;
}

#rxIssueMenu::after {
  content: "";
  position: absolute;
  right: 22px;
  top: 100%;
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.99);
  border-right: 1px solid rgba(51, 51, 51, 0.08);
  border-bottom: 1px solid rgba(51, 51, 51, 0.08);
  transform: translateY(-7px) rotate(45deg);
}

#rxIssueMenu button {
  display: flex !important;
  align-items: center;
  width: 100% !important;
  min-height: 48px;
  padding: 0 14px !important;
  border-radius: 14px;
  color: #333333;
  font-weight: 700;
}

#rxIssueMenu button:hover,
#rxIssueMenu button:focus-visible {
  background: #faf8f4 !important;
  color: var(--primary-3);
  outline: none;
}

.cnp-card-details,
.cnp-card-info {
  min-height: 100%;
}

@media (max-width: 1180px) {
  .navbar-container {
    padding: 0 22px;
  }

  .nav-center {
    gap: 16px;
  }

  .cnp-main-row {
    grid-template-columns: 1fr;
  }

  .cnp-patient-summary {
    min-height: 250px;
  }

  .med-table-wrapper {
    overflow-x: auto;
  }

  .cnp-meds-table {
    min-width: 760px;
  }
}

@media (max-width: 900px) {
  .nav-center {
    flex-wrap: wrap;
  }

  .page-intro {
    align-items: flex-start;
  }

  .cnp-actions-right {
    flex-wrap: wrap;
  }

  #rxIssueMenu {
    min-width: 260px !important;
  }
}

@media (max-width: 760px) {
  .cnp-add-patient-modal {
    padding: 16px 10px;
  }

  .cnp-ap-dialog {
    border-radius: 24px;
    padding: 20px 18px;
  }

  .med-table-wrapper {
    overflow-x: auto;
  }

  .cnp-meds-table {
    min-width: 760px;
  }
}

@media (max-width: 560px) {
  .page-intro {
    margin-bottom: 24px;
  }

  .cnp-actions-right {
    width: 100%;
  }

  #rxIssueMenu {
    left: 0 !important;
    right: auto !important;
    min-width: calc(100vw - 72px) !important;
  }
}


/* ===== Embedded patient history merge ===== */
.cnp-history-section {
  margin-bottom: 26px;
}

.cnp-history-header {
  margin-bottom: 18px;
}

.cnp-history-header h2 {
  margin: 0 0 10px;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(1.65rem, 2.8vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: #333333;
}

.cnp-history-subtitle {
  max-width: 860px;
}

.cnp-history-shell {
  display: grid;
  gap: 24px;
}

.cnp-history-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.95fr);
  gap: 24px;
  align-items: stretch;
}

.cnp-history-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(252, 250, 247, 0.95));
  box-shadow: var(--shadow-card);
}

.cnp-history-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.05));
  opacity: 0.9;
}

.cnp-history-card>* {
  position: relative;
  z-index: 1;
}

.cnp-history-patient-card {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 28px;
}

.cnp-history-avatar {
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: "Montserrat", sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary-3);
  background: linear-gradient(145deg, #fbf7f0, #f1e8dc);
  border: 1px solid rgba(176, 115, 43, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 16px 28px rgba(176, 115, 43, 0.12);
}

.cnp-history-patient-meta {
  flex: 1;
  min-width: 0;
}

.cnp-history-patient-meta h3,
.cnp-history-card-head h4,
.cnp-history-modal-header h4 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  color: #333333;
}

.cnp-history-patient-meta h3 {
  margin-bottom: 8px;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.cnp-history-card-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--primary-3);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cnp-history-meta-line,
.cnp-history-patient-extra,
.cnp-history-card-support {
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.75;
}

.cnp-history-meta-separator {
  margin: 0 8px;
  color: var(--text-muted);
}

.cnp-history-patient-extra {
  margin-top: 10px;
}

.cnp-history-filter-card,
.cnp-history-timeline-card,
.cnp-history-table-card {
  padding: 24px 26px 26px;
}

.cnp-history-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.cnp-history-card-head h4 {
  margin-bottom: 8px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.cnp-history-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}

.cnp-history-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cnp-history-field span {
  color: #333333;
  font-size: 0.92rem;
  font-weight: 700;
}

.cnp-history-field-full,
.cnp-history-filter-actions {
  grid-column: 1 / -1;
}

.cnp-history-filters input,
.cnp-history-filters select {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid rgba(51, 51, 51, 0.1);
  border-radius: 18px;
  color: #333333;
  font-size: 0.96rem;
  font-family: "Open Sans", sans-serif;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(250, 248, 244, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
  appearance: none;
}

.cnp-history-filters input:focus,
.cnp-history-filters select:focus {
  outline: none;
  border-color: rgba(176, 115, 43, 0.38);
  box-shadow:
    0 0 0 4px rgba(176, 115, 43, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.cnp-history-filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cnp-history-filter-btn,
.cnp-history-reset-btn {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.cnp-history-filter-btn {
  border: 0;
  color: #ffffff;
  background: linear-gradient(135deg, #333333, #333333);
  box-shadow:
    0 14px 24px rgba(51, 51, 51, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.cnp-history-reset-btn {
  border: 1px solid rgba(51, 51, 51, 0.12);
  color: var(--text);
  background: linear-gradient(180deg, #ffffff, #faf7f2);
  box-shadow: 0 10px 18px rgba(51, 51, 51, 0.06);
}

.cnp-history-filter-btn:hover,
.cnp-history-reset-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

#historyState {
  min-height: 0;
}

#historyState:empty {
  display: none;
}

.cnp-history-success,
.cnp-history-error,
.cnp-history-loading,
.cnp-history-empty {
  padding: 15px 18px;
  border-radius: 20px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.65;
  box-shadow: var(--shadow-soft);
}

.cnp-history-success {
  color: #1c7d4d;
  background: #edf8f1;
  border-color: rgba(28, 125, 77, 0.16);
}

.cnp-history-error {
  color: #b13f3f;
  background: #fbefef;
  border-color: rgba(177, 63, 63, 0.16);
}

.cnp-history-loading {
  color: #8a5d21;
  background: #f7f2ea;
  border-color: rgba(176, 115, 43, 0.16);
}

.cnp-history-empty {
  color: var(--text-soft);
  background: #faf8f4;
  border-color: rgba(51, 51, 51, 0.08);
}

.cnp-history-timeline-wrap {
  width: 100%;
  min-height: 340px;
  padding: 10px 0 2px;
}

.cnp-history-timeline-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.cnp-history-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.cnp-history-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 50%;
}

.cnp-history-dot-issued {
  background: #b0732b;
}

.cnp-history-dot-dispensed {
  background: #3d9d6c;
}

.cnp-history-dot-expired {
  background: #b13f3f;
}

.cnp-history-table-wrap {
  overflow-x: auto;
}

.cnp-history-table,
.cnp-history-items-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(51, 51, 51, 0.09);
  background: rgba(255, 255, 255, 0.96);
}

.cnp-history-table thead th,
.cnp-history-items-table thead th {
  padding: 16px 18px;
  color: #ffffff;
  font-size: 0.93rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  background: linear-gradient(135deg, #b0732b, #9d6423);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.cnp-history-table thead th:last-child,
.cnp-history-items-table thead th:last-child {
  border-right: 0;
}

.cnp-history-table tbody td,
.cnp-history-items-table tbody td {
  padding: 14px 18px;
  white-space: nowrap;
  border-top: 1px solid rgba(51, 51, 51, 0.09);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.96);
}

.cnp-history-table tbody tr {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.cnp-history-table tbody tr:hover td {
  background: #faf7f2;
}

.cnp-history-table-empty {
  color: var(--text-soft);
  text-align: center;
}

.cnp-history-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.cnp-history-status-badge.status-issued,
.cnp-history-status-badge.status-active,
.cnp-history-status-badge.status-partially_dispensed {
  color: #8a5d21;
  background: #f7f1e6;
  border-color: rgba(176, 115, 43, 0.16);
}

.cnp-history-status-badge.status-dispensed,
.cnp-history-status-badge.status-fully_dispensed {
  color: #1c7d4d;
  background: #edf8f1;
  border-color: rgba(28, 125, 77, 0.14);
}

.cnp-history-status-badge.status-expired,
.cnp-history-status-badge.status-cancelled {
  color: #b13f3f;
  background: #fbefef;
  border-color: rgba(177, 63, 63, 0.14);
}

.cnp-history-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(31, 24, 18, 0.45);
  backdrop-filter: blur(8px);
}

.cnp-history-modal-backdrop.open {
  display: flex;
}

.cnp-history-modal {
  width: min(1040px, 100%);
  max-height: min(90vh, 900px);
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(252, 250, 247, 0.96));
  box-shadow: 0 32px 80px rgba(20, 17, 14, 0.24);
}

.cnp-history-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid rgba(51, 51, 51, 0.09);
}

.cnp-history-modal-header h4 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.cnp-history-modal-close {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(51, 51, 51, 0.1);
  border-radius: 16px;
  color: #333333;
  background: linear-gradient(180deg, #ffffff, #faf7f2);
  cursor: pointer;
}

.cnp-history-modal-body {
  padding: 24px 26px 26px;
  overflow: auto;
}

.cnp-history-rx-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 22px;
  margin-bottom: 18px;
}

.cnp-history-rx-meta div {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(51, 51, 51, 0.09);
  background: #fcfaf7;
  color: var(--text-soft);
  line-height: 1.65;
}

.cnp-history-rx-meta strong {
  color: #333333;
}

.cnp-history-modal-note {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(176, 115, 43, 0.14);
  background: linear-gradient(180deg, #fbf8f3, #f7f2ea);
  color: var(--text-soft);
  line-height: 1.75;
}

@media (max-width: 1180px) {
  .cnp-history-top-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {

  .cnp-history-filters,
  .cnp-history-rx-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {

  .cnp-history-card,
  .cnp-history-modal {
    border-radius: 28px;
  }

  .cnp-history-patient-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .cnp-history-filter-card,
  .cnp-history-timeline-card,
  .cnp-history-table-card,
  .cnp-history-modal-header,
  .cnp-history-modal-body {
    padding-left: 20px;
    padding-right: 20px;
  }
}

@media (max-width: 560px) {
  .cnp-history-filter-actions {
    flex-direction: column;
  }

  .cnp-history-filter-btn,
  .cnp-history-reset-btn {
    width: 100%;
    justify-content: center;
  }

  .cnp-history-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .cnp-history-modal-backdrop {
    padding: 14px;
  }
}

.rx-toast-stack {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.rx-toast {
  pointer-events: all;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(51, 51, 51, 0.13);
  font-family: "Open Sans", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(.22, .68, 0, 1.2), opacity 0.28s ease;
}

.rx-toast.rx-toast--in {
  transform: translateX(0);
  opacity: 1;
}

.rx-toast.rx-toast--out {
  transform: translateX(120%);
  opacity: 0;
}

.rx-toast-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.rx-toast--success .rx-toast-icon {
  background: rgba(0, 167, 110, 0.12);
  color: #007a50;
}

.rx-toast--error .rx-toast-icon {
  background: rgba(181, 95, 95, 0.12);
  color: #9e3a3a;
}

.rx-toast--warn .rx-toast-icon {
  background: rgba(176, 115, 43, 0.13);
  color: #8a5718;
}

.rx-toast--info .rx-toast-icon {
  background: rgba(51, 51, 51, 0.07);
  color: #333;
}

.rx-toast-body {
  flex: 1;
  min-width: 0;
}

.rx-toast-title {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
  margin: 0 0 2px;
}

.rx-toast--success .rx-toast-title {
  color: #005c3c;
}

.rx-toast--error .rx-toast-title {
  color: #7a2a2a;
}

.rx-toast--warn .rx-toast-title {
  color: #7a4a10;
}

.rx-toast--info .rx-toast-title {
  color: #333;
}

.rx-toast-msg {
  margin: 0;
  color: #5f5a54;
  font-size: 13px;
}

.rx-toast-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #9b948c;
  padding: 0;
  line-height: 1;
}

.rx-toast-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 20px 20px;
  width: 100%;
  transform-origin: left;
  animation: rx-shrink 4s linear forwards;
}

.rx-toast--success .rx-toast-bar {
  background: #00a76e;
}

.rx-toast--error .rx-toast-bar {
  background: #b55f5f;
}

.rx-toast--warn .rx-toast-bar {
  background: #b0732b;
}

.rx-toast--info .rx-toast-bar {
  background: #333;
}

@keyframes rx-shrink {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

/* ===== Medicine search dropdown + dosage field styling ===== */
.rx-med-dd {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 10px);
  z-index: 80;
  display: none;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid rgba(51, 51, 51, 0.08);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(252, 250, 247, 0.97));
  box-shadow:
    0 26px 56px rgba(51, 51, 51, 0.16),
    0 8px 20px rgba(176, 115, 43, 0.09);
  backdrop-filter: blur(14px);
}

.rx-med-dd.is-open {
  display: block;
}

.rx-med-dd::-webkit-scrollbar {
  width: 10px;
}

.rx-med-dd::-webkit-scrollbar-track {
  background: transparent;
}

.rx-med-dd::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(176, 115, 43, 0.3);
  background-clip: padding-box;
}

.rx-med-dd-empty {
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(250, 248, 244, 0.96), rgba(255, 255, 255, 0.96));
  text-align: center;
}

.rx-med-dd-empty-title {
  display: block;
  margin-bottom: 4px;
  font-family: "Montserrat", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  color: #333333;
}

.rx-med-dd-empty-copy {
  display: block;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.6;
}

.rx-med-dd-item {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.rx-med-dd-item + .rx-med-dd-item {
  margin-top: 6px;
}

.rx-med-dd-item:hover,
.rx-med-dd-item:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(176, 115, 43, 0.1), rgba(176, 115, 43, 0.05));
  box-shadow: inset 0 0 0 1px rgba(176, 115, 43, 0.14);
}

.rx-med-dd-item-name {
  font-family: "Montserrat", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #333333;
  line-height: 1.4;
}

.rx-med-dd-item-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.rx-med-dd-item-meta {
  flex: 1;
  min-width: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}

.rx-med-dd-item-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(176, 115, 43, 0.16);
  background: rgba(176, 115, 43, 0.1);
  color: var(--primary-3);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.rx-med-dd-item.is-multiple .rx-med-dd-item-badge {
  border-color: rgba(51, 51, 51, 0.1);
  background: rgba(51, 51, 51, 0.06);
  color: #333333;
}

.med-dosage-field {
  position: relative;
}

.med-input-dosage,
.med-input-dosage-select {
  min-height: 50px;
}

.med-input-dosage.is-readonly {
  color: #7a5626;
  font-weight: 700;
  border-bottom-color: rgba(176, 115, 43, 0.3);
  background:
    linear-gradient(180deg, rgba(250, 248, 244, 0.94), rgba(255, 255, 255, 0));
  box-shadow: inset 0 -1px 0 rgba(176, 115, 43, 0.12);
}

.med-input-dosage-select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23b0732b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}

.med-input-dosage-select option {
  color: #333333;
  background: #ffffff;
}

.med-dosage-field[data-mode="select"]::after {
  position: absolute;
  right: 34px;
  top: -14px;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(176, 115, 43, 0.14);
  color: var(--primary-3);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

@media (max-width: 760px) {
  .rx-med-dd {
    max-height: 260px;
    padding: 8px;
    border-radius: 20px;
  }

  .rx-med-dd-item {
    padding: 12px 14px;
    border-radius: 16px;
  }

  .rx-med-dd-item-meta-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .med-dosage-field[data-mode="select"]::after {
    position: static;
    display: inline-flex;
    margin-bottom: 8px;
  }
}