/* ==========================================
   Owlve 2.0 — Unified Layout Styles
   ========================================== */

/* In v2 mode, repurpose the app header to hold the health top panel */
.owlve2 .app-header {
  padding: 0;
}

/* Expand sidebar button in header */
.v2-header-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  background: #eef2ff;
  color: #6366f1;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 8px;
  flex-shrink: 0;
  position: relative;
}
.v2-header-expand-btn:hover {
  background: #e0e7ff;
  color: #4f46e5;
  border-color: #a5b4fc;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.15);
}
.v2-header-expand-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
}
.v2-header-expand-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #1f2937;
}
.v2-header-expand-btn:hover .v2-header-expand-tooltip {
  display: block;
}

.owlve2 .app-header .header-tabs {
  display: none !important;
}

.owlve2 .app-header .mobile-hamburger {
  display: none !important;
}

/* Hide inline plan list and search in v2 sidebar (safety fallback) */
.owlve2 #planList,
.owlve2 .chat-search-container {
  display: none !important;
}

/* Hide old floating expand button in v2 mode */
.owlve2 .sidebar-expand-btn {
  display: none !important;
}

/* Expand button inside collapsed sidebar */
.v2-sidebar-expand-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 24px auto 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  flex-shrink: 0;
}
.v2-sidebar.collapsed .v2-sidebar-expand-btn {
  display: flex;
}
.v2-sidebar-expand-btn:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.v2-sidebar-expand-tooltip {
  display: none;
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
}
.v2-sidebar-expand-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #1f2937;
}
.v2-sidebar-expand-btn:hover .v2-sidebar-expand-tooltip {
  display: block;
}

/* ---- V2 Sidebar ---- */
.v2-sidebar {
  background: #fff;
  border-right: 1px solid #f3f4f6;
}

.v2-sb-section {
  padding: 0 12px;
}

.v2-sb-primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 0px);
  margin: 0 0 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: #111827;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.v2-sb-primary-btn:hover {
  background: #1f2937;
}

.v2-sb-primary-btn svg {
  stroke: #fff;
  flex-shrink: 0;
}

.v2-sb-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  margin: 0 0 2px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #374151;
  font-size: 18px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.v2-sb-nav-item:hover {
  background: #f3f4f6;
  color: #111827;
}

.v2-sb-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f3f4f6;
  flex-shrink: 0;
  color: #6b7280;
}

.v2-sb-nav-item:hover .v2-sb-nav-icon {
  background: #e5e7eb;
  color: #374151;
}

.v2-sb-nav-label {
  flex: 1;
}

.v2-sb-nav-chevron {
  color: #9ca3af;
  flex-shrink: 0;
}

.v2-sb-divider {
  height: 1px;
  background: #f3f4f6;
  margin: 8px 16px;
}

.v2-sb-section-label {
  padding: 8px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #9ca3af;
}

/* Collapsed state */
.v2-sidebar.collapsed .v2-sb-primary-btn span,
.v2-sidebar.collapsed .v2-sb-nav-label,
.v2-sidebar.collapsed .v2-sb-nav-chevron,
.v2-sidebar.collapsed .v2-sb-section-label {
  display: none;
}

.v2-sidebar.collapsed .v2-sb-primary-btn {
  padding: 10px;
  justify-content: center;
  margin: 0 auto 8px;
  width: auto;
}

.v2-sidebar.collapsed .v2-sb-nav-item {
  justify-content: center;
  padding: 0;
  margin: 0 auto 4px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  position: relative;
  overflow: visible;
}
.v2-sidebar.collapsed .v2-sb-nav-item:hover {
  background: #f3f4f6;
}
.v2-sidebar.collapsed .v2-sb-nav-item .v2-sb-nav-icon {
  background: transparent;
  width: 44px;
  height: 44px;
}

/* Tooltips for collapsed sidebar nav items */
.v2-sb-nav-tooltip {
  display: none;
}
.v2-sidebar.collapsed .v2-sb-nav-tooltip {
  display: none;
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
}
.v2-sidebar.collapsed .v2-sb-nav-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #1f2937;
}
.v2-sidebar.collapsed .v2-sb-nav-item:hover .v2-sb-nav-tooltip {
  display: block;
}

