/* ======================================
   VARIABILI E RESET
   ====================================== */

:root {
    --background: #EFF6FF;
    --card: #FFFFFF;
    --text: #1E293B;
    --secondary-text: #64748B;
    --border: #DBEAFE;
}

@media (prefers-color-scheme: dark) {
    /* "Chiara" forzata dalle impostazioni vince anche se il sistema è scuro */
    :root:not([data-theme="light"]) {
        --background: #0F172A;
        --card: #1E293B;
        --text: #F8FAFC;
        --secondary-text: #CBD5E1;
    }
}

/* "Scura" forzata dalle impostazioni: vince anche se il sistema è chiaro */
:root[data-theme="dark"] {
    --background: #0F172A;
    --card: #1E293B;
    --text: #F8FAFC;
    --secondary-text: #CBD5E1;
}

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

/* Garantisce che l'attributo hidden nasconda sempre l'elemento,
   anche quando una regola più specifica imposta un suo display */
[hidden] {
    display: none !important;
}

body {
    background: var(--background);
    font-family: 'Inter', sans-serif;
    color: var(--text);
}

/* ======================================
   LAYOUT GENERALE
   ====================================== */

.container {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.weekday {
    color: var(--secondary-text);
    font-size: 18px;
}

h1 {
    font-size: 34px;
    margin-top: 5px;
}

.date-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-display-toggle {
    cursor: pointer;
    border-radius: 12px;
    transition: transform 0.15s ease;
}

.date-display-toggle:active {
    transform: scale(0.97);
}

.back-to-today-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--card);
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, .05);
    transition: transform 0.15s ease;
}

.back-to-today-btn:active {
    transform: scale(0.9);
}

.welcome {
    color: var(--text);
    background: var(--card);
    padding: 12px 18px;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, .05);
    font-weight: 600;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

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

.home-button {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--card);
    box-shadow: 0 8px 25px rgba(0, 0, 0, .05);
    font-size: 16px;
    text-decoration: none;
    transition: transform 0.15s ease;
}

.home-button:active {
    transform: scale(0.9);
}

.profile-menu-wrapper {
    position: relative;
}

#profile-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    transition: transform 0.15s ease;
}

#profile-toggle:active {
    transform: scale(0.97);
}

.profile-caret {
    font-size: 11px;
    color: var(--secondary-text);
    transition: transform 0.15s ease;
}

#profile-toggle[aria-expanded="true"] .profile-caret {
    transform: rotate(180deg);
}

.profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 10;
}


.profile-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.profile-menu a:active {
    transform: scale(0.97);
}

.profile-menu a:hover {
    background: var(--background);
}

.profile-reminder {
    background: #FEF3C7;
    color: #92400E;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
    line-height: 1.5;
}

.profile-reminder a {
    display: inline-block;
    margin-left: 4px;
    color: #92400E;
    font-weight: 700;
    text-decoration: underline;
}

/* ======================================
   CARD GENERICA
   ====================================== */

.card {
    background: var(--card);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 15px;
    width: 100%;
    font-size: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
}

.card:not(.total-card) {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card:hover {
    transform: translateY(-3px);
}

/* ======================================
   CARD TOTALE KCAL
   ====================================== */

.total-card {
    background: #3B82F6;
    color: white;
    text-align: center;
}

/* La scheda giornaliera riusa lo schema apri/chiudi delle card pasto,
   ma su sfondo blu: qui si adattano i colori per restare leggibili */
#daily-summary-card .arrow {
    border-color: white;
}

#daily-summary-card .meal-name {
    color: white;
}

#daily-summary-card .meal-content {
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

#daily-summary-card .nutrient-name {
    color: rgba(255, 255, 255, 0.85);
}

#daily-summary-card .nutrient-value {
    color: white;
}

#daily-summary-card .meal-entries-toggle {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

#daily-summary-card .micronutrient-name {
    color: white;
}

#daily-summary-card .micronutrient-value {
    color: rgba(255, 255, 255, 0.85);
}

#daily-summary-card .micronutrient-bar {
    background: rgba(255, 255, 255, 0.25);
}

#daily-summary-card .micronutrient-bar-fill {
    background: white;
}

#daily-summary-card .micronutrient-breakdown-arrow {
    color: rgba(255, 255, 255, 0.85);
}

#daily-summary-card .micronutrient-breakdown {
    background: rgba(255, 255, 255, 0.12);
}

#daily-summary-card .micronutrient-breakdown-item {
    color: rgba(255, 255, 255, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

#daily-summary-card .micronutrient-breakdown-item span:first-child {
    color: white;
}

