/* ═══════════════════════════════════════════════════════════════
   Health module styles
   ═══════════════════════════════════════════════════════════════ */

.health-shell {
  display: grid;
  gap: 18px;
}

/* ── Summary strip ──────────────────────────────────────────────── */

.health-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.health-stat-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
}

.health-stat-card__icon {
  font-size: 22px;
  line-height: 1;
  flex: 0 0 auto;
  margin-top: 2px;
}

.health-stat-card__body {
  min-width: 0;
}

.health-stat-card__value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 3px;
}

.health-stat-card__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}

.health-stat-card__trend {
  font-size: 11px;
  font-weight: 800;
}

.health-stat-card__trend--ok      { color: var(--success); }
.health-stat-card__trend--warn    { color: var(--warning); }
.health-stat-card__trend--bad     { color: var(--danger); }
.health-stat-card__trend--neutral { color: var(--muted); }

/* ── Check-in prompt ────────────────────────────────────────────── */

.health-checkin-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border: 1.5px dashed #c6d8ef;
  border-radius: 22px;
  background: linear-gradient(180deg, #f5f9ff 0%, #eef4fc 100%);
  flex-wrap: wrap;
}

.health-checkin-prompt__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.health-checkin-prompt__icon {
  font-size: 28px;
  flex: 0 0 auto;
}

.health-checkin-prompt__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.health-checkin-prompt__sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Today's card ───────────────────────────────────────────────── */

.health-today-card {
  border: 1px solid #c5dcb8;
  border-radius: 20px;
  background: linear-gradient(180deg, #f2fbf4 0%, #e8f7ec 100%);
  padding: 16px 18px;
  display: grid;
  gap: 12px;
}

.health-today-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.health-today-card__title {
  font-size: 15px;
  font-weight: 800;
  color: #156b45;
  letter-spacing: -0.02em;
}

.health-today-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.health-today-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  border: 1px solid #b8e0c5;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.health-today-chip--note {
  border-radius: 12px;
  flex: 1 1 100%;
}

/* ── Insights ───────────────────────────────────────────────────── */

.health-insights-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.health-insights-card__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.health-insights-list {
  display: grid;
  gap: 8px;
}

.health-insight-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8faff 0%, #f3f6fb 100%);
  border: 1px solid #e8eef6;
}

.health-insight-row__icon {
  font-size: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.health-insight-row__text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}

/* ── Charts ─────────────────────────────────────────────────────── */

.health-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.health-chart-card {
  grid-column: span 2;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
  padding: 16px 18px;
  display: grid;
  gap: 12px;
}

.health-chart-card--half {
  grid-column: span 1;
}

.health-chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.health-chart-card__title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.health-chart-card__badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #eef4fb;
  color: #2d5a8e;
  border: 1px solid #ccdff5;
}

.health-chart-card__badge--purple {
  background: #f3f0fb;
  color: #5c3d9e;
  border-color: #d4c8f2;
}

.health-chart-card__svg {
  width: 100%;
  overflow: hidden;
}

.health-chart-card__svg svg {
  width: 100%;
  height: 72px;
}

.health-chart-card__footer {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  padding-top: 4px;
  border-top: 1px solid #eef2f7;
}

.health-chart-card__footer strong {
  color: var(--text);
}

/* ── Goal weight ────────────────────────────────────────────────── */

.health-goal-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.health-goal-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.health-goal-card__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.health-goal-card__btn {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 12px;
  box-shadow: none;
}

.health-goal-card__body {
  display: grid;
  gap: 10px;
}

.health-goal-card__empty {
  font-size: 13px;
  color: var(--muted);
}

.health-progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e8eef6;
  overflow: hidden;
}

.health-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3d79c6 0%, #62a0e8 100%);
  transition: width 0.4s ease;
}

.health-progress-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.health-goal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.health-goal-meta strong {
  color: var(--text);
}

/* ── Readiness card ──────────────────────────────────────────────── */

.health-readiness-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
}

.health-readiness-card__ring {
  flex: 0 0 auto;
}

