*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 40px;
    color: #333;
    min-height: 100vh;
    background: none;
    position: relative;
    z-index: 0;
    --body-background-image: url("images/dashboard_background.png");
}

.page-loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.92), rgba(236, 72, 153, 0.92));
    color: #ffffff;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loading-overlay--default {
    background: rgba(15, 23, 42, 0.92);
}

.page-loading-overlay.slow-fade {
    transition: opacity 3s ease, visibility 3s ease;
}

.page-loading-overlay--mood {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.92), rgba(236, 72, 153, 0.92));
}

.page-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loading-logo {
    width: 96px;
    height: auto;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
    animation: pageLoadingLogoPulse 1.5s ease-in-out infinite;
    transform-origin: center;
}

.page-loading-text {
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.2px;
}

html {
    scrollbar-gutter: stable both-edges;
}

html,
body {
    overflow-x: hidden;
}

:root {
    --desktop-profile-top-offset: 24px;
    --desktop-profile-inline-offset: clamp(16px, 4vw, 48px);
    --profile-avatar-diameter: 44px;
    --modal-viewport-height: 100vh;
    --modal-viewport-offset: 0px;
    --modal-scrollbar-compensation: 0px;
    --jump-date-inline-offset-base: 12px;
    --jump-date-inline-offset: var(--jump-date-inline-offset-base);
    --floating-header-offset: 0px;
}

@media (max-width: 420px) {
    :root {
        --jump-date-inline-offset-base: 8px;
    }
}

html.modal-open {
    --jump-date-inline-offset: calc(
        var(--jump-date-inline-offset-base) - var(--modal-scrollbar-compensation, 0px)
    );
}

@supports (height: 100dvh) {
    :root {
        --modal-viewport-height: 100dvh;
    }
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: var(--body-background-image);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: none;
}

body.home-page::after,
body.settings-page::after,
body.stats-page::after {
    background: rgba(255, 255, 255, 0.45);
}

body.home-page {
    margin: 0;
    --home-frame-padding: clamp(6px, 2vw, 14px);
    padding: var(--home-frame-padding);
    --body-background-image: none;
    background-color: #ffffff;
}

@media (max-width: 768px) {
    body.home-page {
        --body-background-image: url("images/mobile%20background.png");
        background-color: transparent;
    }

    body.home-page::after {
        background: rgba(255, 255, 255, 0.45);
    }

    body.home-page::before {
        background-position: center top;
    }
}

@media (max-width: 768px) {
    body.modal-open {
        position: fixed;
        overflow: hidden;
        width: 100%;
        inset: 0 auto auto 0;
        padding-right: 0 !important;
    }
}

/* Coach Review mobile modal fix */
@media (max-width: 768px) {
  body.coach-review-standalone.modal-open {
    overflow: hidden !important; /* remove position:fixed hack */
    position: static !important;
    inset: auto !important;
    width: auto !important;
    padding-right: 0 !important;
  }

  html.coach-review-standalone.modal-open {
    overflow: hidden !important;
  }

  body.coach-review-standalone .coach-review-modal {
    z-index: 9999 !important;
    pointer-events: auto !important;
  }

  body.coach-review-standalone .coach-review-modal * {
    pointer-events: auto !important;
  }

  /* Ensure fixed UI bars do not block modal input */
  body.coach-review-standalone .mobile-action-bar,
  body.coach-review-standalone .quick-action-bar {
    z-index: 1000 !important;
  }
}

@media (max-width: 768px) {
    body.coach-review-page::before {
        background-image: url("images/mobile%20background.png");
        background-position: center top;
    }
}

/* ------------------------------------------------------------------ */
/* Coach review standalone redesign                                   */
/* ------------------------------------------------------------------ */

body.coach-review-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 4vw, 32px);
    padding: clamp(16px, 5vw, 32px);
    color: #0f172a;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 60%),
        radial-gradient(circle at bottom left, rgba(34, 197, 94, 0.18), transparent 55%),
        #f8fafc;
    --body-background-image: url("images/dashboard_background.png");
}

body.coach-review-page::after {
    background: rgba(255, 255, 255, 0.45);
}

.coach-review-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: min(960px, 100%);
    margin: 0 auto;
}

.coach-review-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1d4ed8;
    text-decoration: none;
}

.coach-review-back span[aria-hidden="true"] {
    font-size: 1.6rem;
    line-height: 1;
}

.coach-review-back:focus-visible,
.coach-review-back:hover {
    text-decoration: underline;
}

.coach-review-title {
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
}

.coach-mood-analyze {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: center;
    gap: 6px;
    text-align: center;
}

.coach-mood-analyze-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.coach-mood-analyze-btn:focus-visible,
.coach-mood-analyze-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.3);
}

.mood-analysis-usage {
    margin: 0;
}

.coach-review-main {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 4vw, 28px);
    width: min(960px, 100%);
    margin: 0 auto;
}

.coach-card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
    padding: clamp(18px, 5vw, 28px);
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 3vw, 20px);
}

.coach-card-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.coach-card-header h2 {
    margin: 0;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    font-weight: 700;
}

.coach-card-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #475569;
}

.coach-card-hero {
    display: none;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/*
    The product team wants the standalone coach review experience to mirror the
    mobile design even on large screens. To do that we apply the former
    mobile-only styles unconditionally while keeping them scoped to the
    coach-review page so other screens are unaffected.
*/
body.coach-review-page .coach-review-back,
body.coach-review-page .coach-review-header .coach-review-title {
    display: none;
}

body.coach-review-page .coach-review-main {
    padding-bottom: calc(clamp(120px, 24vh, 210px) + env(safe-area-inset-bottom, 0px));
}

body.coach-review-page .coach-card-header {
    align-items: center;
    text-align: center;
}

body.coach-review-page .coach-card-header h2,
body.coach-review-page .coach-card-header .coach-card-subtitle {
    text-align: center;
}

body.coach-review-page .coach-card-hero {
    display: block;
    max-width: min(240px, 70%);
    max-height: 160px;
    margin: 0 auto 8px;
}

body.coach-review-page #mobileActionBar {
    display: flex;
}

@media (min-width: 769px) {
    .mobile-action-bar {
        display: none;
    }
}

.coach-calendar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coach-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.coach-calendar-label {
    font-weight: 600;
}

.coach-calendar-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.coach-calendar-nav:hover {
    background: #bfdbfe;
    transform: scale(1.05);
}

.coach-calendar-nav:focus-visible {
    background: #bfdbfe;
    transform: scale(1.05);
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.coach-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
}

.coach-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.coach-calendar-cell {
    aspect-ratio: 1 / 1;
    border: none;
    border-radius: 12px;
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.coach-calendar-cell.is-outside,
.coach-calendar-cell.is-empty {
    cursor: default;
    background: #f1f5f9;
    color: #94a3b8;
}

.coach-calendar-cell.has-meal:not(.is-empty):not(.is-outside):not(.has-review) {
    background: #cbd5f5;
}

.coach-calendar-cell.has-review {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #022c22;
}

.coach-calendar-cell.is-selected {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.coach-calendar-cell:focus-visible,
.coach-calendar-cell:hover {
    transform: translateY(-1px);
}

.coach-calendar-cell:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.coach-status {
    margin: 0;
    font-size: 0.95rem;
    color: #1e293b;
}

.coach-usage {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
}

.coach-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.coach-actions button {
    flex: 1;
}

.coach-primary,
.coach-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.coach-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 14px 32px rgba(29, 78, 216, 0.35);
}

.coach-secondary {
    background: #e0f2fe;
    color: #0f172a;
    box-shadow: 0 10px 26px rgba(14, 165, 233, 0.25);
}

.coach-primary:disabled,
.coach-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.coach-primary:not(:disabled):focus-visible,
.coach-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(29, 78, 216, 0.45);
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.coach-secondary:not(:disabled):focus-visible,
.coach-secondary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(14, 165, 233, 0.35);
    outline: 3px solid rgba(14, 165, 233, 0.35);
    outline-offset: 2px;
}

.coach-week-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coach-week-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.coach-week-select {
    appearance: none;
    -webkit-appearance: none;
    border-radius: 16px;
    border: 1px solid #cbd5f5;
    padding: 12px 16px;
    font-size: 1rem;
    background: #f8fafc url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2363748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")
        no-repeat right 14px center/16px;
}

.coach-week-select:disabled {
    color: #94a3b8;
    border-color: #e2e8f0;
    background-color: #f8fafc;
}

.coach-week-select:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.coach-week-hint {
    margin: 0;
    font-size: 0.9rem;
    color: #475569;
}

.coach-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.coach-review-page .coach-overlay[hidden] {
    display: none !important;
}

.coach-overlay-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.coach-overlay-message {
    margin: 0;
    text-align: center;
}

.coach-overlay-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coach-overlay-video {
    display: block;
    width: min(280px, 80vw);
    max-width: 320px;
    border-radius: 16px;
    background: #000;
}

.coach-overlay-media .coach-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    --coach-spinner-offset: translate(-50%, -50%);
    display: none;
}

.coach-overlay-media .coach-spinner.is-visible {
    display: block;
}

.coach-overlay.spinner-only .coach-overlay-video {
    display: none;
}

.coach-overlay.spinner-only .coach-spinner {
    display: block;
}

.coach-spinner {
    --coach-spinner-offset: translate(0, 0);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 4px solid #bfdbfe;
    border-top-color: #2563eb;
    transform: var(--coach-spinner-offset) rotate(0deg);
    animation: coach-spin 1s linear infinite;
}

@keyframes coach-spin {
    to {
        transform: var(--coach-spinner-offset) rotate(360deg);
    }
}

.coach-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(12px, 5vw, 24px) clamp(16px, 6vw, 32px);
    z-index: 1100;
}

.coach-modal.is-open {
    display: flex;
}

.coach-modal-card {
    background: #ffffff;
    border-radius: 24px;
    width: min(520px, 100%);
    max-height: min(90vh, 620px);
    overflow-y: auto;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
}

.coach-modal-close {
    align-self: flex-end;
    border: none;
    background: none;
    font-size: 1.75rem;
    line-height: 1;
    padding: clamp(8px, 2.5vw, 14px);
    cursor: pointer;
    color: #1f2937;
}

.coach-modal-close:focus-visible,
.coach-modal-close:hover {
    color: #2563eb;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.coach-modal-body {
    padding: clamp(8px, 2.5vw, 16px) clamp(20px, 5vw, 28px) clamp(16px, 4vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.coach-modal-body h2 {
    margin: 0;
    font-size: clamp(1.2rem, 3.5vw, 1.6rem);
}

.coach-modal-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #475569;
}

.coach-modal-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 1rem;
    line-height: 1.6;
    color: #0f172a;
    text-align: center;
}

.mood-analysis-body {
    align-items: center;
    text-align: center;
}

.mood-analysis-hero {
    display: block;
    width: min(360px, 80vw);
    max-height: 260px;
    object-fit: contain;
    margin: 6px auto 8px;
}

.mood-analysis-content {
    width: 100%;
    display: grid;
    gap: 12px;
    text-align: left;
}

.mood-analysis-section {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    background: #f8fafc;
}

.mood-analysis-section h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    color: #0f172a;
}

.mood-analysis-section ul {
    margin: 0;
    padding-left: 18px;
    color: #0f172a;
    line-height: 1.5;
}

.mood-analysis-section li + li {
    margin-top: 4px;
}

.mood-analysis-footer {
    align-items: center;
}

.mood-analysis-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Mood analyzer page */
body.mood-analyzer-page {
    min-height: 100vh;
    margin: 0;
    padding: clamp(12px, 4vw, 28px);
    background-color: #0f172a;
    background-image: var(--body-background-image);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    --body-background-image: url("/images/mobilemoodbackground.png");
    color: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@media (min-width: 769px) {
    body.mood-analyzer-page {
        --body-background-image: url("/images/desktopmoodbackground.png");
    }
}

.mood-analyzer-hero {
    padding: clamp(10px, 3vw, 24px) 0 0;
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

.mood-analyzer-hero__glass {
    width: 100%;
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.92), rgba(124, 58, 237, 0.9));
    backdrop-filter: blur(14px);
    border-radius: 28px;
    padding: clamp(18px, 4vw, 32px);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
    text-align: center;
    color: #f8f5ff;
}

.mood-analyzer-kicker {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    font-size: 0.9rem;
    color: #d8cffb;
}

.mood-analyzer-title {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 800;
    color: #f8f5ff;
}

.mood-analyzer-subtitle {
    margin: 8px 0 0;
    font-size: 1rem;
    color: #f3e8ff;
}

.mood-analyzer-main {
    width: 100%;
    max-width: 960px;
    margin: clamp(14px, 4vw, 28px) auto clamp(120px, 8vh, 200px);
    padding: 0 clamp(10px, 4vw, 24px) clamp(20px, 5vw, 32px);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mood-week-controls,
.mood-analyzer-cta,
.mood-accordion,
.mood-empty,
.mood-loading {
    width: 100%;
}

.mood-week-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 10px 14px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.mood-week-label {
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f172a;
}

.mood-week-btn {
    border: none;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.mood-week-btn:disabled {
    background: rgba(148, 163, 184, 0.3);
    color: #475569;
    cursor: not-allowed;
    box-shadow: none;
}

.mood-week-btn:hover:not(:disabled),
.mood-week-btn:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
    outline: none;
}

.mood-week-current {
    align-self: center;
    border: none;
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.mood-week-current:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: none;
}

.mood-week-current:hover:not(:disabled),
.mood-week-current:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
    outline: none;
}

.mood-analyzer-cta {
    background: rgba(255, 255, 255, 0.94);
    padding: 18px 14px;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

.mood-analyzer-cta__helper {
    margin: 6px 0 0;
    color: #475569;
    font-size: 0.95rem;
}

.mood-accordion {
    background: rgba(255, 255, 255, 0.94);
    border-radius: 18px;
    padding: clamp(12px, 4vw, 18px);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.mood-accordion__item {
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    overflow: hidden;
    background: rgba(248, 250, 252, 0.9);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.mood-accordion__item.open {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.12);
}

.mood-accordion__header {
    width: 100%;
    border: none;
    background: transparent;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.mood-accordion__title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mood-emoji {
    font-size: 1.8rem;
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.mood-accordion__copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.mood-accordion__label {
    font-weight: 800;
    font-size: 1.05rem;
    color: #0f172a;
}

.mood-accordion__meta {
    color: #475569;
    font-size: 0.95rem;
}

.mood-accordion__chevron {
    width: 20px;
    height: 20px;
    border-right: 2px solid #0f172a;
    border-bottom: 2px solid #0f172a;
    transform: rotate(45deg);
    transition: transform 200ms ease;
}

.mood-accordion__item.open .mood-accordion__chevron {
    transform: rotate(225deg);
}

.mood-accordion__body {
    padding: 0 16px 14px;
    overflow: hidden;
    height: 0;
    opacity: 0;
    transition: height 220ms ease, opacity 220ms ease;
}

.mood-accordion__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mood-accordion__meal {
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.4);
}

.mood-accordion__meal-name {
    display: block;
    font-weight: 700;
    color: #0f172a;
}

.mood-accordion__meal-desc {
    display: block;
    color: #475569;
    margin-top: 4px;
    font-size: 0.95rem;
}

.mood-empty {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    width: 100%;
}

.mood-loading {
    text-align: center;
    padding: 12px;
    font-weight: 700;
    color: #1d4ed8;
    width: 100%;
}

@media (max-width: 768px) {
    .mood-week-controls {
        padding: 10px 12px;
    }
}

@media (max-width: 640px) {
    .mood-accordion__header {
        align-items: flex-start;
    }

    .mood-accordion__title {
        align-items: flex-start;
    }
}

.coach-modal-hero {
    width: clamp(120px, 38%, 180px);
    align-self: center;
    object-fit: contain;
    margin-top: clamp(4px, 1.5vw, 12px);
}

.coach-modal-text p {
    margin: 0;
}

.coach-modal-footer {
    margin-top: auto;
    padding: clamp(16px, 4vw, 24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.coach-modal-usage {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
    text-align: center;
}

@media (min-width: 720px) {
    .coach-review-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px 16px;
    }

    .coach-mood-analyze {
        flex-basis: 100%;
    }

    .coach-review-main {
        flex-direction: row;
        align-items: stretch;
    }

    .coach-card {
        flex: 1;
    }
}

#plantRing {
    --plant-ring-size: 44px;
    --plant-ring-track: rgba(255, 255, 255, 0.22);
    --plant-ring-inner: rgba(15, 23, 42, 0.85);
    --plant-ring-color: #f97316;
    --plant-ring-progress: 0;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + var(--floating-header-offset, 0px) + 12px);
    left: calc(env(safe-area-inset-left, 0px) + 12px);
    width: var(--plant-ring-size);
    height: var(--plant-ring-size);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    z-index: 1200;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-variant-numeric: tabular-nums;
    isolation: isolate;
}

html.modal-open #plantRing,
html.modal-open #nutrientRingStack {
    z-index: 900;
    pointer-events: none;
}

html.modal-open #plantRing *,
html.modal-open #nutrientRingStack * {
    pointer-events: none;
}

#plantRing::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(var(--plant-ring-color) calc(var(--plant-ring-progress) * 1turn), var(--plant-ring-track) 0deg);
}

#plantRing::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--plant-ring-inner);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

#plantRing .plant-ring-count {
    position: relative;
    z-index: 1;
    font-size: 0.9rem;
}

#plantRing .plant-ring-leaf {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    z-index: 2;
}

#plantRing .plant-ring-leaf::before {
    content: "";
    width: 9px;
    height: 6px;
    background: #fff;
    border-radius: 60% 60% 40% 40%;
    transform: rotate(-40deg);
}

#plantRing:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.45), 0 6px 18px rgba(15, 23, 42, 0.25);
    transform: translateY(-1px);
}

#plantRing:not([hidden]):hover {
    transform: translateY(-1px);
}

#plantRing:not([hidden]):active {
    transform: scale(0.96);
}

#plantRing[hidden] {
    display: none !important;
}

#plantRing[disabled],
#plantRing.plant-ring--static {
    cursor: default;
    pointer-events: none;
    transform: none;
}

#plantRing[disabled]::before,
#plantRing.plant-ring--static::before,
#plantRing[disabled]::after,
#plantRing.plant-ring--static::after {
    animation: none;
}

body.home-page #plantRing {
    display: inline-flex;
}

@media (max-width: 768px) {
    #plantRing {
        display: inline-flex;
    }
}

#plantRing.plant-ring--low {
    --plant-ring-color: #f97316;
}

#plantRing.plant-ring--mid {
    --plant-ring-color: #a3e635;
}

#plantRing.plant-ring--high {
    --plant-ring-color: #22c55e;
}

#plantRing.plant-ring--complete {
    --plant-ring-color: #16a34a;
    --plant-ring-inner: rgba(21, 128, 61, 0.92);
}

#plantRing.plant-ring--pulse {
    animation: plantRingPulse 1.1s ease-out;
}

#plantRing.plant-ring--pulse::after {
    animation: plantRingPulseInner 1.1s ease-out;
}

#nutrientRingStack {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + var(--floating-header-offset, 0px) + 12px);
    right: calc(env(safe-area-inset-right, 0px) + 12px);
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    z-index: 1200;
}

#nutrientRingStack[hidden] {
    display: none !important;
}

body.home-page #nutrientRingStack {
    display: flex;
}

@media (max-width: 768px) {
    #nutrientRingStack {
        display: flex;
    }
}

@media (min-width: 769px) {
    body.home-page #plantPanelSlot {
        display: none !important;
    }
}

.nutrient-ring {
    --nutrient-ring-size: 44px;
    --nutrient-ring-track: rgba(255, 255, 255, 0.22);
    --nutrient-ring-inner: #ffffff;
    --nutrient-ring-color: #38bdf8;
    --nutrient-ring-progress: 0;
    position: relative;
    width: var(--nutrient-ring-size);
    height: var(--nutrient-ring-size);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    isolation: isolate;
}

.nutrient-ring::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(var(--nutrient-ring-color) calc(var(--nutrient-ring-progress) * 1turn), var(--nutrient-ring-track) 0deg);
}

.nutrient-ring::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--nutrient-ring-inner);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.nutrient-ring:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.45), 0 6px 18px rgba(15, 23, 42, 0.25);
    transform: translateY(-1px);
}

.nutrient-ring:hover {
    transform: translateY(-1px);
}

.nutrient-ring:active {
    transform: scale(0.96);
}

.nutrient-ring[hidden] {
    display: none !important;
}

.nutrient-ring-icon {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    object-fit: contain;
    pointer-events: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
}

.nutrient-ring--calories {
    --nutrient-ring-color: #fb923c;
}

.nutrient-ring--protein {
    --nutrient-ring-color: #38bdf8;
}

.nutrient-ring--fat {
    --nutrient-ring-color: #facc15;
}

.nutrient-ring--carbs {
    --nutrient-ring-color: #22c55e;
}

.nutrient-ring--fiber {
    --nutrient-ring-color: #a855f7;
}

.nutrient-ring--sugars {
    --nutrient-ring-color: #fb7185;
}

.nutrient-ring--salt {
    --nutrient-ring-color: #60a5fa;
}

.nutrient-ring--vitamin_c {
    --nutrient-ring-color: #f97316;
}

.nutrient-ring--vitamin_d {
    --nutrient-ring-color: #fde047;
}

.nutrient-ring--iron {
    --nutrient-ring-color: #ef4444;
}

.nutrient-ring--folate {
    --nutrient-ring-color: #34d399;
}

.nutrient-ring--magnesium {
    --nutrient-ring-color: #0ea5e9;
}

.nutrient-ring--vitamin_b12 {
    --nutrient-ring-color: #c084fc;
}

.nutrient-ring--goal-met {
    --nutrient-ring-inner: rgba(21, 128, 61, 0.92);
}

.nutrient-ring--pulse {
    animation: plantRingPulse 1.1s ease-out;
}

.nutrient-ring--pulse::after {
    animation: plantRingPulseInner 1.1s ease-out;
}

@keyframes plantRingPulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
    }
    45% {
        transform: scale(1.08);
        box-shadow: 0 10px 24px rgba(34, 197, 94, 0.38);
    }
}

@keyframes plantRingPulseInner {
    0%,
    100% {
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    }
    45% {
        box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.32);
    }
}

body.auth-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 5vw, 48px);
    position: relative;
    overflow: hidden;
    --auth-primary: #15803d;
    --auth-primary-dark: #166534;
    --auth-primary-light: #22c55e;
    --auth-primary-pale: rgba(187, 247, 208, 0.85);
    --auth-surface: transparent;
}

body.auth-body::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 18% -8%, rgba(21, 128, 61, 0.28), transparent 55%),
        radial-gradient(circle at 78% 108%, rgba(34, 197, 94, 0.2), transparent 62%),
        linear-gradient(160deg, rgba(255, 255, 255, 0.05), transparent 70%);
    z-index: -1;
}

.icon-rain-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

.falling-icon {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.9;
    pointer-events: none;
    will-change: transform, opacity;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.08));
    transition: opacity 0.45s ease;
}

.falling-icon.fade-out {
    opacity: 0;
}

.auth-card .auth-card-header,
.auth-card .auth-toggle,
.auth-card .auth-forms,
.auth-card .auth-info-panel,
.auth-card .auth-status {
    position: relative;
    z-index: 5;
}

h1 {
    color: #222;
}

form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

button {
    background: #007bff;
    color: white;
    padding: 8px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background: #0056b3;
}

body.settings-page {
    margin: 40px auto;
    max-width: 960px;
    padding: 0 20px 60px;
}

body.legal-page {
    margin: 0 auto;
    max-width: 960px;
    padding: clamp(24px, 5vw, 64px) clamp(16px, 6vw, 56px) clamp(48px, 8vw, 96px);
    color: #0f172a;
    background: #f8fafc;
    --body-background-image: none;
}

body.legal-page::before,
body.legal-page::after {
    content: none;
}

.legal-header {
    display: flex;
    align-items: center;
    gap: clamp(16px, 5vw, 32px);
    margin-bottom: clamp(24px, 6vw, 48px);
}

.legal-logo-link {
    display: inline-flex;
    align-items: center;
}

.legal-logo {
    width: clamp(64px, 12vw, 96px);
    height: auto;
}

.legal-header-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.legal-header-text h1 {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    color: #0f172a;
}

.legal-header-text p {
    margin: 4px 0 0;
    color: #475569;
    font-size: 0.95rem;
}

.legal-header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 4px;
}

.legal-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid #1d4ed8;
    background: #eef2ff;
    color: #1d4ed8;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 24px -12px rgba(37, 99, 235, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.legal-nav-btn:hover {
    background: #dbeafe;
    box-shadow: 0 16px 28px -14px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
}

.legal-nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 10px 20px -12px rgba(37, 99, 235, 0.35);
}

.legal-content {
    display: grid;
    gap: clamp(20px, 4vw, 32px);
}

.legal-section {
    background: #ffffff;
    border-radius: 16px;
    padding: clamp(20px, 4vw, 32px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.legal-section h2 {
    margin-top: 0;
    color: #0f172a;
}

.legal-section h3 {
    margin-top: clamp(16px, 4vw, 24px);
    color: #0f172a;
}

.legal-section ul {
    margin: 12px 0;
    padding-left: 20px;
    color: #1f2937;
}

.legal-section li + li {
    margin-top: 8px;
}

.legal-footer {
    margin-top: clamp(40px, 8vw, 80px);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    color: #475569;
    font-size: 0.95rem;
}

.legal-footer a {
    color: #0f172a;
    text-decoration: underline;
}

@media (max-width: 640px) {
    body.legal-page {
        padding: clamp(24px, 8vw, 48px) clamp(16px, 8vw, 32px) clamp(48px, 10vw, 72px);
    }

    .legal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .legal-logo {
        width: 72px;
    }
}

body.stats-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--desktop-profile-top-offset) var(--desktop-profile-inline-offset) 64px;
    --body-background-image: url("images/stats_background.png");
}

@media (max-width: 768px) {
    body.stats-page {
        --body-background-image: url("images/mobile_stats_background.png");
    }
}

body.stats-page #top-bar {
    padding: 0;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: clamp(12px, 3vw, 24px);
}

body.stats-page .stats-layout {
    width: min(1080px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "stats-top"
        "stats-main"
        "stats-export";
    gap: clamp(20px, 5vw, 32px);
    flex: 1;
}

body.stats-page #top-bar {
    grid-area: stats-top;
}

body.stats-page .stats-container {
    grid-area: stats-main;
}

body.stats-page .stats-layout-export {
    grid-area: stats-export;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: clamp(16px, 5vw, 28px) auto clamp(48px, 12vw, 80px);
}

body.stats-page .stats-export-btn {
    background: transparent;
    border: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 999px;
    line-height: 0;
    box-shadow: none;
}

body.stats-page .stats-back-btn {
    display: none;
    align-items: center;
    gap: 8px;
    border: none;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.1;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

body.stats-page .stats-back-btn:hover,
body.stats-page .stats-back-btn:focus {
    background: rgba(37, 99, 235, 0.16);
    color: #1d4ed8;
}

body.stats-page .stats-back-btn:active {
    background: rgba(37, 99, 235, 0.22);
    color: #1e3a8a;
}

body.stats-page .stats-back-btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.65);
    outline-offset: 2px;
}

body.stats-page .stats-back-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-right: 2px;
}

body.stats-page .stats-export-btn:hover,
body.stats-page .stats-export-btn:focus,
body.stats-page .stats-export-btn:active {
    background: transparent;
}

body.stats-page .mobile-stats-btn {
    display: inline-flex;
    width: clamp(44px, 12vw, 56px);
    height: auto;
    text-decoration: none;
}

body.stats-page .stats-export-btn {
    width: clamp(120px, 48vw, 176px);
}

@media (max-width: 900px) {
    body.stats-page .stats-back-btn {
        display: inline-flex;
        margin-left: auto;
    }

    body.stats-page .stats-layout {
        gap: clamp(20px, 6vw, 36px);
    }

    body.stats-page .stats-export-btn .mobile-stats-img {
        width: 100%;
    }
}

@media (min-width: 901px) {
    body.stats-page .stats-layout {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "stats-top stats-export"
            "stats-main stats-main";
        align-items: start;
    }

    body.stats-page .stats-layout-export {
        justify-content: flex-end;
        margin: 0;
        align-self: start;
    }

body.stats-page .stats-export-btn {
    width: clamp(44px, 12vw, 56px);
}
}

html.nutrient-ring-picker-open,
body.nutrient-ring-picker-open {
    overflow: hidden;
    touch-action: none;
}

.nutrient-ring-picker {
    position: fixed;
    inset: 0;
    z-index: 1700;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 16px 16px;
    width: 100%;
}

.nutrient-ring-picker[hidden] {
    display: none !important;
}

.nutrient-ring-picker__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    pointer-events: auto;
    z-index: 0;
}

.nutrient-ring-picker__sheet {
    position: relative;
    pointer-events: auto;
    width: min(420px, 100%);
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    padding: 28px 24px calc(24px + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -18px 36px rgba(15, 23, 42, 0.18);
    color: #0f172a;
    max-height: calc(85vh - env(safe-area-inset-bottom, 0));
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1;
    margin: 0 auto;
    overscroll-behavior: contain;
}

.nutrient-ring-picker__header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-right: 60px;
}

.nutrient-ring-picker__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
}

.nutrient-ring-picker__subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: #475569;
}

.nutrient-ring-picker__options {
    display: grid;
    gap: 8px;
    max-height: min(60vh, 360px);
    overflow-y: auto;
    padding-right: 4px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.nutrient-ring-picker__options::-webkit-scrollbar {
    width: 6px;
}

.nutrient-ring-picker__options::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 999px;
}

.nutrient-ring-picker__close {
    position: absolute;
    top: -6px;
    right: 0;
    border: none;
    background: transparent;
    color: #475569;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nutrient-ring-picker__close:is(:hover, :focus-visible) {
    outline: none;
    background: rgba(226, 232, 240, 0.7);
    color: #0f172a;
}

.nutrient-ring-picker__option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 10px 14px;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.nutrient-ring-picker__option:is(:hover, :focus-visible) {
    outline: none;
    background: #e2e8f0;
    border-color: rgba(59, 130, 246, 0.45);
    transform: translateY(-1px);
}

.nutrient-ring-picker__option:active {
    transform: scale(0.98);
}

.nutrient-ring-picker__option[aria-current="true"] {
    border-color: rgba(14, 165, 233, 0.55);
    background: rgba(14, 165, 233, 0.14);
}

.nutrient-ring-picker__option[aria-current="true"]::after {
    content: "\2713";
    margin-left: auto;
    font-weight: 700;
    color: #0ea5e9;
}

.nutrient-ring-picker__icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    object-fit: contain;
    flex-shrink: 0;
}

.nutrient-ring-picker__label {
    flex: 1 1 auto;
}

.nutrient-ring-picker__empty {
    margin: 4px 0;
    padding: 12px 8px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
    text-align: center;
    font-size: 0.92rem;
}

@media (min-width: 640px) {
    .nutrient-ring-picker {
        padding-bottom: 24px;
    }

    .nutrient-ring-picker__sheet {
        border-radius: 24px;
        padding: 28px 28px calc(24px + env(safe-area-inset-bottom, 0));
    }

    .nutrient-ring-picker__title {
        font-size: 1.2rem;
    }
}

.stats-container {
    width: min(1080px, 100%);
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stats-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    padding: clamp(20px, 4vw, 36px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.stats-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: clamp(16px, 4vw, 40px);
    flex-wrap: wrap;
}

.stats-card-header h1 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.6rem, 2.5vw, 2.2rem);
}

.stats-subtitle {
    margin: 8px 0 0 0;
    color: #475569;
    font-size: 0.98rem;
}

.stats-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
}

.stats-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-filter--view {
    min-width: max-content;
}

.stats-toggle-group {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.05);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.4);
}