#daily-summary-card .micronutrient-breakdown-empty {
    color: rgba(255, 255, 255, 0.7);
}

.calorie-progress {
    width: 100%;
    height: 60px;
    background: #2563EB;
    border-radius: 30px;
    overflow: hidden;
    margin-top: 20px;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: #22C55E;
    border-radius: 30px;
    transition: 0.5s;
}

.calorie-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.water-stat {
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* ======================================
   CARD PASTI - LAYOUT VERTICALE
   ====================================== */

.card.meal-card {
    display: block;
    width: 100%;
    text-align: center;
}

/* Intestazione del pasto */
.card.meal-card .meal-header {
    width: 100%;
    min-height: 50px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Nome del pasto */
.card.meal-card .meal-name {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.meal-header-kcal {
    font-size: 13px;
    font-weight: 500;
    color: var(--secondary-text);
}

/* Freccia */
.card.meal-card .arrow {
    position: absolute;
    left: 22px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--text);
    border-bottom: 2px solid var(--text);
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.3s ease;
}

/* Rotazione freccia quando la card è aperta */
.card.meal-card.open .arrow {
    transform: translateY(-40%) rotate(225deg);
}

/* Barra che mostra quanto il pasto ha già coperto della sua quota ideale
   del fabbisogno giornaliero — sempre visibile, anche a card chiusa */
.card.meal-card .meal-target-bar {
    width: 100%;
    height: 5px;
    margin-top: 12px;
    background: rgba(100, 116, 139, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.card.meal-card .meal-target-bar-fill {
    width: 0%;
    height: 100%;
    border-radius: 3px;
    background: #22C55E;
    transition: width 0.4s ease, background 0.3s ease;
}

/* Contenuto nascosto */
.card.meal-card .meal-content {
    display: none;
    width: 100%;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(100, 116, 139, 0.2);
}

/* Contenuto quando la card è aperta */
.card.meal-card.open .meal-content {
    display: block;
}

/* Singolo nutriente */
.card.meal-card .nutrient {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.card.meal-card .nutrient-name {
    font-size: 15px;
    color: var(--secondary-text);
    margin-bottom: 4px;
}

.card.meal-card .nutrient-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

/* ======================================
   SCHEDA MICRONUTRIENTI
   ====================================== */

.micronutrient-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
    margin-top: 12px;
}

.micronutrient-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 13px;
}

.micronutrient-name {
    color: var(--text);
    font-weight: 600;
}

.micronutrient-value {
    color: var(--secondary-text);
}

.micronutrient-bar {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--background);
    overflow: hidden;
}

.micronutrient-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: #3B82F6;
    transition: width 0.4s ease;
}

.micronutrient-row-top-clickable {
    cursor: pointer;
}

.micronutrient-breakdown-arrow {
    font-size: 10px;
    color: var(--secondary-text);
    margin-left: 6px;
    transition: transform 0.15s ease;
}

.micronutrient-row.expanded .micronutrient-breakdown-arrow {
    transform: rotate(180deg);
}

.micronutrient-breakdown {
    margin-top: 8px;
    padding: 4px 10px;
    border-radius: 10px;
    background: rgba(100, 116, 139, 0.08);
}

.micronutrient-breakdown-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    font-size: 12px;
    color: var(--secondary-text);
}

.micronutrient-breakdown-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.micronutrient-breakdown-item span:first-child {
    color: var(--text);
}

.micronutrient-breakdown-empty {
    padding: 8px 0;
    font-size: 12px;
    color: var(--secondary-text);
    text-align: center;
}

/* ======================================
   ELENCO ALIMENTI INSERITI (per pasto)
   ====================================== */

.meal-entries-toggle {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: var(--background);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.meal-entries-toggle:active {
    transform: scale(0.97);
}

.card.meal-card.skipped {
    opacity: 0.6;
}

.meal-skip-button:active {
    transform: scale(0.97);
}

.meal-entries-list {
    width: 100%;
    margin-top: 12px;
    text-align: left;
}

.meal-entry-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.meal-entry-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.meal-entry-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meal-entry-details {
    font-size: 12px;
    color: var(--secondary-text);
}

.meal-entry-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.meal-entry-actions button {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: var(--background);
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.15s ease;
}

.meal-entry-actions button:active {
    transform: scale(0.9);
}

.meal-entry-edit-form {
    padding: 14px;
    margin: 8px 0;
    border-radius: 12px;
    background: var(--background);
}

.meal-entry-detail {
    padding: 14px;
    margin: 8px 0;
    border-radius: 12px;
    background: var(--background);
}

.meal-entry-edit-form .food-quantity-wrapper {
    width: 100%;
    margin: 0 0 10px 0;
}

.meal-entry-edit-form label {
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--secondary-text);
    margin-bottom: 4px;
}