.health-readiness-card__body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.health-readiness-card__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.health-readiness-card__advice {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.health-readiness-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.health-readiness-chip {
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  background: #f2f6fc;
  border: 1px solid #e4ecf6;
  border-radius: 999px;
  padding: 4px 10px;
}

.health-alert-card {
  border-color: #f0b25b;
  background: linear-gradient(180deg, #fff8ef 0%, #fffaf3 100%);
}

.health-alert-card .health-goal-card__title {
  color: #b8650a;
}

@media (max-width: 640px) {
  .health-readiness-card {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
}

/* ── Empty states & inline links ────────────────────────────────── */

.apple-nodata {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  padding: 32px 20px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: var(--surface-soft, #f9fbfe);
}

.apple-nodata__icon {
  font-size: 32px;
}

.apple-nodata__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.apple-nodata__sub {
  font-size: 13px;
  color: var(--muted);
  max-width: 480px;
  line-height: 1.5;
}

.health-inline-link {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 800;
  color: var(--primary, #3d79c6);
  text-decoration: underline;
  cursor: pointer;
}

.health-inline-link:hover {
  opacity: 0.8;
}

/* ── History table ──────────────────────────────────────────────── */

.health-history-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
  overflow: hidden;
}

.health-history-card__header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid #eef2f7;
}

.health-history-card__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.health-history-scroll {
  overflow-x: auto;
}

.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.health-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #f8fafc;
  border-bottom: 1px solid #eef2f7;
  white-space: nowrap;
}

.health-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

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

.health-table__date {
  font-weight: 800;
  text-transform: capitalize;
}

.health-table__edit {
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: none;
}

/* ── Emoji picker ───────────────────────────────────────────────── */

.health-emoji-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.health-emoji-btn {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 22px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.health-emoji-btn:hover {
  transform: translateY(-2px);
  background: #f5f8ff;
  box-shadow: 0 8px 18px rgba(15,23,42,0.08);
}

.health-emoji-btn--active {
  border-color: #3d79c6;
  background: linear-gradient(180deg, #eef4fb 0%, #e5effa 100%);
  box-shadow: 0 0 0 3px rgba(61,121,198,0.15);
  transform: translateY(-1px);
}

/* ── Apple Health teaser ────────────────────────────────────────── */

.health-integration-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, #ffffff 0%, #fafbff 100%);
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
  padding: 20px;
  display: grid;
  gap: 16px;
  opacity: 0.88;
}

.health-integration-card__top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.health-integration-card__icon {
  font-size: 28px;
  flex: 0 0 auto;
}

.health-integration-card__title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.health-integration-card__sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.health-lock-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: #f3f0fb;
  border: 1px solid #d4c8f2;
  color: #5c3d9e;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}

.health-integration-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.health-integration-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #edf2f7;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
}

.health-integration-feature__icon {
  font-size: 18px;
  flex: 0 0 auto;
}

.health-integration-feature__label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.health-integration-feature__desc {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 1px;
}

.health-integration-card__note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .health-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-charts-grid {
    grid-template-columns: 1fr;
  }

  .health-chart-card,
  .health-chart-card--half {
    grid-column: span 1;
  }

  .health-integration-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .health-summary-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .health-stat-card__value {
    font-size: 18px;
  }

  .health-integration-features {
    grid-template-columns: 1fr;
  }

  .health-emoji-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .health-checkin-prompt {
    flex-direction: column;
    align-items: flex-start;
  }

  .health-checkin-prompt .button {
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   MODE NUIT — health module
   ══════════════════════════════════════════════════════════════════════════ */

body.dark-mode .health-stat-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

body.dark-mode .health-checkin-prompt {
  background: var(--surface-soft);
  border-color: var(--line);
}

body.dark-mode .health-today-card {
  background: var(--ok-bg);
  border-color: var(--ok);
}
body.dark-mode .health-today-card__title { color: var(--ok); }
body.dark-mode .health-today-chip {
  background: rgba(255,255,255,0.06);
  border-color: rgba(48, 209, 88, 0.3);
  color: var(--text);
}

body.dark-mode .health-insights-card,
body.dark-mode .health-chart-card,
body.dark-mode .apple-nodata {
  background: var(--surface-soft);
  border-color: var(--line);
}

body.dark-mode .health-goal-card,
body.dark-mode .health-readiness-card,
body.dark-mode .health-history-card,
body.dark-mode .health-integration-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

body.dark-mode .health-insight-row {
  background: var(--surface-soft);
  border-color: var(--line);
}

body.dark-mode .health-chart-card__badge {
  background: var(--primary-soft);
  color: var(--text);
  border-color: var(--line);
}
body.dark-mode .health-chart-card__badge--purple {
  background: #1e1245;
  color: #c4b5fd;
  border-color: #3d2a6e;
}

body.dark-mode .health-chart-card__footer {
  border-top-color: var(--line);
}

body.dark-mode .health-history-card__header {
  border-bottom-color: var(--line);
}

body.dark-mode .health-table th {
  background: var(--surface-soft);
  border-bottom-color: var(--line);
  color: var(--muted);
}
body.dark-mode .health-table td {
  border-bottom-color: var(--line);
  color: var(--text);
}

body.dark-mode .health-progress-track {
  background: var(--line);
}

body.dark-mode .health-readiness-chip {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

body.dark-mode .health-alert-card {
  background: #2a2010;
  border-color: #6b4a12;
}

body.dark-mode .health-alert-card .health-goal-card__title {
  color: #ffb86b;
}

body.dark-mode .health-emoji-btn {
  background: var(--surface-soft);
  border-color: var(--line);
}
body.dark-mode .health-emoji-btn:hover {
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
body.dark-mode .health-emoji-btn--active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(31,58,90,0.25);
}

body.dark-mode .health-lock-pill {
  background: #1e1245;
  border-color: #3d2a6e;
  color: #c4b5fd;
}

body.dark-mode .health-integration-feature {
  background: var(--surface-soft);
  border-color: var(--line);
}

body.dark-mode .health-integration-card__note {
  background: var(--surface-soft);
  border-color: var(--line);
}