.v2-sidebar.collapsed .v2-sb-section {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.v2-sidebar.collapsed .v2-sb-divider {
  margin: 8px 8px;
}

/* ---- Health Panel ---- */
.v2-health-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.v2-health-panel::-webkit-scrollbar {
  display: none;
}

/* Divider between sections */
.v2-hp-divider {
  width: 1px;
  height: 32px;
  background: linear-gradient(to bottom, transparent, #d1d5db, transparent);
  flex-shrink: 0;
  margin: 0 2px;
}

/* ---- Mood / Energy / Stress pills ---- */
.v2-hp-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  flex-shrink: 0;
}

.v2-hp-pill .v2-hp-icon {
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
}

.v2-hp-pill .v2-hp-icon svg {
  color: #9ca3af;
}

.v2-hp-pill .v2-hp-text {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

/* Individual pill colors */
.v2-hp-mood {
  background: #fef3f2;
  border-color: #fecaca;
}
.v2-hp-mood:hover {
  background: #fee2e2;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.12);
}

.v2-hp-energy {
  background: #fffbeb;
  border-color: #fde68a;
}
.v2-hp-energy:hover {
  background: #fef3c7;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.12);
}

.v2-hp-stress {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.v2-hp-stress:hover {
  background: #dcfce7;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.12);
}

/* ---- Metric items (sleep/steps/distance/calories) ---- */
.v2-hp-metric {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.v2-hp-metric:hover {
  background: #f3f4f6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.v2-hp-metric-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.v2-hp-sleep-icon { background: #dbeafe; color: #3b82f6; }
.v2-hp-steps-icon { background: #fce7f3; color: #ec4899; }
.v2-hp-dist-icon  { background: #ede9fe; color: #8b5cf6; }
.v2-hp-cal-icon   { background: #fef3c7; color: #f59e0b; }

.v2-hp-metric-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 48px;
}

.v2-hp-metric-val {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
  letter-spacing: -0.02em;
}

.v2-hp-metric-val small {
  font-size: 10px;
  font-weight: 500;
  color: #9ca3af;
  margin-left: 1px;
}

/* Mini progress bars */
.v2-hp-bar {
  width: 100%;
  height: 3px;
  background: #f3f4f6;
  border-radius: 2px;
  overflow: hidden;
}

.v2-hp-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.v2-hp-bar-sleep { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.v2-hp-bar-steps { background: linear-gradient(90deg, #f472b6, #ec4899); }
.v2-hp-bar-dist  { background: linear-gradient(90deg, #a78bfa, #8b5cf6); }
.v2-hp-bar-cal   { background: linear-gradient(90deg, #fbbf24, #f59e0b); }

/* ---- Toggle pills (Insights / Genome) ---- */
.v2-hp-toggle {
  background: #f9fafb;
  border-color: #e5e7eb;
}

.v2-hp-toggle:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.v2-hp-toggle svg {
  color: #6b7280;
  transition: color 0.2s;
}

.v2-hp-toggle.active {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}

.v2-hp-toggle.active .v2-hp-text {
  color: #fff;
}

.v2-hp-toggle.active svg {
  color: #fff;
}

/* ---- Health Dropdown (Mood/Energy/Stress) ---- */
.v2-htp-dropdown {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 8px;
  min-width: 180px;
  animation: v2-dropdown-in 0.15s ease-out;
}

@keyframes v2-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.v2-htp-dropdown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  color: #374151;
}

.v2-htp-dropdown-option:hover {
  background: #f3f4f6;
}

.v2-htp-dropdown-option.selected {
  background: #ede9fe;
  font-weight: 600;
}

.v2-htp-dropdown-option .v2-dd-emoji {
  font-size: 20px;
}

.v2-htp-dropdown-option .v2-dd-label {
  flex: 1;
}

/* ---- Metric Chart Popup ---- */
.v2-metric-popup {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 16px;
  width: 320px;
  max-width: 90vw;
  animation: v2-dropdown-in 0.15s ease-out;
}

.v2-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.v2-popup-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.v2-popup-value {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
}

.v2-popup-value .v2-popup-unit {
  font-size: 12px;
  font-weight: 400;
  color: #9ca3af;
}

.v2-popup-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 2px;
}

.v2-popup-tab {
  flex: 1;
  padding: 5px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
}

.v2-popup-tab.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.v2-popup-chart {
  min-height: 60px;
}

/* ---- Nutrition Popup ---- */
.v2-nutrition-popup {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 16px;
  width: 350px;
  max-width: 90vw;
  max-height: 70vh;
  overflow-y: auto;
  animation: v2-dropdown-in 0.15s ease-out;
}

.v2-nutrition-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.v2-nutrition-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.v2-nutrition-camera-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
}

.v2-nutrition-camera-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ---- Date Navigation ---- */
.v2-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 48px 10px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  position: relative;
}
.v2-focus-clock-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 20px;
  font-weight: 500;
  color: #374151;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.v2-focus-clock-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.v2-date-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: none;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
}

.v2-date-nav-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.v2-date-label {
  font-size: 18px;
  font-weight: 400;
  color: #111827;
  padding: 4px 8px;
  border-radius: 6px;
}

/* ---- Left Panel structure ---- */
.v2-left-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.v2-left-panel .calendar-left-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.v2-event-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}

/* Hide the date nav header from renderDailyEvents in v2 mode */
.owlve2 .v2-left-panel #dailyEvents .date-nav-header {
  display: none !important;
}

/* ---- Overlay Header (for insights/genome/agent overlays) ---- */
.v2-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
}

.v2-overlay-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.v2-overlay-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
}

.v2-overlay-refresh:hover {
  background: #f3f4f6;
  color: #111827;
}

.v2-overlay-refresh.spinning svg {
  animation: spin 0.6s linear;
}

.v2-overlay-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.v2-overlay-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
}

.v2-overlay-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ---- Agent Input Box ---- */
.v2-agent-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  flex-shrink: 0;
}

.v2-agent-textarea {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 36px;
  max-height: 120px;
  outline: none;
  background: #f4f5f7;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  line-height: 1.4;
  overflow-y: hidden;
}

.v2-agent-textarea:focus {
  border-color: #7c3aed;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.v2-agent-textarea::placeholder {
  color: #9ca3af;
}

/* Voice button — gradient animated style */
.v2-agent-voice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.3s, background 0.3s, box-shadow 0.3s;
  flex-shrink: 0;
  position: relative;
}

.v2-agent-voice-btn::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  padding: 2px;
  background: transparent;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: opacity 0.3s;
  opacity: 0;
}

.v2-agent-voice-btn:hover {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
}

/* Listening state — animated gradient ring */
.v2-agent-voice-btn.listening {
  color: #fff;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.4);
  animation: v2-voice-pulse 1.6s ease-in-out infinite;
}

.v2-agent-voice-btn.listening::before {
  opacity: 1;
  background: conic-gradient(#ec4899, #8b5cf6, #06b6d4, #ec4899);
  animation: v2-ring-spin 2s linear infinite;
}

/* Transcribing state — calmer gradient, pulsing ring */
.v2-agent-voice-btn.transcribing {
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
  animation: v2-voice-transcribe 1.2s ease-in-out infinite;
}

.v2-agent-voice-btn.transcribing::before {
  opacity: 1;
  background: conic-gradient(#8b5cf6, #06b6d4, #3b82f6, #8b5cf6);
  animation: v2-ring-spin 1.5s linear infinite, v2-ring-breathe 1.2s ease-in-out infinite;
}

@keyframes v2-voice-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 16px rgba(139, 92, 246, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 24px rgba(236, 72, 153, 0.5); }
}

@keyframes v2-voice-transcribe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes v2-ring-spin {
  to { transform: rotate(360deg); }
}

@keyframes v2-ring-breathe {
  0%, 100% { inset: -3px; opacity: 0.7; }
  50% { inset: -6px; opacity: 1; }
}

.v2-agent-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.v2-agent-send-btn svg {
  stroke: currentColor;
}

.v2-agent-send-btn:hover {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
  border-color: #c4b5fd;
}

.v2-agent-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.v2-agent-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.v2-agent-attach-btn:hover {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
}

/* ---- Overlay Backdrop (shared for dropdown click-outside) ---- */
.v2-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
}

/* ---- Agent Messages in event panel ---- */
.v2-agent-messages {
  padding: 16px;
}

.v2-agent-messages .agent-message {
  margin-bottom: 12px;
}

/* ---- Insights tabs (Daily / Weekly) ---- */
.v2-insights-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.v2-insights-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.v2-insights-tab:hover {
  color: #374151;
  background: #f9fafb;
}

.v2-insights-tab.active {
  color: #6366f1;
  border-bottom-color: #6366f1;
}

.v2-insights-tab.active svg {
  stroke: #6366f1;
}

/* ---- Insights date navigation ---- */
.v2-insights-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
}

