/* ==========================================================================
   JATO PHARMA - SMART MEDICATION HUB & MODERN UI UPGRADE
   ========================================================================== */

:root {
  --med-blue: #2563eb;
  --med-blue-dark: #1d4ed8;
  --med-blue-light: #3b82f6;
  --med-blue-soft: #eff6ff;
  --med-blue-border: #dbeafe;
  --med-surface: #f4f7fc;
  --med-card-shadow: 0 10px 30px -5px rgba(37, 99, 235, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
}

/* Global subtle polish */
body {
  background-color: var(--med-surface);
}

/* Header Notification Bell */
.nav-notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-dark);
  font-size: 1.05rem;
  transition: var(--transition);
}
.nav-notif-btn:hover {
  background: var(--med-blue-soft);
  color: var(--med-blue);
}
.notif-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 9px;
  height: 9px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
.notif-dot.active {
  display: block;
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.85; }
}

/* ==========================================================================
   MEDICATION HUB SECTION
   ========================================================================== */
.med-hub-section {
  padding: 36px 0 28px;
  position: relative;
}

.med-hub-shell {
  background: #ffffff;
  border-radius: 28px;
  padding: 28px;
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: var(--med-card-shadow);
}

/* Greeting Header */
.med-hub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.med-greeting-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.med-greeting-text .med-greeting-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.med-greeting-text h2 {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.22;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.med-greeting-text h2 span {
  color: var(--med-blue);
}

.med-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.med-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--med-blue-soft);
  color: var(--med-blue);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--med-blue-border);
}

.med-btn-add-top {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--med-blue);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
  transition: var(--transition);
}
.med-btn-add-top:hover {
  background: var(--med-blue-dark);
  transform: translateY(-1px);
}

/* Search + Filter Strip inside Hub (especially crisp on mobile) */
.med-search-strip {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.med-search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px 14px;
}
.med-search-box i {
  color: #94a3b8;
}
.med-search-box input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.92rem;
  color: var(--text-dark);
}
.med-filter-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}
.med-filter-btn:hover {
  background: var(--med-blue-soft);
  color: var(--med-blue);
  border-color: var(--med-blue-border);
}

/* Main 2-Column Dashboard Grid */
.med-hub-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  width: 100%;
}

.med-col-left,
.med-col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* Next Dose Hero Card */
.next-dose-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  color: #ffffff;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 48%, #3b82f6 100%);
  box-shadow: 0 16px 34px -8px rgba(37, 99, 235, 0.42);
  transition: var(--transition);
}

.next-dose-card.all-done {
  background: linear-gradient(135deg, #059669 0%, #10b981 60%, #34d399 100%);
  box-shadow: 0 16px 34px -8px rgba(16, 185, 129, 0.35);
}

.next-dose-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.next-dose-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  z-index: 2;
  width: 100%;
}
.next-dose-top > div:first-child {
  min-width: 0;
  flex: 1;
}

.next-dose-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.snooze-pill {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
}

.next-dose-time {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.next-dose-med {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  padding: 6px 14px;
  border-radius: 999px;
}

.next-dose-illustration {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.22));
  animation: floatBottle 4s ease-in-out infinite;
}

@keyframes floatBottle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.next-dose-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
  position: relative;
  z-index: 2;
}

.btn-dose-taken {
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 12px 16px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  transition: var(--transition);
}
.btn-dose-taken:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}
.next-dose-card.all-done .btn-dose-taken {
  color: #059669;
}

.btn-dose-snooze {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 14px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: var(--transition);
}
.btn-dose-snooze:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* Quick Features Grid ("Tính năng nhanh") */
.med-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.med-block-title h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
}
.med-see-all {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--med-blue);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.med-see-all:hover {
  text-decoration: underline;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-action-tile {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
  transition: var(--transition);
}
.quick-action-tile:hover {
  background: #ffffff;
  border-color: var(--med-blue-border);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
  transform: translateY(-2px);
}

.qa-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--med-blue-soft);
  color: var(--med-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.qa-icon.teal { background: #ecfdf5; color: #059669; }
.qa-icon.indigo { background: #eef2ff; color: #4f46e5; }
.qa-icon.sky { background: #e0f2fe; color: #0284c7; }

.quick-action-tile span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.25;
}

/* Adherence Ring Card ("Tuân thủ uống thuốc") */
.adherence-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.adherence-card:hover {
  background: #ffffff;
  border-color: var(--med-blue-border);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
}

.adherence-info h4 {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.adherence-percent {
  font-size: 2rem;
  font-weight: 900;
  color: var(--med-blue);
  line-height: 1.1;
  margin-bottom: 4px;
}
.adherence-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
}

.adherence-ring-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  flex-shrink: 0;
}
.adherence-ring-svg {
  width: 78px;
  height: 78px;
  transform: rotate(-90deg);
}
.adherence-ring-bg {
  fill: none;
  stroke: #dbeafe;
  stroke-width: 8;
}
.adherence-ring-progress {
  fill: none;
  stroke: var(--med-blue);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.adherence-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--med-blue);
  font-size: 1.35rem;
}

/* Today's Schedule Card ("Lịch uống hôm nay") */
.schedule-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 20px;
}

