﻿:root {
    --bg: #fdeaf2;
    --panel: #ffffff;
    --ink: #2a2a2a;
    --muted: #757575;
    --line: #ead2dc;
    --brand: #e85d9a;
    --brand-dark: #b63f72;
    --soft: #d7eadf;
    --warn: #ffb84d;
    --warn-ink: #8b6914;
    --danger: #7fae91;
}
:root[data-theme="male"] {
    --bg: #f3f8ff;
    --line: #dbeafe;
    --brand: #4f8ef7;
    --brand-dark: #2f6fe0;
    --soft: #e8f2ff;
}


* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background:
        linear-gradient(180deg, #fdeaf2 0%, #f8edf3 42%, #e3f1e8 100%);
    color: var(--ink);
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    width: min(100%, 720px);
    min-height: 100vh;
    margin: 0 auto;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 2px 10px;
}

.eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.current-user-badge {
    display: inline-block;
    margin-top: 5px;
    padding: 3px 8px;
    border: 1px solid rgba(127, 174, 145, 0.58);
    border-radius: 999px;
    background: #b8e8c6;
    color: #1f3f2c;
    font-size: 0.78rem;
    font-weight: 800;
}

.sync-status-badge {
    display: inline-block;
    margin-top: 5px;
    margin-left: 6px;
    padding: 3px 8px;
    border: 1px solid rgba(127, 174, 145, 0.44);
    border-radius: 999px;
    background: #eef7f2;
    color: #466356;
    font-size: 0.72rem;
    font-weight: 800;
}

.sync-status-badge.pending {
    background: #fff6d8;
    border-color: #e1bc56;
    color: #74540c;
}

.sync-status-badge.error {
    background: #ffe7ec;
    border-color: #ef8da0;
    color: #7e2031;
}

h2 {
    font-size: 1.85rem;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.icon-button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
    color: var(--brand-dark);
    font-size: 1.3rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.icon-button:hover {
    background: var(--soft);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.screen,
.chat-screen {
    display: grid;
    gap: 8px;
}

.chat-screen {
    align-content: start;
}

.hidden {
    display: none !important;
}

.google-login {
    padding: 20px 16px;
    text-align: center;
}

.login-divider {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    margin: 20px 0;
    position: relative;
}

.login-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 45%;
    height: 1px;
    background: var(--line);
}

.login-divider::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    width: 45%;
    height: 1px;
    background: var(--line);
}