.stats-toggle-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.92rem;
    font-weight: 600;
    color: #475569;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.stats-toggle-btn:is(:hover, :focus-visible) {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
    outline: none;
}

.stats-toggle-btn.is-active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.15);
}

.stats-filter--week[hidden] {
    display: none;
}

.stats-filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stats-select {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(255, 255, 255, 0.96);
    font-size: 0.98rem;
    min-width: 180px;
    color: #0f172a;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.stats-input {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(255, 255, 255, 0.96);
    font-size: 0.98rem;
    min-width: 140px;
    color: #0f172a;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    appearance: textfield;
}

.stats-input::-webkit-outer-spin-button,
.stats-input::-webkit-inner-spin-button {
    margin: 0;
}

.stats-select:focus {
    outline: 3px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.stats-input:focus {
    outline: 3px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.stats-chart-area {
    position: relative;
    min-height: clamp(320px, 48vh, 520px);
}

.stats-chart {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    height: 100%;
    min-height: clamp(260px, 42vh, 420px);
    padding: clamp(16px, 3vw, 32px);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.7), rgba(226, 232, 240, 0.5));
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.7), 0 28px 56px rgba(15, 23, 42, 0.12);
    transition: opacity 0.4s ease;
    overflow: hidden;
}

.stats-chart[aria-hidden="true"],
.stats-chart--empty {
    opacity: 0.2;
}

.stats-chart-canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
}

.stats-chart-canvas--hidden {
    visibility: hidden;
}

.stats-chart-canvas--interactive {
    cursor: pointer;
    touch-action: manipulation;
}

.stats-chart-title {
    margin: 0 0 clamp(12px, 2vw, 18px);
    font-size: clamp(1.05rem, 1.6vw + 0.8rem, 1.35rem);
    font-weight: 600;
    color: #0f172a;
}

.stats-chart-description {
    margin: -0.25rem 0 clamp(14px, 3vw, 22px);
    color: #4b5563;
    font-size: clamp(0.9rem, 1.1vw + 0.65rem, 1rem);
    line-height: 1.55;
}

.stats-chart-area--pie {
    margin-top: clamp(24px, 4vw, 40px);
    min-height: clamp(280px, 44vh, 440px);
}

.stats-chart-area--pie .stats-chart {
    min-height: clamp(240px, 38vh, 360px);
    padding: clamp(18px, 5vw, 36px);
    align-items: center;
}

.stats-chart-area--pie .stats-chart-canvas {
    max-width: min(460px, 92vw);
    margin: 0 auto;
}

.stats-chart--pie {
    flex-direction: column;
    justify-content: center;
}

.stats-empty {
    position: absolute;
    inset: 0;
    margin: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1rem;
    color: #475569;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 18px;
    padding: 24px;
}

.stats-empty.error {
    color: #b91c1c;
}

.stats-export-modal .modal-content {
    margin: clamp(24px, 10vh, 80px) auto;
    width: min(92vw, 520px);
    max-width: 520px;
    border-radius: 24px;
    padding: clamp(24px, 5vw, 32px);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
}

.stats-export-modal-content {
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 3vw, 24px);
    position: relative;
}

.stats-mobile-export-modal-card {
    max-width: 420px;
    width: min(420px, 92vw);
}

.stats-mobile-export-modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-align: center;
    align-items: center;
}

.stats-mobile-export-modal-title {
    margin: 0;
    font-size: clamp(1.25rem, 4vw, 1.45rem);
    color: #0f172a;
}

.stats-mobile-export-modal-description {
    margin: 0;
    font-size: 1rem;
    color: #475569;
}

.stats-mobile-export-modal-close {
    min-width: 140px;
}

.stats-food-group-modal {
    --food-group-accent: #0ea5e9;
}

.stats-food-group-modal-card {
    width: min(520px, 92vw);
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 3vw, 24px);
    position: relative;
    padding: clamp(24px, 5vw, 32px);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
}

.stats-food-group-modal-header {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 2vw, 16px);
    padding-right: clamp(32px, 6vw, 48px);
    position: relative;
}

.stats-food-group-modal-header::before {
    content: "";
    display: inline-block;
    width: 48px;
    height: 4px;
    border-radius: 999px;
    background: var(--food-group-accent);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.stats-food-group-modal-title {
    margin: 0;
    font-size: clamp(1.2rem, 2vw + 0.8rem, 1.5rem);
    font-weight: 700;
    color: #0f172a;
}

.stats-food-group-modal-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #475569;
}

.stats-food-group-modal-close {
    position: absolute;
    top: clamp(12px, 2vw, 18px);
    right: clamp(12px, 2vw, 18px);
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.stats-food-group-modal-close:hover,
.stats-food-group-modal-close:focus-visible {
    background: rgba(59, 130, 246, 0.18);
    outline: none;
}

.stats-food-group-modal-body {
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 2vw, 18px);
    max-height: min(60vh, 420px);
}

.stats-food-group-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: min(52vh, 360px);
    padding-right: 4px;
}

.stats-food-group-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(241, 245, 249, 0.75);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stats-food-group-item-body {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.stats-food-group-item-indicator {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex-shrink: 0;
    margin-top: 6px;
    background: var(--food-group-accent);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18);
}

.stats-food-group-item-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
}

.stats-food-group-item-title {
    margin: 0;
    font-weight: 600;
    color: #0f172a;
}

.stats-food-group-item-meta {
    margin: 0;
    font-size: 0.9rem;
    color: #475569;
}

.stats-food-group-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-food-group-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(248, 113, 113, 0.15);
    color: #b91c1c;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.stats-food-group-remove-btn:hover,
.stats-food-group-remove-btn:focus-visible {
    background: rgba(248, 113, 113, 0.28);
    color: #991b1b;
    outline: none;
}

.stats-food-group-remove-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.stats-food-group-empty {
    margin: 0;
    padding: clamp(16px, 3vw, 20px);
    text-align: center;
    color: #475569;
    border-radius: 18px;
    background: rgba(241, 245, 249, 0.7);
}

.stats-food-group-empty[hidden] {
    display: none;
}

.stats-confirm-modal {
    --stats-confirm-accent: #ef4444;
    --stats-confirm-accent-soft: rgba(239, 68, 68, 0.12);
}

.stats-confirm-modal-card {
    width: min(500px, 94vw);
    max-width: 520px;
    display: grid;
    gap: 14px;
    padding: clamp(22px, 5vw, 30px);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.24);
}

.stats-confirm-body {
    display: grid;
    gap: 14px;
}

.stats-confirm-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--stats-confirm-accent-soft);
    color: var(--stats-confirm-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.stats-confirm-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--stats-confirm-accent-soft);
    color: var(--stats-confirm-accent);
    font-weight: 600;
    width: fit-content;
    margin: 0;
}

.stats-confirm-title {
    margin: 0;
    font-size: clamp(1.2rem, 2vw + 0.8rem, 1.5rem);
    color: #0f172a;
}

.stats-confirm-description {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

.stats-confirm-note {
    margin: 0;
    color: #64748b;
    line-height: 1.55;
    font-size: 0.95rem;
}

.stats-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.stats-confirm-btn {
    flex: 1 1 150px;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.stats-confirm-btn:active {
    transform: translateY(1px);
}

.stats-confirm-cancel {
    background: #e2e8f0;
    color: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stats-confirm-cancel:hover,
.stats-confirm-cancel:focus-visible {
    background: #cbd5e1;
    outline: none;
}

.stats-confirm-remove {
    background: var(--stats-confirm-accent);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(239, 68, 68, 0.28);
}

.stats-confirm-remove:hover,
.stats-confirm-remove:focus-visible {
    background: #dc2626;
    outline: none;
}

.stats-confirm-remove:disabled,
.stats-confirm-cancel:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: none;
}

@media (max-width: 540px) {
    .stats-confirm-modal-card {
        padding: clamp(20px, 6vw, 26px);
    }

    .stats-confirm-actions {
        flex-direction: column;
    }

    .stats-confirm-btn {
        width: 100%;
    }
}

.stats-export-close-btn {
    position: absolute;
    top: clamp(12px, 2vw, 18px);
    right: clamp(12px, 2vw, 18px);
    border: none;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    font-size: 1.6rem;
    font-weight: 600;
    border-radius: 999px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.stats-export-close-btn:hover,
.stats-export-close-btn:focus-visible {
    background: rgba(59, 130, 246, 0.18);
    color: #0f172a;
    outline: none;
}

.stats-export-subtitle {
    margin: 0;
    color: #475569;
    font-size: 0.98rem;
}

.stats-export-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: clamp(16px, 3vw, 20px);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.05);
}

.stats-export-description {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
}

.stats-export-form {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
}

.stats-export-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-export-label {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.stats-export-action {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.stats-export-action[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    body.stats-page {
        padding: 16px 12px 48px;
    }

    .stats-card {
        border-radius: 18px;
        padding: 20px;
        padding-bottom: clamp(28px, 9vw, 52px);
        min-height: clamp(640px, 118vh, 880px);
    }

    .stats-filter--view {
        width: 100%;
    }

    .stats-toggle-group {
        width: 100%;
        justify-content: space-between;
    }

    .stats-toggle-btn {
        flex: 1;
    }

    .stats-select {
        min-width: unset;
    }

    .stats-chart {
        min-height: clamp(220px, 45vh, 360px);
        padding: 16px;
    }

    .stats-chart-canvas {
        max-height: 360px;
    }

    .stats-chart-area--pie {
        margin-top: clamp(20px, 6vw, 28px);
        min-height: 320px;
    }

    .stats-chart-area--pie .stats-chart {
        min-height: 300px;
        padding: clamp(16px, 7vw, 28px);
    }

    .stats-chart-area--pie .stats-chart-canvas {
        height: auto !important;
        max-height: none;
        aspect-ratio: 1 / 1;
        width: min(420px, 96vw);
        display: block;
        margin: 0 auto;
    }

    .stats-chart-area--pie .stats-chart-description {
        margin: 4px 0 10px;
    }

    .stats-chart-title {
        text-align: center;
    }

    .stats-chart-description {
        text-align: center;
    }

    .stats-food-group-modal-card {
        width: min(94vw, 420px);
        padding: clamp(20px, 6vw, 28px);
        gap: 18px;
    }

    .stats-food-group-modal-body {
        max-height: min(66vh, 380px);
    }

    .stats-food-group-list {
        max-height: min(58vh, 320px);
    }

    .stats-food-group-item {
        padding: 12px;
    }

    .stats-food-group-item-body {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .stats-food-group-item-actions {
        align-self: flex-end;
        justify-content: flex-end;
    }

    .stats-food-group-remove-btn {
        width: auto;
        min-width: 0;
        justify-content: center;
        padding-inline: 14px;
    }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.settings-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.settings-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.settings-footer {
    margin: 32px 0 0;
    padding: 16px 0 40px;
    text-align: center;
    color: #475569;
    font-size: 0.95rem;
}

.settings-footer a {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: underline;
}

.settings-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(6px);
}

.settings-card.goals-card {
    padding-bottom: 16px;
}

.account-auth-provider {
    margin: 12px 0 24px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-provider-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-method-fieldset {
    border: none;
    margin: 4px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-method-fieldset legend {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.login-method-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.login-method-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.login-method-option:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #1d4ed8;
}

.login-method-option input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.login-method-option span {
    white-space: nowrap;
}

.login-method-option.is-selected {
    background: rgba(59, 130, 246, 0.24);
    color: #1d4ed8;
}

.login-method-option.is-disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.login-method-option.is-disabled:hover {
    background: rgba(15, 23, 42, 0.05);
    color: inherit;
}

.account-auth-provider[hidden] {
    display: none !important;
}

.account-auth-description {
    margin: 0;
    font-size: 0.9rem;
    color: #1e3a8a;
}

.auth-method-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: rgba(59, 130, 246, 0.14);
    color: #1d4ed8;
    white-space: nowrap;
}

.auth-method-badge.auth-method-google {
    background: rgba(66, 133, 244, 0.18);
    color: #1a73e8;
}

.auth-method-badge.auth-method-apple {
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
}

.auth-method-badge.auth-method-password {
    background: rgba(15, 23, 42, 0.12);
    color: #0f172a;
}

.account-management-card {
    padding: 0;
    overflow: hidden;
}

.settings-collapsible {
    border: none;
    margin: 0;
    padding: 0;
    display: block;
}

.settings-collapsible summary {
    list-style: none;
}

.settings-collapsible__summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.95);
    transition: background 0.2s ease;
}

.settings-collapsible__summary:focus {
    outline: none;
}

.settings-collapsible:focus-visible .settings-collapsible__summary,
.settings-collapsible__summary:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.55);
    outline-offset: -4px;
}

.settings-collapsible__summary:hover {
    background: rgba(249, 250, 251, 0.98);
}

.settings-collapsible__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

.settings-collapsible__icon {
    width: 18px;
    height: 18px;
    border-right: 2px solid #4b5563;
    border-bottom: 2px solid #4b5563;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}

.settings-collapsible[open] .settings-collapsible__icon {
    transform: rotate(45deg);
}

.settings-collapsible__content {
    padding: 0 32px 28px;
    background: rgba(248, 250, 252, 0.92);
    border-top: 1px solid rgba(148, 163, 184, 0.3);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-collapsible__description {
    margin: 0;
    color: #4b5563;
    font-size: 0.95rem;
}

.settings-collapsible__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.settings-collapsible__actions .secondary-btn {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.settings-collapsible__actions .secondary-btn:hover,
.settings-collapsible__actions .secondary-btn:focus {
    background: rgba(59, 130, 246, 0.24);
}

.settings-collapsible__actions .secondary-btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.55);
    outline-offset: 2px;
}

.settings-collapsible__actions .secondary-btn:active {
    transform: translateY(1px);
}

.settings-collapsible__actions .secondary-btn.is-disabled,
.settings-collapsible__actions .secondary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

@media (max-width: 640px) {
    .settings-collapsible__summary {
        padding: 20px 22px;
    }

    .settings-collapsible__content {
        padding: 0 22px 24px;
    }
}

body.account-manage-page {
    margin: 40px auto;
    max-width: 720px;
    padding: 0 20px 60px;
}

.account-manage-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 32px;
}

.account-subscription-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.account-subscription-top-bar .top-bar-right {
    margin-left: auto;
}

.account-subscription-top-bar .profile-menu-wrapper {
    margin-left: 0;
}

.account-manage-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    color: #0f172a;
}

.account-manage-subtitle {
    margin: 0;
    color: #475569;
    line-height: 1.6;
    max-width: 56ch;
}

.account-manage-back {
    font-weight: 600;
    color: #1d4ed8;
}

.account-manage-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.account-manage-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(6px);
}

.account-overview-card h2,
.danger-zone-card h2 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: clamp(1.4rem, 2.5vw, 1.75rem);
    color: #0f172a;
}

.account-overview-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px 24px;
}

.account-overview-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-overview-item dt {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.account-overview-item dd {
    margin: 0;
    font-size: 1.05rem;
    color: #111827;
    word-break: break-word;
}

.danger-zone-card {
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(254, 242, 242, 0.95);
}

.danger-zone-description,
.danger-zone-confirmation {
    margin-top: 0;
    margin-bottom: 16px;
    color: #7f1d1d;
    line-height: 1.6;
}

.danger-zone-confirmation {
    font-weight: 600;
}

.delete-account-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-hint {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: #475569;
}

.delete-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.danger-btn {
    background: #ef4444;
    color: #f8fafc;
    padding: 10px 22px;
    border-radius: 999px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.danger-btn:hover,
.danger-btn:focus {
    background: #dc2626;
}

.danger-btn:active {
    transform: scale(0.98);
}

.danger-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.danger-btn .button-spinner {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid rgba(248, 250, 252, 0.55);
    border-top-color: #f8fafc;
    animation: button-spinner 0.9s linear infinite;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.danger-btn .button-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.danger-btn.is-loading .button-spinner {
    opacity: 1;
    transform: scale(1);
}

.danger-btn.is-loading .button-text {
    opacity: 0.9;
}

@keyframes button-spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.account-manage-status {
    min-height: 1.4em;
    font-weight: 600;
}

.account-manage-status--info {
    color: #1d4ed8;
}

.account-manage-status--error {
    color: #b91c1c;
}

.account-manage-status--success {
    color: #047857;
}

.account-subscription-page .subscription-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.subscription-card-subtitle {
    margin-top: 4px;
    color: #4b5563;
    font-size: 0.95rem;
}

.subscription-status-pill {
    align-self: flex-start;
    background: #e5e7eb;
    color: #111827;
    border-radius: 999px;
    font-weight: 600;
    padding: 6px 16px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.subscription-status-pill.is-premium {
    background: #1d4ed8;
    color: #f9fafb;
}

.subscription-status-pill.is-special {
    background: #7c3aed;
    color: #f9fafb;
}

.subscription-summary-list {
    display: grid;
    gap: 12px 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
}

.subscription-summary-item dt {
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.subscription-summary-item dd {
    margin: 0;
    color: #111827;
}

.subscription-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.subscription-actions.advanced {
    margin-top: 20px;
}

.subscription-hint {
    margin-top: 16px;
    color: #4b5563;
}

.subscription-advanced-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #1f2937;
    list-style: none;
}

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

.subscription-advanced-details[open] summary {
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .subscription-summary-list {
        grid-template-columns: 1fr;
    }

    .account-subscription-page .subscription-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    body.account-manage-page {
        margin: 24px auto 48px;
        padding: 0 16px 48px;
    }

    .account-manage-card {
        padding: 24px 20px;
    }

    .account-overview-list {
        grid-template-columns: 1fr;
    }

    .delete-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .danger-btn,
    .secondary-btn {
        width: 100%;
        text-align: center;
    }
}

.cancel-feedback-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cancel-feedback-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cancel-feedback-modal .modal-subtitle {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

.cancel-feedback-modal .form-field label {
    font-weight: 600;
    color: #1f2937;
}

.cancel-feedback-modal textarea {
    resize: vertical;
    min-height: 120px;
}

.cancel-feedback-modal .form-status {
    min-height: 1.25rem;
    margin: 0;
    color: #dc2626;
}

.cancel-feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ios-subscription-note {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.12);
    color: #0f172a;
    font-size: 0.95rem;
    line-height: 1.4;
}

.ios-subscription-note strong {
    font-weight: 600;
}

.ios-cancel-modal {
    width: min(500px, 92vw);
    padding: clamp(24px, 4vw, 32px);
}

.ios-cancel-steps {
    margin: 16px 0;
    padding-left: 20px;
    color: #0f172a;
}

.ios-cancel-steps li + li {
    margin-top: 8px;
}

.ios-cancel-note {
    margin-top: 12px;
    color: #475467;
}

.ios-cancel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.settings-card h1,
.settings-card h2 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #0f172a;
}

.settings-intro {
    margin: 0 0 18px 0;
    color: #4b5563;
    font-size: 0.95rem;
}

.account-id-display {
    margin: 0 0 18px 0;
    color: #4b5563;
    font-size: 0.95rem;
}

.account-id-display code {
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 600;
    font-size: 1rem;
    color: #111827;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.two-column {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-weight: 600;
    color: #1f2937;
}

.form-field input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
}

.form-field input:focus {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
    border-color: rgba(59, 130, 246, 0.6);
}

.meal-reminder-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.meal-reminder-input-row input[type="time"] {
    max-width: 180px;
}

.meal-reminder-helper {
    margin: -8px 0 0 0;
}

.meal-mood-reminder-toggle {
    border: 1px solid #e5e8ee;
    border-radius: 12px;
    padding: 12px 14px;
    background: #f8fafc;
}

.meal-mood-reminder-toggle .toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #2c3a4b;
}

.meal-mood-reminder-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.meal-mood-reminder-helper {
    margin: 8px 0 0 0;
    color: #4f5f73;
}

.avatar-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(241, 245, 249, 0.9);
    border: 2px solid rgba(148, 163, 184, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.avatar-preview.has-image img {
    display: block;
}

.avatar-preview.has-image .profile-preview-initial {
    display: none;
}

.profile-preview-initial {
    font-weight: 700;
    color: #1f2937;
    font-size: 1.4rem;
}

.avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-start;
    align-items: center;
}

@media (max-width: 640px) {
    .settings-card.goals-card {
        padding-bottom: 24px;
    }
}

.settings-status {
    font-size: 0.95rem;
    color: #1f2937;
}

.settings-status.error {
    color: #b91c1c;
}

.settings-status.success {
    color: #166534;
}

.card-header {
    margin-bottom: 12px;
}

.card-header h2 {
    margin-bottom: 6px;
}
/* Meal preview cards */
.meal-preview {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.meal-preview img {
    border-radius: 4px;
    margin-right: 10px;
}

.meal-details {
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

/* Admin Panel */
body.admin-body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 20% 20%, rgba(255, 176, 108, 0.25), transparent 30%),
        radial-gradient(circle at 80% 0%, rgba(99, 102, 241, 0.22), transparent 28%),
        linear-gradient(135deg, #0f172a 0%, #111827 55%, #0b1221 100%);
    --body-background-image: none;
    font-family: "Inter", Arial, sans-serif;
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 32px 16px 48px;
}

.admin-topbar {
    width: min(1200px, 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 18px;
    background: rgba(17, 24, 39, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-brand__logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.admin-brand__eyebrow {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #a5b4fc;
}

.admin-brand__title {
    display: block;
    font-weight: 800;
    color: #f8fafc;
    font-size: 1.05rem;
}

.admin-nav {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-nav__link {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.2s ease;
}

.admin-nav__link:hover,
.admin-nav__link:focus-visible {
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.12);
}

.admin-nav__link--active {
    color: #0b1221;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border-color: transparent;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.35);
}

.admin-wrapper {
    width: min(1200px, 100%);
}

.admin-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94));
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 25px 50px -18px rgba(0, 0, 0, 0.4), 0 12px 24px -12px rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

.admin-meal-totals {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.admin-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 200px;
}

.meal-total-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff2bf, #f4c542 55%, #c6971f 100%);
    box-shadow: 0 20px 35px -18px rgba(202, 138, 4, 0.65), inset 0 8px 16px rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.meal-total-circle::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    mix-blend-mode: screen;
}

.landing-views-circle {
    background: radial-gradient(circle at 30% 30%, #dbeafe, #60a5fa 55%, #2563eb 100%);
    box-shadow: 0 20px 35px -18px rgba(37, 99, 235, 0.65), inset 0 8px 16px rgba(255, 255, 255, 0.35);
}

.meal-total-number {
    font-size: clamp(2.75rem, 6vw, 3.75rem);
    font-weight: 800;
    color: #111827;
    position: relative;
    z-index: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.meal-total-caption {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
}

.admin-stat-actions {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.admin-stat-actions .secondary-btn {
    padding: 8px 14px;
}

.admin-card + .admin-card {
    margin-top: 24px;
}

.admin-subtitle {
    margin-top: 4px;
    margin-bottom: 24px;
    color: #475569;
}

.admin-overline {
    font-size: 0.85rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 6px 0;
    font-weight: 700;
}

.admin-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #e0f2fe;
    color: #1d4ed8;
    font-size: 0.95rem;
}

.admin-status.info {
    background: #e0f2fe;
    color: #1d4ed8;
}

.admin-status.success {
    background: #dcfce7;
    color: #166534;
}

.admin-status.error {
    background: #fee2e2;
    color: #b91c1c;
}

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.admin-section {
    margin-top: 32px;
}

.admin-back-link {
    margin: 0 0 8px;
    color: #1d4ed8;
    font-weight: 600;
}

.admin-back-link a {
    color: inherit;
    text-decoration: none;
}

.admin-back-link a:hover,
.admin-back-link a:focus-visible {
    text-decoration: underline;
}

.admin-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.admin-section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.admin-section-content {
    display: grid;
    gap: 12px;
}

.admin-section-header .admin-subtitle {
    margin-top: 4px;
}

.admin-analytics-card {
    width: min(1200px, 100%);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.chart-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 25px -18px rgba(30, 64, 175, 0.3);
    min-height: 260px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-title {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
    font-weight: 700;
}

.chart-card canvas {
    width: 100%;
    height: 220px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.chart-selector select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-weight: 600;
}

.admin-chart-area {
    position: relative;
    margin: 8px 0 4px;
    min-height: 360px;
}

.admin-chart {
    position: relative;
    height: min(480px, 50vh);
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.85), rgba(226, 232, 240, 0.6));
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.8), 0 16px 36px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.admin-chart--empty {
    opacity: 0.35;
}

.admin-chart__canvas {
    width: 100% !important;
    height: 100% !important;
}

.admin-chart__empty {
    margin: 12px 0 0;
    color: #475569;
    font-style: italic;
}

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

.admin-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: center;
    gap: 16px;
    margin: 20px 0;
}

.admin-user-count {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: #1f2937;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #1d4ed8;
    color: #f8fafc;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 10px 20px -10px rgba(29, 78, 216, 0.65);
}

.count-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    color: #475569;
}

.admin-search-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-left: auto;
}

.admin-search-form input {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    min-width: 240px;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-search-form input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.admin-search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.admin-filter-group label {
    font-weight: 600;
    color: #1f2937;
}

.admin-filter-select {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    color: #0f172a;
    min-width: 200px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-filter-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    outline: none;
}

.admin-filter-group select {
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 10px;
    padding: 8px 12px;
    background: rgba(248, 250, 252, 0.95);
    font-weight: 500;
    color: #1f2937;
}

.admin-filter-group select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    outline: none;
}

.link-btn {
    background: transparent;
    border: none;
    color: #1d4ed8;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 10px;
}

.link-btn:hover {
    text-decoration: underline;
}

.link-btn.disabled,
.link-btn:disabled {
    opacity: 0.45;
    pointer-events: none;
}

.secondary-btn {
    background: #0f172a;
    color: #f8fafc;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
}

.secondary-btn:hover {
    background: #1e293b;
}

.table-wrapper {
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.92);
}

.admin-table th,
.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    text-align: left;
    font-size: 0.95rem;
}

.admin-table thead {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(14, 165, 233, 0.12));
    position: sticky;
    top: 0;
    z-index: 1;
}

.log-cell-main {
    display: block;
    font-weight: 600;
    color: #111827;
}

.log-cell-sub {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 0.85rem;
}

.admin-user-id {
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background: rgba(14, 165, 233, 0.12);
}

.admin-feedback-table td,
.admin-feedback-table th {
    vertical-align: top;
}

.admin-feedback-reason {
    white-space: pre-line;
    word-break: break-word;
    max-width: 640px;
}

.admin-notifications-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-form .field-hint {
    margin-top: 6px;
    font-size: 0.9rem;
    color: #64748b;
}

.admin-notification-list {
    display: grid;
    gap: 12px;
}

.admin-notification-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.admin-notification-card--revoked {
    border-color: #fecdd3;
    background: linear-gradient(180deg, #fff7ed 0%, #fff 100%);
}

.admin-notification-card__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.admin-notification-card__header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.admin-notification-card__meta {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
}

.admin-notification-card__body {
    margin: 0;
    color: #0f172a;
    white-space: pre-wrap;
}

.admin-notification-card__status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-weight: 600;
}

.admin-notification-card__status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #ecfeff;
    color: #0ea5e9;
    font-size: 0.9rem;
}

.admin-notification-card__status-pill.is-revoked {
    background: #fee2e2;
    color: #b91c1c;
}

.admin-notification-card__status-copy {
    color: #475569;
    font-weight: 500;
    font-size: 0.95rem;
}

.admin-notification-card__actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.secondary-btn.destructive {
    color: #b91c1c;
    border-color: #fecdd3;
    background: #fff;
}

.secondary-btn.destructive:hover,
.secondary-btn.destructive:focus-visible {
    background: #fff1f2;
    color: #991b1b;
}

.admin-notification-card__media {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-weight: 600;
    color: #0ea5e9;
}

.admin-notification-card__media:hover,
.admin-notification-card__media:focus-visible {
    text-decoration: underline;
}

.empty-row {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 32px 16px;
}

.actions-col {
    width: 120px;
}

.admin-actions {
    position: relative;
    display: inline-flex;
    justify-content: flex-end;
}

.actions-trigger {
    background: #1d4ed8;
    color: #fff;
    width: 44px;
    height: 36px;
    border-radius: 18px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 2px;
}

.actions-trigger:hover {
    background: #1e40af;
}

.admin-actions-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #0f172a;
    color: #f8fafc;
    border-radius: 12px;
    min-width: 140px;
    padding: 8px;
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 50;
}

.admin-table-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.pagination-summary {
    color: #4b5563;
    font-size: 0.95rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-btn {
    background: #1d4ed8;
    color: #f8fafc;
    border: none;
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #1e40af;
}

.pagination-btn:disabled {
    background: rgba(148, 163, 184, 0.4);
    color: #475569;
    cursor: not-allowed;
}

.pagination-status {
    color: #1f2937;
    font-weight: 600;
}

.admin-user-id-link {
    color: inherit;
    text-decoration: none;
}

.admin-user-id-link:hover,
.admin-user-id-link:focus {
    color: #1d4ed8;
    text-decoration: underline;
}

.admin-user-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.overview-item {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 18px 32px -18px rgba(15, 23, 42, 0.32);
}

.admin-user-special {
    margin-bottom: 28px;
    padding: 18px 20px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
    box-shadow: 0 18px 36px -22px rgba(15, 23, 42, 0.3);
}

.admin-session-card {
    margin-bottom: 28px;
    padding: 18px 20px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
    box-shadow: 0 18px 36px -22px rgba(15, 23, 42, 0.3);
}

.admin-session-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.session-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.session-status-pill.is-active {
    background: #dcfce7;
    color: #15803d;
}

.session-status-pill.is-inactive {
    background: #fee2e2;
    color: #b91c1c;
}

.special-access-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.special-access-copy h2 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: #0f172a;
}

.special-access-copy p {
    margin: 0;
    font-size: 0.9rem;
    color: #64748b;
}

.special-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 54px;
    height: 30px;
}

.special-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.special-switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd5f5;
    transition: background 0.2s ease;
}

.special-switch-slider::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s ease;
}

.special-switch input:checked + .special-switch-slider {
    background: #2563eb;
}

.special-switch input:checked + .special-switch-slider::before {
    transform: translateX(24px);
}

.special-switch input:focus + .special-switch-slider {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.special-access-description {
    margin-top: 12px;
    font-size: 0.9rem;
    color: #475569;
}

.overview-label {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 6px;
}

.overview-value {
    font-weight: 600;
    font-size: 1.05rem;
    color: #0f172a;
    word-break: break-word;
}

.admin-detail-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-detail-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.admin-actions-menu.drop-up {
    top: auto;
    bottom: calc(100% + 6px);
}

.admin-action-btn {
    background: transparent;
    border: none;
    color: inherit;
    padding: 10px 12px;
    text-align: left;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
}

.admin-action-btn:hover {
    background: rgba(248, 250, 252, 0.12);
}

.admin-action-btn.destructive {
    color: #fca5a5;
}

.admin-map-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-map-header {
    align-items: flex-start;
}

.admin-map-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#mapStatus {
    margin-bottom: 0;
}

#userMap {
    width: 100%;
    height: min(70vh, 640px);
    min-height: 360px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.map-summary {
    font-weight: 600;
    color: #0f172a;
}

.user-count-marker {
    background: rgba(30, 64, 175, 0.92);
    color: #f8fafc;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.25);
}

.user-count-marker span {
    display: inline-block;
    min-width: 30px;
    padding: 4px;
}

