/* ======================================================
   KALÓRIANAPLÓ AI / PROJECT ZUZU
   style.css v2
   ------------------------------------------------------
   Egyben tartott, rendezett CSS verzió.
   Később szétszedhető komponens fájlokra.
====================================================== */

/* ======================================================
   RESET / BASE
====================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
}

img {
    max-width: 100%;
    display: block;
}

/* ======================================================
   TYPOGRAPHY
====================================================== */

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

h1 {
    text-align: center;
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: .25rem;
}

h2 {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.section-title,
.quick-actions h2,
.daily-log-section h2 {
    text-align: center;
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

/* ======================================================
   ICONS
====================================================== */

.material-symbols-outlined {
    color: var(--text-light);
}

/* ======================================================
   FORMS / BUTTONS
====================================================== */

input,
textarea {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
}

button {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

button:hover {
    background: var(--primary-dark);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(46, 125, 50, .25);
}

.secondary-button {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
}

.secondary-button:hover {
    background: rgba(46, 125, 50, .08);
}

.input-group {
    display: flex;
    align-items: center;
    gap: .75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .9rem 1rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, .15);
}

/* ======================================================
   LOGIN
====================================================== */

body:not(.dashboard-body) {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.login-page {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

.logo {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 1rem;
}

#welcomeMessage {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
    font-weight: 500;
}

.footer-links {
    text-align: center;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.footer-links a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
    line-height: 1.3;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-separator {
    display: none;
}

footer {
    margin-top: 1rem;
    color: var(--text-light);
    font-size: .9rem;
}

/* ======================================================
   MODALS - BASE
====================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1000;
}

.modal-overlay[hidden] {
    display: none;
}

#dailyReviewModal:not([hidden]) {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.modal-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

.modal-card h3 {
    font-size: 1.4rem;
    margin-bottom: .75rem;
    color: var(--text);
}

.modal-card p {
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.daily-review-modal { max-width: 760px; max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.25rem; box-shadow: none; }
.daily-review-header { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; }
.daily-review-header > img { width: 56px; height: 56px; flex: 0 0 56px; object-fit: contain; }
.daily-review-header > div { flex: 1; min-width: 0; }
.daily-review-header h2 { margin: 0; color: var(--primary); font-size: 1.35rem; }
.daily-review-header p { margin: .2rem 0 0; font-weight: 700; color: var(--text); }
.daily-review-header button { width: auto; min-width: 44px; min-height: 44px; padding: .5rem; }
#closeDailyReview { background: transparent; color: var(--meal-delete-color); font-size: 12px; font-weight: 700; border: none; }
#closeDailyReview:hover { background: transparent; text-decoration: underline; }
.daily-review-historical { border-left: 4px solid var(--primary); padding: .65rem .8rem; background: var(--background); border-radius: 8px; }
.daily-review-progress { display: grid; gap: .75rem; }
.daily-review-metric { padding: .85rem; border: 1px solid var(--border); border-radius: 12px; background: var(--background); }
.daily-review-metric-heading { display: flex; justify-content: space-between; gap: .75rem; font-weight: 700; }
.daily-review-target { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.daily-review-difference { margin-top: .2rem; font-size: .8rem; font-weight: 700; }
.daily-review-difference.is-under { color: var(--primary); }
.daily-review-difference.is-over { color: var(--error); }
.daily-review-meter { display: flex; align-items: center; gap: .65rem; margin-top: .65rem; min-height: 1.6rem; }
.daily-review-meter progress { flex: 1 1 auto; min-width: 0; width: 100%; height: 8px; accent-color: var(--primary); }
.daily-review-current { flex: 0 0 auto; font-size: 1rem; font-weight: 700; white-space: nowrap; }
.daily-review-current.is-macro { color: var(--primary); font-size: .85rem; }
.daily-review-metric-detail { margin: .35rem 0 0; font-size: .9rem; line-height: 1.5; color: var(--text-light); }
.daily-review-context { display: grid; gap: .5rem; margin: 1rem 0; }
.daily-review-context span { padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 12px; font-size: calc(1rem - 1px); font-weight: 700; color: #000; }
.daily-review-advice { margin-top: 1rem; padding: 1rem; border-radius: 14px; background: var(--background); }
.daily-review-advice h3 { margin: 0 0 .65rem; color: var(--primary); font-size: 1.05rem; }
.daily-review-advice button { min-height: 48px; width: 100%; padding: .7rem; font-weight: 700; }
.daily-review-advice button:disabled { background: var(--surface); color: var(--text-light); border: 2px dashed var(--border); opacity: 1; cursor: not-allowed; transform: none; box-shadow: none; }
.daily-review-loading-bar { height: 25px; margin-top: .75rem; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--primary) 18%, transparent); }
.daily-review-loading-bar span { display: block; width: 38%; height: 100%; border-radius: inherit; background: var(--primary); animation: daily-review-loading 1.15s ease-in-out infinite alternate; }
@keyframes daily-review-loading { from { transform: translateX(-20%); } to { transform: translateX(190%); } }
.daily-review-modal .daily-review-estimate-note { margin: .8rem 0 0; text-align: left; color: var(--primary); font-size: .9rem; font-weight: 700; line-height: 1.5; }
#dailyAdviceStatus { margin: .6rem 0 0; font-size: .85rem; line-height: 1.5; }
#dailyAdviceStatus .daily-review-balance { display: block; margin-bottom: .4rem; font-size: calc(.95rem + 3px); font-weight: 600; font-style: italic; color: var(--meal-delete-color); }
#dailyAdviceStatus .daily-review-balance + span { font-size: calc(.85rem + 1px); font-weight: 700; font-style: italic; }
.daily-review-advice[data-advice-state="goal_reached_or_exceeded"] { background: var(--primary); box-shadow: 10px 10px 10px #555; }
.daily-review-advice[data-advice-state="goal_reached_or_exceeded"] h3 { color: var(--surface); }
.daily-review-advice[data-advice-state="goal_reached_or_exceeded"] #dailyAdviceStatus { padding: 1rem; border-radius: 12px; background: var(--surface); color: var(--text); text-align: center; }
.daily-review-advice[data-advice-state="goal_reached_or_exceeded"] .daily-review-balance { animation: daily-review-balance-pulse 1s ease-in-out infinite; }
@keyframes daily-review-balance-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@media (prefers-reduced-motion: reduce) {
    .daily-review-advice[data-advice-state="goal_reached_or_exceeded"] .daily-review-balance { animation: none; }
}
#dailyReviewError { color: var(--error); font-weight: 600; }
.daily-review-suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .65rem; margin-top: .75rem; }
.daily-review-suggestion { padding: .8rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-width: 0; }
.daily-review-suggestion h4 { margin: 0 0 .35rem; color: var(--text); }
.daily-review-suggestion p { margin: .25rem 0; font-size: .85rem; }
.daily-review-suggestion strong { color: var(--primary); }
@media (max-width: 600px) {
    #closeDailyReview { font-size: 11px; }
    .daily-review-modal { width: 100%; max-width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; padding: 1rem; }
    .daily-review-header { gap: .6rem; }
    .daily-review-header > img { width: 48px; height: 48px; flex-basis: 48px; }
    .daily-review-header h2 { font-size: 1.12rem; }
    .daily-review-metric { padding: .7rem; }
    .daily-review-loading-bar { height: 15px; }
}

.modal-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1rem;
}

/* ======================================================
   DASHBOARD LAYOUT
====================================================== */

.dashboard-body {
    background: #f5f7fa;
    min-height: 100vh;
}

.dashboard-shell {
    width: 60%;
    max-width: 1400px;
    min-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ======================================================
   DASHBOARD HEADER / BRAND
====================================================== */

.dashboard-header {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.dashboard-brand {
    text-align: center;
}

.dashboard-brand-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin: 0 auto .5rem;
}

.dashboard-logo {
    font-size: 2rem;
    margin-bottom: .5rem;
}

.dashboard-brand h1 {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: .4rem;
}

.dashboard-brand p {
    font-size: 1.5rem;
    color: #555;
}

.dashboard-brand strong {
    color: var(--primary);
}

/* ======================================================
   HERO / WELCOME PANEL
====================================================== */

.welcome-panel {
    background: linear-gradient(135deg, #2e7d32, #66bb6a);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.2rem;
    color: white;
}

.hero-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    text-align: left;
}

.hero-zuzu {
    flex-shrink: 0;
}

.hero-zuzu-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
}

.hero-content {
    flex: 1;
    text-align: left;
}

.hero-content h2 {
    font-size: 2.1rem;
    margin-bottom: .6rem;
    color: var(--primary);
    font-weight: 700;
    text-align: left;
}

.hero-content p {
    font-size: 1.15rem;
    color: #2e7d32;
    line-height: 1.5;
    font-weight: 500;
    text-align: left;
}

.zuzu-avatar,
.zuzu-badge {
    display: block;
    margin: 0 auto;
}

.zuzu-avatar {
    width: 96px;
    height: 96px;
    object-fit: contain;
}

.zuzu-badge {
    font-size: 3.5rem;
}

.zuzu-name {
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
}

/* ======================================================
   DATE SELECTOR
====================================================== */

.section-toolbar {
    display: flex;
    justify-content: center;
}

.date-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: white;
    border: none;
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: .8rem 1.2rem;
    cursor: pointer;
    color: #263238;
    font-weight: 500;
}

/* ======================================================
   DAILY STAT CARDS
====================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem;
    min-height: 190px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: .8rem;
    text-align: center;
}

.stat-card .material-symbols-outlined {
    font-size: 2.8rem;
    color: var(--primary);
}

.stat-card h3 {
    font-size: 1.35rem;
    margin-bottom: .3rem;
}

.stat-card p {
    color: #61758a;
    font-size: 1rem;
}

.stat-over-limit {
    color: #d32f2f;
    font-weight: 700;
}

/* ======================================================
   QUICK ACTIONS
====================================================== */

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.action-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: white;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.7rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    cursor: pointer;
    transition: all .2s ease;
}

.action-card:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #2e7d32, #4caf50);
}

.action-card .material-symbols-outlined {
    font-size: 2.8rem;
    color: var(--primary);
}

.action-card:hover .material-symbols-outlined,
.action-card:hover strong,
.action-card:hover small {
    color: white;
}

.action-card strong {
    display: block;
    font-size: 1.25rem;
    color: #263238;
    margin-bottom: .35rem;
}

.action-card small {
    display: block;
    font-size: .95rem;
    color: dimgray;
}

/* ======================================================
   DAILY LOG
====================================================== */

.daily-log-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.daily-log-empty {
    text-align: center;
    color: var(--text-light);
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.daily-log-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.daily-log-main {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.daily-log-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.daily-log-content strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: .25rem;
}

.daily-log-content small {
    display: block;
    color: var(--text-light);
    line-height: 1.4;
}

.meal-original {
    margin-bottom: .25rem;
    opacity: .85;
}

.daily-log-meta {
    text-align: right;
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

/* ======================================================
   ONBOARDING MODAL
====================================================== */

.onboarding-modal {
    max-width: 520px;
}

.onboarding-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    text-align: left;
    margin-bottom: 2rem;
}

.onboarding-header .zuzu-avatar {
    width: 120px;
    height: 120px;
    margin-bottom: .5rem;
}

.onboarding-zuzu {
    flex-shrink: 0;
}

.onboarding-zuzu-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
}

.onboarding-copy h3,
.onboarding-header h3 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: .75rem;
}