.v2-insights-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  color: #374151;
  transition: background 0.15s;
}

.v2-insights-nav-btn:hover:not(.disabled) {
  background: #f3f4f6;
}

.v2-insights-nav-btn.disabled {
  opacity: 0.3;
  cursor: default;
}

.v2-insights-nav-date {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

/* ---- Insights empty state ---- */
.v2-insights-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: #6b7280;
}

.v2-insights-empty svg {
  margin-bottom: 16px;
}

.v2-insights-empty p {
  font-size: 14px;
  line-height: 1.5;
  max-width: 280px;
}

/* ---- Insights content in event panel ---- */
/* When insights mode is active, make the panel flex column so header/tabs are fixed */
.v2-event-panel-content:has(.v2-insights-tabs) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.v2-insights-content {
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.v2-insights-content .daily-insights-card {
  padding: 16px;
}

.v2-insights-content .weekly-insights {
  padding: 16px;
}

/* ---- Project History in event panel ---- */
.v2-project-history {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-top: 12px;
}

.v2-project-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 12px;
  padding: 0 12px;
  height: 36px;
  border: none;
  border-radius: 18px;
  background: #f5f5f5;
}

.v2-project-search svg {
  flex-shrink: 0;
  display: block;
}

.v2-project-search-input {
  border: none;
  background: transparent;
  font-size: 14px;
  line-height: 1;
  font-family: inherit;
  color: #111827;
  outline: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.v2-project-search-input::placeholder {
  color: #9ca3af;
}

.v2-project-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 16px;
}