/* ======================================
   PULSANTE AGGIUNGI ALIMENTO
   ====================================== */

.card.meal-card .add-food-button {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(59, 130, 246, 0.25);
    background: #E8F1FF;
    color: #2563EB;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.add-food-button:hover {
    background: #DCEBFF;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.16);
}

.card.meal-card .add-food-button:active {
    transform: translateY(-50%) scale(0.88);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* ======================================
   PANNELLO AGGIUNGI ALIMENTO
   ====================================== */

.food-search-container {
    width: 100%;
    margin: 8px 0 14px 0;
}

/* Riepilogo fabbisogno (profilo) */
.profile-recap-header {
    padding: 18px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}

.profile-recap-content {
    padding: 0 18px 18px;
}

.profile-recap-row {
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.profile-recap-row-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 14px;
    color: var(--text);
}

.profile-recap-row-label {
    font-weight: 600;
}

.profile-recap-row-value {
    font-weight: 500;
    font-size: 15px;
    color: var(--secondary-text);
}

.profile-recap-row-strong .profile-recap-row-label,
.profile-recap-row-strong .profile-recap-row-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

/* Macro e acqua: come prima, nome a sinistra e valore a destra sulla stessa riga */
.profile-recap-row-top--inline {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
}

.profile-recap-row-top--inline .profile-recap-row-label {
    font-weight: 400;
}

.profile-recap-row-top--inline .profile-recap-row-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    white-space: nowrap;
}

.profile-recap-row-note {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--secondary-text);
    line-height: 1.4;
}

.profile-bmi-track {
    position: relative;
    display: flex;
    height: 10px;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
}

.profile-bmi-marker {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 16px;
    margin-left: -2px;
    border-radius: 2px;
    background: var(--text);
    box-shadow: 0 0 0 2px var(--card);
}

.profile-recap-macro {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 2px solid var(--border);
}

.profile-recap-footnote {
    margin: 14px 0 0;
    font-size: 11px;
    color: var(--secondary-text);
    text-align: center;
}

/* Sezione Peso */
.profile-weight-current {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 16px;
}

.profile-weight-entry-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.profile-weight-entry-row .food-quantity-wrapper {
    flex: 1;
    min-width: 100px;
    margin: 0;
}

.profile-weight-entry-row input[type="date"] {
    height: 52px;
    box-sizing: border-box;
    padding: 0 10px;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: var(--background);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

.profile-weight-entry-row .food-confirm-button {
    width: auto;
    margin: 0;
    padding: 0 20px;
    height: 52px;
    border-radius: 12px;
}

.weight-delete-button {
    color: #DC2626;
}

.profile-weight-history-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary-text);
    margin: 4px 0 6px;
}

/* Sezione Obiettivo / Misure corporee */
.profile-field-hint {
    font-size: 12px;
    color: var(--secondary-text);
    margin: -4px 0 14px;
    line-height: 1.4;
}

.profile-field-hint-inline {
    font-size: 12px;
    font-weight: 400;
    color: var(--secondary-text);
}

.profile-duration-row {
    display: flex;
    gap: 8px;
}

.profile-duration-row .food-quantity-wrapper {
    flex: 1;
    margin: 0;
}

.profile-duration-row .food-search-input-wrapper {
    flex: 1;
}

.profile-measurements-layout {
    display: flex;
    gap: 16px;
    align-items: center;
}

.profile-measurements-fields {
    flex: 1;
    min-width: 0;
}

.profile-measurements-image {
    flex: 0 0 110px;
}

@media (max-width: 480px) {
    .profile-measurements-layout {
        flex-direction: column;
        align-items: center;
    }

    .profile-measurements-image {
        flex: 0 0 auto;
        width: 130px;
        order: -1;
    }
}

.profile-bodyfat-result {
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
    text-align: center;
}

.food-search-panel {
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 22px;
    border-radius: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.food-search-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
}

.food-search-content {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.food-search-content label {
    display: block;
    text-align: center;
    margin-bottom: 7px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

/* Campo ricerca alimento */
.food-search-field {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 18px auto;
}

.food-search-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    box-sizing: border-box;
    padding: 0 16px;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: var(--background);
}

.food-search-input-wrapper input,
.food-search-input-wrapper select {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 16px;
    text-align: center;
}

.food-search-input-wrapper select {
    text-align-last: center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.food-search-input-wrapper--with-button {
    padding-right: 6px;
}

.food-search-input-wrapper--select {
    position: relative;
}

.food-search-input-wrapper--select select {
    padding-right: 18px;
}

.food-search-input-wrapper--select::after {
    content: "▾";
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text);
    font-size: 13px;
    pointer-events: none;
}

.food-search-input-wrapper--with-button input {
    text-align: left;
}

.food-search-submit-button {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: #3B82F6;
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.food-search-submit-button:active {
    transform: scale(0.92);
}

/* Campi quantità / valori nutrizionali */
.food-quantity-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 140px;
    margin: 0 auto 22px auto;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--background);
}