.schedule-filter-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.sch-filter-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #ffffff;
  color: var(--text-muted);
  border: 1px solid #e2e8f0;
  transition: var(--transition);
}
.sch-filter-pill.active {
  background: var(--med-blue);
  color: #ffffff;
  border-color: var(--med-blue);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-item {
  background: #ffffff;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
}
.schedule-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}
.schedule-item.is-next {
  border-color: var(--med-blue-border);
  background: linear-gradient(to right, #ffffff, #f8fbff);
}

.sch-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sch-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.sch-status-icon.taken {
  background: #10b981;
  color: #fff;
}
.sch-status-icon.due {
  background: var(--med-blue);
  color: #fff;
}
.sch-status-icon.upcoming {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.sch-time {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-dark);
  min-width: 46px;
}

.sch-med-info {
  min-width: 0;
}
.sch-med-name {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sch-med-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.sch-action-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}
.sch-action-btn.taken-badge {
  background: #dcfce7;
  color: #15803d;
  cursor: default;
}
.sch-action-btn.take-now {
  background: var(--med-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.sch-action-btn.take-now:hover {
  background: var(--med-blue-dark);
  transform: translateY(-1px);
}
.sch-action-btn.take-upcoming {
  background: #f1f5f9;
  color: var(--text-dark);
}
.sch-action-btn.take-upcoming:hover {
  background: var(--med-blue-soft);
  color: var(--med-blue);
}

/* ==========================================================================
   MODALS FOR MEDICATION HUB (Add Med, Med List, Adherence Report, Notifs)
   ========================================================================== */
.med-modal-content {
  max-width: 560px !important;
  width: 94%;
  border-radius: 24px !important;
  padding: 26px !important;
}

.med-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-right: 32px;
}
.med-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--med-blue-soft);
  color: var(--med-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.med-modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dark);
}
.med-modal-header p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.med-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.med-quick-chip {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-dark);
  border: 1px solid #e2e8f0;
  transition: var(--transition);
}
.med-quick-chip:hover {
  background: var(--med-blue-soft);
  color: var(--med-blue);
  border-color: var(--med-blue-border);
}

.med-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.med-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.med-form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
}
.med-form-group input,
.med-form-group select {
  padding: 10px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 0.92rem;
  background: #f8fafc;
}
.med-form-group input:focus,
.med-form-group select:focus {
  border-color: var(--med-blue);
  background: #ffffff;
}

/* Med Manager List */
.med-manager-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.med-mgr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.med-mgr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.med-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: var(--transition);
}
.med-icon-btn.buy {
  background: #ecfdf5;
  color: #059669;
}
.med-icon-btn.buy:hover { background: #d1fae5; }
.med-icon-btn.del {
  background: #fef2f2;
  color: #ef4444;
}
.med-icon-btn.del:hover { background: #fee2e2; }

/* Adherence Analytics Modal */
.report-summary-banner {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border-radius: 20px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.report-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.report-kpi-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}
.report-kpi-box strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--med-blue);
}
.report-kpi-box span {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.weekly-chart-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
}
.weekly-chart-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  height: 120px;
  align-items: end;
  margin-top: 12px;
}
.wc-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.wc-bar-track {
  width: 100%;
  max-width: 24px;
  height: 88px;
  background: #e2e8f0;
  border-radius: 999px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.wc-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-radius: 999px;
  transition: height 0.5s ease;
}
.wc-day {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Notification List */
.notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.notif-item.urgent {
  background: var(--med-blue-soft);
  border-color: var(--med-blue-border);
}

/* ==========================================================================
   MOBILE APP EXPERIENCE POLISH (<= 768px)
   ========================================================================== */
@media (max-width: 991px) {
  .med-hub-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .med-hub-section {
    padding: 14px 0 18px;
  }
  .med-hub-section .container {
    padding: 0 12px;
  }
  .med-hub-shell {
    border-radius: 22px;
    padding: 16px 14px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .med-greeting-text h2 {
    font-size: 1.28rem;
  }
  .med-top-actions .med-pill-badge {
    display: none;
  }
  .med-btn-add-top {
    padding: 8px 13px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .med-search-strip {
    display: flex;
  }
  .next-dose-card {
    padding: 18px 16px;
    border-radius: 20px;
    width: 100%;
    max-width: 100%;
  }
  .next-dose-time {
    font-size: 1.45rem;
  }
  .next-dose-med {
    font-size: 0.88rem;
    padding: 5px 12px;
    max-width: 100%;
  }
  .next-dose-illustration {
    width: 62px;
    height: 62px;
  }
  .next-dose-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
  }
  .btn-dose-taken,
  .btn-dose-snooze {
    font-size: 0.78rem;
    padding: 10px 8px;
    white-space: nowrap;
  }
  .quick-actions-grid {
    gap: 8px;
    width: 100%;
  }
  .quick-action-tile {
    padding: 10px 4px;
    border-radius: 16px;
    min-width: 0;
  }
  .qa-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 12px;
  }
  .quick-action-tile span {
    font-size: 0.7rem;
  }
  .adherence-card {
    padding: 15px 16px;
    border-radius: 20px;
  }
  .schedule-card {
    padding: 14px 12px;
    border-radius: 20px;
    width: 100%;
  }
  .schedule-item {
    padding: 11px 10px;
    gap: 8px;
  }
  .sch-time {
    min-width: 40px;
    font-size: 0.82rem;
  }
  .sch-med-info {
    flex: 1;
    min-width: 0;
  }
  .sch-med-name {
    font-size: 0.85rem;
  }
  .sch-action-btn {
    padding: 6px 10px;
    font-size: 0.74rem;
    white-space: nowrap;
  }
  .med-form-grid {
    grid-template-columns: 1fr;
  }

  /* Sleeker Glassmorphic Bottom Nav with Raised Center + FAB */
  .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.06) !important;
    padding-bottom: env(safe-area-inset-bottom, 4px);
    overflow: visible !important;
  }
  .mb-nav-item.active {
    color: var(--med-blue) !important;
  }
  .mb-nav-fab-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
  }
  .mb-center-fab {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 1.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.42), 0 0 0 4px #ffffff;
    transform: translateY(-16px);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .mb-center-fab:active {
    transform: translateY(-13px) scale(0.94);
  }
}

