/* ==========================================================================
   CardioMed • ADHD Medicine BP & Pulse Tracker Stylesheet
   Tactical Dark & Clean Clinical Theme (Mobile-First)
   ========================================================================== */

:root {
  --bg-main: #060b18;
  --bg-surface: #0b1329;
  --bg-card: #0f1c3d;
  --bg-card-hover: #152652;
  --bg-input: #080f22;

  --border-subtle: rgba(56, 189, 248, 0.12);
  --border-focus: #38bdf8;
  --border-card: rgba(56, 189, 248, 0.16);

  --accent-cyan: #38bdf8;
  --accent-blue: #0284c7;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-orange: #f97316;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.7);

  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  min-height: 100vh;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: max(80px, env(safe-area-inset-bottom));
}

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: rgba(6, 11, 24, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.2) 0%, rgba(56, 189, 248, 0.2) 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f43f5e;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header-action {
  height: 34px;
  padding: 0 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-header-action:hover, .btn-header-action:active {
  background: rgba(56, 189, 248, 0.22);
}

.btn-icon {
  width: 36px;
  height: 36px;
  background: #0f1c3d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover, .btn-icon:active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.app-main {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.2px;
}

/* ==========================================================================
   Today Focus Section (2 Daily Readings Protocol)
   ========================================================================== */
.today-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-date-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 2px 7px;
  border-radius: 12px;
}

.today-status-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.today-status-badge.complete {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.today-slots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .today-slots-grid {
    grid-template-columns: 1fr;
  }
}

.slot-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.slot-card.is-logged {
  border-color: rgba(16, 185, 129, 0.35);
}

.slot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slot-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slot-emoji {
  font-size: 20px;
}

.slot-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
}

.slot-timing {
  font-size: 10.5px;
  color: var(--text-dim);
}

.slot-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}

