html {
  scroll-behavior: smooth;
}

:root {
  --rx-cyan: #14CFE0;
  --rx-blue: #0A8AC8;
  --rx-deep-blue: #0754A8;
  --rx-navy: #102B57;
  --rx-dark-navy: #071D3D;

  --rx-bg: #EAF4FF;
  --rx-card: #FFFFFF;
  --rx-border: #D7E6F8;

  --rx-text: #172033;
  --rx-text-muted: #60708A;

  --rx-success: #18BFA6;
  --rx-warning: #F5A524;
  --rx-danger: #E5484D;

  --rx-gradient: linear-gradient(135deg, #14CFE0 0%, #0A8AC8 48%, #0754A8 100%);
  --rx-gradient-dark: linear-gradient(135deg, #102B57 0%, #0754A8 60%, #14CFE0 100%);
  --rx-gradient-hero: linear-gradient(160deg, #14CFE0 0%, #0A8AC8 25%, #0754A8 55%, #071D3D 100%);

  --rx-radius-sm: 10px;
  --rx-radius-md: 18px;
  --rx-radius-lg: 28px;
  --rx-shadow: 0 18px 45px rgba(7, 29, 61, 0.14);

  color: var(--rx-text);
  background: var(--rx-bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
}

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

button {
  border: 0;
  border-radius: var(--rx-radius-sm);
  background: var(--rx-gradient);
  color: white;
  cursor: pointer;
  font-weight: 800;
  padding: 0.9rem 1.2rem;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

button:hover {
  background: var(--rx-gradient-dark);
  box-shadow: 0 12px 24px rgba(7, 84, 168, 0.28);
  transform: translateY(-1px);
}

button:disabled {
  background: #eaeaea;
  box-shadow: none;
  color: #adb5bd;
  cursor: not-allowed;
  transform: none;
}

.app-shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 2rem;
}

.top-nav {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  position: relative;
}

.nav-links {
  align-items: center;
  display: flex;
  gap: 0.8rem;
}

.nav-hamburger {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-navy);
  display: none;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.55rem 0.75rem;
}

.nav-hamburger:hover {
  background: var(--rx-border);
  box-shadow: none;
  transform: none;
}

.top-nav a:not(.nav-brand) {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-navy);
  font-size: 0.875rem;
  font-weight: 800;
  padding: 0.6rem 0.9rem;
  text-decoration: none;
}

.top-nav a:not(.nav-brand).is-active {
  background: var(--rx-gradient);
  border-color: transparent;
  color: #fff;
}

.nav-brand {
  align-items: center;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--rx-text);
  display: flex;
  font-size: 1.05rem;
  font-weight: 700;
  gap: 0.5rem;
  letter-spacing: -0.04em;
  margin-right: auto;
  padding: 0;
  text-decoration: none;
  transform: none;
  user-select: none;
}

.nav-brand:hover {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.nav-brand:focus,
.nav-brand:focus-visible,
.nav-brand:active {
  border: none;
  box-shadow: none;
  outline: none;
}

.nav-logo {
  border: none;
  border-radius: 0.75rem;
  display: block;
  flex-shrink: 0;
  height: 3rem;
  max-height: 3rem;
  max-width: 3rem;
  object-fit: contain;
  outline: none;
  width: 3rem;
}

.nav-actions {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  position: relative;
}

/* ── Nav icon buttons (bell, user) ─────────────────────────────────────────── */

.nav-bell-btn,
.nav-user-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: 50%;
  color: var(--rx-navy);
  display: flex;
  font-size: 1rem;
  height: 2.4rem;
  justify-content: center;
  padding: 0;
  position: relative;
  width: 2.4rem;
  flex-shrink: 0;
}

.nav-user-btn {
  background: #e9ecef;
  border-color: #ced4da;
}

.nav-bell-btn:hover,
.nav-user-btn:hover {
  background: var(--rx-border);
  box-shadow: none;
  transform: none;
}

.nav-user-btn i {
  font-size: 1.15rem;
}

.nav-bell-btn svg,
.nav-user-btn svg {
  height: 1.15rem;
  width: 1.15rem;
}

.nav-bell-badge {
  align-items: center;
  background: var(--rx-danger);
  border: 2px solid var(--rx-card);
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 0.6rem;
  font-weight: 900;
  height: 1.05rem;
  justify-content: center;
  min-width: 1.05rem;
  padding: 0 0.2rem;
  position: absolute;
  right: -0.15rem;
  top: -0.15rem;
}

.nav-bell-badge[hidden] {
  display: none;
}

/* ── Notification panel ─────────────────────────────────────────────────────── */

.notif-panel {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  box-shadow: var(--rx-shadow);
  flex-direction: column;
  max-height: min(480px, calc(100vh - 5rem));
  min-width: 320px;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(460px, calc(100vw - 2rem));
  z-index: 1100;
}

.notif-panel:not([hidden]) {
  display: flex;
}

.notif-panel-header {
  align-items: center;
  border-bottom: 1px solid var(--rx-border);
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.notif-panel-title {
  color: var(--rx-navy);
  font-size: 0.9rem;
  font-weight: 700;
}

.notif-mark-all-btn {
  background: none;
  border: none;
  color: var(--rx-blue);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
}

.notif-mark-all-btn:hover {
  box-shadow: none;
  color: var(--rx-deep-blue);
  transform: none;
}

.notif-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.notif-empty {
  color: var(--rx-text-muted);
  font-size: 0.88rem;
  padding: 1.5rem 1rem;
  text-align: center;
}

.notif-item {
  border-left: 3px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  transition: background 120ms ease;
}

.notif-item + .notif-item {
  border-top: 1px solid var(--rx-border);
}

.notif-item--unread {
  background: rgba(7, 84, 168, 0.04);
}

.notif-item:hover {
  background: var(--rx-bg);
}

.notif-item--low_stock {
  border-left-color: var(--rx-warning);
}

.notif-item--critical_stock {
  border-left-color: #e5800a;
}

.notif-item--out_of_stock {
  border-left-color: var(--rx-danger);
}

.notif-item-body {
  align-items: flex-start;
  display: flex;
  gap: 0.625rem;
}

.notif-item-icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1.4;
}

.notif-item--low_stock .notif-item-icon {
  color: var(--rx-warning);
}

.notif-item--critical_stock .notif-item-icon {
  color: #e5800a;
}

.notif-item--out_of_stock .notif-item-icon {
  color: var(--rx-danger);
}

.notif-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.notif-item-name {
  color: var(--rx-text);
  font-size: 0.88rem;
  font-weight: 700;
}

.notif-item-desc {
  color: var(--rx-text-muted);
  font-size: 0.8rem;
}

.notif-item-actions {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.notif-refill-btn {
  background: var(--rx-deep-blue);
  border: none;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
}

.notif-refill-btn:hover {
  background: var(--rx-navy);
  box-shadow: none;
  transform: none;
}

.notif-dismiss-btn {
  background: none;
  border: none;
  color: var(--rx-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.25rem;
}

.notif-dismiss-btn:hover {
  box-shadow: none;
  color: var(--rx-danger);
  transform: none;
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */

.hero {
  align-items: stretch;
  background:
    radial-gradient(ellipse at top left, rgba(20, 207, 224, 0.32) 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(7, 29, 61, 0.55) 0%, transparent 60%),
    var(--rx-gradient-hero);
  border-radius: var(--rx-radius-lg);
  color: white;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.eyebrow {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.4rem, 7vw, 5rem);
  letter-spacing: -0.07em;
  line-height: 0.94;
  margin-bottom: 1rem;
  max-width: 760px;
}

.hero-copy {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  margin-bottom: 0;
  max-width: 720px;
}

.hero-card[hidden] { display: none; }

.hero-card {
  align-self: center;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 1.5rem;
  box-shadow: 0 24px 60px rgba(3, 18, 42, 0.24);
  display: grid;
  gap: 0.5rem;
  padding: 1.5rem;
}

.adherence-ring-wrap {
  align-items: center;
  display: flex;
  height: 140px;
  justify-content: center;
  justify-self: center;
  position: relative;
  width: 140px;
}

.adherence-ring {
  height: 100%;
  transform: rotate(-90deg);
  width: 100%;
}

.adherence-ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.20);
  stroke-width: 8;
}

.adherence-ring-fill {
  fill: none;
  stroke: url(#adherence-gradient);
  stroke-dasharray: 263.89;
  stroke-dashoffset: 263.89;
  stroke-linecap: round;
  stroke-width: 8;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.adherence-ring-num {
  font-size: 1.9rem;
  font-weight: 800;
  left: 50%;
  letter-spacing: -0.05em;
  line-height: 1;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-left .hero-card {
  align-self: stretch;
  flex: 1;
}

/* ── Hero next dose redesign ────────────────────────────────────────────────── */

.hero-next-dose-primary {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.hero-next-dose-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.4rem;
  min-width: 0;
}

.hero-next-dose-eyebrow {
  align-items: center;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  font-size: 0.78rem;
  font-weight: 900;
  gap: 0.4rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-next-dose-time-large {
  color: #fff;
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.hero-next-dose-name-large {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
  hyphens: auto;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.hero-dose-badge {
  background: rgba(20, 207, 224, 0.30);
  border: 1px solid rgba(20, 207, 224, 0.50);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.28rem 0.85rem;
  width: fit-content;
}

.hero-med-graphic {
  background: rgba(255, 255, 255, 0.12);
  border: 3px solid rgba(255, 255, 255, 0.30);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  flex-shrink: 0;
  height: 84px;
  overflow: hidden;
  width: 84px;
}

.med-graphic-image {
  height: 100%;
  object-fit: cover;
  object-position: center;
  width: 100%;
}

.hero-upcoming-section {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.hero-upcoming-label {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.hero-upcoming-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.hero-upcoming-time {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  font-weight: 700;
}

.hero-upcoming-name {
  color: #fff;
  flex: 1;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hero-upcoming-dose-badge {
  background: rgba(20, 207, 224, 0.25);
  border: 1px solid rgba(20, 207, 224, 0.45);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
}

/* ── Hero adherence card ─────────────────────────────────────────────────────── */

.hero-adherence-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: center;
}

.hero-adherence-header {
  align-items: center;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  font-size: 0.78rem;
  font-weight: 900;
  gap: 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-adherence-body {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-adherence-stats {
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  gap: 0.3rem;
}

.hero-next-dose-panel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hero-next-dose-entry {
  margin-top: 0.4rem;
}

.hero-next-dose-entry + .hero-next-dose-entry {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 0.75rem;
  opacity: 0.75;
  padding-top: 0.75rem;
}

.hero-next-dose-time {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-next-dose-name {
  align-items: baseline;
  color: #fff;
  display: flex;
  font-size: 1.25rem;
  font-weight: 900;
  gap: 0.5rem;
  justify-content: space-between;
  letter-spacing: -0.03em;
  margin: 0.2rem 0 0.1rem;
}

.hero-next-dose-dose {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.hero-next-dose-meta {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.group-meds-toggle {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transform: none;
}

.group-meds-toggle:hover {
  background: transparent;
  box-shadow: none;
  color: #fff;
  transform: none;
}

.group-meds-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.group-meds-list[hidden] {
  display: none;
}

.group-meds-member {
  align-items: baseline;
  display: flex;
  gap: 0.5rem;
  font-size: 0.88rem;
}

.group-meds-member .hero-med-dose {
  font-weight: 400;
}

.hero-med-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: space-between;
}

.hero-med-card-header {
  display: flex;
}

.hero-med-card-title {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.hero-med-card-actions {
  display: flex;
  gap: 0.5rem;
}

.hero-card button {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.30);
  color: white;
  font-size: 0.82rem;
  padding: 0.55rem 0.9rem;
}

.hero-card button:hover {
  background: rgba(255, 255, 255, 0.30);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.hero-ellipsis-btn {
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  line-height: 1;
  padding: 0.4rem 0.75rem !important;
}

.hero-count-badge {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.30);
  color: white;
}

.hero-med-preview {
  display: grid;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.hero-med-preview li {
  align-items: center;
  display: flex;
  font-size: 0.88rem;
  font-weight: 700;
  justify-content: space-between;
}

.hero-med-name {
  color: #fff;
}

.hero-med-dose {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 400;
}

.hero-med-more,
.hero-med-empty {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  margin: 0;
}

/* ── Medication plan modal ─────────────────────────────────────────────────── */

.med-plan-modal-overlay {
  align-items: center;
  background: rgba(10, 18, 33, 0.60);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1.5rem;
  position: fixed;
  z-index: 900;
}

.med-plan-modal-overlay[hidden] {
  display: none;
}

.med-plan-modal-inner {
  background: var(--rx-card);
  border-radius: var(--rx-radius-md);
  box-shadow: 0 32px 80px rgba(10, 18, 33, 0.28);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  max-width: 720px;
  overflow: hidden;
  padding: 1.5rem;
  width: 100%;
}

.med-plan-modal-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.med-plan-close-btn {
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.4rem 0.75rem;
}

.stat-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.alert {
  background: rgba(229, 72, 77, 0.10);
  border: 1px solid rgba(229, 72, 77, 0.35);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-danger);
  font-weight: 800;
  margin-top: 1.25rem;
  padding: 1rem;
}

.dashboard-grid {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) 320px;
  margin-top: 1.25rem;
}

.dashboard-schedule-panel {
  min-width: 0;
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-panel-heading {
  align-items: center;
  color: var(--rx-text);
  display: flex;
  font-size: 1rem;
  font-weight: 800;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

/* ── Quick Actions ───────────────────────────────────────────────────────────── */

.quick-actions-panel {
  display: flex;
  flex-direction: column;
}

.quick-action-row {
  align-items: center;
  border-bottom: 1px solid var(--rx-border);
  color: var(--rx-text);
  display: flex;
  font-size: 0.9rem;
  font-weight: 600;
  gap: 0.75rem;
  padding: 0.75rem 0;
  text-decoration: none;
  transition: color 160ms ease;
}

.quick-action-row:first-of-type {
  padding-top: 0;
}

.quick-action-row:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.quick-action-row:hover {
  color: var(--rx-deep-blue);
}

.quick-action-icon {
  align-items: center;
  border-radius: 50%;
  display: flex;
  flex-shrink: 0;
  font-size: 1rem;
  height: 2.25rem;
  justify-content: center;
  width: 2.25rem;
}

.quick-action-icon--add {
  background: var(--rx-gradient);
  color: #fff;
}

.quick-action-icon--log {
  background: rgba(20, 207, 224, 0.12);
  color: var(--rx-blue);
}

.quick-action-icon--manage {
  background: rgba(7, 84, 168, 0.12);
  color: var(--rx-deep-blue);
}

.quick-action-icon--mood {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.quick-action-label {
  flex: 1;
}

.quick-action-chevron {
  color: var(--rx-text-muted);
  font-size: 0.72rem;
}

/* ── Medications Overview ────────────────────────────────────────────────────── */

.medications-overview-panel {
  display: flex;
  flex-direction: column;
}

.medications-overview-list {
  display: flex;
  flex-direction: column;
}

.medications-overview-row {
  align-items: center;
  border-bottom: 1px solid var(--rx-border);
  color: var(--rx-text);
  display: flex;
  font-size: 0.9rem;
  justify-content: space-between;
  padding: 0.65rem 0;
}

.medications-overview-row:last-child {
  border-bottom: none;
}

button.medications-overview-row {
  background: none;
  border-radius: 0;
  color: inherit;
  font-weight: inherit;
  padding: 0.65rem 0;
  width: 100%;
}
button.medications-overview-row:hover,
button.medications-overview-row:active {
  background: none;
  box-shadow: none;
  transform: none;
}

.medications-overview-row--link {
  color: var(--rx-deep-blue);
}

.medications-overview-row-chevron {
  color: var(--rx-muted);
  font-size: 0.72rem;
}

.medications-overview-value {
  font-size: 0.95rem;
  font-weight: 800;
}

.medications-overview-value--taken {
  color: var(--rx-success);
}

.medications-overview-value--missed {
  color: var(--rx-danger);
}

.medications-overview-link {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 0.85rem;
  text-align: center;
}

/* ── Panel link utilities ────────────────────────────────────────────────────── */

.panel-link {
  color: var(--rx-deep-blue);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.panel-link:hover {
  color: var(--rx-blue);
  text-decoration: underline;
}

.panel-heading-link {
  align-items: center;
  background: transparent;
  border: none;
  color: var(--rx-deep-blue);
  display: flex;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 0.35rem;
  margin-left: auto;
  padding: 0;
  text-decoration: none;
  white-space: nowrap;
}

.panel-heading-link:hover {
  background: transparent;
  box-shadow: none;
  color: var(--rx-blue);
  text-decoration: underline;
  transform: none;
}

.schedule-view-full {
  border-top: 1px solid var(--rx-border);
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  text-align: center;
}

.content-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.25rem;
}

.notice {
  background: rgba(10, 138, 200, 0.10);
  border: 1px solid rgba(10, 138, 200, 0.28);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-deep-blue);
  font-weight: 800;
  margin-top: 1.25rem;
  padding: 1rem;
}

.pwa-install-banner {
  align-items: center;
  background: var(--rx-gradient);
  border-radius: var(--rx-radius-sm);
  color: white;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
}

.pwa-install-banner[hidden] {
  display: none;
}

.pwa-install-text {
  font-size: 0.9rem;
  font-weight: 700;
}

.pwa-install-actions {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
}

.pwa-install-actions button {
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
}

.pwa-install-actions .secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: white;
}

.content-grid {
  align-items: start;
}

.panel {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  box-shadow: var(--rx-shadow);
  padding: 1.35rem;
  width: 100%;
}

.panel-heading {
  align-items: center;
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.panel-heading h2 {
  font-size: 1rem;
  margin: 0;
}

.panel-heading-date {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.6;
}

.panel-heading-right {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.history-sort-btn {
  background: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--rx-deep-blue);
  font-size: 1.2rem;
  font-weight: inherit;
  padding: 0;
  transition: none;
  vertical-align: middle;
}

.history-sort-btn:hover,
.history-sort-btn:active {
  background: none;
  box-shadow: none;
  transform: none;
}

.medication-list-panel {
  grid-column: 1 / -1;
}

.medication-plan-heading {
  justify-content: space-between;
}

.medication-plan-title-wrap,
.medication-plan-actions {
  align-items: center;
  display: flex;
  gap: 0.6rem;
}

/* ── Medications page ────────────────────────────────────────────────────── */

.medications-page {
  margin-top: 1.25rem;
}

.medications-page .plan-tab-panel {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  box-shadow: var(--rx-shadow);
  padding: 1rem;
}

.medications-page-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.medications-page-title {
  align-items: center;
  display: flex;
  gap: 0.6rem;
}

.medications-page-title h1 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
}

.medications-page-actions {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.medications-page-actions button {
  align-items: center;
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
}

.count-badge {
  background: rgba(7, 84, 168, 0.10);
  border: 1px solid rgba(7, 84, 168, 0.22);
  border-radius: 999px;
  color: var(--rx-deep-blue);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  min-width: 1.8rem;
  padding: 0.35rem 0.5rem;
  text-align: center;
}

.medication-list-wrap[hidden] {
  display: none;
}

.medication-plan-tabs {
  border-bottom: 1px solid var(--rx-border);
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.medications-page-header .medication-plan-tabs {
  margin-bottom: 0;
}

.plan-tab {
  align-items: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  box-shadow: none;
  color: var(--rx-text-muted);
  display: inline-flex;
  font-size: 0.88rem;
  gap: 0.4rem;
  margin-bottom: -1px;
  padding: 0.5rem 0.1rem;
  transform: none;
}

.plan-tab:hover {
  background: transparent;
  box-shadow: none;
  color: var(--rx-text);
  transform: none;
}

.plan-tab.is-active {
  background: transparent;
  border-bottom-color: var(--rx-blue);
  box-shadow: none;
  color: var(--rx-blue);
  font-weight: 800;
}

.plan-tab-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.plan-tab-panel[hidden] {
  display: none;
}

.next-dose-card {
  background: var(--rx-bg);
  border-radius: var(--rx-radius-sm);
  padding: 1.25rem;
}

.next-dose-list {
  display: grid;
  gap: 0.7rem;
  max-height: 565px;
  overflow-y: auto;
}

.next-dose-card span {
  color: var(--rx-deep-blue);
  font-weight: 900;
}

.next-dose-card h3 {
  font-size: 1.8rem;
  letter-spacing: -0.04em;
  margin: 0.35rem 0 0.2rem;
}

.next-dose-card h4 {
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  margin: 0.25rem 0 0.15rem;
}

.next-dose-card p {
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.next-dose-card-subtle {
  background: rgba(234, 244, 255, 0.6);
  opacity: 0.8;
}

.next-dose-card-subtle p {
  font-weight: 700;
}

.next-dose-card small,
.medication-row small,
.history-list small {
  color: var(--rx-text-muted);
}

.empty-state {
  align-items: center;
  background: rgba(24, 191, 166, 0.10);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-success);
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem;
}

.empty-state p {
  margin-bottom: 0;
}

.stacked-form,
.medication-form {
  display: grid;
  gap: 0.9rem;
}

.medication-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.medication-form > label:nth-last-of-type(-n+2),
.medication-form > button,
.medication-form > .form-disclosure,
.medication-form > .modal-footer {
  grid-column: 1 / -1;
}

/* Grid items default to min-width: auto, which pins them to their content's
   intrinsic width — a <select> or dose-time row can then blow out the track
   and get silently clipped by .modal-scroll's mobile overflow-x: hidden.
   Real-device font metrics (Roboto, etc.) make this worse than desktop
   devtools emulation shows, so guard every direct child explicitly. */
.medication-form > *,
.form-section > * {
  min-width: 0;
}

.form-section {
  border: none;
  border-top: 1px solid var(--rx-border);
  display: grid;
  gap: 0.75rem;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0.75rem 0 0;
}

/* ── Add-medication multi-step wizard ─────────────────────────────────────── */

.med-wizard-step {
  display: contents;
}

.med-wizard-step[hidden] {
  display: none;
}

.med-wizard-step > label,
.med-wizard-step > button.btn-text {
  grid-column: 1 / -1;
}

.med-wizard-step [hidden] {
  display: none;
}

.med-wizard-progress {
  display: flex;
  gap: 0.6rem;
  padding: 0.25rem 1.25rem 1rem;
}

.med-wizard-seg {
  background: none;
  border: none;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0;
  transform: none;
}

.med-wizard-seg:hover {
  background: none;
  box-shadow: none;
  transform: none;
}

.med-wizard-seg:disabled,
.med-wizard-seg.is-locked {
  background: none;
  box-shadow: none;
  cursor: not-allowed;
}

.med-wizard-seg-fill {
  background: var(--rx-border);
  border-radius: 999px;
  display: block;
  height: 6px;
  overflow: hidden;
  position: relative;
}

.med-wizard-seg-fill::after {
  background: var(--rx-deep-blue);
  border-radius: inherit;
  content: '';
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease, background-color 0.3s ease;
  width: 100%;
}

.med-wizard-seg.is-active .med-wizard-seg-fill::after,
.med-wizard-seg.is-done .med-wizard-seg-fill::after {
  transform: scaleX(1);
}

.med-wizard-seg.is-done .med-wizard-seg-fill::after {
  background: var(--rx-success);
}

.med-wizard-seg-label {
  color: var(--rx-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.med-wizard-seg.is-active .med-wizard-seg-label {
  color: var(--rx-navy);
}

.input-with-unit {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.input-with-unit input {
  flex: 1;
  min-width: 0;
}

.form-section legend {
  color: var(--rx-text-muted);
  float: left;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 0 0.4rem;
  text-transform: uppercase;
  width: 100%;
}

.form-disclosure {
  grid-column: 1 / -1;
}

.form-disclosure-toggle {
  color: var(--rx-deep-blue);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  list-style: none;
  padding: 0.35rem 0;
  user-select: none;
}

.form-disclosure-toggle::-webkit-details-marker {
  display: none;
}

.form-disclosure-toggle::before {
  content: '\25B6\00A0';
  font-size: 0.7em;
}

details[open] .form-disclosure-toggle::before {
  content: '\25BC\00A0';
}

.form-disclosure .form-section {
  margin-top: 0.5rem;
}

[data-dose-times-section] {
  display: grid;
  gap: 0.35rem;
}

.dose-times-label {
  color: var(--rx-text-muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.dose-time-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dose-time-field {
  flex: 1 1 6rem;
  min-width: 0;
}

.dose-qty-field {
  flex: 0 1 6rem;
  min-width: 0;
}

.btn-icon {
  background: none;
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  padding: 0.3rem 0.55rem;
}

.btn-icon:hover {
  background: var(--rx-bg-alt);
  color: var(--rx-danger);
}

.btn-text {
  background: none;
  border: none;
  color: var(--rx-deep-blue);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.1rem 0;
  text-align: left;
}

.btn-text:hover {
  background: none;
  box-shadow: none;
  transform: none;
}

label {
  color: var(--rx-text-muted);
  display: grid;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 0.35rem;
}

input,
select,
textarea {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-text);
  min-height: 3rem;
  outline: none;
  padding: 0.75rem 0.9rem;
}

textarea {
  min-height: unset;
  resize: vertical;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus,
.field-error {
  border-color: var(--rx-deep-blue);
  box-shadow: 0 0 0 4px rgba(7, 84, 168, 0.12);
}

.medication-list {
  display: grid;
  gap: 0.75rem;
}

.medication-row {
  align-items: center;
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-width: 0;
  padding: 0.9rem;
}

.medication-row p {
  color: var(--rx-text-muted);
  margin: 0.15rem 0;
}

.row-actions {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  min-width: 0;
}

.row-actions form {
  margin: 0;
}

.medication-content {
  min-width: 0;
}

.med-dose {
  color: #6b7280;
  font-weight: 700;
}

.dose-inline {
  color: #6b7280;
  font-size: 0.82rem;
  font-weight: 700;
  margin-left: 0.3rem;
}

.med-type-badge {
  border-radius: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-left: 0.5rem;
  padding: 0.1rem 0.4rem;
  text-transform: uppercase;
  vertical-align: middle;
}

.med-type-badge--prescription {
  background: rgba(7, 84, 168, 0.10);
  color: var(--rx-deep-blue);
}

.med-type-badge--otc {
  background: rgba(24, 191, 166, 0.12);
  color: #0e7a68;
}

.med-type-badge--supplement {
  background: rgba(245, 165, 36, 0.12);
  color: #8a5c00;
}

.med-type-badge--draft {
  background: rgba(96, 112, 138, 0.14);
  color: var(--rx-text-muted);
}

.hero-next-dose-panel .med-type-badge {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: rgba(255, 255, 255, 0.95);
}

.med-filter-wrap {
  border-bottom: 1px solid var(--rx-border);
  display: flex;
  justify-content: flex-end;
  padding: 0.4rem 1rem;
  position: relative;
}

.med-filter-trigger {
  background: none;
  border-radius: var(--rx-radius-sm);
  color: var(--rx-muted);
  font-size: 1.1rem;
  padding: 0.3rem 0.4rem;
  transition: none;
}
.med-filter-trigger:hover,
.med-filter-trigger:active {
  background: none;
  box-shadow: none;
  color: var(--rx-deep-blue);
  transform: none;
}

.med-filter-dropdown {
  background: #fff;
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  min-width: 190px;
  padding: 0.4rem 0 0.6rem;
  position: absolute;
  right: 1rem;
  top: calc(100% + 4px);
  z-index: 200;
}

.med-filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.med-filter-option {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 0.88rem;
  gap: 0.55rem;
  padding: 0.5rem 0.85rem;
  user-select: none;
}
.med-filter-option:hover {
  background: var(--rx-hover, rgba(7, 84, 168, 0.04));
}

.med-filter-check {
  color: var(--rx-deep-blue);
  font-size: 0.75rem;
  visibility: hidden;
  width: 0.8rem;
}
.med-filter-option.is-selected .med-filter-check {
  visibility: visible;
}

.med-filter-apply {
  background: #0A8AC8;
  border-radius: var(--rx-radius-sm);
  color: #fff;
  cursor: pointer;
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.5rem 0.85rem 0;
  padding: 0.45rem 0.75rem;
  text-align: center;
  transition: background-color 0.2s ease;
  width: calc(100% - 1.7rem);
}
.med-filter-apply:hover {
  background: #14CFE0;
  box-shadow: none;
  transform: none;
}

.med-filter-empty-msg {
  color: var(--rx-muted);
  font-size: 0.9rem;
  padding: 2rem 1rem;
  text-align: center;
}

.medication-row-plan {
  align-items: flex-start;
  display: grid;
  gap: 0 0.75rem;
  grid-template-columns: 1.5rem minmax(0, 1fr);
}

.medication-actions-top {
  align-items: center;
  align-self: flex-start;
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

/* Top row inside the medication content: title/dose on left, action buttons on right */
.med-top-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
}
.med-top-left {
  min-width: 0;
}
.med-title {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.med-title strong {
  white-space: normal;
}
.med-top-right {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.med-dose {
  margin: 0.15rem 0 0 0;
}

.med-actions-menu {
  position: relative;
}

.med-actions-dropdown {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  min-width: 160px;
  position: fixed;
  z-index: 1000;
}

.med-actions-item {
  align-items: center;
  background: none;
  border: none;
  color: var(--rx-text);
  cursor: pointer;
  display: flex;
  font-size: 0.88rem;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  text-decoration: none;
  width: 100%;
}

.med-actions-item:hover {
  background: var(--rx-bg);
}

.med-actions-item i {
  color: var(--rx-text-muted);
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
}

.med-actions-item--danger {
  color: var(--rx-danger);
}

.med-actions-item--danger i {
  color: var(--rx-danger);
}

.med-actions-dropdown form {
  display: contents;
}

.medication-actions-bottom {
  border-top: 1px solid var(--rx-border);
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  justify-content: flex-start;
  margin-top: 0.5rem;
  padding-top: 0.55rem;
  width: 100%;
}

.medication-actions-bottom button,
.medication-actions-bottom .secondary,
.log-se-btn {
  align-items: center;
  display: inline-flex;
  font-size: 0.82rem;
  gap: 0.4rem;
  justify-content: center;
  padding: 0.5rem 0.8rem;
  width: 45%;
}

.medication-actions-bottom form {
  width: 45%;
}

.medication-actions-bottom form button,
.medication-actions-bottom form .secondary {
  width: 100%;
}

/* Mobile: hide desktop-only buttons, show mobile more-menu */
.med-action-mobile { display: none; }
.med-action-desktop { display: inline-flex; }

.instructions-label-mobile { display: none; }

.med-actions-more-wrap {
  position: relative;
}

.med-actions-more-trigger {
  padding: 0.5rem 0.75rem;
}

.med-actions-more-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  background: var(--rx-surface);
  border: 1px solid var(--rx-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 180px;
  z-index: 200;
  padding: 0.25rem 0;
}

.med-actions-more-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rx-text);
  text-align: left;
  white-space: nowrap;
}

.med-actions-more-item:hover {
  background: var(--rx-surface-2, rgba(0,0,0,0.05));
}

.done-pill {
  align-self: flex-start;
  background: rgba(24, 191, 166, 0.12);
  border-radius: 999px;
  color: var(--rx-success);
  font-size: 0.74rem;
  font-weight: 900;
  padding: 0.3rem 0.65rem;
}

.modal-close {
  align-items: center;
  background: rgba(229, 72, 77, 0.08);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-danger);
  display: inline-flex;
  font-size: 1.35rem;
  height: 2.5rem;
  justify-content: center;
  padding: 0;
  width: 2.5rem;
}
.modal-close:hover {
  background: rgba(229, 72, 77, 0.16);
  box-shadow: none;
  transform: none;
}

.icon-button {
  align-items: center;
  background: rgba(229, 72, 77, 0.08);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-danger);
  display: inline-flex;
  font-size: 1.35rem;
  height: 2.5rem;
  justify-content: center;
  padding: 0;
  width: 2.5rem;
}

.icon-button:hover {
  background: rgba(229, 72, 77, 0.16);
  box-shadow: none;
}

.med-actions-trigger,
.note-actions-trigger {
  background: none;
  border: none;
  color: var(--rx-text-muted);
  font-size: 1.1rem;
}

.med-actions-trigger:hover,
.note-actions-trigger:hover {
  background: none;
  color: var(--rx-text);
}

.secondary {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  color: var(--rx-navy);
}

button.danger {
  background: var(--rx-danger);
  border: 1px solid var(--rx-danger);
  color: #fff;
}

button.danger:hover {
  background: #c93a3f;
  box-shadow: none;
}

/* Discontinue modal */
.discontinue-reasons {
  display: grid;
  gap: 0.35rem;
}

.discontinue-reason-option {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  font-weight: 500;
}

.discontinue-reason-option input[type="radio"] {
  margin: 0;
  width: auto;
}

/* Inactive medication rows: discontinue info */
.inactive-discontinued-line {
  color: var(--rx-danger);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.2rem 0 0;
}

.inactive-discontinued-comment {
  color: var(--rx-text-muted);
  font-size: 0.82rem;
  margin: 0.15rem 0 0;
}

.inactive-history {
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.inactive-history summary {
  color: var(--rx-text-muted);
  cursor: pointer;
}

.inactive-history-list {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0 0 0 0.25rem;
  display: grid;
  gap: 0.25rem;
}

.inactive-history-comment {
  color: var(--rx-text-muted);
}

.dose-change-history-list {
  display: grid;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
}

/* Mood graph: hint + single-day drill-down banner */
.graph-hint {
  color: var(--rx-text-muted);
  font-size: 0.78rem;
  margin: 0.5rem 0 0;
}

.mood-graph-day-banner[hidden] {
  display: none;
}

.mood-graph-day-banner {
  align-items: center;
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  display: flex;
  font-size: 0.82rem;
  font-weight: 600;
  gap: 0.75rem;
  justify-content: space-between;
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.75rem;
}

.mood-graph-day-back {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--rx-deep-blue);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.1rem 0.25rem;
}

.mood-graph-day-back:hover {
  background: none;
  box-shadow: none;
  text-decoration: underline;
}

.secondary:hover {
  background: var(--rx-border);
  box-shadow: none;
}

.secondary:disabled {
  border-color: #dce0e5;
}

.schedule-list {
  display: grid;
  gap: 0.75rem;
  max-height: 565px;
  overflow-y: auto;
}

.schedule-row {
  align-items: center;
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  min-width: 0;
  padding: 0.8rem 0.9rem;
}

.schedule-row-time {
  align-items: center;
  color: var(--rx-text-muted);
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 0.2rem;
  text-align: center;
}

.schedule-row-time i {
  color: var(--rx-blue);
  font-size: 1rem;
  margin-bottom: 0.1rem;
}

.schedule-prn {
  color: var(--rx-text-muted);
  font-size: 0.7rem;
}

.schedule-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.schedule-row-info strong {
  color: var(--rx-text);
  font-size: 0.92rem;
  font-weight: 800;
}

.schedule-row .row-actions {
  align-items: center;
  flex-direction: row;
  width: auto;
}

.schedule-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.schedule-actions-buttons button {
  font-size: 0.82rem;
  padding: 0.5rem 0.85rem;
}

.btn-take {
  background: var(--rx-gradient);
  border-radius: 8px;
  color: white;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.5rem 0.9rem;
}

.warn-pill,
.alert-pill {
  align-self: flex-start;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 0.3rem 0.65rem;
}

.warn-pill {
  background: rgba(245, 165, 36, 0.12);
  color: var(--rx-warning);
}

.alert-pill {
  background: rgba(229, 72, 77, 0.10);
  color: var(--rx-danger);
}

.pill-meta {
  font-size: 0.84rem;
  margin-top: 0.4rem;
}

.low-supply-warning {
  color: var(--rx-danger);
  font-weight: 800;
  margin: 0.3rem 0 0;
}

.calendar-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-day {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  display: grid;
  gap: 0.2rem;
  padding: 0.6rem;
}

.calendar-day strong {
  font-size: 0.85rem;
}

.marker-taken {
  color: var(--rx-success);
}

.marker-skipped {
  color: var(--rx-warning);
}

.marker-missed {
  color: var(--rx-danger);
}

.calendar-day--header {
  background: transparent;
  border-color: transparent;
  text-align: center;
}

.calendar-day--header-today {
  background: rgba(7, 84, 168, 0.08);
  border-color: rgba(7, 84, 168, 0.22);
  border-radius: var(--rx-radius-sm);
}

.calendar-day--header-today strong {
  color: var(--rx-deep-blue);
}

.calendar-day--taken {
  background: rgba(24, 191, 166, 0.10);
  border-color: rgba(24, 191, 166, 0.35);
}

.calendar-day--missed {
  background: rgba(229, 72, 77, 0.08);
  border-color: rgba(229, 72, 77, 0.30);
}

.calendar-day--skipped {
  background: rgba(245, 165, 36, 0.08);
  border-color: rgba(245, 165, 36, 0.32);
}

.calendar-day--future {
  background: var(--rx-bg);
  border-color: var(--rx-border);
  opacity: 0.55;
}

.calendar-day--empty {
  background: var(--rx-bg);
  border-color: transparent;
}

.calendar-day--today {
  box-shadow: 0 0 0 2px var(--rx-deep-blue);
}

.calendar-section {
  margin-top: 1.25rem;
}

.calendar-nav {
  justify-content: space-between;
}

.calendar-nav-btn {
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-navy);
  font-weight: 800;
  padding: 0.45rem 0.8rem;
  text-decoration: none;
}

.calendar-legend {
  display: flex;
  gap: 1.2rem;
  margin-top: 1rem;
}

.legend-item {
  align-items: center;
  display: flex;
  font-size: 0.84rem;
  gap: 0.4rem;
}

.legend-dot {
  border-radius: 999px;
  display: inline-block;
  height: 0.75rem;
  width: 0.75rem;
}

.legend-dot--taken { background: var(--rx-success); }
.legend-dot--skipped { background: var(--rx-warning); }
.legend-dot--missed { background: var(--rx-danger); }

/* Clickable calendar day cells */
.calendar-day[data-calendar-day] {
  cursor: pointer;
}
.calendar-day[data-calendar-day]:hover {
  filter: brightness(0.93);
}

/* Calendar day detail modal */
.calendar-day-dialog {
  max-width: 520px;
}

.cal-day-med-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cal-day-med-item {
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  overflow: hidden;
  padding: 0.7rem 0.85rem 0;
}

.cal-day-med-name {
  margin-bottom: 0.2rem;
}

.cal-day-med-summary {
  color: var(--rx-muted);
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.cal-day-med-details {
  border-top: 1px solid var(--rx-border);
  margin: 0 -0.85rem;
}

.cal-day-med-view-label {
  align-items: center;
  color: var(--rx-link, var(--rx-deep-blue));
  cursor: pointer;
  display: flex;
  font-size: 0.82rem;
  gap: 0.35rem;
  list-style: none;
  padding: 0.5rem 0.85rem;
  user-select: none;
}
.cal-day-med-view-label::-webkit-details-marker { display: none; }

.cal-day-chevron {
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.cal-day-med-details[open] .cal-day-chevron {
  transform: rotate(180deg);
}

.cal-day-slots {
  border-top: 1px solid var(--rx-border);
  list-style: none;
  margin: 0;
  padding: 0;
}

.cal-day-slot-row {
  align-items: center;
  border-top: 1px solid var(--rx-border);
  display: flex;
  gap: 0.6rem;
  padding: 0.45rem 0.85rem;
}
.cal-day-slot-row:first-child { border-top: none; }

.cal-day-slot-time {
  color: var(--rx-muted);
  font-size: 0.88rem;
  min-width: 4.5rem;
}

.warning-banner {
  background: rgba(245, 165, 36, 0.08);
  border: 1px solid rgba(245, 165, 36, 0.35);
  border-radius: var(--rx-radius-sm);
  color: #7a4d00;
  font-weight: 700;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
}

.warning-banner p {
  margin: 0;
}

.warning-banner p + p {
  margin-top: 0.4rem;
}

.refill-soon {
  color: var(--rx-warning);
  font-weight: 800;
}

.export-section {
  margin-top: 1.25rem;
}

.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.export-table {
  border-collapse: collapse;
  font-size: 0.9rem;
  width: 100%;
}

.export-table th,
.export-table td {
  border: 1px solid var(--rx-border);
  padding: 0.6rem 0.8rem;
  text-align: left;
  vertical-align: top;
}

.export-table th {
  background: var(--rx-bg);
  font-weight: 800;
}

.export-table tr:nth-child(even) td {
  background: rgba(234, 244, 255, 0.5);
}

.alarm-overlay {
  align-items: center;
  background: rgba(10, 18, 33, 0.80);
  display: none;
  inset: 0;
  justify-content: center;
  overflow: hidden;
  padding: 1rem;
  position: fixed;
  z-index: 2000;
}

.alarm-overlay.is-active {
  display: flex;
}

.alarm-overlay.is-behind-modal {
  z-index: 900;
}

.alarm-dialog {
  background: var(--rx-card);
  border-radius: var(--rx-radius-md);
  box-shadow: 0 32px 80px rgba(3, 18, 42, 0.40);
  max-width: 420px;
  padding: 2rem 1.75rem;
  position: relative;
  text-align: center;
  width: 100%;
}

.alarm-pulse-ring {
  animation: alarm-pulse 1.4s ease-in-out infinite;
  border: 3px solid var(--rx-danger);
  border-radius: var(--rx-radius-md);
  inset: 0;
  pointer-events: none;
  position: absolute;
}

@keyframes alarm-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.28); }
  50% { opacity: 0.8; box-shadow: 0 0 0 12px rgba(229, 72, 77, 0); }
}

.alarm-eyebrow {
  color: var(--rx-danger);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.alarm-med-name {
  font-size: 1.8rem;
  letter-spacing: -0.04em;
  margin-bottom: 0.25rem;
  margin-top: 0;
}

.alarm-med-dose {
  color: var(--rx-text-muted);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.alarm-actions {
  display: grid;
  gap: 0.65rem;
}

.alarm-take-btn {
  background: var(--rx-success);
  font-size: 1.05rem;
  padding: 1rem;
  width: 100%;
}

.alarm-take-btn:hover {
  background: #14a88f;
}

.alarm-skip-btn {
  width: 100%;
}

.alarm-snooze-row {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr auto;
}

.alarm-snooze-select {
  min-height: 2.8rem;
}

.history-panel {
  margin-top: 1.25rem;
}

.reminder-panel,
.settings-panel,
.push-status-panel {
  margin-top: 1.25rem;
}

.push-status-intro {
  color: var(--rx-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.push-check-list {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.push-check-row {
  align-items: flex-start;
  display: flex;
  gap: 0.85rem;
}

.push-check-icon {
  border-radius: 999px;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 900;
  height: 1.6rem;
  line-height: 1.6rem;
  text-align: center;
  width: 1.6rem;
}

.push-check-ok {
  background: rgba(24, 191, 166, 0.14);
  color: #0e7a68;
}

.push-check-fail {
  background: rgba(229, 72, 77, 0.12);
  color: var(--rx-danger);
}

.push-check-warn {
  background: rgba(245, 165, 36, 0.12);
  color: #8a5c00;
}

.push-check-pending {
  background: var(--rx-bg);
  color: var(--rx-text-muted);
}

.push-check-body {
  flex: 1;
  min-width: 0;
}

.push-check-body strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.4;
}

.push-check-hint {
  color: var(--rx-text-muted);
  font-size: 0.82rem;
  margin: 0.25rem 0 0;
}

.push-check-hint code {
  background: var(--rx-bg);
  border-radius: 0.3rem;
  font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
  font-size: 0.78rem;
  padding: 0.1rem 0.35rem;
}

.push-test-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.push-test-row button {
  flex-shrink: 0;
}

.push-test-status {
  font-size: 0.875rem;
}

.in-app-alert {
  background: rgba(245, 165, 36, 0.08);
  border: 1px solid rgba(245, 165, 36, 0.35);
  border-radius: var(--rx-radius-sm);
  color: #7a4d00;
  font-weight: 700;
  margin-top: 0.8rem;
  padding: 0.75rem;
}

.toggle-control {
  align-items: center;
  color: var(--rx-navy);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.92rem;
  font-weight: 800;
  gap: 0.55rem;
}

.toggle-control input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.toggle-slider {
  background: #ccd8ea;
  border-radius: 999px;
  display: inline-block;
  height: 1.55rem;
  position: relative;
  transition: background 160ms ease;
  width: 2.8rem;
}

.toggle-slider::after {
  background: #fff;
  border-radius: 50%;
  content: '';
  height: 1.2rem;
  left: 0.18rem;
  position: absolute;
  top: 0.17rem;
  transition: transform 160ms ease;
  width: 1.2rem;
}

.toggle-control input:checked + .toggle-slider {
  background: var(--rx-gradient);
}

.toggle-control input:checked + .toggle-slider::after {
  transform: translateX(1.24rem);
}

.toggle-control input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 4px rgba(7, 84, 168, 0.18);
}

.toggle-label {
  user-select: none;
}

.settings-subsection-heading {
  color: var(--rx-navy);
  font-size: 1rem;
  font-weight: 700;
  margin: 1rem 0 0.3rem;
}

.settings-subsection-hint {
  color: var(--rx-text-muted);
  font-size: 0.875rem;
  margin: 0 0 0.9rem;
}

.notification-toggles {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.notification-toggle-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.toggle-description {
  color: var(--rx-text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0 0 0 3.35rem;
}

.inactive-list {
  display: grid;
  gap: 0.75rem;
}

.history-list {
  display: grid;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  max-height: 17rem;
  overflow-y: auto;
  padding: 0;
}

.history-panel.is-expanded .history-list {
  max-height: 42.5rem;
}

.history-empty {
  color: var(--rx-text-muted);
  font-size: 0.88rem;
  padding: 0.25rem 0;
}

.history-view-more {
  background: transparent;
  color: var(--rx-deep-blue);
  display: block;
  font-weight: 600;
  margin: 0.75rem auto 0;
  padding: 0;
  text-align: center;
}

.history-view-more:hover {
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
  transform: none;
}

.history-list li {
  align-items: start;
  border-bottom: 1px solid var(--rx-border);
  display: grid;
  gap: 1rem;
  grid-template-columns: 82px 1fr;
  padding-bottom: 0.75rem;
}

.history-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.history-list > li > span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.history-time {
  color: var(--rx-navy);
  font-size: 0.9rem;
  font-weight: 800;
}

.history-date {
  color: var(--rx-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.history-list p,
.muted,
.disclaimer {
  color: var(--rx-text-muted);
  margin-bottom: 0;
}

.modal-overlay {
  align-items: center;
  background: rgba(10, 18, 33, 0.56);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 1000;
}

.modal-overlay.is-open {
  display: flex;
}

.modal-dialog {
  background: var(--rx-card);
  border-radius: var(--rx-radius-md);
  box-shadow: 0 24px 60px rgba(3, 18, 42, 0.34);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
  max-width: 920px;
  overflow: hidden;
  width: 100%;
}

.modal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 1rem 1rem;
}

/* Nested "popup" modal — stacks visually on top of an already-open
   full-screen modal (higher z-index) instead of replacing it, and stays a
   small centered card at every viewport width. */
.modal-overlay--popup {
  z-index: 1100;
}

.modal-dialog--sm {
  max-width: 420px;
}

.modal-header--edit-tag {
  gap: 0.75rem;
  justify-content: flex-start;
}

.modal-manage-tags-link {
  align-items: center;
  color: var(--rx-text-muted);
  display: inline-flex;
  font-size: 1.1rem;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.mood-tag-error {
  color: var(--rx-danger, #c9213c);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}

.edit-mood-tag-name-row {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.edit-mood-tag-name-text {
  font-size: 1.05rem;
  font-weight: 700;
}

.edit-mood-tag-name-input {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
}

.mood-tag-usage-count {
  font-size: 0.85rem;
}

.edit-mood-tag-footer {
  justify-content: space-between;
}

.button-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0;
}

.button-link:hover {
  background: none;
  box-shadow: none;
  opacity: 0.8;
  transform: none;
}

.button-link--danger {
  color: var(--rx-danger, #c9213c);
}

.button-link--cancel {
  color: var(--rx-text-muted);
  order: -1;
}

.button-solo {
  display: block;
  margin: 0 auto;
  width: fit-content;
}

.manage-tags-header {
  gap: 0.75rem;
  justify-content: flex-start;
}

.manage-tags-list-header {
  display: flex;
  justify-content: flex-end;
  padding: 0 0.25rem 0.5rem;
}

.manage-tags-col-label {
  color: var(--rx-text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.manage-tags-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.manage-tag-row {
  align-items: center;
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
}

.manage-tag-info {
  flex: 1;
  min-width: 0;
}

.manage-tag-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}

.manage-tag-count {
  display: block;
  font-size: 0.78rem;
}

.instructions-content-box {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-text);
  overflow: auto;
  padding: 5px;
}

.instructions-content-wrap {
  position: relative;
}

.instructions-content-box {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-text);
  overflow: auto;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(3, 18, 42, 0.12);
}

.instructions-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  float: none;
  margin: 0;
}

.instructions-content-box p[data-instructions-modal-body], .instructions-content-box p {
  font-weight: 500;
}

.postpone-dialog {
  max-width: 420px;
}

/* ── Slot picker modal ──────────────────────────────────────────────────────── */

.slot-picker-dialog {
  max-width: 440px;
}

/* ── Required doses modal ───────────────────────────────────────────────────── */

.required-doses-dialog {
  max-width: 480px;
}

.required-doses-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.required-doses-details {
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  overflow: hidden;
}

.required-doses-summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  list-style: none;
  padding: 0.65rem 0.85rem;
  user-select: none;
}
.required-doses-summary::-webkit-details-marker { display: none; }

.required-doses-details[open] .required-doses-summary {
  border-bottom: 1px solid var(--rx-border);
}

.required-doses-med-name {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

.required-doses-view-label {
  color: var(--rx-link, var(--rx-deep-blue));
  flex-shrink: 0;
  font-size: 0.82rem;
  white-space: nowrap;
}

.required-doses-chevron {
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.required-doses-details[open] .required-doses-chevron {
  transform: rotate(180deg);
}

.required-doses-times {
  list-style: none;
  margin: 0;
  padding: 0;
}

.required-doses-time-row {
  align-items: center;
  border-top: 1px solid var(--rx-border);
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
}
.required-doses-time-row:first-child { border-top: none; }

.required-doses-time {
  color: var(--rx-muted);
  font-size: 0.88rem;
  min-width: 4.5rem;
}

.slot-picker-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

.slot-picker-hint {
  color: var(--rx-text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

.slot-picker-list {
  display: flex;
  flex-direction: column;
}

.slot-picker-row {
  align-items: center;
  border-bottom: 1px solid var(--rx-border);
  cursor: pointer;
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0.25rem;
}

.slot-picker-row:last-child {
  border-bottom: none;
}

.slot-picker-row--logged {
  cursor: not-allowed;
  opacity: 0.45;
}

.slot-time {
  font-weight: 600;
  min-width: 5.5rem;
}

.slot-badge {
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.2em 0.6em;
  text-transform: uppercase;
}

.slot-badge--taken   { background: rgba(24, 191, 166, 0.12); color: #0e7a68; }
.slot-badge--skipped { background: #e5e7eb; color: #374151; }
.slot-badge--missed  { background: rgba(245, 165, 36, 0.12); color: #8a5c00; }
.slot-badge--overdue { background: rgba(229, 72, 77, 0.10); color: var(--rx-danger); }
.slot-badge--upcoming { background: rgba(7, 84, 168, 0.10); color: var(--rx-deep-blue); }

.slot-late-question {
  background: var(--rx-bg);
  border-radius: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
}

.slot-late-question p {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.slot-late-option {
  cursor: pointer;
  display: flex;
  font-size: 0.9rem;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.slot-picker-footer {
  border-top: 1px solid var(--rx-border);
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.modal-header {
  align-items: center;
  border-bottom: 1px solid var(--rx-border);
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  padding: 1rem 1.25rem;
}

.modal-header h2,
.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.modal-footer {
  border-top: 1px solid var(--rx-border);
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  margin-top: 0.8rem;
  padding: 0.75rem 1.25rem;
}

.modal-footer > button:only-child,
.feedback-actions > button:only-child,
.refill-form-actions > button:only-child {
  display: block;
  margin: 0 auto;
}

.modal-scroll .modal-footer {
  margin: 0 -1rem -1rem;
}

.modal-close-btn {
  align-items: center;
  background: none;
  border: none;
  color: var(--rx-text-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 1.3rem;
  height: 2rem;
  justify-content: center;
  position: relative;
  transition: color 0.15s ease;
  width: 2rem;
}

.modal-close-btn:hover {
  background: none;
  box-shadow: none;
  color: var(--rx-danger);
  transform: none;
}

.modal-footer button,
.slot-picker-footer button,
.feedback-actions button,
.refill-form-actions button,
.group-form-actions button,
.stacked-form button[type="submit"] {
  font-weight: 600;
  padding: 0.5rem 1rem;
}

.disclaimer {
  font-size: 0.85rem;
  margin-top: 1rem;
  text-align: center;
}

@media print {
  .top-nav,
  .bottom-nav,
  .hero,
  .reminder-panel,
  .warning-banner,
  .dashboard-grid,
  .history-panel,
  .modal-overlay,
  .alarm-overlay,
  .no-print,
  .disclaimer {
    display: none !important;
  }

  body {
    background: white;
  }

  .app-shell {
    max-width: 100%;
    padding: 0;
  }

  .export-section {
    border: none;
    box-shadow: none;
    margin: 0;
    padding: 0;
  }

  .export-table th,
  .export-table td {
    border: 1px solid #999;
  }
}

@media (max-width: 800px) {
  .med-plan-modal-overlay {
    align-items: stretch;
    padding: 0;
  }

  .med-plan-modal-inner {
    border-radius: 0;
    height: 100dvh;
    max-height: none;
    max-width: 100%;
    width: 100%;
  }

  .app-shell {
    padding: 1rem;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    width: 100%;
  }

  .hero,
  .content-grid,
  .medication-form,
  .form-section {
    grid-template-columns: 1fr;
  }

  .pwa-install-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .calendar-grid {
    gap: 0.25rem;
  }

  .calendar-day {
    padding: 0.3rem 0.2rem;
  }

  .calendar-day strong {
    font-size: 0.7rem;
  }

  .calendar-day small {
    font-size: 0.58rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem;
  }

  .hero-card {
    align-self: stretch;
  }

  .panel,
  .hero,
  .hero-card,
  .schedule-row,
  .medication-row,
  .next-dose-card {
    max-width: 100%;
    min-width: 0;
  }

  .medication-plan-heading,
  .medication-plan-actions,
  .row-actions,
  .schedule-actions-buttons {
    flex-wrap: wrap;
  }

  .medication-actions-bottom {
    grid-column: 2;
    grid-row: auto;
  }

  .medication-actions-bottom button {
    font-size: 0.84rem;
    padding: 0.5rem 0.6rem;
  }

  .med-action-desktop { display: none; }
  .med-action-mobile { display: flex; }

  .instructions-label-desktop { display: none; }
  .instructions-label-mobile { display: inline; }

  .medication-actions-top {
    justify-content: flex-end;
    margin-top: 0;
  }

  .medication-row-plan {
    grid-template-columns: 1.5rem minmax(0, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    order: 3;
  }

  .schedule-row {
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .schedule-row .row-actions {
    align-items: flex-start;
    grid-column: 1 / -1;
    margin-top: 0.3rem;
    width: 100%;
  }

  .modal-overlay {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

  /* Fill the fixed overlay (inset: 0) instead of sizing with viewport units —
     100vw/100dvh can disagree with the visible viewport on some mobile
     browsers, causing side scroll and top/bottom clipping. */
  .modal-dialog {
    border-radius: 0;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    width: 100%;
  }

  .modal-scroll {
    overflow-x: hidden;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  /* Nested popups opt out of the full-bleed mobile treatment above and stay
     a small centered card, matching the desktop look at every width. */
  .modal-overlay--popup {
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }

  .modal-overlay--popup .modal-dialog--sm {
    border-radius: var(--rx-radius-md);
    height: auto;
    max-height: calc(100vh - 2rem);
    max-width: 420px;
    width: 100%;
  }

  /* Single-button footers/forms go full width on mobile; desktop default
     (set outside this media query) is natural content width, centered. */
  .modal-footer > button:only-child,
  .feedback-actions > button:only-child,
  .refill-form-actions > button:only-child,
  .button-solo {
    width: 100%;
  }

  /* The wizard footer can show up to 4 items (Cancel, Back, Save draft,
     Next/Save Medication) — let them wrap onto a second line instead of
     overflowing the modal on narrow phones. */
  .med-wizard-footer {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .med-wizard-footer > button:not(.button-link) {
    flex: 1 1 auto;
  }

  .med-wizard-progress {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .alarm-dialog {
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    width: 100%;
  }

  /* Hide hamburger on mobile — use bottom nav instead */
  .nav-hamburger {
    display: none;
  }

  .nav-links {
    display: none;
  }
}

/* ── Bottom navigation (mobile only) ───────────────────────────────────────── */

.bottom-nav {
  display: none;
}

@media (max-width: 800px) {
  .bottom-nav {
    align-items: stretch;
    background: var(--rx-card);
    border-top: 1px solid var(--rx-border);
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(7, 29, 61, 0.10);
    display: flex;
    justify-content: space-around;
    left: 0;
    padding-bottom: env(safe-area-inset-bottom);
    position: fixed;
    right: 0;
    z-index: 500;
  }

  .bottom-nav-item {
    align-items: center;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: var(--rx-text-muted);
    cursor: pointer;
    display: flex;
    flex: 1;
    flex-direction: column;
    font-size: 0.65rem;
    font-weight: 700;
    gap: 0.25rem;
    justify-content: center;
    padding: 0.6rem 0.25rem;
    text-align: center;
    text-decoration: none;
    transition: color 160ms ease;
  }

  .bottom-nav-item svg {
    height: 1.4rem;
    width: 1.4rem;
  }

  .bottom-nav-item i {
    font-size: 1.35rem;
    line-height: 1;
  }

  .bottom-nav-item.is-active {
    color: var(--rx-deep-blue);
  }

  .bottom-nav-item:hover {
    background: none;
    box-shadow: none;
    color: var(--rx-blue);
    transform: none;
  }
}

/* ── More menu (bottom nav popup) ───────────────────────────────────────── */

.more-menu {
  display: none;
  inset: 0;
  position: fixed;
  z-index: 600;
}

.more-menu.is-open {
  display: block;
}

.more-menu__backdrop {
  background: rgba(7, 29, 61, 0.45);
  inset: 0;
  position: absolute;
}

.more-menu__sheet {
  background: var(--rx-card);
  border-radius: 1rem 1rem 0 0;
  border-top: 1px solid var(--rx-border);
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  left: 0;
  padding: 0.75rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
  position: absolute;
  right: 0;
}

.more-menu__item {
  align-items: center;
  border-radius: 0.625rem;
  color: var(--rx-text);
  display: flex;
  font-size: 1rem;
  font-weight: 600;
  gap: 1rem;
  padding: 0.875rem 1rem;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.more-menu__item i {
  color: var(--rx-blue);
  font-size: 1.2rem;
  text-align: center;
  width: 1.5rem;
}

.more-menu__item:hover {
  background: var(--rx-bg);
  box-shadow: none;
  color: var(--rx-deep-blue);
  transform: none;
}

.more-menu__item:hover i {
  color: var(--rx-deep-blue);
}

.more-menu__item.is-active,
.more-menu__item.is-active i {
  color: var(--rx-deep-blue);
}

/* ── Pain level trend graph ──────────────────────────────────────────────── */

.pain-graph-btn {
  background: var(--rx-bg);
  color: var(--rx-text-muted);
}

.pain-graph-btn:hover {
  background: var(--rx-border);
  color: var(--rx-deep-blue);
}

.mood-graph-btn {
  background: var(--rx-bg);
  color: var(--rx-text-muted);
}

.mood-graph-btn:hover {
  background: var(--rx-border);
  color: var(--rx-deep-blue);
}

.pain-graph-dialog {
  max-width: 600px;
}

.pain-graph-controls {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.pain-graph-print-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-text-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  justify-content: center;
  padding: 0.3rem 0.9rem;
}

.pain-graph-print-btn:hover {
  background: var(--rx-bg);
  box-shadow: none;
  transform: none;
}

.pain-graph-range-tabs {
  display: flex;
  gap: 0.5rem;
}

.range-tab {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.range-tab.is-active {
  background: var(--rx-deep-blue);
  border-color: var(--rx-deep-blue);
  color: #fff;
}

.pain-graph-body {
  min-height: 6rem;
}

.pain-graph-body svg {
  display: block;
  overflow: visible;
  width: 100%;
}

.pain-graph-loading,
.pain-graph-empty {
  color: var(--rx-text-muted);
  font-size: 0.9rem;
  margin: 0;
  padding: 1rem 0;
}

/* ── Pain tracking dedicated page ───────────────────────────────────────── */

.pain-tracking-page {
  padding: 1.25rem 1rem 2rem;
  width: 100%;
}

.pain-tracking-header {
  margin-bottom: 1.25rem;
}

.pain-tracking-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--rx-deep-blue);
  margin: 0;
}

.pain-tracking-empty {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  box-shadow: var(--rx-shadow);
  padding: 1.5rem;
  text-align: center;
  color: var(--rx-text-muted);
}

.pain-tracking-empty p {
  margin: 0 0 1rem;
}

.pain-tracking-med-panel {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  box-shadow: var(--rx-shadow);
  padding: 1.35rem;
  margin-bottom: 1rem;
}

.pain-tracking-med-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pain-tracking-med-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--rx-bg);
  border: 1.5px solid var(--rx-border);
  border-radius: 2rem;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--rx-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pain-tracking-med-btn:hover {
  background: var(--rx-border);
}

.pain-tracking-med-btn.is-active {
  background: var(--rx-deep-blue);
  border-color: var(--rx-deep-blue);
  color: #fff;
}

.pain-tracking-med-dose {
  font-size: 0.8rem;
  opacity: 0.75;
}

.pain-tracking-chart-section {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  box-shadow: var(--rx-shadow);
  padding: 1.35rem;
}

.pain-tracking-med-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--rx-text);
  margin-bottom: 0.75rem;
  min-height: 1.4rem;
}

.pain-page-range-tab {
  background: var(--rx-bg);
  border: 1.5px solid var(--rx-border);
  border-radius: 2rem;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--rx-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pain-page-range-tab:hover {
  background: var(--rx-border);
}

.pain-page-range-tab.is-active {
  background: var(--rx-deep-blue);
  border-color: var(--rx-deep-blue);
  color: #fff;
}

.mood-page-range-tab {
  background: var(--rx-bg);
  border: 1.5px solid var(--rx-border);
  border-radius: 2rem;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--rx-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.mood-page-range-tab:hover {
  background: var(--rx-border);
}

.mood-page-range-tab.is-active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.mood-tracking-med-btn.is-active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

/* ── Dose feedback modal ─────────────────────────────────────────────────── */

.feedback-pain-section {
  display: grid;
  gap: 0.4rem;
}

.feedback-pain-section.is-hidden {
  display: none;
}

.feedback-mood-section {
  display: grid;
  gap: 0.4rem;
}

.feedback-mood-section.is-hidden {
  display: none;
}

.feedback-pain-label {
  color: var(--rx-text-muted);
  font-size: 0.86rem;
  font-weight: 800;
  margin: 0;
}

.feedback-pain-hint {
  font-weight: 400;
  color: var(--rx-text-muted);
}

.field-hint {
  color: var(--rx-text-muted);
  font-size: 0.8rem;
  display: block;
  margin-top: 0.2rem;
}

.timezone-select-row {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.timezone-select-row select {
  flex: 1 1 auto;
  min-width: 0;
}

.pain-level-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pain-level-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 2px solid var(--rx-border);
  color: var(--rx-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  font-size: 0.85rem;
  font-weight: 700;
  height: 2.6rem;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 2.6rem;
}

.pain-level-btn:hover {
  border-color: var(--rx-text-muted);
  color: #fff;
}

.pain-level-btn[data-pain-level="1"],
.pain-level-btn[data-pain-level="2"],
.pain-level-btn[data-pain-level="3"] {
  border-color: #2a9d49;
}

.pain-level-btn[data-pain-level="4"],
.pain-level-btn[data-pain-level="5"],
.pain-level-btn[data-pain-level="6"] {
  border-color: #d97706;
}

.pain-level-btn[data-pain-level="7"],
.pain-level-btn[data-pain-level="8"] {
  border-color: #e05b30;
}

.pain-level-btn[data-pain-level="9"],
.pain-level-btn[data-pain-level="10"] {
  border-color: #c9213c;
}

.pain-level-btn.is-selected {
  color: #fff;
}

.pain-level-btn.is-selected[data-pain-level="1"],
.pain-level-btn.is-selected[data-pain-level="2"],
.pain-level-btn.is-selected[data-pain-level="3"] {
  background: #2a9d49;
  border-color: #2a9d49;
}

.pain-level-btn.is-selected[data-pain-level="4"],
.pain-level-btn.is-selected[data-pain-level="5"],
.pain-level-btn.is-selected[data-pain-level="6"] {
  background: #d97706;
  border-color: #d97706;
}

.pain-level-btn.is-selected[data-pain-level="7"],
.pain-level-btn.is-selected[data-pain-level="8"] {
  background: #e05b30;
  border-color: #e05b30;
}

.pain-level-btn.is-selected[data-pain-level="9"],
.pain-level-btn.is-selected[data-pain-level="10"] {
  background: #c9213c;
  border-color: #c9213c;
}

/* Mood level buttons — inverted color scale from pain (low = red, high = green) */
.mood-level-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 2px solid var(--rx-border);
  color: var(--rx-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  font-size: 0.85rem;
  font-weight: 700;
  height: 2.6rem;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 2.6rem;
}

.mood-level-btn:hover {
  border-color: var(--rx-text-muted);
  color: #fff;
}

.mood-level-btn[data-mood-level="1"],
.mood-level-btn[data-mood-level="2"],
.mood-level-btn[data-mood-level="3"] {
  border-color: #c9213c;
}

.mood-level-btn[data-mood-level="4"],
.mood-level-btn[data-mood-level="5"],
.mood-level-btn[data-mood-level="6"] {
  border-color: #d97706;
}

.mood-level-btn[data-mood-level="7"],
.mood-level-btn[data-mood-level="8"] {
  border-color: #8bb04a;
}

.mood-level-btn[data-mood-level="9"],
.mood-level-btn[data-mood-level="10"] {
  border-color: #2a9d49;
}

.mood-level-btn.is-selected {
  color: #fff;
}

.mood-level-btn.is-selected[data-mood-level="1"],
.mood-level-btn.is-selected[data-mood-level="2"],
.mood-level-btn.is-selected[data-mood-level="3"] {
  background: #c9213c;
  border-color: #c9213c;
}

.mood-level-btn.is-selected[data-mood-level="4"],
.mood-level-btn.is-selected[data-mood-level="5"],
.mood-level-btn.is-selected[data-mood-level="6"] {
  background: #d97706;
  border-color: #d97706;
}

.mood-level-btn.is-selected[data-mood-level="7"],
.mood-level-btn.is-selected[data-mood-level="8"] {
  background: #8bb04a;
  border-color: #8bb04a;
}

.mood-level-btn.is-selected[data-mood-level="9"],
.mood-level-btn.is-selected[data-mood-level="10"] {
  background: #2a9d49;
  border-color: #2a9d49;
}

/* Missed dose modal pain buttons — same appearance as feedback modal pain buttons */
.missed-pain-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 2px solid var(--rx-border);
  color: var(--rx-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 600;
  height: 2.6rem;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 2.6rem;
}
.missed-pain-btn:hover { border-color: var(--rx-text-muted); color: #fff; }
.missed-pain-btn[data-missed-pain="1"],
.missed-pain-btn[data-missed-pain="2"],
.missed-pain-btn[data-missed-pain="3"]  { border-color: #2a9d49; }
.missed-pain-btn[data-missed-pain="4"],
.missed-pain-btn[data-missed-pain="5"],
.missed-pain-btn[data-missed-pain="6"]  { border-color: #d97706; }
.missed-pain-btn[data-missed-pain="7"],
.missed-pain-btn[data-missed-pain="8"]  { border-color: #e05b30; }
.missed-pain-btn[data-missed-pain="9"],
.missed-pain-btn[data-missed-pain="10"] { border-color: #c9213c; }
.missed-pain-btn.is-selected { color: #fff; }
.missed-pain-btn.is-selected[data-missed-pain="1"],
.missed-pain-btn.is-selected[data-missed-pain="2"],
.missed-pain-btn.is-selected[data-missed-pain="3"]  { background: #2a9d49; border-color: #2a9d49; }
.missed-pain-btn.is-selected[data-missed-pain="4"],
.missed-pain-btn.is-selected[data-missed-pain="5"],
.missed-pain-btn.is-selected[data-missed-pain="6"]  { background: #d97706; border-color: #d97706; }
.missed-pain-btn.is-selected[data-missed-pain="7"],
.missed-pain-btn.is-selected[data-missed-pain="8"]  { background: #e05b30; border-color: #e05b30; }
.missed-pain-btn.is-selected[data-missed-pain="9"],
.missed-pain-btn.is-selected[data-missed-pain="10"] { background: #c9213c; border-color: #c9213c; }

/* Missed dose modal mood buttons — inverted color scale from pain */
.missed-mood-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 2px solid var(--rx-border);
  color: var(--rx-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 600;
  height: 2.6rem;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 2.6rem;
}
.missed-mood-btn:hover { border-color: var(--rx-text-muted); color: #fff; }
.missed-mood-btn[data-missed-mood="1"],
.missed-mood-btn[data-missed-mood="2"],
.missed-mood-btn[data-missed-mood="3"]  { border-color: #c9213c; }
.missed-mood-btn[data-missed-mood="4"],
.missed-mood-btn[data-missed-mood="5"],
.missed-mood-btn[data-missed-mood="6"]  { border-color: #d97706; }
.missed-mood-btn[data-missed-mood="7"],
.missed-mood-btn[data-missed-mood="8"]  { border-color: #8bb04a; }
.missed-mood-btn[data-missed-mood="9"],
.missed-mood-btn[data-missed-mood="10"] { border-color: #2a9d49; }
.missed-mood-btn.is-selected { color: #fff; }
.missed-mood-btn.is-selected[data-missed-mood="1"],
.missed-mood-btn.is-selected[data-missed-mood="2"],
.missed-mood-btn.is-selected[data-missed-mood="3"]  { background: #c9213c; border-color: #c9213c; }
.missed-mood-btn.is-selected[data-missed-mood="4"],
.missed-mood-btn.is-selected[data-missed-mood="5"],
.missed-mood-btn.is-selected[data-missed-mood="6"]  { background: #d97706; border-color: #d97706; }
.missed-mood-btn.is-selected[data-missed-mood="7"],
.missed-mood-btn.is-selected[data-missed-mood="8"]  { background: #8bb04a; border-color: #8bb04a; }
.missed-mood-btn.is-selected[data-missed-mood="9"],
.missed-mood-btn.is-selected[data-missed-mood="10"] { background: #2a9d49; border-color: #2a9d49; }

/* Log past dose modal pain buttons — same round appearance as the normal feedback modal */
.log-past-dose-pain-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 2px solid var(--rx-border);
  color: var(--rx-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  font-size: 0.85rem;
  font-weight: 700;
  height: 2.6rem;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 2.6rem;
}
.log-past-dose-pain-btn:hover { border-color: var(--rx-text-muted); color: #fff; }
.log-past-dose-pain-btn[data-log-past-dose-pain="1"],
.log-past-dose-pain-btn[data-log-past-dose-pain="2"],
.log-past-dose-pain-btn[data-log-past-dose-pain="3"]  { border-color: #2a9d49; }
.log-past-dose-pain-btn[data-log-past-dose-pain="4"],
.log-past-dose-pain-btn[data-log-past-dose-pain="5"],
.log-past-dose-pain-btn[data-log-past-dose-pain="6"]  { border-color: #d97706; }
.log-past-dose-pain-btn[data-log-past-dose-pain="7"],
.log-past-dose-pain-btn[data-log-past-dose-pain="8"]  { border-color: #e05b30; }
.log-past-dose-pain-btn[data-log-past-dose-pain="9"],
.log-past-dose-pain-btn[data-log-past-dose-pain="10"] { border-color: #c9213c; }
.log-past-dose-pain-btn.is-selected { color: #fff; }
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="1"],
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="2"],
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="3"]  { background: #2a9d49; border-color: #2a9d49; }
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="4"],
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="5"],
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="6"]  { background: #d97706; border-color: #d97706; }
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="7"],
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="8"]  { background: #e05b30; border-color: #e05b30; }
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="9"],
.log-past-dose-pain-btn.is-selected[data-log-past-dose-pain="10"] { background: #c9213c; border-color: #c9213c; }

/* Log past dose modal mood buttons — inverted color scale from pain */
.log-past-dose-mood-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 2px solid var(--rx-border);
  color: var(--rx-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  font-size: 0.85rem;
  font-weight: 700;
  height: 2.6rem;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 2.6rem;
}
.log-past-dose-mood-btn:hover { border-color: var(--rx-text-muted); color: #fff; }
.log-past-dose-mood-btn[data-log-past-dose-mood="1"],
.log-past-dose-mood-btn[data-log-past-dose-mood="2"],
.log-past-dose-mood-btn[data-log-past-dose-mood="3"]  { border-color: #c9213c; }
.log-past-dose-mood-btn[data-log-past-dose-mood="4"],
.log-past-dose-mood-btn[data-log-past-dose-mood="5"],
.log-past-dose-mood-btn[data-log-past-dose-mood="6"]  { border-color: #d97706; }
.log-past-dose-mood-btn[data-log-past-dose-mood="7"],
.log-past-dose-mood-btn[data-log-past-dose-mood="8"]  { border-color: #8bb04a; }
.log-past-dose-mood-btn[data-log-past-dose-mood="9"],
.log-past-dose-mood-btn[data-log-past-dose-mood="10"] { border-color: #2a9d49; }
.log-past-dose-mood-btn.is-selected { color: #fff; }
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="1"],
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="2"],
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="3"]  { background: #c9213c; border-color: #c9213c; }
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="4"],
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="5"],
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="6"]  { background: #d97706; border-color: #d97706; }
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="7"],
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="8"]  { background: #8bb04a; border-color: #8bb04a; }
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="9"],
.log-past-dose-mood-btn.is-selected[data-log-past-dose-mood="10"] { background: #2a9d49; border-color: #2a9d49; }

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: space-between;
  margin-top: 0.8rem;
}

.field-optional {
  color: var(--rx-text-muted);
  font-weight: 400;
}

.char-counter {
  color: var(--rx-text-muted);
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  margin-top: 0.2rem;
  text-align: left;
}

/* ── History note & pain badge ───────────────────────────────────────────── */

.history-note {
  color: var(--rx-text-muted);
  display: block;
  font-size: 0.78rem;
  font-style: italic;
  margin-top: 0.15rem;
}

.history-pain-label {
  color: var(--rx-text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  margin-left: 0.3rem;
}

.history-pain-badge {
  border: 1px solid;
  border-radius: 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
}

.history-pain-badge--low {
  background: rgba(24, 191, 166, 0.12);
  border-color: #2a9d49;
  color: #0e7a68;
}

.history-pain-badge--mid {
  background: rgba(245, 165, 36, 0.12);
  border-color: #d97706;
  color: #8a5c00;
}

.history-pain-badge--high {
  background: rgba(229, 72, 77, 0.10);
  border-color: #e05b30;
  color: #9a3412;
}

.history-pain-badge--severe {
  background: rgba(229, 72, 77, 0.12);
  border-color: #c9213c;
  color: #7f1d1d;
}

.history-mood-label {
  color: var(--rx-text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  margin-left: 0.3rem;
}

.history-mood-badge {
  border: 1px solid;
  border-radius: 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
}

.history-mood-badge--poor {
  background: rgba(229, 72, 77, 0.12);
  border-color: #c9213c;
  color: #7f1d1d;
}

.history-mood-badge--fair {
  background: rgba(245, 165, 36, 0.12);
  border-color: #d97706;
  color: #8a5c00;
}

.history-mood-badge--good {
  background: rgba(24, 191, 166, 0.12);
  border-color: #2a9d49;
  color: #0e7a68;
}

.history-mood-badge--great {
  background: rgba(16, 163, 74, 0.14);
  border-color: #15803d;
  color: #14532d;
}

.history-note .history-note-label {
  color: var(--rx-text-muted);
  font-style: normal;
  font-weight: 600;
}

/* ── Export history table ────────────────────────────────────────────────── */

.export-history-section {
  margin-top: 2rem;
}

.export-history-heading {
  flex-wrap: wrap;
  justify-content: space-between;
}

.export-month-nav {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.export-month-label {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 7.5rem;
  text-align: center;
}

.export-date-filter {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.export-date-filter label {
  align-items: center;
  display: flex;
  font-size: 0.875rem;
  gap: 0.35rem;
}

.export-date-filter input[type="date"] {
  border: 1px solid var(--rx-border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  padding: 0.3rem 0.5rem;
}

.export-date-filter button,
.export-date-filter a.secondary {
  border-radius: var(--rx-radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  text-decoration: none;
}

.export-date-filter a.secondary {
  display: inline-block;
}

.export-date-range-label {
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  opacity: 0.65;
}

.empty-state-text {
  color: var(--rx-text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

@media print {
  .export-history-section {
    margin-top: 1.5rem;
    page-break-inside: avoid;
  }
}

/* ── Product label image in medication plan ──────────────────────────────── */

.product-label-wrap {
  display: none;
}

.product-label-wrap img {
  border-radius: 0.5rem;
  cursor: pointer;
  display: block;
  height: 48px;
  object-fit: contain;
  transition: transform 160ms ease, box-shadow 160ms ease;
  width: 48px;
}

.product-label-wrap img:hover {
  box-shadow: 0 4px 12px rgba(10, 18, 33, 0.18);
  transform: scale(1.08);
}

.product-label-placeholder {
  display: none;
  align-items: center;
  background: rgba(7, 84, 168, 0.10);
  border-radius: 50%;
  color: var(--rx-deep-blue);
  display: flex;
  flex-shrink: 0;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.product-label-placeholder svg {
  height: 26px;
  width: 26px;
}

/* ── View details link-button ────────────────────────────────────────────── */

.view-details-link {
  background: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--rx-deep-blue);
  cursor: pointer;
  display: inline;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  transform: none;
  transition: color 160ms ease;
}

.view-details-link:hover {
  background: none;
  box-shadow: none;
  color: var(--rx-blue);
  transform: none;
}

.view-instructions-link {
  background: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--rx-deep-blue);
  cursor: pointer;
  display: inline;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0;
  margin-left: 0.6rem;
  text-decoration: underline;
  transform: none;
  transition: color 160ms ease;
}

.view-instructions-link:hover {
  background: none;
  box-shadow: none;
  color: var(--rx-blue);
  transform: none;
}

/* ── Drug name autocomplete ──────────────────────────────────────────────── */

.autocomplete-wrap {
  grid-column: 1 / -1;
  position: relative;
}

.autocomplete-dropdown {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  box-shadow: 0 8px 24px rgba(10, 18, 33, 0.14);
  left: 0;
  list-style: none;
  margin: 0.25rem 0 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25rem;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 1300;
}

.autocomplete-item {
  align-items: center;
  border-radius: 0.6rem;
  color: var(--rx-text);
  cursor: pointer;
  display: flex;
  font-size: 0.9rem;
  font-weight: 400;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
}

.autocomplete-item:hover {
  background: var(--rx-bg);
  color: var(--rx-deep-blue);
}


/* ── Image lightbox ──────────────────────────────────────────────────────── */

.image-lightbox-overlay {
  align-items: center;
  background: rgba(10, 18, 33, 0.80);
  cursor: pointer;
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: 1.5rem;
  pointer-events: none;
  position: fixed;
  transition: opacity 200ms ease;
  z-index: 1200;
}

.image-lightbox-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.image-lightbox-dialog {
  background: var(--rx-card);
  border-radius: var(--rx-radius-md);
  box-shadow: 0 32px 80px rgba(3, 18, 42, 0.38);
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 420px;
  padding: 1.5rem;
  position: relative;
  width: 100%;
}

.image-lightbox-close {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
}

.image-lightbox-img {
  border-radius: 0.5rem;
  display: block;
  max-height: 360px;
  max-width: 100%;
  object-fit: contain;
}

.image-lightbox-caption {
  color: var(--rx-text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
  text-align: center;
}

/* ── Medication detail modal ─────────────────────────────────────────────── */

[data-med-detail-modal] {
  z-index: 1100;
}

.med-detail-dialog {
  max-width: 640px;
}

.med-detail-images {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.med-detail-image-wrap {
  flex: 1;
  margin: 0;
  min-width: 120px;
  text-align: center;
}

.med-detail-image-wrap img {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: 8px;
  display: block;
  max-height: 180px;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

.med-detail-image-wrap img[src=""] {
  display: none;
}

.med-detail-image-wrap figcaption {
  color: var(--rx-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 0.3rem;
  text-transform: uppercase;
}

.med-detail-section {
  border-top: 1px solid var(--rx-border);
  margin-top: 1rem;
  padding-top: 0.85rem;
}

.med-detail-section-title {
  color: var(--rx-text);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  list-style: none;
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  user-select: none;
}

.med-detail-section-title::-webkit-details-marker {
  display: none;
}

.med-detail-section-title::after {
  content: ' ▾';
  font-size: 0.75rem;
  opacity: 0.6;
}

details.med-detail-section[open] .med-detail-section-title::after {
  content: ' ▴';
}

.med-detail-section-body {
  margin-top: 0.4rem;
}

.med-detail-section p {
  color: var(--rx-text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0 0 0.4rem;
}

.med-detail-section p:last-child {
  margin-bottom: 0;
}

.boxed-warning-banner {
  background: rgba(245, 165, 36, 0.08);
  border: 1px solid #d97706;
  border-left: 4px solid #d97706;
  border-radius: 0.5rem;
  color: #8a5c00;
  font-size: 0.85rem;
  line-height: 1.55;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
}

.boxed-warning-banner strong {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.med-detail-links {
  border-top: 1px solid var(--rx-border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
}

.med-detail-links a {
  color: var(--rx-deep-blue);
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 800px) {
  .image-lightbox-overlay {
    padding: 1rem;
  }
}

/* ── Medication groups ───────────────────────────────────────────────────────── */

.groups-list {
  display: grid;
  gap: 0.9rem;
}

.groups-create-row {
  display: flex;
  justify-content: flex-end;
}

.groups-empty-state {
  margin-top: 0.5rem;
}

.group-form-wrap {
  display: none;
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  padding: 1rem;
}

.group-form-wrap.is-open {
  display: block;
}

.group-inline-form {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
}

.group-inline-form input {
  background: #f6f6f6;
}

.group-inline-form label {
  display: grid;
  gap: 0.3rem;
}

.group-form-actions {
  display: flex;
  gap: 0.5rem;
  grid-column: 1 / -1;
  margin-top: 0.8rem;
}

.drag-handle {
  align-items: center;
  align-self: stretch;
  background: none;
  border: none;
  color: var(--rx-muted);
  cursor: grab;
  display: flex;
  font-size: 0.9rem;
  justify-content: center;
  opacity: 0.4;
  padding: 0;
  touch-action: none;
  transition: opacity 0.15s;
}
.drag-handle:hover,
.drag-handle:active {
  background: none;
  box-shadow: none;
  opacity: 1;
  transform: none;
}
.drag-handle:active { cursor: grabbing; }

.drag-handle--group {
  border-right: 1px solid var(--rx-border);
  padding: 0 0.5rem;
}

.groups-sortable-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.sortable-ghost {
  opacity: 0.4;
}

.group-card {
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  display: flex;
  overflow: hidden;
}

.group-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.group-card-header {
  align-items: center;
  background: var(--rx-bg);
  border-bottom: 1px solid var(--rx-border);
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  padding: 0.8rem 1rem;
}

.group-card-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.group-time-badge {
  background: rgba(7, 84, 168, 0.10);
  border: 1px solid rgba(7, 84, 168, 0.22);
  border-radius: 999px;
  color: var(--rx-deep-blue);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
}

.group-members-list {
  display: grid;
  gap: 0;
  padding: 0.25rem 0;
}

.group-empty-hint {
  color: var(--rx-text-muted);
  font-size: 0.85rem;
  margin: 0;
  padding: 0.75rem 1rem;
}

.group-member-row {
  align-items: center;
  border-bottom: 1px solid var(--rx-bg);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
}

.group-member-row:last-child {
  border-bottom: 0;
}

.group-member-name {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 0;
}

.group-member-dose {
  color: var(--rx-text-muted);
  font-size: 0.85rem;
}

.group-feedback-badge {
  background: rgba(245, 165, 36, 0.10);
  border: 1px solid rgba(245, 165, 36, 0.35);
  border-radius: 999px;
  color: #7a4d00;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
}

.group-remove-btn {
  display: none;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: auto;
  padding: 0.3rem 0.6rem;
}
.group-card.is-editing .group-remove-btn {
  display: inline-flex;
}

.group-name-input,
.group-time-input {
  background: #f6f6f6;
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
}

.group-name-input {
  max-width: 180px;
  width: 100%;
}

.group-time-input {
  max-width: 110px;
  width: 100%;
}

.group-time-input[hidden] { display: none; }

.group-card-edit-actions {
  border-top: 1px solid var(--rx-border);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.65rem 1rem;
}
.group-card-edit-actions[hidden] { display: none; }

.group-add-med-form {
  align-items: center;
  border-top: 1px solid var(--rx-border);
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
}
.group-add-med-form[hidden] { display: none; }

.group-dose-override-label {
  white-space: nowrap;
}

.group-dose-override-input {
  background: #f6f6f6;
}

.group-add-select {
  flex: 1;
  font-size: 0.85rem;
  min-height: 2.4rem;
  min-width: 0;
  padding: 0.4rem 0.6rem;
}

.group-add-btn {
  font-size: 0.82rem;
  padding: 0.45rem 0.8rem;
  white-space: nowrap;
}

/* ── Group badge in today schedule ──────────────────────────────────────────── */

.group-badge {
  align-items: center;
  align-self: flex-start;
  background: rgba(7, 84, 168, 0.10);
  border: 1px solid rgba(7, 84, 168, 0.22);
  border-radius: 999px;
  color: var(--rx-deep-blue);
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 700;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  margin-right: 0.2rem;
}

/* ── Group alarm overlay ─────────────────────────────────────────────────────── */

.alarm-group-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  text-align: left;
}

.alarm-group-list-item {
  border-bottom: 1px solid var(--rx-bg);
  color: var(--rx-text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.45rem 0;
}

.alarm-group-list-item:last-child {
  border-bottom: 0;
}

/* ── Feedback queue progress ─────────────────────────────────────────────────── */

.feedback-queue-progress {
  color: var(--rx-deep-blue);
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0.1rem 0 0;
}

@media (max-width: 800px) {
  .group-inline-form {
    grid-template-columns: 1fr;
  }

  .group-card-header {
    gap: 0.5rem;
  }

  .med-actions-menu {
    flex-shrink: 0;
  }

  .group-member-row {
    gap: 0.3rem;
  }

  .group-remove-btn {
    margin-left: 0;
  }

  .group-add-med-form {
    align-items: stretch;
    flex-direction: column;
  }

  .group-dose-override-label {
    white-space: normal;
  }
}

/* ── Pill supply progress bar ────────────────────────────────────────────────── */

.pill-supply-bar {
  background: var(--rx-border);
  border-radius: 999px;
  height: 6px;
  margin: 0.35rem 0 0.2rem;
  overflow: hidden;
  width: 100%;
}

.pill-supply-bar-fill {
  background: var(--rx-success);
  border-radius: 999px;
  height: 100%;
  min-width: 2px;
  transition: width 0.3s ease;
}

.pill-supply-bar-fill--low {
  background: var(--rx-warning);
}

.pill-supply-bar-fill--critical {
  background: var(--rx-danger);
}

/* ── Refill meta line ────────────────────────────────────────────────────────── */

.refill-meta {
  color: var(--rx-text-muted);
  font-size: 0.78rem;
}

/* ── Refill modal ────────────────────────────────────────────────────────────── */

.refill-modal-subtitle {
  color: var(--rx-text-muted);
  font-size: 1rem;
  font-weight: 600;
  margin: 0.15rem 0 0;
}

.refill-form-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  margin-top: 0.8rem;
}

/* ── Zero pill count interstitial ─────────────────────────────────────────────── */

.zero-pill-adjust {
  margin-top: 1rem;
}

.zero-pill-stepper {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.zero-pill-step-btn {
  align-items: center;
  background: #0A8AC8;
  border: 1px solid var(--rx-border);
  border-radius: 6px;
  display: flex;
  font-weight: 700;
  height: 2.25rem;
  justify-content: center;
  padding: 0;
  width: 2.25rem;
}

.zero-pill-step-btn:hover {
  background: #14CFE0;
  box-shadow: none;
  transform: none;
}

.zero-pill-stepper input[data-zero-pill-delta] {
  text-align: center;
  width: 4.5rem;
}

.zero-pill-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  margin-top: 1rem;
}

.zero-pill-cancel-row {
  border-top: 1px solid var(--rx-border);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
}

.zero-pill-cancel-btn {
  width: 100%;
}

.zero-pill-cancel-hint {
  color: var(--rx-text-muted);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  text-align: center;
}

/* ── Refill history modal ────────────────────────────────────────────────────── */

.refill-history-dialog {
  max-width: 520px;
}

.refill-history-body {
  padding: 0 0.25rem;
}

.refill-stats-banner {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: 8px;
  color: var(--rx-navy);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.75rem;
}

.refill-month-nav {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.refill-month-label {
  color: var(--rx-text);
  font-size: 0.92rem;
  text-align: center;
  flex: 1;
}

.refill-nav-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  white-space: nowrap;
}

.refill-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.refill-history-entry {
  border-bottom: 1px solid var(--rx-border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0;
}

.refill-history-entry:last-child {
  border-bottom: 0;
}

.refill-entry-date {
  color: var(--rx-text);
  font-size: 0.88rem;
  font-weight: 700;
}

.refill-entry-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.refill-entry-amount {
  background: rgba(24, 191, 166, 0.12);
  border-radius: 999px;
  color: var(--rx-success);
  font-weight: 700;
  padding: 0.15rem 0.55rem;
}

.refill-entry-hand {
  color: var(--rx-text-muted);
}

.refill-days-between {
  background: var(--rx-bg);
  border-radius: 999px;
  color: var(--rx-text-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
}

.refill-note {
  color: var(--rx-text-muted);
  font-style: italic;
}

.refill-entry-badge {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: 999px;
  color: var(--rx-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.5rem;
  text-transform: uppercase;
}

.refill-history-entry--adjustment .refill-entry-amount {
  background: rgba(10, 138, 200, 0.1);
  color: var(--rx-blue);
}

@media (max-width: 600px) {
  .refill-month-nav {
    gap: 0.3rem;
  }

  .refill-nav-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
  }
}

/* ── Auth Pages ─────────────────────────────────────────────────────────── */

.auth-shell {
  display: grid;
  grid-template-columns: 55fr 45fr;
  min-height: 100vh;
}

.auth-shell--centered {
  grid-template-columns: 1fr;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rx-bg);
  padding: 2rem 1rem;
}

.auth-panel--left {
  background: var(--rx-gradient-hero);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3rem 0;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.auth-panel--right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--rx-card);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.auth-brand-name {
  font-size: 1.3rem;
  font-weight: 800;
}

.auth-tagline {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 2.5rem 0 1.75rem;
  color: #fff;
}

.auth-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.auth-features li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.92);
}

.auth-feature-icon {
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.auth-graphic {
  display: block;
  margin: 0 auto;
  width: 80%;
  max-width: 340px;
  opacity: 0.22;
  pointer-events: none;
  user-select: none;
  align-self: flex-end;
}

.auth-card h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--rx-text);
  margin: 0 0 0.3rem;
}

.auth-subtitle {
  color: var(--rx-text-muted);
  margin: 0 0 1.75rem;
  font-size: 0.92rem;
}

.auth-card .stacked-form .form-group {
  margin-bottom: 1.1rem;
}

.auth-card .stacked-form label {
  display: block;
  font-weight: 700;
  font-size: 0.87rem;
  color: var(--rx-text);
  margin-bottom: 0.4rem;
}

.auth-card .stacked-form input[type="text"],
.auth-card .stacked-form input[type="email"],
.auth-card .stacked-form input[type="password"] {
  width: 100%;
  border: 1.5px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: var(--rx-text);
  background: var(--rx-bg);
  outline: none;
  transition: border-color 160ms;
}

.auth-card .stacked-form input:focus {
  border-color: var(--rx-blue);
  box-shadow: 0 0 0 3px rgba(10, 138, 200, 0.12);
}

.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
}

.auth-forgot-link {
  display: block;
  text-align: right;
  font-size: 0.84rem;
  color: var(--rx-blue);
  text-decoration: none;
  margin-top: 0.4rem;
  font-weight: 600;
}

.auth-forgot-link:hover {
  text-decoration: underline;
}

.auth-remember-row {
  display: flex;
  align-items: center;
}

.auth-checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600 !important;
  font-size: 0.88rem;
  cursor: pointer;
}

.auth-checkbox-label input[type="checkbox"] {
  width: auto;
  border: none;
  padding: 0;
  cursor: pointer;
}

.auth-optional {
  color: var(--rx-text-muted);
  font-weight: 500;
}

.auth-footer-link {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.9rem;
  color: var(--rx-text-muted);
}

.auth-footer-link a {
  color: var(--rx-blue);
  font-weight: 700;
  text-decoration: none;
}

.auth-footer-link a:hover {
  text-decoration: underline;
}

.auth-error {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: var(--rx-radius-sm);
  color: var(--rx-danger);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.auth-success {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: var(--rx-radius-sm);
  color: #166534;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.auth-mobile-header {
  display: none;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

/* Logged-in user & logout in top nav */
.nav-user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--rx-text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout-form {
  display: flex;
  align-items: center;
}

.nav-logout-btn {
  background: none;
  border: none;
  padding: 0.4rem;
  color: var(--rx-text-muted);
  cursor: pointer;
  border-radius: var(--rx-radius-sm);
  display: flex;
  align-items: center;
  transition: color 160ms, background 160ms;
  box-shadow: none;
}

.nav-logout-btn:hover {
  color: var(--rx-danger);
  background: #fef2f2;
  box-shadow: none;
  transform: none;
}

/* Mobile: hide left panel, show card with logo */
@media (max-width: 767px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-panel--left {
    display: none;
  }

  .auth-panel--right {
    min-height: 100vh;
    padding: 2rem 1.25rem;
    background: var(--rx-bg);
    align-items: flex-start;
    padding-top: 3rem;
  }

  .auth-card {
    background: var(--rx-card);
    border-radius: var(--rx-radius-md);
    padding: 2rem 1.75rem;
    box-shadow: var(--rx-shadow);
  }

  .auth-mobile-header {
    display: flex;
  }

  .nav-user-name {
    display: none;
  }
}

/* ── Nav user button active state ───────────────────────────────────────────── */

a.nav-user-btn {
  text-decoration: none;
  cursor: pointer;
}

a.nav-user-btn.is-active {
  background: var(--rx-navy);
  border-color: var(--rx-navy);
  color: #fff;
}

/* ── Nav icon links (Settings, Help) ────────────────────────────────────────── */

.nav-icon-link {
  align-items: center;
  background: none;
  border: none;
  border-radius: 0.375rem;
  color: var(--rx-text-muted);
  display: inline-flex;
  font-size: 1.1rem;
  padding: 0.3rem;
  text-decoration: none;
}

.nav-icon-link:hover {
  color: var(--rx-navy);
}

.nav-icon-link.is-active {
  color: var(--rx-navy);
}

@media (max-width: 800px) {
  .nav-icon-link[aria-label="Settings"],
  .nav-icon-link[aria-label="Help"] {
    display: none;
  }
}

/* ── Profile page ────────────────────────────────────────────────────────────── */

.profile-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  width: 100%;
}

.profile-page-header {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.profile-page-header h1 {
  font-size: 1.4rem;
  margin: 0;
}

.profile-signout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  transition: color 160ms, border-color 160ms, background 160ms;
}

.profile-signout-btn:hover {
  color: var(--rx-danger);
  border-color: var(--rx-danger);
  background: #fef2f2;
  box-shadow: none;
  transform: none;
}

.profile-flash {
  margin-bottom: 1.25rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

/* Profile form inputs */
.profile-page .stacked-form label {
  display: block;
  font-weight: 700;
  font-size: 0.87rem;
  color: var(--rx-text);
  margin-bottom: 0.4rem;
}

.profile-page .stacked-form input[type="text"],
.profile-page .stacked-form input[type="email"],
.profile-page .stacked-form input[type="password"] {
  width: 100%;
  border: 1.5px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  outline: none;
  background: var(--rx-bg);
  color: var(--rx-text);
  transition: border-color 160ms;
  box-sizing: border-box;
}

.profile-page .stacked-form input:focus {
  border-color: var(--rx-blue);
  box-shadow: 0 0 0 3px rgba(10, 138, 200, 0.12);
}

.profile-info-row {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.profile-info-label {
  color: var(--rx-text-muted);
  font-weight: 600;
  min-width: 90px;
  flex-shrink: 0;
}

.profile-info-value {
  color: var(--rx-text);
  font-weight: 400;
  word-break: break-all;
}

.profile-divider {
  border: none;
  border-top: 1px solid var(--rx-border);
  margin: 1.1rem 0;
}

/* Sessions list */
.sessions-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  padding: 0.6rem 0.85rem;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.session-agent {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rx-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  font-size: 0.75rem;
  color: var(--rx-text-muted);
}

.session-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(7, 84, 168, 0.12);
  color: var(--rx-navy);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Danger zone */
.danger-zone {
  margin-top: 0.25rem;
}

.danger-zone-heading {
  font-size: 0.9rem;
  color: var(--rx-danger);
  margin: 0 0 0.35rem;
}

.danger-details summary {
  cursor: pointer;
  display: inline-block;
}

.danger-summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rx-danger);
  margin-top: 0.75rem;
}

.danger-form {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(229, 72, 77, 0.2);
}

.btn-danger {
  background: var(--rx-danger);
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #c0393e;
  box-shadow: none;
  transform: none;
}

.btn-inline {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--rx-radius-sm);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  color: var(--rx-text);
  transition: background 0.15s;
}

.btn-inline:hover {
  background: var(--rx-border);
}

@media (max-width: 700px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Password visibility toggle ────────────────────────────────────────────── */

.password-input-wrapper {
  position: relative;
}

.password-input-wrapper input {
  padding-right: 2.75rem !important;
  box-sizing: border-box;
  width: 100%;
}

.password-toggle {
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--rx-text-muted, #888);
  cursor: pointer;
  font-size: 1rem;
  font-weight: inherit;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  transition: none;
}

.password-toggle:hover,
.password-toggle:active {
  background: none;
  box-shadow: none;
  transform: translateY(-50%);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--rx-blue);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .notif-panel {
    /* Switch to fixed so left/right are viewport-relative, not relative to the
       narrow .nav-actions container, which caused the panel to render tiny. */
    left: 1rem;
    max-height: calc(100vh - 5rem);
    max-width: calc(100vw - 2rem);
    min-width: unset;
    position: fixed;
    right: 1rem;
    top: 3.75rem;
    width: calc(100vw - 2rem);
  }
}

/* ── Unified nav user menu ──────────────────────────────────────────────── */

.nav-user-menu {
  position: relative;
}

.nav-user-avatar {
  align-items: center;
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 0.75rem;
  font-weight: 700;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.nav-user-menu-panel {
  background: var(--rx-surface, #fff);
  border: 1px solid var(--rx-border, #e2e8f0);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 14rem;
  overflow: hidden;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 300;
}

.nav-user-menu-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.nav-user-menu-link {
  align-items: center;
  color: inherit;
  display: flex;
  font-size: 0.875rem;
  gap: 0.5rem;
  padding: 0.65rem 0.875rem;
  text-decoration: none;
  transition: background 0.1s;
}

.nav-user-menu-link:hover {
  background: var(--rx-surface-hover, #f1f5f9);
}

.nav-user-menu-link--top {
  border-bottom: 1px solid var(--rx-border, #e2e8f0);
  font-weight: 600;
}

.nav-user-menu-link--manage {
  border-top: 1px solid var(--rx-border, #e2e8f0);
  color: var(--rx-blue, #3b82f6);
  font-size: 0.8125rem;
}

.nav-user-menu-section-label {
  color: var(--rx-text-muted, #94a3b8);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.875rem 0.2rem;
  text-transform: uppercase;
}

.nav-user-menu-switcher-form {
  display: flex;
  flex-direction: column;
}

/* ── Family profiles: profile switcher chip ─────────────────────────────── */

.profile-switcher {
  position: relative;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: 1px solid var(--rx-border, #e2e8f0);
  border-radius: 9999px;
  padding: 0.25rem 0.625rem 0.25rem 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: inherit;
  transition: background 0.15s;
}

.profile-chip:hover {
  background: var(--rx-surface-hover, #f1f5f9);
}

.profile-chip-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.profile-chip-name {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip .fa-chevron-down {
  font-size: 0.625rem;
  opacity: 0.6;
  transition: transform 0.15s;
}

.profile-chip[aria-expanded="true"] .fa-chevron-down {
  transform: rotate(180deg);
}

.profile-switcher-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--rx-surface, #fff);
  border: 1px solid var(--rx-border, #e2e8f0);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 13rem;
  z-index: 200;
  overflow: hidden;
}

.profile-switcher-dropdown form {
  display: flex;
  flex-direction: column;
}

.profile-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  text-align: left;
  color: inherit;
  transition: background 0.1s;
}

.profile-option:hover {
  background: var(--rx-surface-hover, #f1f5f9);
}

.profile-option.is-active {
  background: var(--rx-blue-light, #eff6ff);
  font-weight: 600;
}

.profile-option-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.profile-option-rel {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--rx-text-muted, #94a3b8);
}

.profile-switcher-manage {
  display: block;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--rx-blue, #3b82f6);
  text-decoration: none;
  border-top: 1px solid var(--rx-border, #e2e8f0);
}

.profile-switcher-manage:hover {
  text-decoration: underline;
}

/* ── Active profile context banner ──────────────────────────────────────── */

.profile-context-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1.25rem;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  font-size: 0.875rem;
  color: #92400e;
}

.profile-context-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.profile-context-switch-btn {
  margin-left: auto;
  background: none;
  border: 1px solid #d97706;
  border-radius: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  color: #92400e;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.profile-context-switch-btn:hover {
  background: #fef3c7;
}

/* ── Manage Family page ─────────────────────────────────────────────────── */

.family-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1rem;
}

.family-profile-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem;
  background: var(--rx-surface, #fff);
  border: 1px solid var(--rx-border, #e2e8f0);
  border-radius: 0.5rem;
}

.family-profile-card__avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.family-profile-card__info {
  flex: 1;
  min-width: 0;
}

.family-profile-card__name {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.family-profile-card__meta {
  font-size: 0.8125rem;
  color: var(--rx-text-muted, #94a3b8);
  margin-top: 0.125rem;
}

.family-profile-card__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Avatar color picker ─────────────────────────────────────────────────── */

.avatar-color-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.avatar-color-swatch {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.avatar-color-swatch input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.avatar-color-dot {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: block;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
}

.avatar-color-swatch input[type="radio"]:checked + .avatar-color-dot,
.avatar-color-swatch input[type="radio"]:checked + .avatar-color-custom-input {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1e293b;
  transform: scale(1.1);
}

.avatar-color-swatch--custom {
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.avatar-color-custom-label {
  font-size: 0.75rem;
  color: var(--rx-text-muted, #94a3b8);
  white-space: nowrap;
}

.avatar-color-custom-input {
  -webkit-appearance: none;
  appearance: none;
  border: 2px solid var(--rx-border, #e2e8f0);
  border-radius: 4px;
  box-sizing: border-box;
  cursor: pointer;
  min-height: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  width: 2.5rem;
  overflow: hidden;
  padding: 0;
}

.avatar-color-custom-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.avatar-color-custom-input::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.avatar-color-custom-input::-moz-color-swatch {
  border: none;
  border-radius: 2px;
}

@media (max-width: 600px) {
  .family-profiles-grid {
    grid-template-columns: 1fr;
  }

  .family-profile-card {
    flex-wrap: wrap;
  }

  .family-profile-card__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .profile-chip-name {
    display: none;
  }
}

.app-shell--full {
  max-width: 100%;
}

.help-panel {
  max-width: 100%;
  width: 100%;
}

.help-panel h3 {
  background: #EAF4FF;
  border-left: 4px solid var(--rx-deep-blue);
  color: var(--rx-navy);
  margin: 1.5rem -1.75rem 0.75rem;
  padding: 0.5rem 1.75rem;
}


.auth-divider {
  align-items: center;
  color: var(--rx-text-muted);
  display: flex;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 0.75rem;
  margin: 0.35rem 0;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  background: var(--rx-border);
  content: '';
  flex: 1;
  height: 1px;
}

.google-auth-btn {
  align-items: center;
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  color: var(--rx-navy);
  display: inline-flex;
  gap: 0.65rem;
  justify-content: center;
  width: 100%;
}

.google-auth-btn:hover,
.google-auth-btn:focus-visible {
  background: #f8fbff;
  border-color: var(--rx-deep-blue);
  box-shadow: 0 10px 22px rgba(7, 84, 168, 0.16);
  color: var(--rx-deep-blue);
}

.google-auth-btn.is-loading .google-auth-icon {
  animation: google-auth-spin 900ms linear infinite;
}

.google-auth-btn--compact {
  width: auto;
}

.google-auth-icon {
  align-items: center;
  background: #fff;
  border: 1px solid var(--rx-border);
  border-radius: 50%;
  color: #4285f4;
  display: inline-flex;
  font-family: Arial, sans-serif;
  font-weight: 900;
  height: 1.4rem;
  justify-content: center;
  width: 1.4rem;
}

.google-auth-message {
  margin-top: 0.75rem;
}

.connected-account-row {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.connected-account-info {
  display: grid;
  gap: 0.2rem;
}

.connected-account-status {
  color: var(--rx-text-muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.connected-account-status.is-connected {
  color: #0e7a68;
}

@keyframes google-auth-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .connected-account-row {
    align-items: stretch;
    flex-direction: column;
  }

  .google-auth-btn--compact {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  .google-auth-btn {
    background: #0f223f;
    border-color: rgba(215, 230, 248, 0.25);
    color: #eef6ff;
  }

  .google-auth-btn:hover,
  .google-auth-btn:focus-visible {
    background: #163052;
    color: #fff;
  }
}

/* ── Standalone pain/mood log form panel ─────────────────────────────────── */

.pain-log-panel,
.mood-log-panel {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  box-shadow: var(--rx-shadow);
  margin-bottom: 1.25rem;
  padding: 1.35rem;
}

.pain-log-intro-text {
  color: var(--rx-text-muted);
  font-size: 0.88rem;
  margin: 0 0 0.6rem;
}

.pain-log-cta {
  background: var(--rx-gradient);
  border: 0;
  border-radius: var(--rx-radius-sm);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.65rem 1.2rem;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.pain-log-cta:hover {
  background: var(--rx-gradient-dark);
  box-shadow: 0 12px 24px rgba(7, 84, 168, 0.28);
  transform: translateY(-1px);
}

.pain-log-form-wrap,
.mood-log-form-wrap {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md, 0.75rem);
  margin-top: 0.75rem;
  padding: 1.1rem 1.35rem;
}

.pain-log-form .pain-level-selector,
.mood-log-form .pain-level-selector {
  margin-bottom: 0.75rem;
}

.pain-log-error,
.mood-log-error {
  color: var(--rx-danger, #c9213c);
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}

.log-datetime-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.log-datetime-row .stacked-label {
  flex: 1;
}

.log-datetime-row input[type="date"],
.log-datetime-row input[type="time"] {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-text);
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
  width: 100%;
}

.mood-tag-section {
  margin-bottom: 0.75rem;
}

.mood-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.mood-tag-chip {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: 999px;
  color: var(--rx-text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.mood-tag-chip:hover {
  border-color: var(--rx-blue);
}

.mood-tag-chip.is-selected {
  background: var(--rx-gradient);
  border-color: transparent;
  color: #fff;
}

.mood-tag-chip--add {
  background: transparent;
  border-style: dashed;
}

.mood-tag-custom-input {
  margin-top: 0.5rem;
}

.mood-tag-custom-input input {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  color: var(--rx-text);
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  width: 100%;
}

.history-mood-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.3rem 0 0;
}

.history-mood-tag {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: 999px;
  color: var(--rx-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
}

/* pain-log-level-btn / mood-log-level-btn: same appearance as pain-level-btn /
   mood-level-btn but a separate class so the dose-feedback modal's global
   querySelectorAll('.pain-level-btn') handler doesn't interfere. */
.pain-log-level-btn,
.mood-log-level-btn {
  align-items: center;
  background: var(--rx-bg);
  border: 2px solid var(--rx-border);
  border-radius: 50%;
  color: var(--rx-text-muted);
  cursor: pointer;
  display: flex;
  font-size: 0.85rem;
  font-weight: 700;
  height: 2.6rem;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 2.6rem;
}

.pain-log-level-btn:hover,
.mood-log-level-btn:hover {
  border-color: var(--rx-text-muted);
  color: #fff;
}

/* Pain log level button colors (mirror pain-level-btn selectors) */
.pain-log-level-btn[data-pain-level="1"],
.pain-log-level-btn[data-pain-level="2"],
.pain-log-level-btn[data-pain-level="3"] { border-color: #2a9d49; }

.pain-log-level-btn[data-pain-level="4"],
.pain-log-level-btn[data-pain-level="5"],
.pain-log-level-btn[data-pain-level="6"] { border-color: #d97706; }

.pain-log-level-btn[data-pain-level="7"],
.pain-log-level-btn[data-pain-level="8"] { border-color: #e05b30; }

.pain-log-level-btn[data-pain-level="9"],
.pain-log-level-btn[data-pain-level="10"] { border-color: #c9213c; }

.pain-log-level-btn.is-selected { color: #fff; }

.pain-log-level-btn.is-selected[data-pain-level="1"],
.pain-log-level-btn.is-selected[data-pain-level="2"],
.pain-log-level-btn.is-selected[data-pain-level="3"] { background: #2a9d49; border-color: #2a9d49; }

.pain-log-level-btn.is-selected[data-pain-level="4"],
.pain-log-level-btn.is-selected[data-pain-level="5"],
.pain-log-level-btn.is-selected[data-pain-level="6"] { background: #d97706; border-color: #d97706; }

.pain-log-level-btn.is-selected[data-pain-level="7"],
.pain-log-level-btn.is-selected[data-pain-level="8"] { background: #e05b30; border-color: #e05b30; }

.pain-log-level-btn.is-selected[data-pain-level="9"],
.pain-log-level-btn.is-selected[data-pain-level="10"] { background: #c9213c; border-color: #c9213c; }

/* Mood log level button colors (mirror mood-level-btn selectors, inverted scale) */
.mood-log-level-btn[data-mood-level="1"],
.mood-log-level-btn[data-mood-level="2"],
.mood-log-level-btn[data-mood-level="3"] { border-color: #c9213c; }

.mood-log-level-btn[data-mood-level="4"],
.mood-log-level-btn[data-mood-level="5"],
.mood-log-level-btn[data-mood-level="6"] { border-color: #d97706; }

.mood-log-level-btn[data-mood-level="7"],
.mood-log-level-btn[data-mood-level="8"] { border-color: #8bb04a; }

.mood-log-level-btn[data-mood-level="9"],
.mood-log-level-btn[data-mood-level="10"] { border-color: #2a9d49; }

.mood-log-level-btn.is-selected { color: #fff; }

.mood-log-level-btn.is-selected[data-mood-level="1"],
.mood-log-level-btn.is-selected[data-mood-level="2"],
.mood-log-level-btn.is-selected[data-mood-level="3"] { background: #c9213c; border-color: #c9213c; }

.mood-log-level-btn.is-selected[data-mood-level="4"],
.mood-log-level-btn.is-selected[data-mood-level="5"],
.mood-log-level-btn.is-selected[data-mood-level="6"] { background: #d97706; border-color: #d97706; }

.mood-log-level-btn.is-selected[data-mood-level="7"],
.mood-log-level-btn.is-selected[data-mood-level="8"] { background: #8bb04a; border-color: #8bb04a; }

.mood-log-level-btn.is-selected[data-mood-level="9"],
.mood-log-level-btn.is-selected[data-mood-level="10"] { background: #2a9d49; border-color: #2a9d49; }

/* ── Pain/Mood log history section ──────────────────────────────────────── */

.pain-history-list,
.mood-history-list {
  scroll-margin-top: 5rem;
}

.pain-history-entry,
.mood-history-entry {
  scroll-margin-top: 5rem;
  transition: background 0.4s;
}

.pain-history-entry.is-highlighted,
.mood-history-entry.is-highlighted {
  background: rgba(245, 165, 36, 0.18);
}

.history-entry-badges {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.history-entry-source {
  border-radius: 0.75rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.4rem;
  text-transform: uppercase;
}

.history-entry-source--standalone {
  background: #e0eeff;
  color: #2563eb;
}

.history-entry-source--dose {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  color: var(--rx-text-muted);
}

@media (prefers-color-scheme: dark) {
  .history-entry-source--standalone {
    background: rgba(37, 99, 235, 0.2);
    color: #93c5fd;
  }
}

.history-entry-edited {
  color: var(--rx-text-muted);
  font-size: 0.72rem;
  font-style: italic;
  margin: 0.1rem 0 0;
  width: 100%;
}

.history-entry-edit-btn {
  background: none;
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm, 0.4rem);
  color: var(--rx-text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  margin-left: auto;
  padding: 0.15rem 0.55rem;
  transition: border-color 0.15s, color 0.15s;
}

.history-entry-edit-btn:hover {
  background: none;
  box-shadow: none;
  transform: none;
}

/* Inline edit form within a history entry */
.history-entry-edit-form {
  grid-column: 1 / -1;
  width: 100%;
}

.history-entry-edit-form .pain-level-selector {
  margin-bottom: 0.5rem;
}

.history-entry-edit-error {
  color: var(--rx-danger, #c9213c);
  font-size: 0.83rem;
  margin: 0.2rem 0 0;
}

.stacked-label {
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
  gap: 0.3rem;
  width: 100%;
}

/* ── Notes modal (wider) ─────────────────────────────────────────────────── */

.modal-dialog--wide {
  max-width: 600px;
}

/* ── Note cards ─────────────────────────────────────────────────────────── */

.notes-section {
  margin-top: 0.5rem;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.note-card {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
}

.note-card-body {
  flex: 1;
  min-width: 0;
}

.note-text {
  font-size: 0.9rem;
  margin: 0 0 0.35rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-meta {
  font-size: 0.75rem;
  margin: 0;
}

.note-edit-form {
  margin-top: 0.5rem;
}

.note-edit-textarea {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  background: var(--rx-bg);
  color: var(--rx-text);
  resize: vertical;
}

.note-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.note-actions-menu {
  flex-shrink: 0;
  position: relative;
}

.note-actions-dropdown {
  background: var(--rx-card);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  box-shadow: 0 6px 20px rgba(3,18,42,.2);
  min-width: 130px;
  position: fixed;
  z-index: 1200;
}

.note-action-item {
  background: none;
  border: none;
  cursor: pointer;
  display: block;
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  text-align: left;
  width: 100%;
  color: var(--rx-text);
}

.note-action-item:hover {
  background: var(--rx-hover);
}

.note-action-item--danger {
  color: var(--rx-danger, #e5484d);
}

.add-note-link {
  background: none;
  border: none;
  color: var(--rx-accent);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.25rem 0;
  text-decoration: underline;
}

.add-note-link:hover {
  background: none;
  box-shadow: none;
  opacity: 0.8;
  transform: none;
}

/* ── Dose-change history inside notes modal ──────────────────────────────── */

[data-notes-dose-history] .med-detail-section {
  margin-bottom: 1rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   Onboarding Wizard
   ═══════════════════════════════════════════════════════════════════════ */

.onboarding-body {
  background: var(--rx-gradient-hero);
  min-height: 100vh;
}

.onboarding-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* Header */
.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.onboarding-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
}

.onboarding-logo {
  border-radius: 8px;
}

.onboarding-skip-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  font-size: 0.875rem;
  text-decoration: none;
}

.onboarding-skip-link:hover {
  color: #fff;
  background: none;
  box-shadow: none;
  transform: none;
}

/* Progress indicator */
.onboarding-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1.25rem 0;
}

.onboarding-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  flex: 1;
  cursor: pointer;
}

.onboarding-progress-step::before {
  content: '';
  position: absolute;
  top: 16px;
  right: calc(50% + 16px);
  left: calc(-50% + 16px);
  height: 2px;
  background: rgba(255,255,255,0.25);
}

.onboarding-progress-step:first-child::before {
  display: none;
}

.onboarding-progress-step.is-done::before,
.onboarding-progress-step.is-active::before {
  background: rgba(255,255,255,0.7);
}

.onboarding-progress-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  position: relative;
  z-index: 1;
  transition: background 0.2s, border-color 0.2s;
}

.onboarding-progress-step.is-active .onboarding-progress-dot {
  background: #fff;
  border-color: #fff;
  color: var(--rx-deep-blue);
}

.onboarding-progress-step.is-done .onboarding-progress-dot {
  background: var(--rx-success);
  border-color: var(--rx-success);
  color: #fff;
}

.onboarding-progress-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  text-align: center;
}

.onboarding-progress-step.is-active .onboarding-progress-label {
  color: #fff;
}

/* Content area */
.onboarding-content {
  flex: 1;
}

.onboarding-step {
  background: var(--rx-card);
  border-radius: var(--rx-radius-lg);
  padding: 1.75rem;
  box-shadow: var(--rx-shadow);
}

.onboarding-step-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--rx-navy);
  margin: 0 0 0.35rem;
}

.onboarding-step-desc {
  color: var(--rx-text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.925rem;
}

/* Footer nav */
.onboarding-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0 0;
  gap: 1rem;
}

.ob-footer-center {
  text-align: center;
}

.ob-step-counter {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
}

/* ── Step 1: Medication form ──────────────────────────────────────────── */

.ob-med-form-card {
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.ob-form-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--rx-navy);
  margin: 0 0 1rem;
}

.ob-form-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.ob-form-row--3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.ob-form-row--2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.ob-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ob-field--wide {
  flex: 1;
  min-width: 0;
}

.ob-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rx-text-muted);
}

.ob-field input,
.ob-field select {
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  font-size: 0.925rem;
  color: var(--rx-text);
  background: #fff;
  transition: border-color 0.15s;
}

.ob-field input:focus,
.ob-field select:focus {
  outline: none;
  border-color: var(--rx-blue);
}

.ob-field-hint {
  font-size: 0.75rem;
  color: var(--rx-text-muted);
  margin: 0;
}

.ob-field--checkbox-row {
  justify-content: center;
}

.ob-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.ob-form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.ob-form-error {
  color: var(--rx-danger);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fff0f0;
  border-radius: 6px;
}

/* Draft meds list */
.ob-med-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ob-empty-state {
  color: var(--rx-text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem;
  border: 2px dashed var(--rx-border);
  border-radius: var(--rx-radius-md);
}

.ob-med-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--rx-bg);
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  gap: 0.5rem;
}

.ob-med-item-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
}

.ob-med-item-dose {
  font-size: 0.8rem;
  color: var(--rx-text-muted);
}

.ob-med-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.ob-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ob-badge--prn {
  background: #fff3cd;
  color: #856404;
}

/* ── Step 2: Tracking table ───────────────────────────────────────────── */

.ob-tracking-table-wrap {
  overflow-x: auto;
}

.ob-tracking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ob-tracking-table th {
  padding: 0.6rem 0.75rem;
  background: var(--rx-bg);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rx-text-muted);
  text-align: left;
  border-bottom: 2px solid var(--rx-border);
}

.ob-tracking-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--rx-border);
  vertical-align: middle;
}

.ob-tracking-col--name {
  min-width: 160px;
}

.ob-tracking-col--check {
  width: 100px;
  text-align: center;
}

.ob-tracking-col--check th {
  text-align: center;
}

.ob-tracking-table td.ob-tracking-col--check {
  text-align: center;
}

.ob-col-toggle {
  display: block;
  margin: 0.25rem auto 0;
  font-size: 0.7rem;
  background: none;
  border: 1px solid var(--rx-border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
  color: var(--rx-blue);
}

.ob-tracking-note {
  font-size: 0.8rem;
  color: var(--rx-text-muted);
  margin: 1rem 0 0;
}

.ob-tracking-row--prn td {
  opacity: 0.6;
}

.ob-tracking-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--rx-blue);
}

/* ── Step 3: Schedule ────────────────────────────────────────────────── */

.ob-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ob-schedule-card {
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  overflow: hidden;
}

.ob-schedule-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  background: var(--rx-bg);
  font-size: 0.95rem;
}

.ob-schedule-card-body {
  padding: 0.85rem 1rem;
}

.ob-preset-btns {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.ob-preset-label {
  font-size: 0.75rem;
  color: var(--rx-text-muted);
  font-weight: 600;
  margin-right: 0.25rem;
}

.btn-tag {
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  border: 1.5px solid var(--rx-blue);
  color: var(--rx-blue);
  background: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-weight: 600;
}

.btn-tag:hover {
  background: var(--rx-blue);
  color: #fff;
}

.ob-times-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.ob-time-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: var(--rx-bg);
  border-radius: 8px;
}

.ob-time-pill {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rx-navy);
  min-width: 70px;
}

.ob-time-qty {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--rx-text-muted);
}

.ob-qty-input {
  width: 60px;
  padding: 0.2rem 0.4rem;
  border: 1.5px solid var(--rx-border);
  border-radius: 6px;
  font-size: 0.875rem;
  text-align: center;
}

.ob-remove-time {
  margin-left: auto;
}

.ob-add-custom-time {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ob-custom-time-input {
  padding: 0.4rem 0.65rem;
  border: 1.5px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  font-size: 0.875rem;
  width: 120px;
}

.ob-schedule-save-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--rx-border);
}

.ob-schedule-saved-indicator {
  color: var(--rx-success);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── Step 4: Inventory ───────────────────────────────────────────────── */

.ob-inventory-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ob-inventory-card {
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  overflow: hidden;
}

.ob-inventory-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  background: var(--rx-bg);
}

.ob-inventory-method-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rx-border);
}

.ob-method-tab {
  flex: 1;
  padding: 0.6rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  color: var(--rx-text-muted);
  transition: color 0.15s, border-color 0.15s;
}

.ob-method-tab.is-active {
  color: var(--rx-blue);
  border-bottom-color: var(--rx-blue);
}

.ob-method-panel {
  padding: 1rem;
}

.ob-qty-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ob-inv-count-input {
  width: 100px;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  font-size: 1rem;
  text-align: right;
}

.ob-fill-date,
.ob-fill-qty,
.ob-carryover-qty {
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--rx-border);
  border-radius: var(--rx-radius-sm);
  font-size: 0.925rem;
  width: 100%;
}

.ob-calc-btn {
  margin-top: 0.75rem;
}

.ob-estimate-result {
  background: #eefcf9;
  border: 1px solid var(--rx-success);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.75rem;
}

.ob-estimate-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--rx-navy);
}

.ob-estimate-confidence {
  font-size: 0.8rem;
  color: var(--rx-text-muted);
  margin-top: 0.25rem;
}

.ob-estimate-warnings {
  font-size: 0.8rem;
  color: var(--rx-warning);
  margin-top: 0.25rem;
}

.ob-inventory-save-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--rx-border);
}

/* ── Step 5: Reconcile ───────────────────────────────────────────────── */

.ob-reconcile-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ob-reconcile-group {
  border: 1px solid var(--rx-border);
  border-radius: var(--rx-radius-md);
  overflow: hidden;
}

.ob-reconcile-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--rx-bg);
  gap: 0.75rem;
}

.ob-reconcile-group-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--rx-navy);
}

.ob-reconcile-group-actions {
  display: flex;
  gap: 0.5rem;
}

.ob-reconcile-meds {
  padding: 0.5rem 1rem 0.75rem;
}

.ob-reconcile-med {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--rx-bg);
}

.ob-reconcile-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.ob-reconcile-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

/* ── Step 6: Summary ─────────────────────────────────────────────────── */

.ob-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ob-summary-stat {
  text-align: center;
  padding: 1rem;
  background: var(--rx-bg);
  border-radius: var(--rx-radius-md);
}

.ob-summary-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--rx-deep-blue);
  line-height: 1;
}

.ob-summary-stat-label {
  font-size: 0.75rem;
  color: var(--rx-text-muted);
  margin-top: 0.25rem;
}

.ob-summary-meds {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.ob-summary-med-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--rx-bg);
  border-radius: 8px;
  gap: 0.5rem;
}

.ob-summary-med-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
}

.ob-summary-times {
  font-size: 0.8rem;
  color: var(--rx-text-muted);
}

.ob-summary-no-schedule {
  font-size: 0.8rem;
  color: var(--rx-warning);
}

.ob-summary-med-flags {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.ob-flag {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.7rem;
}

.ob-flag--on {
  background: #e8f4fd;
  color: var(--rx-blue);
}

.ob-summary-note {
  font-size: 0.825rem;
  color: var(--rx-text-muted);
  padding: 0.75rem;
  background: var(--rx-bg);
  border-radius: 8px;
  margin: 0;
}

.ob-activate-row {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.ob-activate-error {
  color: var(--rx-danger);
  font-size: 0.85rem;
}

/* ── Notice / shared ─────────────────────────────────────────────────── */

.ob-notice {
  padding: 0.85rem 1rem;
  background: #eef6ff;
  border-left: 3px solid var(--rx-blue);
  border-radius: 0 8px 8px 0;
  font-size: 0.875rem;
  color: var(--rx-text);
  margin-bottom: 1rem;
}

.ob-field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rx-text-muted);
  margin-bottom: 0.4rem;
}

/* Responsive */
@media (max-width: 600px) {
  .ob-form-row--3col,
  .ob-form-row--2col {
    grid-template-columns: 1fr;
  }

  .ob-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .onboarding-progress-label {
    display: none;
  }

  .onboarding-step {
    padding: 1.25rem;
  }
}
