:root {
  color-scheme: light;
  --page: #f3f7f2;
  --page-deep: #e9f0e9;
  --surface: #ffffff;
  --surface-soft: #f7faf6;
  --ink: #12231b;
  --muted: #66756d;
  --line: #dce6de;
  --line-strong: #c7d5cb;
  --green: #157a4e;
  --green-bright: #20a66a;
  --green-soft: #dff4e8;
  --lime: #b8f35a;
  --navy: #061b3d;
  --navy-soft: #e8eef8;
  --amber: #ad6b12;
  --amber-soft: #fff2d7;
  --danger: #b34442;
  --danger-soft: #fbe8e7;
  --shadow: 0 16px 50px rgba(20, 48, 34, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html {
  min-width: 0;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(32, 166, 106, 0.1), transparent 36rem),
    linear-gradient(180deg, #f8fbf7 0, var(--page) 38rem, var(--page-deep) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(32, 166, 106, 0.3);
  outline-offset: 2px;
}

.fitness-root {
  min-height: 100vh;
}

.centered-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

.centered-screen > p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.loading-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  animation: lift 1.15s ease-in-out infinite;
}

.loading-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

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

@keyframes lift {
  0%, 100% { transform: translateY(3px) rotate(-2deg); }
  48% { transform: translateY(-5px) rotate(2deg); }
}

.login-card,
.error-card {
  width: min(100%, 420px);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  text-align: left;
}

.login-logo {
  width: 166px;
  max-width: 60%;
  height: auto;
  margin-bottom: 28px;
}

.login-card h1,
.error-card h1 {
  margin: 5px 0 8px;
  font-size: clamp(32px, 9vw, 46px);
  letter-spacing: -0.045em;
  line-height: 1;
}

.access-recovery-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.access-recovery-actions .button { min-height: 44px; text-align: center; text-decoration: none; }
.error-card h1:focus { outline: none; }

.login-copy,
.error-card > p:last-of-type {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.login-card label,
.quick-card label,
.composer-card > label {
  display: block;
  margin: 14px 0 7px;
  font-size: 0.82rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input {
  min-height: 48px;
  padding: 0 13px;
}

textarea {
  min-height: 108px;
  padding: 15px 16px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--green-bright);
  box-shadow: 0 0 0 4px rgba(32, 166, 106, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: #98a49d;
}

.button,
.icon-button,
.text-button,
.segment-button,
.metric-tab {
  min-height: 44px;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, opacity 120ms ease, background-color 120ms ease;
}

.button:hover,
.icon-button:hover,
.text-button:hover,
.segment-button:hover,
.metric-tab:hover {
  transform: translateY(-1px);
}

.button:disabled,
.icon-button:disabled,
.text-button:disabled {
  cursor: wait;
  opacity: 0.54;
  transform: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
}

.button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.button-primary {
  color: #fff;
  background: var(--green);
  box-shadow: 0 8px 22px rgba(21, 122, 78, 0.2);
}

.button-dark {
  color: #fff;
  background: var(--navy);
}

.button-full {
  width: 100%;
  margin-top: 20px;
}

.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.form-message[data-tone="error"] {
  color: var(--danger);
}

.form-message[data-tone="success"] {
  color: var(--green);
}

.error-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 50%;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 1.3rem;
  font-weight: 900;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right));
  border-bottom: 1px solid rgba(199, 213, 203, 0.82);
  background: rgba(248, 251, 247, 0.9);
  backdrop-filter: blur(16px);
}

.private-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.fitness-brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--green-bright), var(--green));
  box-shadow: 0 8px 18px rgba(21, 122, 78, 0.2);
}

.fitness-brand-mark svg,
.fitness-eyebrow svg,
.composer-card > label svg,
.quick-icon svg,
.report-mark svg,
.entry-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.fitness-brand-mark svg {
  width: 23px;
}

.brand-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-copy img {
  width: 132px;
  max-width: 38vw;
  height: auto;
}

.brand-copy strong {
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
  font-size: 0.9rem;
  font-weight: 900;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.agent-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a1aca5;
}

.agent-pill[data-state="online"] {
  color: var(--green);
  border-color: #bfe1cc;
  background: var(--green-soft);
}

.agent-pill[data-state="online"] .status-dot {
  background: var(--green-bright);
  box-shadow: 0 0 0 4px rgba(32, 166, 106, 0.12);
}

.agent-pill[data-state="offline"] {
  color: var(--amber);
  border-color: #eed5a7;
  background: var(--amber-soft);
}

.agent-pill[data-state="offline"] .status-dot {
  background: var(--amber);
}

.agent-pill[data-state="error"] {
  color: var(--danger);
  border-color: #e8c1bf;
  background: var(--danger-soft);
}

.agent-pill[data-state="error"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(179, 68, 66, 0.1);
}

.icon-button,
.text-button {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
}

.icon-button {
  width: 44px;
  padding: 0;
}

.icon-button svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button.is-loading svg {
  animation: spin 0.8s linear infinite;
}

.text-button {
  padding: 0 8px;
}

.page-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 max(36px, env(safe-area-inset-bottom));
}

.day-heading,
.section-heading,
.trend-header,
.card-heading,
.calorie-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.day-heading {
  align-items: flex-end;
  margin: 4px 1px 18px;
}

.eyebrow,
.metric-label {
  margin: 0;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.fitness-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fitness-eyebrow svg {
  width: 14px;
  height: 14px;
}

.day-heading h1,
.section-heading h2,
.trend-header h2,
.card-heading h2,
.report-card h2 {
  margin: 4px 0 0;
  letter-spacing: -0.035em;
}

.day-heading h1 {
  font-size: clamp(2.25rem, 11vw, 4rem);
  line-height: 0.95;
}

.section-heading h2,
.trend-header h2,
.card-heading h2 {
  font-size: clamp(1.3rem, 5vw, 1.75rem);
}

.date-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  text-align: right;
}

.status-bar {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.86rem;
  font-weight: 700;
}

.status-bar[data-tone="success"] {
  color: var(--green);
  border-color: #bfe1cc;
  background: var(--green-soft);
}

.status-bar[data-tone="error"] {
  color: var(--danger);
  border-color: #edc2c0;
  background: var(--danger-soft);
}

.status-bar[data-tone="warn"] {
  color: var(--amber);
  border-color: #eed5a7;
  background: var(--amber-soft);
}

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 34px rgba(20, 48, 34, 0.045);
}

.top-grid,
.dashboard-grid {
  display: grid;
  gap: 14px;
}

.composer-card,
.calorie-card,
.today-card,
.report-card,
.trend-card {
  padding: 19px;
}

.composer-card > label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  font-size: 1rem;
}