.hero-panel {
    min-height: 190px;
    padding: 24px 18px;
    border-radius: 22px;
    background:
        linear-gradient(rgba(23, 35, 28, 0.18), rgba(23, 35, 28, 0.18)),
        radial-gradient(circle at 15% 20%, rgba(244, 106, 165, 0.38) 0 18%, transparent 19%),
        linear-gradient(135deg, #f7dceb, #75bf98);
    color: #111;
}

.hero-panel.compact {
    min-height: 145px;
}

.hero-panel h2 {
    max-width: 310px;
    margin-bottom: 12px;
}

.hero-panel p {
    max-width: 330px;
    line-height: 1.45;
}

.form-card,
.advisor-card,
.totals-panel article,
.voice-panel,
.medical-note {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-card {
    display: grid;
    gap: 15px;
    padding: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: #314138;
    font-weight: 600;
    font-size: 0.98rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    transition: all 0.2s ease;
}

input,
select {
    min-height: 50px;
    padding: 0 12px;
}

textarea {
    min-height: 48px;
    max-height: 132px;
    padding: 12px;
    resize: none;
}

input::placeholder,
textarea::placeholder {
    color: #b8b8b8;
    opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(255, 127, 127, 0.12);
    outline: none;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.primary-button {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: #111;
    font-weight: 700;
    transition: all 0.2s ease;
}

.primary-button:hover {
    box-shadow: 0 4px 12px rgba(255, 127, 127, 0.3);
    transform: translateY(-1px);
}

.small-button {
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
}

.warning {
    padding: 12px;
    border-radius: 8px;
    background: var(--warn);
    color: var(--warn-ink);
}

.warning strong {
    display: block;
    margin-bottom: 4px;
}

.warning p,
.medical-note,
.voice-panel p {
    line-height: 1.4;
}

.advisor-card {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.advisor-card p {
    color: var(--muted);
}

.target-summary {
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--brand-dark) !important;
    font-weight: 800;
}

.bmr-summary {
    background: #fff4cf;
    color: #674e08 !important;
}

.warning-summary {
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffe6e6;
    color: #b30000 !important;
    font-weight: 600;
}

.chat-screen {
    grid-template-rows: auto;
    min-height: calc(100vh - 86px);
}

.tab-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.tab-button {
    min-height: 36px;
    border: 1px solid rgba(127, 174, 145, 0.48);
    border-radius: 9px;
    background: rgba(228, 250, 235, 0.62);
    color: #294d36;
    font-weight: 700;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tab-button:hover:not(.active) {
    background: rgba(228, 250, 235, 0.82);
    color: var(--brand-dark);
}

.tab-button.active {
    background: var(--brand);
    color: #111;
    box-shadow: 0 2px 8px rgba(184, 63, 114, 0.24);
}

.tab-panel {
    display: grid;
    gap: 6px;
    min-height: 0;
    padding: 4px;
}

.daily-weight-reminder {
    order: 0;
    display: grid;
    gap: 2px;
    padding: 7px 9px;
    border: 1px solid rgba(179, 0, 0, 0.32);
    border-radius: 8px;
    background: #ffe6e6;
    color: #8f0000;
    font-size: 0.82rem;
    line-height: 1.18;
}

.daily-weight-reminder strong {
    font-size: 0.86rem;
}

.daily-weight-status {
    margin: 4px 0 0;
    color: #8f0000;
    font-size: 0.76rem;
    font-weight: 800;
}

.daily-weight-status.done {
    color: #1f7a3a;
}

.education-banner {
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(184, 63, 114, 0.28);
    border-radius: 10px;
    background: var(--soft);
}

.education-banner p {
    margin: 0;
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.9rem;
}

.education-banner-actions {
    display: flex;
    gap: 8px;
}

.education-banner-actions button {
    flex: 1 1 0;
    padding: 0 8px;
    font-size: 0.86rem;
}

.education-dismiss-button {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.18);
    color: var(--ink);
}

#chatTabPanel {
    display: flex;
    flex-direction: column;
    min-height: clamp(430px, calc(100dvh - 250px), 680px);
}

.totals-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.totals-panel article {
    padding: 12px;
}

.totals-panel span {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
}

.totals-panel strong {
    display: block;
    margin-top: 4px;
    font-size: 1.25rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}


.profile-card {
    padding: 14px;
    display: grid;
    gap: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #edf9f1 100%);
    border: 1px solid rgba(127, 174, 145, 0.48);
    border-radius: 14px;
}

.profile-card-header h3 {
    margin: 4px 0 0;
    font-size: 1.15rem;
}

.profile-sections {
    display: grid;
    gap: 14px;
}

.profile-sections h4 {
    margin: 0 0 8px;
    font-size: 0.92rem;
    color: var(--brand-dark);
}

.calculation-group-title {
    margin: 14px 0 6px;
    color: var(--brand-dark);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.15;
}

.profile-sections h4 + .calculation-group-title {
    margin-top: 0;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.profile-grid article,
.activity-summary {
    padding: 9px 10px;
    box-shadow: none;
    background: #eef9f2;
    border: 1px solid rgba(127, 174, 145, 0.42);
    border-radius: 10px;
}

.profile-grid span,
.activity-summary span {
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.2;
}

.profile-grid strong,
.activity-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 0.98rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.calc-note {
    display: block;
    margin-top: 3px;
    color: #5b7c6a;
    font-size: 0.68rem;
    font-style: normal;
    line-height: 1.12;
}

.activity-summary {
    margin-top: 8px;
}

.summary-edit-input,
.summary-edit-textarea {
    margin-top: 4px;
    min-height: 30px;
    padding: 2px 6px;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--ink);
    background: #fff;
    border: 1px solid rgba(127, 174, 145, 0.55);
    border-radius: 6px;
}

.summary-edit-textarea {
    min-height: 40px;
    max-height: 90px;
    padding: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    resize: none;
}

.weight-form {
    display: grid;
    grid-template-columns: 1fr 130px;
    gap: 8px;
    align-items: end;
    margin-top: 10px;
}

.primary-weight-form {
    grid-template-columns: auto minmax(88px, 140px) auto;
    align-items: center;
    margin-top: 0;
    padding: 4px 6px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: rgba(234, 248, 239, 0.78);
}

.primary-weight-form label {
    display: contents;
}

.primary-weight-form label span {
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 700;
}

.primary-weight-form input,
.primary-weight-form .small-button {
    min-height: 34px;
}

.primary-weight-form .small-button {
    padding: 0 10px;
    white-space: nowrap;
}

.hydration-panel,
.steps-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(220px, 0.62fr);
    gap: 8px;
    align-items: center;
}

.hydration-panel h4,
.steps-panel h4 {
    margin: 0;
    font-size: 0.92rem;
    color: var(--brand-dark);
    white-space: nowrap;
}

.water-form,
.steps-form {
    display: grid;
    grid-template-columns: auto minmax(82px, 1fr) auto;
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.water-form label,
.steps-form label {
    display: contents;
}

.water-form label span,
.steps-form label span {
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 700;
}

.water-form input,
.steps-form input,
.water-form .small-button,
.steps-form .small-button {
    min-height: 40px;
}

.water-form .small-button,
.steps-form .small-button {
    padding: 0 10px;
    white-space: nowrap;
}

.hydration-grid {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
}

.steps-grid {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
}

.hydration-grid article,
.steps-grid article {
    padding: 6px 7px;
}

.hydration-grid span,
.steps-grid span {
    font-size: 0.68rem;
}

.hydration-grid strong,
.steps-grid strong {
    margin-top: 2px;
    font-size: 0.86rem;
}

.steps-grid .calc-note {
    font-size: 0.6rem;
}

.hydration-note {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.calculations-grid {
    grid-template-columns: repeat(3, 1fr);
}

.main-calculations-grid {
    grid-template-columns: 1fr;
}

.main-calculations-grid article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content !important;
    align-items: baseline;
    column-gap: 14px;
    row-gap: 4px;
    min-height: 0;
    padding: 9px 11px;
}

.main-calculations-grid span {
    grid-column: 1;
    grid-row: 1;
    display: block;
    font-size: 1rem;
    line-height: 1.18;
    color: #33483c;
}

.main-calculations-grid strong {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    display: block;
    margin-top: 0;
    text-align: right;
    font-size: 1.22rem;
    line-height: 1.12;
    white-space: nowrap;
}

.main-calculations-grid .calc-note {
    grid-column: 1 / -1;
    margin-top: 0;
    font-size: 0.9rem;
    line-height: 1.25;
}

.weight-comment {
    margin: 8px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #2f3f37;
    font-size: 0.95rem;
    line-height: 1.35;
}

.weight-chart-card {
    margin: 8px 0 14px;
    padding: 10px;
    border: 1px solid rgba(127, 174, 145, 0.46);
    border-radius: 10px;
    background: #f5fbf7;
}

.weight-chart-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 6px;
}

.weight-chart-header span {
    color: var(--brand-dark);
    font-size: 0.9rem;
    font-weight: 800;
}

.weight-chart-header strong {
    color: #111;
    font-size: 0.86rem;
    text-align: right;
}

.weight-chart {
    min-height: 180px;
}

.weight-chart-empty {
    display: grid;
    min-height: 160px;
    place-items: center;
    color: var(--muted);
    font-size: 0.86rem;
    text-align: center;
}

.weight-chart-svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 240px;
}