@media (max-width: 768px) {
    body.admin-body {
        padding: 18px 12px 32px;
        align-items: stretch;
    }

    .admin-topbar {
        flex-direction: column;
        align-items: flex-start;
        position: sticky;
        top: 0;
        z-index: 4;
    }

    .admin-wrapper {
        width: 100%;
    }

    .admin-card {
        padding: 22px;
    }

    .meal-total-circle {
        width: 150px;
        height: 150px;
    }

    .meal-total-caption {
        font-size: 0.9rem;
        letter-spacing: 0.06em;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .admin-header-actions .secondary-btn,
    .admin-header-actions .danger-btn {
        width: 100%;
        text-align: center;
    }

    .table-wrapper {
        overflow-x: auto;
    }

    .admin-table {
        min-width: 640px;
    }

    .actions-col {
        width: 80px;
    }
}

/* Calendar grid */
.calendar {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.calendar-stats-wrapper {
    display: none;
}

.day-column {
    flex: 1;
    background: #fefefe;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-height: 300px;
    padding: 10px;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.day-column.goals-complete {
    border-color: rgba(56, 189, 248, 0.85);
    box-shadow: 0 0 0 3px rgba(191, 227, 255, 0.9), 0 18px 40px rgba(14, 165, 233, 0.25);
    background: linear-gradient(180deg, rgba(224, 242, 254, 0.75), #ffffff);
}

.day-column.goals-complete .daily-total {
    color: #0369a1;
}

body:not(.calendar-editing) .day-column.goals-complete:hover {
    border-color: rgba(14, 165, 233, 0.95);
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.85), 0 22px 46px rgba(14, 165, 233, 0.3);
    background: linear-gradient(180deg, rgba(191, 239, 255, 0.9), #ffffff);
}

.goal-inspectable {
    position: relative;
}

body:not(.calendar-editing) .goal-inspectable {
    cursor: pointer;
}

body:not(.calendar-editing) .goal-inspectable:hover {
    border-color: rgba(59, 130, 246, 0.65);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.12);
    background: #f8fbff;
}

.goal-inspectable .entry-card,
.goal-inspectable .entry-card * {
    cursor: pointer;
}

body.calendar-editing .goal-inspectable {
    cursor: default;
    box-shadow: none;
}

.goal-inspectable h3,
.goal-status-trigger {
    cursor: pointer;
}


.day-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.day-column h3 {
    text-align: left;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.day-column-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.day-column-collapse[hidden] {
    display: none !important;
}

.day-column-collapse:hover {
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.35);
}

.day-column-collapse:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.4);
    outline-offset: 3px;
}

.day-column-collapse-icon {
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2px solid #1f2937;
    border-bottom: 2px solid #1f2937;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.day-column.is-collapsed .day-column-collapse-icon {
    transform: rotate(-135deg);
}

.entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.daily-total {
    font-weight: 600;
    margin-bottom: 10px;
    color: #1f2937;
    font-size: 0.95rem;
}

.day-column.is-collapsed .daily-total {
    opacity: 0.7;
}

/* Entry cards */
.entry-card {
    position: relative;
    overflow: hidden;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    background: #007bff;
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.entry-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.entry-card.is-prepped {
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15);
}

.prepped-badge {
    position: absolute;
    top: 8px;
    right: 12px;
    bottom: auto;
    padding: 4px 10px;
    border-radius: 999px;
    border: none;
    background: rgba(248, 250, 252, 0.9);
    color: #0f172a;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    cursor: pointer;
    z-index: 2;
}

.prepped-badge:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.45), 0 2px 6px rgba(15, 23, 42, 0.2);
}

.prepped-badge__tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(240px, 70vw);
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
    text-transform: none;
    letter-spacing: normal;
}

.prepped-badge.show-tooltip .prepped-badge__tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

@media (min-width: 901px) {
    .entry-card.prepped-tooltip-visible {
        overflow: visible;
        z-index: 5;
    }

    .prepped-badge {
        top: auto;
        bottom: 8px;
    }

    .prepped-badge__tooltip {
        top: auto;
        bottom: calc(100% + 8px);
    }
}

.entry-checkbox-container {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.85);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.entry-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.entry-card.is-editing {
    padding-left: 40px;
}

.entry-card.is-editing .entry-checkbox-container {
    opacity: 1;
    pointer-events: auto;
}

body.calendar-editing .entry-card:hover {
    transform: none;
}

@media (min-width: 901px) {
    .calendar-stats-wrapper {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        column-gap: 10px;
        align-items: flex-end;
        margin-top: clamp(12px, 2vw, 20px);
        width: 100%;
    }

    .calendar-stats-wrapper .home-logo-reminder {
        grid-column: 1;
        justify-self: start;
    }

}

/* Card header */
.card-header {
    line-height: 1.2;
}

.card-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.card-cal {
    font-size: 12px;
    opacity: 0.95;
}

.card-tag {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
    text-transform: capitalize;
}

/* Card details */
.card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 6px;
    font-size: 12px;
}

.entry-card:hover .card-details {
    max-height: 80px;
}

/* Ripple effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 600ms linear;
    background-color: rgba(255, 255, 255, 0.7);
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Week controls + totals */
.day-controls-collapsible {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 clamp(12px, 4vw, 48px);
}

.mobile-day-controls-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 360px;
    margin: clamp(4px, 1vw, 12px) auto 0;
    padding: 10px 18px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.mobile-day-controls-toggle:hover {
    background: #0056b3;
}

.mobile-day-controls-toggle:active {
    transform: translateY(1px);
}

.mobile-day-controls-toggle:focus,
.mobile-day-controls-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.45);
}

.mobile-day-controls-toggle-icon {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid currentColor;
    transition: transform 0.2s ease;
}

.mobile-day-controls-calendar-icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
    flex-shrink: 0;
}

.day-controls-collapsible[data-expanded="true"] .mobile-day-controls-toggle-icon {
    transform: rotate(180deg);
}

.day-controls-collapsible[data-expanded="false"] .mobile-day-controls-panel {
    display: none;
}

.day-controls-collapsible[data-expanded="true"] .mobile-day-controls-panel {
    display: flex;
    justify-content: center;
    width: 100%;
}

.mobile-day-controls-panel {
    width: 100%;
}

.day-controls-collapsible[data-expanded="true"] .mobile-day-controls-viewport {
    display: flex;
    justify-content: center;
    width: 100%;
}

.mobile-day-controls-viewport {
    width: 100%;
}

.mobile-day-controls-content {
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vw, 20px);
    width: 100%;
}

.week-controls-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 10px auto 10px;
    width: 100%;
    max-width: 1140px;
    padding: 0 clamp(12px, 4vw, 48px);
}

body.home-page .week-controls-wrapper {
    margin: clamp(4px, 1vw, 10px) auto clamp(8px, 1.4vw, 16px);
}

.week-controls-wrapper.week-controls-mobile {
    align-items: flex-start;
    gap: 8px;
}

.week-controls-wrapper.week-controls-mobile #weekTotals {
    display: none;
}

#week-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    text-align: center;
    width: 100%;
}

.week-secondary-controls {
    display: grid;
    grid-auto-flow: row;
    justify-items: center;
    row-gap: 8px;
    width: 100%;
    margin-inline: auto;
}

.mobile-day-controls-panel #jumpDate.mobile-date-input {
    display: block;
    margin: 0 auto;
    justify-self: center;
    align-self: center;
    min-width: 0;
    width: min(100%, 260px);
    max-width: 260px;
    text-align: center;
    font-size: 0.85rem;
    -webkit-appearance: none;
    appearance: none;
    padding: 8px 12px;
    line-height: 1.2;
    height: auto;
    border-radius: 6px;
}

.mobile-day-controls-panel #jumpDate.mobile-date-input::-webkit-date-and-time-value,
.mobile-day-controls-panel #jumpDate.mobile-date-input::-webkit-datetime-edit,
.mobile-day-controls-panel #jumpDate.mobile-date-input::-webkit-datetime-edit-fields-wrapper {
    padding-top: 0;
    padding-bottom: 0;
}

.calendar-toolbar-inner #jumpDate {
    display: none;
}

.week-controls-wrapper button {
    background: #007bff;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.week-controls-wrapper button:disabled,
.week-controls-wrapper button.is-disabled {
    background: #d1d5db;
    color: #374151;
    cursor: default;
    opacity: 0.85;
}

.week-controls-wrapper button:hover {
    background: #0056b3;
}

.week-controls-wrapper button:disabled:hover,
.week-controls-wrapper button.is-disabled:hover {
    background: #d1d5db;
}

@media (min-width: 901px) {
    body.home-page .day-controls-collapsible {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: clamp(12px, 1.5vw, 18px);
        padding: 0 clamp(12px, 4vw, 48px);
        margin: clamp(12px, 2vw, 28px) auto 0;
    }

    body.home-page .day-controls-collapsible .mobile-day-controls-toggle {
        width: min(100%, 420px);
        max-width: 420px;
        margin-inline: auto;
    }

    body.home-page .day-controls-collapsible[data-expanded="true"] .mobile-day-controls-content {
        width: 100%;
        max-width: 640px;
        margin-inline: auto;
        padding: clamp(20px, 3vw, 32px);
        padding-top: clamp(16px, 2.5vw, 28px);
        padding-bottom: clamp(18px, 2.5vw, 30px);
        background-image: url("images/cuttingboard.png");
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        border-radius: 26px;
        border: 1px solid rgba(15, 23, 42, 0.12);
        box-shadow: 0 24px 44px rgba(15, 23, 42, 0.18);
        align-items: center;
        color: #0f172a;
    }

    body.home-page .day-controls-collapsible[data-expanded="true"] .mobile-day-controls-content > * {
        width: 100%;
    }

    body.home-page .day-controls-collapsible .week-controls-wrapper {
        align-items: center;
        text-align: center;
        margin: 0 auto;
        padding: 0;
    }

    body.home-page .day-controls-collapsible #week-controls {
        justify-content: center;
    }

    body.home-page .mobile-day-controls-panel #jumpDate.mobile-date-input {
        margin-inline: auto;
        text-align: center;
        min-width: 0;
        width: min(100%, 280px);
    }

    body.home-page .mobile-day-controls-content #day-controls {
        justify-content: center;
        width: 100%;
        max-width: 360px;
        margin-inline: auto;
    }

    body.home-page .mobile-day-controls-content #day-controls button {
        flex: 1 1 auto;
        max-width: none;
        border-radius: 999px;
        padding: 12px 0;
        font-weight: 600;
        background: rgba(255, 255, 255, 0.92);
        border: 1px solid rgba(15, 23, 42, 0.16);
        color: #0f172a;
        box-shadow: 0 14px 26px rgba(15, 23, 42, 0.12);
        transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
    }

    body.home-page .mobile-day-controls-content #day-controls button:hover {
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 18px 32px rgba(15, 23, 42, 0.18);
    }

    body.home-page .mobile-day-controls-content #day-controls button:active {
        transform: translateY(1px);
        box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
    }
}

.danger {
    background: #ef4444;
}

.danger:hover {
    background: #dc2626;
}

body.calendar-editing #calendarEditToggle {
    background: #6b7280;
}

body.calendar-editing #calendarEditToggle:hover {
    background: #4b5563;
}

#weekLabel {
    font-weight: bold;
    font-size: 16px;
}

.calendar-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1140px;
    margin: 4px auto 0;
    padding: 0 clamp(12px, 4vw, 48px);
}

.calendar-toolbar-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.calendar-toolbar-inner > #calendarEditToggle {
    order: 1;
}

.calendar-toolbar-inner > #calendarDeleteSelected {
    order: 2;
}

.calendar-toolbar-inner > .calendar-toolbar-totals {
    order: 3;
}

.calendar-toolbar-totals {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.total-select-label {
    display: inline-block;
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
}

.total-select {
    margin: 0;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(255, 255, 255, 0.96);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .week-controls-wrapper {
        padding: 0 clamp(12px, 4vw, 24px);
    }

    .week-controls-wrapper.week-controls-mobile {
        align-items: center;
    }

    .calendar-toolbar {
        padding: 0 clamp(12px, 4vw, 24px);
    }

    .week-controls-wrapper.week-controls-mobile {
        align-items: center;
    }

    .week-controls-wrapper.week-controls-mobile .week-secondary-controls {
        align-self: center;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .week-secondary-controls #todayBtn {
        display: none;
    }

    .calendar-toolbar-inner #jumpDate {
        display: block;
        order: 0;
        min-width: 0;
        width: min(100%, 260px);
        max-width: 260px;
        align-self: center;
        margin: 0;
        margin-inline: auto;
    }
}

#day-controls,
.day-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

#day-controls button,
.day-controls button {
    background: #007bff;
    color: #fff;
    border-radius: 5px;
    border: none;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    line-height: 1.1;
}

#day-controls input[type="date"],
.day-controls input[type="date"] {
    margin: 0 auto;
    flex-shrink: 0;
}

#day-controls button.is-active,
.day-controls button.is-active {
    background: #0056b3;
    cursor: default;
}

#day-controls button:hover,
.day-controls button:hover {
    background: #0056b3;
}

#day-controls button:focus,
#day-controls button:focus-visible,
#week-controls button:focus,
#week-controls button:focus-visible {
    outline: none;
    box-shadow: none;
}

#day-controls button:active,
#week-controls button:active {
    transform: translateY(1px);
}

/* Delete button */
.delete-btn {
    margin-top: 8px;
    padding: 4px 8px;
    background: red;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.delete-btn:hover {
    background: darkred;
}

/* Add Meal button */
.add-meal-row {
    position: relative;
    display: flex;
    justify-content: center;
    gap: clamp(6px, 1.5vw, 16px);
    margin: 0;
    padding: 0;
}

.add-meal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.add-meal-btn:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 4px;
}

.add-meal-btn-img {
    display: block;
    width: 220px;
    max-width: 100%;
    height: auto;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.add-meal-btn:hover .add-meal-btn-img {
    transform: translateY(-1px) scale(1.01);
    filter: brightness(1.03);
}

.add-meal-btn:active .add-meal-btn-img {
    transform: scale(0.98);
}

.add-meal-container {
    grid-column: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

/* Modals */
.modal {
    position: fixed;
    top: var(--modal-viewport-offset, 0px);
    right: var(--modal-viewport-right, 0px);
    bottom: 0;
    left: var(--modal-viewport-left, 0px);
    display: grid;
    place-items: center;
    width: 100%;
    height: var(--modal-viewport-height, 100vh);
    min-height: var(--modal-viewport-height, 100vh);
    margin: 0;
    --modal-overlay-padding: clamp(16px, 4vw, 32px);
    padding: var(--modal-overlay-padding);
    padding-bottom: calc(var(--modal-overlay-padding) + env(safe-area-inset-bottom, 0px));
    background: rgba(15, 23, 42, 0.55);
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
    overscroll-behavior: contain;
}

.modal.goal-status-modal {
    z-index: 1600;
}

.modal.show {
    display: grid;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal[hidden] {
    display: none !important;
}

.modal-card {
    width: min(92vw, 640px);
    max-height: min(
        92vh,
        calc(
            var(--modal-viewport-height, 100vh) - clamp(32px, 10vh, 120px) - env(safe-area-inset-bottom, 0px)
        )
    );
    overflow: hidden;
    background: #ffffff;
    border-radius: 16px;
    margin-inline: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    padding: clamp(20px, 4vw, 32px);
    padding-bottom: calc(clamp(20px, 4vw, 32px) + env(safe-area-inset-bottom, 16px));
    box-sizing: border-box;
    animation: slideDown 0.3s ease;
    overscroll-behavior: contain;
    scroll-padding-bottom: clamp(96px, 22vh, 160px);
    min-width: 0;
}

.modal .modal-body,
.modal-body {
    overscroll-behavior: contain;
    overflow-y: auto;
    overflow-x: hidden;
}

.delete-confirm-modal {
    z-index: 1800;
}

.delete-confirm-card {
    width: min(420px, 94vw);
    max-width: min(420px, 94vw);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    padding: clamp(28px, 6vw, 40px);
    padding-inline: clamp(20px, 5vw, 32px);
}

.delete-confirm-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 6px;
}

.delete-confirm-close:hover,
.delete-confirm-close:focus-visible {
    color: #475569;
}

.delete-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 1.5rem;
}

.delete-confirm-message {
    margin: 0;
    color: #475569;
}

.delete-confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.delete-confirm-actions .secondary-btn,
.delete-confirm-actions .danger-btn {
    width: 100%;
    justify-content: center;
}

@media (min-width: 480px) {
    .delete-confirm-actions {
        flex-direction: row;
    }

    .delete-confirm-card {
        padding-inline: clamp(28px, 6vw, 40px);
    }
}

.install-help-modal .modal-card {
    max-width: 420px;
    width: min(420px, 92vw);
}

.install-help-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}


.welcome-modal .modal-card {
    max-width: 480px;
    width: min(480px, 92vw);
    padding: clamp(24px, 4vw, 40px) clamp(24px, 5vw, 48px)
        calc(32px + env(safe-area-inset-bottom, 24px));
    overflow: hidden;
}

.welcome-modal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    gap: 20px;
}

.welcome-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.welcome-modal-button {
    min-width: 220px;
}

.onboarding-page {
    min-height: 100vh;
    margin: 0;
    background: radial-gradient(circle at 18% 20%, #e0f2fe, #e2e8f0 34%, #e2e8f0),
        linear-gradient(145deg, #f8fafc, #e2e8f0 40%, #f8fafc);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(24px, 5vw, 56px) clamp(16px, 6vw, 60px);
    box-sizing: border-box;
}

.onboarding-header {
    width: 100%;
    max-width: 960px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: clamp(16px, 3vw, 32px);
}

.onboarding-header-logo {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
}

.onboarding-logo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.onboarding-logo {
    height: 48px;
    width: auto;
}

.onboarding-main {
    width: 100%;
    max-width: 1040px;
    display: flex;
    justify-content: center;
}

.onboarding-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    border-radius: 32px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 25px 70px rgba(15, 23, 42, 0.16);
    padding: clamp(28px, 4vw, 48px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 20px;
    text-align: left;
    backdrop-filter: blur(6px);
}

.onboarding-illustration {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    grid-area: illustration;
    margin: 0 auto;
    max-width: 100%;
    align-self: center;
}

.onboarding-status {
    min-height: 1.5em;
    margin: 0;
    font-size: 0.95rem;
    color: #0f172a;
    margin-top: 4px;
}

.onboarding-status[data-status="error"] {
    color: #b91c1c;
}

.onboarding-status[data-status="warning"] {
    color: #b45309;
}

.onboarding-primary-btn {
    min-width: 160px;
}

.onboarding-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.onboarding-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(120deg, #e0f2fe, #e5e7eb);
    color: #0f172a;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
}

.onboarding-skip-btn,
.onboarding-back-btn {
    min-width: 120px;
}

.onboarding-progress-shell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.onboarding-progress-track {
    width: 100%;
    height: 10px;
    background: linear-gradient(90deg, #e5e7eb, #e2e8f0);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.onboarding-progress-bar {
    position: absolute;
    inset: 0;
    width: 0;
    background: linear-gradient(90deg, #22c55e, #0ea5e9);
    border-radius: 999px;
    transition: width 240ms ease;
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.25);
}

.onboarding-content {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.25fr);
    grid-template-areas: "copy illustration";
    gap: clamp(18px, 3vw, 32px);
    align-items: center;
    width: 100%;
}

.onboarding-copy {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    grid-area: copy;
}

.onboarding-eyebrow {
    color: #0ea5e9;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
    font-size: 0.8rem;
}

.onboarding-step-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.onboarding-step-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: none;
    background: #e5e7eb;
    transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
    cursor: pointer;
}

.onboarding-step-dot.is-active {
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
    transform: translateY(-1px) scale(1.05);
}

.onboarding-step-dot.is-complete {
    background: #c4d4f8;
}


.onboarding-slide-illustration {
    grid-area: illustration;
    width: 100%;
    max-width: min(100%, clamp(340px, 64vw, 720px));
    min-height: clamp(240px, 48vw, 540px);
    border: 1px solid #dbeafe;
    border-radius: 22px;
    background: radial-gradient(circle at 30% 25%, rgba(14, 165, 233, 0.12), rgba(14, 165, 233, 0)),
        radial-gradient(circle at 70% 80%, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0)),
        #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vw, 16px);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 16px 48px rgba(15, 23, 42, 0.12);
    aspect-ratio: 16 / 9;
    margin: 0 auto;
}

.onboarding-slide-illustration.has-video {
    border-style: solid;
    border-color: transparent;
    background: radial-gradient(circle at 35% 25%, rgba(14, 165, 233, 0.18), rgba(255, 255, 255, 0) 55%),
        radial-gradient(circle at 70% 75%, rgba(34, 197, 94, 0.14), rgba(255, 255, 255, 0) 55%),
        linear-gradient(135deg, rgba(226, 232, 240, 0.82), rgba(255, 255, 255, 0.96));
    padding: clamp(12px, 2vw, 18px);
    justify-content: center;
    width: 100%;
    max-width: min(100%, clamp(360px, 72vw, 980px));
    margin: 0 auto;
    min-height: clamp(280px, 48vw, 660px);
}

.onboarding-slide-video {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    object-fit: contain;
    background: linear-gradient(145deg, #0b1020, #0f172a);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.22);
    margin: 0 auto;
    max-height: 68vh;
    max-width: 100%;
}

.onboarding-slide-video.is-visible {
    display: block;
}

.onboarding-slide-progress {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin: 0;
}

.onboarding-slide-title {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    color: #0f172a;
    margin: 0;
}

.onboarding-slide-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #1f2937;
    margin: 0;
}

.onboarding-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.onboarding-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.onboarding-actions .primary-btn,
.onboarding-actions .secondary-btn {
    flex: 1;
    min-width: 0;
}

@media (max-width: 600px) {
    .onboarding-main {
        width: 100%;
    }

    .onboarding-content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "illustration"
            "copy";
        gap: 12px;
    }

    .onboarding-card {
        padding: 22px 16px;
        gap: 14px;
        max-height: calc(100dvh - 32px);
    }

    .onboarding-header {
        flex-direction: column;
        align-items: center;
    }

    .onboarding-header-logo {
        width: 100%;
        justify-content: center;
    }

    .onboarding-card-header {
        align-items: flex-start;
        gap: 8px;
    }

    .onboarding-actions {
        width: 100%;
        justify-content: stretch;
        gap: 8px;
    }

    .onboarding-footer {
        align-items: flex-start;
        gap: 10px;
        flex-direction: column;
    }

    .onboarding-illustration {
        align-self: center;
        justify-content: center;
        width: 100%;
        margin-inline: auto;
    }

    .onboarding-slide-illustration,
    .onboarding-slide-illustration.has-video {
        width: 100%;
        max-width: min(90vw, 520px);
        min-height: clamp(210px, 58vw, 360px);
        max-height: clamp(240px, 60vw, 400px);
        margin: 0 auto;
        padding: 12px 14px;
    }
}

@media (max-width: 640px) {
    .welcome-modal {
        align-items: stretch;
    }

    .welcome-modal .modal-card {
        max-width: none;
        width: 100%;
        height: var(--modal-viewport-height, 100vh);
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }

    .welcome-modal-card {
        height: 100%;
        justify-content: space-between;
    }

    .welcome-modal-body {
        flex: 1;
        justify-content: center;
    }

    .onboarding-page {
        padding: 24px 16px;
    }

    .onboarding-card {
        border-radius: 24px;
        padding: 28px 20px;
    }

    .onboarding-illustration {
        align-self: center;
        margin-inline: auto;
    }

    .onboarding-slide-illustration,
    .onboarding-slide-illustration.has-video {
        width: 100%;
        max-width: min(94vw, 520px);
        min-height: clamp(240px, 62vw, 420px);
        max-height: clamp(320px, 64vw, 520px);
    }
}

@media (max-width: 480px) {
    .onboarding-header {
        margin-bottom: 8px;
    }

    .onboarding-page {
        padding: 16px 12px calc(18px + env(safe-area-inset-bottom, 0px));
    }

    .onboarding-card {
        border-radius: 20px;
        padding: 18px 14px;
        gap: 14px;
        max-height: calc(100dvh - 24px);
    }

    .onboarding-slide-illustration,
    .onboarding-slide-illustration.has-video {
        width: min(calc(100vw - 28px), 440px);
        max-width: 440px;
        min-height: clamp(200px, 64vw, 320px);
        max-height: clamp(230px, 66vw, 360px);
        padding: 10px 12px;
        margin-inline: auto;
    }

    .onboarding-slide-video.is-visible {
        max-height: min(60vh, 360px);
        max-width: min(90vw, 440px);
        aspect-ratio: 16 / 9;
        margin: 0 auto;
    }

    .onboarding-slide-title {
        font-size: clamp(1.2rem, 5vw, 1.4rem);
    }

    .onboarding-slide-description {
        font-size: 0.95rem;
    }

    .onboarding-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}

.install-help-message {
    font-size: 1rem;
    line-height: 1.5;
    color: #1f2937;
}

.install-help-message strong {
    color: #111827;
}

.install-help-secondary {
    font-size: 0.9rem;
    line-height: 1.45;
    color: #4b5563;
}

.nutrition-calibration-modal,
.nutrition-calibration-result-modal {
    max-width: 520px;
    width: min(520px, 92vw);
}

.nutrition-calibration-result-modal {
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.nutrition-calibration-result-modal .calibration-result-body {
    min-height: 0;
}

.nutrition-calibration-result-modal .nutrition-calibration-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    margin-bottom: clamp(12px, 2.4vw, 18px);
    position: relative;
}

.nutrition-calibration-result-modal .nutrition-calibration-header h2 {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 1.6rem);
    color: #0f172a;
}

.nutrition-calibration-result-modal .nutrition-calibration-header .close {
    color: #1f2937;
    background: rgba(15, 23, 42, 0.04);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    transition: background 0.2s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}

.nutrition-calibration-result-modal .nutrition-calibration-header .close:hover,
.nutrition-calibration-result-modal .nutrition-calibration-header .close:focus-visible {
    background: rgba(37, 99, 235, 0.12);
    outline: none;
    transform: scale(1.02);
}

.nutrition-calibration-modal {
    position: relative;
    padding-top: clamp(36px, 5vw, 44px);
    padding-bottom: clamp(28px, 8vw, 64px);
}

.nutrition-calibration-close {
    position: absolute;
    top: clamp(16px, 4vw, 20px);
    right: clamp(16px, 4vw, 20px);
    color: #1f2937;
    background: rgba(15, 23, 42, 0.04);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    transition: background 0.2s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
    float: none;
}

.nutrition-calibration-close:hover,
.nutrition-calibration-close:focus-visible {
    background: rgba(37, 99, 235, 0.12);
    outline: none;
    transform: scale(1.02);
}

.nutrition-calibration-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(16px, 4vw, 26px);
    margin-bottom: clamp(24px, 6vw, 40px);
    text-align: center;
}

.nutrition-calibration-hero-image {
    width: min(360px, 100%);
    height: auto;
    border-radius: 18px;
    display: block;
}

.nutrition-calibration-hero-caption {
    margin: 0;
    font-size: clamp(0.95rem, 2.6vw, 1.05rem);
    color: #475569;
    line-height: 1.6;
    max-width: 36ch;
}

.nutrition-calibration-form {
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 5vw, 28px);
}

.nutrition-calibration-form .form-grid {
    margin-bottom: clamp(12px, 5vw, 24px);
    gap: clamp(16px, 5vw, 24px);
}