.composer-card > label svg {
  width: 19px;
  color: var(--green);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.composer-footer > span {
  color: var(--muted);
  font-size: 0.75rem;
}

.composer-footer .button {
  flex: 0 0 auto;
}

/* One short line under the composer; a failed log carries its Reintentar here. */
.processing-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 8px;
  padding: 2px 2px 2px 12px;
  border: 1px solid #c5e5d1;
  border-radius: 12px;
  color: var(--green);
  background: linear-gradient(110deg, #edf9f1 8%, #fff 48%, #edf9f1 92%);
  background-size: 220% 100%;
  animation: processing-sheen 2.2s linear infinite;
}

.processing-strip strong {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.3;
}

.processing-dots {
  display: inline-flex;
  gap: 3px;
}

.processing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green-bright);
  animation: processing-dot 1s ease-in-out infinite;
}

.processing-dots i:nth-child(2) { animation-delay: 120ms; }
.processing-dots i:nth-child(3) { animation-delay: 240ms; }

.processing-strip[data-phase="failed"] {
  color: #7a4a12;
  border-color: #eed5a7;
  background: #fff7e7;
  animation: none;
}

.processing-strip[data-phase="failed"] .processing-dots {
  display: none;
}

.processing-retry {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #d8b474;
  border-radius: 10px;
  color: #6b3d0c;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.processing-retry:disabled {
  opacity: 0.55;
  cursor: default;
}

@keyframes processing-sheen {
  to { background-position: -220% 0; }
}

@keyframes processing-dot {
  0%, 65%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.calorie-card {
  position: relative;
  overflow: hidden;
  color: #fff;
  border-color: transparent;
  background: var(--navy);
  box-shadow: 0 18px 40px rgba(6, 27, 61, 0.18);
}

.calorie-card::after {
  content: "";
  position: absolute;
  right: -74px;
  bottom: -86px;
  width: 190px;
  height: 190px;
  border: 38px solid rgba(255, 255, 255, 0.045);
  border-radius: 50%;
  pointer-events: none;
}

.calorie-card[data-tone="over"] {
  background: #412522;
}

.calorie-card[data-tone="near"] {
  background: #3b301a;
}

.calorie-card .metric-label {
  color: #9fd9bb;
}

.calorie-value {
  margin: 7px 0 0;
  font-size: clamp(2.7rem, 14vw, 4.6rem);
  font-weight: 950;
  letter-spacing: -0.065em;
  line-height: 0.9;
}

.pending-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 900;
  white-space: nowrap;
}

.pending-pill {
  color: #fff4ce;
  background: rgba(255, 209, 92, 0.15);
}

.pending-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #ffd571;
  animation: pending-pulse 1.25s ease-out infinite;
}

@keyframes pending-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 213, 113, 0.42); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(255, 213, 113, 0); }
}

.calorie-target {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  font-weight: 750;
}

.metric-progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e5ece6;
  accent-color: var(--green-bright);
}

.metric-progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #e5ece6;
}

.metric-progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--green-bright);
}

.metric-progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--green-bright);
}

.calorie-progress {
  position: relative;
  z-index: 1;
  height: 12px;
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.14);
}

.calorie-progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.14);
}

.calorie-progress::-webkit-progress-value {
  background: #65e0a2;
}

.calorie-progress::-moz-progress-bar {
  background: #65e0a2;
}

.calorie-card[data-tone="near"] .calorie-progress::-webkit-progress-value,
.calorie-card[data-tone="over"] .calorie-progress::-webkit-progress-value {
  background: #ffd571;
}

.calorie-card[data-tone="near"] .calorie-progress::-moz-progress-bar,
.calorie-card[data-tone="over"] .calorie-progress::-moz-progress-bar {
  background: #ffd571;
}

.calorie-details {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  margin-top: 14px;
}

.calorie-details p,
.estimate-note {
  margin: 0;
}

.calorie-details p:first-child {
  font-weight: 850;
}

.calorie-details p:last-child,
.estimate-note {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.8rem;
  line-height: 1.4;
}

.estimate-note {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.section-block {
  margin-top: 28px;
}

.compact-heading {
  margin-bottom: 12px;
}

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

.quick-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
}

.quick-card-wide {
  grid-column: 1 / -1;
}

.quick-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
}

.quick-icon svg {
  width: 23px;
  height: 23px;
}

.quick-icon-cardio {
  color: #315fa0;
  background: #e8eff9;
}

.quick-icon-steps {
  color: #8a5a0b;
  background: #fff2d7;
}

.quick-icon-measurements {
  color: #8a5a0b;
  background: #fff2d7;
}

.measurement-height {
  margin-top: 10px;
}

.quick-title div {
  min-width: 0;
}

.quick-title strong,
.quick-title small {
  display: block;
}

.quick-title strong {
  font-size: 0.96rem;
}

.quick-title small {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-card label {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.7rem;
}

.quick-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.quick-input-row input {
  min-width: 0;
}

.dashboard-grid {
  margin-top: 28px;
}

.today-metrics {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.today-row-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.today-row-heading span {
  color: var(--muted);
  font-weight: 750;
}

.today-row-heading strong {
  text-align: right;
}

.today-row small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.74rem;
}

.workout-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-top: 4px;
}

.workout-summary > span {
  min-width: 0;
  padding: 12px 8px;
  border-radius: 14px;
  background: var(--surface-soft);
  text-align: center;
}

.workout-summary strong,
.workout-summary small {
  display: block;
}

.workout-summary strong {
  font-size: 1.05rem;
}

.workout-summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.report-card {
  position: relative;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg, #0e3a2a, #146848);
  box-shadow: 0 16px 40px rgba(14, 58, 42, 0.16);
}

.report-card.is-processing::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg, transparent 25%, rgba(255, 255, 255, 0.07) 48%, transparent 72%);
  background-size: 220% 100%;
  pointer-events: none;
  animation: processing-sheen 2.2s linear infinite;
}

.report-card .eyebrow {
  color: #a7e2c4;
}

.report-card h2 {
  max-width: 28ch;
  margin-top: 13px;
  font-size: clamp(1.35rem, 6vw, 2rem);
  line-height: 1.2;
}

.report-mark {
  position: absolute;
  top: 17px;
  right: 18px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #bff2d5;
  background: rgba(255, 255, 255, 0.1);
}

.report-mark svg {
  width: 20px;
}

.report-actions {
  display: grid;
  gap: 9px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.report-actions li {
  position: relative;
  padding-left: 20px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  line-height: 1.45;
}

.report-actions li::before {
  content: "";
  position: absolute;
  top: 0.53em;
  left: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #65e0a2;
}

.report-meta {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.75rem;
}

.trend-card {
  margin-top: 14px;
}

.trend-header {
  align-items: center;
}

.segmented,
.metric-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 13px;
  background: #edf2ed;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, auto);
}

.segment-button,
.metric-tab {
  min-height: 38px;
  padding: 0 11px;
  color: var(--muted);
  background: transparent;
  font-size: 0.77rem;
}

.segment-button.is-active,
.metric-tab.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 12px rgba(20, 48, 34, 0.08);
}

.metric-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
}

.chart-legend {
  min-height: 25px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 13px;
  height: 7px;
  border-radius: 999px;
  background: var(--green-bright);
}

.legend-swatch.range {
  background: #b9dbc7;
}

