/*
 * Mobile tracking experience
 *
 * This layer intentionally leaves the desktop layout and product markup alone.
 * It replaces the translucent card stack with a quieter, data-first mobile UI.
 */

.mobile-today-overview,
.mobile-section-heading,
.record-entry-icon,
.replay-entry-icon {
  display: none;
}

@media (max-width: 1024px), (max-width: 1366px) and (any-pointer: coarse) {
  :root {
    --mobile-tracking-surface: #fbfdff;
    --mobile-tracking-surface-raised: #ffffff;
    --mobile-tracking-surface-soft: #f0f5f7;
    --mobile-tracking-ink: #10202b;
    --mobile-tracking-muted: #667681;
    --mobile-tracking-line: rgba(39, 77, 94, 0.12);
    --mobile-tracking-primary: #267a8c;
    --mobile-tracking-primary-strong: #1d6372;
    --mobile-tracking-primary-soft: #e4f2f5;
    --mobile-tracking-rose: #c9779e;
    --mobile-tracking-violet: #7770bd;
    --mobile-tracking-shadow: 0 12px 34px rgba(33, 67, 82, 0.08);
    --mobile-tracking-shadow-raised: 0 18px 48px rgba(33, 67, 82, 0.12);
    --mobile-tracking-radius: 22px;
    --mobile-tracking-radius-small: 16px;
  }

  /* Dashboard rhythm and compact identity header */
  .dashboard,
  html[data-theme^="glass-"] .dashboard {
    gap: 12px;
  }

  .dashboard > .topbar { order: 0; }
  .dashboard > .mobile-today-overview { order: 1; }
  .dashboard > .action-zone { order: 2; }
  .dashboard > .chart-section { order: 3; }
  .dashboard > .goal-chart-section { order: 4; }
  .dashboard > .calendar-section { order: 5; }
  .dashboard > .history-section { order: 6; }

  .mobile-today-overview {
    display: grid;
    gap: 15px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 26px;
    padding: 17px;
    background:
      radial-gradient(90% 100% at 100% 0%, rgba(92, 184, 202, 0.11), transparent 64%),
      radial-gradient(75% 90% at 0% 100%, rgba(205, 122, 162, 0.08), transparent 70%),
      var(--mobile-tracking-surface-raised);
    box-shadow: var(--mobile-tracking-shadow-raised);
  }

  .today-overview-heading,
  .mobile-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .today-overview-kicker,
  .mobile-section-heading span {
    margin: 0 0 3px;
    color: var(--mobile-tracking-primary);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.08em;
    line-height: 1.2;
  }

  .today-overview-heading h2,
  .mobile-section-heading h2 {
    margin: 0;
    color: var(--mobile-tracking-ink);
    font-size: 17px;
    font-weight: 720;
    letter-spacing: -0.02em;
    line-height: 1.25;
  }

  .today-record-status {
    flex: 0 0 auto;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    background: var(--mobile-tracking-primary-soft);
    color: var(--mobile-tracking-primary-strong);
    font-size: 10px;
    font-weight: 700;
  }

  .today-record-status[data-tone="pending"] {
    background: #f5f0e4;
    color: #8b672a;
  }

  .today-metric-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 10px;
  }

  .today-primary-metric,
  .today-secondary-metric {
    min-width: 0;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 18px;
    padding: 13px;
    background: rgba(244, 249, 251, 0.82);
  }

  .today-primary-metric > span,
  .today-secondary-metric > span {
    display: block;
    margin-bottom: 4px;
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 650;
  }

  .today-primary-metric strong {
    color: var(--mobile-tracking-ink);
    font-size: clamp(31px, 10vw, 40px);
    font-weight: 720;
    letter-spacing: -0.055em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  .today-primary-metric > small {
    margin-left: 4px;
    color: var(--mobile-tracking-muted);
    font-size: 12px;
    font-weight: 650;
  }

  .today-secondary-metric strong {
    display: block;
    overflow: hidden;
    color: var(--mobile-tracking-ink);
    font-size: clamp(18px, 5.5vw, 22px);
    font-weight: 720;
    letter-spacing: -0.035em;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .today-secondary-metric strong[data-tone="down"] { color: var(--mobile-tracking-primary-strong); }
  .today-secondary-metric strong[data-tone="up"] { color: #a96377; }

  .today-secondary-metric small {
    display: -webkit-box;
    margin-top: 7px;
    overflow: hidden;
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 550;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .today-insight {
    position: relative;
    margin: 0;
    border-left: 3px solid rgba(38, 122, 140, 0.42);
    border-radius: 0 12px 12px 0;
    padding: 9px 11px;
    background: rgba(229, 242, 245, 0.72);
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    font-weight: 550;
    line-height: 1.55;
  }

  .today-quick-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .today-record-button,
  html[data-theme^="glass-"] .today-record-button {
    width: 100%;
    min-height: 58px;
    border-radius: 17px;
    box-shadow: none;
  }

  .today-record-button,
  html[data-theme^="glass-"] .today-record-button {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(23, 93, 108, 0.36);
    padding: 9px 13px;
    background: linear-gradient(135deg, #2b8496, #216f80);
    color: #ffffff;
    text-align: left;
  }

  .today-record-button-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 23px;
    font-weight: 400;
  }

  .today-record-button > span:last-child { min-width: 0; }

  .today-record-button strong,
  .today-record-button small {
    display: block;
    color: inherit;
  }

  .today-record-button strong { font-size: 14px; font-weight: 720; }
  .today-record-button small { margin-top: 1px; opacity: 0.74; font-size: 10px; font-weight: 520; }

  .mobile-section-heading {
    margin: 4px 2px 9px;
  }

  .mobile-section-heading > small {
    align-self: flex-end;
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 550;
  }

  .dashboard > .topbar,
  html[data-theme^="glass-"] .dashboard > .topbar {
    min-height: 48px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px;
  }

  .dashboard > .topbar > div {
    min-width: 0;
  }

  .dashboard > .topbar .eyebrow {
    margin: 0 0 3px 46px;
    color: var(--mobile-tracking-primary);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.08em;
  }

  .dashboard .profile-title-row {
    gap: 9px;
  }

  .dashboard .profile-avatar,
  html[data-theme^="glass-"] .dashboard .profile-avatar {
    width: 37px;
    height: 37px;
    border: 1px solid rgba(255, 255, 255, 0.88);
    background: var(--mobile-tracking-surface-raised);
    box-shadow: 0 7px 18px rgba(35, 73, 89, 0.1);
    font-size: 15px;
  }

  .dashboard #profileTitle {
    margin: 0;
    color: var(--mobile-tracking-ink);
    font-size: clamp(19px, 5.6vw, 23px);
    font-weight: 700;
    line-height: 1.14;
    letter-spacing: -0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dashboard #profileTitleSuffix {
    display: none;
  }

  .dashboard .notification-bell,
  html[data-theme^="glass-"] .dashboard .notification-bell {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 14px;
    padding: 0;
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-ink);
    box-shadow: 0 8px 20px rgba(35, 73, 89, 0.07);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  /* Main weight card: data remains the visual anchor. */
  .chart-section {
    min-width: 0;
  }

  .weight-chart,
  html[data-theme^="glass-"] .weight-chart {
    min-height: 276px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 24px;
    background: var(--mobile-tracking-surface);
    box-shadow: var(--mobile-tracking-shadow-raised);
    overflow: hidden;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .weight-chart .chart-frame {
    overflow: hidden;
    border-radius: inherit;
  }

  .weight-chart .chart-y-axis,
  html[data-theme^="glass-"] .weight-chart .chart-y-axis {
    width: 44px;
    border-right-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface);
    color: var(--mobile-tracking-muted);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .weight-chart .chart-frame {
    padding-left: 44px;
  }

  .weight-chart .chart-frame.has-no-axis {
    padding-left: 0;
  }

  .weight-chart .chart-y-axis span {
    left: 8px;
    font-size: 10px;
    font-weight: 600;
  }

  .weight-chart .chart-day-label {
    fill: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 600;
  }

  .weight-chart .chart-detail,
  html[data-theme^="glass-"] .weight-chart .chart-detail {
    top: 10px;
    left: calc(50% + 22px);
    min-width: min(248px, calc(100% - 58px));
    min-height: 44px;
    gap: 8px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 15px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--mobile-tracking-muted);
    box-shadow: 0 8px 22px rgba(30, 63, 77, 0.09);
    font-size: 10px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .weight-chart .chart-frame.has-no-axis .chart-detail {
    left: 50%;
  }

  .weight-chart .chart-detail-date {
    color: var(--mobile-tracking-ink);
    font-weight: 700;
  }

  .weight-chart .chart-detail strong {
    color: var(--mobile-tracking-primary-strong);
    font-size: 11px;
    font-weight: 700;
  }

  .weight-chart .weight-trend-widget-selection-slot .chart-detail,
  html[data-theme^="glass-"] .weight-chart .weight-trend-widget-selection-slot .chart-detail {
    top: 0;
    left: 50%;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    gap: 6px;
    border-radius: 8px;
    padding: 5px 8px;
    box-shadow: none;
  }

  /* Primary action first, supporting actions share the second row. */
  .dashboard .action-zone {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
  }

  .dashboard .record-entry-grid {
    display: contents;
  }

  .dashboard .record-entry-button,
  .dashboard .replay-launch-button,
  html[data-theme^="glass-"] .dashboard .record-entry-button,
  html[data-theme^="glass-"] .dashboard .replay-launch-button {
    border-radius: 18px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .dashboard .record-entry-button {
    min-height: 80px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 40px auto;
    place-items: center;
    gap: 4px;
    padding: 8px 6px;
    text-align: center;
  }

  .dashboard .record-entry-button::before {
    display: none;
  }

  .dashboard .record-entry-icon {
    grid-column: 1;
    grid-row: 1;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 0;
    background: transparent;
    color: var(--mobile-tracking-primary-strong);
  }

  .dashboard .record-entry-icon svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }

  .dashboard .record-entry-button .action-label,
  .dashboard .record-entry-button .action-meta {
    grid-column: 1;
  }

  .dashboard .body-record-entry,
  html[data-theme^="glass-"] .dashboard .body-record-entry {
    grid-column: auto;
    min-height: 80px;
    border: 1px solid var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-ink);
    box-shadow: var(--mobile-tracking-shadow);
  }

  .dashboard .body-record-entry .action-label {
    color: var(--mobile-tracking-ink);
    font-size: 12px;
    font-weight: 700;
  }

  .dashboard .body-record-entry .action-meta {
    display: none;
  }

  .dashboard .food-record-entry,
  html[data-theme^="glass-"] .dashboard .food-record-entry {
    border: 1px solid var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-ink);
    box-shadow: var(--mobile-tracking-shadow);
  }

  .dashboard .food-record-entry .record-entry-icon {
    background: transparent;
    color: var(--mobile-tracking-primary-strong);
  }

  .dashboard .food-record-entry .action-label {
    font-size: 12px;
    font-weight: 700;
  }

  .dashboard .food-record-entry .action-meta {
    display: none;
  }

  .dashboard .replay-launch-button,
  html[data-theme^="glass-"] .dashboard .replay-launch-button {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-primary-strong);
    box-shadow: none;
    font-size: 12px;
    font-weight: 700;
  }

  .dashboard .replay-entry-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 0;
    background: transparent;
    color: var(--mobile-tracking-primary-strong);
  }

  .dashboard .replay-entry-icon svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }

  .dashboard .replay-entry-icon svg path:last-child {
    fill: none;
  }

  .dashboard .replay-launch-button:disabled {
    color: var(--mobile-tracking-muted);
    opacity: 0.52;
  }

  .dashboard .record-entry-button:active:not(:disabled),
  .dashboard .replay-launch-button:active:not(:disabled) {
    transform: scale(0.982);
  }

  /* Calendar and goal cards use solid, quiet surfaces. */
  .weight-calendar,
  .weight-goal-chart,
  html[data-theme^="glass-"] .weight-calendar,
  html[data-theme^="glass-"] .weight-goal-chart {
    border: 1px solid var(--mobile-tracking-line);
    border-radius: var(--mobile-tracking-radius);
    background: var(--mobile-tracking-surface);
    box-shadow: var(--mobile-tracking-shadow);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .weight-calendar {
    padding: 14px 14px 15px;
  }

  .calendar-head {
    margin-bottom: 8px;
  }

  .calendar-head strong {
    color: var(--mobile-tracking-ink);
    font-size: 13px;
    font-weight: 700;
  }

  .calendar-head span {
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 600;
  }

  .calendar-detail,
  html[data-theme^="glass-"] .calendar-detail {
    min-height: 38px;
    gap: 8px;
    margin-bottom: 10px;
    border: 0;
    border-radius: 13px;
    padding: 8px 10px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-muted);
    box-shadow: none;
    font-size: 11px;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 4px;
  }

  .calendar-weekdays,
  html[data-theme^="glass-"] .calendar-weekdays {
    margin-bottom: 5px;
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 600;
  }

  .calendar-day,
  button.calendar-day,
  html[data-theme^="glass-"] .calendar-day,
  html[data-theme^="glass-"] button.calendar-day {
    --calendar-day-font-size: 10px;
    height: 27px;
    min-height: 27px;
    border-color: rgba(55, 91, 106, 0.09);
    border-radius: 8px;
    background: var(--day-color, #edf2f4);
    color: var(--mobile-tracking-ink);
    box-shadow: none;
    font-weight: 650;
  }

  .calendar-day.is-empty,
  html[data-theme^="glass-"] .calendar-day.is-empty {
    border-color: transparent;
    background: #f4f7f8;
    color: rgba(80, 101, 111, 0.48);
  }

  .calendar-day.calendar-day-spacer,
  html[data-theme^="glass-"] .calendar-day.calendar-day-spacer {
    visibility: hidden;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .calendar-day.is-selected,
  html[data-theme^="glass-"] .calendar-day.is-selected {
    border-color: rgba(38, 122, 140, 0.56);
    box-shadow: 0 0 0 2px rgba(38, 122, 140, 0.12);
  }

  .weight-goal-chart {
    padding: 15px 14px 8px;
  }

  .goal-chart-head {
    gap: 9px;
    margin-bottom: 10px;
  }

  .goal-chart-head span,
  html[data-theme^="glass-"] .goal-chart-head span,
  .goal-chart-head strong small,
  html[data-theme^="glass-"] .goal-chart-head strong small {
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 600;
  }

  .goal-chart-head strong {
    color: var(--mobile-tracking-ink);
    font-size: 15px;
    font-weight: 700;
  }

  .goal-chart-forecast-summary {
    max-width: 42%;
  }

  .goal-chart-forecast-summary strong {
    font-size: 12px;
  }

  .goal-chart-metrics {
    gap: 5px 12px;
    margin-bottom: 2px;
  }

  .goal-chart-metric,
  html[data-theme^="glass-"] .goal-chart-metric {
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 600;
  }

  .goal-chart-metric::before {
    width: 18px;
    flex-basis: 18px;
  }

  .goal-chart-empty {
    min-height: 92px;
    padding: 18px;
    color: var(--mobile-tracking-muted);
  }

  /* AI action and record history */
  .history-section,
  html[data-theme^="glass-"] .history-section {
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 24px;
    padding: 14px;
    background: var(--mobile-tracking-surface);
    box-shadow: var(--mobile-tracking-shadow);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .history-section .ai-advice-button,
  html[data-theme^="glass-"] .history-section .ai-advice-button {
    min-height: 70px;
    margin: 0 0 18px;
    border: 1px solid rgba(113, 112, 189, 0.16);
    border-radius: 18px;
    padding: 12px 13px;
    background: linear-gradient(135deg, #f0f1fb, #edf6f7);
    color: var(--mobile-tracking-ink);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .history-section .ai-advice-button small {
    color: var(--mobile-tracking-violet);
    font-size: 10px;
    font-weight: 700;
  }

  .history-section .ai-advice-button strong {
    color: var(--mobile-tracking-ink);
    font-size: 16px;
    font-weight: 700;
  }

  .history-section .ai-advice-button em {
    margin-top: 1px;
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    font-weight: 500;
  }

  .history-section .ai-advice-action,
  html[data-theme^="glass-"] .history-section .ai-advice-action {
    min-width: 52px;
    min-height: 32px;
    border: 0;
    border-radius: 11px;
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-violet);
    box-shadow: 0 6px 16px rgba(91, 90, 155, 0.1);
    font-size: 12px;
    font-weight: 700;
  }

  .history-section > .section-heading {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .history-section > .section-heading h2,
  html[data-theme^="glass-"] .history-section > .section-heading h2 {
    color: var(--mobile-tracking-ink);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
  }

  .history-heading-actions {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
  }

  .history-heading-actions #historyMeta {
    min-width: 0;
    max-width: none;
    margin: 0;
    overflow: visible;
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.3;
    text-align: right;
    text-overflow: clip;
    text-wrap: balance;
    white-space: normal;
  }

  .history-toggle-button,
  html[data-theme^="glass-"] .history-toggle-button {
    width: auto;
    min-width: 48px;
    min-height: 32px;
    border: 0;
    border-radius: 11px;
    padding: 0 10px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-primary-strong);
    box-shadow: none;
    font-size: 11px;
    font-weight: 700;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .history-list {
    gap: 9px;
    margin-top: 12px;
  }

  .history-list > .chart-empty {
    height: auto;
    min-height: 94px;
    border: 1px dashed rgba(38, 122, 140, 0.2);
    border-radius: 16px;
    padding: 18px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.55;
  }

  .history-item,
  html[data-theme^="glass-"] .history-item {
    grid-template-columns: 62px minmax(0, 1fr);
    column-gap: 11px;
    min-height: 82px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 18px;
    padding: 10px;
    background: var(--mobile-tracking-surface-raised);
    box-shadow: none;
  }

  .history-item.is-food,
  .history-item.is-body-record,
  .history-item.is-health-record {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .history-thumb,
  .history-body-photo,
  .history-health-thumb,
  .history-item.is-food .history-food-gallery {
    width: 62px;
    border-radius: 14px;
  }

  .history-food-gallery,
  .history-food-track img {
    border-radius: 14px;
  }

  .history-time {
    color: var(--mobile-tracking-ink);
    font-size: 12px;
    font-weight: 700;
  }

  .history-note {
    margin-top: 2px;
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    font-weight: 500;
  }

  .history-mood {
    margin-top: 6px;
    color: var(--mobile-tracking-ink);
    font-size: 12px;
    line-height: 1.45;
  }

  .history-food-list {
    gap: 5px;
    margin-top: 7px;
  }

  .history-food-entry,
  html[data-theme^="glass-"] .history-food-entry {
    border-color: var(--mobile-tracking-line);
    border-radius: 12px;
    padding: 6px 8px;
    background: var(--mobile-tracking-surface-soft);
  }

  .history-food-summary strong,
  .history-food-summary span {
    padding: 3px 7px;
    font-size: 10px;
  }

  .history-food-calories,
  .history-weight {
    font-size: 16px;
    font-weight: 700;
  }

  .delete-record-button,
  .edit-record-button,
  html[data-theme^="glass-"] .delete-record-button {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .history-loader {
    min-height: 36px;
    color: var(--mobile-tracking-muted);
    font-size: 11px;
  }

  /* Capture flow: compact header, immersive camera, clear completion action. */
  .capture-view,
  html[data-theme^="glass-"] .capture-view {
    gap: 12px;
  }

  .capture-view > .topbar,
  html[data-theme^="glass-"] .capture-view > .topbar {
    min-height: 44px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px;
  }

  .capture-view > .topbar .eyebrow {
    margin: 0 0 2px;
    color: var(--mobile-tracking-primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
  }

  .capture-view > .topbar h1,
  html[data-theme^="glass-"] .capture-view > .topbar h1 {
    margin: 0;
    color: var(--mobile-tracking-ink);
    font-size: 25px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.03em;
  }

  .capture-view #backToDashboardButton,
  html[data-theme^="glass-"] .capture-view #backToDashboardButton {
    min-width: 62px;
    min-height: 38px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 13px;
    padding: 0 13px;
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-ink);
    box-shadow: none;
    font-size: 12px;
    font-weight: 650;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .capture-flow {
    width: 100%;
  }

  .camera-stage,
  .camera-stage.is-food-mode {
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    background: #071118;
    box-shadow: 0 20px 52px rgba(7, 17, 24, 0.2);
  }

  .camera-stage {
    aspect-ratio: 4 / 5;
  }

  .camera-stage.is-food-mode {
    aspect-ratio: 1 / 1;
  }

  .empty-camera {
    background:
      radial-gradient(circle at 50% 36%, rgba(99, 177, 194, 0.15), transparent 36%),
      #071118;
  }

  .empty-camera span {
    min-width: 0;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 15px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 600;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .camera-switch-button,
  .photo-effect-button,
  .photo-effect-toggle {
    min-height: 38px;
    border-radius: 13px;
    background: rgba(7, 17, 24, 0.68);
    font-size: 11px;
    box-shadow: none;
  }

  .capture-hint {
    min-height: 0;
    margin: 10px 4px 0;
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
  }

  .capture-flow .control-row {
    display: grid;
    grid-template-columns: minmax(0, 0.74fr) minmax(0, 1.26fr);
    gap: 9px;
    margin-top: 10px;
  }

  .capture-flow .control-row button,
  .camera-settings-button,
  .record-submit-button,
  html[data-theme^="glass-"] .capture-flow .control-row button,
  html[data-theme^="glass-"] .camera-settings-button,
  html[data-theme^="glass-"] .record-submit-button {
    min-height: 50px;
    border-radius: 16px;
    box-shadow: none;
    font-size: 14px;
    font-weight: 700;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .capture-flow #retakeButton,
  html[data-theme^="glass-"] .capture-flow #retakeButton {
    border: 1px solid var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-ink);
  }

  .capture-flow #captureButton,
  .record-submit-button,
  html[data-theme^="glass-"] .capture-flow #captureButton,
  html[data-theme^="glass-"] .record-submit-button {
    border: 1px solid rgba(28, 98, 113, 0.34);
    background: var(--mobile-tracking-primary);
    color: #ffffff;
  }

  .capture-message {
    min-height: 0;
    margin: 7px 4px 0;
    font-size: 11px;
  }

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

  .record-form,
  html[data-theme^="glass-"] .record-form {
    margin-top: 12px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 22px;
    padding: 14px;
    background: var(--mobile-tracking-surface);
    box-shadow: var(--mobile-tracking-shadow);
  }

  .record-fields {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .record-field label,
  .food-mood-field label {
    color: var(--mobile-tracking-ink);
    font-size: 12px;
    font-weight: 650;
  }

  .record-field input,
  .food-mood-field input {
    min-height: 50px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 15px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-ink);
    box-shadow: none;
    font-size: 16px;
  }

  .mood-ai-button,
  html[data-theme^="glass-"] .mood-ai-button {
    min-height: 28px;
    border: 0;
    border-radius: 10px;
    background: #eeeff9;
    color: var(--mobile-tracking-violet);
    box-shadow: none;
    font-size: 10px;
    font-weight: 700;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  /* Food capture output */
  .food-record-panel,
  html[data-theme^="glass-"] .food-record-panel {
    margin-top: 12px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 22px;
    padding: 14px;
    background: var(--mobile-tracking-surface);
    box-shadow: var(--mobile-tracking-shadow);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .food-panel-head {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .food-panel-head h2 {
    color: var(--mobile-tracking-ink);
    font-size: 18px;
    font-weight: 700;
  }

  .food-panel-head p {
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    font-weight: 500;
  }

  .food-panel-head .record-submit-button {
    width: 100%;
    min-height: 48px;
  }

  .food-photo-carousel {
    min-height: 98px;
    gap: 9px;
    margin-top: 10px;
    padding-bottom: 6px;
  }

  .food-capture-thumb {
    width: min(102px, 29vw);
    height: min(102px, 29vw);
    flex-basis: min(102px, 29vw);
    border: 0;
    border-radius: 16px;
    background: var(--mobile-tracking-surface-soft);
    box-shadow: none;
  }

  .food-photo-delete-button,
  html[data-theme^="glass-"] .food-photo-delete-button {
    top: 6px;
    right: 6px;
    width: 27px;
    min-width: 27px;
    height: 27px;
    min-height: 27px;
    border-radius: 50%;
    padding: 0;
    background: rgba(7, 17, 24, 0.66);
  }

  .food-photo-delete-button svg,
  html[data-theme^="glass-"] .food-photo-delete-button svg {
    display: block;
  }

  .food-result-list {
    gap: 7px;
    margin-top: 10px;
  }

  .food-quick-submit-note,
  html[data-theme^="glass-"] .food-quick-submit-note {
    border-color: var(--mobile-tracking-line);
    border-radius: 15px;
    background: var(--mobile-tracking-surface-soft);
  }

  .food-quick-submit-note strong {
    color: var(--mobile-tracking-ink);
  }

  .food-quick-submit-note span {
    color: var(--mobile-tracking-muted);
  }

  .food-delete-button,
  html[data-theme^="glass-"] .food-delete-button,
  .food-delete-button:hover:not(:disabled),
  .food-delete-button:focus-visible,
  .food-delete-button:active:not(:disabled) {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .history-food-processing,
  html[data-theme^="glass-"] .history-food-processing {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
  }

  .history-food-processing strong {
    color: var(--mobile-tracking-ink);
  }

  .history-food-processing small {
    color: var(--mobile-tracking-muted);
  }

  .food-result-item,
  html[data-theme^="glass-"] .food-result-item {
    grid-template-columns: minmax(0, 1fr) auto 30px;
    gap: 8px;
    min-height: 62px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 15px;
    padding: 9px 8px 9px 11px;
    background: var(--mobile-tracking-surface-raised);
  }

  .food-result-item strong {
    color: var(--mobile-tracking-ink);
    font-size: 14px;
  }

  .food-result-item span,
  .food-result-item small,
  .food-result-item p {
    color: var(--mobile-tracking-muted);
  }

  .food-result-metrics strong {
    color: var(--mobile-tracking-primary-strong);
  }

  .food-nutrition-grid span,
  .food-selection-nutrition span,
  .history-food-nutrition span,
  html[data-theme^="glass-"] .food-nutrition-grid span,
  html[data-theme^="glass-"] .food-selection-nutrition span,
  html[data-theme^="glass-"] .history-food-nutrition span {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-muted);
  }

  .food-empty-state,
  html[data-theme^="glass-"] .food-empty-state {
    min-height: 72px;
    border-color: rgba(38, 122, 140, 0.2);
    border-radius: 15px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    font-weight: 500;
  }

  /* Food selection and manual entry behave as native bottom sheets. */
  .food-selection-backdrop,
  .manual-food-backdrop,
  html[data-theme^="glass-"] .food-selection-backdrop,
  html[data-theme^="glass-"] .manual-food-backdrop {
    align-items: end;
    justify-items: stretch;
    padding: 0;
    background: rgba(7, 16, 23, 0.42);
  }

  .food-selection-dialog,
  html[data-theme^="glass-"] .food-selection-dialog {
    position: relative;
    width: 100%;
    max-width: none;
    max-height: min(90dvh, 780px);
    border: 0;
    border-radius: 28px 28px 0 0;
    padding: 28px 14px max(16px, calc(env(safe-area-inset-bottom, 0px) + 10px));
    background: var(--mobile-tracking-surface);
    box-shadow: 0 -16px 54px rgba(7, 16, 23, 0.2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .food-selection-dialog::before,
  .manual-food-dialog::before {
    position: absolute;
    top: 9px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: rgba(73, 96, 107, 0.22);
    transform: translateX(-50%);
    content: "";
  }

  .food-selection-head {
    gap: 10px;
  }

  .food-selection-head h2 {
    color: var(--mobile-tracking-ink);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  .food-selection-copy {
    margin: 7px 0 12px;
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    line-height: 1.45;
  }

  .food-selection-manual-button,
  .modal-icon-button,
  html[data-theme^="glass-"] .food-selection-manual-button,
  html[data-theme^="glass-"] .modal-icon-button {
    border: 1px solid var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-primary-strong);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .food-selection-list {
    gap: 8px;
  }

  .food-selection-item,
  html[data-theme^="glass-"] .food-selection-item {
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 17px;
    padding: 15px 10px 10px;
    background: var(--mobile-tracking-surface-raised);
  }

  .food-selection-item.is-selected,
  html[data-theme^="glass-"] .food-selection-item.is-selected {
    border-color: rgba(38, 122, 140, 0.36);
    background: var(--mobile-tracking-primary-soft);
  }

  .food-source-badge {
    border-radius: 0 17px 0 10px;
    background: var(--mobile-tracking-primary-soft);
    color: var(--mobile-tracking-primary-strong);
  }

  .food-portion-control {
    grid-template-columns: 29px minmax(66px, 72px) 29px auto;
  }

  .food-portion-control input,
  html[data-theme^="glass-"] .food-portion-control input {
    min-width: 0;
    padding-inline: 6px !important;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }

  .food-portion-control button,
  html[data-theme^="glass-"] .food-portion-control button {
    width: 29px;
    min-width: 29px;
    height: 29px;
    min-height: 29px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-primary-strong);
    box-shadow: none;
  }

  .food-selection-data span,
  html[data-theme^="glass-"] .food-selection-data span {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-muted);
  }

  .food-selection-summary,
  html[data-theme^="glass-"] .food-selection-summary {
    border: 0;
    border-radius: 14px;
    background: var(--mobile-tracking-primary-soft);
    color: var(--mobile-tracking-ink);
  }

  .manual-food-dialog,
  html[data-theme^="glass-"] .manual-food-dialog {
    position: relative;
    width: 100%;
    max-width: none;
    border: 0;
    border-radius: 28px 28px 0 0;
    padding: 30px 16px max(18px, calc(env(safe-area-inset-bottom, 0px) + 12px));
    background: var(--mobile-tracking-surface);
    box-shadow: 0 -16px 54px rgba(7, 16, 23, 0.2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .manual-food-dialog h2 {
    color: var(--mobile-tracking-ink);
    font-size: 22px;
    font-weight: 700;
  }

  .manual-food-dialog > p:not(.eyebrow):not(.manual-food-message) {
    color: var(--mobile-tracking-muted);
  }

  .manual-food-field input,
  html[data-theme^="glass-"] .manual-food-field input {
    min-height: 50px;
    border-color: var(--mobile-tracking-line);
    border-radius: 15px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-ink);
    box-shadow: none;
  }

  /* AI summary: focused information sheet instead of another glass panel. */
  .ai-summary-backdrop,
  html[data-theme^="glass-"] .ai-summary-backdrop {
    align-items: end;
    padding: 0;
    background: rgba(7, 16, 23, 0.42);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .ai-summary-panel,
  html[data-theme^="glass-"] .ai-summary-panel {
    position: relative;
    width: 100%;
    height: min(90dvh, 760px);
    border: 0;
    border-radius: 28px 28px 0 0;
    background: var(--mobile-tracking-surface);
    box-shadow: 0 -18px 58px rgba(7, 16, 23, 0.22);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .ai-summary-panel::before {
    position: absolute;
    z-index: 2;
    top: 9px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: rgba(73, 96, 107, 0.22);
    transform: translateX(-50%);
    content: "";
  }

  .ai-summary-header,
  html[data-theme^="glass-"] .ai-summary-header {
    min-height: 70px;
    align-items: center;
    border-bottom: 1px solid var(--mobile-tracking-line);
    padding: 23px 15px 12px;
    background: var(--mobile-tracking-surface);
  }

  .ai-summary-header p {
    margin-bottom: 2px;
    color: var(--mobile-tracking-violet);
    font-size: 9px;
    font-weight: 700;
  }

  .ai-summary-header h2 {
    color: var(--mobile-tracking-ink);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  .ai-summary-close,
  html[data-theme^="glass-"] .ai-summary-close {
    min-width: 52px;
    min-height: 36px;
    border: 0;
    border-radius: 12px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-ink);
    box-shadow: none;
    font-size: 12px;
    font-weight: 650;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .ai-summary-content,
  html[data-theme^="glass-"] .ai-summary-content {
    padding: 15px 15px max(22px, calc(env(safe-area-inset-bottom, 0px) + 14px));
    background: var(--mobile-tracking-surface-soft);
  }

  .ai-summary-status {
    min-height: 0;
    margin: 0 0 10px;
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    font-weight: 600;
  }

  .ai-summary-status:empty {
    display: none;
  }

  .ai-summary-output,
  html[data-theme^="glass-"] .ai-summary-output {
    min-height: 160px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 20px;
    padding: 16px;
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-ink);
    box-shadow: 0 8px 24px rgba(33, 67, 82, 0.06);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.72;
  }

  .ai-summary-output h2,
  .ai-summary-output h3,
  .ai-summary-output h4 {
    color: var(--mobile-tracking-ink);
    font-weight: 700;
  }

  .ai-summary-output h2 {
    font-size: 18px;
  }

  .ai-summary-output h3,
  .ai-summary-output h4 {
    font-size: 16px;
  }

  .ai-summary-output strong {
    color: var(--mobile-tracking-primary-strong);
    font-weight: 700;
  }

  .ai-summary-output blockquote,
  html[data-theme^="glass-"] .ai-summary-output blockquote {
    border-left-color: var(--mobile-tracking-primary);
    border-radius: 0 12px 12px 0;
    background: var(--mobile-tracking-primary-soft);
    color: var(--mobile-tracking-muted);
  }

  .ai-summary-output code,
  html[data-theme^="glass-"] .ai-summary-output code {
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-primary-strong);
  }

  /* Replay becomes a true immersive mobile surface. */
  .replay-modal-backdrop,
  html[data-theme^="glass-"] .replay-modal-backdrop {
    place-items: stretch;
    padding: 0;
    background: #05090d;
  }

  .replay-modal-panel,
  html[data-theme^="glass-"] .replay-modal-panel {
    width: 100vw;
    height: 100dvh;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    padding:
      env(safe-area-inset-top, 0px)
      env(safe-area-inset-right, 0px)
      env(safe-area-inset-bottom, 0px)
      env(safe-area-inset-left, 0px);
    background: #05090d;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .replay-modal-panel iframe,
  html[data-theme^="glass-"] .replay-modal-panel iframe {
    background: #05090d;
  }
}

@media (max-width: 360px) {
  .dashboard #profileTitle {
    font-size: 18px;
  }

  .dashboard #profileTitleSuffix {
    display: none;
  }

  .dashboard > .topbar .eyebrow {
    margin-left: 44px;
  }

  .weight-chart .chart-detail,
  html[data-theme^="glass-"] .weight-chart .chart-detail {
    min-width: min(224px, calc(100% - 52px));
    gap: 5px;
    padding-inline: 7px;
    font-size: 9px;
  }

  .weight-chart .chart-detail strong {
    font-size: 10px;
  }

  .dashboard .record-entry-button {
    grid-template-columns: 1fr;
    grid-template-rows: 36px auto;
    gap: 4px;
    padding-inline: 4px;
  }

  .dashboard :is(.record-entry-icon, .replay-entry-icon) {
    width: 36px;
    height: 36px;
    border-radius: 0;
  }

  .dashboard :is(.record-entry-icon, .replay-entry-icon) svg {
    width: 30px;
    height: 30px;
  }

  .dashboard .body-record-entry .action-label,
  .dashboard .food-record-entry .action-label,
  .dashboard .replay-launch-button {
    font-size: 11px;
  }

  .history-heading-actions #historyMeta {
    display: block;
    font-size: 9px;
    line-height: 1.25;
  }

  .calendar-day,
  button.calendar-day,
  html[data-theme^="glass-"] .calendar-day,
  html[data-theme^="glass-"] button.calendar-day {
    height: 25px;
    min-height: 25px;
  }

  .food-selection-head h2 {
    font-size: 18px;
  }

  .food-selection-manual-button {
    padding-inline: 8px;
    font-size: 10px;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 1024px),
  (prefers-color-scheme: dark) and (max-width: 1366px) and (any-pointer: coarse) {
  :root {
    --mobile-tracking-surface: #101b25;
    --mobile-tracking-surface-raised: #14222d;
    --mobile-tracking-surface-soft: #0b1620;
    --mobile-tracking-ink: #eef6fa;
    --mobile-tracking-muted: #91a3ae;
    --mobile-tracking-line: rgba(170, 205, 219, 0.13);
    --mobile-tracking-primary: #69bdcf;
    --mobile-tracking-primary-strong: #8dd3e1;
    --mobile-tracking-primary-soft: rgba(78, 157, 175, 0.15);
    --mobile-tracking-violet: #aaa5ea;
    --mobile-tracking-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    --mobile-tracking-shadow-raised: 0 18px 48px rgba(0, 0, 0, 0.24);
  }

  .dashboard .profile-avatar,
  html[data-theme^="glass-"] .dashboard .profile-avatar {
    border-color: rgba(180, 218, 231, 0.13);
    background: var(--mobile-tracking-surface-raised);
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.22);
  }

  .dashboard .notification-bell,
  html[data-theme^="glass-"] .dashboard .notification-bell {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-ink);
  }

  .weight-chart .chart-detail,
  html[data-theme^="glass-"] .weight-chart .chart-detail {
    background: rgba(20, 34, 45, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  }

  .dashboard .body-record-entry,
  html[data-theme^="glass-"] .dashboard .body-record-entry {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-ink);
  }

  .dashboard .body-record-entry .record-entry-icon {
    background: transparent;
    color: var(--mobile-tracking-primary-strong);
  }

  .dashboard .body-record-entry .action-label {
    color: var(--mobile-tracking-ink);
  }

  .dashboard .food-record-entry .record-entry-icon {
    background: transparent;
    color: var(--mobile-tracking-primary-strong);
  }

  .calendar-day,
  button.calendar-day,
  html[data-theme^="glass-"] .calendar-day,
  html[data-theme^="glass-"] button.calendar-day {
    border-color: rgba(170, 205, 219, 0.12);
    background: var(--day-color, #172631);
    color: var(--mobile-tracking-ink);
  }

  .calendar-day.is-empty,
  html[data-theme^="glass-"] .calendar-day.is-empty {
    border-color: transparent;
    background: #0c1720;
    color: rgba(155, 177, 188, 0.44);
  }

  .calendar-day.is-selected,
  html[data-theme^="glass-"] .calendar-day.is-selected {
    border-color: rgba(105, 189, 207, 0.7);
    box-shadow: 0 0 0 2px rgba(105, 189, 207, 0.16);
  }

  .history-section .ai-advice-button,
  html[data-theme^="glass-"] .history-section .ai-advice-button {
    border-color: rgba(170, 165, 234, 0.16);
    background: linear-gradient(135deg, rgba(116, 111, 190, 0.14), rgba(66, 145, 163, 0.11));
  }

  .history-section .ai-advice-action,
  html[data-theme^="glass-"] .history-section .ai-advice-action {
    background: rgba(170, 165, 234, 0.12);
    color: #c0bcf1;
    box-shadow: none;
  }

  .history-health-thumb,
  html[data-theme^="glass-"] .history-health-thumb {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
  }

  .history-health-thumb-label {
    color: var(--mobile-tracking-muted);
  }

  .mood-ai-button,
  html[data-theme^="glass-"] .mood-ai-button {
    background: rgba(170, 165, 234, 0.12);
    color: #c0bcf1;
  }

  .food-selection-backdrop,
  .manual-food-backdrop,
  .ai-summary-backdrop,
  html[data-theme^="glass-"] .ai-summary-backdrop {
    background: rgba(0, 5, 9, 0.66);
  }

  .food-selection-dialog::before,
  .manual-food-dialog::before,
  .ai-summary-panel::before {
    background: rgba(193, 220, 231, 0.2);
  }

  .food-selection-loading,
  html[data-theme^="glass-"] .food-selection-loading {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
  }

  .food-selection-loading strong {
    color: var(--mobile-tracking-ink);
  }

  .food-selection-loading p {
    color: var(--mobile-tracking-muted);
  }

  .food-portion-control input,
  .food-candidate-editor input,
  html[data-theme^="glass-"] .food-portion-control input,
  html[data-theme^="glass-"] .food-candidate-editor input {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-ink);
  }

  .food-selection-check strong,
  .food-candidate-editor label,
  .food-selection-total {
    color: var(--mobile-tracking-ink);
  }

  .food-selection-check em,
  .food-portion-control small {
    color: var(--mobile-tracking-muted);
  }

  .ai-summary-output blockquote,
  html[data-theme^="glass-"] .ai-summary-output blockquote {
    color: #a9bac3;
  }

  .markdown-table-wrap,
  html[data-theme^="glass-"] .markdown-table-wrap {
    border-color: var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-raised);
  }

  .markdown-table-wrap th,
  html[data-theme^="glass-"] .markdown-table-wrap th {
    background: var(--mobile-tracking-primary-soft);
    color: var(--mobile-tracking-primary-strong);
  }

  .markdown-table-wrap th,
  .markdown-table-wrap td {
    border-bottom-color: var(--mobile-tracking-line);
  }
}

/* iOS real-device pass: keep the AI report a full-width reading surface. */
@media (max-width: 1024px), (max-width: 1366px) and (any-pointer: coarse) {
  .ai-summary-backdrop,
  html[data-theme^="glass-"] body .ai-summary-backdrop {
    position: fixed;
    inset: 0;
    width: 100dvw;
    min-width: 100dvw;
    max-width: none;
    height: 100dvh;
    align-items: end;
    justify-items: stretch;
    margin: 0;
    padding:
      max(10px, env(safe-area-inset-top, 0px))
      env(safe-area-inset-right, 0px)
      0
      env(safe-area-inset-left, 0px);
    overflow: hidden;
  }

  .ai-summary-backdrop.is-open,
  html[data-theme^="glass-"] body .ai-summary-backdrop.is-open {
    background: rgba(7, 16, 23, 0.46);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .ai-summary-panel,
  html[data-theme^="glass-"] body .ai-summary-panel {
    width: calc(100dvw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    min-width: 0;
    max-width: none;
    height: calc(100dvh - max(10px, env(safe-area-inset-top, 0px)));
    max-height: none;
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 26px 26px 0 0;
    background: var(--mobile-tracking-surface);
    box-shadow: 0 -18px 56px rgba(7, 16, 23, 0.24);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .ai-summary-header,
  html[data-theme^="glass-"] body .ai-summary-header {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    min-height: 78px;
    gap: 12px;
    padding: 25px 18px 13px;
    background: var(--mobile-tracking-surface);
  }

  .ai-summary-header h2,
  html[data-theme^="glass-"] body .ai-summary-header h2 {
    font-size: clamp(21px, 5.8vw, 24px);
    line-height: 1.15;
  }

  .ai-summary-close,
  html[data-theme^="glass-"] body .ai-summary-close {
    flex: 0 0 auto;
    min-width: 58px;
    min-height: 44px;
    padding-inline: 14px;
    border-radius: 14px;
    font-size: 13px;
  }

  .ai-summary-content,
  html[data-theme^="glass-"] body .ai-summary-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 14px 18px calc(24px + env(safe-area-inset-bottom, 0px));
    background: var(--mobile-tracking-surface-soft);
    overscroll-behavior-y: contain;
    scroll-padding-block: 14px calc(24px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .ai-summary-status,
  html[data-theme^="glass-"] body .ai-summary-status {
    width: fit-content;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    margin: 0 0 12px;
    border-radius: 999px;
    padding: 5px 10px;
    background: var(--mobile-tracking-primary-soft);
    color: var(--mobile-tracking-primary-strong);
    font-size: 11px;
    line-height: 1.35;
  }

  .ai-summary-output,
  html[data-theme^="glass-"] body .ai-summary-output {
    width: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    color: var(--mobile-tracking-ink);
    font-size: clamp(14px, 3.85vw, 16px);
    font-weight: 500;
    line-height: 1.68;
    overflow-wrap: break-word;
  }

  .ai-summary-output h2,
  .ai-summary-output h3,
  .ai-summary-output h4 {
    margin: 24px 0 9px;
    line-height: 1.28;
  }

  .ai-summary-output h2:first-child,
  .ai-summary-output h3:first-child,
  .ai-summary-output h4:first-child {
    margin-top: 0;
  }

  .ai-summary-output h2 { font-size: 20px; }
  .ai-summary-output h3,
  .ai-summary-output h4 { font-size: 17px; }

  .ai-summary-output p,
  .ai-summary-output ul,
  .ai-summary-output ol,
  .ai-summary-output blockquote,
  .ai-summary-output .markdown-table-wrap {
    margin: 9px 0;
  }

  .ai-summary-output ul,
  .ai-summary-output ol {
    padding-left: 1.25em;
  }

  .ai-summary-output li + li {
    margin-top: 8px;
  }
}

@media (max-width: 1024px), (max-width: 1366px) and (any-pointer: coarse) {
  body.quick-weight-open {
    overflow: hidden;
  }

  .quick-weight-backdrop,
  html[data-theme^="glass-"] .quick-weight-backdrop {
    align-items: flex-end;
    justify-items: stretch;
    padding: 0;
    background: rgba(7, 16, 23, 0.48);
  }

  .quick-weight-dialog,
  html[data-theme^="glass-"] .quick-weight-dialog {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 720px);
    overflow-y: auto;
    overscroll-behavior: contain;
    display: grid;
    gap: 15px;
    border: 0;
    border-radius: 28px 28px 0 0;
    padding: 30px max(16px, var(--mobile-page-inline)) calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--mobile-tracking-surface-raised);
    color: var(--mobile-tracking-ink);
    box-shadow: 0 -20px 64px rgba(7, 20, 29, 0.24);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .quick-weight-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .quick-weight-header .eyebrow {
    margin: 0 0 3px;
    color: var(--mobile-tracking-primary);
    font-size: 10px;
    font-weight: 720;
    letter-spacing: 0.08em;
  }

  .quick-weight-header h2 {
    margin: 0;
    color: var(--mobile-tracking-ink);
    font-size: 23px;
    font-weight: 720;
    letter-spacing: -0.035em;
    line-height: 1.2;
  }

  .quick-weight-header .modal-icon-button,
  html[data-theme^="glass-"] .quick-weight-header .modal-icon-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 14px;
    padding: 0;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-muted);
    box-shadow: none;
  }

  .quick-weight-header .modal-icon-button svg {
    width: 18px;
    height: 18px;
  }

  .quick-weight-copy {
    margin: -4px 0 0;
    color: var(--mobile-tracking-muted);
    font-size: 12px;
    font-weight: 520;
    line-height: 1.5;
  }

  .quick-weight-field {
    display: grid;
    gap: 7px;
    color: var(--mobile-tracking-ink);
    font-size: 12px;
    font-weight: 680;
  }

  .quick-weight-field > span:first-child small {
    color: var(--mobile-tracking-muted);
    font-size: 10px;
    font-weight: 520;
  }

  .quick-weight-input-wrap {
    min-width: 0;
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(38, 122, 140, 0.2);
    border-radius: 20px;
    padding: 0 16px;
    background: var(--mobile-tracking-primary-soft);
  }

  .quick-weight-input-wrap input,
  html[data-theme^="glass-"] .quick-weight-input-wrap input {
    width: 100%;
    min-width: 0;
    min-height: 68px;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--mobile-tracking-ink);
    box-shadow: none;
    font-size: 31px;
    font-weight: 720;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
  }

  .quick-weight-input-wrap input:focus {
    outline: none;
  }

  .quick-weight-input-wrap strong {
    color: var(--mobile-tracking-primary-strong);
    font-size: 13px;
    font-weight: 700;
  }

  .quick-weight-mood-field > input,
  html[data-theme^="glass-"] .quick-weight-mood-field > input {
    min-height: 50px;
    border: 1px solid var(--mobile-tracking-line);
    border-radius: 16px;
    padding: 0 14px;
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-ink);
    box-shadow: none;
    font-size: 15px;
  }

  .quick-weight-message {
    min-height: 18px;
    margin: -4px 0;
    color: var(--mobile-tracking-muted);
    font-size: 11px;
    font-weight: 550;
    line-height: 1.45;
  }

  .quick-weight-message:empty {
    min-height: 0;
  }

  .quick-weight-message[data-tone="error"] { color: #af4d5d; }
  .quick-weight-message[data-tone="loading"] { color: var(--mobile-tracking-primary-strong); }

  .quick-weight-actions {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 9px;
  }

  .quick-weight-actions button,
  html[data-theme^="glass-"] .quick-weight-actions button {
    min-width: 0;
    min-height: 52px;
    border-radius: 17px;
    box-shadow: none;
    font-size: 13px;
    font-weight: 700;
  }

  .quick-weight-actions #quickWeightPhotoButton,
  html[data-theme^="glass-"] .quick-weight-actions #quickWeightPhotoButton {
    border: 1px solid var(--mobile-tracking-line);
    background: var(--mobile-tracking-surface-soft);
    color: var(--mobile-tracking-ink);
  }

  .quick-weight-actions #saveQuickWeightButton,
  html[data-theme^="glass-"] .quick-weight-actions #saveQuickWeightButton {
    border: 1px solid rgba(28, 98, 113, 0.34);
    background: var(--mobile-tracking-primary);
    color: #ffffff;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 1024px),
  (prefers-color-scheme: dark) and (max-width: 1366px) and (any-pointer: coarse) {
  .mobile-today-overview {
    background:
      radial-gradient(90% 100% at 100% 0%, rgba(89, 183, 202, 0.1), transparent 64%),
      radial-gradient(75% 90% at 0% 100%, rgba(205, 122, 162, 0.07), transparent 70%),
      var(--mobile-tracking-surface-raised);
  }

  .today-primary-metric,
  .today-secondary-metric {
    background: rgba(8, 21, 30, 0.54);
  }

  .today-record-status[data-tone="pending"] {
    background: rgba(180, 132, 53, 0.14);
    color: #d2ae70;
  }

  .today-insight {
    background: rgba(68, 151, 170, 0.1);
  }

  .quick-weight-backdrop,
  html[data-theme^="glass-"] .quick-weight-backdrop {
    background: rgba(0, 5, 9, 0.68);
  }
}
