/* --- Today / Timeline screen --- */

/* --- Intel card --- */

.intel-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
}

.intel-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.intel-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.intel-type-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #00C896;
}

.intel-type-label.caution { color: #F5A623; }
.intel-type-label.treat { color: #A78BFA; }

.intel-confidence {
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  color: var(--text-muted);
}

.intel-card.collapsed .intel-confidence {
  display: none;
}

.intel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
  flex-shrink: 1;
}

.intel-headline-preview {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
  max-width: 180px;
}

.intel-card.collapsed .intel-headline-preview {
  display: block;
}

.collapse-chevron {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.collapse-chevron svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.collapse-chevron.open {
  transform: rotate(180deg);
}

.intel-card.collapsed .intel-body {
  display: none;
}

.intel-body {
  padding: 0 14px 12px;
}

.intel-headline {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.intel-text {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.intel-treat {
  background: rgba(167, 139, 250, 0.1);
  border: 0.5px solid rgba(167, 139, 250, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  color: #A78BFA;
  margin-bottom: 10px;
}

.intel-low-notice {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.intel-why-row {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.intel-why-toggle {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
}

.intel-reasoning {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.intel-reasoning.expanded {
  max-height: 200px;
}

.intel-reasoning-text {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-top: 8px;
}

/* --- Intel skeleton --- */

.intel-skeleton {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.intel-skeleton-bar {
  background: var(--bg-raised);
  border-radius: 4px;
  animation: intel-pulse 1.5s ease-in-out infinite;
}

.intel-skeleton-bar--short {
  height: 16px;
  width: 40%;
}

.intel-skeleton-bar--long {
  height: 36px;
  width: 90%;
}

@keyframes intel-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Date navigation --- */

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.date-nav-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  transition: opacity 0.15s, background 0.15s;
}
.date-nav-btn:active { background: var(--accent-dim); }
.date-nav-btn:disabled { opacity: 0.3; pointer-events: none; }
.date-nav-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-centre {
  flex: 1;
  text-align: center;
  position: relative;
  cursor: pointer;
}

.date-display {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.date-relative {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}
.date-relative.is-today { color: var(--accent); }

.date-picker-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  font-size: 16px;
}

/* --- Loading state --- */
.tl-loading { opacity: 0.4; transition: opacity 0.2s; }

/* --- Full-width stat row --- */
.today-stats-full { grid-template-columns: 1fr; }

/* --- Reading type pill (timeline cards only) --- */

.reading-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.reading-badge.green {
  background: var(--reading-green-bg);
  color: var(--reading-green);
  border: 0.5px solid var(--reading-green);
  box-shadow: 0 0 8px var(--accent-glow);
}
.reading-badge.amber {
  background: var(--reading-amber-bg);
  color: var(--reading-amber);
  border: 0.5px solid var(--reading-amber);
}
.reading-badge.red {
  background: var(--reading-red-bg);
  color: var(--reading-red);
  border: 0.5px solid var(--reading-red);
}

/* --- Stats row --- */

.today-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.stat-cell {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-muted);
}
.stat-value.green { color: var(--reading-green); }
.stat-value.amber { color: var(--reading-amber); }
.stat-value.red   { color: var(--reading-red); }

/* --- Section label --- */

.today-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

/* --- Timeline --- */

.today-timeline {
  display: flex;
  flex-direction: column;
}

.timeline-row {
  display: flex;
  gap: 10px;
  min-height: 52px;
}

.timeline-left {
  width: 40px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-time {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 2px;
}

.timeline-connector {
  flex: 1;
  width: 1px;
  background: var(--border);
  margin-top: 4px;
  min-height: 12px;
}

.timeline-row:last-child .timeline-connector {
  display: none;
}

.timeline-right {
  flex: 1;
  min-width: 0;
  padding-bottom: 10px;
}

/* --- Timeline meal card --- */

.tl-meal {
  background: var(--bg-surface);
  border-left: 2px solid #0F6E56;
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
}

.tl-meal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tl-meal-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(15, 110, 86, 0.12);
  color: #5DCAA5;
  border: 0.5px solid rgba(15, 110, 86, 0.4);
  text-transform: uppercase;
}

.tl-meal-time {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
}

.tl-meal-desc {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  margin-top: 3px;
}

.tl-meds-pill {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(15, 110, 86, 0.12);
  color: #5DCAA5;
  border: 0.5px solid rgba(15, 110, 86, 0.4);
  margin-top: 6px;
}

/* --- Timeline reading card --- */

.tl-reading {
  background: var(--bg-surface);
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
}
.tl-reading.green { border-left: 2px solid var(--reading-green); }
.tl-reading.amber { border-left: 2px solid var(--reading-amber); }
.tl-reading.red   { border-left: 2px solid var(--reading-red); }

.tl-reading-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tl-reading-value {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 700;
}
.tl-reading-value.green { color: var(--reading-green); }
.tl-reading-value.amber { color: var(--reading-amber); }
.tl-reading-value.red   { color: var(--reading-red); }

.tl-reading-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.tl-reading-link {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
}

/* --- Empty state --- */

.today-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 40vh;
  text-align: center;
  gap: 6px;
}

.today-empty-line {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
}

/* --- Pull to refresh --- */

.ptr-indicator {
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  padding: 8px 0;
  display: none;
}
.ptr-indicator.visible { display: block; }