.legend-swatch.target {
  height: 2px;
  background: #8c9a91;
}

.legend-swatch.cardio {
  background: #406dad;
}

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

.trend-chart {
  width: 100%;
  height: auto;
  min-height: 220px;
  display: block;
}

.chart-grid {
  stroke: #e5ebe6;
  stroke-width: 1;
}

.chart-target {
  stroke: #8c9a91;
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
}

.chart-range {
  fill: #b9dbc7;
}

.chart-bar,
.chart-point {
  fill: var(--green-bright);
}

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.chart-stack-weights {
  fill: var(--green-bright);
}

.chart-stack-cardio {
  fill: #406dad;
}

.chart-axis-label,
.chart-date-label,
.chart-target-label {
  fill: #748078;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
}

.chart-date-label {
  text-anchor: middle;
}

.chart-axis-label {
  text-anchor: end;
}

.chart-target-label {
  font-size: 10px;
  font-weight: 800;
}

.chart-missing {
  fill: #aeb8b1;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  text-anchor: middle;
}

.empty-copy,
.empty-state {
  margin: 14px 0 0;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
  font-size: 0.86rem;
}

.entries-section {
  margin-top: 30px;
}

.count-pill {
  min-width: 31px;
  color: var(--green);
  background: var(--green-soft);
}

.entry-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.entry-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.92);
}

.entry-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--green);
}

.entry-icon svg {
  width: 23px;
  height: 23px;
}

.entry-icon[data-kind="cardio"] {
  color: #315fa0;
  background: #e8eff9;
}

.entry-icon[data-kind="steps"] {
  color: #8a5a0b;
  background: #fff2d7;
}

.entry-icon[data-kind="weight"] {
  color: #7252a2;
  background: #f0eafa;
}

.entry-icon[data-kind="correction"] {
  color: var(--muted);
}

.entry-main {
  min-width: 0;
}

.entry-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.entry-title {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.93rem;
  font-weight: 850;
  line-height: 1.35;
}

.entry-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.entry-analysis {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
}

.entry-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #edf2ed;
  font-size: 0.66rem;
  font-weight: 900;
}

.entry-status[data-tone="pending"] {
  color: var(--amber);
  background: var(--amber-soft);
}

.entry-status[data-tone="pending"]::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pending-pulse 1.25s ease-out infinite;
}

.entry-status[data-tone="success"] {
  color: var(--green);
  background: var(--green-soft);
}

.entry-status[data-tone="danger"] {
  color: var(--danger);
  background: var(--danger-soft);
}

.entry-estimate {
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 850;
  text-align: right;
}

.entry-confidence {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--muted);
  background: #edf2ed;
  font-size: 0.62rem;
  font-weight: 850;
}

.entry-confidence[data-tone="high"] {
  color: var(--green);
  background: var(--green-soft);
}

.entry-confidence[data-tone="low"] {
  color: var(--amber);
  background: var(--amber-soft);
}

.private-footer {
  padding: 28px 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

@media (min-width: 520px) {
  .quick-input-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .quick-card-wide {
    grid-column: auto;
  }

  .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 760px) {
  .app-header {
    padding-right: 28px;
    padding-left: 28px;
  }

  .page-shell {
    width: min(1120px, calc(100% - 48px));
    padding-top: 34px;
  }

  .composer-card,
  .calorie-card,
  .today-card,
  .report-card,
  .trend-card {
    padding: 24px;
  }

  .top-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  }

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

  .entry-item {
    padding: 16px;
  }
}