.nutrition-calibration-form .form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: clamp(10px, 3.5vw, 16px);
    border-radius: 16px;
    background: rgba(241, 245, 249, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.nutrition-calibration-form .form-field label {
    font-size: clamp(0.95rem, 2.4vw, 1.05rem);
    color: #0f172a;
    font-weight: 600;
}

.calibration-measurement-control {
    display: flex;
    gap: clamp(6px, 1.6vw, 12px);
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

.calibration-measurement-option {
    flex: 1 1 140px;
}

.calibration-measurement-option input {
    width: 100%;
}

.calibration-measurement-option[hidden] {
    display: none !important;
}

.calibration-measurement-option--split {
    display: flex;
    gap: 8px;
    flex: 1 1 200px;
}

.calibration-measurement-split {
    display: flex;
    align-items: center;
    gap: 6px;
}

.calibration-measurement-split input {
    width: clamp(68px, 18vw, 96px);
    flex: 1 1 auto;
    min-width: 0;
}

.calibration-measurement-suffix {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.4;
}

.calibration-measurement-select {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.calibration-measurement-select select {
    min-width: 72px;
}

.calibration-measurement-control[data-field="height"] .calibration-measurement-select {
    flex: 1 1 100%;
    justify-content: flex-start;
    margin-top: clamp(6px, 1.4vw, 12px);
}

.calibration-measurement-control[data-field="height"] .calibration-measurement-select select {
    min-width: clamp(88px, 18vw, 160px);
    width: auto;
}

.calibration-helper {
    margin: 0;
    font-size: clamp(0.82rem, 2.2vw, 0.9rem);
    color: #475569;
}

.nutrition-calibration-form input,
.nutrition-calibration-form select {
    min-height: 44px;
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    font-size: clamp(1rem, 3vw, 1.05rem);
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    scroll-margin-bottom: clamp(140px, 28vh, 220px);
}

.nutrition-calibration-form input:focus,
.nutrition-calibration-form input:focus-visible,
.nutrition-calibration-form select:focus,
.nutrition-calibration-form select:focus-visible {
    outline: none;
    border-color: rgba(37, 99, 235, 0.6);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.nutrition-calibration-form input::placeholder {
    color: rgba(100, 116, 139, 0.75);
}

.nutrition-calibration-form .modal-footer {
    margin-top: clamp(8px, 3vw, 16px);
}

#nutritionCalibrationSubmit {
    min-height: 56px;
    border-radius: 16px;
    padding: clamp(14px, 4vw, 18px) clamp(18px, 6vw, 28px);
    font-size: clamp(1rem, 3.2vw, 1.1rem);
}

/* Mobile tweaks */
@media (max-width: 540px) {
    /* Keep weight, etc. inline, but let height wrap */
    .calibration-measurement-control[data-field="height"] {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    /* (Keep the rest of your mobile rules as they are) */
    .calibration-measurement-option,
    .calibration-measurement-option--split {
        flex: 1 1 auto;
        min-width: 0;
    }

    .calibration-measurement-split {
        flex: 1 1 auto;
    }

    .calibration-measurement-select select {
        min-width: 64px;
    }
}

@media (max-width: 720px) {
    .nutrition-calibration-result-modal {
        width: 100vw;
        max-width: 100vw;
        height: calc(var(--modal-viewport-height, 100vh) - env(safe-area-inset-bottom, 0px));
        max-height: calc(var(--modal-viewport-height, 100vh) - env(safe-area-inset-bottom, 0px));
        border-radius: 0;
        margin: 0;
        padding-left: clamp(18px, 6vw, 28px);
        padding-right: clamp(18px, 6vw, 28px);
    }

    .nutrition-calibration-result-modal .modal-footer {
        padding-left: clamp(18px, 6vw, 28px);
        padding-right: clamp(18px, 6vw, 28px);
    }

    .nutrition-calibration-result-modal .calibration-result-body {
        padding-left: clamp(18px, 6vw, 28px);
        padding-right: clamp(18px, 6vw, 28px);
    }
}

.modal-error {
    margin: 12px 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #b91c1c;
}

.modal-error[hidden] {
    display: none;
}

.nutrition-calibration-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    padding-bottom: clamp(24px, 8vw, 72px);
}

@media (min-width: 768px) {
    .nutrition-calibration-modal .modal-footer {
        justify-content: center;
    }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .nutrition-calibration-modal .modal-footer {
        padding-bottom: calc(clamp(24px, 8vw, 72px) + env(safe-area-inset-bottom, 0px));
    }
}

.nutrition-calibration-result-modal .modal-footer {
    display: flex;
    justify-content: center;
    margin-top: clamp(12px, 2.4vw, 20px);
}

@media (min-width: 768px) {
    .nutrition-calibration-result-modal .modal-footer {
        margin-top: clamp(18px, 3vw, 24px);
    }
}

.calibration-result-footer {
    --calibration-footer-padding: clamp(18px, 6vw, 56px);
    flex-direction: column;
    align-items: center;
    gap: clamp(10px, 2.6vw, 18px);
    padding-bottom: var(--calibration-footer-padding);
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .calibration-result-footer {
        padding-bottom: calc(var(--calibration-footer-padding) + env(safe-area-inset-bottom, 0px));
    }
}

@media (min-width: 768px) {
    .calibration-result-footer {
        --calibration-footer-padding: clamp(24px, 8vw, 88px);
        gap: clamp(14px, 3vw, 20px);
    }
}

.calibration-result-body {
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 3vw, 26px);
    padding-top: clamp(12px, 2.6vw, 22px);
    padding-bottom: clamp(14px, 3vw, 24px);
}

.nutrition-calibration-result-modal .calibration-result-body {
    flex: 1 1 auto;
    overflow-y: auto;
}

.calibration-result-hero {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 22px 55px rgba(14, 116, 144, 0.35);
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 4.5vw, 34px);
    min-height: clamp(260px, 48vw, 380px);
}

.calibration-result-hero::after {
    content: none;
}

.calibration-result-hero-image,
.calibration-result-hero-video {
    display: block;
    width: 100%;
    height: auto;
}

.calibration-result-hero-video {
    object-fit: cover;
    border: none;
    background-color: #000;
    pointer-events: none;
}

.calibration-result-hero-video::-webkit-media-controls,
.calibration-result-hero-video::-webkit-media-controls-panel,
.calibration-result-hero-video::-webkit-media-controls-overlay-play-button,
.calibration-result-hero-video::-webkit-media-controls-start-playback-button,
.calibration-result-hero-video::-webkit-media-controls-play-button,
.calibration-result-hero-video::-webkit-media-controls-overlay-enclosure {
    display: none !important;
    -webkit-appearance: none;
    opacity: 0 !important;
}

.calibration-highlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.calibration-highlight-card {
    background: linear-gradient(145deg, #1d4ed8 0%, #2563eb 60%, #38bdf8 100%);
    border-radius: 18px;
    padding: clamp(16px, 3vw, 22px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #f8fafc;
    box-shadow: 0 24px 60px rgba(37, 99, 235, 0.35);
}

.calibration-highlight-label {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.85;
}

.calibration-highlight-value {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    font-weight: 700;
    line-height: 1.1;
}

.calibration-highlight-meta {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.calibration-result-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calibration-result-note {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #475569;
    text-align: center;
    max-width: 460px;
}

.calibration-result-heading {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.calibration-result-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
}

.calibration-result-item {
    background: linear-gradient(140deg, rgba(15, 23, 42, 0.04), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
}

.calibration-result-label {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #475569;
}

.calibration-result-value {
    margin: 0;
    font-size: clamp(1.25rem, 3.2vw, 1.45rem);
    font-weight: 700;
    color: #0f172a;
}

@media (max-width: 600px) {
    .nutrition-calibration-modal,
    .nutrition-calibration-result-modal {
        width: min(100%, 96vw);
    }

    .nutrition-calibration-hero,
    .calibration-result-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .nutrition-calibration-result-modal .nutrition-calibration-header {
        flex-direction: column;
        gap: 12px;
        padding-right: clamp(4px, 4vw, 12px);
    }

    .nutrition-calibration-result-modal .nutrition-calibration-header .close {
        align-self: auto;
        position: absolute;
        top: clamp(8px, 4vw, 14px);
        right: clamp(8px, 4vw, 14px);
        display: none;
    }

    .nutrition-calibration-hero {
        align-items: center;
    }

    .nutrition-calibration-hero-image {
        width: 100%;
    }

    .calibration-highlight-grid,
    .calibration-result-list {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

.goal-status-modal-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 20px);
    padding: clamp(24px, 4vw, 32px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
    max-height: min(
        92vh,
        calc(var(--modal-viewport-height, 100vh) - clamp(32px, 10vh, 120px) - env(safe-area-inset-bottom, 0px))
    );
}

.goal-status-close {
    position: absolute;
    top: clamp(14px, 2.5vw, 18px);
    right: clamp(14px, 2.5vw, 18px);
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.goal-status-close:hover,
.goal-status-close:focus-visible {
    background: rgba(59, 130, 246, 0.16);
    color: #0f172a;
    transform: translateY(-1px);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.goal-status-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.goal-status-kicker {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3b82f6;
    margin: 0;
}

.goal-status-title {
    margin: 0;
    font-size: clamp(1.4rem, 3.6vw, 1.75rem);
    color: #0f172a;
}

.goal-status-subtitle {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
}

.goal-status-summary {
    margin: 0;
    text-align: center;
    font-size: 1rem;
    color: #0f172a;
    font-weight: 500;
}

.goal-status-summary strong {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2563eb;
}

.goal-status-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 6px;
    margin-right: -6px;
    min-height: 0;
}

.goal-status-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-status-section-title {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
    font-weight: 600;
}

.goal-status-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-status-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: #f8fafc;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.goal-status-item--complete {
    border-color: rgba(59, 130, 246, 0.55);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(191, 219, 254, 0.18));
}

.goal-status-item--highlight {
    border-color: rgba(37, 99, 235, 0.65);
    box-shadow:
        0 12px 32px rgba(37, 99, 235, 0.25),
        0 0 0 2px rgba(59, 130, 246, 0.35);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(191, 219, 254, 0.24));
}

.goal-status-item--highlight .goal-status-label {
    color: #1d4ed8;
}

.goal-status-item--highlight .goal-status-meta {
    color: #1e293b;
}

.goal-status-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
    background: rgba(148, 163, 184, 0.35);
    color: #0f172a;
}

.goal-status-item--complete .goal-status-icon {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.35);
}

.goal-status-icon--pending {
    background: rgba(148, 163, 184, 0.35);
    color: #334155;
}

.goal-status-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #0f172a;
}

.goal-status-label {
    font-weight: 600;
    font-size: 1rem;
}

.goal-status-meta {
    font-size: 0.95rem;
    color: #475569;
}

.goal-status-empty {
    margin: 0;
    text-align: center;
    color: #475569;
    font-size: 0.95rem;
}

.goal-status-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
    color: #475569;
    font-size: 0.95rem;
}

@media (max-width: 720px) {
    .goal-status-modal-card {
        max-height: 96vh;
        padding: clamp(22px, 5vw, 28px);
        border-radius: 16px;
        gap: 18px;
    }

    .goal-status-list {
        gap: 10px;
    }

    .goal-status-item {
        padding: 12px 14px;
        border-radius: 14px;
    }

    .goal-status-summary strong {
        font-size: 1.2rem;
    }
}

.quota-modal {
    max-width: 420px;
    text-align: center;
}

.quota-modal .modal-body {
    padding-bottom: 0;
}

.quota-modal .modal-footer {
    display: flex;
    justify-content: center;
    padding-top: 18px;
}

.quota-modal .primary-btn {
    min-width: 160px;
}

.verify-required-modal .modal-card {
    max-width: 420px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 4vw, 22px);
    padding: clamp(24px, 5vw, 32px);
}

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

.verify-required-title {
    margin: 0;
    font-size: clamp(1.35rem, 4vw, 1.6rem);
    color: #0f172a;
    padding-right: 28px;
}

.verify-required-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #1f2937;
}

.verify-required-message {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.verify-required-subtext {
    margin: 0;
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.6;
}

.verify-required-footer {
    display: flex;
    justify-content: center;
    padding-top: 6px;
}

.verify-required-button {
    min-width: 180px;
}

.email-verification-success-modal .modal-close {
    top: 18px;
    right: 18px;
}

.email-verification-success-card {
    max-width: 420px;
    position: relative;
    padding: clamp(26px, 5vw, 34px);
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 4vw, 22px);
    text-align: center;
}

.email-verification-success-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: #1f2937;
}

.email-verification-success-body h2 {
    margin: 0;
    font-size: clamp(1.35rem, 4vw, 1.6rem);
}

.email-verification-success-text {
    margin: 0;
    font-size: 0.98rem;
    color: #475569;
    line-height: 1.6;
}

.email-verification-success-footer {
    display: flex;
    justify-content: center;
}

.email-verification-success-button {
    min-width: 170px;
}

.email-verification-success-modal .primary-btn {
    font-weight: 700;
}

.premium-success-modal {
    --premium-success-padding: clamp(24px, 4vw, 36px);
    max-width: 520px;
    padding: var(--premium-success-padding);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(20px, 3vw, 28px);
}

.premium-success-modal .modal-close {
    top: 18px;
    right: 18px;
    font-size: 1.75rem;
}

.premium-success-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(20px, 3vw, 28px);
}

.premium-success-image {
    width: 100%;
    max-width: 420px;
    height: auto;
    border-radius: 18px;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
}

.premium-success-footer {
    width: 100%;
    display: flex;
    justify-content: center;
}

.premium-success-button {
    min-width: 220px;
}

@media (max-width: 600px) {
    .modal,
    .stats-export-modal {
        --modal-overlay-padding: clamp(12px, 5vw, 20px);
        padding: var(--modal-overlay-padding);
        padding-bottom: calc(var(--modal-overlay-padding) + env(safe-area-inset-bottom, 0px));
        width: 100%;
        height: var(--modal-viewport-height, 100vh);
        min-height: var(--modal-viewport-height, 100vh);
        margin: 0;
    }

    .modal-card,
    .modal-content,
    .stats-export-modal .modal-content {
        width: min(92vw, 640px);
        max-width: none;
        height: auto;
        border-radius: 12px;
        padding: clamp(16px, 5vw, 20px);
        padding-bottom: calc(clamp(16px, 5vw, 20px) + env(safe-area-inset-bottom, 16px));
        margin-inline: auto;
        box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
    }

    .modal-card {
        max-height: calc(
            var(--modal-viewport-height, 100vh) - clamp(24px, 12vh, 140px) - env(safe-area-inset-bottom, 0px)
        );
    }

    .modal-content,
    .stats-export-modal .modal-content {
        max-height: calc(
            var(--modal-viewport-height, 100vh) - clamp(24px, 12vh, 140px) - env(safe-area-inset-bottom, 0px)
        );
    }

    .premium-success-modal {
        padding-bottom: calc(var(--premium-success-padding) + env(safe-area-inset-bottom, 16px));
        align-self: flex-start;
        margin-top: clamp(28px, 12vh, 96px);
        margin-bottom: clamp(24px, 8vh, 72px);
    }
}

.modal-content {
    background-color: #fff;
    margin-inline: auto;
    padding: 20px;
    border-radius: 12px;
    width: min(92vw, 400px);
    max-height: 92vh;
    overflow: hidden;
    animation: slideDown 0.3s ease;
    box-sizing: border-box;
    justify-self: center;
    overscroll-behavior: contain;
    min-width: 0;
}

.modal > .modal-content {
    width: min(92vw, 640px);
    max-width: none;
    margin-inline: auto;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0;
}

.plant-modal .plant-modal-content {
    position: relative;
    margin: clamp(16px, 3.6vh, 34px) auto;
    width: min(88vw, 528px);
    max-width: 528px;
    max-height: min(calc(92vh - env(safe-area-inset-bottom, 0px)), 720px);
    --plant-modal-padding: clamp(16px, 2.2vw, 22px);
    padding: var(--plant-modal-padding);
    padding-bottom: calc(var(--plant-modal-padding) + env(safe-area-inset-bottom, 16px));
    border-radius: 24px;
    background: radial-gradient(circle at top left, #f0fdf4 0%, #dcfce7 55%, #f7fee7 100%);
    color: #022c22;
    box-shadow: 0 24px 60px rgba(15, 118, 110, 0.22);
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vw, 18px);
    overflow: hidden;
}

.plant-modal .plant-modal-content::before {
    content: "";
    position: absolute;
    inset: -28% auto auto -22%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.18) 0%, rgba(34, 197, 94, 0) 70%);
    pointer-events: none;
    transform: rotate(-8deg);
}

.plant-modal-close {
    position: absolute;
    top: clamp(10px, 1.6vw, 16px);
    right: clamp(10px, 1.6vw, 16px);
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: #047857;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 6px 16px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
    z-index: 2;
}

.plant-modal-close:hover,
.plant-modal-close:focus-visible {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 16px 36px rgba(21, 128, 61, 0.25);
    background: #047857;
    color: #ecfdf5;
}

.plant-modal-header {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(12px, 1.8vw, 16px);
    padding: clamp(16px, 2.4vw, 24px) clamp(16px, 2.4vw, 24px) clamp(20px, 2.8vw, 26px);
    min-height: clamp(126px, 16vh, 152px);
    border-radius: 20px;
    background: linear-gradient(120deg, rgba(21, 128, 61, 0.95), rgba(34, 197, 94, 0.88));
    color: #ecfdf5;
    overflow: hidden;
}

.plant-modal-header::after {
    content: "";
    position: absolute;
    inset: auto -40% -60% auto;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle at top, rgba(187, 247, 208, 0.35), rgba(255, 255, 255, 0));
    opacity: 0.8;
}

.plant-modal-icon {
    position: relative;
    z-index: 1;
    width: clamp(42px, 5vw, 52px);
    height: clamp(42px, 5vw, 52px);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.plant-modal-icon-leaf {
    width: 20px;
    height: 32px;
    border-radius: 50% 50% 45% 45%;
    background: radial-gradient(circle at 40% 25%, #bbf7d0 0%, #22c55e 55%, #15803d 100%);
    transform: rotate(-12deg);
    position: relative;
}

.plant-modal-icon-leaf::after {
    content: "";
    position: absolute;
    top: 12%;
    left: 50%;
    width: 3px;
    height: 78%;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 999px;
    transform: translateX(-50%);
}

.plant-modal-text {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 2px;
    align-self: center;
}

.plant-modal-kicker {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.66rem;
    font-weight: 600;
    opacity: 0.8;
    margin: 0;
}

.plant-modal-title {
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 700;
    margin: 0;
}

.plant-modal-subtitle {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}

.plant-modal-total {
    position: relative;
    z-index: 1;
    padding: 12px 14px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(236, 253, 245, 0.35);
    text-align: right;
    min-width: 120px;
}

.plant-total-label {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(236, 253, 245, 0.8);
    margin-bottom: 2px;
}

.plant-total-count {
    font-size: clamp(1.65rem, 4.6vw, 2rem);
    line-height: 1;
    font-weight: 700;
    color: #fff;
}

.plant-modal-summary {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: clamp(8px, 1.6vw, 14px);
    flex-shrink: 0;
}

.plant-summary-card {
    --accent: #15803d;
    --accent-soft: rgba(21, 128, 61, 0.18);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(15, 118, 110, 0.18);
    box-shadow: 0 10px 18px rgba(15, 118, 110, 0.14);
    backdrop-filter: blur(6px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plant-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(22, 101, 52, 0.22);
}

.plant-summary-card[data-bucket="fruits"] {
    --accent: #f97316;
    --accent-soft: rgba(249, 115, 22, 0.22);
}

.plant-summary-card[data-bucket="vegetables"] {
    --accent: #22c55e;
    --accent-soft: rgba(34, 197, 94, 0.2);
}

.plant-summary-card[data-bucket="legumes"] {
    --accent: #0ea5e9;
    --accent-soft: rgba(14, 165, 233, 0.2);
}

.plant-summary-card[data-bucket="wholeGrains"] {
    --accent: #facc15;
    --accent-soft: rgba(250, 204, 21, 0.22);
}

.plant-summary-card[data-bucket="nuts"] {
    --accent: #b45309;
    --accent-soft: rgba(180, 83, 9, 0.22);
}

.plant-summary-card[data-bucket="seeds"] {
    --accent: #6b7280;
    --accent-soft: rgba(107, 114, 128, 0.22);
}

.plant-summary-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft);
}

.plant-summary-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #065f46;
    display: block;
    letter-spacing: 0.02em;
}

.plant-summary-copy {
    display: grid;
    gap: 1px;
    flex: 1;
    justify-items: center;
    text-align: center;
}

.plant-summary-card[data-bucket="fruits"] .plant-summary-label { color: #9a3412; }
.plant-summary-card[data-bucket="legumes"] .plant-summary-label { color: #075985; }
.plant-summary-card[data-bucket="wholeGrains"] .plant-summary-label { color: #854d0e; }
.plant-summary-card[data-bucket="nuts"] .plant-summary-label { color: #7c2d12; }
.plant-summary-card[data-bucket="seeds"] .plant-summary-label { color: #44403c; }

.plant-summary-count {
    font-size: 1.22rem;
    font-weight: 700;
    line-height: 1.05;
    color: #022c22;
    justify-self: center;
}

.plant-summary-card[data-bucket="fruits"] .plant-summary-count { color: #9a3412; }
.plant-summary-card[data-bucket="vegetables"] .plant-summary-count { color: #166534; }
.plant-summary-card[data-bucket="legumes"] .plant-summary-count { color: #0369a1; }
.plant-summary-card[data-bucket="wholeGrains"] .plant-summary-count { color: #854d0e; }
.plant-summary-card[data-bucket="nuts"] .plant-summary-count { color: #78350f; }
.plant-summary-card[data-bucket="seeds"] .plant-summary-count { color: #3f3f46; }

.plant-modal-body {
    margin-top: 0;
    padding: clamp(14px, 2.3vw, 20px);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08), 0 16px 28px rgba(15, 118, 110, 0.15);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.plant-modal-body-heading {
    display: grid;
    gap: 3px;
    margin-bottom: clamp(10px, 2.2vw, 16px);
}

.plant-modal-body-title {
    font-size: 0.86rem;
    margin: 0;
    color: #065f46;
}

.plant-modal-body-subtitle {
    margin: 0;
    font-size: 0.82rem;
    color: #475569;
}

@media (max-width: 640px) {
    .plant-modal-header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .plant-modal-text {
        justify-items: center;
    }

    .plant-modal-total {
        display: none;
    }

    .plant-summary-card {
        padding: 12px 14px;
    }
}

.modal-subtitle {
    margin: 4px 0 18px;
    color: #6b7280;
    font-size: 0.95rem;
}

.plant-modal .modal-subtitle.plant-modal-subtitle {
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 6px;
}

.plant-tracker-page {
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(187, 247, 208, 0.45), rgba(236, 253, 245, 0.9)), #f0fdf4;
    color: #022c22;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.plant-tracker-appbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px clamp(18px, 4vw, 28px);
    background: linear-gradient(120deg, rgba(15, 118, 110, 0.92), rgba(22, 163, 74, 0.85));
    color: #ecfdf5;
    box-shadow: 0 12px 30px rgba(22, 101, 52, 0.28);
}

.plant-tracker-heading {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
}

.plant-tracker-main {
    flex: 1;
    width: min(100%, 760px);
    margin: 0 auto;
    padding: clamp(16px, 4vw, 32px) clamp(16px, 5vw, 32px) 96px;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 28px);
    box-sizing: border-box;
}

.plant-tracker-week-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 14px;
    border-radius: 16px;
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.18);
}

.plant-tracker-week-label {
    text-align: center;
    font-weight: 600;
    color: #065f46;
    font-size: 0.95rem;
}

.plant-tracker-nav-btn {
    border: none;
    background: rgba(21, 128, 61, 0.12);
    color: #14532d;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.plant-tracker-nav-btn:hover:not(:disabled),
.plant-tracker-nav-btn:focus-visible:not(:disabled) {
    background: rgba(21, 128, 61, 0.22);
    transform: translateY(-1px);
}

.plant-tracker-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.plant-tracker-today-btn {
    align-self: flex-end;
    border: none;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.92), rgba(16, 185, 129, 0.88));
    color: #ecfdf5;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.32);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.plant-tracker-today-btn:hover:not(:disabled),
.plant-tracker-today-btn:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(5, 150, 105, 0.36);
}

.plant-tracker-today-btn:disabled {
    opacity: 0.55;
    cursor: default;
    box-shadow: none;
}

.plant-tracker-card {
    background: radial-gradient(circle at top left, #f0fdf4 0%, #dcfce7 55%, #f7fee7 100%);
    border-radius: 26px;
    box-shadow: 0 28px 60px rgba(15, 118, 110, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 3vw, 24px);
}

.plant-tracker-card.is-empty .plant-modal-body {
    opacity: 0.9;
}

.plant-tracker-summary {
    padding: 0 clamp(18px, 3vw, 28px);
}

.plant-tracker-empty {
    margin-top: -8px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    padding: 18px 20px;
    color: #166534;
    font-weight: 500;
    box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.12);
    text-align: center;
}

.plant-tracker-loading {
    position: fixed;
    inset: auto 16px 24px 16px;
    background: rgba(6, 95, 70, 0.92);
    color: #ecfdf5;
    padding: 12px 18px;
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(15, 118, 110, 0.35);
    font-weight: 600;
    text-align: center;
    z-index: 20;
}

@media (min-width: 768px) {
    .plant-tracker-heading {
        font-size: 1.6rem;
        text-align: center;
    }

    .plant-tracker-main {
        padding-top: 42px;
    }

    .plant-tracker-week-controls {
        padding: 14px 20px;
    }
}

.close,
.view-close {
    float: right;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Refined meal detail modal */
.modal-content.meal-view-modal {
    width: min(92vw, 700px);
    max-width: 700px;
    max-height: min(92vh, 720px);
    margin: 0 auto;
    padding: clamp(20px, 3vw, 28px);
    border-radius: 26px;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.94), rgba(14, 116, 144, 0.92));
    color: #f8fafc;
    box-shadow: 0 32px 80px rgba(15, 23, 42, 0.45);
    position: relative;
    overflow: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2.5vw, 28px);
}

.meal-view-modal::after {
    content: "";
    position: absolute;
    inset: -40% -20% auto;
    height: 60%;
    background: radial-gradient(circle at top right, rgba(96, 165, 250, 0.35), transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.meal-view-modal > * {
    position: relative;
    z-index: 1;
}


.meal-view-modal .view-close {
    position: relative;
    top: 0;
    right: 0;
    float: none;
    margin-left: auto;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.2rem;
    min-width: 82px;
    background: rgba(15, 23, 42, 0.55);
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.45);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    z-index: 6;
    pointer-events: auto;
    touch-action: manipulation;
}

.meal-view-modal .view-close:hover,
.meal-view-modal .view-close:focus-visible {
    background: rgba(15, 23, 42, 0.75);
    transform: translateY(-1px);
}

.meal-modal-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.meal-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.meal-color-accent {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid rgba(248, 250, 252, 0.7);
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.25);
    background: rgba(148, 163, 184, 0.6);
}

.meal-meta-chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.35);
    color: rgba(241, 245, 249, 0.95);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.meal-prepped-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.45);
    color: #f8fafc;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 700;
}

.meal-prepped-chip[hidden] {
    display: none !important;
}

.meal-prepped-chip::before {
    content: "●";
    font-size: 0.65rem;
    line-height: 1;
}

.meal-view-modal .meal-tag-badge {
    margin: 0;
    background: rgba(191, 219, 254, 0.2);
    color: #e0f2fe;
    border: 1px solid rgba(191, 219, 254, 0.35);
}

.meal-hero {
    display: grid;
    grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
    gap: clamp(16px, 2.5vw, 24px);
    align-items: start;
}

.meal-prepped-prompt {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.35);
}

.meal-prepped-prompt__text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #f8fafc;
}

.meal-prepped-prompt__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.meal-prepped-prompt[hidden] {
    display: none !important;
}

.meal-image-frame {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: clamp(200px, 32vh, 280px);
    background: rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.4);
}

.meal-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.meal-image-frame .meal-image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 18px;
    background: linear-gradient(135deg, rgba(14, 116, 144, 0.55), rgba(37, 99, 235, 0.4));
    color: rgba(240, 249, 255, 0.92);
    font-weight: 600;
    letter-spacing: 0.03em;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.meal-image-frame.is-empty img {
    display: none;
}

.meal-image-frame.is-empty .meal-image-placeholder {
    opacity: 1;
}

.meal-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.meal-hero-copy h2 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 700;
    color: #f8fafc;
}

.meal-time {
    margin: -4px 0 4px;
    color: #ffffff !important;
    font-weight: 700;
    text-align: center;
    align-self: center;
    letter-spacing: 0.01em;
}

.meal-time[hidden] {
    display: none !important;
}

.meal-view-modal .meal-description {
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.98rem;
    line-height: 1.5;
}

.meal-explanation {
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.4);
    padding: 12px 16px;
    color: rgba(226, 232, 240, 0.9);
}

.meal-explanation summary {
    cursor: pointer;
    font-weight: 600;
    color: #e0f2fe;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

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

.meal-explanation summary::after {
    content: "";
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.meal-explanation summary:focus-visible {
    outline: 2px solid rgba(125, 211, 252, 0.8);
    outline-offset: 3px;
}

.meal-explanation summary:hover {
    color: #bae6fd;
}

.meal-explanation[open] summary::after {
    transform: rotate(-135deg);
}

.meal-explanation div {
    margin-top: 8px;
    line-height: 1.45;
}

.meal-nutrition {
    background: rgba(15, 23, 42, 0.32);
    border-radius: 22px;
    padding: clamp(16px, 2.5vw, 20px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.meal-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.meal-section-heading h3 {
    margin: 0;
    font-size: 1.08rem;
    color: #f8fafc;
}

.meal-section-subtitle {
    color: rgba(226, 232, 240, 0.75);
    font-size: 0.85rem;
    font-weight: 500;
}

.meal-nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.meal-metric-card {
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meal-metric-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.7);
    font-weight: 600;
}

.meal-metric-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f8fafc;
}

.meal-metric-value .meal-metric-unit {
    margin-left: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(226, 232, 240, 0.65);
}

.meal-edit-lock {
    margin: 0;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.38);
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.meal-quick-edit-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 22px;
    background: rgba(15, 23, 42, 0.32);
    border: 1px solid rgba(148, 163, 184, 0.28);
    backdrop-filter: blur(6px);
}

.meal-quick-edit-panel.is-collapsed {
    gap: 10px;
    padding-bottom: 12px;
}

.meal-quick-edit-panel[hidden] {
    display: none !important;
}

.quick-edit-toggle {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    background: rgba(59, 130, 246, 0.24);
    color: #e0f2fe;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.quick-edit-toggle::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(224, 242, 254, 0.85);
    transition: transform 0.2s ease;
}

.quick-edit-toggle.is-open::after {
    transform: rotate(180deg);
}

.quick-edit-toggle:hover,
.quick-edit-toggle:focus-visible {
    background: rgba(59, 130, 246, 0.35);
    outline: none;
}

.quick-edit-toggle:focus-visible {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.45);
}

.meal-quick-edit {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: clamp(12px, 2vw, 18px);
    border-radius: 20px;
    background: rgba(248, 250, 252, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.24);
    backdrop-filter: blur(8px);
}

.meal-quick-edit[hidden] {
    display: none !important;
}

.meal-quick-edit-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.quick-edit-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.9rem;
}

.quick-edit-field span {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.quick-edit-field input,
.quick-edit-field textarea,
.quick-edit-field select {
    border: none;
    border-radius: 12px;
    padding: 9px 12px;
    background: rgba(248, 250, 252, 0.92);
    color: #0f172a;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

.quick-edit-field textarea {
    resize: vertical;
    min-height: 72px;
}

.quick-edit-field input[type="color"] {
    padding: 0;
    height: 42px;
    cursor: pointer;
}

.quick-edit-field input[type="file"] {
    padding: 8px 0;
    background: transparent;
    color: rgba(248, 250, 252, 0.92);
    box-shadow: none;
}

.quick-edit-field input[type="file"]::file-selector-button {
    border: none;
    margin-right: 12px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.9);
    color: #f8fafc;
    cursor: pointer;
}

.quick-edit-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meal-quick-edit .tag-buttons button {
    border-radius: 18px;
    padding: 6px 12px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(248, 250, 252, 0.9);
    color: #0f172a;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.meal-quick-edit .tag-buttons button:hover,
.meal-quick-edit .tag-buttons button:focus-visible {
    background: rgba(191, 219, 254, 0.9);
    border-color: rgba(59, 130, 246, 0.9);
    outline: none;
}

.meal-quick-edit .tag-buttons button.selected {
    background: rgba(59, 130, 246, 0.92);
    border-color: rgba(37, 99, 235, 0.95);
    color: #f8fafc;
    box-shadow: 0 8px 14px rgba(37, 99, 235, 0.35);
}

.quick-edit-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.quick-edit-colors .color-dot {
    width: 26px;
    height: 26px;
    border-width: 2px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12) inset;
}

.quick-edit-colors .color-dot.selected {
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.18) inset, 0 0 0 2px rgba(15, 23, 42, 0.45);
    border-color: rgba(15, 23, 42, 0.75);
}

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

.quick-edit-metrics {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.quick-edit-metrics .quick-edit-field input {
    text-align: center;
}

.meal-quick-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.meal-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.meal-modal-footer .danger-btn {
    background: rgba(239, 68, 68, 0.92);
}

.meal-modal-footer .danger-btn:hover {
    background: rgba(220, 38, 38, 0.95);
}

.copy-meal-dialog {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 32px);
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(2px);
    z-index: 8;
}

.copy-meal-dialog.is-visible {
    display: flex;
}

.meal-mood-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.meal-mood-label {
    margin: 0;
    font-weight: 600;
    color: #ffffff !important;
    text-align: center;
}

.meal-mood-options {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.meal-mood-more {
    position: relative;
}

.meal-mood-option {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 2px solid transparent;
    background: rgba(15, 23, 42, 0.35);
    color: #f8fafc;
    font-size: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.meal-mood-more-toggle {
    font-weight: 700;
}

.meal-mood-dropdown {
    position: fixed;
    inset: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 10px 26px;
    min-width: 180px;
    max-height: min(320px, 60vh);
    max-width: min(340px, calc(100vw - 24px));
    background: rgba(15, 23, 42, 0.95);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.45);
    z-index: 20000;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.meal-mood-dropdown[hidden] {
    display: none !important;
}

.meal-mood-dropdown .meal-mood-dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(15, 23, 42, 0.35);
    color: #f8fafc;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.meal-mood-dropdown .meal-mood-dropdown-option .emoji {
    font-size: 1.2rem;
}

.meal-mood-dropdown .meal-mood-dropdown-option:hover,
.meal-mood-dropdown .meal-mood-dropdown-option:focus-visible {
    background: rgba(191, 219, 254, 0.2);
    border-color: rgba(125, 211, 252, 0.6);
    transform: translateY(-1px);
    outline: none;
}

.meal-mood-dropdown .meal-mood-dropdown-option.is-selected {
    background: rgba(59, 130, 246, 0.9);
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 12px 22px rgba(59, 130, 246, 0.35);
}

.meal-mood-option:hover,
.meal-mood-option:focus-visible {
    background: rgba(191, 219, 254, 0.2);
    border-color: rgba(125, 211, 252, 0.6);
    transform: translateY(-1px);
    outline: none;
}

.meal-mood-option.is-selected {
    background: rgba(59, 130, 246, 0.9);
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 12px 22px rgba(59, 130, 246, 0.35);
}

.meal-mood-option:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.meal-mood-status {
    margin: 0;
    min-height: 18px;
    font-size: 0.9rem;
    color: #ffffff !important;
    text-align: center;
}

@media (max-width: 640px) {
    .meal-mood-label,
    .meal-mood-status {
        color: #ffffff !important;
    }
}

.copy-meal-dialog-card {
    width: min(520px, 100%);
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    border-radius: 22px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.55);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.copy-meal-dialog-header h3 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: 0.01em;
}

.copy-meal-dialog-description {
    margin: 8px 0 0;
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.95rem;
    line-height: 1.4;
}

.copy-meal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.copy-meal-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.copy-meal-date-input {
    flex: 1 1 200px;
    min-width: 180px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.35);
    color: #f8fafc;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.45);
}

.copy-meal-date-input:focus-visible {
    outline: 2px solid rgba(96, 165, 250, 0.75);
    outline-offset: 1px;
}

.copy-meal-message {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
}

.copy-meal-message[data-state="error"] {
    color: #fca5a5;
}

.copy-meal-message[data-state="success"] {
    color: #6ee7b7;
}