.onboarding-copy p,
.onboarding-header p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.7;
}

.onboarding-step h4 {
    font-size: 1.4rem;
    margin-bottom: .75rem;
    text-align: center;
}

.onboarding-step p {
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.onboarding-options,
.onboarding-form-grid {
    display: grid;
    gap: .75rem;
}

.onboarding-option {
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
    text-align: left;
}

.onboarding-option:hover {
    background: rgba(46, 125, 50, .08);
    color: var(--primary);
}

.onboarding-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1.5rem;
}

.onboarding-progress {
    margin-top: 1.5rem;
    height: 6px;
    background: #e0e0e0;
    border-radius: 999px;
    overflow: hidden;
}

.onboarding-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width .3s ease;
}

.onboarding-field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.onboarding-field span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.onboarding-field input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    font-size: 1rem;
    background: white;
}

.onboarding-hint {
    background: rgba(46, 125, 50, .08);
    color: var(--primary);
    border-radius: 12px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 500;
}

.onboarding-complete {
    text-align: center;
}

.onboarding-complete h3 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.onboarding-complete p {
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.goal-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.goal-summary div {
    background: #f7f7f7;
    padding: 1rem;
    border-radius: 16px;
}

.goal-summary strong {
    display: block;
    font-size: 1.3rem;
    color: var(--primary);
}

.goal-summary span {
    font-size: .9rem;
    color: var(--text-light);
}

.complete-btn {
    width: 100%;
}

/* ======================================================
   MEAL MODAL
====================================================== */

.meal-modal {
    max-width: 560px;
}

.meal-modal-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.meal-modal-zuzu {
    width: 96px;
    height: 96px;
    object-fit: contain;
    flex-shrink: 0;
}

.meal-modal-header h3 {
    font-size: 1.7rem;
    color: var(--primary);
    margin-bottom: .4rem;
}

.meal-modal-header p {
    color: var(--text-light);
    line-height: 1.5;
}

.meal-textarea {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
}

.meal-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, .15);
}

