.chat {
    display: flex;
    flex-direction: column;
    height: clamp(420px, calc(100dvh - 330px), 760px);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    overflow: hidden;
}

.messages {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.msg {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(640px, 88%);
}

.msg.user {
    align-self: flex-end;
    align-items: flex-end;
}

.msg.assistant {
    align-self: flex-start;
}

.bubble {
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--accent-soft);
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.msg.user .bubble {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg.assistant .bubble {
    border-bottom-left-radius: 4px;
}

.bubble p {
    margin: 0;
}

.bubble p + p {
    margin-top: 8px;
}

.recipe-card {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    background: var(--surface);
}

.recipe-card strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: 400;
}

.recipe-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.chat-empty {
    margin: auto;
    max-width: 420px;
    text-align: center;
}

.chat-empty h2 {
    margin: 0 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
}

.suggestions {
    padding: 0 20px 12px;
}

.suggestions[hidden] {
    display: none;
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
}

.composer textarea {
    flex: 1;
    width: auto;
    margin: 0;
    min-height: 44px;
    padding-top: 11px;
    padding-bottom: 11px;
    min-width: 0;
    max-height: 160px;
    resize: none;
    overflow-y: auto;
    font: inherit;
}

.recipe-body h3,
.fact-list h3 {
    margin: 16px 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.recipe-body .ingredients {
    margin: 0;
    padding-left: 20px;
}

.recipe-body .step {
    margin: 0 0 8px;
}

.recipe-body > .btn {
    margin-top: 12px;
}

.fact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
}

.fact-text {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.art-unvertraeglichkeit {
    background: #f6dcd8;
    color: #7a2a20;
}

.fact-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}

.fact-form input,
.fact-form .btn {
    grid-column: 1 / -1;
}

@media (max-width: 700px) {
    .chat {
        height: calc(100dvh - 300px);
        min-height: 380px;
    }

    .messages {
        padding: 14px;
    }

    .msg {
        max-width: 94%;
    }
}

.badge {
    flex: none;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent);
    font-size: 12px;
}

.ingredients {
    margin: 0;
}

.meal-remove {
    flex: none;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
}

.head-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.composer .btn {
    min-height: 44px;
    padding-inline: 20px;
}

.recipe-card {
    min-width: min(260px, 100%);
    border-radius: 14px;
}

.suggestions {
    padding-top: 4px;
}

.saver-banner {
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--ink);
    font-size: 13px;
}

/* Tabs Rezepte · Gym: beide Chats teilen das Layout; versteckte Tabs wirklich ausblenden (.chat setzt display) */
.chat[hidden] {
    display: none;
}

.chat-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}

.chat-tools .hint {
    margin: 0;
}

.chat-tools .btn {
    margin-left: auto;
}

.gb-person {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.gb-person-option {
    padding: 5px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.gb-person-option[aria-checked="true"] {
    background: var(--accent);
    color: var(--surface);
}

.gb-person-option:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.gb-gym-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.plan-body {
    display: grid;
    gap: 6px;
}

.plan-body .list-caption {
    margin-top: 10px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

.gb-exercise {
    padding: 8px 14px;
}

.gb-exercise-text {
    display: grid;
    min-width: 0;
}

.gb-exercise-text small {
    color: var(--muted);
    font-size: 12px;
}

.gb-exercise-target {
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gb-plan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

/* Profil: Bereiche Küche/Gym als Tabs (eigener Kontext je Chat) */
.fact-tabs {
    margin: 4px 0 8px;
}

.fact-area-hint {
    margin: 0 0 6px;
}

.fact-person {
    margin: 10px 0 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