.copy-meal-message[data-state="info"] {
    color: rgba(191, 219, 254, 0.9);
}

.copy-meal-date-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
}

.copy-meal-date-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.copy-meal-date-label {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.copy-meal-empty {
    text-align: center;
    font-style: italic;
    color: rgba(226, 232, 240, 0.7);
    padding: 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px dashed rgba(148, 163, 184, 0.35);
}

.copy-meal-remove-btn {
    background: transparent;
    border: none;
    color: #fca5a5;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.copy-meal-remove-btn:hover,
.copy-meal-remove-btn:focus-visible {
    background: rgba(252, 165, 165, 0.18);
    color: #fecaca;
}

.copy-meal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
}

.copy-meal-actions .link-btn {
    color: rgba(191, 219, 254, 0.92);
}

.copy-meal-actions .link-btn:hover,
.copy-meal-actions .link-btn:focus-visible {
    color: #fff;
}

@media (max-width: 560px) {
    .copy-meal-dialog-card {
        padding: 20px;
    }

    .copy-meal-add-row {
        flex-direction: column;
        align-items: stretch;
    }

    .copy-meal-date-input {
        width: 100%;
    }

    .copy-meal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .copy-meal-actions .primary-btn,
.copy-meal-actions .link-btn {
        width: 100%;
        text-align: center;
    }
}

.settings-toast {
    position: fixed;
    top: clamp(16px, 5vh, 48px);
    right: clamp(16px, 5vw, 48px);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 16px 20px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.96), rgba(14, 116, 144, 0.96));
    color: #f8fafc;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
    font-size: 0.95rem;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.32s ease, transform 0.32s ease;
    pointer-events: none;
    z-index: 1400;
}

.settings-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.settings-toast__message {
    flex: 1;
    font-weight: 600;
}

.settings-toast__dismiss {
    appearance: none;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.settings-toast__dismiss:hover,
.settings-toast__dismiss:focus-visible {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.settings-toast__dismiss:focus-visible {
    outline: 3px solid rgba(191, 219, 254, 0.8);
    outline-offset: 2px;
}

.meal-toast {
    position: fixed;
    top: clamp(12px, 4vh, 32px);
    left: 50%;
    transform: translate(-50%, -140%);
    padding: 12px 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
    color: #ecfdf5;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 24px 50px rgba(6, 95, 70, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
    z-index: 1200;
}

.meal-toast.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

@media (max-width: 768px) {
    .modal-content.meal-view-modal {
        width: min(96vw, 600px);
        padding: 20px 18px calc(140px + env(safe-area-inset-bottom));
        border-radius: 22px;
        max-height: calc(100vh - 48px);
    }

    .meal-hero {
        grid-template-columns: 1fr;
    }

    .meal-quick-edit-panel {
        padding: 14px 16px;
    }

    .quick-edit-toggle {
        width: 100%;
        justify-content: center;
    }

    .meal-toast {
        width: clamp(240px, 88vw, 420px);
        border-radius: 22px;
        padding: 14px 22px;
        top: auto;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        transform: translate(-50%, 140%);
    }

    .meal-modal-footer {
        justify-content: stretch;
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .meal-modal-footer .danger-btn {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .meal-chip-group {
        gap: 6px;
    }

    .meal-meta-chip {
        font-size: 0.78rem;
    }

    .meal-nutrition-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Collapsible edit section */
/* Add Meal modal */
.add-meal-modal {
    width: min(640px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(20px, 4vw, 28px);
    overflow: hidden;
    overscroll-behavior: contain;
    --add-meal-content-width: 100%;
}

.add-meal-modal .modal-header {
    width: 100%;
    width: var(--add-meal-content-width);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-bottom: clamp(12px, 2vw, 18px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    column-gap: clamp(12px, 2vw, 18px);
    flex-shrink: 0;
}
.add-meal-modal .modal-header::before {
    content: "";
    width: var(--modal-header-action);
    height: var(--modal-header-action);
    border-radius: 999px;
    visibility: hidden;
}

.add-meal-modal h2 {
    margin: 0;
    font-size: clamp(1.4rem, 1.05vw + 1.1rem, 1.85rem);
    color: #0f172a;
    text-align: center;
}

.add-meal-modal .close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #f8fafc;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.add-meal-modal .close:hover,
.add-meal-modal .close:focus-visible {
    background: #dcfce7;
    color: #166534;
    box-shadow: 0 8px 20px rgba(21, 128, 61, 0.18);
    outline: none;
}

.add-meal-modal .close span {
    pointer-events: none;
}

.add-meal-form {
    width: 100%;
    width: var(--add-meal-content-width);
    max-width: 460px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 4vw, 28px);
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.add-meal-form .form-grid {
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 4vw, 28px);
    width: 100%;
    max-width: 100%;
    max-width: var(--add-meal-content-width);
    margin-inline: auto;
}

.add-meal-form .form-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.add-meal-form .block-title {
    font-weight: 700;
    font-size: 1rem;
    color: #065f46;
    margin: 0;
    text-align: center;
}

.add-meal-form label {
    font-size: 0.95rem;
    color: #0f172a;
    text-align: center;
}

.add-meal-form label strong {
    font-weight: 600;
}

.add-meal-form .photo-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.add-meal-form .upload-circle {
    display: flex;
    justify-content: center;
}

.add-meal-form .photo-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.add-meal-form #imagePreview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.add-meal-form #imagePreview img {
    max-width: 180px;
    width: 100%;
    border-radius: 12px;
}

.add-meal-form #imagePreview .change-image-btn {
    margin: 0;
}

.add-meal-form .field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.add-meal-form .meta-block {
    gap: 18px;
}

.add-meal-form .color-group {
    gap: 12px;
}

.add-meal-form .color-choices {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.add-meal-form textarea,
.add-meal-form input[type="date"],
.add-meal-form input[type="time"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(21, 128, 61, 0.28);
    background: #f0fdf4;
    color: #0f172a;
    box-sizing: border-box;
    text-align: center;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.add-meal-form .field-group--time {
    align-items: center;
}

.add-meal-form .field-group--time input {
    max-width: 220px;
}

.add-meal-form textarea:focus,
.add-meal-form textarea:focus-visible,
.add-meal-form input[type="date"]:focus,
.add-meal-form input[type="date"]:focus-visible {
    border-color: rgba(21, 128, 61, 0.55);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
    outline: none;
}

.add-meal-form textarea {
    resize: vertical;
    min-height: 110px;
}

@media (max-width: 640px) {
  body.add-meal-page .add-meal-form input[type="date"] {
    width: min(100%, 260px);
    margin-inline: auto;
    display: block;
  }
}

.add-meal-form .tag-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.add-meal-form .tag-buttons button {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(21, 128, 61, 0.35);
    background: #ecfdf5;
    color: #065f46;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.add-meal-form .tag-buttons button:hover,
.add-meal-form .tag-buttons button:focus-visible {
    background: #bbf7d0;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.22);
    outline: none;
}

.add-meal-form .form-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.add-meal-form .primary-btn {
    width: 100%;
    max-width: 320px;
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    color: #f0fdf4;
    padding: 14px 24px;
    border-radius: 999px;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 18px 36px rgba(21, 128, 61, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.add-meal-form .primary-btn:hover,
.add-meal-form .primary-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 24px 44px rgba(21, 128, 61, 0.32);
    outline: none;
}

.add-meal-form .muted {
    text-align: center;
}

@media (max-width: 640px) {
    #mealModal.modal {
        padding: 0 !important;
    }

    .modal-card.add-meal-modal {
        display: flex;
        flex-direction: column;
        width: 100vw !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 16px !important;
        border-radius: 0 !important;
        box-shadow: none;
        align-items: center;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .modal-card.add-meal-modal .modal-header,
    .modal-card.add-meal-modal .add-meal-form {
        width: 100%;
        max-width: min(84vw, 440px);
        margin-inline: auto;
    }

    .modal-card.add-meal-modal .close {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .modal-card.add-meal-modal .add-meal-form {
        gap: clamp(16px, 6vw, 24px);
        align-self: center;
    }

    .modal-card.add-meal-modal .form-grid {
        gap: clamp(16px, 6vw, 24px);
        width: 100%;
        max-width: min(84vw, 440px);
        margin-inline: auto;
    }

    .modal-card.add-meal-modal #imagePreview img {
        max-width: 140px;
    }
}

#logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0 5px 0;
}
#site-logo {
    max-width: 100px;
    height: auto;
}

/* Quick meal suggestion buttons */
.quick-meal-buttons {
    display: flex;
    gap: 8px;
    margin: 8px 0 15px;
}
.quick-meal-buttons button {
    flex: 1;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    background: #d1f0db;
    border: 1px solid #9bc9ac;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.quick-meal-buttons button:hover {
    background: #b8e5c6;
    transform: scale(1.05);
}

/* Highlight current day column */
.day-column.today {
    position: relative;
    border-color: rgba(46, 125, 50, 0.9);
    outline: 3px solid rgba(56, 142, 60, 0.65);
    outline-offset: 4px;
    box-shadow: 0 0 0 2px rgba(129, 199, 132, 0.85), 0 0 28px 6px rgba(56, 142, 60, 0.5);
    background: linear-gradient(180deg, rgba(227, 252, 232, 0.92) 0%, #ffffff 65%);
    z-index: 1;
}

.day-column.today::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 3px solid rgba(129, 199, 132, 0.75);
    box-shadow: 0 0 28px rgba(76, 175, 80, 0.5);
    opacity: 0.95;
    pointer-events: none;
    z-index: -1;
}

/* Header bar layout */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 20px;
    margin-bottom: 10px;
    position: relative;
    z-index: 5;
}

html.modal-open #top-bar {
    margin-right: calc(var(--modal-scrollbar-compensation, 0px) * -1);
    padding-right: calc(20px + var(--modal-scrollbar-compensation, 0px));
}

#jumpDateBtn {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: calc(env(safe-area-inset-right, 0px) + var(--jump-date-inline-offset));
    width: clamp(36px, 10vw, 44px);
    height: clamp(36px, 10vw, 44px);
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #0f172a;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
    transition: box-shadow 0.18s ease, opacity 0.18s ease;
    cursor: pointer;
    padding: 0;
    z-index: 6;
    touch-action: manipulation;
    opacity: 0.96;
    transform-origin: center;
}

.jump-date-native-input {
    position: fixed;
    top: 0;
    left: -10000px;
    width: 1px;
    height: 1px;
    opacity: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    color: transparent;
    z-index: -1;
    appearance: none;
}

#jumpDateBtn[aria-expanded="true"] {
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
}

#jumpDateBtn .jump-date-btn-icon {
    width: clamp(18px, 5vw, 22px);
    height: clamp(18px, 5vw, 22px);
    fill: currentColor;
}

#jumpDateBtn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#jumpDateBtn:active {
    opacity: 0.88;
}

@media (hover: hover) {
    #jumpDateBtn:hover {
        box-shadow: 0 12px 26px rgba(15, 23, 42, 0.22);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    #jumpDateBtn {
        display: none;
    }
}


body.home-page #top-bar {
    --home-top-bar-block-padding: clamp(4px, 1vw, 10px);
    --home-top-bar-inline-padding: clamp(16px, 3vw, 32px);
    --home-top-bar-min-height: clamp(110px, 14vw, 170px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    justify-content: center;
    column-gap: clamp(14px, 2.5vw, 32px);
    row-gap: clamp(10px, 2vw, 20px);
    padding: var(--home-top-bar-block-padding) var(--home-top-bar-inline-padding);
    margin-bottom: clamp(6px, 1vw, 14px);
    min-height: var(--home-top-bar-min-height);
}

.floating-banner-stack {
    position: relative;
    width: 100%;
    z-index: 2;
}

.upgrade-banner {
    position: relative;
    z-index: 1;
    background: linear-gradient(90deg, #1d4ed8, #2563eb);
    color: #f8fafc;
    padding: 12px clamp(16px, 4vw, 28px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
    margin-bottom: clamp(12px, 3vw, 20px);
}

.upgrade-banner[hidden] {
    display: none !important;
}

.upgrade-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto;
}

.upgrade-banner-text {
    font-size: clamp(0.95rem, 1.8vw, 1.05rem);
    font-weight: 500;
    margin: 0;
}

.upgrade-banner-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.upgrade-banner-button {
    background: #facc15;
    color: #1f2937;
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 18px rgba(234, 179, 8, 0.35);
}

.upgrade-banner-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(234, 179, 8, 0.45);
}

.upgrade-banner-button:disabled {
    opacity: 0.6;
    cursor: progress;
    transform: none;
}

.guest-banner {
    position: relative;
    margin: 16px auto;
    padding: 16px 20px;
    padding-right: clamp(48px, 14vw, 72px);
    background: #0f172a;
    color: #f8fafc;
    border-radius: 18px;
    max-width: 720px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.guest-banner[hidden] {
    display: none !important;
}

.guest-banner-content {
    max-width: 640px;
    margin: 0 auto;
}

.guest-banner-heading {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 600;
}

.guest-banner-message {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #e2e8f0;
}

.guest-banner-dismiss {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.65);
    color: #f1f5f9;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.guest-banner-dismiss:hover,
.guest-banner-dismiss:focus-visible {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(248, 250, 252, 0.6);
    transform: translateY(-1px);
}

.guest-banner-dismiss:focus-visible {
    outline: 2px solid #facc15;
    outline-offset: 2px;
}

.guest-banner-dismiss span[aria-hidden="true"] {
    line-height: 1;
}

@media (max-width: 640px) {
    .guest-banner {
        padding: 14px 16px;
        padding-right: clamp(42px, 18vw, 60px);
        border-radius: 16px;
    }

    .guest-banner-heading {
        font-size: 1rem;
    }

    .guest-banner-message {
        font-size: 0.9rem;
    }

    .guest-banner-dismiss {
        width: 32px;
        height: 32px;
        top: 8px;
        right: 10px;
    }
}

@media (max-width: 600px) {
    .upgrade-banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .upgrade-banner-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .upgrade-banner-button {
        flex: 1 1 auto;
        text-align: center;
        width: 100%;
    }
}

.floating-banner-spacer {
    display: block;
    width: 100%;
    height: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .floating-banner-stack {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px));
        left: 0;
        right: 0;
        z-index: 900;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        pointer-events: none;
    }

    .floating-banner-stack > .upgrade-banner,
    .floating-banner-stack > .guest-banner {
        pointer-events: auto;
    }

    .floating-banner-stack > .guest-banner {
        margin-top: 0;
    }

    .floating-banner-spacer {
        height: var(--floating-header-offset, 0px);
    }
}

.top-bar-left {
    --top-bar-left-gap: 10px;
    display: flex;
    align-items: center;
    gap: var(--top-bar-left-gap);
}

body.home-page .top-bar-center {
    position: static;
    left: auto;
    transform: none;
    grid-column: 2;
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 0;
}

body.home-page .top-bar-right {
    grid-column: 3;
    justify-self: end;
}

body.home-page .top-bar-left,
body.home-page .top-bar-right {
    align-items: center;
    min-width: 0;
}

body.home-page .top-bar-left {
    grid-column: 1;
    justify-self: start;
}

.top-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
}

body.home-page .top-bar-right {
    justify-content: flex-end;
    flex: 0 1 auto;
}

.profile-menu-wrapper {
    position: relative;
    z-index: 50;
}

.coach-review-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--coach-review-btn-diameter, 68px);
    flex: 0 0 auto;
}

.coach-review-launcher {
    position: absolute;
    top: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 20;
    --coach-review-btn-diameter: 68px;
}

@media (min-width: 901px) {
    body.home-page .coach-review-launcher {
        top: calc(100% + 36px);
        left: calc(
            50% - (
                var(--top-bar-left-gap) +
                var(--profile-avatar-diameter) / 2 +
                var(--coach-review-btn-diameter) / 2
            )
        );
    }
}

.coach-review-btn {
    border: none;
    background: transparent;
    border-radius: 50%;
    padding: 0;
    width: 68px;
    height: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.coach-review-btn:hover,
.coach-review-btn:focus-visible {
    transform: translateY(-4px);
}

.coach-review-btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.7);
    outline-offset: 3px;
}

@keyframes coachReviewBounceTwice {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-14px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.coach-review-btn.coach-bounce-twice {
    animation: coachReviewBounceTwice 1.1s ease;
}

@keyframes coachReviewBounceLoop {
    0%,
    100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-12px);
    }
    55% {
        transform: translateY(0);
    }
    72% {
        transform: translateY(-6px);
    }
}

#coachReviewToggle.coachmark-bounce-loop {
    animation: coachReviewBounceLoop 1.3s ease-in-out infinite;
    transform-origin: center bottom;
}

.coach-review-hover-label {
    position: absolute;
    top: calc(var(--coach-review-btn-diameter) / 2);
    left: calc(100% + 16px);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2563eb;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    padding: 4px 14px;
    pointer-events: none;
    opacity: 0;
    --coach-review-label-offset: 0px;
    transform: translate(0, -50%) translateY(var(--coach-review-label-offset));
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
    white-space: nowrap;
}

.coach-review-btn:hover + .coach-review-hover-label,
.coach-review-btn:focus-visible + .coach-review-hover-label,
.coach-review-btn:focus + .coach-review-hover-label {
    opacity: 1;
}

.coach-review-btn:hover + .coach-review-hover-label,
.coach-review-btn:focus-visible + .coach-review-hover-label,
.coach-review-btn:focus + .coach-review-hover-label {
    animation: coachHoverLabelBounce 0.9s ease-in-out infinite;
}

#goalCoachmark {
    --coachmark-bg: #1d4ed8;
    position: absolute;
    top: 50%;
    left: calc(100% + 18px);
    transform: translateY(-50%) translateX(12px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    min-width: 220px;
    max-width: 280px;
}

#goalCoachmark.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

#goalCoachmark .coachmark-bubble {
    background: var(--coachmark-bg);
    color: #f8fafc;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.35);
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    align-items: start;
}

#goalCoachmark .coachmark-message {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
}

#goalCoachmark .coachmark-close {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

#goalCoachmark .coachmark-close:hover,
#goalCoachmark .coachmark-close:focus-visible {
    color: rgba(241, 245, 249, 0.9);
    outline: 2px solid rgba(241, 245, 249, 0.6);
    outline-offset: 2px;
    border-radius: 6px;
}

#goalCoachmark .coachmark-arrow {
    position: absolute;
    top: 50%;
    left: -14px;
    width: 0;
    height: 0;
    border-right: 14px solid var(--coachmark-bg);
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    transform: translateY(-50%);
}

.coach-review-btn-img {
    width: 68px;
    height: auto;
    display: block;
    filter: drop-shadow(0 10px 24px rgba(15, 23, 42, 0.22));
    transition: filter 0.2s ease;
}

.coach-review-btn:hover .coach-review-btn-img,
.coach-review-btn:focus-visible .coach-review-btn-img {
    filter: drop-shadow(0 14px 32px rgba(37, 99, 235, 0.35));
}

.coach-review-panel {
    position: absolute;
    top: -6px;
    left: 88px;
    width: min(320px, 80vw);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.24);
    padding: 18px;
    backdrop-filter: blur(12px);
    display: flex;
    z-index: 10;
}

.coach-review-panel[hidden] {
    display: none !important;
}

.coach-review-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.coach-review-panel-header h2 {
    font-size: 1.05rem;
    margin: 0 0 4px;
}

.coach-review-panel-subtext {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(15, 23, 42, 0.7);
}

.coach-calendar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coach-calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.coach-calendar-nav {
    border: none;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    transition: background 0.2s ease, transform 0.2s ease;
}

.coach-calendar-nav:hover,
.coach-calendar-nav:focus-visible {
    background: rgba(37, 99, 235, 0.18);
    transform: translateY(-1px);
    outline: none;
}

.coach-calendar-month {
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.coach-calendar-headings {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(15, 23, 42, 0.55);
}

.coach-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.coach-calendar-cell {
    position: relative;
    border: none;
    border-radius: 12px;
    padding: 8px 0;
    font-size: 0.9rem;
    background: rgba(226, 232, 240, 0.6);
    color: rgba(15, 23, 42, 0.5);
    cursor: default;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.coach-calendar-cell.is-available {
    cursor: pointer;
    background: rgba(59, 130, 246, 0.18);
    color: #1d4ed8;
    font-weight: 600;
}

.coach-calendar-cell.has-review:not(.is-selected) {
    background: linear-gradient(135deg, #34d399, #059669);
    color: #022c22;
    box-shadow: inset 0 0 0 1px rgba(5, 150, 105, 0.35);
}

.coach-calendar-cell.has-review:not(.is-selected):hover,
.coach-calendar-cell.has-review:not(.is-selected):focus-visible {
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
}

.coach-calendar-cell.is-available:hover,
.coach-calendar-cell.is-available:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
    outline: none;
}

.coach-calendar-cell.is-selected {
    background: linear-gradient(135deg, #2563eb, #4c1d95);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.coach-calendar-cell.has-review.is-selected {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
}

.coach-calendar-cell.is-outside {
    opacity: 0.35;
}

.coach-calendar-cell:disabled {
    cursor: default;
    opacity: 0.4;
}

.coach-calendar-status {
    font-size: 0.8rem;
    min-height: 1.2rem;
    color: rgba(15, 23, 42, 0.7);
}

.coach-review-request {
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb, #4c1d95);
    color: #ffffff;
    font-weight: 600;
    padding: 10px 18px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.coach-review-request:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.coach-review-request:not(:disabled):hover,
.coach-review-request:not(:disabled):focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(76, 29, 149, 0.3);
    outline: none;
}

.coach-review-week-option {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    text-align: center;
}

.coach-review-week-hint {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: rgba(15, 23, 42, 0.7);
}

.coach-review-week-btn {
    border-radius: 999px;
    border: 1px solid rgba(76, 29, 149, 0.3);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(76, 29, 149, 0.12));
    color: #1f2937;
    font-weight: 600;
    padding: 8px 18px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.coach-review-week-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.coach-review-week-btn:not(:disabled):hover,
.coach-review-week-btn:not(:disabled):focus-visible {
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(76, 29, 149, 0.18));
    box-shadow: 0 10px 18px rgba(76, 29, 149, 0.2);
    outline: none;
}

.coach-review-week-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.coach-review-usage {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(15, 23, 42, 0.65);
    text-align: center;
}

.coach-review-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    padding: 24px;
    z-index: 3000;
}

.coach-review-modal.is-visible {
    display: flex;
    animation: coachModalFade 0.25s ease;
}

.coach-review-modal[hidden] {
    display: none !important;
}

.coach-review-modal-card {
    position: relative;
    width: min(480px, 92vw);
    max-height: 92vh;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.35);
    padding: 28px 28px 32px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    overflow: hidden;
    overscroll-behavior: contain;
}

.coach-review-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow-y: auto;
    padding-top: 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.coach-review-modal-footer {
    margin-top: auto;
    display: flex;
    justify-content: center;
}

.week-review-modal-footer {
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.week-review-modal-image {
    max-width: 280px;
}

.week-review-range {
    margin: 0;
    font-weight: 600;
    color: #1d4ed8;
    text-align: center;
}

.week-review-usage {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
    text-align: center;
}

.coach-review-regenerate {
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-weight: 600;
    padding: 10px 26px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.25);
}

.coach-review-regenerate:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.coach-review-regenerate:not(:disabled):hover,
.coach-review-regenerate:not(:disabled):focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 20px 36px rgba(37, 99, 235, 0.35);
    outline: none;
}

.coach-review-modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    color: rgba(15, 23, 42, 0.55);
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s ease, color 0.2s ease;
}

.coach-review-modal-close:hover,
.coach-review-modal-close:focus-visible {
    transform: scale(1.1);
    color: rgba(37, 99, 235, 0.9);
    outline: none;
}

.coach-review-modal-hero {
    display: flex;
    align-items: center;
    justify-content: center;
}

.coach-review-modal-image {
    width: 120px;
    height: auto;
}

.coach-review-modal-image.is-bouncing {
    animation: coachBounceTwice 0.9s ease;
}

.coach-review-modal-content {
    text-align: center;
}

.coach-review-modal-content h2 {
    margin: 0 0 10px;
    font-size: 1.35rem;
}

.coach-review-text {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(15, 23, 42, 0.8);
}

.week-review-picker-video {
    width: min(320px, 100%);
    border-radius: 16px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
}

.week-review-picker-description {
    margin: 0 0 16px;
    color: #475569;
    font-size: 0.95rem;
}

.week-review-picker-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: min(100%, 360px);
    margin: 0 auto;
    align-self: center;
}

.week-review-picker-label {
    text-align: left;
    font-weight: 600;
    color: #1f2937;
}

.week-review-picker-select {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    font-size: 1rem;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.week-review-picker-select:focus-visible {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.week-review-picker-message {
    margin: 0;
    font-size: 0.9rem;
    color: #0f172a;
    font-weight: 500;
}

.week-review-picker-message.is-error {
    color: #b91c1c;
}

.week-review-picker-actions {
    margin-top: 4px;
    display: flex;
    justify-content: center;
}

.week-review-picker-submit {
    min-width: 220px;
    justify-content: center;
    text-align: center;
}

.week-review-picker-modal .coach-review-modal-card {
    overflow: visible;
    box-sizing: border-box;
}

@media (max-width: 540px) {
    .week-review-picker-modal .coach-review-modal-card {
        width: min(96vw, 420px);
        padding: clamp(20px, 6vw, 28px) clamp(16px, 7vw, 24px) clamp(24px, 8vw, 32px);
    }

    .week-review-picker-form {
        width: min(100%, 280px);
    }

    .week-review-picker-video {
        width: min(260px, 100%);
    }

    .week-review-picker-submit {
        width: 100%;
        min-width: 0;
    }
}

.coach-review-text p {
    margin: 0 0 12px;
}

.coach-review-text p:last-child {
    margin-bottom: 0;
}

@keyframes coachModalFade {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes coachBounceTwice {
    0% { transform: translateY(0); }
    20% { transform: translateY(-18px); }
    35% { transform: translateY(0); }
    55% { transform: translateY(-10px); }
    75% { transform: translateY(0); }
    100% { transform: translateY(0); }
}

@keyframes coachHoverLabelBounce {
    0% { transform: translate(0, -50%) translateY(var(--coach-review-label-offset)); }
    40% { transform: translate(0, -50%) translateY(calc(var(--coach-review-label-offset) - 6px)); }
    80% { transform: translate(0, -50%) translateY(var(--coach-review-label-offset)); }
    100% { transform: translate(0, -50%) translateY(var(--coach-review-label-offset)); }
}

@keyframes coachHoverLabelBounceMobile {
    0% { transform: translate(-50%, 0); }
    40% { transform: translate(-50%, -6px); }
    80% { transform: translate(-50%, 0); }
    100% { transform: translate(-50%, 0); }
}

@media (max-width: 600px) {
    .coach-review-modal {
        align-items: flex-start;
        justify-content: center;
        padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 16px;
        overflow-y: auto;
    }

    .coach-review-btn {
        width: 58px;
        height: 58px;
    }

    .coach-review-btn-img {
        width: 58px;
    }

    body.home-page .coach-review-panel {
        top: calc(100% + clamp(10px, 3vw, 18px));
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        width: min(94vw, 360px);
        padding: 16px;
    }

    .coach-review-hover-label {
        font-size: 0.7rem;
        padding: 4px 12px;
    }

    .coach-review-modal-card {
        padding: 24px 20px 28px;
        width: min(420px, 96vw);
        max-height: min(82vh, 560px);
        margin: 0 auto;
        border-radius: 24px;
    }

    .coach-review-modal-close {
        top: 10px;
        right: 12px;
    }

    .coach-review-regenerate {
        width: min(240px, 100%);
    }

    body.home-page #top-bar {
        position: relative;
    }

    body.home-page .top-bar-left {
        align-items: flex-start;
    }

    body.home-page .profile-menu-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: clamp(6px, 2vw, 10px);
        width: auto;
    }

    body.home-page .coach-review-launcher {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        width: auto;
        gap: clamp(8px, 3vw, 12px);
        align-items: center;
    }

    body.home-page #coachReviewToggle {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        z-index: auto;
    }

    body.home-page .coach-review-hover-label {
        position: static;
        top: auto;
        bottom: auto;
        left: auto;
        transform: none;
        animation: none;
        margin-top: clamp(4px, 2vw, 8px);
        text-align: center;
    }

    body.home-page #goalCoachmark {
        left: 50%;
        transform: translate(-50%, 10px);
    }

    body.home-page #goalCoachmark.visible {
        transform: translate(-50%, 0);
    }

    body.home-page .coach-review-panel {
        left: 50%;
    }
}

@media (max-width: 480px) {
    body.home-page .coach-review-panel {
        left: 50%;
        right: auto;
        transform: translate(-50%, 0);
        width: min(96vw, 360px);
    }
}

@media (max-width: 900px) {
    .profile-menu-wrapper {
        position: relative;
    }

    body.home-page .coach-review-launcher {
        top: calc(100% + clamp(12px, 4vw, 22px));
        left: clamp(16px, 6vw, 28px);
        transform: none;
        align-items: flex-start;
    }

    #goalCoachmark {
        top: calc(100% + 18px);
        left: 50%;
        transform: translate(-50%, 10px);
        min-width: min(280px, 90vw);
        max-width: min(320px, 92vw);
    }

    #goalCoachmark.visible {
        transform: translate(-50%, 0);
    }

    #goalCoachmark .coachmark-arrow {
        top: -12px;
        left: 50%;
        transform: translate(-50%, 0);
        border-right: 12px solid transparent;
        border-left: 12px solid transparent;
        border-bottom: 14px solid var(--coachmark-bg);
        border-top: none;
    }

    body.home-page .profile-menu {
        top: calc(clamp(12px, 4vw, 20px) + var(--profile-avatar-diameter) + 10px);
        left: clamp(16px, 6vw, 28px);
    }

    .coach-review-hover-label {
        top: calc(100% + 12px);
        left: 0;
        transform: translate(0, 6px);
        animation: none;
    }

    .coach-review-launcher:hover .coach-review-hover-label,
    .coach-review-btn:focus-visible + .coach-review-hover-label {
        transform: translate(0, 0);
    }

    .coach-review-launcher:hover .coach-review-hover-label {
        animation: coachHoverLabelBounceMobile 0.9s ease-in-out infinite;
    }

    body.home-page .coach-review-panel {
        top: calc(100% + 16px);
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(94vw, 380px);
        padding: 18px;
    }
}

@media (max-width: 900px) {
    body.home-page .coach-review-launcher {
        top: auto;
        left: auto;
        transform: none;
        align-items: center;
    }

    body.home-page .coach-review-hover-label {
        top: auto;
        left: auto;
        transform: none;
    }

    body.home-page .coach-review-launcher:hover .coach-review-hover-label,
    body.home-page #coachReviewToggle:focus-visible + .coach-review-hover-label,
    body.home-page #coachReviewToggle:focus + .coach-review-hover-label {
        transform: none;
    }

    body.home-page .coach-review-panel {
        width: min(92vw, 360px);
    }

    body.home-page #goalCoachmark {
        top: calc(100% + 18px);
        left: 50%;
        transform: translate(-50%, 10px);
        min-width: min(280px, 90vw);
        max-width: min(320px, 92vw);
    }

    body.home-page #goalCoachmark.visible {
        transform: translate(-50%, 0);
    }

    body.home-page #goalCoachmark .coachmark-arrow {
        top: -12px;
        left: 50%;
        transform: translate(-50%, 0);
        border-right: 12px solid transparent;
        border-left: 12px solid transparent;
        border-bottom: 14px solid var(--coachmark-bg);
        border-top: none;
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    body.home-page .coach-review-panel {
        top: -6px;
        left: 88px;
        transform: none;
    }
}