@media (max-width: 560px) {
  body {
    background:
      radial-gradient(circle at 0 0, rgba(32, 166, 106, 0.09), transparent 21rem),
      linear-gradient(180deg, #f8fbf7 0, var(--page) 28rem, var(--page-deep) 100%);
  }

  .app-header {
    min-height: 54px;
    gap: 7px;
    padding: 7px max(9px, env(safe-area-inset-left)) 7px max(9px, env(safe-area-inset-right));
  }

  .fitness-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .fitness-brand-mark svg {
    width: 21px;
  }

  .brand-copy img {
    display: none;
  }

  .brand-copy strong {
    padding: 0;
    border: 0;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
  }

  .private-brand {
    min-height: 44px;
  }

  .header-actions {
    gap: 2px;
  }

  .agent-pill {
    width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }

  .agent-pill #agentLabel {
    font-size: 0;
  }

  .agent-pill #agentLabel::after {
    content: "PC";
    font-size: 0.68rem;
  }

  .private-brand span {
    flex-shrink: 0;
  }

  .text-button {
    min-height: 44px;
    padding: 0 5px;
    font-size: 0.78rem;
  }

  .icon-button {
    width: 44px;
    min-height: 44px;
  }

  .page-shell {
    width: min(100% - 16px, 1120px);
    padding: 10px 0 max(24px, env(safe-area-inset-bottom));
  }

  .day-heading {
    min-height: 48px;
    align-items: center;
    margin: 0 2px 8px;
  }

  .eyebrow,
  .metric-label {
    font-size: 0.62rem;
    letter-spacing: 0.09em;
  }

  .day-heading h1 {
    margin-top: 2px;
    font-size: 2.25rem;
  }

  .date-label {
    max-width: 14ch;
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .status-bar {
    margin-bottom: 8px;
    padding: 9px 11px;
    border-radius: 12px;
    font-size: 0.76rem;
  }

  .top-grid,
  .dashboard-grid {
    gap: 8px;
  }

  .card {
    border-radius: 16px;
    box-shadow: 0 7px 24px rgba(20, 48, 34, 0.04);
  }

  .composer-card,
  .calorie-card,
  .today-card,
  .report-card,
  .trend-card {
    padding: 12px;
  }

  .composer-card > label {
    gap: 6px;
    margin-bottom: 7px;
    font-size: 0.86rem;
  }

  .composer-card > label svg {
    width: 17px;
  }

  textarea {
    min-height: 82px;
    max-height: 145px;
    padding: 11px 12px;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.35;
  }

  .composer-footer {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    margin-top: 8px;
  }

  .composer-footer > span {
    min-width: 0;
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .composer-footer .button {
    min-width: 116px;
    min-height: 44px;
    padding: 0 13px;
  }

  .form-message {
    min-height: 0;
    margin-top: 7px;
    font-size: 0.72rem;
  }

  .form-message:empty {
    display: none;
  }

  .calorie-card::after {
    right: -66px;
    bottom: -90px;
    width: 170px;
    height: 170px;
  }

  .calorie-value {
    margin-top: 4px;
    font-size: 2.35rem;
  }

  .pending-pill {
    min-height: 26px;
    padding: 0 8px;
    font-size: 0.65rem;
  }

  .calorie-target {
    margin-top: 7px;
    font-size: 0.72rem;
  }

  .calorie-progress {
    height: 9px;
    margin-top: 10px;
  }

  .calorie-details {
    gap: 2px;
    margin-top: 9px;
    font-size: 0.76rem;
  }

  .calorie-details p:last-child {
    font-size: 0.69rem;
  }

  .estimate-note {
    display: none;
  }

  .section-block,
  .dashboard-grid,
  .entries-section {
    margin-top: 16px;
  }

  .compact-heading {
    margin: 0 2px 8px;
  }

  .section-heading h2,
  .trend-header h2,
  .card-heading h2 {
    margin-top: 2px;
    font-size: 1.14rem;
  }

  .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .quick-card,
  .quick-card-wide {
    grid-column: auto;
    padding: 8px;
    border-radius: 14px;
  }

  .quick-title {
    display: block;
  }

  .quick-icon {
    width: 31px;
    height: 31px;
    border-radius: 9px;
  }

  .quick-icon svg {
    width: 19px;
    height: 19px;
  }

  .quick-title strong {
    margin-top: 5px;
    font-size: 0.8rem;
  }

  .quick-title small {
    min-height: 20px;
    margin-top: 1px;
    overflow: hidden;
    font-size: 0.66rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .quick-card label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .quick-input-row {
    gap: 5px;
    margin-top: 6px;
  }

  .quick-input-row input {
    min-height: 44px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 1rem;
    text-align: center;
  }

  .quick-input-row .button {
    min-height: 44px;
    gap: 4px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 0.75rem;
  }

  .quick-input-row .button svg {
    width: 14px;
  }

  .today-metrics {
    gap: 12px;
    margin-top: 13px;
  }

  .today-row-heading {
    margin-bottom: 6px;
    font-size: 0.79rem;
  }

  .metric-progress {
    height: 8px;
  }

  .today-row small {
    margin-top: 4px;
    font-size: 0.66rem;
  }

  .workout-summary {
    gap: 5px;
  }

  .workout-summary > span {
    padding: 9px 5px;
    border-radius: 11px;
  }

  .workout-summary strong {
    font-size: 0.88rem;
  }

  .report-mark {
    top: 11px;
    right: 11px;
    width: 32px;
    height: 32px;
  }

  .report-card h2 {
    max-width: calc(100% - 28px);
    margin-top: 8px;
    font-size: 1.12rem;
    line-height: 1.18;
  }

  .report-actions {
    gap: 6px;
    margin-top: 11px;
  }

  .report-actions li {
    padding-left: 16px;
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .report-actions li::before {
    width: 6px;
    height: 6px;
  }

  .report-meta {
    margin-top: 11px;
    padding-top: 8px;
    font-size: 0.64rem;
  }

  .trend-card {
    margin-top: 8px;
  }

  .trend-header {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .trend-header > div:first-child {
    min-width: 0;
  }

  .segmented {
    flex: 0 0 auto;
    align-self: auto;
    grid-template-columns: repeat(3, auto);
    padding: 2px;
    border-radius: 10px;
  }

  .segment-button,
  .metric-tab {
    min-height: 44px;
    padding: 0 8px;
    border-radius: 9px;
    font-size: 0.72rem;
  }

  .segment-button {
    min-width: 44px;
  }

  .metric-tabs {
    margin-top: 10px;
    padding: 2px;
  }

  .chart-legend {
    min-height: 20px;
    gap: 10px;
    margin-top: 8px;
    font-size: 0.68rem;
  }

  .trend-chart {
    min-height: 185px;
  }

  .empty-copy,
  .empty-state {
    margin-top: 9px;
    padding: 17px 12px;
    border-radius: 13px;
    font-size: 0.75rem;
  }

  .section-heading {
    align-items: center;
  }

  .entry-list {
    gap: 6px;
    margin-top: 9px;
  }

  .entry-item {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
    border-radius: 13px;
  }

  .entry-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .entry-icon svg {
    width: 20px;
    height: 20px;
  }

  .entry-topline {
    gap: 7px;
  }

  .entry-title {
    font-size: 0.84rem;
    line-height: 1.28;
  }

  .entry-time {
    font-size: 0.68rem;
  }

  .entry-analysis {
    margin-top: 4px;
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .entry-footer {
    margin-top: 6px;
  }

  .entry-status {
    min-height: 22px;
    font-size: 0.65rem;
  }

  .entry-estimate {
    font-size: 0.72rem;
  }

  .private-footer {
    padding-top: 20px;
    font-size: 0.68rem;
  }
}

@media (max-width: 370px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
  }

  .app-header {
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand-copy strong {
    display: none;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .quick-card-wide {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Fitness v3: captura progresiva, estado del día y progreso accionable. */
select {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 1rem;
}

select:focus-visible,
dialog button:focus-visible {
  outline: 3px solid rgba(32, 166, 106, 0.3);
  outline-offset: 2px;
}

.button-secondary {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
}

.day-picker-wrap {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.day-picker {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: #e8efe9;
}

.day-picker-button {
  min-width: 58px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 850;
}

.day-picker-button.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 10px rgba(20, 48, 34, 0.08);
}

.day-state-bar {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 9px 8px 13px;
  border: 1px solid #d9e5dc;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.78);
}

.day-state-bar > div,
.day-state-bar > div > span:last-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.day-state-bar > div > span:last-child {
  display: grid;
  gap: 1px;
}

.day-state-bar strong,
.day-state-bar small {
  display: block;
}

.day-state-bar strong {
  font-size: 0.8rem;
}

.day-state-bar small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
}

.day-state-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 5px var(--amber-soft);
}

.day-state-bar[data-state="closed"] {
  border-color: #bcdcc9;
  background: #eff9f3;
}

.day-state-bar[data-state="closed"] .day-state-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px var(--green-soft);
}

.day-state-button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--green);
  border: 1px solid #bad9c6;
  background: #fff;
  font-size: 0.72rem;
}

.quick-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-icon-weight {
  color: #7252a2;
  background: #f0eafa;
}

.input-with-unit {
  position: relative;
  min-width: 0;
}

.input-with-unit input {
  width: 100%;
  padding-right: 43px;
}

.input-with-unit > span {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 0.66rem;
  font-weight: 850;
}

.quality-label {
  display: block;
}

.compact-select {
  min-height: 40px;
  margin-top: 5px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.quality-help {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.25;
}

.quick-details {
  margin-top: 9px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.quick-details summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--green);
  cursor: pointer;
  list-style: none;
  font-size: 0.7rem;
  font-weight: 850;
}

.quick-details summary::-webkit-details-marker {
  display: none;
}

.quick-details summary::after {
  content: "+";
  font-size: 1rem;
}

.quick-details[open] summary::after {
  content: "−";
}

.quick-details summary span {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 700;
}

.quick-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  padding-top: 6px;
}

.quick-detail-grid label {
  margin: 5px 0 0;
}

.quick-detail-grid select,
.quick-detail-grid input {
  min-height: 44px;
  font-size: 1rem;
}

.quick-card.is-locked {
  opacity: 0.58;
}

.today-highlight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
}

.today-highlight-row > span:first-child {
  display: grid;
  gap: 2px;
}

.today-highlight-row small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.66rem;
}