/* Project list items */
.v2-project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 0 0 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.v2-project-item:hover {
  background: #f3f4f6;
}

.v2-project-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.v2-project-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-project-item-date,
.v2-project-item-meta {
  font-size: 12px;
  color: #9ca3af;
}

.v2-project-item-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: #9ca3af;
  transition: color 0.15s, background 0.15s;
}

.v2-project-item-delete:hover {
  color: #ec4899;
  background: rgba(236, 72, 153, 0.08);
}

/* Make the event panel flex when project history is active */
.v2-event-panel-content:has(.v2-project-history) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Genome content in event panel ---- */
.v2-genome-content {
  padding: 16px;
}

/* ---- Calendar main keeps original topbar-based height in v2 ---- */
.owlve2 .calendar-split-view {
  height: 100%;
}

/* ==========================================
   Monthly Calendar — Modern Redesign (v2)
   ========================================== */

/* Right panel container */
.owlve2 .calendar-right-panel {
  display: flex;
  flex-direction: column;
  min-width: 280px;
  max-width: 360px;
  background: #f8f9fb;
  border-left: 1px solid #e5e7eb;
  padding: 0 !important;
}

.owlve2 .monthly-calendar {
  padding: 0 12px 12px;
}

/* ---- Month Header — match event panel date nav ---- */
.owlve2 .monthly-calendar .month-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  margin: 0;
  background: transparent;
  border-bottom: none;
  border-radius: 0;
  position: static;
  min-height: 32px;
  box-sizing: content-box;
}

.owlve2 .month-header h2 {
  font-size: 18px;
  font-weight: 400;
  color: #111827;
  margin: 0;
  letter-spacing: -0.01em;
}

.owlve2 .month-nav-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  color: #374151;
}

.owlve2 .month-nav-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.owlve2 .month-nav-btn svg {
  width: 22px;
  height: 22px;
}

/* Hide all 3 todo buttons — we add a unified one via CSS */
.owlve2 #mobileFoldBtn2,
.owlve2 #mobileTodoBtn {
  display: none !important;
}

.owlve2 .desktop-todo-btn {
  position: static;
  width: 32px;
  height: 32px;
  padding: 0;
  margin-left: auto;
  border-radius: 8px;
  color: #3b82f6;
  transition: all 0.2s;
}

.owlve2 .desktop-todo-btn:hover {
  background: #dbeafe;
  color: #2563eb;
}

.owlve2 .desktop-todo-btn svg {
  width: 20px;
  height: 20px;
}

/* Hide the bottom todo row */
.owlve2 .todo-open-row {
  display: flex !important;
  margin-top: 8px;
}

/* Hide fold bar in v2 */
.owlve2 .month-fold-bar {
  display: none !important;
}

/* ---- Calendar Grid ---- */
.owlve2 .calendar-grid {
  padding: 8px 0 0;
  gap: 0 !important;
}

/* ---- Weekday Headers ---- */
.owlve2 .calendar-weekdays {
  column-gap: 0 !important;
  margin-bottom: 0;
  border-bottom: none;
}

.owlve2 .weekday {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 0;
}

/* ---- Day Grid — clean, borderless ---- */
.owlve2 .calendar-days {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  grid-auto-rows: 1fr !important;
  column-gap: 0 !important;
  row-gap: 0 !important;
  gap: 0 !important;
  border: none;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  flex: none !important;
  align-content: unset !important;
}

.owlve2 .calendar-day {
  aspect-ratio: 1 / 1 !important;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 8px !important;
  background: transparent;
  transition: background 0.12s ease;
  box-shadow: none !important;
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.owlve2 .calendar-day.empty {
  background: transparent;
  cursor: default;
}

.owlve2 .calendar-day:not(.empty):hover {
  background: #e0f2fe;
}

/* Day number */
.owlve2 .day-number {
  font-size: 17px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0;
}

/* Today */
.owlve2 .calendar-day.today {
  background: #dbeafe;
}

.owlve2 .calendar-day.today .day-number {
  color: #2563eb;
  font-weight: 700;
}

.owlve2 .calendar-day.today:hover {
  background: #bfdbfe;
}

/* Selected */
.owlve2 .calendar-day.selected {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
}

.owlve2 .calendar-day.selected .day-number {
  color: #fff;
  font-weight: 700;
}

.owlve2 .calendar-day.selected:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6) !important;
}