.meal-modal-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1rem;
}

.meal-thinking-state {
    text-align: center;
    padding: 2rem 1rem;
}

.thinking-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.meal-thinking-state p {
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.meal-result-state {
    margin-top: 1rem;
}

.meal-result-card {
    background: #f7faf8;
    border: 1px solid #d7ead8;
    border-radius: 18px;
    padding: 1.25rem;
}

.meal-result-card h4 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: .75rem;
}

.meal-result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
    margin: 1rem 0;
}

.meal-result-grid div {
    background: white;
    border-radius: 14px;
    padding: .9rem;
    text-align: center;
}

.meal-result-grid strong {
    display: block;
    color: var(--primary);
    font-size: 1.15rem;
}

.meal-result-grid span {
    color: var(--text-light);
    font-size: .85rem;
}

.meal-result-message {
    color: var(--text);
    line-height: 1.5;
    margin-top: 1rem;
}

.meal-result-actions {
    margin-top: 1rem;
}

/* ======================================================
   LOGOUT
====================================================== */

.logout-section {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: auto;
    min-height: 44px;
    padding: .5rem .9rem;
    border: none;
    border-radius: 14px;
    background: #007e49;
    color: white;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}

.logout-icon { flex: 0 0 28px; }

.logout-button:hover {
    background: #00653a;
    transform: translateY(-2px);
}

/* ======================================================
   TABLET
====================================================== */

@media (max-width: 1400px) {
    .dashboard-shell {
        width: 70%;
        min-width: unset;
    }

    .dashboard-brand h1 {
        font-size: 2.2rem;
    }

    .dashboard-brand p {
        font-size: 1.2rem;
    }

    .welcome-panel {
        padding: 1.8rem;
    }

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

    .stat-card {
        min-height: 120px;
        padding: 1rem;
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
    }

    .stat-card .material-symbols-outlined {
        font-size: 2.6rem;
    }

    .stat-card h3 {
        font-size: 1.1rem;
    }

    .stat-card p {
        font-size: .9rem;
    }
}

/* ======================================================
   MOBILE
====================================================== */