.chart-axis {
    stroke: rgba(91, 124, 106, 0.42);
    stroke-width: 1;
}

.chart-label,
.chart-date-label {
    fill: #5b7c6a;
    font-size: 11px;
}

.chart-date-label {
    text-anchor: middle;
}

.weight-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.weight-path.daily {
    stroke: rgba(191, 63, 124, 0.36);
    stroke-width: 2;
}

.weight-path.average {
    stroke: #2f8f57;
    stroke-width: 3;
}

.weight-point {
    fill: #bf3f7c;
    stroke: #fff;
    stroke-width: 1.5;
}

.weight-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    color: #4f6658;
    font-size: 0.74rem;
}

.weight-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.daily {
    background: rgba(191, 63, 124, 0.5);
}

.legend-dot.average {
    background: #2f8f57;
}

.protein-goals {
    padding: 12px 14px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 8px 0;
}

.protein-goals h3 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: var(--brand-dark);
}

.protein-goals p {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: #666;
}

.meal-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.meal-breakdown article {
    background: #eef9f2;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    text-align: left;
    display: grid;
    gap: 10px;
}

.meal-goals {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.meal-goals h4 {
    margin: 0;
    font-size: 0.92rem;
    color: var(--brand-dark);
}

.meal-breakdown article h5 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--brand-dark);
}

.meal-breakdown article span {
    font-size: 0.72rem;
    color: #7f8790;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.meal-breakdown article strong {
    display: inline-block;
    font-size: 1.1rem;
    color: var(--brand-dark);
}

.meal-breakdown-metric {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.cost-panel {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #eaf5ee 100%);
    border: 1px solid rgba(127, 174, 145, 0.4);
    border-radius: 12px;
}

.subscription-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #fff0f6 100%);
    border: 1px solid rgba(232, 93, 154, 0.3);
    border-radius: 12px;
}