/* Event indicator — old style hidden */
.owlve2 .event-indicator {
  display: none !important;
}

/* Event dots — iOS style */
.owlve2 .event-dots {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-top: 2px;
}

.owlve2 .event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #3b82f6;
}

.owlve2 .event-dot.completed {
  background-color: #10b981;
}

.owlve2 .calendar-day.selected .event-dot {
  background-color: rgba(255, 255, 255, 0.7);
}

.owlve2 .calendar-day.selected .event-dot.completed {
  background-color: rgba(255, 255, 255, 0.9);
}

.owlve2 .event-dot-count {
  font-size: 9px;
  color: #9ca3af;
  margin-left: 1px;
  line-height: 1;
}

.owlve2 .calendar-day.selected .event-dot-count {
  color: rgba(255, 255, 255, 0.8);
}

/* ---- Give more space to the event panel ---- */
.owlve2 .calendar-left-panel {
  flex: 2;
}

.owlve2 .calendar-left-panel {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  overflow: hidden;
  background: #fff;
}

/* The event panel content must scroll, not the whole left panel */
.owlve2 .v2-event-panel-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Agent input must stay pinned at bottom */
.owlve2 #v2AgentInput {
  flex-shrink: 0;
  margin-bottom: 24px;
}

/* ---- No header — reclaim all vertical space ---- */
.owlve2 .app-header {
  display: none !important;
}

.owlve2 .app-body {
  margin-top: 0 !important;
}

.owlve2 .calendar-main {
  height: 100vh !important;
  max-height: 100vh !important;
}

.owlve2 .calendar-left-panel::after {
  display: none !important;
}

.owlve2 .calendar-right-panel {
  border-left: 1px solid #e5e7eb !important;
}

/* ---- Health Tags (above agent input) — minimal modern ---- */
.v2-health-tags {
  display: flex;
  gap: 8px;
  padding: 12px 14px 6px;
  flex-shrink: 0;
}

.v2-health-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 20px;
  border: none;
  background: #f3f4f6;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.v2-health-tag:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.v2-ht-mood.has-value {
  background: #fdf2f8;
  color: #be185d;
}

.v2-ht-stress.has-value {
  background: #ecfdf5;
  color: #047857;
}

.v2-ht-icon {
  font-size: 15px;
  line-height: 1;
}

.v2-ht-label {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ---- Scale Dropdown (1-5 number picker, opens upward) ---- */
.v2-scale-dropdown {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.06);
  padding: 12px 14px;
  min-width: 220px;
  animation: v2-scale-in 0.15s ease-out;
}

@keyframes v2-scale-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.v2-scale-header {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  text-align: center;
}

.v2-scale-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.v2-scale-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 40px;
  height: 52px;
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  background: #fafafa;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  padding: 6px 0;
}

.v2-scale-btn:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(124,58,237,0.15);
}

.v2-scale-btn.selected {
  border-color: #7c3aed;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  box-shadow: 0 3px 10px rgba(124,58,237,0.3);
}

.v2-scale-emoji {
  font-size: 18px;
  line-height: 1;
}

.v2-scale-num {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
}

.v2-scale-btn.selected .v2-scale-num {
  color: #fff;
}

.v2-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: #9ca3af;
  padding: 0 2px;
}

/* ---- Health Trend Chart ---- */
#v2HealthTrendChart {
  margin-top: auto;
  margin-bottom: -10px;
}
.trend-chart-wrap {
  padding: 8px 12px 4px;
}
.trend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 6px 0 12px;
}
.trend-title {
  font-size: 15px;
  font-weight: 400;
  color: #1f2937;
}
.trend-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}
.trend-toggle-btn {
  font-size: 15px;
  font-weight: 500;
  color: #9ca3af;
  cursor: pointer;
  padding-bottom: 2px;
  transition: color 0.15s;
}
.trend-toggle-btn:hover {
  color: #6366f1;
}
.trend-toggle-btn.active {
  color: #6366f1;
  border-bottom: 2px solid #6366f1;
}
.trend-toggle-sep {
  color: #d1d5db;
  font-size: 15px;
  user-select: none;
}
.trend-tooltip {
  position: absolute;
  display: none;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

/* ---- Health Score Ring (below calendar, pushed to bottom) ---- */
#v2HealthScoreRing {
  margin-top: auto;
  overflow: visible;
}

.v2-score-ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 32px;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.15s;
  position: relative;
  overflow: visible;
}