@media (max-width: 768px) {
    .dashboard-shell {
        width: 100%;
        padding: 1rem;
    }

    .dashboard-header {
        margin-bottom: 1.4rem;
    }

    .dashboard-brand-logo {
        width: 56px;
        height: 56px;
    }

    .dashboard-logo {
        font-size: 1.8rem;
    }

    .dashboard-brand h1 {
        font-size: 1.9rem;
    }

    .dashboard-brand p {
        font-size: 1rem;
    }

    .dashboard-main {
        gap: 1.4rem;
    }

    .welcome-panel {
        padding: 1.4rem;
    }

    .hero-card,
    .onboarding-header,
    .meal-modal-header {
        flex-direction: column;
        text-align: center;
    }

    .hero-content,
    .hero-content h2,
    .hero-content p {
        text-align: center;
    }

    .hero-zuzu-img {
        width: 90px;
        height: 90px;
    }

    .hero-content h2 {
        font-size: 1.5rem;
    }

    .zuzu-avatar {
        width: 72px;
        height: 72px;
    }

    .onboarding-header .zuzu-avatar {
        width: 92px;
        height: 92px;
    }

    .onboarding-zuzu-img {
        width: 100px;
        height: 100px;
    }

    .onboarding-copy h3,
    .onboarding-header h3 {
        font-size: 1.5rem;
    }

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

    .stat-card {
        min-height: 92px;
        padding: .85rem;
    }

    .stat-card .material-symbols-outlined {
        font-size: 2.2rem;
    }

    .stat-card h3 {
        font-size: 1rem;
    }

    .stat-card p {
        font-size: .82rem;
    }

    .quick-actions h2,
    .daily-log-section h2 {
        font-size: 1.2rem;
    }

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

    .action-card {
        min-height: 140px;
        padding: 1rem;
        gap: .6rem;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .action-card span:last-child {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .action-card .material-symbols-outlined {
        font-size: 2.3rem;
    }

    .action-card strong {
        font-size: .9rem;
        line-height: 1.25;
    }

    .action-card small {
        font-size: .72rem;
        line-height: 1.3;
    }

    .modal-actions,
    .onboarding-actions,
    .meal-modal-actions {
        flex-direction: column-reverse;
    }

    .goal-summary {
        grid-template-columns: 1fr;
    }

    .meal-modal-zuzu {
        width: 82px;
        height: 82px;
    }

    .daily-log-card {
        align-items: flex-start;
    }

    .daily-log-meta {
        font-size: .9rem;
    }
}

/* ======================================================
   SMALL MOBILE
====================================================== */

@media (max-width: 420px) {
    .login-card {
        padding: 2rem 1.5rem;
    }

    .dashboard-shell {
        padding: .8rem;
    }

    .stats-grid,
    .action-grid {
        gap: .8rem;
    }

    .action-card {
        min-height: 130px;
        padding: .85rem;
    }

    .action-card strong {
        font-size: .85rem;
    }

    .action-card small {
        font-size: .68rem;
    }

    .onboarding-modal {
        padding: 1.5rem;
    }
}

/* Compact manual entry in the existing meal modal. */
.meal-modal {
    max-height: calc(100vh - 3rem);
    max-height: calc(100dvh - 3rem);
    overflow-y: auto;
}
.meal-input-state label { display: block; margin: .6rem 0; }
.meal-input-state select, .manual-meal-fields input {
    width: 100%; min-width: 0; padding: .6rem; font: inherit;
}
.manual-meal-fields:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.manual-meal-fields small { grid-column: 1 / -1; }
#mealSaveError { color: #9c2424; }
@media (max-width: 420px) {
    .manual-meal-fields:not([hidden]) { grid-template-columns: 1fr; }
}

.meal-log-card { flex-wrap: wrap; gap: .5rem 1rem; color: var(--text); background: var(--surface); }
.meal-log-card .meal-type-title { margin-bottom: .4rem; font-size: 1.05rem; font-weight: 800; color: var(--text); }
.meal-log-card .meal-description { margin: 0 0 .25rem; font-size: .875rem; font-weight: 400; line-height: 1.5; color: var(--text); white-space: pre-line; }
.daily-log-main { min-width: 0; flex: 1 1 14rem; }
.daily-log-content { min-width: 0; overflow-wrap: anywhere; }
.meal-card-actions {
    flex: 0 0 100%; display: flex; justify-content: space-between; align-items: center;
}
.meal-edit-button {
    width: auto; min-height: 44px; padding: .25rem 0; border-radius: 4px;
    background: transparent; color: var(--primary); font-size: .9rem;
    text-decoration: underline; text-underline-offset: .2em;
}
.meal-edit-button:hover { background: transparent; color: var(--primary-dark); }
.meal-edit-button:disabled { opacity: .5; cursor: wait; }
.meal-edit-food { border: 1px solid var(--border); border-radius: 12px; padding: .7rem; margin-top: .8rem; }
.meal-edit-food input, #mealEditTime { width: 100%; min-width: 0; font: inherit; padding: .5rem; }

.journal-date {
    display: block; width: 17rem; max-width: 100%; min-height: 48px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--background);
    padding: .65rem 1rem; margin: 0 auto .8rem; font: inherit; text-align: center;
    font-size: 1.1rem; font-weight: 700; color: var(--primary);
    cursor: pointer; transition: var(--transition);
}
.journal-date::-webkit-datetime-edit { text-align: center; }
.journal-date::-webkit-calendar-picker-indicator { cursor: pointer; }
.journal-date:hover { background: white; border-color: var(--primary); }
.journal-date:focus-visible { outline-offset: 3px; border-color: var(--primary); }
.meal-delete-button {
    width: 44px; min-width: 44px; min-height: 44px; padding: .25rem;
    color: var(--meal-delete-color); background: transparent;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0; line-height: 1;
}
.meal-delete-button::before {
    content: ''; width: 20px; height: 20px; background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7M14 10v7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.meal-delete-button:hover { background: #ffe0e0; }
.meal-delete-button:disabled { opacity: .5; cursor: wait; }
@media (max-width: 768px) {
    .meal-delete-button::before { width: 16px; height: 16px; }
}

.exercise-section { margin-top: 2rem; }
.exercise-section h2 { color: var(--primary); font-size: 1.8rem; font-weight: 700; margin-bottom: .5rem; }
.exercise-day-hint { color: var(--text-light); line-height: 1.5; }
.exercise-total { color: var(--primary); font-weight: 700; margin: 1rem 0; }
.exercise-card { flex-wrap: wrap; gap: .5rem 1rem; }
.exercise-card .daily-log-content { flex: 1 1 14rem; }
.exercise-modal { max-height: calc(100dvh - 2rem); overflow-y: auto; }
.exercise-modal h3 { margin-bottom: 1rem; }
.exercise-modal [hidden] { display: none !important; }
.exercise-modal fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.exercise-modal label { display: block; margin: .75rem 0 .3rem; }
.exercise-modal input, .exercise-modal select, .exercise-modal textarea {
    display: block; width: 100%; min-width: 0; min-height: 44px; padding: .65rem;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font: inherit;
}

.exercise-modal button { min-height: 44px; margin-top: .75rem; }
.exercise-modal small, #exerciseEstimateInfo { color: var(--text-light); line-height: 1.5; }
.exercise-modal small { display: block; margin-top: .6rem; }
.exercise-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; }
#exerciseError { color: var(--error); margin-top: .75rem; }
#exerciseProgress { margin-top: .75rem; }
@media (max-width: 520px) {
    .exercise-section h2 { font-size: 1.2rem; }
    .exercise-fields { grid-template-columns: 1fr; }
    .exercise-modal { padding: 1.25rem; }
}

/* Daily overview: available actions and actual progress share the first screen. */
.dashboard-shell { width: 100%; min-width: 0; max-width: 1160px; padding: 1.5rem; }
.dashboard-main { gap: 1.25rem; }
.dashboard-header { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.dashboard-brand { display: grid; grid-template-columns: 44px auto; column-gap: .6rem; text-align: left; align-items: center; }
.dashboard-brand-logo { grid-row: 1 / 3; width: 44px; height: 44px; margin: 0; }
.dashboard-brand h1 { font-size: 1.5rem; text-align: left; margin: 0; }
.dashboard-brand p { font-size: .8rem; }
.dashboard-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.overview-panel, .journal-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; min-width: 0; box-shadow: var(--shadow); }
.journal-column { display: grid; gap: 1.25rem; min-width: 0; }
.dashboard-columns .exercise-section { margin-top: 0; }
.dashboard-columns .journal-panel > h2 { color: var(--primary); font-size: calc(1.2rem - 1px); font-weight: 700; text-align: left; margin-bottom: 1rem; }
.journal-panel .daily-log-card { box-shadow: none; border: 1px solid var(--border); padding: 1rem; }
.journal-panel .daily-log-empty { box-shadow: none; background: var(--background); padding: 1rem; }
.global-date-control {
    position: relative; display: flex; align-items: center; justify-content: center; gap: .65rem;
    width: 17rem; max-width: 100%; min-height: 48px; margin-left: auto; padding: .65rem 1rem;
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
    cursor: pointer; transition: var(--transition);
}
.global-date-control #overviewDate { font-size: 1.05rem; font-weight: 700; color: var(--primary); pointer-events: none; }
.global-date-icon { pointer-events: none; }
.global-date-control .journal-date { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.global-date-control:hover { background: var(--background); border-color: var(--primary); }
.global-date-control:focus-within { outline: 3px solid rgba(46, 125, 50, .35); outline-offset: 3px; border-color: var(--primary); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#dashboardStatus:empty { display: none; }
#dashboardStatus, #dashboardError { margin-bottom: 1rem; color: var(--text-light); }
#dashboardError { color: var(--error); }
.dashboard-columns h2 { color: var(--primary); font-size: calc(1.2rem - 1px); font-weight: 700; text-align: left; margin-bottom: 1rem; }
.dashboard-columns .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.dashboard-columns .action-card {
    min-height: 90px; padding: .8rem; gap: .65rem; flex-direction: row; align-items: center;
    justify-content: flex-start; text-align: left; background: var(--background); border: 1px solid #dce8de;
    box-shadow: none; color: var(--text);
}
.action-icon { width: 2rem; flex: 0 0 2rem; font-size: 1.65rem; text-align: center; }
.action-icon img { display: block; width: 100%; height: auto; border-radius: 50%; }
.dashboard-columns .action-card > span:last-child { display: block; min-width: 0; text-align: left; }
.dashboard-columns .action-card strong { font-size: 1.05rem; margin-bottom: .2rem; line-height: 1.25; }
.dashboard-columns .action-card small { font-size: .75rem; line-height: 1.4; }
.dashboard-columns .action-card:enabled:hover { transform: translateY(-1px); background: var(--primary); }
.dashboard-columns .action-card:disabled { background: #f7f8f9; border-color: var(--border); cursor: not-allowed; }
.dashboard-columns .action-card:disabled:hover { transform: none; }
.dashboard-columns .action-card:disabled strong, .dashboard-columns .action-card:disabled small { color: var(--text-light); }
.dashboard-columns .action-card:focus-visible, .secondary-actions summary:focus-visible { outline-offset: 3px; }
.secondary-actions { margin-top: .65rem; color: var(--text-light); font-size: .85rem; }
.secondary-actions summary { cursor: pointer; padding: .75rem 0; min-height: 44px; color: var(--primary); font-weight: 700; }
.secondary-actions > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; }
.secondary-actions button { min-height: 44px; padding: .6rem; font-size: .8rem; }
#openStatisticsModal { background: var(--background); color: var(--text); border: 1px solid var(--border); }
#openStatisticsModal:hover, #openStatisticsModal:focus-visible { background: var(--primary); color: white; border-color: var(--primary); }
.secondary-actions button:disabled { background: #f7f8f9; color: var(--text-light); cursor: not-allowed; }
.secondary-actions small { display: block; margin-top: .2rem; }
.progress-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .25rem .75rem; margin-bottom: .5rem; }
.progress-heading h2 { margin-bottom: 0; }
#overviewDate { font-size: .8rem; color: var(--text-light); }
.progress-list { display: grid; }
.daily-progress-row { min-width: 0; padding: .65rem 0; border-bottom: 1px solid #edf1ee; }
.daily-progress-row:last-child { border-bottom: 0; padding-bottom: 0; }
.progress-row-label { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .9rem; }
.progress-row-label > span { font-weight: 500; flex-shrink: 0; }
.progress-row-label p { font-size: .85rem; text-align: right; overflow-wrap: anywhere; color: var(--text-light); }
.daily-progress-row progress { display: block; width: 100%; height: 6px; margin-top: .5rem; border: 0; border-radius: 999px; overflow: hidden; background: #e9efea; color: var(--primary); accent-color: var(--primary); }
.daily-progress-row progress[hidden] { display: none; }
.daily-progress-row progress::-webkit-progress-bar { background: #e9efea; border-radius: 999px; }
.daily-progress-row progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
.daily-progress-row progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
.progress-row-label p[data-over-target="true"] { color: var(--meal-delete-color); }
.daily-progress-row progress[data-over-target="true"] { color: var(--meal-delete-color); accent-color: var(--meal-delete-color); }
.daily-progress-row progress[data-over-target="true"]::-webkit-progress-value { background: var(--meal-delete-color); }
.daily-progress-row progress[data-over-target="true"]::-moz-progress-bar { background: var(--meal-delete-color); }
@media (max-width: 768px) {
    .dashboard-shell { padding: 1rem; }
    .dashboard-columns { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .dashboard-columns > .dashboard-column { display: contents; }
    .dashboard-columns > .dashboard-column > .quick-actions { order: 1; }
    .dashboard-columns > .dashboard-column > .daily-progress { order: 2; }
    .dashboard-columns > .dashboard-column > .daily-log-section { order: 3; }
    .dashboard-columns > .dashboard-column > .water-section { order: 6; }
    .dashboard-columns > .dashboard-column > .exercise-section { order: 4; }
    .dashboard-columns > .dashboard-column > .weight-section { order: 5; }
    .dashboard-columns > .dashboard-column > .profile-section { order: 7; }
    .overview-panel, .journal-panel { padding: 1rem; }
    .dashboard-columns .action-card { padding: .65rem; gap: .4rem; min-height: 82px; }
    .dashboard-columns .action-card strong { font-size: .95rem; }
    .meal-log-card .meal-type-title { font-size: .95rem; }
    .dashboard-columns .action-card small { font-size: .7rem; }
    .action-icon { width: 1.5rem; flex-basis: 1.5rem; font-size: 1.3rem; }
}


.water-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.water-heading h2 { color: var(--primary); font-size: calc(1.2rem - 1px); font-weight: 700; text-align: left; margin: 0; }
#waterList { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.water-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--border); color: var(--text); }
.water-card:last-child { border-bottom: 0; }
.water-card .meal-card-actions { flex-basis: auto; justify-content: flex-end; gap: .5rem; }
.water-section .daily-log-empty { grid-column: 1 / -1; }
.water-entry-time { color: var(--text-light); }
.water-entry-amount { color: var(--text); }
.water-modal { max-height: calc(100dvh - 2rem); overflow-y: auto; }
.water-modal [hidden] { display: none !important; }
.water-modal h3 { margin-bottom: 1rem; }
.water-modal fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.water-modal label { display: block; margin: .75rem 0 .3rem; }
.water-modal input, .water-modal select {
    display: block; width: 100%; min-width: 0; min-height: 44px; padding: .6rem;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit;
}
.water-modal small { display: block; font-size: .8rem; line-height: 1.5; color: var(--text-light); margin-top: .5rem; }
.water-modal button { min-height: 44px; margin-top: .75rem; }
.water-quick-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.water-quick-buttons button { padding: .7rem .25rem; font-size: 1rem; font-weight: 700; }
#waterQuickHint { color: var(--text-light); font-size: .85rem; line-height: 1.5; }
#waterError { color: var(--error); margin-top: .75rem; }
#waterProgressStatus, #waterStatus { margin-top: .6rem; }
@media (max-width: 768px) {
    #waterList { grid-template-columns: minmax(0, 1fr); }
    .water-modal { padding: 1.25rem; }
}

.journal-heading { display: flex; align-items: center; gap: .55rem; }
.journal-heading .action-icon { display: inline-flex; align-items: center; justify-content: center; }
.water-reference-note { display: block; margin-top: .3rem; font-size: .75rem; line-height: 1.4; color: var(--text-light); }
.weight-card { flex-wrap: wrap; gap: .25rem 1rem; background: var(--surface); color: var(--text); }
#weightChange { color: var(--text-light); font-size: .85rem; line-height: 1.5; }
.weight-history summary { cursor: pointer; min-height: 44px; padding: .75rem 0; color: var(--primary); font-size: .9rem; }
#weightError { color: var(--error); margin-top: .75rem; }
#weightStatus, #weightProgressStatus { margin-top: .6rem; }

/* Read-only statistics live in the dashboard's native modal top layer. */
.statistics-modal { width: calc(100% - 2rem); max-width: 1160px; height: min(900px, calc(100dvh - 2rem)); max-height: calc(100dvh - 2rem); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--background); box-shadow: var(--shadow); overflow: clip; }
.statistics-modal[open] { display: flex; flex-direction: column; }
.statistics-modal:not([open]), .statistics-modal [hidden] { display: none !important; }
.statistics-modal::backdrop { background: rgba(16, 31, 25, .65); }
.statistics-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; flex-shrink: 0; gap: .75rem; padding: 1rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.statistics-header h2 { display: flex; align-items: center; gap: .6rem; text-align: left; font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--primary); }
.statistics-title-icon { display: inline-block; width: 28px; height: 28px; flex: 0 0 28px; background: var(--primary); mask: url('/assets/statistics-flaticon.png') center / contain no-repeat; }
.statistics-header button, #statisticsRetry { width: auto; min-height: 44px; padding: .6rem .85rem; flex-shrink: 0; font-size: .85rem; }
.statistics-body { min-height: 0; padding: 1.25rem 1.5rem 1.5rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.statistics-period-row { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin: .25rem 0 0; }
.statistics-period-row label { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: .65rem; }
.statistics-period-row select { min-height: 48px; padding: .65rem .8rem; font: inherit; font-size: 1rem; color: var(--text); border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.statistics-period-row select:hover { border-color: var(--primary); }
.statistics-period-row select:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 2px; border-color: var(--primary); }
.statistics-note { font-size: .85rem; line-height: 1.6; color: var(--text-light); margin: .75rem 0; }
#statisticsLoading { padding: 2rem 0; color: var(--primary); font-weight: 600; }
#statisticsError { color: var(--error); margin: 1rem 0; }
.statistics-section { margin-top: 1.25rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.statistics-section:first-child { margin-top: 0; }
.statistics-section h3 { font-size: 1.2rem; color: var(--primary); margin-bottom: 1rem; }
.statistics-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: .75rem; margin: 1rem 0; }
.statistics-metrics > div { min-width: 0; border-radius: 12px; padding: .85rem; background: var(--background); }
.statistics-metrics dt { font-size: .75rem; line-height: 1.5; color: var(--text-light); }
.statistics-metrics dd { margin: .4rem 0 0; font-size: 1.1rem; line-height: 1.5; font-weight: 700; overflow-wrap: anywhere; }
.statistics-chart { margin: 1rem 0; min-width: 0; }
.statistics-chart h4 { color: var(--primary); font-size: .95rem; margin: 1rem 0 .6rem; }
.statistics-plot { width: 100%; min-width: 0; }
.statistics-plot svg { display: block; max-width: 100%; overflow: visible; }
.statistics-axis { fill: var(--text-light); font-size: 11px; }
.statistics-gridline { stroke: var(--border); stroke-width: 1; }
.statistics-reference { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 5 4; }
.statistics-chart-point { cursor: pointer; outline: none; }
.statistics-chart-point:focus-visible > :last-child { stroke: var(--text); stroke-width: 3; }
.statistics-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .75rem; line-height: 1.5; margin-top: .5rem; }
.statistics-legend > span { display: inline-flex; align-items: center; gap: .35rem; }
.statistics-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.statistics-tooltip { min-height: 3rem; font-size: .8rem; line-height: 1.5; color: var(--text); margin: .7rem 0; overflow-wrap: anywhere; }
.statistics-empty { padding: 1.5rem .75rem; text-align: center; font-size: .85rem; color: var(--text-light); background: var(--background); border-radius: 10px; }
.statistics-data-table summary { cursor: pointer; min-height: 44px; padding: .75rem 0; font-size: .85rem; color: var(--primary); }
.statistics-table-scroll { max-height: 300px; overflow: auto; }
.statistics-data-table table { border-collapse: collapse; width: 100%; font-size: .75rem; }
.statistics-data-table th, .statistics-data-table td { border-bottom: 1px solid var(--border); padding: .5rem .3rem; text-align: left; overflow-wrap: anywhere; }
.statistics-data-table thead th { color: var(--text); }
.statistics-data-table tbody th { font-weight: 400; }
.statistics-welcome { display: flex; align-items: flex-start; gap: 1rem; margin: 1.25rem 0 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.statistics-welcome-avatar { display: block; width: 64px; height: 64px; flex: 0 0 64px; object-fit: contain; }
.statistics-welcome-content { flex: 1; min-width: 0; }
.statistics-welcome-content h3 { margin: 0 0 .35rem; color: var(--primary); font-size: 1.05rem; }
.statistics-welcome-content > p { margin: .35rem 0 .65rem; line-height: 1.55; }
.statistics-coverage-message { font-weight: 700; }
.statistics-coverage-message.is-insufficient { color: #b42318; }
.statistics-coverage-list { margin: .45rem 0 0; padding-left: 1.15rem; color: var(--muted); font-size: .9em; line-height: 1.6; }
@media (max-width: 600px) {
    .statistics-modal { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
    .statistics-header { padding: 1rem; }
    .statistics-body { padding: 1.25rem 1rem 1rem; }
    .statistics-header h2 { font-size: 1.2rem; }
    .statistics-section { padding: .8rem; }
    .statistics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .statistics-metrics > div { padding: .6rem; }
    .statistics-metrics dd { font-size: .95rem; }
    .statistics-welcome { gap: .65rem; padding: .75rem; }
    .statistics-welcome-avatar { width: 48px; height: 48px; flex-basis: 48px; }
    .statistics-welcome-content h3 { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) {
    .statistics-modal, .statistics-modal * { scroll-behavior: auto; animation: none; transition: none; }
}

.statistics-goals { padding-left: 1.2rem; font-size: .85rem; line-height: 1.8; color: var(--text-light); margin: -.25rem 0 .75rem; }
.statistics-detail-date { display: block; font-weight: 700; margin-bottom: .4rem; }
.statistics-exercise-entries { padding-left: 1.2rem; line-height: 1.7; }
.statistics-exercise-entries li { margin-bottom: .35rem; }
.statistics-latest-weight { font-weight: 400; }
.statistics-latest-weight strong { font-weight: 700; }
.statistics-measurement-date { display: block; margin-top: .3rem; font-size: .85rem; font-weight: 400; color: var(--text-light); }

@media (min-width: 769px) {
    .statistics-section { font-size: calc(1rem + 2px); }
    .statistics-section h3 { font-size: calc(1.2rem + 2px); }
    .statistics-section .statistics-chart h4 { font-size: calc(.95rem + 2px); }
    .statistics-section .statistics-metrics dt,
    .statistics-section .statistics-legend,
    .statistics-section .statistics-data-table table { font-size: calc(.75rem + 2px); }
    .statistics-section .statistics-note,
    .statistics-section .statistics-empty,
    .statistics-section .statistics-data-table summary,
    .statistics-section .statistics-goals,
    .statistics-section .statistics-measurement-date { font-size: calc(.85rem + 2px); }
    .statistics-section .statistics-tooltip { font-size: calc(.8rem + 2px); }
    .statistics-section .statistics-axis { font-size: 13px; }
}

.profile-modal { --profile-padding: 20px; position: fixed; inset: 0; margin: auto; height: fit-content; width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 24px); box-sizing: border-box; padding: var(--profile-padding); border: 0; border-radius: 18px; box-shadow: 10px 10px 24px rgb(128 128 128 / 55%); overflow-y: auto; }
.profile-modal::backdrop { background: rgb(0 0 0 / 35%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.profile-heading { display: flex; align-items: flex-start; justify-content: flex-end; gap: 12px; margin-bottom: 12px; }
.profile-fields legend { font-size: 15px; font-weight: 600; color: var(--primary); }
.profile-modal #closeProfile { width: auto; min-height: 44px; margin: -10px -4px 0 0; padding: 10px 4px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--primary); font-size: calc(.85rem + 1px); font-weight: 600; }
.profile-modal #closeProfile:hover { color: var(--primary); text-decoration: underline; }
.profile-modal #closeProfile:focus-visible { outline: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .25em; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; padding: 12px; border: 1px solid #ddd; }
.profile-fields label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.profile-field-label { font-size: calc(1em - 1px); }
.profile-fields input, .profile-fields select { width: 100%; min-width: 0; box-sizing: border-box; padding: 9px; font: inherit; }
.profile-fields select, .profile-fields select option { background-color: #edf7ee; color: var(--text); }
.profile-fields select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='20' viewBox='0 0 12 20'%3E%3Cpath d='m3 7 3-3 3 3M3 13l3 3 3-3' fill='none' stroke='%232E7D32' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
}
.profile-modal button { margin-block: 8px; }
.profile-modal table { width: 100%; border-collapse: collapse; }
.profile-modal th, .profile-modal td { text-align: left; padding: 7px 4px; border-bottom: 1px solid #ddd; }
.profile-table-scroll { overflow-x: auto; }
.profile-modal p { overflow-wrap: anywhere; }
#profileHelp { font-size: 12px; }
#profileConfirmLabel { display: flex; align-items: flex-start; gap: .5rem; margin-block: 12px; font-weight: 700; color: var(--meal-delete-color); }
#profileConfirm { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin: .15rem 0 0; }
#profileConfirmLabel span { min-width: 0; }
#profileConfirmLabel[hidden] { display: none; }
@media (max-width: 480px) {
    .profile-fields { grid-template-columns: 1fr; }
    .profile-modal { --profile-padding: 14px; }
    .profile-fields legend { font-size: 13px; }
    #profileHelp { font-size: 11px; }
    .dashboard-header { flex-wrap: wrap; }
}

.profile-summary[hidden] { display: none; }
.profile-summary dt { font-weight: 500; }
.profile-summary dd { min-width: 0; font-size: .85rem; text-align: right; overflow-wrap: anywhere; color: var(--text-light); }
.profile-edit-action { display: flex; justify-content: flex-end; margin-top: .75rem; }
.profile-edit-action a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--primary); text-decoration: none; }
.profile-edit-action a:hover { color: var(--primary-dark); }
@media (max-width: 768px) {
    .profile-edit-action a { font-size: 13px; }
    .profile-heading { position: sticky; top: calc(0px - var(--profile-padding)); z-index: 2; margin: calc(0px - var(--profile-padding)) calc(0px - var(--profile-padding)) 12px; padding: 0 var(--profile-padding); background: var(--surface); }
    .profile-modal #closeProfile { margin: 0; font-size: 12px; font-weight: 600; }
}

.profile-avatar-filter { position: absolute; pointer-events: none; }
.profile-avatar-icon { filter: url(#profileAvatarBlue); }