.food-quantity-wrapper input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    padding: 12px 0;
    font-size: 16px;
    text-align: center;
}

.food-quantity-wrapper input:disabled {
    color: var(--secondary-text);
    opacity: 0.7;
}

.food-quantity-wrapper span {
    color: var(--secondary-text);
    font-size: 14px;
}

.food-manual-link {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}

/* ======================================
   NOTIFICHE PASTI (pagina profilo)
   ====================================== */

.reminder-intro {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    margin-bottom: 16px;
}

.reminder-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.reminder-row:last-of-type {
    border-bottom: none;
}

.reminder-meal-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.reminder-toggle {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.reminder-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.reminder-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.reminder-toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.reminder-toggle input:checked + .reminder-toggle-slider {
    background: #3B82F6;
}

.reminder-toggle input:checked + .reminder-toggle-slider::before {
    transform: translateX(18px);
}

.reminder-toggle input:active + .reminder-toggle-slider::before {
    width: 22px;
}

.reminder-time-input {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    color: var(--text);
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    width: 92px;
}

.reminder-time-input:disabled {
    opacity: 0.4;
}

/* ======================================
   PAGINA IMPOSTAZIONI (accordion + tema)
   ====================================== */

.settings-section {
    background: var(--card);
    border-radius: 20px;
    margin-bottom: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
    overflow: hidden;
}

.settings-section-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.settings-section-header:active {
    transform: scale(0.98);
}

.settings-section-chevron {
    font-size: 12px;
    color: var(--secondary-text);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.settings-section.open .settings-section-chevron {
    transform: rotate(180deg);
}

/* Header con pulsante "fissa aperta" a fianco (usato in profile.html) */
.settings-section-header-row {
    display: flex;
    align-items: center;
}

.settings-section-header-row .settings-section-header {
    flex: 1;
}

.settings-section-pin-button {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    margin: 0 12px 0 -6px;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--secondary-text);
    font-size: 15px;
    cursor: pointer;
    opacity: 0.45;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.settings-section-pin-button:active {
    transform: scale(0.9);
}

.settings-section-pin-button.pinned {
    opacity: 1;
    background: #FEF3C7;
}

/* Spaziatura tra etichette e campi nelle sezioni a fisarmonica (profilo) */
.settings-section-content label {
    display: block;
    text-align: center;
    margin: 16px 0 7px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

.settings-section-content label:first-child {
    margin-top: 0;
}

.section-badge {
    display: inline-block;
    margin-left: 6px;
    color: #DC2626;
    font-weight: 700;
}

.settings-section-content {
    padding: 0 18px 20px;
}

.theme-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: var(--background);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.theme-option:active {
    transform: scale(0.96);
}

.theme-option.selected {
    border-color: #3B82F6;
    background: rgba(59, 130, 246, 0.1);
}

.theme-option-icon {
    font-size: 22px;
}

.micro-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    margin-bottom: 18px;
}

.micro-field label {
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--secondary-text);
    margin-bottom: 4px;
}

.micro-quantity-wrapper {
    width: 100%;
    margin: 0;
}

.food-manual-link a {
    color: var(--secondary-text);
    text-decoration: underline;
}

.food-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    box-sizing: border-box;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    padding: 8px;
    z-index: 20;
}

.food-suggestions-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--secondary-text);
    padding: 6px 8px 4px;
}

.food-suggestions-loading,
.food-suggestions-empty {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    padding: 12px 0;
}

.quantity-mode-toggle {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 14px;
}

.cooking-state-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.cooking-state-label {
    font-size: 13px;
    color: var(--secondary-text);
}

.quantity-mode-btn {
    border: none;
    background: var(--background);
    color: var(--secondary-text);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.quantity-mode-btn.active {
    background: #3B82F6;
    color: white;
}

.quantity-mode-btn:active {
    transform: scale(0.95);
}

.portion-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.portion-note {
    text-align: center;
    font-size: 12px;
    color: var(--secondary-text);
    margin-bottom: 18px;
}

.stepper-btn {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--background);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.stepper-btn:active {
    transform: scale(0.9);
}

.sugar-suggestion {
    margin: 14px 0;
}

.sugar-title {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    margin-bottom: 6px;
}

.portion-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    min-width: 150px;
}