/* ==========================================================================
   EMOTIONAL INTERACTIVE APP UPGRADE (Day/Night, Scene, Liquid, Sheet, 7-Day)
   ========================================================================== */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #f59e0b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  border: 1px solid #e2e8f0;
  transition: var(--transition);
}
.theme-toggle-btn:hover {
  transform: rotate(15deg) scale(1.06);
  background: #fef3c7;
}

/* Night Mode for Medication Hub */
.med-hub-shell.night-mode {
  background: linear-gradient(180deg, #0f172a 0%, #172038 100%);
  border-color: rgba(148, 163, 184, 0.2);
  color: #f8fafc;
}
.med-hub-shell.night-mode .med-greeting-text .med-greeting-sub {
  color: #94a3b8;
}
.med-hub-shell.night-mode .med-greeting-text h2,
.med-hub-shell.night-mode .med-block-title h3,
.med-hub-shell.night-mode .adherence-info h4,
.med-hub-shell.night-mode .sch-time,
.med-hub-shell.night-mode .sch-med-name,
.med-hub-shell.night-mode .water-amount {
  color: #f8fafc;
}
.med-hub-shell.night-mode .med-pill-badge {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.3);
  color: #93c5fd;
}
.med-hub-shell.night-mode .theme-toggle-btn {
  background: #1e293b;
  border-color: #334155;
  color: #fde047;
}
.med-hub-shell.night-mode .quick-action-tile,
.med-hub-shell.night-mode .adherence-card,
.med-hub-shell.night-mode .schedule-card,
.med-hub-shell.night-mode .water-card,
.med-hub-shell.night-mode .med-search-box,
.med-hub-shell.night-mode .med-filter-btn {
  background: rgba(30, 41, 59, 0.78);
  border-color: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}
.med-hub-shell.night-mode .quick-action-tile span,
.med-hub-shell.night-mode .adherence-sub,
.med-hub-shell.night-mode .sch-med-note,
.med-hub-shell.night-mode .water-sub {
  color: #cbd5e1;
}
.med-hub-shell.night-mode .schedule-item,
.med-hub-shell.night-mode .sch-filter-pill,
.med-hub-shell.night-mode .day-pill {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
.med-hub-shell.night-mode .sch-filter-pill.active,
.med-hub-shell.night-mode .day-pill.active {
  background: var(--med-blue);
  border-color: var(--med-blue);
  color: #fff;
}

/* Contextual Animated Hero Scene Banner */
.med-scene-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 55%, #f0f9ff 100%);
  border: 1px solid #dbeafe;
  transition: all 0.4s ease;
}
.med-hub-shell.night-mode .med-scene-card,
.med-scene-card.scene-night {
  background: linear-gradient(135deg, #1e1b4b 0%, #1e293b 65%, #0f172a 100%);
  border-color: rgba(129, 140, 248, 0.28);
}
.med-scene-card.scene-due {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
}
.med-scene-card.scene-done {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #a7f3d0;
}
.scene-left {
  flex: 1;
  min-width: 0;
}
.scene-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 8px 14px;
  border-radius: 16px 16px 16px 4px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  margin-bottom: 10px;
  transition: all 0.3s ease;
}
.med-hub-shell.night-mode .scene-bubble,
.med-scene-card.scene-night .scene-bubble {
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  backdrop-filter: blur(8px);
}
.scene-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.scene-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.78);
  color: #475569;
  border: 1px solid rgba(203, 213, 225, 0.7);
  transition: var(--transition);
}
.scene-chip.active,
.scene-chip:hover {
  background: var(--med-blue);
  color: #fff;
  border-color: var(--med-blue);
}
.med-hub-shell.night-mode .scene-chip,
.med-scene-card.scene-night .scene-chip {
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.25);
}
.med-hub-shell.night-mode .scene-chip.active {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}
.scene-character {
  width: 82px;
  height: 82px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatBottle 3.6s ease-in-out infinite;
}