.today-highlight-row strong {
  color: #fff;
  font-size: 1rem;
}

.quality-badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #dbe7df;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.63rem;
  font-weight: 850;
}

.quality-badge[data-tone="clean"] {
  color: #d8ffea;
  background: rgba(32, 166, 106, 0.28);
}

.action-reason {
  max-width: 45ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.latest-analysis {
  margin-top: 15px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.latest-analysis > summary {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.latest-analysis > summary::-webkit-details-marker { display: none; }

.latest-analysis > summary::after {
  content: "Ver";
  color: var(--green);
  font-size: 0.66rem;
  font-weight: 900;
}

.latest-analysis[open] > summary::after { content: "Ocultar"; }

.latest-analysis > summary > span {
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.latest-analysis > p {
  margin: 5px 0 0;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.latest-analysis .report-actions {
  margin-top: 8px;
}

.metric-tabs {
  grid-template-columns: repeat(5, 1fr);
}

.metric-tab {
  min-width: 0;
  padding: 0 7px;
}

.chart-insight-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.chart-insight-row strong {
  min-width: 0;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.3;
}

.coverage-pill {
  flex: 0 0 auto;
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 0.65rem;
  font-weight: 900;
}

.legend-swatch.trend {
  height: 3px;
  background: var(--navy);
}

.legend-swatch.clean {
  width: 9px;
  height: 9px;
  background: var(--green);
}

.legend-swatch.unknown {
  width: 9px;
  height: 9px;
  border: 2px solid #9aa69e;
  background: transparent;
}

.chart-weight-line {
  stroke: var(--navy);
}

.chart-weight-point {
  fill: #fff;
  stroke: #929f97;
  stroke-width: 2;
}

.chart-weight-clean {
  fill: var(--green-bright);
  stroke: var(--green);
}

.chart-weight-semi {
  fill: #fff2d7;
  stroke: var(--amber);
}

.chart-hit {
  fill: transparent;
  cursor: pointer;
}

.chart-hit:focus {
  outline: none;
  fill: rgba(32, 166, 106, 0.06);
}

.chart-wrap {
  position: relative;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  width: min(230px, calc(100% - 16px));
  transform: translate(-50%, -105%);
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 28px rgba(20, 48, 34, 0.14);
  pointer-events: none;
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.35;
}

.entry-item.is-inactive {
  opacity: 0.62;
  background: #f4f6f4;
}

.entry-item.is-inactive .entry-title {
  text-decoration: line-through;
}

.entry-details {
  margin: 5px 0 0;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
}

.entry-actions {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.entry-action {
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--green);
  background: #fff;
  font-size: 0.68rem;
  font-weight: 850;
}

.entry-action-danger {
  color: var(--danger);
}

.entry-retry-analysis {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 7px;
  background: var(--green-soft, #e5f3eb);
  font-size: .75rem;
}
.entry-retry-analysis svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.action-toast {
  position: fixed;
  z-index: 100;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: auto;
  max-width: min(430px, calc(100% - 28px));
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: 15px;
  color: #fff;
  background: var(--navy);
  box-shadow: 0 16px 45px rgba(6, 27, 61, 0.28);
}

.action-toast > span {
  min-width: 0;
  flex: 1;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.3;
}

.action-toast button {
  min-height: 38px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--lime);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 900;
}

.action-toast .toast-close {
  width: 38px;
  padding: 0;
  color: #fff;
  font-size: 1.1rem;
}

.app-dialog {
  width: min(520px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(760px, calc(100dvh - 24px));
  margin: auto;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(6, 27, 61, 0.24);
}

.app-dialog::backdrop {
  background: rgba(6, 27, 61, 0.48);
  backdrop-filter: blur(4px);
}

.app-dialog > form {
  padding: 22px;
}

.app-dialog h2 {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-size: 1.35rem;
  line-height: 1.15;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dialog-close {
  width: 44px;
  min-height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 1.25rem;
}

.dialog-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 13px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--green-bright), var(--green));
}

.dialog-mark svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.consent-dialog p:not(.eyebrow):not(.form-message) {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.consent-dialog p.consent-update:not(.eyebrow) {
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef7e2;
  color: #1f4a2c;
  font-weight: 700;
}

.consent-check {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  margin-top: 18px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.35;
}

.consent-check input {
  width: 22px;
  min-height: 22px;
  margin: 0;
}

.privacy-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
}

.correction-fields,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.correction-field,
.settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.correction-field:has(textarea),
.settings-wide {
  grid-column: 1 / -1;
}

.correction-field input,
.correction-field textarea,
.settings-grid input,
.settings-grid select {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
}

.correction-field textarea {
  min-height: 112px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

@media (max-width: 760px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-card.is-expanded {
    grid-column: 1 / -1;
  }

  .quick-card.is-expanded .quick-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
  }
}

@media (max-width: 560px) {
  .app-header {
    padding-top: max(7px, env(safe-area-inset-top));
  }

  .agent-pill {
    width: auto;
    min-width: 44px;
    padding: 0 8px;
  }

  .agent-pill #agentLabel {
    font-size: 0.66rem;
  }

  .agent-pill #agentLabel::after {
    content: none;
  }

  .day-heading {
    gap: 8px;
  }

  .day-heading h1 {
    font-size: 1.9rem;
  }

  .day-picker-wrap {
    gap: 2px;
  }

  .day-picker-button {
    min-width: 50px;
    min-height: 36px;
    padding: 0 7px;
    font-size: 0.7rem;
  }

  .date-label {
    max-width: none;
    font-size: 0.64rem;
  }

  .day-state-bar {
    margin-bottom: 8px;
  }

  .day-state-bar small {
    max-width: 25ch;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .quick-card,
  .quick-card-wide {
    grid-column: auto;
    padding: 9px;
  }

  .quick-card.is-expanded {
    grid-column: 1 / -1;
  }

  .quick-input-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .quick-input-row .button {
    width: 44px;
    padding: 0;
  }

  .quick-input-row .button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .quick-card .quality-label,
  .quick-card .quick-detail-grid label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 7px 0 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .quality-label {
    font-size: 0.63rem !important;
  }

  .compact-select {
    min-height: 40px;
    font-size: 1rem;
  }

  .quick-details summary {
    min-height: 38px;
  }

  .metric-tabs {
    gap: 1px;
  }

  .metric-tab {
    padding: 0 3px;
    font-size: 0.64rem;
  }

  .chart-insight-row {
    align-items: flex-start;
  }

  .chart-insight-row strong {
    font-size: 0.72rem;
  }

  .coverage-pill {
    font-size: 0.61rem;
  }

  .chart-legend {
    gap: 8px;
  }

  .entry-actions {
    margin-top: 6px;
  }

  .entry-action {
    min-height: 38px;
  }

  .action-toast {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    max-width: none;
  }

  .app-dialog {
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 16px);
    overflow-x: hidden;
    border-radius: 18px;
  }

  .app-dialog > form {
    padding: 16px;
  }

  .app-dialog h2 {
    font-size: 1.2rem;
  }

  .correction-fields,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .correction-field:has(textarea),
  .settings-wide {
    grid-column: auto;
  }
}

@media (max-width: 370px) {
  .agent-pill {
    width: 44px;
    padding: 0;
  }

  .agent-pill #agentLabel {
    font-size: 0;
  }

  .agent-pill #agentLabel::after {
    content: "OK";
    font-size: 0.64rem;
  }

  .day-state-bar small {
    display: none;
  }

  .day-state-button {
    min-height: 40px;
  }

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

  .quick-card,
  .quick-card-wide {
    grid-column: auto;
  }

  .quick-card.is-expanded {
    grid-column: 1 / -1;
  }

  .quick-title small {
    min-height: 24px;
  }

  .metric-tab {
    font-size: 0.6rem;
  }
}