.v2-score-ring-container:hover {
  background: rgba(0,0,0,0.03);
}

.v2-ring-tooltip {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  z-index: 9999;
  background: #1f2937;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.12s;
}
.v2-score-ring-container:hover .v2-ring-tooltip {
  visibility: visible;
  opacity: 1;
}

.v2-score-zone-label {
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
}

.v2-score-subtitle {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 4px;
}

/* ---- Health Score Page (matches iOS HealthScoreScreen) ---- */
.v2-health-score-page {
  padding: 0 20px 40px;
  overflow-y: auto;
}

/* Hero ring */
.v2-hs-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 0 12px;
}

.v2-hs-zone {
  font-size: 16px;
  font-weight: 700;
  margin-top: 8px;
  letter-spacing: -0.02em;
}

.v2-hs-completeness {
  font-size: 14px;
  color: #6b7280;
  margin-top: 10px;
  font-weight: 500;
}
.v2-hs-date {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 4px;
}

.v2-hs-hint {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 4px;
}

/* Sections — separated like iOS */
.v2-hs-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.v2-hs-section-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

/* Breakdown rows */
.v2-breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f3f4f6;
}

.v2-breakdown-row:last-child {
  border-bottom: none;
}

.v2-breakdown-emoji {
  font-size: 18px;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}

.v2-breakdown-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  width: 70px;
  flex-shrink: 0;
}

.v2-breakdown-bar {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.v2-breakdown-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.v2-breakdown-val {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

/* Tips — bullet list like iOS */
.v2-hs-tip-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding-right: 8px;
}

.v2-hs-tip-bullet {
  font-size: 16px;
  color: #6b7280;
  line-height: 22px;
  flex-shrink: 0;
}

.v2-hs-tip-text {
  font-size: 15px;
  color: #374151;
  line-height: 22px;
}

/* Body Profile */
.v2-hs-body-profile {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v2-hs-body-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.v2-hs-body-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.v2-hs-body-label {
  font-size: 15px;
  color: #374151;
}

/* Metric tags — horizontal scrollable pills like iOS */
.v2-hs-metric-tags {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.v2-hs-metric-tags::-webkit-scrollbar {
  display: none;
}

.v2-hs-metric-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 8px 14px;
  flex-shrink: 0;
}

.v2-hs-mt-icon {
  font-size: 18px;
  line-height: 1;
}

.v2-hs-mt-text {
  display: flex;
  flex-direction: column;
}

.v2-hs-mt-value {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
}

.v2-hs-mt-label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
  margin-top: 1px;
}

/* Body profile — interactive fields */
.v2-hs-body-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v2-hs-body-clickable {
  cursor: pointer;
  flex: 1;
}

.v2-hs-body-clickable:hover .v2-hs-body-label {
  color: #6366f1;
}

.v2-hs-body-edit {
  font-size: 12px;
  margin-left: 6px;
  opacity: 0.5;
}

.v2-hs-unit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f3f4f6;
  border: none;
  border-radius: 12px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #6366f1;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.v2-hs-unit-toggle:hover {
  background: #e5e7eb;
}

.v2-hs-unit-toggle svg {
  color: #6366f1;
}

.v2-hs-body-picker {
  margin-top: 6px;
  background: #f9fafb;
  border-radius: 10px;
  padding: 8px;
}

.v2-hs-picker-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: #1a1a1a;
  outline: none;
  cursor: pointer;
}

.v2-hs-picker-select:focus {
  border-color: #6366f1;
}

/* Metric tag active state */
.v2-hs-metric-tag {
  cursor: pointer;
  transition: all 0.15s;
}

.v2-hs-metric-tag:hover {
  border-color: #d1d5db;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.v2-hs-metric-tag.active {
  border-color: currentColor;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Expanded metric area */
.v2-hs-metric-expanded:empty {
  display: none;
}

.v2-hs-expanded-card {
  margin-top: 14px;
  background: #f9fafb;
  border-radius: 12px;
  padding: 16px;
}

.v2-hs-expanded-single {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
}

.v2-hs-expanded-icon {
  font-size: 28px;
  line-height: 1;
}

.v2-hs-expanded-value {
  font-size: 26px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.03em;
}

.v2-hs-expanded-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.v2-hs-expanded-hint {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

/* Hourly bar chart */
.v2-hs-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.v2-hs-chart-title {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
}

.v2-hs-chart-total {
  font-size: 15px;
  font-weight: 700;
}

.v2-hs-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 100px;
  padding-bottom: 16px;
  position: relative;
}

.v2-hs-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
  position: relative;
}

.v2-hs-bar-col:hover .v2-hs-bar {
  opacity: 0.8;
}

