/* Font ospitati qui (niente Google Fonts: nessun dato degli utenti a terzi) — licenza SIL OFL */
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito.woff2") format("woff2"); font-weight: 200 1000; font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-ext.woff2") format("woff2"); font-weight: 200 1000; font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ============ Nido — tema allegro ============ */
:root {
    --bg: #fff6e9;
    --dots: rgba(255, 152, 120, .14);
    --ink: #33264d;
    --muted: #806f99;
    --card: #ffffff;
    --card-2: #fff9f2;
    --line: #f3e3d3;
    --press: #efd9c4;

    --peach: #ff9a76;
    --rose: #ff6f9f;
    --lilac: #a07bff;
    --sky: #4fb6ff;
    --mint: #3fd1a6;
    --sun: #ffc531;
    --grass: #8bd450;

    --present: #e3fbf1;
    --present-ink: #128a69;
    --off: #f2edf8;

    --radius: 28px;
    --font-head: "Fredoka", "Nunito", system-ui, sans-serif;
    --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #17123a;
        --dots: rgba(255, 255, 255, .06);
        --ink: #f6f0ff;
        --muted: #b3a7d6;
        --card: #241c55;
        --card-2: #2c2363;
        --line: #362c74;
        --press: #120d2e;
        --present: #17433f;
        --present-ink: #6ff0c8;
        --off: #2c2460;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #17123a;
    --dots: rgba(255, 255, 255, .06);
    --ink: #f6f0ff;
    --muted: #b3a7d6;
    --card: #241c55;
    --card-2: #2c2363;
    --line: #362c74;
    --press: #120d2e;
    --present: #17433f;
    --present-ink: #6ff0c8;
    --off: #2c2460;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background-color: var(--bg);
    background-image: radial-gradient(var(--dots) 2.5px, transparent 3px);
    background-size: 26px 26px;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.45;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; letter-spacing: .2px; }
a { color: var(--lilac); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* ---------- bolle colorate di sfondo ---------- */
.blobs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.blobs span {
    position: absolute; border-radius: 50%; filter: blur(60px); opacity: .45;
    animation: float 18s ease-in-out infinite alternate;
}
.blobs span:nth-child(1) { width: 420px; height: 420px; background: var(--peach); top: -120px; left: -100px; }
.blobs span:nth-child(2) { width: 360px; height: 360px; background: var(--sky); top: 30%; right: -140px; animation-delay: -6s; }
.blobs span:nth-child(3) { width: 380px; height: 380px; background: var(--sun); bottom: -160px; left: 25%; animation-delay: -12s; opacity: .35; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .blobs span { opacity: .25; }
    :root:not([data-theme="light"]) body {
        background-image:
            radial-gradient(1.5px 1.5px at 12% 18%, #fff8 50%, transparent 51%),
            radial-gradient(1.5px 1.5px at 72% 12%, #fff9 50%, transparent 51%),
            radial-gradient(2px 2px at 40% 60%, #fff7 50%, transparent 51%),
            radial-gradient(1.5px 1.5px at 88% 72%, #fff8 50%, transparent 51%),
            radial-gradient(var(--dots) 2.5px, transparent 3px);
        background-size: 420px 420px, 380px 380px, 520px 520px, 460px 460px, 26px 26px;
    }
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, 30px) scale(1.08); }
    100% { transform: translate(-30px, 50px) scale(.95); }
}

/* ---------- shell ---------- */
.shell { max-width: 1120px; margin: 0 auto; padding: 16px 16px 40px; padding-top: max(16px, env(safe-area-inset-top)); }

.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-logo {
    width: 46px; height: 46px; display: grid; place-items: center; font-size: 26px;
    background: linear-gradient(135deg, var(--sun), var(--peach)); border-radius: 16px;
    box-shadow: 0 4px 0 #e2863e; transform: rotate(-6deg); transition: transform .3s;
}
.brand:hover .brand-logo { transform: rotate(6deg) scale(1.08); }
.brand-name {
    font-family: var(--font-head); font-size: 1.7rem; font-weight: 700;
    background: linear-gradient(90deg, var(--rose), var(--peach), var(--sun), var(--mint), var(--sky), var(--lilac));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.live {
    display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800;
    color: var(--present-ink); background: var(--present); padding: 4px 10px; border-radius: 99px;
    text-transform: uppercase; letter-spacing: .6px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63, 209, 166, .6); } 100% { box-shadow: 0 0 0 10px rgba(63, 209, 166, 0); } }

.topnav { margin-left: auto; display: flex; gap: 8px; }
.pill-link {
    text-decoration: none; color: var(--ink); font-weight: 800; padding: 9px 14px; border-radius: 99px;
    background: var(--card); box-shadow: 0 4px 0 var(--line); transition: transform .15s;
}
.pill-link:hover { transform: translateY(-2px); }
.pill-link.active { background: var(--ink); color: var(--bg); box-shadow: 0 4px 0 var(--lilac); }

.foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 36px; }

/* ---------- card ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 2px solid var(--line);
    box-shadow: 0 8px 0 var(--line), 0 24px 50px -24px rgba(80, 40, 120, .25);
    padding: 22px;
    animation: pop-in .55s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- pulsanti caramella ---------- */
.btn {
    --c: var(--card-2); --s: var(--line);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: 18px; padding: 12px 20px; font-weight: 800; text-decoration: none;
    background: var(--c); color: var(--ink);
    box-shadow: 0 5px 0 var(--s);
    transition: transform .12s, box-shadow .12s, filter .2s;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--s); }