.food-result-total {
    white-space: pre-line; /* caffeina e alcol vanno a capo sulla riga sotto */
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.food-result-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--background);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.food-result-item:active {
    transform: scale(0.97);
}

.food-result-item-name {
    font-size: 14px;
    font-weight: 600;
    text-transform: capitalize;
}

.food-result-item-meta {
    font-size: 12px;
    color: var(--secondary-text);
}

.food-result-food-name {
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
    text-transform: capitalize;
}

.food-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
}

.food-result-grid div {
    background: var(--background);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.food-result-note {
    text-align: center;
    font-size: 12px;
    color: var(--secondary-text);
    margin-bottom: 18px;
}

/* Pulsanti azione (conferma / annulla) */
.food-search-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.food-search-actions button {
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.food-search-actions button:hover {
    filter: brightness(0.97);
}

.food-search-actions button:active {
    transform: scale(0.94);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.food-confirm-button {
    width: 150px;
    padding: 12px 20px;
    background: #DCFCE7;
    color: #16A34A;
    box-shadow: 0 2px 5px rgba(22, 163, 74, 0.12);
}

/* Pulsante Salva in fondo a ogni scheda del profilo: stesso stile di quello del peso, centrato */
.profile-section-save {
    display: block;
    width: auto;
    margin: 18px auto 0;
    padding: 0 28px;
    height: 52px;
    border-radius: 12px;
}

.profile-section-save,
.profile-weight-entry-row .food-confirm-button {
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.profile-section-save:active,
.profile-weight-entry-row .food-confirm-button:active {
    transform: scale(0.94);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* ✓ / ⚠️ accanto al titolo di una scheda del profilo */
.settings-section-status {
    margin-left: 6px;
    font-size: 15px;
}

.food-cancel-button {
    background: #FEE2E2;
    color: #DC2626;
    box-shadow: 0 2px 5px rgba(220, 38, 38, 0.12);
}

/* ======================================
   BANNER DI CONFERMA / ERRORE
   ====================================== */

.confirmation-banner,
.error-banner {
    display: none;
    text-align: center;
    margin-top: 14px;
    padding: 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.confirmation-banner.visible,
.error-banner.visible {
    display: block;
}

.confirmation-banner {
    background: #DCFCE7;
    color: #16A34A;
}

.error-banner {
    background: #FEE2E2;
    color: #DC2626;
}

/* ======================================
   CALENDARIO / CRONOLOGIA
   ====================================== */

.calendar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.calendar-popup {
    background: var(--card);
    border-radius: 20px;
    padding: 20px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
}

.calendar-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}

.calendar-nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--background);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.calendar-nav-btn:active {
    transform: scale(0.9);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 12px;
    color: var(--secondary-text);
    margin-bottom: 6px;
}

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

.calendar-day {
    aspect-ratio: 1;
    border: none;
    border-radius: 10px;
    background: var(--background);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.calendar-day:active {
    transform: scale(0.9);
}

.calendar-day.empty-slot {
    background: transparent;
    cursor: default;
}

.calendar-day.status-good {
    background: #22C55E;
    color: white;
}

.calendar-day.status-warn {
    background: #F59E0B;
    color: white;
}

.calendar-day.status-over {
    background: #EF4444;
    color: white;
}

.calendar-day.today {
    box-shadow: inset 0 0 0 2px #3B82F6;
}

.calendar-day.selected {
    box-shadow: inset 0 0 0 2px var(--text);
}

.calendar-day.today.selected {
    box-shadow: inset 0 0 0 2px var(--text), inset 0 0 0 4px #3B82F6;
}

.calendar-day.future:disabled {
    opacity: 0.35;
    cursor: default;
}

.calendar-today-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    border: none;
    border-radius: 14px;
    background: #3B82F6;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.calendar-today-btn:active {
    transform: scale(0.97);
}

/* ======================================
   PAGINA "I MIEI PIATTI"
   ====================================== */

.dish-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.dish-row:last-of-type {
    border-bottom: none;
}

.dish-row-info {
    flex: 1;
    min-width: 0;
}

.dish-row-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.dish-row-meta {
    font-size: 12px;
    color: var(--secondary-text);
    margin-top: 2px;
}

.dish-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.dish-section-label {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0 0 10px 0;
}

.community-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    max-width: 500px;
    margin: -10px auto 20px auto;
}

.dish-save-button {
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease, background 0.15s ease;
}

.dish-save-button:active {
    transform: scale(0.94);
}

.dish-save-button.saved {
    background: var(--background);
    color: var(--secondary-text);
    cursor: default;
}

/* ======================================
   COMMUNITY — feed scorrevole di ricette
   ====================================== */

.community-feed {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.community-card {
    width: 100%;
    box-sizing: border-box;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
    transition: transform 0.2s ease;
}

.community-card:hover {
    transform: translateY(-3px);
}

.community-card-top {
    position: relative;
    width: 100%;
    text-align: center;
    margin-bottom: 14px;
    padding: 0 24px;
    box-sizing: border-box;
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    color: inherit;
    transition: transform 0.15s ease;
}

.community-card-top:active {
    transform: scale(0.98);
}

.community-card-chevron {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--secondary-text);
    transition: transform 0.2s ease;
}

.community-card.open .community-card-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.community-card-ingredients {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.community-card-instructions-title {
    margin: 14px 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.community-card-instructions-text {
    font-size: 13px;
    color: var(--secondary-text);
    white-space: pre-line;
    line-height: 1.5;
}

.community-card-ingredients-empty {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
}

.community-card-per-portion {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    margin: 0 0 14px;
}

.community-recipe-stepper-label {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    margin: 0 0 4px;
}

.community-card-ingredients .portion-stepper {
    margin-bottom: 12px;
}

.community-card-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.community-card-kcal {
    text-align: center;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.community-card-author {
    font-size: 13px;
    color: var(--secondary-text);
    margin-top: 2px;
}

.community-card-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.community-card-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.community-card-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.community-card-stat-label {
    font-size: 11px;
    color: var(--secondary-text);
}

.community-card-portion {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    margin: 14px 0;
}

.community-card-save {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    background: #2563EB;
    color: white;
    transition: transform 0.15s ease, background 0.15s ease;
}

.community-card-save:active {
    transform: scale(0.96);
}

.community-card-save.saved {
    background: var(--background);
    color: var(--secondary-text);
    cursor: default;
}

.community-card-saved-count {
    margin-top: 10px;
    font-size: 14px;
    color: var(--secondary-text);
    text-align: center;
}

.community-card-remove {
    background: var(--background);
    color: var(--secondary-text);
    margin-top: 10px;
}

.icon-btn {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.icon-btn:active {
    transform: scale(0.9);
}

a.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* ======================================
   LISTA DELLA SPESA
   ====================================== */

.shopping-list-items {
    margin-top: 16px;
}

.shopping-list-row {
    gap: 12px;
}

.shopping-list-checkbox {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: #2563EB;
    cursor: pointer;
}

.shopping-list-item-checked {
    text-decoration: line-through;
    color: var(--secondary-text);
}

.dish-ingredient-pending {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}

.dish-ingredient-pending .food-quantity-wrapper {
    width: 100px;
    margin: 0;
}

.dish-ingredient-pending .cooking-state-toggle,
.dish-ingredient-pending .food-result-note {
    flex-basis: 100%;
    margin-bottom: 0;
}

.dish-ingredient-pending-name {
    font-size: 14px;
    font-weight: 600;
    text-transform: capitalize;
}

.dish-ingredients-list {
    margin-bottom: 10px;
}

.dish-ingredient-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.dish-ingredient-row:last-of-type {
    border-bottom: none;
}

.dish-ingredient-row-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dish-ingredient-row-quantity {
    width: 60px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    color: var(--text);
    padding: 6px;
    font-size: 14px;
    text-align: center;
    font-family: inherit;
}

.dish-ingredient-row-alcohol {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--secondary-text);
    white-space: nowrap;
    cursor: pointer;
}

.dish-summary {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    margin: 14px 0;
}

/* Lista allergeni nel profilo: nome a sinistra (va a capo se serve), toggle
   sempre allineato allo stesso bordo destro, come le righe dello storico.
   Selettore con lo stesso peso di ".settings-section-content label"
   (style.css:1262, che altrimenti vince e rimette tutto a blocco centrato) */
.settings-section-content label.profile-allergen-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    margin: 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-align: left;
}

.profile-allergen-row:last-child {
    border-bottom: none;
}

.profile-allergen-name {
    font-size: 14px;
    color: var(--text);
    flex: 1;
    text-align: left;
}

.dish-publish-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 18px;
    cursor: pointer;
}

.dish-instructions-textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 110px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: var(--background);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
}

.dish-instructions-ai-button {
    display: block;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 18px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: #EDE9FE;
    color: #7C3AED;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.dish-instructions-ai-button:active {
    transform: scale(0.97);
}

.dish-instructions-ai-button:disabled {
    opacity: 0.6;
    cursor: default;
}

.scan-label-button {
    display: block;
    width: 100%;
    margin: 0 0 16px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: #EDE9FE;
    color: #7C3AED;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.scan-label-button:active {
    transform: scale(0.97);
}

/* ======================================
   TRASCINA-PER-AGGIORNARE (PWA standalone)
   ====================================== */

.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    opacity: 0;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.pull-refresh-indicator.visible {
    opacity: 1;
}

.pull-refresh-indicator.ready {
    background: #2563EB;
    border-color: #2563EB;
}

/* ======================================
   GRAFICO ANDAMENTO PESO (home)
   ====================================== */

.card.weight-chart-card {
    display: block;
    text-align: left;
    cursor: default;
}

.weight-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.weight-chart-header .meal-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.weight-chart-empty {
    text-align: center;
    font-size: 13px;
    color: var(--secondary-text);
    padding: 10px 0;
}

.weight-chart-empty a {
    color: #2563EB;
    text-decoration: none;
    font-weight: 600;
}

/* ======================================
   SCHEDA ACQUA (home)
   ====================================== */

.card.water-card {
    display: block;
    text-align: center;
    cursor: default;
}

.water-card-total {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.water-card-glasses {
    font-size: 14px;
    color: var(--secondary-text);
    margin-bottom: 10px;
}

.water-progress-bar {
    height: 10px;
    margin-bottom: 14px;
}

.water-card .portion-stepper {
    margin-bottom: 0;
}

.weight-chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.weight-chart-grid-line {
    stroke: var(--border);
    stroke-width: 1;
}

.weight-chart-axis-label {
    font-size: 9px;
    fill: var(--secondary-text);
}

.weight-chart-area {
    fill: #2563EB;
    fill-opacity: 0.08;
    stroke: none;
}

.weight-chart-line {
    fill: none;
    stroke: #2563EB;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.weight-chart-point {
    fill: var(--card);
    stroke: #2563EB;
    stroke-width: 2;
    transition: fill 0.15s ease;
}

.weight-chart-point.active {
    fill: #2563EB;
}

.weight-chart-point-hit {
    fill: transparent;
    cursor: pointer;
}

.weight-chart-tooltip {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 8px 0 0;
    min-height: 18px;
}

.app-footer {
    text-align: center;
    font-size: 11px;
    color: var(--secondary-text);
    opacity: 0.6;
    padding: 24px 16px 16px;
}

.dish-servings-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 18px;
}

.dish-servings-row label {
    flex: 1;
    min-width: 160px;
}

.dish-servings-row input {
    width: 60px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    color: var(--text);
    padding: 6px;
    font-size: 14px;
    text-align: center;
    font-family: inherit;
}

.dish-portion-hint {
    flex-basis: 100%;
    font-size: 13px;
    color: var(--secondary-text);
}

.weight-reminder-frequency-select {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    color: var(--text);
    padding: 6px 10px;
    font-size: 14px;
    font-family: inherit;
}

.weight-reminder-frequency-select:disabled {
    opacity: 0.4;
}

/* ======================================
   RESPONSIVE
   ====================================== */

@media (max-width: 430px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 26px;
    }

    .welcome {
        padding: 10px 14px;
        font-size: 14px;
    }

    .card {
        padding: 16px;
    }
}

/* ======================================
   MODALE (avviso di sicurezza obiettivo/tempistica)
   ====================================== */

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

.modal-card {
    width: 100%;
    max-width: 380px;
    box-sizing: border-box;
    padding: 28px 24px;
    border-radius: 20px;
    background: var(--card);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.modal-card-icon {
    font-size: 34px;
    margin-bottom: 10px;
}

.modal-card-message {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    margin: 0 0 22px;
}

.modal-card .food-confirm-button {
    width: 100%;
}

.passkey-remove-button {
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: #FEE2E2;
    color: #DC2626;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.passkey-remove-button:active {
    transform: scale(0.95);
}

/* ======================================
   SUGGERIMENTI DELL'IA (per pasto)
   ====================================== */

.meal-suggestions {
    width: 100%;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text);
}

.meal-evaluation {
    width: 100%;
    margin-top: 12px;
    padding: 12px 14px;
    border: 2px solid #3B82F6;
    border-radius: 12px;
    text-align: left;
}

/* Sulla scheda blu il contorno azzurro sparirebbe */
#daily-summary-card .meal-evaluation {
    border-color: rgba(255, 255, 255, 0.75);
}

.meal-evaluation .suggestion-verdict {
    margin: 0;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
}

.confirm-dialog {
    width: 100%;
    max-width: 340px;
    padding: 22px 20px;
    border-radius: 16px;
    background: var(--card, #fff);
    color: var(--text);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.confirm-dialog p {
    margin: 0 0 18px;
    line-height: 1.4;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
}

.confirm-button {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.confirm-button:active {
    transform: scale(0.95);
}

.confirm-yes { background: #22C55E; }
.confirm-no { background: #EF4444; }
.confirm-neutral { background: #3B82F6; }

.suggestion-verdict {
    margin-bottom: 12px;
    line-height: 1.4;
}

.suggestion-option {
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--background);
}

.suggestion-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.suggestion-foods {
    margin: 0 0 6px;
    padding-left: 18px;
}

.suggestion-values {
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary-text);
    margin-bottom: 6px;
}

.suggestion-why {
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
}

.suggestion-note {
    font-size: 11px;
    color: var(--secondary-text);
    text-align: center;
    margin: 6px 0 0;
}

.suggestion-save-button {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: #2563EB;
    color: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.suggestion-save-button:active {
    transform: scale(0.97);
}

.suggestion-save-button:disabled {
    opacity: 0.6;
}

.suggestion-saved-note {
    margin: 10px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary-text);
    text-align: center;
}

.suggestion-saved-note a,
.suggestion-note--section a {
    color: #3B82F6;
    font-weight: 600;
}

.suggestion-note--section {
    margin-top: 16px;
}

.settings-section-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--secondary-text);
}

/* Scheda Caffeina (home): stessa base della scheda Acqua */
.caffeine-card-note {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text);
}

/* "Meno è meglio" nella scheda Alcol: a capo e più in evidenza della nota */
.alcohol-card-motto {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.caffeine-card-footnote {
    margin: 12px 0 0;
    font-size: 11px;
    color: var(--secondary-text);
}

/* ======================================
   ENCICLOPEDIA
   ====================================== */

.enc-body {
    margin-top: 4px;
    text-align: left;
}

.enc-section {
    margin-top: 16px;
}

.enc-section-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 700;
    color: #2563EB;
}

/* Blu più chiaro sullo sfondo scuro, per restare leggibile */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .enc-section-title {
        color: #60A5FA;
    }
}

:root[data-theme="dark"] .enc-section-title {
    color: #60A5FA;
}

.enc-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
}