@media (min-width: 1024px) {
    body.home-page .top-bar-left {
        align-self: start;
    }

    body.home-page .profile-menu-wrapper {
        transform: translate(
            calc(var(--desktop-profile-inline-offset) - var(--home-frame-padding) - var(--home-top-bar-inline-padding)),
            calc(
                var(--desktop-profile-top-offset)
                - var(--home-frame-padding)
                - var(--home-top-bar-block-padding)
            )
        );
    }

    body.settings-page {
        margin: 0;
        max-width: none;
        padding: var(--desktop-profile-top-offset) var(--desktop-profile-inline-offset) 60px;
    }

    body.settings-page #top-bar {
        padding: 0;
        margin-bottom: 24px;
    }

    body.settings-page .settings-layout {
        width: min(960px, 100%);
        margin: 0 auto;
    }
}

body.home-page .mobile-stats-btn,
body.settings-page .mobile-stats-btn {
    display: none;
    border-radius: 999px;
}


body.home-page .mobile-stats-btn:focus-visible,
body.settings-page .mobile-stats-btn:focus-visible,
body.stats-page .mobile-stats-btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.75);
    outline-offset: 3px;
}

body.home-page .mobile-stats-img,
body.settings-page .mobile-stats-img,
body.stats-page .mobile-stats-img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.profile-avatar-btn {
    width: var(--profile-avatar-diameter);
    height: var(--profile-avatar-diameter);
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    padding: 0;
    position: relative;
}

.profile-avatar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.profile-avatar-btn:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.6);
    outline-offset: 3px;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background-color: transparent;
    display: none;
}

.profile-avatar-initial {
    font-weight: 700;
    color: #1f2937;
    font-size: 1.1rem;
}

.profile-avatar-btn.has-image .profile-avatar-img {
    display: block;
}

.profile-avatar-btn.has-image .profile-avatar-initial {
    display: none;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 180px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
    padding: 8px 0;
    display: none;
    z-index: 40;
    overflow: hidden;
}

.profile-menu.open {
    display: block;
}

.profile-menu[hidden] {
    display: none !important;
}

.profile-menu-item {
    width: 100%;
    display: block;
    padding: 10px 18px;
    font-size: 0.95rem;
    text-align: left;
    color: #1f2937;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.profile-menu-item:hover {
    background: #f3f4f6;
}

.profile-menu-item[hidden] {
    display: none !important;
}

.profile-menu-item:disabled,
.profile-menu-item[aria-disabled="true"] {
    color: #9ca3af;
    cursor: default;
    pointer-events: none;
}

.profile-menu-item--disabled {
    color: #9ca3af;
    cursor: default;
    pointer-events: none;
}

.profile-menu-item.logout-trigger {
    color: #b91c1c;
}

.profile-menu-item.logout-trigger:hover {
    background: #fee2e2;
}

.profile-menu-note {
    padding: 8px 18px 12px;
    font-size: 0.85rem;
    line-height: 1.3;
    color: #4b5563;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(249, 250, 251, 0.85);
}

.profile-menu-note[hidden] {
    display: none !important;
}

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

.auth-card {
    width: min(440px, 100%);
    background: url("/images/loginbackgroundlight.png") center/cover no-repeat;
    padding: clamp(28px, 6vw, 36px) clamp(24px, 6vw, 40px);
    border-radius: 22px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 4vw, 26px);
    text-align: left;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(6px);
    z-index: 1;
}

.auth-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: none;
}

.auth-card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.auth-logo {
    width: clamp(120px, 32vw, 160px);
    transition: transform 0.4s ease;
    opacity: 0;
    animation: authFadeInUp 0.65s ease forwards 0.1s;
}

.auth-coach {
    width: clamp(130px, 30vw, 190px);
    max-width: 100%;
    display: block;
    margin-top: clamp(0px, 0.5vw, 8px);
    margin-bottom: clamp(6px, 1.5vw, 14px);
    animation: coachBounce 0.85s ease-in-out 0.45s 3;
    transform-origin: center bottom;
}

.auth-card:hover .auth-coach,
.auth-card:focus-within .auth-coach {
    animation-play-state: paused;
    transform: none;
}

.auth-card:hover .auth-logo,
.auth-card:focus-within .auth-logo {
    transform: scale(1.02);
}

#authTitle:empty {
    display: none;
}

#authTitle {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    color: #0f172a;
    opacity: 0;
    animation: authFadeInUp 0.65s ease forwards 0.45s;
}

.auth-subtitle {
    margin-top: -6px;
    margin-bottom: 2px;
    color: #1f2937;
    text-align: center;
    font-size: 1.05rem;
    opacity: 0;
    animation: authFadeInUp 0.65s ease forwards 0.7s;
}

@keyframes authFadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes coachBounce {
    0%,
    20%,
    53%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-18px);
    }

    70% {
        transform: translateY(-8px);
    }
}

.auth-toggle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    background: var(--auth-primary-pale);
    padding: 6px;
    border-radius: 14px;
    position: relative;
}

.auth-toggle-btn {
    border: none;
    background: transparent;
    color: #14532d;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 12px;
    transition: color 0.35s ease, transform 0.35s ease;
    position: relative;
    isolation: isolate;
}

.auth-toggle-btn.active {
    color: #052e16;
}

.auth-toggle-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-light));
    border-radius: inherit;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: -1;
}

.auth-toggle-btn.active::before,
.auth-toggle-btn:focus-visible::before,
.auth-toggle-btn:hover::before {
    opacity: 1;
    transform: scale(1);
}

.auth-toggle-btn:focus-visible {
    outline: none;
    color: #052e16;
}

.auth-toggle-btn:hover,
.auth-toggle-btn:focus-visible {
    transform: translateY(-1px);
}

.auth-status {
    min-height: 20px;
    font-size: 0.95rem;
    padding: 6px 10px;
    border-radius: 8px;
    display: none;
}

.auth-status.info {
    display: block;
    background: rgba(187, 247, 208, 0.8);
    color: #166534;
}

.auth-status.success {
    display: block;
    background: rgba(134, 239, 172, 0.8);
    color: #166534;
}

.auth-status.error {
    display: block;
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}


.auth-forms {
    display: grid;
    position: relative;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    grid-area: 1 / 1;
    opacity: 0;
    transform: translateY(18px) scale(0.995);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    border-radius: 16px;
    padding: 4px 0 2px;
    background: transparent;
    box-shadow: none;
}

.auth-form.is-active {
    pointer-events: auto;
}

.auth-form.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.auth-form.hidden {
    display: none;
}

.auth-form .form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form label {
    font-weight: 600;
    color: #1f2937;
}

.auth-form input {
    padding: 12px 14px;
    border: 1px solid rgba(21, 128, 61, 0.28);
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.auth-form input:focus {
    outline: none;
    border-color: rgba(22, 101, 52, 0.8);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.32);
    transform: translateY(-1px);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 4px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(21, 128, 61, 0.2);
}

.auth-divider-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #15803d;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-terms-disclaimer {
    font-size: 0.85rem;
    color: #1f2937;
    line-height: 1.5;
    text-align: center;
    margin: 4px 0 0;
}

.auth-terms-disclaimer a {
    color: #166534;
    font-weight: 600;
    text-decoration: underline;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(21, 128, 61, 0.35);
    background: linear-gradient(135deg, rgba(187, 247, 208, 0.45), rgba(22, 163, 74, 0.1));
    color: #166534;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.google-btn img {
    width: 20px;
    height: 20px;
}

.google-btn:hover,
.google-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px -12px rgba(22, 163, 74, 0.6);
    background: linear-gradient(135deg, rgba(134, 239, 172, 0.6), rgba(22, 163, 74, 0.18));
}

.google-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.35);
}

.apple-signin-row {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.apple-signin-button {
    width: 100%;
    max-width: 420px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 14px;
    background: #000000;
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.apple-signin-button:hover {
    filter: brightness(1.08);
}

.apple-signin-button:focus-visible {
    outline: 2px solid rgba(148, 163, 184, 0.8);
    outline-offset: 4px;
    border-radius: 14px;
}

.apple-logo {
    width: 18px;
    height: 18px;
    display: block;
}

.apple-label {
    font-size: 0.95rem;
}

.forgot-password-trigger {
    display: flex;
    justify-content: flex-end;
    margin-top: -6px;
    margin-bottom: -2px;
}

.forgot-password-trigger .link-btn {
    padding: 4px 0;
    font-size: 0.9rem;
}

.auth-footer {
    text-align: center;
    font-size: 0.9rem;
    color: #e2e8f0;
    margin: 0;
}

.auth-footer a {
    color: #c7d2fe;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-footer a:hover,
.auth-footer a:focus-visible {
    color: #1d4ed8;
    text-decoration: underline;
}

.auth-card .primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-dark));
    color: #f0fdf4;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 16px 30px rgba(21, 128, 61, 0.32);
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card .primary-btn:hover,
.auth-card .primary-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(21, 128, 61, 0.38);
}

.auth-card .primary-btn:focus-visible {
    outline: none;
}

.auth-card .primary-btn:active {
    transform: translateY(0);
    box-shadow: 0 12px 24px rgba(21, 128, 61, 0.3);
}

.auth-card .guest-login-btn {
    width: 100%;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.15);
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.auth-card .guest-login-btn:hover,
.auth-card .guest-login-btn:focus-visible {
    background: #f8fafc;
    color: #0b1221;
    border-color: rgba(15, 23, 42, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

.auth-card .guest-login-btn:active {
    background: #e2e8f0;
    transform: translateY(0);
}

.guest-login-note {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e2e8f0;
    text-align: center;
}

.auth-info-panel {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(248, 250, 252, 0.15);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: grid;
    gap: 10px;
}

.verify-email-body {
    background: radial-gradient(circle at 18% -8%, rgba(21, 128, 61, 0.12), transparent 55%),
        radial-gradient(circle at 78% 108%, rgba(34, 197, 94, 0.12), transparent 62%),
        linear-gradient(160deg, rgba(255, 255, 255, 0.65), rgba(244, 244, 249, 0.8));
}

.verify-email-card {
    gap: clamp(16px, 4vw, 24px);
    align-items: stretch;
}

.verify-email-card .auth-subtitle {
    font-size: 1rem;
    color: #334155;
}

.verify-email-card .auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.verify-email-card .form-field label {
    font-weight: 600;
    color: #1f2937;
}

.verify-email-card .form-field input {
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    font-size: 1.1rem;
    letter-spacing: 0.2em;
    text-align: center;
}

.verify-email-card .form-field input:focus {
    outline: none;
    border-color: rgba(21, 128, 61, 0.65);
    box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.35);
}

.verify-email-resend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #4b5563;
    text-align: center;
}

.verify-email-resend .link-btn {
    font-size: 0.95rem;
    padding: 0;
}

.verify-email-countdown {
    color: #64748b;
    font-weight: 600;
}

.verify-email-countdown[hidden] {
    display: none;
}

.verify-email-card .auth-footer {
    margin-top: -6px;
}

@media (prefers-reduced-motion: reduce) {
    body.auth-body,
    .auth-logo,
    .auth-toggle-btn,
    .auth-form,
    .auth-form input,
    .auth-card .primary-btn,
    #authTitle,
    .auth-subtitle {
        transition: none !important;
        animation: none !important;
        opacity: 1 !important;
    }
}

@media (max-width: 600px) {
    body.auth-body {
        padding: 16px;
    }

    .auth-card {
        width: 100%;
        padding: 26px 22px;
        border-radius: 18px;
        gap: 18px;
    }

    .auth-logo {
        width: 165px;
        max-width: 90%;
    }

    .auth-toggle {
        grid-template-columns: 1fr;
    }

    .auth-toggle-btn {
        padding: 12px;
        font-size: 1.05rem;
    }

    .auth-form {
        gap: 16px;
    }

    .auth-form input {
        padding: 12px;
        font-size: 1.05rem;
    }

    .primary-btn {
        padding: 14px;
        font-size: 1.05rem;
    }
}

/* Back button in header */
#back-link {
    font-size: 14px;
    text-decoration: none;
    color: #2c3e50;
    background: #e8f0f2;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}
#back-link:hover {
    background: #d1e7ea;
}

/* Settings form */
.settings-form {
    max-width: 500px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.settings-form label {
    font-weight: bold;
    margin-bottom: 4px;
}
.settings-form input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
}
.settings-form button {
    margin-top: 10px;
    padding: 12px;
    background: #4CAF50;
    border: none;
    color: white;
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.settings-form button:hover {
    background: #45a049;
}

/* === AI overlay + spinner === */
.ai-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.ai-overlay[hidden] {
    display: none !important;
}
.ai-overlay-box {
    background: #fff; padding: 18px 22px; border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    min-width: 240px;
}
.ai-spinner {
    width: 36px; height: 36px; border-radius: 50%;
    border: 4px solid #ddd; border-top-color: #666;
    animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-overlay-text { font-size: 14px; color: #333; }

/* Description text under meal image */
.meal-description {
    margin-top: 8px; color: #444; font-size: 0.95rem; line-height: 1.3;
}

/* Week total bar */
.week-total-bar {
    margin: 10px auto 8px;
    width: min(100% - 48px, 520px);
    text-align: center;
    padding: 12px 20px;
    border-radius: 12px;
    background: #f2f7ff;
    color: #2c3e50;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Tag buttons */
.tag-buttons {
    display: flex; gap: 8px; margin: 10px 0 6px; flex-wrap: wrap;
}
.tag-buttons button {
    padding: 6px 10px; border-radius: 20px; border: 1px solid #ccc;
    background: #f7f7f7; cursor: pointer; font-size: 0.95rem;
}
.tag-buttons button.selected {
    background: #2563eb; color: white; border-color: #2563eb;
}
.field-group.has-error .tag-buttons {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
    border-radius: 24px;
    padding: 4px;
}
.field-group.has-error .tag-buttons button {
    border-color: #dc2626;
}

.form-error {
    color: #b91c1c;
    font-size: 0.875rem;
    margin-top: 4px;
}

.required-indicator {
    color: #dc2626;
    margin-left: 4px;
}

/* Tag badge */
.meal-tag-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Color choices */
.color-choices {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin: 6px 0 6px;
}
.color-dot {
    width: 30px; height: 30px; border-radius: 999px; border: 2px solid transparent; cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06) inset;
}
.color-dot.selected {
    box-shadow: 0 0 0 2px #111827 inset, 0 0 0 2px #111827;
    border-color: #111827;
}

/* Small helper text */
.muted { color:#6b7280; display:block; margin-top:4px; }

/* ---- Upload image button ---- */
.upload-image-label {
    display: inline-block;
    cursor: pointer;
}
.upload-image-btn {
    width: 140px;
    height: auto;
    transition: transform 0.15s ease, filter 0.2s ease;
}
.upload-image-label:hover .upload-image-btn {
    transform: scale(1.05);
    filter: brightness(1.1);
}
.upload-image-label:active .upload-image-btn {
    transform: scale(0.97);
}

/* Change image button */
.change-image-btn {
    display: inline-block;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    margin: 6px 0;
    transition: background 0.2s ease;
}
.change-image-btn:hover {
    background: #2563eb;
}

body {
    font-family: Arial, sans-serif;
    margin: 10px;   /* was 40px */
    color: #333;
    background: url("images/dashboard_background.png") no-repeat center center fixed;
    background-size: cover;
  }
  
  #top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px; /* was 8px 20px */
    margin-bottom: 6px; /* was 10px */
  }

  /* --- everything above is YOUR current stylesheet (unchanged) --- */

/* ===== Plant Panel ===== */
#plantPanel {
    position: relative;
    top: auto;
    width: 220px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.18);
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #0f172a;
    z-index: 1;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
  }

  #plantPanel.plant-goal-met {
    border-color: rgba(250, 204, 21, 0.7);
    box-shadow:
      0 0 0 2px rgba(250, 204, 21, 0.35),
      0 16px 30px rgba(202, 138, 4, 0.25);
  }

  #plantPanel .plant-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.2px;
  }

  #plantPanel .plant-total {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    background: rgba(15, 23, 42, 0.06);
    padding: 2px 10px;
    border-radius: 999px;
    line-height: 1.2;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
  }

  #plantPanel .plant-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #plantPanel .plant-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 12.5px;
    font-weight: 600;
    color: #0f172a;
  }

  #plantPanel .plant-item:hover {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.3);
  }

  #plantPanel .plant-count {
    font-weight: 700;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
  }

  #plantPanel .plant-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    margin-right: 6px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75);
    flex-shrink: 0;
  }
  #plantPanel .plant-dot.fruit  { background: #f97316; }
  #plantPanel .plant-dot.veg    { background: #22c55e; }
  #plantPanel .plant-dot.legume { background: #0ea5e9; }
  #plantPanel .plant-dot.grain  { background: #facc15; }
  #plantPanel .plant-dot.nut    { background: #b45309; }
  #plantPanel .plant-dot.seed   { background: #6b7280; }

  #plantPanel .plant-sub {
    font-size: 11px;
    color: #475569;
    margin-top: 2px;
  }

  @media (max-width: 1100px) {
    #plantPanel {
      position: static;
      width: 100%;
      max-width: 360px;
      margin: 12px auto 0;
    }
  }

/* ===== Plant Items Modal Accordion ===== */
.plant-acc {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.plant-acc .acc-item {
  --accent: #15803d;
  --accent-soft: rgba(21, 128, 61, 0.18);
  --chip-bg: rgba(21, 128, 61, 0.14);
  --chip-color: #065f46;
  border-radius: 20px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  background: rgba(250, 253, 250, 0.92);
  box-shadow: 0 18px 36px rgba(15, 118, 110, 0.16);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.plant-acc .acc-item[data-bucket="fruits"] {
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.22);
  --chip-bg: rgba(249, 115, 22, 0.16);
  --chip-color: #9a3412;
}

.plant-acc .acc-item[data-bucket="vegetables"] {
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.2);
  --chip-bg: rgba(34, 197, 94, 0.16);
  --chip-color: #166534;
}

.plant-acc .acc-item[data-bucket="legumes"] {
  --accent: #0ea5e9;
  --accent-soft: rgba(14, 165, 233, 0.22);
  --chip-bg: rgba(14, 165, 233, 0.16);
  --chip-color: #075985;
}

.plant-acc .acc-item[data-bucket="wholeGrains"] {
  --accent: #facc15;
  --accent-soft: rgba(250, 204, 21, 0.22);
  --chip-bg: rgba(250, 204, 21, 0.16);
  --chip-color: #854d0e;
}

.plant-acc .acc-item[data-bucket="nuts"] {
  --accent: #b45309;
  --accent-soft: rgba(180, 83, 9, 0.22);
  --chip-bg: rgba(180, 83, 9, 0.16);
  --chip-color: #7c2d12;
}

.plant-acc .acc-item[data-bucket="seeds"] {
  --accent: #6b7280;
  --accent-soft: rgba(107, 114, 128, 0.22);
  --chip-bg: rgba(107, 114, 128, 0.14);
  --chip-color: #3f3f46;
}

.plant-acc .acc-item.open {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 26px 48px var(--accent-soft);
}

.plant-acc .acc-header {
    width: 100%;
    border: none;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.85), rgba(236, 253, 245, 0.75));
    color: #022c22;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.plant-acc .acc-header:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(236, 253, 245, 0.88));
}

.plant-acc .acc-header:focus-visible {
  outline: 3px solid rgba(34, 197, 94, 0.55);
  outline-offset: 2px;
}

.plant-acc .acc-title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.05rem;
}

.plant-acc .acc-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 8px var(--accent-soft);
}

.plant-acc .acc-label {
  letter-spacing: 0.01em;
}

.plant-acc .acc-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plant-acc .acc-count {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
}

.plant-acc .acc-item.open .acc-count {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 24px var(--accent-soft);
}

.plant-acc .acc-chevron {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.18);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.plant-acc .acc-chevron::before {
  content: "›";
  transform: translateX(1px);
  transition: transform 0.2s ease;
}

.plant-acc .acc-item.open .acc-chevron {
  background: var(--accent);
  color: #fff;
}

.plant-acc .acc-item.open .acc-chevron::before {
  transform: rotate(90deg);
}

.plant-acc .acc-body {
    padding: 0 24px 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 253, 245, 0.78));
    border-top: 1px solid rgba(15, 118, 110, 0.08);
}

.plant-acc .acc-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plant-acc .acc-list li {
  list-style: none;
}

.plant-acc .acc-chip {
  display: inline-block;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-color);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.plant-acc .acc-empty {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  color: #64748b;
  font-style: italic;
  background: rgba(255, 255, 255, 0.8);
}

@media (max-width: 520px) {
  .plant-acc {
    gap: 14px;
  }

  .plant-acc .acc-item {
    border-radius: 18px;
  }

  .plant-acc .acc-header {
    padding: 14px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .plant-acc .acc-title {
    gap: 10px;
    font-size: 0.98rem;
  }

  .plant-acc .acc-dot {
    width: 14px;
    height: 14px;
    box-shadow: 0 0 0 6px var(--accent-soft);
  }

  .plant-acc .acc-meta {
    gap: 8px;
    width: 100%;
    justify-content: space-between;
  }

  .plant-acc .acc-count {
    font-size: 0.78rem;
    padding: 5px 11px;
  }

  .plant-acc .acc-chevron {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .plant-acc .acc-body {
    padding: 0 18px 20px;
  }

  .plant-acc .acc-list {
    gap: 8px;
  }

  .plant-acc .acc-chip {
    padding: 6px 12px;
  }
}

/* ===== Layout adjustments for calendar + plant tracker ===== */
.calendar-layout {
  margin-top: 24px;
}

body.home-page .calendar-layout {
  margin-top: clamp(12px, 2vw, 20px);
}

body.home-page .home-logo-reminder {
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  margin: 0;
  padding: 0;
}

.home-logo-reminder--mobile {
  display: none;
}

@media (min-width: 721px) {
  .home-logo-reminder--mobile {
    display: none !important;
  }
}

.home-logo-reminder-img {
  width: clamp(120px, 15vw, 160px);
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.18));
}

@media (max-width: 720px) {
  body.home-page .home-logo-reminder--desktop {
    display: none;
  }

  body.home-page .home-logo-reminder--mobile {
    display: flex;
    justify-content: center;
    margin: 12px auto 32px;
  }

  body.home-page #plantPanelSlot {
    display: none;
  }

  body.home-page .home-logo-reminder--mobile .home-logo-reminder-img {
    width: clamp(80px, 28vw, 110px);
  }
}

#plantPanelSlot {
  display: flex;
  justify-content: flex-end;
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
}

#plantPanelSlot:empty {
  display: none;
}

@media (max-width: 900px) {
  .add-meal-row {
    flex-direction: column;
    row-gap: clamp(16px, 4vw, 24px);
    padding: 0 clamp(16px, 4vw, 32px);
    min-height: 0;
  }

  .add-meal-row #plantPanelSlot {
    position: static;
    transform: none;
    width: min(100%, 360px);
    min-width: 0;
    justify-content: center;
    align-items: center;
  }
}

@media (max-width: 720px) {
  body.settings-page {
    margin: 28px auto;
    padding: 0 16px 48px;
  }

  .settings-card {
    padding: 24px 20px;
  }

  .avatar-preview {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 520px) {
  .avatar-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-actions {
    width: 100%;
  }

  .settings-actions .primary-btn,
  .settings-actions .secondary-btn {
    flex: 1 1 100%;
    justify-content: center;
    width: 100%;
  }
}

.day-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 520px;
  margin: 0 auto;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.day-view-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.day-view-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #1f2937;
}

.day-view-header h2.goals-complete {
  color: #0369a1;
  text-shadow: 0 0 12px rgba(125, 211, 252, 0.45);
}

.day-entries {
  gap: 12px;
}

.mobile-plant-slot {
  display: flex;
  justify-content: center;
}

.mobile-plant-slot:empty {
  display: none;
}

.mobile-plant-slot #plantPanel {
  width: min(360px, 100%);
}

.mobile-action-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(148, 163, 184, 0.25);
  pointer-events: none;
  z-index: 1;
}

.mobile-action-button {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.mobile-action-button:visited {
  color: inherit;
}

.mobile-action-button img,
.mobile-action-button span {
  pointer-events: none;
}

.mobile-action-button:hover {
  transform: translateY(-2px);
  background: rgba(79, 70, 229, 0.12);
  border-color: rgba(129, 140, 248, 0.55);
}

.mobile-action-button:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.55);
  outline-offset: 2px;
}

.mobile-action-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.mobile-action-icon-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.mobile-action-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}

#mobileMenuAction .mobile-action-icon {
  border-radius: 999px;
  overflow: hidden;
}

#mobileProfileAvatarImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  background-color: transparent;
}

#mobileProfileAvatarImage[hidden] {
  display: none !important;
}

#mobileProfileAvatarInitial {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  line-height: 1;
}

#mobileProfileAvatarInitial[hidden] {
  display: none !important;
}

#mobileMenuAction.mobile-action-button--has-initial .mobile-action-icon {
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(255, 255, 255, 0.85);
}

#mobileMenuAction.mobile-action-button--has-initial #mobileProfileAvatarImage {
  display: none !important;
}

#mobileMenuAction.mobile-action-button--has-image #mobileProfileAvatarInitial {
  display: none !important;
}

.mobile-action-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 900px) {
  body {
    margin: 16px;
  }

  #top-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  body.home-page {
    padding: clamp(10px, 4vw, 20px);
  }

  .profile-menu-wrapper {
    position: relative;
  }

  body.home-page .coach-review-launcher {
    top: calc(100% + clamp(12px, 4vw, 22px));
    left: clamp(16px, 6vw, 28px);
    transform: none;
    gap: 12px;
    align-items: flex-start;
  }

  body.home-page .profile-menu {
    top: calc(clamp(12px, 4vw, 20px) + var(--profile-avatar-diameter) + 10px);
    left: clamp(16px, 6vw, 28px);
  }

  body.home-page #top-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, var(--mobile-header-item-size)));
    align-items: center;
    justify-content: center;
    column-gap: var(--mobile-header-gap);
    row-gap: var(--mobile-header-gap);
    padding: clamp(12px, 4vw, 20px) clamp(16px, 6vw, 28px) clamp(14px, 4vw, 24px);
  }

  body.home-page .top-bar-left,
  body.home-page .top-bar-right {
    align-items: center;
  }

  body.home-page .top-bar-left {
    grid-column: 1 / span 2;
    grid-row: 1;
    display: contents;
    width: auto;
    justify-self: center;
    align-self: center;
  }

  body.home-page .profile-menu-wrapper {
    grid-column: 1;
    grid-row: 1;
  }

  body.home-page .coach-review-slot {
    grid-column: 2;
    grid-row: 1;
  }

  body.home-page .mobile-stats-btn {
    grid-column: 3;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    width: var(--mobile-header-item-size);
    text-decoration: none;
  }

  body.home-page .top-bar-right {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    margin-left: 0;
    justify-content: center;
    justify-self: stretch;
  }

  body.home-page .top-bar-center {
    grid-column: 1 / -1;
    grid-row: 2;
    position: static;
    transform: none;
    left: auto;
    width: 100%;
    justify-content: center;
    top: auto;
    margin-top: 0;
  }

  body.stats-page {
    padding: clamp(12px, 4vw, 20px) clamp(16px, 6vw, 28px) clamp(48px, 8vw, 64px);
  }

  body.stats-page #top-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "stats-left stats-export";
    justify-content: stretch;
    align-items: center;
    padding: clamp(12px, 4vw, 20px) clamp(16px, 6vw, 28px) clamp(14px, 4vw, 24px);
    column-gap: clamp(12px, 4vw, 24px);
    row-gap: clamp(12px, 3vw, 24px);
  }

  body.stats-page .top-bar-left {
    grid-area: stats-left;
    justify-self: start;
    align-self: center;
    width: auto;
  }

  body.stats-page .stats-export-btn {
    grid-area: stats-export;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
  }

  body.settings-page #top-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "settings-left settings-stats";
    padding: clamp(12px, 4vw, 20px) clamp(16px, 6vw, 28px);
    align-items: center;
    column-gap: clamp(12px, 4vw, 24px);
    row-gap: clamp(10px, 3vw, 20px);
  }

  body.settings-page .top-bar-left {
    grid-area: settings-left;
    justify-self: start;
    align-self: center;
  }

  body.settings-page .mobile-stats-btn {
    grid-area: settings-stats;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    width: clamp(44px, 12vw, 56px);
    text-decoration: none;
  }

  body.settings-page {
    padding-bottom: calc(clamp(120px, 24vh, 210px) + env(safe-area-inset-bottom, 0px));
  }

  body.settings-page #top-bar {
    display: none;
  }

  body.settings-page .settings-footer {
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }

  body.stats-page {
    padding-bottom: calc(clamp(120px, 24vh, 210px) + env(safe-area-inset-bottom, 0px));
  }

  .add-meal-container {
    margin: 12px 0 16px;
  }

  .calendar-toolbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    text-align: center;
  }

  .total-select {
    margin-left: 0;
    width: 100%;
    max-width: 240px;
  }

  .calendar {
    flex-direction: column;
  }

  .day-column {
    width: 100%;
  }

  .calendar-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .page-footer {
    justify-content: center;
  }

  .footer-logo {
    height: 64px;
  }

  .day-controls button,
  #week-controls button {
    min-width: 72px;
  }
}

