/* Stili specifici della schermata Oggi */

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 23px;
    background: var(--brand);
    color: var(--brand-contrast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    text-decoration: none;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero {
    background: var(--brand);
    color: var(--brand-contrast);
    border-radius: 22px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
body.dark .hero {
    background: var(--surface-2);
    color: var(--text);
}
.hero-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.hero-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    opacity: 0.8;
}
.hero-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.hero-value span {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1;
}
.hero-value small {
    font-size: 15px;
    font-weight: 600;
    opacity: 0.8;
}
.hero-when {
    font-size: 13px;
    opacity: 0.8;
}
.hero-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.hero-badge {
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
}
.hero-badge.ok {
    background: var(--ok-soft);
    color: var(--ok-text);
}
.hero-badge.high {
    background: #ffd9a0;
    color: #5a3a00;
}
.hero-badge.low {
    background: #ffd2c4;
    color: #6e1d05;
}
.hero-trend svg {
    width: 40px;
    height: 40px;
}

/* Grafico del giorno (SVG generato in js/home.js) */
.chart svg {
    display: block;
    width: 100%;
    height: auto;
}
.chart .band {
    fill: var(--ok-soft);
}
.chart .limit {
    stroke: var(--ok);
    stroke-opacity: 0.45;
    stroke-dasharray: 4 4;
}
.chart .line {
    fill: none;
    stroke: var(--brand);
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.chart .meal {
    fill: var(--surface);
    stroke: var(--ok);
    stroke-width: 3;
}
.chart .point {
    fill: var(--brand);
}
.chart-axis {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
}
.chart-legend {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}
.chart-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-meal {
    width: 10px;
    height: 10px;
    border-radius: 5px;
    border: 2.5px solid var(--ok);
}
.legend-line {
    width: 14px;
    height: 3px;
    border-radius: 2px;
    background: var(--brand);
}

/* Insulina basale */
.basale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.basale .btn {
    min-height: 44px;
    flex-shrink: 0;
}

/* ===== Disposizione: una colonna su telefono, due su PC ===== */
.oggi-grid,
.oggi-grid .col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
@media (min-width: 1100px) {
    .oggi-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
        gap: 20px;
        align-items: start;
    }
    .oggi-grid .col {
        gap: 16px;
    }
    /* la colonna destra resta visibile mentre si scorre la lista */
    .oggi-grid .col:first-child {
        position: sticky;
        top: 28px;
    }
    .hero {
        padding: 26px 28px;
    }
    .hero-value span {
        font-size: 64px;
    }
}

/* tocco sull'ultimo valore: si aggiorna */
.hero { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 0.15s; }
.hero:active { transform: scale(0.985); }
.hero.in-aggiornamento .hero-value { animation: hero-pulsa 0.9s ease-in-out infinite; }
@keyframes hero-pulsa { 50% { opacity: 0.45; } }
