/* Smooth scrolling for chat history */
#chat-history {
  scroll-behavior: smooth;
}
#chat-history.streaming {
  scroll-behavior: auto;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.25); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.45); }

/* Metric tiles */
.metric-tile {
  background: linear-gradient(160deg, rgba(31,41,55,0.95) 0%, rgba(17,24,39,0.98) 100%);
  border-radius: 0.875rem;
  padding: 0.55rem 0.25rem;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.05);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.metric-tile:hover {
  border-color: rgba(99,102,241,0.35);
  box-shadow: 0 0 0 1px rgba(99,102,241,0.15), 0 4px 14px rgba(99,102,241,0.1);
}
/* Active tile — has real data */
.metric-tile--active.metric-tile--cal  { background: linear-gradient(160deg, rgba(234,88,12,0.18) 0%, rgba(31,41,55,0.9) 100%); border-color: rgba(234,88,12,0.25); }
.metric-tile--active.metric-tile--sleep{ background: linear-gradient(160deg, rgba(99,102,241,0.2)  0%, rgba(31,41,55,0.9) 100%); border-color: rgba(99,102,241,0.28); }
.metric-tile--active.metric-tile--steps{ background: linear-gradient(160deg, rgba(52,211,153,0.15) 0%, rgba(31,41,55,0.9) 100%); border-color: rgba(52,211,153,0.22); }
.metric-tile--active.metric-tile--water{ background: linear-gradient(160deg, rgba(56,189,248,0.15) 0%, rgba(31,41,55,0.9) 100%); border-color: rgba(56,189,248,0.22); }
.metric-tile--active.metric-tile--supp { background: linear-gradient(160deg, rgba(167,139,250,0.18) 0%, rgba(31,41,55,0.9) 100%); border-color: rgba(167,139,250,0.25); }
/* Glows for active tiles */
.metric-tile--active.metric-tile--cal:hover   { box-shadow: 0 0 0 1px rgba(234,88,12,0.3),   0 4px 14px rgba(234,88,12,0.15); }
.metric-tile--active.metric-tile--sleep:hover { box-shadow: 0 0 0 1px rgba(99,102,241,0.35), 0 4px 14px rgba(99,102,241,0.15); }
.metric-tile--active.metric-tile--steps:hover { box-shadow: 0 0 0 1px rgba(52,211,153,0.3),  0 4px 14px rgba(52,211,153,0.12); }
.metric-tile--active.metric-tile--water:hover { box-shadow: 0 0 0 1px rgba(56,189,248,0.3),  0 4px 14px rgba(56,189,248,0.12); }
.metric-tile--active.metric-tile--supp:hover  { box-shadow: 0 0 0 1px rgba(167,139,250,0.3), 0 4px 14px rgba(167,139,250,0.12); }
.tile-icon { font-size: 11px; line-height: 1; margin-bottom: 2px; opacity: 0.7; }
.metric-tile--active .tile-icon { opacity: 1; }
.metric-tile--tap {
  cursor: pointer;
  position: relative;
  user-select: none;
}
.metric-tile--tap:active {
  transform: scale(0.96);
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.08);
}
.tile-chevron {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 11px;
  color: rgba(156,163,175,0.4);
  line-height: 1;
  transition: color 0.15s;
}
.metric-tile--tap:hover .tile-chevron {
  color: rgba(165,180,252,0.7);
}

/* AI message bubble */
.ai-message {
  background: #1f2937;
  color: #f3f4f6;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border-top-left-radius: 0.25rem;
  max-width: 30rem;
  font-size: 0.875rem;
  line-height: 1.625;
  white-space: pre-wrap;
  border-left: 2px solid rgba(99,102,241,0.45);
}

/* User message bubble */
.user-message {
  color: #fff;
  padding: 0.625rem 1rem;
  border-radius: 1rem;
  border-top-right-radius: 0.25rem;
  max-width: 30rem;
  font-size: 0.875rem;
  line-height: 1.625;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
}