.enc-compare {
    margin-top: 16px;
    padding: 14px;
    border-radius: 14px;
    background: var(--background);
    border: 1px solid var(--border);
}

.enc-compare-item + .enc-compare-item {
    margin-top: 12px;
}

.enc-compare-label {
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.enc-trick {
    margin: 14px 0 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--secondary-text);
}

.enc-list-items {
    margin: 0;
    padding-left: 20px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
}

.enc-source {
    margin: 16px 0 0 0;
    font-size: 12px;
    color: var(--secondary-text);
    text-align: right;
}

.enc-card.open .enc-body {
    animation: enc-apri 0.2s ease;
}

@keyframes enc-apri {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.enc-disclaimer {
    max-width: 600px;
    margin: 24px auto 0 auto;
    font-size: 12px;
    line-height: 1.5;
    color: var(--secondary-text);
    text-align: center;
}

/* "?" che rimanda alla voce dell'enciclopedia */
.enc-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.2);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    vertical-align: middle;
    transition: transform 0.15s ease;
}

/* Area sensibile più grande del cerchietto, per il tocco col dito */
.enc-help::after {
    content: "";
    position: absolute;
    inset: -8px;
}

.enc-help:active {
    transform: scale(0.9);
}

/* Sulla scheda blu delle kcal */
#daily-summary-card .enc-help {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Gruppi dell'enciclopedia (macronutrienti, micronutrienti) */
.enc-group {
    width: 100%;
    box-sizing: border-box;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
    overflow: hidden;
}

.enc-group-top {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.enc-group-top:active {
    transform: scale(0.98);
}

.enc-group-texts {
    flex: 1;
    min-width: 0;
}

.enc-group-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.enc-group-sub {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--secondary-text);
}

.enc-group-count {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--background);
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary-text);
}

.enc-group-chevron {
    flex-shrink: 0;
    font-size: 13px;
    color: var(--secondary-text);
    transition: transform 0.2s ease;
}

.enc-group.open .enc-group-chevron {
    transform: rotate(180deg);
}

.enc-group-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 12px 14px 12px;
}

/* Etichetta fissa dentro un gruppo (es. "Vitamine", "Minerali") */
.enc-group-label {
    margin: 4px 4px 0 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--secondary-text);
}

.enc-group-label:not(:first-child) {
    margin-top: 10px;
}