@media (max-width: 640px) {
  .day-controls-collapsible[data-expanded="true"] .mobile-day-controls-content {
    gap: clamp(16px, 4vw, 24px);
  }

  .mobile-day-controls-content {
    color: #0f172a;
  }

  .mobile-day-controls-content .week-controls-wrapper button {
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 600;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-day-controls-content .week-controls-wrapper button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
  }

  .mobile-day-controls-content .week-controls-wrapper button:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.18);
  }

  .mobile-day-controls-content .week-controls-wrapper button:focus,
  .mobile-day-controls-content .week-controls-wrapper button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35), 0 12px 24px rgba(15, 23, 42, 0.12);
  }

  .mobile-day-controls-content .week-controls-wrapper button:disabled,
  .mobile-day-controls-content .week-controls-wrapper button.is-disabled {
    background: rgba(255, 255, 255, 0.72);
    color: rgba(15, 23, 42, 0.55);
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: none;
  }

  #day-controls,
  .day-controls {
    order: 2;
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }

  #day-controls button,
  .day-controls button {
    flex: 1 1 auto;
    max-width: 96px;
    border-radius: 999px;
    padding: 10px 0;
    font-weight: 600;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.16);
    color: #0f172a;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  }

  #day-controls button.is-active,
  .day-controls button.is-active {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(15, 23, 42, 0.22);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.2);
    color: #0f172a;
  }

  #day-controls button:hover,
  .day-controls button:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
  }

  #day-controls button:active,
  .day-controls button:active {
    transform: translateY(1px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.18);
  }

  #day-controls button:focus,
  #day-controls button:focus-visible,
  .day-controls button:focus,
  .day-controls button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35), 0 12px 24px rgba(15, 23, 42, 0.12);
  }

  body.home-page #top-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, var(--mobile-header-item-size)));
    align-items: center;
    justify-content: center;
    column-gap: var(--mobile-header-gap);
    row-gap: var(--mobile-header-gap);
    padding: clamp(12px, 4vw, 20px) clamp(16px, 6vw, 28px) clamp(14px, 4vw, 24px);
  }

  body.home-page .top-bar-left {
    grid-column: 1 / span 2;
    grid-row: 1;
    display: contents;
  }

  body.home-page .profile-menu-wrapper,
  body.home-page .coach-review-slot,
  body.home-page .mobile-stats-btn {
    justify-self: center;
    align-self: center;
  }

  body.home-page .profile-menu-wrapper {
    width: var(--mobile-header-item-size);
    height: var(--mobile-header-item-size);
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 1;
    grid-row: 1;
  }

  body.home-page #profileMenuToggle {
    margin: 0;
  }

  body.home-page .coach-review-slot {
    width: var(--mobile-header-item-size);
    height: var(--mobile-header-item-size);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    grid-column: 2;
    grid-row: 1;
  }

  body.home-page .coach-review-slot .coach-review-launcher {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    --coach-review-btn-diameter: var(--mobile-header-item-size);
  }

  body.home-page .coach-review-slot .coach-review-hover-label {
    display: none;
  }

  body.home-page .profile-avatar-btn,
  body.home-page .coach-review-btn {
    width: var(--mobile-header-item-size);
    height: var(--mobile-header-item-size);
  }

  body.home-page .top-bar-center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    min-width: 0;
    width: auto;
    margin: 0;
  }

  body.home-page .mobile-stats-btn {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: center;
  }

  body.home-page {
    --mobile-control-width: min(300px, 90vw);
    --mobile-action-width: min(200px, 72vw);
    --mobile-header-item-size: clamp(52px, 15vw, 62px);
    --mobile-header-gap: clamp(20px, 6vw, 32px);
    --profile-avatar-diameter: var(--mobile-header-item-size);
  }

  body.home-page .coach-review-panel {
    position: fixed;
    top: clamp(96px, 24vh, 148px);
    left: 50vw;
    right: auto;
    transform: translate(-50%, 0);
    width: min(90vw, 360px);
    margin: 0 auto;
    z-index: 60;
  }

  body.home-page .coach-review-slot .coach-review-launcher {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    --coach-review-btn-diameter: var(--mobile-header-item-size);
  }

  body.home-page .coach-review-slot .coach-review-hover-label {
    display: none;
  }

  body.home-page .coach-review-btn-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  body.home-page .top-bar-center {
    grid-area: auto;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.home-page .add-meal-row {
    width: 100%;
    max-width: var(--mobile-control-width);
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
  }

  body.home-page .add-meal-btn {
    width: min(var(--mobile-action-width), 100%);
    max-width: var(--mobile-action-width);
    height: auto;
    margin: 0 auto;
  }

  body.home-page .add-meal-btn-img {
    width: 100%;
    height: auto;
    max-width: none;
    display: block;
    line-height: 0;
  }

  body.home-page .mobile-stats-btn {
    grid-area: auto;
    grid-column: 4;
    justify-self: center;
    width: var(--mobile-header-item-size);
    height: var(--mobile-header-item-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    line-height: 0;
  }

  body.home-page .mobile-stats-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  body.home-page .top-bar-right {
    grid-area: auto;
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: stretch;
    margin-left: 0;
  }

  .add-meal-row {
    text-align: center;
    padding-left: clamp(12px, 6vw, 24px);
    padding-right: clamp(12px, 6vw, 24px);
    align-items: center;
    width: var(--mobile-control-width);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .add-meal-container {
    justify-content: center;
    width: 100%;
  }

  .add-meal-btn {
    margin-left: auto;
    margin-right: auto;
  }

  .day-controls-collapsible {
    width: var(--mobile-control-width);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
  }

  .day-controls-collapsible[data-expanded="false"] .mobile-day-controls-panel {
    display: none;
  }

  .day-controls-collapsible[data-expanded="true"] .mobile-day-controls-panel {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .day-controls-collapsible[data-expanded="true"] .mobile-day-controls-viewport {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .day-controls-collapsible[data-expanded="true"] .mobile-day-controls-content {
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
    padding: clamp(16px, 4.5vw, 24px);
    padding-top: clamp(10px, 3.5vw, 18px);
    padding-left: clamp(12px, 4vw, 20px);
    padding-right: clamp(12px, 4vw, 20px);
    background-image: url("images/cuttingboard.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 22px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.18);
    align-items: center;
    color: #0f172a;
  }

  .mobile-day-controls-toggle {
    display: inline-flex;
    width: var(--mobile-control-width);
    max-width: 100%;
  }

  .day-controls-collapsible .mobile-day-controls-toggle {
    margin-bottom: 12px;
  }

  .week-controls-wrapper {
    order: 1;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    align-items: center;
    gap: 14px;
  }

  #week-controls {
    display: none;
  }

  .week-secondary-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
  }

  .mobile-day-controls-panel #jumpDate.mobile-date-input {
    width: min(100%, 260px);
    max-width: 260px;
    padding: 12px 18px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.25);
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0.01em;
  }

  .mobile-day-controls-panel #jumpDate.mobile-date-input:focus,
  .mobile-day-controls-panel #jumpDate.mobile-date-input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.55), 0 16px 36px rgba(15, 23, 42, 0.25);
  }

  .week-secondary-controls #todayBtn {
    display: none;
  }

  .calendar-toolbar-inner #jumpDate {
    width: min(100%, 260px);
    max-width: 260px;
    align-self: center;
    margin-inline: auto;
    text-align: center;
    text-align-last: center;
  }

  .calendar-toolbar {
    order: 3;
    margin-top: 0;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    margin-bottom: 0;
  }

  .calendar-toolbar-inner {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
  }

  .calendar-toolbar-inner > button {
    width: min(100%, 260px);
    min-width: 0;
    max-width: 260px;
    align-self: center;
    border-radius: 999px;
    padding: 12px 20px;
    font-weight: 600;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.16);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.16);
    color: #0f172a;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  }

  .calendar-toolbar-totals {
    display: none;
  }

  .calendar-toolbar-inner > button:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 36px rgba(15, 23, 42, 0.18);
  }

  .calendar-toolbar-inner > button:active {
    transform: translateY(1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
  }

  .mobile-day-controls-content #day-controls {
    order: 2;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 12px;
  }

  .mobile-day-controls-content #day-controls button {
    flex: 1 1 auto;
    max-width: 96px;
    border-radius: 999px;
    padding: 10px 0;
    font-weight: 600;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.16);
    color: #0f172a;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-day-controls-content #day-controls button:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
  }

  .mobile-day-controls-content #day-controls button:active {
    transform: translateY(1px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.18);
  }

  #calendarLayout {
    width: 100%;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }

  .calendar {
    width: 100%;
  }

}

@media (max-width: 768px) {
  .day-controls-collapsible[data-expanded="true"] .mobile-day-controls-content {
    align-items: center;
    overflow: hidden;
    row-gap: 18px;
  }

  .day-controls-collapsible[data-expanded="true"] .mobile-day-controls-content > * {
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .week-controls-wrapper,
  .week-secondary-controls {
    align-items: center;
  }

  #day-controls,
  .day-controls {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0 auto;
  }

  #day-controls button,
  .day-controls button {
    width: auto;
    min-width: 0;
    flex: 0 1 auto;
  }

  .mobile-day-controls-panel #jumpDate.mobile-date-input,
  .calendar-toolbar-inner #jumpDate {
    width: min(100%, 260px);
    min-width: 0;
    box-sizing: border-box;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 640px) {
  body.home-page #top-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, var(--mobile-header-item-size)));
    justify-content: center;
    align-items: start;
    column-gap: var(--mobile-header-gap);
    row-gap: var(--mobile-header-gap);
  }

  body.home-page .top-bar-left {
    grid-column: 1 / span 2;
    grid-row: 1;
    display: contents;
  }

  body.home-page .profile-menu-wrapper,
  body.home-page .coach-review-slot,
  body.home-page .mobile-stats-btn {
    align-self: start;
    justify-self: center;
  }

  body.home-page .profile-menu-wrapper {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  body.home-page .coach-review-slot {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: center;
  }

  body.home-page .mobile-stats-btn {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  body.home-page .coach-review-slot .coach-review-launcher {
    top: calc(100% + 6px);
  }

  body.home-page .coach-review-slot .coach-review-panel {
    top: calc(100% + 6px);
    transform: translate(-50%, -6px);
    max-height: min(80vh, 460px);
    overflow-y: auto;
  }

  body.home-page .top-bar-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.home-page .top-bar-right {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

@media (min-width: 721px) {
  .day-column-header {
    justify-content: center;
  }

  .day-column h3 {
    text-align: center;
  }
}

@media (max-width: 720px) {
  body.home-page {
    padding: clamp(16px, 5vw, 26px);
    padding-bottom: calc(clamp(120px, 24vh, 160px) + env(safe-area-inset-bottom, 0px));
  }

  body.home-page.has-floating-banners {
    padding-top: calc(var(--floating-header-offset, 0px));
  }

  body.home-page #top-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: clamp(18px, 5vw, 28px);
    padding: 0;
    border-radius: 0;
    background: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  body.home-page .top-bar-left,
  body.home-page .coach-review-slot,
  body.home-page .mobile-stats-btn {
    display: none !important;
  }

  body.home-page .top-bar-center,
  body.home-page .top-bar-right {
    width: 100%;
    margin: 0;
  }

  body.home-page .add-meal-row {
    justify-content: center;
    align-items: center;
    padding: 0;
  }

  body.home-page .add-meal-btn {
    width: clamp(180px, 54vw, 220px);
    margin: 0 auto;
  }

  body.home-page .add-meal-btn-img {
    width: 100%;
  }

  body.home-page .top-bar-right {
    display: flex;
    justify-content: center;
  }

  #plantPanelSlot {
    width: min(100%, 420px);
    justify-content: center;
  }

  #plantPanelSlot > * {
    width: 100%;
  }

  .day-column {
    padding: 16px 18px;
  }

  .day-column-header {
    margin-bottom: 6px;
  }
}

@media (max-width: 720px) {
  body.home-page.coach-review-mobile-open {
    overflow: hidden;
  }

  body.home-page.coach-review-mobile-open .top-bar-left {
    display: contents !important;
  }

  body.home-page.coach-review-mobile-open .profile-menu-wrapper,
  body.home-page.coach-review-mobile-open .mobile-stats-btn {
    display: none !important;
  }

  body.home-page.coach-review-mobile-open .coach-review-slot {
    display: flex !important;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: clamp(18px, 6vw, 32px);
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1200;
  }

  body.home-page.coach-review-mobile-open .coach-review-slot .coach-review-launcher {
    position: static;
    transform: none;
    width: min(92vw, 420px);
    max-width: 100%;
  }

  body.home-page.coach-review-mobile-open .coach-review-slot .coach-review-btn {
    display: none;
  }

  body.home-page.coach-review-mobile-open .coach-review-slot .coach-review-panel {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    width: 100%;
    max-height: min(80vh, 520px);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.35);
  }

  body.home-page.coach-review-mobile-open .coach-review-slot .coach-review-panel-inner {
    max-height: min(70vh, 440px);
  }
}

@media (max-width: 540px) {
  body {
    margin: 12px;
  }

  .day-view {
    padding: 16px;
    border-radius: 16px;
  }

  .entry-card {
    font-size: 0.95rem;
  }

  .entry-card .card-details {
    font-size: 0.85rem;
  }

}

/* Help center layout */
.help-center-page {
  background: linear-gradient(180deg, #f5f7fb 0%, #ffffff 40%);
  min-height: 100vh;
  color: #1f2937;
}

/* Keep the help center column centered at all breakpoints */
.help-center-layout {
  max-width: 960px;
  width: 100%;
  margin: 72px auto 56px;
  padding: 0 clamp(16px, 4vw, 24px) 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/*
 * Prevent any help center container from exceeding the viewport width so the
 * card and form can't overflow or lean on narrow screens.
 */
.help-center-layout,
.help-center-card,
.contact-form,
.form-row,
.form-field {
  box-sizing: border-box;
  max-width: 100%;
}

/* The main card stays centered regardless of viewport width */
.help-center-card {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.08);
  padding: 48px;
  width: 100%;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.help-center-header {
  margin-bottom: 32px;
  text-align: left;
}

.help-center-brand {
  display: inline-flex;
  align-items: center;
}

.help-center-logo {
  display: block;
  height: clamp(84px, 14vw, 140px);
  width: auto;
}

.help-center-home-link {
  --home-link-bg: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--home-link-bg);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.help-center-home-link:visited {
  color: #ffffff;
}

.help-center-home-link:hover,
.help-center-home-link:focus-visible {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(79, 70, 229, 0.3);
}

.help-center-home-link:active {
  transform: translateY(0);
  filter: brightness(0.96);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.28);
}

.help-center-home-link:focus-visible {
  outline: 3px solid #c7d2fe;
  outline-offset: 2px;
}

.help-center-page .top-bar-left {
  --top-bar-left-gap: clamp(12px, 2vw, 16px);
}

.help-center-page #top-bar {
  padding: clamp(14px, 3vw, 28px) clamp(20px, 5vw, 40px);
}

.help-center-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6366f1;
  margin-bottom: 12px;
  font-weight: 600;
}

.help-center-header h1 {
  font-size: clamp(2rem, 2.8vw, 2.75rem);
  margin-bottom: 16px;
  color: #0f172a;
}

.help-center-intro {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #475569;
  max-width: 720px;
}

.help-topic-accordion {
  display: grid;
  gap: 16px;
}

.help-topic {
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 18px;
  background-color: #f8f9ff;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.help-topic:hover,
.help-topic:focus-within {
  border-color: #6366f1;
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.12);
}

.help-topic-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 24px 28px;
  display: grid;
  row-gap: 8px;
  cursor: pointer;
  font-family: inherit;
  position: relative;
}

.help-topic-toggle:focus {
  outline: 3px solid rgba(99, 102, 241, 0.45);
  outline-offset: 4px;
}

.help-topic-toggle::after {
  content: "";
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  width: 16px;
  height: 16px;
  border-right: 2px solid #4f46e5;
  border-bottom: 2px solid #4f46e5;
  transition: transform 0.2s ease;
}

.help-topic-toggle[aria-expanded="true"]::after {
  transform: translateY(-50%) rotate(45deg);
}

.help-topic-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e1b4b;
}

.help-topic-summary {
  font-size: 0.95rem;
  color: #4c51bf;
  line-height: 1.5;
}

.help-topic-content {
  padding: 0 28px 28px;
  background: #ffffff;
  border-top: 1px solid rgba(99, 102, 241, 0.2);
  animation: helpTopicReveal 0.2s ease;
}

.help-topic-content p {
  margin: 16px 0;
  color: #1f2937;
  line-height: 1.6;
}

.help-topic-content ul {
  margin: 16px 0 16px 20px;
  color: #1f2937;
  line-height: 1.6;
  list-style: disc;
}

.help-topic-content li + li {
  margin-top: 8px;
}

/* Ensure the contact section aligns with the centered column */
.help-center-contact {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid rgba(99, 102, 241, 0.2);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.help-center-contact h2 {
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
  margin-bottom: 16px;
  color: #0f172a;
}

.help-center-footer {
  margin: 32px auto 64px;
  padding: 24px;
  max-width: 960px;
  width: 100%;
  text-align: center;
  color: #475569;
  font-size: 0.95rem;
}

.help-center-footer p {
  margin: 0;
}

.help-center-footer a {
  color: #4338ca;
  font-weight: 600;
  text-decoration: none;
}

.help-center-footer a:hover,
.help-center-footer a:focus {
  text-decoration: underline;
}

.contact-intro {
  font-size: 1rem;
  color: #475569;
  margin-bottom: 28px;
  max-width: 680px;
}

/* Keep the form centered inside the contact section */
.contact-form {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.form-row {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.contact-form .form-field input,
.contact-form .form-field select,
.contact-form .form-field textarea {
  width: 100%;
  box-sizing: border-box;
}

.recaptcha-field {
  align-items: flex-start;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(129, 140, 248, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.16);
  gap: 8px;
  width: 100%;
}

.recaptcha-badge-slot {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.recaptcha-message {
  margin: 0;
  color: #312e81;
  font-size: 0.95rem;
  line-height: 1.5;
}

.recaptcha-message a {
  color: #4338ca;
  font-weight: 600;
  text-decoration: none;
}

.recaptcha-message a:hover,
.recaptcha-message a:focus {
  text-decoration: underline;
}

.grecaptcha-badge {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  overflow: hidden;
}

.recaptcha-badge-slot .grecaptcha-badge,
.grecaptcha-badge.is-embedded {
  position: static !important;
  transform: none !important;
  margin: 0;
  box-shadow: none;
  width: auto;
  max-width: 100%;
}

.recaptcha-badge-slot .grecaptcha-badge iframe,
.grecaptcha-badge.is-embedded iframe {
  position: static !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
}

.form-field label {
  font-weight: 600;
  color: #1f2937;
}

.form-field input,
.form-field select,
.form-field textarea {
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: #1f2937;
  background-color: #f8f9ff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background-color: #ffffff;
}

.form-field textarea {
  resize: vertical;
  min-height: 160px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.contact-submit {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-submit:hover,
.contact-submit:focus {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.24);
  outline: none;
}

.contact-submit:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.form-status {
  font-size: 0.95rem;
  color: #475569;
  min-height: 1.2em;
}

.form-status.success {
  color: #047857;
}

.form-status.error {
  color: #dc2626;
}

html.modal-open {
  overflow: hidden;
  height: 100%;
  overscroll-behavior-y: none;
}

body.modal-open {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
  touch-action: none;
  margin: 0 !important;
}

.modal-scrollable {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.modal-overlay {
  position: fixed;
  top: var(--modal-viewport-offset, 0px);
  right: 0;
  bottom: 0;
  left: 0;
  min-height: var(--modal-viewport-height, 100vh);
  height: var(--modal-viewport-height, 100vh);
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.6);
  --modal-overlay-padding: clamp(16px, 4vw, 32px);
  padding: var(--modal-overlay-padding);
  padding-bottom: calc(var(--modal-overlay-padding) + env(safe-area-inset-bottom, 0px));
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  box-sizing: border-box;
}

#contactConfirmation.modal-overlay {
  display: flex !important;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  position: relative;
  width: min(92vw, 420px);
  max-width: min(92vw, 420px);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9ff 100%);
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.28);
  padding: 40px 32px 32px;
  color: #1f2937;
  max-height: 92vh;
  overflow: hidden;
  overscroll-behavior: contain;
  margin: 0;
  box-sizing: border-box;
  min-width: 0;
}

#contactConfirmation .modal-dialog {
  margin: 0 auto;
  width: 100%;
  max-width: 500px;
}

.modal-dialog .modal-content {
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 600px) {
  .modal-overlay {
    position: fixed;
    inset: 0;
    min-height: 100vh;
    height: 100vh;
    display: grid;
    place-items: center;
  }

  .modal-overlay .modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: min(92vw, 420px);
    margin: 0;
    margin-inline: 0;
    box-sizing: border-box;
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #475569;
  cursor: pointer;
}

.modal-close:hover,
.modal-close:focus {
  color: #1e1b4b;
  outline: none;
}

.modal-content {
  display: grid;
  gap: 16px;
  text-align: center;
}

/* Contact confirmation modal – keep card centered and inside viewport */
#contactConfirmation .modal-dialog {
  width: 100%;
  max-width: 400px;
  padding: 24px 20px 20px;
  margin: 0 auto;
  box-sizing: border-box;
}

#contactConfirmation .modal-content {
  width: 100%;
  max-width: none;
  margin: 0;
}

.forgot-password-modal .modal-content {
  text-align: left;
  gap: 20px;
}

.forgot-password-modal .modal-content h3 {
  text-align: center;
}

.forgot-password-modal .modal-content p {
  text-align: center;
  line-height: 1.65;
}

.forgot-password-modal form {
  display: grid;
  gap: 14px;
}

.forgot-password-modal .form-field {
  display: grid;
  gap: 8px;
}

.forgot-password-modal label {
  font-weight: 600;
  color: #1f2937;
}

.forgot-password-modal input[type="email"] {
  padding: 12px 14px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 12px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.95);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.forgot-password-modal input[type="email"]:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.forgot-password-modal .modal-actions {
  display: flex;
  justify-content: center;
}

.forgot-password-modal .modal-primary-action {
  width: 100%;
}

.forgot-password-modal .form-status {
  text-align: center;
  min-height: 1.4em;
}

.modal-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.2) 0%, rgba(16, 185, 129, 0.08) 65%, transparent 100%);
  color: #047857;
}

.modal-content h3 {
  font-size: 1.5rem;
  color: #1e1b4b;
  margin: 0;
}

.modal-content p {
  font-size: 1rem;
  color: #475569;
  line-height: 1.6;
  margin: 0;
}

.modal-primary-action {
  margin-top: 8px;
  align-self: center;
  padding: 12px 28px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 18px 30px rgba(99, 102, 241, 0.25);
}

.modal-primary-action:hover,
.modal-primary-action:focus {
  outline: none;
  box-shadow: 0 24px 36px rgba(79, 70, 229, 0.32);
}

@keyframes helpTopicReveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .help-center-page #top-bar {
    display: none;
  }

  .help-center-layout {
    width: 100%;
    max-width: 100%;
    margin: 24px auto 96px;
    padding: 0 16px calc(160px + env(safe-area-inset-bottom, 0px));
  }

  .help-center-card {
    padding: 32px 20px;
    width: 100%;
    max-width: 100%;
  }

  .contact-form {
    width: 100%;
    max-width: 100%;
  }

  .help-topic-toggle {
    padding: 20px 24px 20px 20px;
  }

  .help-topic-toggle::after {
    right: 20px;
  }

  .help-topic-content {
    padding: 0 20px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .help-center-footer {
    margin-top: 12px;
    padding: 16px;
  }
}

@media (max-width: 540px) {
  .help-center-layout {
    margin: 20px auto 72px;
    padding: 0 16px calc(160px + env(safe-area-inset-bottom, 0px));
  }

  .help-topic-title {
    font-size: 1.15rem;
  }

  .help-center-intro {
    font-size: 1rem;
  }

  /* Center the contact card & form on the smallest screens */
  .help-center-card,
  .help-center-contact,
  .contact-form {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* Fix selector typo so the rule actually hits the contact section */
  .help-center-contact {
    padding-top: 32px;
  }

  .contact-submit {
    width: 100%;
    justify-content: center;
  }

  .contact-form .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-form .form-status {
    text-align: left;
  }
}


@media (max-width: 900px) {
  body.home-page {
    --mobile-control-width: min(300px, 90vw);
    --mobile-action-width: min(200px, 72vw);
    --mobile-header-item-size: clamp(52px, 15vw, 62px);
    --mobile-header-gap: clamp(20px, 6vw, 32px);
    --profile-avatar-diameter: var(--mobile-header-item-size);
    --coach-review-panel-top-offset: clamp(56px, 14vh, 112px);
    --coach-review-panel-bottom-offset: clamp(24px, 8vh, 48px);
    --coach-review-panel-inner-max-height: max(
      240px,
      calc(
        100vh - var(--coach-review-panel-top-offset) - var(--coach-review-panel-bottom-offset) - 36px
      )
    );
  }

  body.home-page #top-bar {
    grid-template-columns: var(--mobile-header-item-size) 1fr var(--mobile-header-item-size);
    column-gap: var(--mobile-header-gap);
    row-gap: var(--mobile-header-gap);
    justify-content: stretch;
    align-items: start;
  }

  body.home-page .top-bar-left {
    display: contents;
  }

  body.home-page .profile-menu-wrapper {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: start;
  }

  body.home-page .profile-avatar-btn {
    width: var(--mobile-header-item-size);
    height: var(--mobile-header-item-size);
  }

  body.home-page .coach-review-slot {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    align-self: start;
  }

  body.home-page .mobile-stats-btn {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--mobile-header-item-size);
    height: var(--mobile-header-item-size);
  }

  body.home-page .top-bar-center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  body.home-page .top-bar-right {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: stretch;
    margin-left: 0;
  }

  body.home-page .coach-review-slot .coach-review-launcher {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    width: var(--mobile-header-item-size);
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.home-page .coach-review-slot .coach-review-hover-label {
    display: none;
  }

  body.home-page .coach-review-slot .coach-review-btn {
    width: var(--mobile-header-item-size);
    height: var(--mobile-header-item-size);
  }

  body.home-page .coach-review-btn-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  body.home-page .coach-review-slot .coach-review-panel {
    position: fixed;
    top: var(--coach-review-panel-top-offset);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(92vw, 360px);
    max-height: calc(var(--coach-review-panel-inner-max-height) + 36px);
    overflow: hidden;
    z-index: 70;
  }

  body.home-page .coach-review-panel-inner {
    max-height: var(--coach-review-panel-inner-max-height);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
  }
}


/* Calibration dedicated page */
.calibration-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f3f4f6 0%, #ffffff 35%);
    color: #111827;
    display: flex;
    flex-direction: column;
}

.calibration-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem clamp(1rem, 5vw, 2.5rem);
    gap: 1rem;
}

.calibration-logo {
    height: 40px;
    width: auto;
}

@media (min-width: 769px) {
    .calibration-logo {
        height: 56px;
    }
}

.calibration-back-button {
    border: none;
    background: #1f2937;
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.calibration-back-button:hover,
.calibration-back-button:focus-visible {
    background: #111827;
    transform: translateY(-1px);
}

.calibration-back-button:active {
    transform: translateY(0);
}

.calibration-main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: clamp(1rem, 5vw, 3rem) clamp(1rem, 5vw, 3rem) 3rem;
}

.calibration-card {
    width: min(720px, 100%);
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    display: flex;
    flex-direction: column;
    gap: clamp(1.25rem, 3.5vw, 2rem);
}

.calibration-card .nutrition-calibration-hero {
    align-items: center;
    text-align: center;
}

.calibration-card .nutrition-calibration-hero-image {
    width: min(240px, 60vw);
    height: auto;
}

.calibration-card .nutrition-calibration-hero-caption {
    font-size: clamp(1rem, 2.6vw, 1.25rem);
    margin-top: 1rem;
}

.calibration-card .nutrition-calibration-form {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.calibration-card .form-grid {
    gap: clamp(0.75rem, 2.5vw, 1.25rem);
}

.calibration-card .form-field {
    background: #f9fafb;
    border-radius: 0.875rem;
    padding: 0.75rem;
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.calibration-card .form-field label {
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.calibration-card input,
.calibration-card select {
    background: #ffffff;
    padding: 0.65rem 0.75rem;
}

.calibration-card .calibration-helper {
    margin-top: 0.5rem;
    color: rgba(17, 24, 39, 0.6);
    font-size: 0.9rem;
}

.calibration-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.calibration-submit {
    min-width: 160px;
    border-radius: 999px;
    font-size: 1rem;
}

.calibration-error {
    background: rgba(220, 38, 38, 0.1);
    border-left: 4px solid #dc2626;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.calibration-exit-modal .modal-card {
    max-width: 420px;
}

.calibration-exit-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.calibration-exit-actions .secondary-btn {
    background: #f9fafb;
    color: #111827;
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.calibration-exit-actions .secondary-btn:hover,
.calibration-exit-actions .secondary-btn:focus-visible {
    background: #eef2ff;
    border-color: rgba(79, 70, 229, 0.45);
}

.calibration-success-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f3f4f6 0%, #ffffff 30%);
    color: #111827;
    display: flex;
    flex-direction: column;
}

.calibration-success-main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: clamp(1rem, 5vw, 3rem) clamp(1rem, 5vw, 3rem) clamp(1.5rem, 6vw, 4rem);
}

.calibration-success-card {
    width: min(760px, 100%);
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
    padding: clamp(1.75rem, 4vw, 2.75rem);
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 4vw, 2.5rem);
}

.calibration-success-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.calibration-success-header h1 {
    font-size: clamp(1.6rem, 3.4vw, 2.25rem);
    margin: 0;
    color: #0f172a;
}

.calibration-success-header p {
    margin: 0;
    font-size: clamp(1rem, 2.4vw, 1.125rem);
    color: rgba(15, 23, 42, 0.75);
}

.calibration-success-body {
    display: flex;
    flex-direction: column;
    gap: clamp(1.25rem, 3vw, 2rem);
}

.calibration-success-scroll {
    display: flex;
    flex-direction: column;
    gap: clamp(1.25rem, 3vw, 2rem);
}

.calibration-success-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.calibration-success-footer .primary-btn {
    align-self: flex-end;
    min-width: 160px;
    border-radius: 999px;
}

.calibration-success-close {
    border: none;
    background: rgba(17, 24, 39, 0.08);
    color: #111827;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.calibration-success-close:hover,
.calibration-success-close:focus-visible {
    background: rgba(17, 24, 39, 0.14);
    transform: translateY(-1px);
}

.calibration-success-close:active {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .calibration-success-card {
        width: min(840px, 100%);
    }
}

@media (min-width: 1024px) {
    .calibration-highlight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 768px) {
    .calibration-page .calibration-top-bar {
        display: none;
    }
    .calibration-page .calibration-main {
        padding-top: clamp(0.5rem, 4vw, 1.25rem);
    }
    .calibration-card {
        border-radius: 1rem 1rem 0 0;
        padding: clamp(1.25rem, 6vw, 2rem);
        box-shadow: none;
    }
    .calibration-main {
        padding: 1rem clamp(0.75rem, 4vw, 1.5rem) 2rem;
    }
    .calibration-success-main {
        padding: clamp(0.75rem, 4vw, 1.5rem) clamp(0.75rem, 4vw, 1.5rem) calc(4.5rem + env(safe-area-inset-bottom, 0));
    }
    .calibration-success-card {
        border-radius: 1.25rem 1.25rem 0 0;
        padding: clamp(1.25rem, 5vw, 2.25rem);
        box-shadow: none;
        max-height: none;
        min-height: calc(100vh - clamp(2.5rem, 8vw, 4rem));
    }
    .calibration-success-footer {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .calibration-card .form-grid.two-column {
        grid-template-columns: 1fr;
    }
    .calibration-back-button {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .calibration-top-bar {
        flex-direction: row;
        align-items: center;
    }
    .calibration-logo {
        height: 32px;
    }
    .calibration-card {
        padding-bottom: 2.5rem;
    }
    .calibration-actions {
        justify-content: center;
    }
    .calibration-submit {
        width: 100%;
    }
    .calibration-success-card {
        padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0));
    }
    .calibration-success-footer .primary-btn {
        width: 100%;
    }
}

/* Standalone Add Meal Page */
body.add-meal-page {
  background: transparent;
  min-height: 100vh;
  margin: 0;
  color: #0f172a;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
}

body.add-meal-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.65);
  z-index: -1;
}

.add-meal-page__container {
  width: 100%;
  max-width: 640px;
  padding: clamp(28px, 7vw, 56px) clamp(18px, 6vw, 36px) clamp(40px, 10vw, 72px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.add-meal-page__title {
  font-size: 1.5rem;
  text-align: center;
  margin: 0;
  font-weight: 700;
}

.barcode-button-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.barcode-scan-btn {
  margin-top: -4px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

@media (max-width: 640px) {
  .barcode-scan-btn {
    padding: 8px 12px;
    min-width: 0;
    width: auto;
  }
}

.barcode-scan-btn:hover,
.barcode-scan-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.guest-add-note {
  margin: -8px 0 8px;
  padding: 12px 16px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #1f2937;
  text-align: center;
}

.guest-add-note strong {
  color: #1d4ed8;
}

.track-mode-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  width: clamp(260px, 64vw, 320px);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.track-mode-toggle__option {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
  z-index: 1;
  min-height: 40px;
  border-radius: 999px;
}

.track-mode-toggle__option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.track-mode-toggle__option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.track-mode-toggle__option.is-disabled input {
  cursor: not-allowed;
}

.track-mode-toggle__option span {
  pointer-events: none;
}

.track-mode-toggle__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  transition: transform 0.24s ease;
}

.track-mode-toggle[data-mode="manual"] .track-mode-toggle__indicator {
  transform: translateX(100%);
}

.track-mode-toggle[data-mode="auto"] .track-mode-toggle__indicator {
  transform: translateX(0);
}

.add-meal-page__form {
  width: min(100%, 520px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 6vw, 32px);
  background: transparent;
  padding: 0 clamp(12px, 5vw, 28px) clamp(28px, 8vw, 40px);
  box-sizing: border-box;
}

body.add-meal-page .add-meal-form .form-grid {
  grid-template-columns: 1fr;
  width: 100%;
  margin: 0;
}

body.add-meal-page .add-meal-form .form-block {
  width: min(100%, 420px);
  margin-inline: auto;
}

body.add-meal-page .form-actions {
  width: min(100%, 420px);
  margin-inline: auto;
  text-align: center;
}

.add-meal-form:not(.is-manual) .manual-only {
  display: none !important;
}

.add-meal-form.is-manual .photo-block,
.add-meal-form.is-manual .meta-block,
.add-meal-form.is-manual .desc-block,
.add-meal-form.is-manual #manualTitleBlock,
.add-meal-form.is-manual #manualNutrientsSection,
.add-meal-form.is-manual #manualFoodGroupSection {
  width: 100%;
  max-width: 460px;
  width: min(100%, 460px);
}

.manual-block input[type="text"] {
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.92);
  box-sizing: border-box;
}