/* Panel section headers */
.panel-header {
  font-size: 0.6rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Quick action buttons */
.quick-action-btn {
  background: rgba(31,41,55,0.7);
  border: 1px solid rgba(255,255,255,0.05);
  color: #d1d5db;
  font-size: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.quick-action-btn:hover {
  background: rgba(79,70,229,0.15);
  border-color: rgba(99,102,241,0.3);
  color: #e0e7ff;
}

/* Bubble chips */
.bubble-system {
  background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
  color: #fff;
  border: none;
  border-radius: 9999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 1px 8px rgba(79,70,229,0.25);
}
.bubble-system:hover { opacity: 0.85; transform: translateY(-1px); }

.bubble-recent {
  background: transparent;
  color: #9ca3af;
  border: 1px solid #374151;
  border-radius: 9999px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.bubble-recent:hover { border-color: #6b7280; color: #d1d5db; }

/* Supplement inventory dots */
.inv-dot {
  width: 8px; height: 8px;
  border-radius: 9999px;
  flex-shrink: 0;
  display: inline-block;
}
.inv-dot-green  { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.inv-dot-yellow { background: #eab308; box-shadow: 0 0 6px rgba(234,179,8,0.5); }
.inv-dot-red    { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.inv-dot-gray   { background: #4b5563; }

/* ── DNA Onboarding Card ─────────────────────────────────────────────────── */
#dna-onboarding-card {
  background: linear-gradient(135deg, #0f1e3d 0%, #1a0f3d 100%);
  border: 1px solid rgba(99,102,241,0.25);
  box-shadow: 0 0 24px rgba(99,102,241,0.08);
}
#dna-drop-zone {
  transition: border-color 0.15s, background 0.15s;
}
#dna-drop-zone:hover {
  border-color: rgba(99,102,241,0.65);
  background: rgba(99,102,241,0.1);
}

.qa-pill {
  background: rgba(31,41,55,0.9);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 999px;
  color: #9ca3af;
  font-size: 11px;
  padding: 0.3rem 0.75rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor: pointer;
}
.qa-pill:hover {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.3);
  color: #e2e8f0;
}
.device-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(31,41,55,0.9); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 999px; color: #9ca3af; font-size: 11px; padding: 0.25rem 0.65rem;
  cursor: pointer; transition: background 0.15s, border-color 0.15s; position: relative;
}
.device-pill:hover { background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.3); color: #e2e8f0; }
.device-pill .d-dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.d-dot-green{background:#34d399} .d-dot-yellow{background:#fbbf24} .d-dot-gray{background:#4b5563}
.device-pill .d-popover { display:none; position:absolute; bottom:calc(100% + 6px); left:50%; transform:translateX(-50%); background:#1f2937; border:1px solid rgba(255,255,255,0.1); border-radius:8px; padding:8px 12px; font-size:11px; white-space:nowrap; z-index:50; min-width:160px; box-shadow:0 4px 16px rgba(0,0,0,0.4); }
.device-pill:hover .d-popover { display:block; }

/* Panel scroll containers */
.panel-scroll {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}
.panel-scroll::-webkit-scrollbar { width: 3px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 9999px; }

/* bubble-log: orange for logging actions */
.bubble-log {
  background: linear-gradient(135deg, #ea580c 0%, #d97706 100%);
  color: #fff;
  border: none;
  border-radius: 9999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 1px 8px rgba(234,88,12,0.25);
}
.bubble-log:hover { opacity: 0.85; transform: translateY(-1px); }

/* report-tile: card-style for Example Reports panel */
.report-tile {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.07) 0%, rgba(15,23,42,0.7) 100%);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 10px;
  color: #94a3b8;
  font-size: 11px;
  padding: 0.45rem 0.7rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.report-tile:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.14) 0%, rgba(15,23,42,0.85) 100%);
  border-color: rgba(99,102,241,0.3);
  color: #e2e8f0;
  box-shadow: 0 2px 10px rgba(99,102,241,0.1);
}
.report-tile-icon { font-size: 12px; opacity: 0.8; flex-shrink: 0; }

/* Report picker button */
.report-picker-btn {
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
  padding: 2px;
  line-height: 0;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.report-picker-btn:hover { color: #94a3b8; background: rgba(255,255,255,0.05); }

/* Report picker modal */
#report-picker-modal { background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); }
.report-picker-panel {
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  width: 340px;
  max-height: 72vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.report-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  flex-shrink: 0;
}
.report-picker-close {
  background: none;
  border: none;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
}
.report-picker-close:hover { color: #94a3b8; background: rgba(255,255,255,0.05); }
.report-picker-body {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.report-picker-cat { }
.report-picker-cat-label {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 8px 3px;
}
.report-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.report-picker-item:hover {
  background: rgba(99,102,241,0.1);
  color: #e2e8f0;
}

/* Supplement card */
.supp-card {
  background: rgba(17,24,39,0.8);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 0.3rem 0.6rem;
  transition: border-color 0.15s;
}
.supp-card:hover { border-color: rgba(99,102,241,0.2); }
.supp-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.supp-badge--morning   { background: rgba(251,146,60,0.15);  color: #fb923c; border: 1px solid rgba(251,146,60,0.25); }
.supp-badge--afternoon { background: rgba(56,189,248,0.12);  color: #38bdf8; border: 1px solid rgba(56,189,248,0.2); }
.supp-badge--evening   { background: rgba(167,139,250,0.15); color: #a78bfa; border: 1px solid rgba(167,139,250,0.25); }
.supp-badge--nightly   { background: rgba(99,102,241,0.15);  color: #818cf8; border: 1px solid rgba(99,102,241,0.25); }
.supp-inv-track {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
}
.supp-inv-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
/* Compact days-remaining pill (replaces full-width bar) */
.supp-days {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  border-radius: 999px;
}
.supp-days--ok  { color: #22c55e; background: rgba(34,197,94,0.1);  }
.supp-days--mid { color: #eab308; background: rgba(234,179,8,0.12); }
.supp-days--low { color: #ef4444; background: rgba(239,68,68,0.12); }

/* Quick Log cards */
.fav-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border-radius: 9px;
  padding: 0.35rem 0.55rem;
  background: rgba(17,24,39,0.7);
  border-left: 2px solid transparent;
  border-top: 1px solid rgba(255,255,255,0.04);
  border-right: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.fav-card:hover { background: rgba(31,41,55,0.9); }
.fav-card--breakfast { border-left-color: rgba(251,146,60,0.5); }
.fav-card--lunch     { border-left-color: rgba(52,211,153,0.45); }
.fav-card--dinner    { border-left-color: rgba(99,102,241,0.5); }
.fav-card--snack     { border-left-color: rgba(251,191,36,0.4); }
.fav-card--other     { border-left-color: rgba(148,163,184,0.3); }