@media (max-width: 560px) {
  .agent-pill[data-state="error"] #agentLabel::after {
    content: "Error";
  }
}

/* Fitness V4: registro-first, resumen compacto y progreso gamificado. */
.profile-summary {
  min-width: 190px;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 9px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.profile-summary:hover {
  border-color: #b9d9c5;
  box-shadow: 0 7px 20px rgba(20, 48, 34, 0.08);
}

.profile-summary:active {
  transform: scale(0.985);
}

.profile-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  overflow: hidden;
  border: 2px solid #d6eadf;
  border-radius: 13px;
  background: linear-gradient(145deg, #eff9f3, #dbece2);
}

.profile-avatar {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 22%;
  transform: scale(1.12);
  transform-origin: 50% 20%;
}

.profile-sync {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #a1aca5;
}

.profile-sync .status-dot {
  width: 100%;
  height: 100%;
  background: transparent;
}

.profile-sync[data-state="online"] { background: var(--green-bright); }
.profile-sync[data-state="offline"] { background: var(--amber); }
.profile-sync[data-state="error"] { background: var(--danger); box-shadow: 0 0 0 3px rgba(179, 68, 66, 0.15); }
.profile-sync[data-state="checking"] { animation: pending-pulse 1.25s ease-out infinite; }
.profile-summary[data-sync-state="error"] { border-color: #e8b8b6; }

.profile-copy {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 1px;
}

.profile-copy > strong {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 920;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-score {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.profile-score b {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
}

.profile-score small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 750;
  text-overflow: ellipsis;
}

.profile-progress-track {
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe9e1;
}

.profile-progress-track i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-bright), #8ad83e);
  transition: width 300ms ease;
}

.profile-streak {
  min-width: 26px;
  padding: 3px 5px;
  border-radius: 8px;
  color: #81500b;
  background: var(--amber-soft);
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
}

@keyframes points-earned {
  0%, 100% { transform: scale(1); box-shadow: none; }
  35% { transform: scale(1.04); box-shadow: 0 0 0 7px rgba(184, 243, 90, 0.24); }
}

.profile-summary.points-earned {
  animation: points-earned 750ms ease;
}

.entry-digest {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.top-grid {
  align-items: start;
}

.day-heading h1 {
  font-size: clamp(2.4rem, 5vw, 3.3rem);
}

.entry-digest-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.entry-digest-heading > span {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.entry-digest-heading strong {
  font-size: 0.7rem;
}

.entry-digest-heading small {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 750;
}

.entry-digest-heading a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  color: var(--green);
  font-size: 0.63rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.entry-digest-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 5px;
  padding: 1px 1px 4px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.entry-digest-row {
  min-width: min(178px, 68vw);
  min-height: 38px;
  display: grid;
  grid-template-columns: 21px minmax(64px, 1fr) auto;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface-soft);
  text-decoration: none;
  scroll-snap-align: start;
}

.entry-digest-icon {
  font-size: 0.8rem;
  text-align: center;
}

.entry-digest-name {
  overflow: hidden;
  font-size: 0.65rem;
  font-weight: 780;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-digest-value {
  display: grid;
  justify-items: end;
  line-height: 1.1;
  white-space: nowrap;
}

.entry-digest-value strong { font-size: 0.64rem; }
.entry-digest-value small { margin-top: 2px; color: var(--muted); font-size: 0.53rem; font-weight: 750; }

.today-overview-card {
  padding: 15px;
}

.today-overview-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.today-overview-heading h2 {
  margin: 2px 0 0;
  font-size: 1.15rem;
  letter-spacing: -0.035em;
}

.target-edit-button {
  width: 44px;
  min-height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #d9f7e6;
  background: rgba(255, 255, 255, 0.09);
  cursor: pointer;
}

.today-overview-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.day-state-inline {
  display: flex;
  flex: 0 0 auto;
}

.today-overview-card .day-state-button {
  min-height: 44px;
  padding: 0 10px;
  border-color: rgba(255, 255, 255, 0.22);
  color: #e7fff1;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.7rem;
  white-space: nowrap;
}

.today-overview-card .day-state-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.day-state-inline[data-state="closed"] .day-state-button {
  border-color: #bde9cf;
  color: #0a3d29;
  background: #dff8e9;
}

.quick-card .weight-quality-inline {
  position: static;
  width: 64px;
  min-width: 64px;
  height: 44px;
  display: block;
  margin: 0;
  padding: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border: 0;
}

.weight-quality-inline select {
  width: 64px;
  min-height: 44px;
  margin: 0;
  padding: 0 20px 0 6px;
  border-radius: 9px;
  background-color: var(--surface-soft);
  font-size: 1rem;
  font-weight: 850;
}

.edit-pencil {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.target-edit-button .edit-pencil {
  width: 18px;
  height: 18px;
}

.calorie-heading {
  position: relative;
  z-index: 1;
  align-items: center;
}

.calorie-value {
  margin-top: 3px;
  font-size: clamp(2rem, 4vw, 2.55rem);
  line-height: 0.96;
  white-space: nowrap;
}

.calorie-value small {
  margin-left: 5px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.02em;
}

.calorie-score {
  display: grid;
  justify-items: end;
  gap: 1px;
}

.calorie-score > strong {
  font-size: 1.15rem;
  font-weight: 950;
}

.target-link {
  min-height: 30px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: inherit;
  background: transparent;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.target-link .target-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-link .edit-pencil {
  opacity: 0.72;
}

.target-link:hover .edit-pencil,
.target-link:focus-visible .edit-pencil {
  opacity: 1;
}

.calorie-target.target-link {
  min-height: 30px;
  justify-content: flex-end;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.65rem;
}

.calorie-progress {
  margin-top: 7px;
}

.compact-calorie-details {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.compact-calorie-details p {
  margin: 0;
  font-size: 0.65rem !important;
  white-space: nowrap;
}

.compact-calorie-details p:last-child {
  text-align: right;
}

.compact-today-metrics {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  margin-top: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.today-stat {
  min-width: 0;
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  align-items: center;
  gap: 1px 4px;
  padding: 5px 8px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: transparent;
}

.today-stat:nth-child(3n) { border-right: 0; }
.today-stat:nth-child(n + 4) { border-bottom: 0; }

.today-stat > span {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.63rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-stat > strong {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-stat > small,
.today-stat > .target-link,
.today-stat > .quality-badge {
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: 28px;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.62);
  background: transparent;
  font-size: 0.63rem;
  font-weight: 720;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-stat > .target-link {
  width: fit-content;
  min-width: 0;
}

.today-stat-protein > .target-link,
.today-stat-steps > .target-link {
  grid-row: 3;
}

.today-stat > .quality-badge {
  padding: 0;
}

.today-stat .metric-progress {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 4px;
  margin: 1px 0;
  background: rgba(255, 255, 255, 0.16);
}

.today-stat .metric-progress::-webkit-progress-bar { background: rgba(255, 255, 255, 0.16); }
.today-stat .metric-progress::-webkit-progress-value { background: var(--lime); }
.today-stat .metric-progress::-moz-progress-bar { background: var(--lime); }

.dashboard-grid-report {
  grid-template-columns: 1fr;
  margin-top: 14px;
}

.dashboard-grid-report .report-card h2 {
  max-width: 48ch;
  margin-top: 7px;
  font-size: 1.25rem;
}

.dashboard-grid-report .action-reason,
.dashboard-grid-report .report-meta {
  margin-top: 8px;
}

.report-card .action-reason {
  color: rgba(255, 255, 255, 0.78);
}

.report-card .latest-analysis {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
}

.report-card .latest-analysis .report-actions li {
  color: var(--muted);
}

.report-card .latest-analysis .report-actions li::before {
  background: var(--green-bright);
}

.entry-item {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.entry-impact {
  min-width: 88px;
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 3px;
  text-align: right;
}

.entry-impact-kcal {
  font-size: 0.78rem;
  font-weight: 950;
  white-space: nowrap;
}

.entry-impact-share {
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 750;
  white-space: nowrap;
}

.entry-points {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 0 7px;
  border-radius: 999px;
  color: #4f720e;
  background: #ecf8d8;
  font-size: 0.62rem;
  font-weight: 950;
}

.entry-action-kcal {
  color: #76510d;
  border-color: #ead49d;
  background: #fff9e9;
}

.calorie-adjust-presets {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.calorie-adjust-preset {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green);
  background: var(--surface-soft);
  font-size: 0.8rem;
  font-weight: 900;
}

.correction-help {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.settings-session {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.points-guide {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 11px;
  border: 1px solid #d9e9c0;
  border-radius: 12px;
  background: #f3f9e9;
}

.points-guide span {
  color: #527817;
  font-size: 0.63rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.points-guide strong {
  font-size: 0.75rem;
  line-height: 1.35;
}

.points-guide small {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.35;
}

.settings-session .button {
  width: 100%;
}

@media (max-width: 760px) {
  .profile-summary { min-width: 165px; }
  .dashboard-grid-report { grid-template-columns: 1fr; }
}

@media (min-width: 760px) {
  .app-header {
    padding-right: max(28px, calc((100vw - 1120px) / 2));
    padding-left: max(28px, calc((100vw - 1120px) / 2));
  }
  .page-shell { padding-top: 24px; }
  .day-heading { margin-bottom: 12px; }
}

@media (min-width: 760px) and (max-width: 999px) {
  .top-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1000px) {
  .top-grid { grid-template-columns: minmax(0, 1.15fr) minmax(410px, 0.85fr); }
  .today-overview-card {
    align-self: stretch;
    display: flex;
    flex-direction: column;
  }
  .today-overview-card .compact-today-metrics { margin-top: auto; }
}

@media (max-width: 560px) {
  .app-header {
    min-height: 58px;
    gap: 3px;
    padding-right: max(6px, env(safe-area-inset-right));
    padding-left: max(6px, env(safe-area-inset-left));
    overflow: hidden;
  }

  .private-brand { min-height: 44px; gap: 0; }
  .fitness-brand-mark { width: 36px; height: 36px; }
  .brand-copy { display: none; }
  .header-actions { min-width: 0; flex: 1; gap: 1px; overflow: hidden; }
  .profile-summary { width: 0; min-width: 0; max-width: 205px; flex: 1; height: 48px; padding-right: 6px; border-radius: 14px; }
  .profile-avatar-wrap { width: 40px; height: 40px; flex-basis: 40px; border-radius: 12px; }
  .profile-copy > strong { font-size: 0.73rem; }
  .profile-score { gap: 4px; }
  .profile-score b { font-size: 0.67rem; }
  .profile-score small { max-width: 80px; font-size: 0.52rem; }
  .profile-streak { min-width: 23px; padding: 3px; font-size: 0.56rem; }
  .header-actions .icon-button { width: 38px; min-height: 44px; }
  .header-actions .text-button { min-width: 35px; padding: 0 3px; font-size: 0.68rem; }
  #settingsButton,
  #logoutButton { display: none; }

  .page-shell { width: min(100% - 12px, 1120px); padding-top: 6px; }
  .day-heading { min-height: 42px; margin-bottom: 4px; }
  .day-heading .fitness-eyebrow { display: none; }
  .day-heading h1 { margin: 0; font-size: 1.45rem; }
  .day-picker-wrap { display: flex; align-items: center; gap: 5px; }
  .day-picker { padding: 2px; }
  .day-picker-button { min-width: 48px; min-height: 38px; }
  .date-label { display: none; }
  .top-grid,
  .top-grid > * { min-width: 0; }
  .top-grid { width: 100%; gap: 6px; }
  .composer-card { width: 100%; min-width: 0; overflow: hidden; padding: 10px; }
  .entry-digest,
  .entry-digest-list { width: 100%; min-width: 0; max-width: 100%; }
  .composer-card > label { margin-bottom: 5px; font-size: 0.8rem; }
  textarea { min-height: 62px; max-height: 116px; padding: 8px 10px; }
  .composer-footer { margin-top: 5px; }
  .composer-footer > span { font-size: 0.64rem; }
  .composer-footer .button { min-width: 106px; }

  .today-overview-card { width: 100%; min-width: 0; padding: 10px; }
  .today-overview-heading { margin-bottom: 1px; }
  .today-overview-heading .eyebrow { display: none; }
  .today-overview-heading h2 { font-size: 1rem; }
  .today-overview-actions { gap: 4px; }
  .today-overview-card .day-state-button { padding: 0 8px; font-size: 0.66rem; }
  .target-edit-button { width: 44px; min-height: 44px; }
  .calorie-heading .metric-label { display: none; }
  .calorie-value { margin-top: 0; font-size: 1.85rem; }
  .calorie-value small { margin-left: 4px; font-size: 0.64rem; }
  .calorie-score > strong { font-size: 1rem; }
  .calorie-target.target-link { min-height: 30px; font-size: 0.64rem; }
  .calorie-progress { height: 7px; }
  .compact-calorie-details { gap: 6px; margin-top: 4px; }
  .compact-calorie-details p { font-size: 0.61rem !important; line-height: 1.2; }
  .compact-calorie-details p:last-child::before { content: "·"; margin-right: 6px; color: rgba(255, 255, 255, 0.42); }
  .compact-today-metrics { width: 100%; min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 7px; }
  .today-stat { min-height: 56px; gap: 1px 4px; padding: 4px 7px; border-radius: 0; }
  .today-stat > span { font-size: 0.6rem; }
  .today-stat > strong { font-size: 0.82rem; }
  .today-stat > small,
  .today-stat > .target-link,
  .today-stat > .quality-badge { min-height: 28px; font-size: 0.63rem; }
  .today-stat > .target-link { min-height: 28px; max-width: 100%; padding: 0; }
  .today-stat .edit-pencil { width: 13px; height: 13px; }

  .section-block { margin-top: 15px; }
  .compact-heading { margin-bottom: 7px; }
  .compact-heading .eyebrow { display: none; }
  .compact-heading h2 { margin: 0; font-size: 1rem; }
  .quick-grid { gap: 6px; }
  .quick-card { padding: 8px; border-radius: 13px; }
  .quick-icon { width: 34px; height: 34px; border-radius: 10px; }
  .quick-icon svg { width: 19px; height: 19px; }
  .quick-title { gap: 7px; }
  .quick-title strong { font-size: 0.82rem; }
  .quick-title small { font-size: 0.59rem; }
  .quick-card label { margin-top: 7px; }
  .quick-input-row { gap: 5px; }
  .quick-details { margin-top: 5px; padding-top: 3px; }
  .quick-details summary { min-height: 44px; font-size: 0.63rem; }

  .dashboard-grid-report { margin-top: 8px; }
  .dashboard-grid-report .report-card { padding: 12px 44px 12px 12px; }
  .dashboard-grid-report .report-card h2 { font-size: 1.05rem; }
  .dashboard-grid-report .action-reason { font-size: 0.78rem; }
  .dashboard-grid-report .report-meta { padding-top: 7px; font-size: 0.64rem; }
  .dashboard-grid-report .report-mark { top: 10px; right: 10px; width: 32px; height: 32px; }

  .trend-card { margin-top: 8px; }
  .trend-header { gap: 7px; }
  .trend-header h2 { font-size: 1rem; }
  .segment-button { min-height: 36px; padding: 0 8px; font-size: 0.67rem; }
  .metric-tabs { margin-top: 10px; }
  .trend-chart { min-height: 190px; }

  .entries-section { margin-top: 18px; }
  .entry-list { gap: 7px; margin-top: 8px; }
  .entry-item { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 8px; padding: 9px; border-radius: 13px; }
  .entry-icon { width: 38px; height: 38px; border-radius: 10px; }
  .entry-icon svg { width: 20px; height: 20px; }
  .entry-title { font-size: 0.78rem; }
  .entry-analysis { margin-top: 4px; font-size: 0.69rem; line-height: 1.35; }
  .entry-footer { justify-content: flex-start; flex-wrap: wrap; margin-top: 5px; }
  .entry-estimate { text-align: left; }
  .entry-impact { min-width: 74px; }
  .entry-impact-kcal { font-size: 0.68rem; }
  .entry-impact-share { font-size: 0.52rem; }
  .entry-actions { flex-wrap: wrap; }
  .entry-action { min-height: 40px; }
}

@media (max-width: 370px) {
  .header-actions .icon-button { width: 34px; }
  .profile-summary { gap: 5px; padding-left: 3px; }
  .profile-avatar-wrap { width: 38px; height: 38px; flex-basis: 38px; }
  .profile-score small { display: none; }
  .profile-streak { display: none; }
  .compact-calorie-details p:last-child { display: block; }
  .entry-item { grid-template-columns: 34px minmax(0, 1fr); }
  .entry-icon { width: 34px; height: 34px; }
  .entry-impact { grid-column: 2; min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 7px; text-align: left; }
}

/* Fitness V5: densidad útil, metas con lápiz y jerarquía consistente. */
.quick-grid { align-items: start; }

.status-bar[data-tone="success"] {
  position: fixed;
  z-index: 45;
  top: max(72px, calc(env(safe-area-inset-top) + 64px));
  right: max(16px, env(safe-area-inset-right));
  max-width: min(360px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 12px;
  box-shadow: 0 12px 34px rgba(20, 48, 34, 0.16);
  pointer-events: none;
  animation: status-toast-in 180ms ease-out;
}

@keyframes status-toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  .entry-digest-row { min-width: min(174px, 64vw); }
  .status-bar[data-tone="success"] {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-summary.points-earned,
  .profile-sync[data-state="checking"],
  .status-bar[data-tone="success"] { animation: none; }
  .profile-progress-track i { transition: none; }
}

/* Fitness V7: estado legible, cobertura explícita y controles cómodos. */
.day-state-inline { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
#dayStateLabel { font-size: .75rem; line-height: 1.3; max-width: 160px; text-align: right; }
.day-status-note { margin: 8px 0 12px; font-size: .8rem; line-height: 1.45; color: #d9e9df; }
.entry-repeat { margin-top: 8px; color: #17583d; background: #edf7ef; min-height: 44px; }
.entry-action, .day-picker-button, .segment-button, .target-link { min-height: 44px; }
@media (max-width: 560px) {
  .page-shell { width: min(100% - 24px, 1120px); }
  .composer-card, .today-overview-card { padding: 14px; }
  .top-grid { gap: 12px; }
  .composer-card > label { font-size: 1rem; }
  .composer-footer > span, .quick-title small, .date-label, .report-meta { font-size: .75rem; }
  .composer-footer { gap: 8px; }
  .profile-copy > strong { font-size: .875rem; }
  .profile-score b, .profile-score small, .profile-streak { font-size: .75rem; }
  .today-overview-heading { align-items: flex-start; gap: 8px; }
  .today-overview-actions { align-items: flex-start; }
  .today-overview-card .day-state-button { font-size: .8rem; min-height: 44px; }
  .day-status-note { font-size: .8rem; }
  .calorie-target.target-link { min-height: 44px; font-size: .8rem; }
  .calorie-value small { font-size: .8rem; }
  .compact-calorie-details { flex-wrap: wrap; }
  .compact-calorie-details p { font-size: .8rem !important; line-height: 1.45; }
  .compact-today-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-stat { min-height: 70px; padding: 8px; }
  .today-stat > span, .today-stat > small, .today-stat > .quality-badge { font-size: .75rem; }
  .today-stat > strong { font-size: 1rem; }
  .today-stat > .target-link { min-height: 44px; font-size: .8rem; }
  .quick-title strong, .entry-title { font-size: .95rem; }
  .quick-details summary, .entry-analysis { font-size: .85rem; }
  .entry-impact-kcal, .entry-impact-share { font-size: .75rem; }
  .entry-action, .segment-button { min-height: 44px; font-size: .8rem; }
}


.manual-food-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.manual-food-panel label {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.manual-food-panel input {
  min-height: 42px;
  margin-top: 5px;
}

@media (max-width: 560px) {
  .manual-food-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