.slot-card.is-logged .slot-status-indicator {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* Slot Body: Logged view */
.slot-reading-display {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(8, 15, 34, 0.6);
  border-radius: var(--radius-md);
  padding: 10px;
}

.slot-bp-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.slot-bp-numbers {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.slot-bp-unit {
  font-size: 10.5px;
  color: var(--text-dim);
  margin-left: 2px;
}

.slot-category-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.slot-category-pill.normal { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.slot-category-pill.elevated { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.slot-category-pill.stage1 { background: rgba(249, 115, 22, 0.18); color: #fdba74; }
.slot-category-pill.stage2 { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

.slot-pulse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.pulse-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: #f43f5e;
}

.slot-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.slot-time-text {
  font-size: 11px;
  color: var(--text-dim);
}

.slot-med-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
}

.btn-slot-edit {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px;
}

.btn-slot-edit:hover {
  color: #ffffff;
}

/* Slot Body: Pending view */
.slot-pending-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  background: rgba(8, 15, 34, 0.4);
  border: 1px dashed rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  text-align: center;
  gap: 6px;
}

.btn-log-slot {
  width: 100%;
  height: 38px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-log-slot:hover, .btn-log-slot:active {
  background: var(--accent-blue);
  color: #ffffff;
}

/* ==========================================================================
   Quick Stats Overview
   ========================================================================== */
.stats-overview-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-bp { background: rgba(56, 189, 248, 0.15); color: var(--accent-cyan); }
.icon-pulse { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.icon-med { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }

.stat-info {
  min-width: 0;
}

.stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.stat-value {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
}

.stat-sub {
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   Chart Section
   ========================================================================== */
.chart-period-tabs {
  display: flex;
  background: #090f20;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.period-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.period-btn.active {
  background: #1e293b;
  color: #ffffff;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-card);
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-sys { background: var(--accent-cyan); }
.dot-dia { background: var(--accent-emerald); }
.dot-pulse { background: var(--accent-rose); }

.chart-container {
  width: 100%;
  height: 220px;
  position: relative;
}

#trendCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  pointer-events: none;
  font-size: 11px;
  color: #e2e8f0;
  z-index: 10;
  transform: translate(-50%, -100%);
  margin-top: -8px;
  white-space: nowrap;
  display: none;
  backdrop-filter: blur(6px);
}

.chart-tooltip-date {
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 2px;
}

.chart-tooltip-reading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.chart-tooltip-alert {
  color: #fbbf24;
  font-weight: 700;
}

.chart-guide-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.guide-chip {
  font-size: 10.5px;
  color: var(--text-dim);
}

/* ==========================================================================
   Daily History Feed
   ========================================================================== */
.history-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.select-filter {
  height: 32px;
  background: #090f20;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  padding: 0 8px;
  outline: none;
  cursor: pointer;
}

.btn-primary-sm {
  height: 32px;
  padding: 0 12px;
  background: var(--accent-blue);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

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

.day-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.day-card-date {
  font-size: 13.5px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-card-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.day-card-badge.complete {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.btn-day-edit-all {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-day-edit-all:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

/* Horizontal 2-Column Grid */
.day-horizontal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
}

/* Slot Column Item */
.history-col {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  position: relative;
  min-height: 94px;
}

.history-col.is-empty {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.2);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 8px;
}

.history-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-col-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.history-col-time {
  font-size: 11px;
  color: var(--text-dim);
}

.history-col.has-timing-alert {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, rgba(15, 23, 42, 0.6) 100%);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.08);
}

.med-hours-badge {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 5.5px;
  border-radius: 9999px;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.med-hours-badge.standard {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.med-hours-badge.alert {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.25);
  font-weight: 800;
}

@media (max-width: 440px) {
  .badge-post-med {
    display: none;
  }
}

.history-col-metrics {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.history-bp-val {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.history-bp-unit {
  font-size: 9.5px;
  font-weight: 600;
  color: #64748b;
  margin-left: 2px;
}

.history-pulse-val {
  font-size: 12px;
  font-weight: 700;
  color: #fb7185;
  display: flex;
  align-items: center;
  gap: 3px;
}

.history-notes-snippet {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.history-col-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 2px;
}

.btn-history-action {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-history-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-history-add {
  background: rgba(56, 189, 248, 0.08);
  border: 1px dashed var(--accent-cyan);
  border-radius: 6px;
  color: var(--accent-cyan);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-history-add:hover {
  background: rgba(56, 189, 248, 0.18);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 16px;
  background: var(--bg-card);
  border: 1px dashed rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  gap: 10px;
}

.empty-icon {
  font-size: 36px;
}

.empty-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 300px;
}

.btn-primary {
  height: 42px;
  padding: 0 18px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   Floating Action Button (Mobile)
   ========================================================================== */
.fab-btn {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: 20px;
  z-index: 50;
  height: 52px;
  padding: 0 18px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid var(--accent-cyan);
  border-radius: 26px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5), 0 0 24px rgba(56, 189, 248, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.fab-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   Bottom Sheet / Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  background: #0c1429;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-sheet-large {
  max-width: 720px;
  max-height: 92vh;
}

.modal-sheet-small {
  max-width: 480px;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
  .modal-sheet {
    border-radius: var(--radius-xl);
  }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle-bar {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.sheet-title {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
}

.btn-sheet-close {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  color: #cbd5e1;
  font-size: 14px;
  cursor: pointer;
}

.sheet-form {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--accent-cyan);
}

/* Modal Slot Tabs / Toggle Switch */
.slot-toggle-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.slot-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.slot-tab-btn:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.slot-tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}

.tab-btn-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.tab-btn-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.slot-tab-btn.active .tab-btn-title {
  color: #ffffff;
}

.tab-btn-badge {
  font-size: 9.5px;
  font-weight: 700;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.tab-btn-badge.ready {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.tab-btn-badge.empty {
  background: rgba(255, 255, 255, 0.05);
  color: #64748b;
}

/* Slot Editor Box */
.slot-editor-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slot-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.slot-editor-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.slot-enable-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.slot-enable-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.slot-toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Big 3 Numeric Entry Cards */
.metrics-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric-input-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.card-sys { border-top: 3px solid var(--accent-cyan); }
.card-dia { border-top: 3px solid var(--accent-emerald); }
.card-pulse { border-top: 3px solid var(--accent-rose); }

.metric-card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
}

.metric-label {
  white-space: nowrap;
}

.metric-unit {
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
}

.metric-stepper-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 2px;
}

.btn-step {
  width: 28px;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 4px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-step:active {
  background: rgba(255, 255, 255, 0.15);
}

.metric-number-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 38px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.metric-number-input::-webkit-outer-spin-button,
.metric-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.metric-hint {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 3px;
}

/* Hours since medication form controls */
.med-hours-form-group {
  margin-top: 10px;
  margin-bottom: 10px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.med-hours-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.med-hours-header .form-label {
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
}

.med-hours-badge-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: all 0.2s ease;
}

.med-hours-badge-status.is-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.55);
}

.med-hours-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.med-hours-stepper {
  flex: 0 0 130px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  display: flex;
  align-items: center;
}

.med-hours-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.med-hours-input {
  width: 100%;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  color: #ffffff;
  padding-right: 18px;
}

.med-hours-unit-tag {
  position: absolute;
  right: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  pointer-events: none;
}

.med-hours-quick-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 160px;
}

.btn-med-pill {
  flex: 1;
  height: 38px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-med-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-med-pill.active {
  background: rgba(2, 132, 199, 0.25);
  border-color: var(--accent-cyan);
  color: #38bdf8;
}

.med-hours-status-hint {
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.med-hours-status-hint.is-warning {
  color: #fbbf24;
  font-weight: 600;
}



/* Modal Sheet Actions */
.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 6px;
}

.btn-modal {
  height: 44px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-modal-cancel {
  background: #1e293b;
  color: #94a3b8;
}

.btn-modal-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

/* ==========================================================================
   Doctor Report Modal & Print View
   ========================================================================== */
.doctor-report-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.report-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.report-main-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
}

.report-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.report-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.report-table th {
  background: #090f20;
  padding: 8px 10px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.report-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  white-space: nowrap;
}

.report-table tr:last-child td {
  border-bottom: none;
}

.doctor-report-actions {
  display: flex;
  gap: 10px;
  padding: 0 18px 14px;
}

.doctor-report-actions .btn-modal,
.doctor-report-actions a {
  flex: 1;
  text-decoration: none !important;
}

.doctor-report-actions .btn-modal:hover,
.doctor-report-actions .btn-modal:focus,
.doctor-report-actions .btn-modal:active,
.doctor-report-actions a:hover,
.doctor-report-actions a:focus,
.doctor-report-actions a:active {
  text-decoration: none !important;
}

/* ==========================================================================
   Settings Modal Body
   ========================================================================== */
.settings-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-label {
  font-size: 13.5px;
  font-weight: 800;
  color: #ffffff;
}

.settings-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.settings-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn-settings-action {
  flex: 1;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-settings-action:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.reference-note {
  background: rgba(8, 15, 34, 0.6);
  border-left: 3px solid var(--accent-cyan);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.4;
}

.settings-version {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast.toast-success { border-color: var(--accent-emerald); }
.toast.toast-error { border-color: var(--accent-rose); }

/* ==========================================================================
   Print Media Styles (Pristine Doctor Paper Report)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 14mm 12mm;
  }

  *, *::before, *::after {
    box-shadow: none !important;
    text-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

  html, body {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 11pt !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Completely hide everything that is not the doctor report */
  body > *:not(#doctorModal) {
    display: none !important;
  }

  .app-container,
  .app-header,
  .fab-btn,
  .today-section,
  .stats-overview-section,
  .chart-section,
  .history-section,
  .modal-backdrop:not(#doctorModal),
  .sheet-header,
  .sheet-handle-bar,
  .btn-sheet-close,
  .doctor-report-actions,
  .toast-container {
    display: none !important;
  }

  /* Make doctor report modal flow as clean paper document */
  #doctorModal,
  .modal-backdrop#doctorModal {
    position: static !important;
    display: block !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    opacity: 1 !important;
  }

  #doctorModal .modal-sheet,
  #doctorModal .modal-sheet-large {
    position: static !important;
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    transform: none !important;
  }

  .doctor-report-body {
    padding: 0 !important;
    display: block !important;
    width: 100% !important;
  }

  .report-header-banner {
    display: block !important;
    border-bottom: 2px solid #0f172a !important;
    padding-bottom: 10px !important;
    margin-bottom: 16px !important;
  }

  .report-main-title {
    color: #0f172a !important;
    font-size: 18pt !important;
    font-weight: 800 !important;
    margin-bottom: 4px !important;
  }

  .report-meta {
    color: #475569 !important;
    font-size: 10.5pt !important;
    font-weight: 600 !important;
  }

  .report-table-wrapper {
    overflow: visible !important;
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    margin-top: 12px !important;
  }

  .report-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 10.5pt !important;
  }

  .report-table th,
  .report-table td {
    padding: 8px 10px !important;
    color: #0f172a !important;
    border: 1px solid #94a3b8 !important;
    white-space: normal !important;
    text-align: left !important;
  }

  .report-table th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
  }

  .report-table td strong {
    color: #0f172a !important;
  }

  .report-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}