.v2-hs-bar {
  width: 100%;
  min-height: 0;
  border-radius: 2px 2px 0 0;
  transition: height 0.4s ease;
}

.v2-hs-bar-label {
  font-size: 9px;
  color: #9ca3af;
  margin-top: 4px;
  height: 12px;
  position: absolute;
  bottom: -16px;
  white-space: nowrap;
}

/* Chart tabs (day/week/month) for metric expand */
.v2-hs-chart-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.v2-hs-chart-tab {
  flex: 1;
  padding: 6px 0;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}

.v2-hs-chart-tab:hover {
  background: #f9fafb;
}

.v2-hs-chart-tab.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.v2-hs-bridge-chart {
  overflow-x: auto;
}

.v2-hs-bridge-chart svg {
  width: 100%;
  height: auto;
  max-height: 140px;
}

/* Sleep bedtime/wake-up display */
.v2-hs-sleep-times {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.v2-hs-sleep-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.v2-hs-sleep-block-icon {
  line-height: 1;
}

.v2-hs-sleep-block-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.v2-hs-sleep-block-value {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}

.v2-hs-sleep-divider {
  width: 1px;
  height: 40px;
  background: #e5e7eb;
}

/* View Insights button */
.v2-hs-insights-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  cursor: pointer;
  transition: opacity 0.15s;
}

.v2-hs-insights-btn:hover {
  opacity: 0.7;
}

.v2-hs-insights-text {
  font-size: 16px;
  font-weight: 600;
  color: #6366f1;
  flex: 1;
}

/* Notes card */
.v2-hs-notes-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f9fafb;
  border-radius: 12px;
  padding: 14px;
}

.v2-hs-notes-icon {
  font-size: 18px;
  line-height: 22px;
  flex-shrink: 0;
}

.v2-hs-notes-text {
  font-size: 15px;
  color: #374151;
  line-height: 22px;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
  .v2-health-panel {
    padding: 0 8px;
    gap: 4px;
  }

  .v2-hp-pill {
    padding: 4px 10px;
  }

  .v2-hp-pill .v2-hp-text {
    font-size: 12px;
  }

  .v2-hp-metric {
    padding: 4px 6px;
    gap: 5px;
  }

  .v2-hp-metric-icon {
    width: 24px;
    height: 24px;
  }

  .v2-hp-metric-val {
    font-size: 12px;
  }

  .v2-metric-popup,
  .v2-nutrition-popup {
    width: calc(100vw - 32px);
    left: 16px !important;
  }

  .v2-date-nav {
    padding: 8px 12px;
  }

  .v2-agent-input {
    padding: 8px;
  }

  .v2-health-tags {
    gap: 4px;
    padding: 6px 8px 2px;
    flex-wrap: wrap;
  }

  .v2-health-tag {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 16px;
  }

  .v2-score-ring-container {
    padding: 12px;
  }

  .v2-scale-dropdown {
    min-width: 200px;
  }
}

/* ==========================================
   Weekly Calendar View
   ========================================== */

.v2-view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 4px;
  position: relative;
}
.v2-view-toggle-btn:hover {
  background: #f3f4f6;
  color: #374151;
}
.v2-view-toggle-btn.active {
  background: #eef2ff;
  color: #6366f1;
}
.v2-view-toggle-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
}
.v2-view-toggle-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #1f2937;
}
.v2-view-toggle-btn:hover .v2-view-toggle-tooltip {
  display: block;
}

.v2-weekly-container {
  display: flex;
  flex-direction: column;
  overflow-x: auto;
}

/* Day name header row */
.v2-weekly-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 2px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.v2-weekly-day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 2px 6px;
  user-select: none;
}

