.history-caption {
  grid-column: 1 / -1;
  margin: .5rem 0 0;
  font-size: .875rem;
}

.day[data-status="future"],
#next:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.day[data-status="future"] .bar-track {
  visibility: hidden;
}

.day[data-status="met"]:not([aria-pressed="true"]) {
  background: var(--bg);
  border-color: var(--accent);
}

.day .goal-marker {
  height: 0;
  border-top: 2px dashed var(--ink);
  background: transparent;
}

main[data-page="historico"] { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.page-toolbar { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 8px; }
.page-toolbar h1 { flex: 1; min-width: 0; margin: 0; font-size: 28px; }
.back-link { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 14px; background: var(--card); font-size: 14px; font-weight: 600; }
.page-toolbar button { min-height: 48px; border: 0; background: transparent; font-size: 14px; }
.page-toolbar button:disabled { color: var(--muted); }
.history-segments { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: var(--card); border-radius: 18px; }
.history-segments button { min-height: 48px; border: 0; border-radius: 15px; background: transparent; font-weight: 600; }
.history-segments button[aria-pressed="true"] { background: var(--accent); color: var(--on); }
#page-historico .period { margin: 12px 0 4px; }
#page-historico .period h2 { font-size: 16px; }
#page-historico .period h2::first-letter { text-transform: uppercase; }
#page-historico .period button { width: 48px; height: 48px; border: 0; border-radius: 14px; font-size: 24px; padding: 0; background: var(--accent); color: var(--on); }
#page-historico .period button:disabled { background: transparent; color: var(--muted); }
#chart[data-mode="month"] { gap: 2px; }
#chart[data-mode="month"] > small { font-size: 12px; color: var(--muted); padding-bottom: 5px; }
#chart[data-mode="month"] .day { min-height: 48px; padding: 3px 0; border: 0; border-radius: 14px; font-size: 16px; font-weight: 600; background: var(--card); color: var(--ink); }
#chart[data-mode="month"] .day small { min-height: 16px; font-size: 14px; line-height: 16px; }
#chart[data-mode="month"] .day[data-status="empty"], #chart[data-mode="month"] .day[data-status="future"] { background: transparent; }
#chart[data-mode="month"] .day[data-status="future"] { color: var(--muted); }
#chart[data-mode="month"] .day[aria-pressed="true"] { background: var(--accent); color: var(--on); }
.history-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; margin-top: 10px; font-size: 12px; }
.history-detail { margin-top: 16px; padding: 14px 16px; border-radius: 18px; background: var(--card); }
.history-detail h2 { margin: 0 0 4px; font-size: 16px; }
.history-detail h2::first-letter { text-transform: uppercase; }
#detail-total { font-size: 24px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
#detail-summary { font-size: 13px; margin-bottom: 10px; }
#detail .record { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 4px; min-height: 56px; padding: 0; border-top: 1px solid var(--line); border-bottom: 0; }
#detail .record small { font-size: 12px; }
#detail .record strong { font-size: 14px; overflow-wrap: anywhere; }
#detail .actions { flex-wrap: nowrap; gap: 0; }
#detail button { width: 48px; height: 48px; padding: 13px; border: 0; background: transparent; }
#detail svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

#chart[data-mode="week"] { grid-template-columns: auto repeat(7, minmax(0, 1fr)); gap: 0; }
.week-axis { height: 168px; padding-right: 5px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: 11px; line-height: 22px; color: var(--muted); }
#chart[data-mode="week"] .day { display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--ink); border-radius: 0; font-weight: 400; }
#chart[data-mode="week"] .bar-track { position: relative; width: 100%; height: 146px; margin: 11px 0; border-radius: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: linear-gradient(to bottom, transparent calc(50% - .5px), var(--line) calc(50% - .5px), var(--line) calc(50% + .5px), transparent calc(50% + .5px)); }
#chart[data-mode="week"] .day[data-status="future"] .bar-track { visibility: visible; }
#chart[data-mode="week"] .bar { left: 22%; width: 56%; border-radius: 4px 4px 0 0; }
#chart[data-mode="week"] .day[aria-pressed="true"] .bar { background: var(--accent); }
#chart[data-mode="week"] .goal-marker { width: 100%; border-top-color: var(--ink); z-index: 1; }
.week-empty { position: absolute; left: 0; width: 100%; bottom: 3px; color: var(--muted); font-size: 14px; line-height: 16px; }
.week-tick { display: flex; align-items: center; justify-content: center; min-height: 44px; margin: 0 2px; border-radius: 14px; font-size: 14px; }
#chart[data-mode="week"] .day[aria-pressed="true"] .week-tick { background: var(--accent); color: var(--on); }
#chart[data-mode="week"] .day:disabled .week-tick { color: var(--muted); }
.week-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 8px; font-size: 12px; }
.week-legend span:first-child::first-letter { color: var(--water); }
#detail-total.compact { font-size: 16px; margin-bottom: 10px; }