.btn-in { --c: linear-gradient(135deg, #5fe0b5, #2fbf95); --s: #1f8f6e; color: #fff; }
.btn-out { --c: linear-gradient(135deg, #ff9f80, #ff6f9f); --s: #d24a77; color: #fff; }
.btn-danger { --c: #ffe2e7; --s: #f3b6c2; color: #c02a4f; }
.btn-ghost { --c: var(--card-2); --s: var(--line); }
.btn-sm { padding: 8px 14px; font-size: .9rem; border-radius: 14px; }
.btn-big { font-size: 1.15rem; padding: 16px 26px; border-radius: 22px; font-family: var(--font-head); font-weight: 600; }
.btn-in, .btn-out { background: var(--c); }

/* ---------- hero di oggi ---------- */
.hero {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "main ring" "actions actions";
    gap: 18px 24px; padding: 28px;
}
.hero::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 8px;
    background: linear-gradient(90deg, var(--rose), var(--peach), var(--sun), var(--grass), var(--mint), var(--sky), var(--lilac));
}
.hero::after {
    content: "☁️"; position: absolute; font-size: 64px; opacity: .25; right: 210px; top: 6px;
    animation: drift 14s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(40px); } }

.hero-main { grid-area: main; display: flex; align-items: center; gap: 20px; min-width: 0; }
.avatar-wrap { position: relative; flex: none; }
.avatar {
    width: 96px; height: 96px; border-radius: 32px; display: grid; place-items: center; font-size: 56px;
    background: linear-gradient(135deg, #ffe7a3, #ffc2a8);
    box-shadow: 0 6px 0 #f2a97c, inset 0 -6px 0 rgba(0, 0, 0, .05);
    animation: bob 3s ease-in-out infinite;
}
.state-innido .avatar { background: linear-gradient(135deg, #b9f5de, #9fdcff); box-shadow: 0 6px 0 #6cc4b0; }
.state-absent .avatar { background: linear-gradient(135deg, #e6dcff, #ffd6e6); box-shadow: 0 6px 0 #c7b2f0; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.avatar-badge {
    position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
    background: var(--mint); color: #fff; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 99px;
    white-space: nowrap; box-shadow: 0 3px 0 #1f8f6e; text-transform: uppercase; letter-spacing: .5px;
}
.hero-text { min-width: 0; }
.eyebrow { font-weight: 800; color: var(--peach); text-transform: uppercase; font-size: .8rem; letter-spacing: 1px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.1; margin: 4px 0 6px; }
.hero .sub { margin: 0; color: var(--muted); font-weight: 600; }

.ring-wrap { grid-area: ring; position: relative; width: 168px; height: 168px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 12; }
.ring-fill { fill: none; stroke: url(#ringGrad); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-time { font-family: var(--font-head); font-weight: 700; font-size: 2rem; line-height: 1; }
.ring-time small { font-size: .9rem; color: var(--muted); margin: 0 2px; }
.ring-sec { font-weight: 800; color: var(--muted); font-size: .85rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ring-emoji { font-size: 54px; animation: bob 3s ease-in-out infinite; }
.state-innido .ring-wrap::after {
    content: ""; position: absolute; inset: 6px; border-radius: 50%;
    box-shadow: 0 0 40px rgba(255, 111, 159, .35); animation: glow 2.4s ease-in-out infinite; pointer-events: none;
}
@keyframes glow { 50% { opacity: .3; } }

.hero-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- interruttore pasto ---------- */
.meal-toggle {
    display: inline-flex; align-items: center; gap: 10px; border: 0; border-radius: 22px;
    padding: 10px 14px 10px 12px; font-weight: 800; background: var(--card-2);
    box-shadow: 0 5px 0 var(--line); transition: transform .12s, box-shadow .12s, background .3s;
}
.meal-toggle:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.meal-toggle.wide { width: 100%; justify-content: flex-start; margin-top: 14px; }
.meal-toggle.wide .switch { margin-left: auto; }
.plate { font-size: 1.6rem; filter: grayscale(1); opacity: .5; transition: .3s; }
.meal-toggle.on { background: #fff1c7; box-shadow: 0 5px 0 #f2c94c; color: #7a5200; }
.meal-toggle.on .plate { filter: none; opacity: 1; animation: yum .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes yum { 0% { transform: scale(.6) rotate(-20deg); } 60% { transform: scale(1.3) rotate(10deg); } 100% { transform: none; } }
.switch { width: 46px; height: 26px; border-radius: 99px; background: var(--line); position: relative; transition: .3s; flex: none; }
.knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: .35s cubic-bezier(.2, 1.5, .4, 1); }
.meal-toggle.on .switch { background: var(--sun); }
.meal-toggle.on .knob { left: 23px; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .meal-toggle.on { background: #4a3a12; color: #ffe08a; box-shadow: 0 5px 0 #2e2208; }
}

/* ---------- intestazione mese ---------- */
.month-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 34px 4px 16px; }
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-title { font-size: 2rem; min-width: 210px; text-align: center; animation: pop-in .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.month-title span { color: var(--muted); font-weight: 500; }
.nav-btn {
    width: 46px; height: 46px; border-radius: 16px; border: 0; font-size: 1.6rem; font-weight: 800; line-height: 1;
    background: var(--card); box-shadow: 0 5px 0 var(--line); transition: transform .12s, box-shadow .12s;
}
.nav-btn:hover { transform: translateY(-2px) rotate(-4deg); }
.nav-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.month-tools { display: flex; gap: 10px; }

/* ---------- statistiche ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat {
    position: relative; overflow: hidden; border-radius: 24px; padding: 18px 18px 16px;
    background: var(--card); border: 2px solid var(--line); box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 55%, transparent);
    animation: pop-in .6s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(var(--i) * 80ms);
}
.stat::before {
    content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%;
    right: -40px; top: -40px; background: var(--accent); opacity: .18;
}
.stat-icon {
    width: 46px; height: 46px; display: grid; place-items: center; font-size: 24px; border-radius: 15px;
    background: color-mix(in srgb, var(--accent) 25%, transparent); margin-bottom: 10px; transition: transform .3s;
}
.stat:hover .stat-icon { animation: wiggle .5s ease; }
@keyframes wiggle { 25% { transform: rotate(-12deg) scale(1.1); } 75% { transform: rotate(12deg) scale(1.1); } }
.stat-val { font-family: var(--font-head); font-size: 2rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat-val small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.stat-label { color: var(--muted); font-weight: 700; font-size: .88rem; margin-top: 2px; }

/* ---------- calendario ---------- */
.calendar { padding: 20px; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.dow span { text-align: center; font-weight: 800; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; padding-bottom: 8px; }
.dow span:nth-child(n+6) { color: var(--rose); }
.day {
    position: relative; min-height: 86px; border-radius: 20px; border: 2px solid transparent;
    background: var(--card-2); padding: 8px 9px; text-align: left; display: flex; flex-direction: column; gap: 3px;
    box-shadow: 0 4px 0 var(--line);
    transition: transform .18s cubic-bezier(.2, 1.6, .4, 1), box-shadow .18s;
    animation: drop .5s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(var(--i, 0) * 14ms);
}
@keyframes drop { from { opacity: 0; transform: translateY(-10px) scale(.9); } to { opacity: 1; transform: none; } }
.day.blank { background: transparent; box-shadow: none; }
.day:not(.blank):hover { transform: translateY(-3px) rotate(-1.5deg); box-shadow: 0 7px 0 var(--line); }
.day:not(.blank):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.day .num { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; }
.day.weekend { background: transparent; box-shadow: 0 4px 0 transparent; border: 2px dashed var(--line); }
.day.future .num { opacity: .5; }
.day.present { background: var(--present); box-shadow: 0 4px 0 color-mix(in srgb, var(--mint) 45%, transparent); }
.day.present .num { color: var(--present-ink); }
.day.off { background: var(--off); }
.day.today { border-color: var(--sun); box-shadow: 0 4px 0 #e5a813, 0 0 0 5px color-mix(in srgb, var(--sun) 25%, transparent); }
.day.today .num::after { content: " ★"; color: var(--sun); }
.hrs { font-weight: 800; font-size: .8rem; color: var(--present-ink); }
.live-hrs { color: var(--rose); animation: glow 1.6s infinite; }
.bar { margin-top: auto; height: 7px; border-radius: 99px; background: color-mix(in srgb, var(--mint) 20%, transparent); overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--fill); border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--sky)); animation: grow-x .9s cubic-bezier(.2, 1, .3, 1) both; animation-delay: calc(var(--i, 0) * 14ms + 200ms); }
@keyframes grow-x { from { width: 0; } }
.meal-badge { position: absolute; top: 6px; right: 7px; font-size: 1.15rem; animation: yum .6s both; animation-delay: calc(var(--i, 0) * 14ms + 300ms); }
.day:hover .meal-badge { animation: wiggle .5s; }
.tag { margin-top: auto; font-size: 1.4rem; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 18px; font-size: .85rem; font-weight: 700; color: var(--muted); align-items: center; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 5px; vertical-align: -2px; }
.lg-present { background: var(--present); border: 2px solid var(--mint); }
.legend-hint { margin-left: auto; font-style: italic; font-weight: 600; }

/* ---------- grafico + verifica ---------- */
.duo { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 22px; }
.duo h3 { font-size: 1.3rem; margin-bottom: 14px; }
.chart { display: flex; align-items: flex-end; gap: 5px; height: 190px; padding-top: 10px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 6px; min-width: 0; }
.col-bar {
    position: relative; width: 100%; max-width: 26px; height: var(--h); min-height: 4px;
    border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--peach), var(--rose));
    transform-origin: bottom; animation: grow-y .8s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(var(--i) * 30ms);
}
.col:nth-child(3n+2) .col-bar { background: linear-gradient(180deg, var(--sky), var(--lilac)); }
.col:nth-child(3n) .col-bar { background: linear-gradient(180deg, var(--sun), var(--peach)); }
.col.off .col-bar { background: var(--line); }
.col:hover .col-bar { filter: brightness(1.1); transform: scaleY(1.04); }
@keyframes grow-y { from { transform: scaleY(0); } }
.col-meal { position: absolute; top: -12px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 2px var(--card); }
.col-lbl { font-size: .7rem; font-weight: 800; color: var(--muted); }

.verify-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 16px; }
.verify-inputs label span, .field > span, .time-field span, .note-field span {
    display: block; font-weight: 800; font-size: .8rem; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .6px;
}
input:not([type=checkbox]):not([type=radio]), select {
    width: 100%; border: 2px solid var(--line); background: var(--card-2); border-radius: 14px; padding: 10px 12px;
    font-weight: 700; outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { border-color: var(--lilac); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lilac) 22%, transparent); }
.verify-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.v-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 16px; font-weight: 700; animation: pop-in .4s both; }
.v-lbl { font-family: var(--font-head); font-weight: 600; }
.v-msg { text-align: right; }
.v-row.pending { background: var(--card-2); color: var(--muted); }
.v-row.ok { background: var(--present); color: var(--present-ink); }
.v-row.warn { background: #ffe9d6; color: #b2541a; }
.v-row.info { background: #e3f1ff; color: #2a6fb0; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .v-row.warn { background: #4a2a17; color: #ffc59a; }
    :root:not([data-theme="light"]) .v-row.info { background: #1b3352; color: #9fd0ff; }
}

/* ---------- modale ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
    background: rgba(40, 20, 70, .35); backdrop-filter: blur(6px); animation: fade .2s both;
}
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 26px; animation: bounce-in .45s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes bounce-in { from { opacity: 0; transform: scale(.85) translateY(30px); } }
.modal-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 12px; border: 0; background: var(--card-2); font-weight: 800; }
.modal-title { font-size: 1.8rem; margin: 2px 0 16px; }
.status-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
    border: 2px solid var(--line); background: var(--card-2); border-radius: 99px; padding: 7px 14px; font-weight: 800;
    transition: transform .15s cubic-bezier(.2, 1.6, .4, 1);
}
.chip:hover { transform: translateY(-2px); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: scale(1.05); }
.time-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.time-row input { font-size: 1.3rem; font-family: var(--font-head); text-align: center; }
.time-arrow { font-size: 1.4rem; padding-bottom: 12px; color: var(--muted); }
.editor-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.editor-hours { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; color: var(--present-ink); }
.note-field { display: block; margin-top: 16px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: center; }
.spacer { flex: 1; }

/* ---------- impostazioni ---------- */
.settings { max-width: 720px; margin: 0 auto; }
.page-title { font-size: 2rem; margin-bottom: 8px; }
.settings-group { padding: 18px 0; border-bottom: 2px dashed var(--line); }
.settings-group h3 { font-size: 1.25rem; margin-bottom: 12px; }
.field { display: block; margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.check input { width: 22px; height: 22px; accent-color: var(--mint); }
.emoji-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-opt {
    width: 54px; height: 54px; font-size: 30px; border-radius: 18px; border: 2px solid var(--line); background: var(--card-2);
    transition: transform .2s cubic-bezier(.2, 1.6, .4, 1);
}
.emoji-opt:hover { transform: scale(1.12) rotate(-6deg); }
.emoji-opt.active { border-color: var(--sun); background: #fff1c7; transform: scale(1.12); box-shadow: 0 4px 0 #f2c94c; }
.saved-pop { font-weight: 800; color: var(--present-ink); animation: bounce-in .4s both; }

/* ---------- varie ---------- */
.loader { display: grid; place-items: center; min-height: 50vh; font-size: 64px; }
.loader span { animation: bob 1s ease-in-out infinite; }
.empty-state { text-align: center; max-width: 480px; margin: 40px auto; }
.big-emoji { font-size: 72px; }
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .duo { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .shell { padding: 12px 16px 32px; }
    .topnav .pill-link span:not(.me-avatar) { display: none; }
    .live { display: none; }
    .hero { grid-template-columns: 1fr; grid-template-areas: "main" "ring" "actions"; padding: 22px 18px; }
    .hero::after { right: 20px; }
    .ring-wrap { margin: 0 auto; width: 150px; height: 150px; }
    .avatar { width: 72px; height: 72px; font-size: 42px; border-radius: 24px; }
    .hero-actions > * { flex: 1 1 100%; }
    .meal-toggle { justify-content: flex-start; }
    .meal-toggle .switch { margin-left: auto; }
    .month-head { justify-content: center; }
    .month-title { font-size: 1.5rem; min-width: 170px; }
    .stats { gap: 10px; }
    .stat { padding: 14px; }
    .stat-val { font-size: 1.5rem; }
    .calendar { padding: 12px; }
    .dow, .grid { gap: 5px; }
    .day { min-height: 58px; padding: 5px; border-radius: 13px; }
    .day .num { font-size: .95rem; }
    .day.today .num::after { content: ""; }
    .hrs { font-size: .62rem; }
    .meal-badge { font-size: .8rem; top: 3px; right: 3px; }
    .tag { font-size: 1rem; }
    .legend-hint { margin-left: 0; width: 100%; }
    .verify-inputs { grid-template-columns: 1fr 1fr 1fr; }
    .field-row.three { grid-template-columns: 1fr; }
    .chart { gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- login ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); text-align: center; padding: 34px 26px 28px; position: relative; overflow: hidden; }
.auth-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 8px;
    background: linear-gradient(90deg, var(--rose), var(--peach), var(--sun), var(--grass), var(--mint), var(--sky), var(--lilac));
}
.auth-logo {
    width: 96px; height: 96px; margin: 0 auto 10px; display: grid; place-items: center; font-size: 56px; border-radius: 32px;
    background: linear-gradient(135deg, var(--sun), var(--peach)); box-shadow: 0 6px 0 #e2863e; animation: bob 3s ease-in-out infinite;
}
.auth-title {
    font-size: 2.6rem; font-weight: 700;
    background: linear-gradient(90deg, var(--rose), var(--peach), var(--sun), var(--mint), var(--sky), var(--lilac));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-sub { color: var(--muted); font-weight: 600; margin: 6px 0 22px; }
.auth-form { text-align: left; }
.auth-form input { font-size: 1.05rem; padding: 13px 14px; }
.auth-btn { width: 100%; margin-top: 8px; }
.auth-error { background: #ffe2e7; color: #c02a4f; font-weight: 800; padding: 10px 14px; border-radius: 14px; margin: 4px 0 12px; animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- utente in topbar ---------- */
.logout-form { margin: 0; display: contents; }
button.pill-link { border: 0; cursor: pointer; }
.user-pill { display: inline-flex; align-items: center; gap: 8px; padding-left: 6px; }
.me-avatar {
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem;
    background: linear-gradient(135deg, var(--sky), var(--lilac)); color: #fff;
}
.who { margin: 4px 0 0; font-size: .85rem; color: var(--muted); font-weight: 600; }
.modal .who { margin: -10px 0 14px; }

/* ---------- gestione utenti ---------- */
.user-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--card-2); border-radius: 18px; flex-wrap: wrap; }
.user-avatar {
    width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; font-family: var(--font-head);
    font-weight: 700; font-size: 1.2rem; color: #fff; background: hsl(var(--hue) 80% 65%); box-shadow: 0 4px 0 hsl(var(--hue) 60% 50%);
}
.user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-info small { color: var(--muted); font-weight: 600; }
.user-actions { display: flex; gap: 6px; align-items: center; }
.user-actions input { width: 150px; padding: 7px 10px; }
.form-msg { margin-top: 10px; font-weight: 800; padding: 9px 13px; border-radius: 14px; animation: pop-in .35s both; }
.form-msg.ok { background: var(--present); color: var(--present-ink); }
.form-msg.err { background: #ffe2e7; color: #c02a4f; }

@media (max-width: 640px) {
    .user-pill span:last-child { display: none; }
    .user-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- MFA ---------- */
.auth-alt { margin: 18px 0 0; font-size: .9rem; font-weight: 700; }
.otp-input { font-family: var(--font-head); font-size: 1.6rem !important; letter-spacing: .35em; text-align: center; }
.mfa-status.on { font-weight: 800; color: var(--present-ink); }
.mfa-actions, .mfa-confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.mfa-confirm .otp-input { max-width: 200px; }
.mfa-steps { padding-left: 22px; display: grid; gap: 16px; font-weight: 700; }
.qr { display: block; margin-top: 10px; border-radius: 18px; background: #fff; padding: 8px; box-shadow: 0 5px 0 var(--line); image-rendering: pixelated; }
.secret { font-size: .95rem; background: var(--card-2); padding: 3px 8px; border-radius: 8px; user-select: all; word-break: break-all; }
.mfa-box { padding: 16px; border-radius: 18px; background: var(--present); }
.recovery-codes { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.recovery-codes li { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; font-weight: 700; background: var(--card); padding: 8px 10px; border-radius: 10px; text-align: center; user-select: all; }