.subscription-panel h4 {
    margin: 0;
    font-size: 0.92rem;
    color: var(--brand-dark);
}

.privacy-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
}

.privacy-panel h4 {
    margin: 0;
    font-size: 0.92rem;
    color: var(--brand-dark);
}

.privacy-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.privacy-actions .small-button {
    flex: 1;
    min-width: 140px;
}

.danger-button {
    background: #d9534f !important;
    color: #fff !important;
}

.link-button {
    border: 0;
    background: none;
    padding: 0;
    color: var(--brand-dark);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.cookie-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 1000;
    background: #222;
    color: #fff;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.cookie-banner p {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.cookie-banner-actions {
    display: flex;
    gap: 10px;
}

.cookie-banner-actions .small-button {
    flex: 1;
}

.cost-panel h4 {
    margin: 0;
    font-size: 0.92rem;
    color: var(--brand-dark);
}

.cost-panel .calculations-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#costLastModel {
    font-size: 0.82rem;
    line-height: 1.08;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 220px;
    justify-content: flex-start;
    gap: 3px;
    overflow-y: auto;
    padding: 2px 0;
    order: 1;
}

.chat-date {
    align-self: center;
    padding: 4px 10px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.message {
    max-width: 96%;
    padding: 6px 9px;
    border-radius: 12px;
    line-height: 1.16;
    white-space: pre-wrap;
    animation: slideIn 0.2s ease;
}

.stable-message {
    animation: none !important;
    transition: none !important;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nutrition-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    margin: 2px 0;
    white-space: normal;
}

.nutrition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
    line-height: 1.02;
}

.nutrition-table caption {
    caption-side: top;
    padding: 3px 4px 2px;
    color: var(--brand-dark);
    font-weight: 800;
    text-align: left;
}

.nutrition-table th,
.nutrition-table td {
    padding: 1px 4px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.nutrition-table th {
    background: #eeeeee;
    color: var(--brand-dark);
}

.cell-split {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.cell-label {
    text-align: left;
}

.cell-value {
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
}

.nutrition-table td:nth-child(2),
.nutrition-table td:nth-child(3),
.nutrition-table td:nth-child(4),
.nutrition-table th:nth-child(2),
.nutrition-table th:nth-child(3),
.nutrition-table th:nth-child(4) {
    text-align: right;
}

.daily-food-table td:nth-child(2),
.daily-food-table th:nth-child(2) {
    text-align: left;
}

.daily-food-table td:nth-child(1),
.daily-food-table th:nth-child(1) {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    padding-left: 2px;
    padding-right: 2px;
    white-space: nowrap;
}

.daily-food-table td:nth-child(3),
.daily-food-table td:nth-child(4),
.daily-food-table th:nth-child(3),
.daily-food-table th:nth-child(4) {
    text-align: right;
}

.daily-food-table td:nth-child(3),
.daily-food-table td:nth-child(4),
.daily-food-table th:nth-child(3),
.daily-food-table th:nth-child(4) {
    white-space: nowrap;
}

.daily-food-table td:nth-child(5),
.daily-food-table th:nth-child(5) {
    text-align: center;
    width: 24px;
    min-width: 24px;
}

.delete-food-row-button {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    border: 1px solid rgba(173, 84, 84, 0.38);
    border-radius: 6px;
    background: #fff;
    color: #8e3636;
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.delete-food-row-button:hover {
    border-color: rgba(173, 84, 84, 0.7);
    background: #fdecec;
}

.nutrition-table tbody tr:last-child {
    background: #f1f1f1;
}

.nutrition-table tbody tr:last-child td {
    border-color: #d9d9d9;
}

.meal-comment {
    margin-top: 3px;
    font-size: 0.86rem;
    line-height: 1.18;
    font-weight: normal !important;
}

.meal-comment span {
    display: inline;
    font-weight: normal !important;
}

.comment-warning {
    color: #b30000;
    font-weight: normal !important;
}

.comment-positive {
    color: #1f7a3a;
    font-weight: normal !important;
}

.comment-neutral {
    color: var(--ink);
    font-weight: normal !important;
}

.message.bot {
    align-self: flex-start;
    width: 100%;
    border-bottom-left-radius: 4px;
    background: #fffdfd;
    border: 1px solid rgba(127, 174, 145, 0.52);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.meal-draft-title {
    margin-bottom: 6px;
    font-size: 0.92rem;
    font-weight: 600;
}

.meal-draft-message {
    max-height: min(360px, 45dvh);
    overflow-y: auto;
    will-change: auto;
}

.meal-draft-list {
    display: grid;
    gap: 4px;
    margin: 0;
    padding-left: 20px;
    font-size: 0.84rem;
    line-height: 1.18;
}

.meal-draft-list li {
    overflow-wrap: anywhere;
    word-break: normal;
    text-align: left;
}

.meal-draft-hint {
    margin-top: 8px;
    font-size: 0.88rem;
    line-height: 1.2;
}

.message.user {
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    background: var(--brand);
    color: #111;
    box-shadow: 0 2px 8px rgba(184, 63, 114, 0.24);
    padding-top: 6px;
    padding-bottom: 6px;
}

.meal-analysis-message {
    font-size: 0.86rem;
    line-height: 1.16;
}

.welcome-message {
    font-size: 0.72rem;
    line-height: 1.12;
    padding-top: 4px;
    padding-bottom: 4px;
}

.message.loading {
    color: var(--muted);
}

.voice-panel {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 6px;
    align-items: flex-start;
    padding: 6px 8px;
    border-color: var(--line);
}

.voice-panel strong {
    display: block;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.1;
}

.voice-panel p {
    margin: 2px 0 0 0;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.15;
}

.mic-button {
    width: 52px;
    height: 52px;
    min-height: 52px;
    border: 0;
    border-radius: 8px;
    background: #ff9a4d;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(255, 154, 77, 0.3);
    transition: all 0.2s ease;
    cursor: pointer;
}

.mic-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 154, 77, 0.4);
}

.mic-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-button.recording {
    width: 58px;
    background: var(--danger);
    animation: recordingPulse 1.2s ease-in-out infinite;
    box-shadow: 0 4px 12px rgba(127, 174, 145, 0.34);
}

.mic-recording-label {
    display: none;
    color: #111;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.mic-button.recording .mic-icon-badge {
    display: none;
}

.mic-button.recording .mic-recording-label {
    display: inline;
}

@keyframes recordingPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(127, 174, 145, 0.34);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 6px 16px rgba(127, 174, 145, 0.44);
    }
}