.v2-weekly-day-name {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.v2-weekly-day-header-today .v2-weekly-day-name {
  color: #6366f1;
}

.v2-weekly-day-num {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin-top: 2px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.v2-weekly-day-num-today {
  background: #6366f1;
  color: #fff !important;
}

/* 7-column grid */
.v2-weekly-columns {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex: 1;
  min-height: 200px;
}

.v2-weekly-col {
  padding: 6px 3px;
  border-right: 1px solid #e5e7eb;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.v2-weekly-col:last-child {
  border-right: none;
}
.v2-weekly-col-today {
  background: #f8f9ff;
}

/* Event card (compact) */
.v2-weekly-evt {
  display: flex;
  gap: 4px;
  padding: 4px 5px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.v2-weekly-evt:hover {
  background: #f3f4f6;
}
.v2-weekly-evt-bar {
  width: 3px;
  min-height: 100%;
  border-radius: 2px;
  flex-shrink: 0;
}
.v2-weekly-evt-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.v2-weekly-evt-title {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.v2-weekly-evt-time {
  font-size: 10px;
  color: #9ca3af;
}
.v2-weekly-evt-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 3px;
  vertical-align: middle;
}
.v2-weekly-evt-done { background: #10b981; }
.v2-weekly-evt-missed { background: #ef4444; }

.v2-weekly-no-events {
  font-size: 12px;
  color: #d1d5db;
  text-align: center;
  padding-top: 12px;
}

@media (max-width: 768px) {
  .v2-weekly-header-row,
  .v2-weekly-columns {
    min-width: 560px;
  }
  .v2-weekly-day-num {
    font-size: 15px;
    width: 26px;
    height: 26px;
  }
}

/* ==========================================
   Focus Clock Overlay
   ========================================== */
.v2-focus-clock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.v2-focus-clock-time {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 120px;
  font-weight: 300;
  color: #fff;
  letter-spacing: 4px;
  line-height: 1;
}
.v2-focus-clock-date {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 16px;
  font-weight: 400;
}
.v2-focus-clock-hint {
  position: absolute;
  bottom: 40px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.25);
}
@media (max-width: 600px) {
  .v2-focus-clock-time {
    font-size: 56px;
  }
  .v2-focus-clock-date {
    font-size: 16px;
  }
}

/* ==========================================
   Daily Check-in Modal
   ========================================== */
.v2-checkin-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: v2-fade-in 0.2s ease-out;
}

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

.v2-checkin-modal {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  width: 440px;
  max-width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: v2-scale-in 0.2s ease-out;
}

.v2-checkin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.v2-checkin-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.v2-checkin-date {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 2px;
}

.v2-checkin-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.15s;
}

.v2-checkin-close:hover {
  background: #f3f4f6;
  color: #374151;
}

/* Progress dots */
.v2-checkin-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.v2-checkin-progress-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.v2-checkin-progress-item span {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
}

.v2-checkin-progress-item.done span {
  color: #6366f1;
}

.v2-checkin-progress-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s;
}

.v2-checkin-progress-item.done .v2-checkin-progress-dot {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.v2-checkin-progress-line {
  width: 30px;
  height: 2px;
  background: #e5e7eb;
  margin-bottom: 18px;
}

/* Sections */
.v2-checkin-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v2-checkin-section {
  background: #f9fafb;
  border-radius: 14px;
  padding: 14px;
}

.v2-checkin-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
}

/* Sleep pickers */
.v2-checkin-sleep-pickers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v2-checkin-time-block {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
}

.v2-checkin-time-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.v2-checkin-time-selects {
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-checkin-time-selects select {
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  background: #fff;
  color: #111827;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  flex: 1;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}

.v2-checkin-time-selects select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.v2-checkin-time-selects .v2-checkin-colon {
  font-size: 20px;
  font-weight: 700;
  color: #9ca3af;
  flex-shrink: 0;
}

.v2-checkin-time-selects .v2-checkin-ampm-group {
  display: flex;
  align-items: stretch;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.v2-checkin-time-selects .v2-checkin-ampm-btn {
  padding: 10px 12px;
  border: none;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s;
}

.v2-checkin-time-selects .v2-checkin-ampm-btn.active {
  background: #6366f1;
  color: #fff;
}

.v2-checkin-duration {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #6366f1;
  padding: 2px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.v2-checkin-duration svg {
  flex-shrink: 0;
}

/* Emoji row (mood/stress) */
.v2-checkin-emoji-row {
  display: flex;
  gap: 6px;
}

.v2-checkin-emoji-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}

.v2-checkin-emoji-btn:hover {
  border-color: #c4b5fd;
  background: #f5f3ff;
  transform: translateY(-1px);
}

.v2-checkin-emoji-btn.mood-selected {
  border-color: #ec4899;
  background: #ec4899;
}

.v2-checkin-emoji-btn.stress-selected {
  border-color: #10b981;
  background: #10b981;
}

.v2-checkin-emoji-btn.selected .v2-checkin-emoji-label {
  color: #fff;
}

.v2-checkin-emoji {
  font-size: 22px;
  line-height: 1;
}

.v2-checkin-emoji-label {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

/* Save button */
.v2-checkin-save-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: #6366f1;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.15s;
}

.v2-checkin-save-btn:hover {
  background: #4f46e5;
}

.v2-checkin-save-btn.disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* Check-in health panel pill */
.v2-hp-checkin {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.v2-hp-checkin:hover {
  background: #e0e7ff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
}

.v2-hp-checkin-done {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.v2-hp-checkin-done:hover {
  background: #d1fae5;
}

/* Check-in health tag (agent input area) */
.v2-ht-checkin {
  border-color: #c7d2fe;
}

.v2-ht-checkin.has-value {
  border-color: #a7f3d0;
  background: #ecfdf5;
}