/* Liquid-Fill Water & Wellness Tracker Card */
.water-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition);
}
.water-bottle-wrap {
  position: relative;
  width: 54px;
  height: 76px;
  border-radius: 14px 14px 18px 18px;
  border: 3px solid #93c5fd;
  background: #eff6ff;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 2px 6px rgba(37, 99, 235, 0.08);
}
.water-liquid-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.water-liquid-fill::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -10%;
  width: 120%;
  height: 10px;
  background: rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  animation: waveBob 2.4s ease-in-out infinite;
}
@keyframes waveBob {
  0%, 100% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
}
.water-bottle-pct {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: #0f172a;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}
.water-info {
  flex: 1;
  min-width: 0;
}
.water-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0284c7;
  text-transform: uppercase;
}
.water-amount {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1.15;
  margin: 2px 0;
}
.water-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.water-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btn-water-add {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 13px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
  white-space: nowrap;
}
.btn-water-add:hover {
  transform: translateY(-1px);
}
.btn-water-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-align: center;
}

/* 7-Day Interactive Strip & Segmented Timeline Switcher */
.seven-day-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.day-pill {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}
.day-pill .day-num {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-dark);
}
.med-hub-shell.night-mode .day-pill .day-num {
  color: #f8fafc;
}
.day-pill .day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
}
.day-pill.active {
  background: var(--med-blue);
  border-color: var(--med-blue);
  color: #dbeafe;
}
.day-pill.active .day-num {
  color: #ffffff;
}
.day-pill.active .day-dot {
  background: #ffffff;
}

.schedule-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.view-mode-switch {
  display: inline-flex;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 3px;
}
.view-mode-btn {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  transition: var(--transition);
}
.view-mode-btn.active {
  background: #ffffff;
  color: var(--med-blue);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

/* Hourly Visual Timeline */
.hourly-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ht-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: center;
}
.ht-hour {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
}
.ht-block {
  border-radius: 14px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 700;
}
.ht-block.med {
  background: #eff6ff;
  color: #1d4ed8;
  border-left: 4px solid #2563eb;
}
.ht-block.med.done {
  background: #ecfdf5;
  color: #047857;
  border-left: 4px solid #10b981;
}
.ht-block.water {
  background: #f0f9ff;
  color: #0369a1;
  border-left: 4px solid #0ea5e9;
}

/* Slide-Up Quick-Log Bottom Sheet */
.quick-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.quick-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.quick-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 105%);
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 28px 28px 0 0;
  padding: 12px 20px 28px;
  z-index: 9999;
  box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.18);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
.quick-sheet.active {
  transform: translate(-50%, 0);
}
.qs-handle {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: #cbd5e1;
  margin: 0 auto 14px;
}
.qs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.qs-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
}
.qs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.qs-tile {
  border-radius: 20px;
  padding: 16px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}
.qs-tile:active {
  transform: scale(0.97);
}
.qs-tile.mint { background: #ecfdf5; color: #065f46; }
.qs-tile.sky { background: #e0f2fe; color: #075985; }
.qs-tile.lavender { background: #eef2ff; color: #3730a3; }
.qs-tile.peach { background: #fff7ed; color: #9a3412; }
.qs-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}
.qs-tile strong {
  font-size: 0.96rem;
  font-weight: 800;
}
.qs-tile small {
  font-size: 0.78rem;
  opacity: 0.82;
  font-weight: 500;
}

@media (max-width: 768px) {
  .med-scene-card {
    padding: 14px 14px;
    border-radius: 20px;
  }
  .scene-character {
    width: 66px;
    height: 66px;
  }
  .water-card {
    padding: 14px;
    gap: 12px;
  }
  .water-amount {
    font-size: 1.25rem;
  }
}