.mic-button.disabled {
    background: #aeb9b2;
    box-shadow: none;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr 54px;
    gap: 8px;
    align-items: start;
    padding: 8px;
    border: 2px solid rgba(127, 174, 145, 0.58);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #d7eadf 100%);
    order: 3;
    margin-top: auto;
}

.chat-form textarea {
    min-height: 76px;
    font-size: 0.95rem;
}

.chat-actions {
    display: grid;
    grid-template-rows: 52px;
    gap: 8px;
    align-content: start;
}

.action-icon {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.mic-glyph {
    width: 18px;
    height: 18px;
    color: var(--ink);
}

.medical-note {
    padding: 0;
    margin: 4px 0 0;
    align-self: start;
    color: #5b7c6a;
    background: linear-gradient(90deg, rgba(127, 174, 145, 0.18), rgba(232, 93, 154, 0.06));
    padding: 6px 8px;
    border-radius: 8px;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    font-size: 0.65rem;
    line-height: 1.2;
    order: 99;
}

.voice-status {
    order: 2;
}

.daily-summary-bottom {
    order: 4;
    margin-top: 4px;
}

.daily-summary-bottom .nutrition-table-wrap {
    margin: 0;
}

.daily-summary-bottom .nutrition-table caption {
    padding-top: 0;
}

.toast {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 18px;
    max-width: 430px;
    margin: 0 auto;
    padding: 12px 14px;
    border-radius: 10px;
    background: #eaf5ee;
    color: #111;
    text-align: center;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

@media (max-width: 760px) {
    .meal-breakdown {
        grid-template-columns: 1fr;
    }

    .hydration-panel,
    .steps-panel {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .water-form,
    .steps-form {
        grid-column: 1 / -1;
        grid-template-columns: auto minmax(80px, 1fr) auto;
    }
}


@media (max-width: 370px) {
    .field-grid,
    .totals-panel,
    .primary-weight-form,
    .hydration-panel,
    .steps-panel,
    .water-form,
    .steps-form,
    .chat-form,
    .voice-panel,
    .chat-actions {
        grid-template-columns: 1fr;
    }

    .chat-actions {
        grid-template-rows: auto;
    }

    .mic-button {
        width: 100%;
        border-radius: 8px;
    }
}







.last-weight-edit-row {
    align-items: center !important;
}

.last-weight-edit {
    grid-column: 2;
    display: grid;
    grid-template-columns: minmax(82px, 1fr) auto;
    gap: 6px;
    align-items: center;
    justify-self: end;
    max-width: 230px;
}

.last-weight-edit .summary-edit-input {
    width: 100%;
    min-width: 82px;
    text-align: right;
}

.compact-button {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    white-space: nowrap;
}