.manual-block input[type="text"]:focus {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
}

.add-meal-form.is-manual .desc-block textarea {
  background: rgba(255, 255, 255, 0.92);
}

.speech-input {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.speech-toggle-btn {
  min-width: 220px;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.speech-toggle-btn::before {
  content: "\1F3A4";
  font-size: 1rem;
}

.speech-toggle-btn.speech-toggle-btn--listening {
  background: #1d4ed8;
  color: #ffffff;
}

.speech-toggle-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.listening-indicator {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translate(-50%, 120%);
  transition: transform 180ms ease, opacity 180ms ease;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  display: inline-flex;
  justify-content: center;
  width: min(220px, 70vw);
}

.listening-indicator img {
  width: 100%;
  height: auto;
  display: block;
}

.listening-indicator.listening-indicator--visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.listening-indicator.listening-indicator--visible img {
  animation: listening-pulse 1.2s ease-in-out infinite;
}

@keyframes listening-pulse {
  0% {
    filter: drop-shadow(0 0 0 rgba(59, 130, 246, 0.4));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.45));
    transform: scale(1.04);
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(59, 130, 246, 0.4));
    transform: scale(1);
  }
}

.barcode-modal__card {
  width: min(94vw, 720px);
  border-radius: 20px;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  background: radial-gradient(circle at 14% 12%, rgba(59, 130, 246, 0.08), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(14, 165, 233, 0.07), transparent 30%),
    #ffffff;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}

.barcode-modal__card.is-confirm {
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.12)),
    radial-gradient(circle at 18% 16%, rgba(99, 102, 241, 0.12), transparent 34%),
    #ffffff;
}

.barcode-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
}

.barcode-modal__close:hover,
.barcode-modal__close:focus-visible {
  background: rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.barcode-modal__header {
  padding-top: 8px;
  padding-bottom: 8px;
  text-align: center;
  display: grid;
  gap: 6px;
  align-items: center;
  justify-items: center;
}

.barcode-modal__eyebrow {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #2563eb;
}

.barcode-modal__header h2 {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.6rem);
  font-weight: 900;
  color: #0f172a;
}

.barcode-modal__subhead {
  margin: 0;
  color: #475569;
  font-size: 0.95rem;
}

.barcode-modal .modal-header {
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.barcode-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: min(72vh, 640px);
}

.barcode-modal.is-confirm .modal-body {
  gap: 14px;
}

.barcode-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.barcode-step[data-step="confirm"] {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  padding: 12px clamp(12px, 2vw, 16px) 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.barcode-viewport {
  position: relative;
  width: 100%;
  min-height: 260px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.9), rgba(37, 99, 235, 0.6));
  border-radius: 18px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25), 0 16px 40px rgba(15, 23, 42, 0.32);
}

.barcode-modal.is-confirm .barcode-viewport {
  min-height: 0;
  height: 0;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.barcode-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05);
}

.barcode-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  gap: 18px;
}

.guide-line {
  display: block;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  width: 70%;
  height: 2px;
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.7);
}

.guide-line--vertical {
  width: 2px;
  height: 70%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.95), transparent);
}

.barcode-status {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  transform: none;
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  text-align: center;
  backdrop-filter: blur(8px);
}

.barcode-status.is-error {
  background: rgba(239, 68, 68, 0.9);
  color: #f8fafc;
}

.barcode-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.barcode-modal .field-group {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.barcode-modal .field-group label {
  color: #0f172a;
}

.barcode-modal .tag-buttons {
  background: rgba(59, 130, 246, 0.08);
  border-radius: 12px;
  padding: 6px;
  gap: 8px;
}

.barcode-modal .tag-buttons button {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.barcode-modal .tag-buttons button.is-selected {
  background: linear-gradient(120deg, #2563eb, #22c55e);
  color: #f8fafc;
  border-color: transparent;
}

.barcode-modal .form-error {
  margin-top: 8px;
}

.barcode-actions .primary-btn,
.barcode-actions .secondary-btn {
  flex: 1;
  min-width: 140px;
  justify-content: center;
}

.barcode-product-card {
  width: 100%;
  background: #f8fafc;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.barcode-product-label {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: #475569;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.barcode-product-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.barcode-product-meta {
  margin: 4px 0 0;
  color: #475569;
  font-size: 0.95rem;
}

.barcode-nutrient-list {
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px 16px;
}

.barcode-nutrient-list dt {
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.barcode-nutrient-list dd {
  margin: 2px 0 0;
  color: #475569;
}

@media (max-width: 640px) {
  .barcode-modal__card {
    width: 100%;
    border-radius: 18px;
  }

  .barcode-modal .modal-body {
    max-height: calc(100vh - 140px);
  }

  .barcode-viewport {
    min-height: 230px;
  }
}

.manual-section {
  width: 100%;
  max-width: 460px;
  width: min(100%, 460px);
  margin-inline: auto;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  padding: 18px clamp(16px, 4vw, 22px);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-sizing: border-box;
  align-self: center;
}

.manual-section__header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.manual-section__hint {
  margin: 0;
  color: #475569;
  font-size: 0.85rem;
}

.manual-nutrient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.manual-nutrient-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.65);
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.manual-nutrient-field__label {
  font-size: 0.85rem;
  color: #1f2937;
  font-weight: 600;
}

.manual-nutrient-field input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: #0f172a;
  padding: 0;
  text-align: center;
}

.manual-nutrient-field input:focus {
  outline: none;
}

.manual-nutrient-field__unit {
  font-size: 0.75rem;
  color: #64748b;
}

.manual-food-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.manual-food-group-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1f2937;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.manual-food-group-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.manual-food-group-option.is-selected {
  color: #0f172a;
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.16);
}

.manual-food-group-option.is-selected span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--food-group-color, currentColor);
  display: inline-block;
  margin-right: 6px;
}

.manual-food-group-option span {
  display: inline-flex;
  align-items: center;
}

.manual-food-group-option:active {
  transform: translateY(1px);
}

.add-meal-page__close {
  position: fixed;
  top: clamp(16px, 6vw, 28px);
  right: clamp(16px, 6vw, 32px);
  color: #f8fafc;
  font-size: clamp(28px, 8vw, 36px);
  text-decoration: none;
  line-height: 1;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.add-meal-page__close:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.add-meal-page__close:hover {
  background: rgba(15, 23, 42, 0.8);
}

@media (min-width: 720px) {
  .add-meal-page__container {
    padding-top: 56px;
  }
}

@media (max-width: 768px) {
  /* QUICK ACTION BAR BACKGROUND */
  #top-bar {
    position: relative;
    z-index: 5;
    min-height: 56px;
    padding: 8px 20px;
    background:
      linear-gradient(rgba(248, 250, 252, 0.85), rgba(248, 250, 252, 0.85)),
      url("images/cuttingboard.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent !important;
  }

  body.stats-page #top-bar {
    display: none !important;
  }

  #top-bar[hidden],
  #top-bar.is-hidden {
    display: block !important;
  }

  #top-bar {
    opacity: 1 !important;
    visibility: visible !important;
  }

  body.add-meal-page .add-meal-page__container {
    padding-bottom: calc(clamp(120px, 24vh, 210px) + env(safe-area-inset-bottom, 0px));
  }
}

body.goal-celebration-open {
  overflow: hidden;
}

.goal-celebration {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 4vw, 32px);
  background:
    radial-gradient(circle at 20% 20%, rgba(236, 72, 153, 0.2), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(14, 165, 233, 0.2), transparent 45%),
    rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(10px);
  z-index: 1400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.goal-celebration--visible {
  opacity: 1;
  pointer-events: auto;
}

.goal-celebration[hidden] {
    display: none !important;
}

.three-meal-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 32px);
    background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.14), transparent 36%),
        radial-gradient(circle at 80% 30%, rgba(16, 185, 129, 0.14), transparent 38%),
        rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(14px) saturate(140%);
    transition: opacity 0.28s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 1400;
}

.three-meal-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.three-meal-modal[hidden] {
    display: none !important;
}

.three-meal-card {
    position: relative;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.32), 0 12px 24px rgba(15, 23, 42, 0.16);
    width: min(520px, 94vw);
    min-height: clamp(420px, 60vh, 520px);
    padding: clamp(24px, 6vw, 36px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
    color: #0f172a;
    border: 1px solid rgba(59, 130, 246, 0.12);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.4), rgba(15, 23, 42, 0.35)),
        linear-gradient(145deg, rgba(255, 255, 255, 0.4), rgba(236, 242, 255, 0.3)),
        url('/images/3meals.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.three-meal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(15, 23, 42, 0.08);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: #0f172a;
    font-size: 1.1rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.three-meal-close:hover,
.three-meal-close:focus-visible {
    background: rgba(59, 130, 246, 0.14);
    color: #1d4ed8;
    transform: translateY(-1px);
    outline: none;
}

.three-meal-heading {
    width: 100%;
    text-align: center;
}

.three-meal-title {
    margin: 0;
    font-size: clamp(1.6rem, 5vw, 2rem);
    font-weight: 800;
    color: #0b1224;
    text-shadow: 0 10px 22px rgba(15, 23, 42, 0.45);
    animation: three-meal-pulse 1.2s ease-in-out 3;
}

.three-meal-content {
    width: min(440px, 90vw);
    padding: clamp(18px, 4vw, 26px);
    background: rgba(255, 255, 255, 0.86);
    border-radius: 18px;
    backdrop-filter: blur(12px) saturate(130%);
    border: 1px solid rgba(59, 130, 246, 0.16);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(12px, 2vw, 18px);
    margin-bottom: clamp(18px, 6vh, 48px);
}

.three-meal-subtitle {
    margin: 0;
    font-size: clamp(0.95rem, 2.8vw, 1.05rem);
    color: #1f2937;
    text-align: center;
    line-height: 1.5;
}

.three-meal-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.three-meal-primary,
.three-meal-secondary {
    min-width: 140px;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.three-meal-primary {
    box-shadow: 0 16px 30px rgba(59, 130, 246, 0.35);
}

.three-meal-secondary {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.1);
}

.three-meal-secondary:hover,
.three-meal-secondary:focus-visible {
    background: rgba(15, 23, 42, 0.12);
}

@keyframes three-meal-pulse {
    0% {
        transform: scale(1);
        text-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
    }
    35% {
        transform: scale(1.05);
        text-shadow: 0 10px 28px rgba(59, 130, 246, 0.35);
    }
    70% {
        transform: scale(0.99);
        text-shadow: 0 6px 16px rgba(16, 185, 129, 0.28);
    }
    100% {
        transform: scale(1);
        text-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
    }
}

@media (max-width: 540px) {
    .three-meal-card {
        padding: 20px;
        width: 96vw;
        min-height: clamp(380px, 70vh, 520px);
    }

    .three-meal-content {
        padding: 16px;
        width: 100%;
    }

    .three-meal-actions {
        gap: 10px;
    }

    .three-meal-primary,
    .three-meal-secondary {
        flex: 1 1 45%;
    }
}

.goal-celebration__dialog {
  position: relative;
  width: min(400px, 92vw);
  border-radius: 28px;
  padding: clamp(26px, 4vw, 38px) clamp(22px, 5vw, 34px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3vw, 22px);
  color: #f8fafc;
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(15, 118, 110, 0.95), rgba(37, 99, 235, 0.85));
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow:
    0 35px 80px rgba(15, 23, 42, 0.65),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.goal-celebration__dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(248, 250, 252, 0.18), transparent 55%);
  pointer-events: none;
  mix-blend-mode: screen;
}

.goal-celebration__hero {
  position: relative;
  width: clamp(108px, 30vw, 160px);
  height: clamp(108px, 30vw, 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(248, 250, 252, 0.35), rgba(248, 250, 252, 0)),
    linear-gradient(135deg, rgba(236, 72, 153, 0.85), rgba(59, 130, 246, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 20px 40px rgba(14, 116, 144, 0.45),
    0 0 25px rgba(37, 99, 235, 0.4);
  isolation: isolate;
}

.goal-celebration__hero::before,
.goal-celebration__hero::after {
  content: "";
  position: absolute;
  inset: -15%;
  border-radius: inherit;
  border: 2px solid rgba(248, 250, 252, 0.35);
  opacity: 0;
  animation: goal-celebration-ring 2.4s ease-out infinite;
  z-index: -1;
}

.goal-celebration__hero::after {
  animation-delay: 1.2s;
  border-color: rgba(94, 234, 212, 0.45);
}

.goal-celebration__hero-image {
  display: block;
  width: 70%;
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.5));
  animation: goal-celebration-bounce 1.6s ease-in-out infinite,
    goal-celebration-glow 2.4s ease-in-out infinite;
}

.goal-celebration__hero-image--pulse {
  animation: goals-complete-pulse 1.6s ease-in-out infinite,
    goal-celebration-glow 2.4s ease-in-out infinite;
}

.goal-celebration__message {
  position: relative;
  font-size: clamp(1.05rem, 2.8vw, 1.4rem);
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  color: #e2e8f0;
  text-shadow: 0 8px 18px rgba(15, 23, 42, 0.55);
}

.goal-celebration__message strong {
  color: #fdf2f8;
}

.goal-celebration__close {
  position: relative;
  margin-top: clamp(12px, 3vw, 24px);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 180px;
  border-radius: 999px;
  background: linear-gradient(120deg, #22d3ee, #8b5cf6);
  border: none;
  box-shadow: 0 15px 30px rgba(14, 116, 144, 0.45);
}

.goal-celebration__close::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.goal-celebration__close:hover::after,
.goal-celebration__close:focus-visible::after {
  opacity: 1;
}

@keyframes goal-celebration-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes goal-celebration-glow {
  0%,
  100% {
    filter: drop-shadow(0 8px 20px rgba(8, 145, 178, 0.45));
  }
  50% {
    filter: drop-shadow(0 12px 30px rgba(59, 130, 246, 0.6));
  }
}

@keyframes goal-celebration-ring {
  0% {
    transform: scale(0.75);
    opacity: 0.65;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

@keyframes goals-complete-pulse {
  0%,
  100% {
    transform: scale(0.96);
  }
  50% {
    transform: scale(1.06);
  }
}

@media (max-width: 480px) {
  .goal-celebration {
    padding: 12px;
  }

  .goal-celebration__dialog {
    border-radius: 22px;
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .goal-celebration {
    transition-duration: 0.01ms;
  }

  .goal-celebration__hero-image {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transform: none !important;
  }

  .goal-celebration__hero::before,
  .goal-celebration__hero::after {
    animation: none !important;
    opacity: 0 !important;
  }
}

/* --- QUICK ACTION BAR: legacy overrides removed in favor of final rules at EOF --- */

/* Desktop-specific header cleanup */
@media (min-width: 901px) {
  body.home-page .profile-menu-wrapper,
  body.home-page .coach-review-slot {
    display: none !important;
  }
}

/* FINAL quick action bar rules — keep this at the very end */
.mobile-action-bar {
  position: fixed;
  left: 50%;
  bottom: env(safe-area-inset-bottom, 0px);
  transform: translate(-50%, 0);
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 6px 14px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px;
  z-index: 1000;
  /* show the image, no white wash */
  background: url("images/cuttingboard.png") center / cover no-repeat;
  background-color: transparent;
  /* keep the glass blur if you want; remove if too white */
  backdrop-filter: blur(12px);
  display: flex;                 /* never hidden on mobile */
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #0f172a;
  overflow: hidden;
  transition: transform 200ms ease, opacity 200ms ease;
}

.mobile-action-bar.is-single {
  justify-content: center;
}

.mobile-action-bar--hidden {
  transform: translate(-50%, 140%);
  opacity: 0;
}

/* kill the overlay that was whitening the bar */
.mobile-action-bar::before {
  content: none;
}

/* give buttons more opacity so they stand out on photos */
.mobile-action-button {
  background: rgba(255, 255, 255, 0.32);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.mobile-profile-menu {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1100;
}

.mobile-profile-menu.open {
  display: flex;
}

.mobile-profile-menu[hidden] {
  display: none !important;
}

.mobile-profile-menu-card {
  width: min(320px, 92vw);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-profile-menu-item {
  font-size: 1rem;
  color: #0f172a;
  text-decoration: none;
  padding: 12px 4px;
  border: none;
  background: transparent;
  text-align: left;
  border-radius: 12px;
  display: block;
  width: 100%;
  cursor: pointer;
}

.mobile-profile-menu-item + .mobile-profile-menu-item {
  margin-top: 2px;
}

.mobile-profile-menu-item:hover,
.mobile-profile-menu-item:focus-visible {
  background: rgba(148, 163, 184, 0.18);
  outline: none;
}

.mobile-profile-menu-item.profile-menu-item--disabled {
  color: #94a3b8;
  cursor: default;
  pointer-events: none;
  background: transparent;
}

.mobile-profile-menu-item.has-unread,
.profile-menu-item.has-unread {
  background: #e0f2fe;
  color: #0f172a;
  font-weight: 600;
}

.mobile-profile-menu-item.has-unread:hover,
.profile-menu-item.has-unread:hover {
  background: #bee3f8;
}

#mobileMenuAction.has-notifications {
  position: relative;
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.mobile-profile-menu-item.has-unread::before,
.profile-menu-item.has-unread::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #0ea5e9;
  margin-right: 8px;
  vertical-align: middle;
}

.notifications-page {
  background: #f8fafc;
}

.notifications-top-bar,
.notifications-page #top-bar {
  justify-content: center;
}

.notifications-top-bar__brand {
  margin: 0 auto;
}

.notifications-hero {
  padding: clamp(18px, 4vw, 28px);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(59, 130, 246, 0.16));
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  margin-bottom: 18px;
}

.notifications-hero h1 {
  margin: 0 0 8px 0;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
}

.notifications-hero p {
  margin: 0;
  color: #334155;
}

.notifications-layout {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 24px);
  padding-bottom: clamp(120px, 14vh, 220px);
  display: grid;
  gap: 16px;
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notification-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.notification-card:hover,
.notification-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.12);
  outline: none;
}

.notification-card__title {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
}

.notification-card__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #dbeafe;
  color: #1d4ed8;
}

.notification-card__meta {
  margin: 0;
  color: #475569;
  font-size: 0.95rem;
}

.notification-card__preview {
  margin: 8px 0 0 0;
  color: #0f172a;
  line-height: 1.4;
}

.notification-card--unread {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.45), #fff);
}

.notification-detail {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  padding: clamp(14px, 4vw, 18px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.notification-detail header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.notification-detail h2 {
  margin: 0;
  font-size: 1.2rem;
}

.notification-detail time {
  color: #475569;
}

.notification-detail__body {
  white-space: pre-wrap;
  color: #0f172a;
  margin: 0;
}

.notification-detail__media {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.notification-detail__media img,
.notification-detail__media video {
  max-width: 100%;
  max-height: min(420px, 55vh);
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.notification-detail__media video {
  background: #000;
}

.notification-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.notification-empty {
  padding: 14px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #475569;
  background: #f8fafc;
}

body.modal-open {
  overflow: hidden;
}

.notification-confirm-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 2000;
}

.notification-confirm-modal[hidden] {
  display: none !important;
}

.notification-confirm-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  z-index: 1;
}

.notification-confirm-modal__dialog {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: 18px;
  padding: clamp(18px, 4vw, 24px);
  width: min(520px, 100%);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(226, 232, 240, 0.6);
  display: grid;
  gap: 12px;
  text-align: center;
}

.notification-confirm-modal__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.12), rgba(239, 68, 68, 0.18));
  font-size: 1.5rem;
  margin: 0 auto 4px;
}

.notification-confirm-modal h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #0f172a;
}

.notification-confirm-modal p {
  margin: 0;
  color: #475569;
}

.notification-confirm-modal__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.notification-confirm-modal .primary-btn.destructive {
  background: #ef4444;
  border: none;
  color: #fff;
}

.notification-confirm-modal .primary-btn.destructive:hover,
.notification-confirm-modal .primary-btn.destructive:focus-visible {
  background: #dc2626;
}

/* Mobile fixes: make chart containers content-sized and consistent */
@media (max-width: 640px) {
  .notifications-layout {
    padding-bottom: 140px;
  }

  .notification-detail__media img,
  .notification-detail__media video {
    max-height: min(320px, 50vh);
  }

  .notification-confirm-modal__dialog {
    width: 100%;
    border-radius: 14px;
    padding: 18px 16px;
    align-items: center;
  }

  .notification-confirm-modal__actions {
    grid-template-columns: 1fr;
  }

  /* Let the whole card size to content */
  .stats-card {
    min-height: auto; /* was clamp(..., 118vh, ...) */
  }

  /* Remove vh clamps so parents aren’t taller/shorter than contents */
  .stats-chart-area {
    min-height: auto; /* was clamp(320px, 48vh, 520px) */
  }

  .stats-chart {
    height: auto;
    min-height: 300px; /* fixed, content-oriented */
    padding: 16px;
    overflow: hidden; /* safety against legend/canvas bleed */
  }

  /* Make the pie section match the bar section */
  .stats-chart-area--pie {
    margin-top: 24px;
    min-height: 300px; /* no vh */
  }
  .stats-chart-area--pie .stats-chart {
    min-height: 300px; /* no vh */
  }

  /* Keep the pie chart square and centered without forcing parent height */
  .stats-chart-area--pie .stats-chart-canvas {
    display: block;
    margin: 0 auto;
    height: auto !important;    /* stop stretching to parent’s 100% */
    max-height: 280px;
    max-width: 96vw;
    aspect-ratio: 1 / 1;
  }
}

/* Achievements page */
body.achievements-page .achievements-card {
    gap: 24px;
}

.achievements-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.achievements-heading-content {
    text-align: center;
}

.achievements-heading-content #achievementsHeading {
    margin: 0;
}

.achievements-heading-content .achievements-subtitle {
    margin-top: 12px;
}

.achievements-hero-image {
    display: block;
    margin: 12px auto 0 auto;
    width: min(55vw, 220px);
    height: auto;
}

.achievements-subtitle {
    margin: 4px 0 0 0;
    color: #475569;
    font-size: 1rem;
}

.achievements-intro {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #334155;
    font-size: 0.95rem;
}

.achievements-rules {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #1e293b;
}

.achievements-rules strong {
    color: #0f172a;
}

@media (min-width: 901px) {
    body.achievements-page #top-bar {
        display: none !important;
    }

    body.achievements-page .stats-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "stats-main";
    }
}

@media (min-width: 901px) {
    body.stats-page #top-bar {
        display: none !important;
    }

    body.stats-page .stats-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "stats-main"
            "stats-export";
    }
}

.achievements-note {
    margin: 0;
    color: #475569;
}

.achievements-helper {
    margin: 0;
    color: #334155;
}

.achievements-helper a {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
}

.achievements-helper a:hover,
.achievements-helper a:focus-visible {
    text-decoration: underline;
}

.achievements-status {
    border-radius: 12px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.28);
    color: #1d4ed8;
    font-weight: 600;
    font-size: 0.95rem;
}

.achievements-status.is-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.32);
    color: #b91c1c;
}

.achievements-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.achievement-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achievement-row-title {
    margin: 0;
    color: #0f172a;
    font-size: 1.25rem;
}

.achievement-row-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(92px, 1fr));
    gap: 16px;
}

.achievement-badge {
    min-height: 132px;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
}

.achievement-badge .mobile-action-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
}

.achievement-badge .mobile-action-label {
    font-size: 0.78rem;
}

.achievement-count {
    font-size: 0.72rem;
    font-weight: 500;
    color: #475569;
}

.achievement-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
}

.achievement-streak,
.achievement-met-days {
    font-size: 0.7rem;
    color: #475569;
    font-weight: 500;
}

.achievement-badge.is-locked .mobile-action-icon img {
    filter: grayscale(100%);
    opacity: 0.55;
}

.achievement-badge.is-locked .achievement-count {
    color: #94a3b8;
}

.achievement-badge.is-locked .achievement-streak,
.achievement-badge.is-locked .achievement-met-days {
    color: #94a3b8;
}

.achievement-modal-card {
    max-width: 420px;
    width: min(420px, 92vw);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
}

.achievement-modal-close {
    align-self: flex-end;
    background: transparent;
    border: none;
    color: #475569;
    font-size: 1.6rem;
    cursor: pointer;
}

.achievement-modal-close:hover,
.achievement-modal-close:focus-visible {
    color: #1d4ed8;
    outline: none;
}

.achievement-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

.achievement-modal-image {
    width: 132px;
    height: 132px;
    border-radius: 24px;
    background: rgba(148, 163, 184, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.achievement-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.achievement-modal-image.is-locked img {
    filter: grayscale(100%);
    opacity: 0.55;
}

.achievement-modal-title {
    margin: 0;
    color: #0f172a;
    font-size: 1.4rem;
}

.achievement-modal-description {
    margin: 0;
    color: #475569;
    font-size: 0.98rem;
}

.achievement-modal-count,
.achievement-modal-streak,
.achievement-modal-progress {
    margin: 0;
    color: #475569;
    font-size: 0.92rem;
    font-weight: 600;
}

.achievement-modal-progress[hidden] {
    display: none;
}

.achievement-modal-count {
    margin: 0;
    color: #1d4ed8;
    font-weight: 600;
}

body.achievements-guest-locked {
    overflow: hidden;
}

body.achievements-guest-locked .achievements-layout,
body.achievements-guest-locked #mobileActionBar {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

body.coach-review-guest-locked {
    overflow: hidden;
}

body.coach-review-guest-locked .coach-review-header,
body.coach-review-guest-locked .coach-review-main,
body.coach-review-guest-locked #mobileActionBar {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.guest-lock-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 3000;
}

.guest-lock-modal[hidden] {
    display: none;
}

.guest-lock-card {
    width: min(520px, 100%);
    background: #fff;
    border-radius: 28px;
    padding: 36px 32px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: center;
}

.guest-lock-icon {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    background: rgba(59, 130, 246, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.guest-lock-icon img {
    width: 64px;
    height: 64px;
}

.guest-lock-eyebrow {
    margin: 0;
    color: #6366f1;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.guest-lock-card h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #0f172a;
}

.guest-lock-description {
    margin: 0;
    color: #475569;
    font-size: 1rem;
}

.guest-lock-list {
    margin: 0;
    padding-left: 22px;
    text-align: left;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.guest-lock-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
    align-items: center;
}

.guest-lock-primary {
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-sizing: border-box;
}

.guest-lock-secondary {
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-sizing: border-box;
}

.guest-lock-error {
    margin: 8px auto 0;
    color: #b91c1c;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

.guest-lock-error[hidden] {
    display: none;
}

@media (max-width: 640px) {
    .guest-lock-card {
        padding: 28px 22px;
        border-radius: 22px;
    }

    .guest-lock-card h2 {
        font-size: 1.5rem;
    }

    .guest-lock-list {
        font-size: 0.95rem;
    }

    .guest-lock-primary,
    .guest-lock-secondary {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .achievements-grid {
        gap: 20px;
    }

    .achievement-row-title {
        font-size: 1.15rem;
    }

    .achievement-badge {
        min-height: 120px;
        padding: 8px 6px;
    }

    .achievement-badge .mobile-action-icon {
        width: 48px;
        height: 48px;
    }
}

.guest-only-notice {
    margin: 20px auto 32px;
    max-width: 780px;
    padding: 18px 24px;
    border-radius: 18px;
    background: rgba(59, 130, 246, 0.12);
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

body.settings-page.guest-settings-mode .guest-only-notice {
    display: block;
}

body.settings-page.guest-settings-mode .settings-card.is-guest-locked {
    opacity: 0.65;
}

/* Ensure Manage Subscription link remains clickable even when parent containers limit pointer events */
#manageSubscriptionButton {
    pointer-events: auto;
}

body.settings-page.guest-settings-mode .account-management-card.is-guest-locked #manageSubscriptionButton {
    pointer-events: auto;
}

.settings-form input:disabled,
.settings-form select:disabled,
.settings-form textarea:disabled {
    background: rgba(148, 163, 184, 0.16);
    border-color: rgba(148, 163, 184, 0.5);
    color: #475569;
    cursor: not-allowed;
}

.settings-form button:disabled,
.settings-form .secondary-btn:disabled,
.settings-form .danger-btn:disabled,
.settings-form .primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.guest-disabled-control {
    pointer-events: none;
}

.calibration-guest-notice {
    margin: 12px auto 28px;
    padding: 18px 22px;
    border-radius: 18px;
    background: rgba(220, 38, 38, 0.08);
    color: #7f1d1d;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 16px 32px rgba(220, 38, 38, 0.18);
}

body.calibration-page.calibration-guest-mode .nutrition-calibration-form {
    opacity: 0.92;
}

/* Nutrition info page and links */
.nutrition-info-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #4b5563;
    text-decoration: none;
    font-weight: 600;
}

.nutrition-info-link:hover,
.nutrition-info-link:focus {
    color: #111827;
    text-decoration: underline;
}

.nutrition-info-link--blue {
    color: #2563eb;
}

.nutrition-info-link--blue:hover,
.nutrition-info-link--blue:focus {
    color: #1d4ed8;
    text-decoration: underline;
}

.meal-view-modal .nutrition-info-link {
    color: #f8fafc;
}

.meal-view-modal .nutrition-info-link:hover,
.meal-view-modal .nutrition-info-link:focus {
    color: #e0f2fe;
}

.nutrition-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    font-size: 0.75rem;
    font-weight: 700;
}

.nutrition-info-inline {
    margin-top: 8px;
    color: #4b5563;
}

.settings-actions__nutrition-helper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.nutrition-info-page {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 40%);
    min-height: 100vh;
    color: #0f172a;
}

.nutrition-info-header {
    max-width: 900px;
    margin: 36px auto 12px;
    padding: 0 clamp(16px, 4vw, 28px);
}

.nutrition-info-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.nutrition-info-home {
    color: #4f46e5;
    font-weight: 700;
    text-decoration: none;
}

.nutrition-info-home:hover,
.nutrition-info-home:focus {
    text-decoration: underline;
}

.nutrition-info-logo {
    height: clamp(52px, 10vw, 80px);
    width: auto;
}

.nutrition-info-intro {
    margin-top: 8px;
    color: #475569;
    line-height: 1.5;
    font-size: 0.98rem;
}

.nutrition-info-content {
    max-width: 900px;
    margin: 0 auto 72px;
    padding: 0 clamp(16px, 4vw, 28px);
}

.nutrition-info-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
    padding: clamp(20px, 5vw, 32px);
    line-height: 1.7;
    color: #1f2937;
}

.nutrition-info-card h1 {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    margin-bottom: 12px;
}

.nutrition-info-card h2 {
    font-size: clamp(1.2rem, 2.4vw, 1.6rem);
    margin: 20px 0 10px;
    color: #111827;
}

.nutrition-info-card ul {
    list-style: disc;
    padding-left: 20px;
    margin: 8px 0 12px;
}

.nutrition-info-card li + li {
    margin-top: 8px;
}

.nutrition-source-list {
    display: grid;
    gap: 8px;
    padding-left: 18px;
}

.nutrition-source-list a {
    color: #2563eb;
    text-decoration: none;
}

.nutrition-source-list a:hover,
.nutrition-source-list a:focus {
    text-decoration: underline;
}

.nutrition-info-footnote {
    margin-top: 16px;
    color: #475569;
    font-size: 0.95rem;
}

@media (max-width: 640px) {
    .nutrition-info-brand {
        flex-direction: column;
        align-items: flex-start;
    }

    .nutrition-info-card {
        border-radius: 16px;
    }
}
