/* =========================================================
   Life · stile ERP (evoluzione di Plancia)
   Grigi neutri, Inter per il testo, IBM Plex Mono per le cifre.
   Sidebar fissa su desktop, barra in basso su mobile.
   Il colore di sezione compare solo come segnale.
   ========================================================= */
:root {
  --bg: #F5F6F8;
  --panel: #F0F1F4;
  --white: #FFFFFF;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98A2B3;
  --line: #E4E7EC;
  --hair: #EEF0F3;
  --china: #B42318;
  --bmw: #1C69D4;
  --uni: #067647;
  --gym: #B54708;
  --gym-soft: #FEF0E6;
  --m1: #81C4FF; --m2: #16588E; --m3: #E7222E;
  --ok: #067647; --ok-bg: #ECFDF3; --ko: #B42318; --ko-bg: #FEF3F2;
  --accent: var(--ink);
  --accent-bg: #F2F4F7;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: var(--sans); /* compatibilità con eventuali stili inline */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --r: 8px;
  --r-s: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-l: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 0 0 1px rgba(16, 24, 40, .05);
  --pad: clamp(16px, 3vw, 32px);
  --toph: 56px;
  --sidew: 232px;
  --navh: 0px;
  color-scheme: light only;
}
body[data-section="cina"] { --accent: var(--china); --accent-bg: #FEF3F2; }
body[data-section="bmw"]  { --accent: var(--bmw);   --accent-bg: #EFF6FF; }
body[data-section="uni"]  { --accent: var(--uni);   --accent-bg: #ECFDF3; }
body[data-section="gym"]  { --accent: var(--gym);   --accent-bg: #FEF6EE; }
body[data-section="cal"]    { --accent: #6941C6; --accent-bg: #F4F3FF; }
body[data-section="tasks"]  { --accent: #0E9384; --accent-bg: #F0FDF9; }
body[data-section="habits"] { --accent: #C11574; --accent-bg: #FDF2FA; }
body[data-section="notes"]  { --accent: #B54708; --accent-bg: #FFFAEB; }
body[data-section="cloud"]  { --accent: #026AA2; --accent-bg: #F0F9FF; }
body[data-section="money"]  { --accent: #3E4784; --accent-bg: #F8F9FC; }
body[data-section="shop"]   { --accent: var(--china); --accent-bg: #FEF3F2; }
body[data-section="settings"] { --accent: var(--ink); --accent-bg: #F2F4F7; }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  font-feature-settings: "cv11", "ss01"; font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--ok); } .down { color: var(--ko); }
::selection { background: var(--ink); color: var(--white); }

/* filo di caricamento */
.stripe { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; height: 2px; pointer-events: none; }
.stripe i { flex: 1; background: var(--accent); transition: background .4s ease; }
body[data-section="bmw"] .stripe i:nth-child(1) { background: var(--m1); }
body[data-section="bmw"] .stripe i:nth-child(2) { background: var(--m2); }
body[data-section="bmw"] .stripe i:nth-child(3) { background: var(--m3); }
body:not(.busy) .stripe { opacity: 0; transition: opacity .3s ease .2s; }
body.busy .stripe { animation: load 1s ease-in-out infinite; transform-origin: left; }
@keyframes load { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }

/* marchio: quadrato con fascia tricolore + nome */
.wordmark { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -.01em; line-height: 1; }
.wordmark::before {
  content: ""; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px;
  background:
    linear-gradient(90deg, var(--m1) 0 33%, var(--m2) 33% 66%, var(--m3) 66%) center / 16px 3px no-repeat,
    var(--ink);
}
.wordmark a { text-decoration: none; }

/* ---------- login ---------- */
.login {
  max-width: 400px; margin: 12vh auto 48px; padding: 36px 32px 28px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.login .wordmark { font-size: 20px; }
.login .wordmark::before { width: 32px; height: 32px; border-radius: 8px; }
.login-sub { margin: 16px 0 28px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.login-form { display: grid; gap: 16px; }
.login-form .btn { margin-top: 4px; width: 100%; }
@media (max-width: 480px) { .login { margin: 0; min-height: 100dvh; border: 0; border-radius: 0; padding-top: 18vh; box-shadow: none; } }

/* ---------- layout: app bar + sidebar ---------- */
.app {
  display: grid; min-height: 100dvh;
  grid-template-columns: var(--sidew) minmax(0, 1fr);
  grid-template-rows: var(--toph) 1fr;
  grid-template-areas: "top top" "nav view";
}
.top {
  grid-area: top; position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px; height: var(--toph);
  padding: 0 var(--pad) 0 20px; background: var(--white); border-bottom: 1px solid var(--line);
}
.top .wordmark { order: 0; font-size: 15px; }
.top-date { order: 1; margin: 0 0 0 auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.top-date::first-letter { text-transform: uppercase; }
.top-end { order: 2; display: flex; align-items: center; gap: 12px; padding-left: 16px; border-left: 1px solid var(--line); height: 24px; }
.mode { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 4px; background: var(--panel); text-transform: uppercase; letter-spacing: .04em; }
.mode:empty { display: none; }

.nav {
  grid-area: nav; position: sticky; top: var(--toph); align-self: start;
  height: calc(100dvh - var(--toph)); overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 16px 12px;
  background: var(--white); border-right: 1px solid var(--line);
}
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.nav-group:first-child { margin-top: 2px; }
.nav-spacer { flex: 1; min-height: 12px; }
.nav .more-btn { display: none; }
.nav button {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  padding: 8px 10px; border-radius: var(--r-s); font-weight: 500; font-size: 13.5px; color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.nav svg { width: 18px; height: 18px; stroke-width: 1.7; color: var(--faint); flex: 0 0 auto; transition: color .15s ease; }
.nav button:hover { background: var(--panel); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--accent-bg); color: var(--ink); font-weight: 600; }
.nav button[aria-current="page"] svg { color: var(--accent); }
.nav button[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }

.view { grid-area: view; min-width: 0; min-height: 60vh; padding: 0 var(--pad) calc(64px + var(--navh)); max-width: 1280px; width: 100%; }
.view.drop { outline: 2px dashed var(--accent); outline-offset: -8px; border-radius: 12px; }
.loading { height: 60vh; }

@media (max-width: 900px) {
  :root { --navh: calc(60px + env(safe-area-inset-bottom)); --toph: 52px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "view"; }
  .top { padding: 0 16px; }
  .top-date { display: none; }
  .top-end { margin-left: auto; border-left: 0; padding-left: 0; }
  .nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 40;
    flex-direction: row; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--white) 92%, transparent);
    backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  }
  .nav-group, .nav-spacer { display: none; }
  .nav button:not(.on-bar) { display: none; }
  .nav .more-btn { display: flex; }
  .nav button { flex: 1; flex-direction: column; gap: 3px; justify-content: center; padding: 7px 2px; font-size: 10.5px; font-weight: 600; text-align: center; }
  .nav button[aria-current="page"] { background: transparent; color: var(--accent); }
  .nav button[aria-current="page"]::before { left: 30%; right: 30%; top: -4px; bottom: auto; width: auto; height: 2px; border-radius: 0 0 2px 2px; }
  .nav svg { width: 22px; height: 22px; }
}

/* ---------- intestazione di sezione ---------- */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 0 0; }
.masthead h2 { margin: 0; font-weight: 650; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; font-style: normal; }
.masthead p { margin: 0; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.masthead p::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }

/* ---------- KPI (hero) ---------- */
.hero {
  display: grid; grid-template-columns: 1fr; gap: 0;
  margin: 16px 0 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-label { margin: 0; padding: 16px 20px 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.hero-num {
  margin: 0; padding: 6px 20px 18px; font-family: var(--mono); font-weight: 500; font-style: normal;
  font-size: clamp(34px, 5vw, 48px); line-height: 1.1; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.hero-num .cents, .hero-num .unit { font-size: .45em; color: var(--muted); margin-left: .15em; letter-spacing: 0; }
.hero.anim .hero-num, .hero.anim .hero-stats li { animation: fade .5s var(--ease) both; }
.hero.anim .hero-stats li:nth-child(2) { animation-delay: .04s; }
.hero.anim .hero-stats li:nth-child(3) { animation-delay: .08s; }
.hero.anim .hero-stats li:nth-child(4) { animation-delay: .12s; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.hero-stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none;
  border-top: 1px solid var(--line);
}
.hero-stats li { padding: 12px 20px 14px; font-size: 12px; color: var(--muted); border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.hero-stats li:nth-child(2n) { border-right: 0; }
.hero-stats b { display: block; margin-bottom: 2px; font-family: var(--mono); font-weight: 500; font-size: 18px; line-height: 1.3; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hero-stats b .sign { margin-right: .05em; }
.hero-stats b.up { color: var(--ok); } .hero-stats b.down { color: var(--ko); }
.bar { height: 6px; margin: 0 20px 20px; background: var(--panel); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .8s var(--ease); }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); }
  .hero-label, .hero-num, .hero .bar { grid-column: 1; }
  .hero > .hero-stats { grid-column: 2; grid-row: 1 / span 3; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 0; border-left: 1px solid var(--line); }
  .hero > .hero-stats li { display: flex; flex-direction: column; justify-content: center; border-bottom: 0; }
  .hero > .hero-stats li:nth-child(2n) { border-right: 1px solid var(--hair); }
  .hero > .hero-stats li:last-child { border-right: 0; }
  .hero > .hero-stats:has(li:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero > .hero-stats:has(li:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Oggi ---------- */
.hero-home { margin-top: 24px; background: transparent; border: 0; box-shadow: none; grid-template-columns: 1fr !important; overflow: visible; }
.hero-home .hero-label { padding: 0; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; }
.hero-home .hero-label::first-letter { text-transform: uppercase; }
.hero-num.hello { padding: 4px 0 0; font-family: var(--sans); font-weight: 650; font-size: clamp(26px, 4vw, 34px); letter-spacing: -.03em; overflow-wrap: normal; }
body[data-section="home"] .top-date { visibility: visible; }
.brief { margin: 8px 0 0; max-width: 70ch; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.hero.anim .brief { animation: fade .5s .08s var(--ease) both; }

.index { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 20px; }
@media (min-width: 640px) { .index { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .index { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.idx {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 16px; min-height: 176px;
  text-decoration: none; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.idx:hover { border-color: #D0D5DD; box-shadow: 0 4px 12px -4px rgba(16, 24, 40, .12); transform: translateY(-1px); }
.idx::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; border-radius: var(--r) var(--r) 0 0; background: var(--c); }
.idx-k { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.idx-k::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.idx-n { white-space: nowrap; font-family: var(--mono); font-weight: 500; font-size: 30px; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 10px 0 4px; }
.idx-n small { font-size: .45em; color: var(--muted); letter-spacing: 0; margin-left: .2em; }
.idx:first-child .idx-n { font-size: 30px; }
.idx-t { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.idx-go { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--hair); font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; }
.idx-go::after { content: "→"; color: var(--faint); transition: transform .15s ease, color .15s ease; }
.idx:hover .idx-go::after { transform: translateX(3px); color: var(--ink); }
.week-dots { display: flex; gap: 4px; margin: 2px 0 6px; }
.week-dots i { flex: 1; max-width: 28px; height: 6px; border-radius: 2px; background: var(--panel); }
.week-dots i.on { background: var(--gym); }

/* ---------- impostazioni a scomparsa ---------- */
.settings { margin-top: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); }
.settings summary { cursor: pointer; padding: 12px 16px; color: var(--ink-2); font-size: 13px; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 10px; }
.settings summary::-webkit-details-marker { display: none; }
.settings summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .2s ease; }
.settings[open] summary { border-bottom: 1px solid var(--hair); }
.settings[open] summary::before { transform: rotate(45deg); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; padding: 16px; align-items: end; }

/* ---------- toolbar, filtri, tab ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; padding: 20px 0 12px; }
.filters {
  display: inline-flex; gap: 2px; overflow-x: auto; margin-right: auto; min-width: 0; scrollbar-width: none;
  padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
}
.filters::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 0; background: transparent; cursor: pointer; padding: 5px 12px; border-radius: 5px; font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; transition: background .15s ease, color .15s ease; }
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }

.seg { display: flex; gap: 20px; margin: 20px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { position: relative; flex: 0 0 auto; border: 0; background: transparent; padding: 10px 2px 11px; font-weight: 500; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap; transition: color .15s ease; }
.seg button:hover { color: var(--ink); }
.seg button::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform .2s var(--ease); }
.seg button[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.seg button[aria-selected="true"]::after { transform: scaleX(1); }

/* ---------- liste come tabella ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.item {
  display: grid; align-items: center; gap: 2px 20px;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "main price status" "actions actions actions";
  padding: 14px 16px 12px; border-bottom: 1px solid var(--hair); transition: background .12s ease;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: #FAFBFC; }
.item-main { grid-area: main; min-width: 0; }
.item-name { margin: 0; font-weight: 600; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.item-meta { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.item-meta .prio-Alta { color: var(--china); font-weight: 600; }
.item-price { grid-area: price; margin: 0; font-family: var(--mono); font-weight: 500; font-size: 15px; line-height: 1.2; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.item-price small { display: block; margin-top: 2px; font-family: var(--sans); font-weight: 500; color: var(--muted); font-size: 11.5px; }
.item-actions { grid-area: actions; display: flex; gap: 2px 14px; margin-top: 6px; flex-wrap: wrap; }
.item.is-done .item-name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }

.pill {
  grid-area: status; justify-self: end; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 5px; border: 1px solid var(--line); background: var(--white);
  font-size: 12px; font-weight: 600; color: var(--ink-2); transition: border-color .15s ease, background .15s ease;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot); }
.pill:hover { border-color: #D0D5DD; background: var(--panel); }
.pill:active { transform: scale(.97); }
.pill[data-step="0"] { --dot: #98A2B3; color: var(--muted); }
.pill[data-step="1"] { --dot: #DC6803; background: #FFFAEB; border-color: #FEDF89; color: #93370D; }
.pill[data-step="2"] { --dot: #1570EF; background: #EFF8FF; border-color: #B2DDFF; color: #175CD3; }
.pill[data-step="3"] { --dot: #6938EF; background: #F4F3FF; border-color: #D9D6FE; color: #5925DC; }
.pill[data-step="4"] { --dot: #12B76A; background: #ECFDF3; border-color: #ABEFC6; color: #067647; }
.pill.study-btn { background: var(--ink); border-color: var(--ink); color: var(--white); padding: 6px 14px; font-size: 12.5px; }
.pill.study-btn::before { display: none; }
.pill.study-btn:hover { background: var(--accent); border-color: var(--accent); }

.act {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 0;
  border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 500; text-decoration: none; cursor: pointer; transition: color .15s ease;
}
.act svg { width: 14px; height: 14px; flex: 0 0 auto; }
.act:hover { color: var(--ink); }
.act.is-ok, .act.is-ok svg { color: var(--accent); }

.empty { margin-top: 16px; padding: 40px 24px; text-align: center; color: var(--muted); background: var(--white); border: 1px dashed #D0D5DD; border-radius: var(--r); }
.empty p { margin: 0 auto 16px; max-width: 44ch; font-size: 14px; line-height: 1.5; color: var(--ink-2); }

/* ---------- foto prodotti ---------- */
.item.has-thumb { grid-template-columns: 56px 1fr auto auto; grid-template-areas: "thumb main price status" "thumb actions actions actions"; }
.thumb {
  grid-area: thumb; align-self: start; width: 56px; aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; cursor: pointer;
  background: var(--panel); display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.thumb:hover img { transform: scale(1.05); }
.thumb.is-empty { border-style: dashed; background: var(--white); }
.thumb.is-empty span { font-size: 18px; font-weight: 300; color: var(--faint); line-height: 1; }
.thumb.is-empty:hover { border-color: var(--muted); }
.thumb.is-empty:hover span { color: var(--ink); }

.photo-field { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; padding-bottom: 4px; }
.photo-prev { width: 96px; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-prev svg { width: 26px; height: 26px; }
.photo-side { display: grid; gap: 8px; justify-items: start; }
.photo-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.photo-btns { display: flex; align-items: center; gap: 12px; }
.photo-btns .btn { cursor: pointer; min-height: 34px; padding: 6px 12px; font-size: 13px; }
.photo-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }

.lightbox { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 56px 20px 40px; border: 0; background: rgba(16, 24, 40, .88); display: none; cursor: zoom-out; }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; gap: 14px; animation: fade .25s var(--ease); }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: min(92vw, 960px); max-height: calc(100dvh - 150px); object-fit: contain; border-radius: var(--r); }
.lb-cap { margin: 0; font-size: 14px; font-weight: 500; color: #fff; }
.lb-close { position: fixed; top: 16px; right: 20px; color: #D0D5DD !important; }
.lb-close:hover { color: #fff !important; }

@media (max-width: 720px) {
  .item.has-thumb { grid-template-columns: 48px auto 1fr auto; grid-template-areas: "thumb main main price" "thumb status actions actions"; gap: 2px 12px; }
  .thumb { width: 48px; }
  .photo-field { grid-template-columns: 80px 1fr; gap: 12px; }
  .photo-prev { width: 80px; }
}

/* ---------- bottoni e campi ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid #D0D5DD; background: var(--white); color: var(--ink-2); box-shadow: var(--shadow);
  padding: 8px 14px; border-radius: var(--r-s); font-weight: 600; font-size: 13.5px; cursor: pointer; min-height: 38px; white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover:not(:disabled) { background: var(--panel); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: #1D2939; border-color: #1D2939; color: var(--white); }
body[data-section="home"] .btn-primary:hover:not(:disabled) { background: #1D2939; }
.btn-danger { color: var(--ko); border-color: #FDA29B; }
.btn-danger:hover:not(:disabled) { background: var(--ko-bg); color: var(--ko); }
.btn-block { width: 100%; margin-top: 16px; min-height: 46px; font-size: 14px; }
.file-btn { cursor: pointer; }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 0; font-size: 13px; font-weight: 500; transition: color .15s ease; }
.link-btn:hover { color: var(--ink); }
.link-btn.danger { color: var(--ko); }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; background: transparent; color: var(--muted); border-radius: var(--r-s); cursor: pointer; transition: background .15s ease, color .15s ease; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover:not(:disabled) { background: var(--panel); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }

label { display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 8px 12px; min-height: 40px; font-size: 14px;
  border: 1px solid #D0D5DD; border-radius: var(--r-s); background: var(--white); color: var(--ink); box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
input[type="number"] { -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
@media (max-width: 720px) { input, select, textarea { font-size: 16px; min-height: 44px; } }
.form-error { color: var(--ko); margin: 0; font-size: 13px; min-height: 1em; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input { flex: 1; min-width: 0; }
.inline select { width: auto; }
.inline .btn { min-height: 40px; }

/* ---------- foglio (dialog) ---------- */
.sheet {
  width: min(560px, calc(100vw - 24px)); max-height: 90dvh; padding: 0; border: 0;
  border-radius: 12px; background: var(--white); color: var(--ink); box-shadow: var(--shadow-l);
}
.sheet::backdrop, .study::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.sheet[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.sheet form { display: flex; flex-direction: column; max-height: 90dvh; }
.sheet-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 16px; font-weight: 650; font-style: normal; letter-spacing: -.01em; line-height: 1.3; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px; overflow-y: auto; }
.fields .full { grid-column: 1 / -1; }
.sheet-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #FCFCFD; border-radius: 0 0 12px 12px; }
.sheet-foot .btn-danger { margin-right: auto; }

@media (max-width: 720px) {
  .sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .sheet[open] { animation: up .28s var(--ease); }
  .sheet-head { padding: 22px 16px 14px; }
  .sheet-head::before { content: ""; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
  .fields { padding: 16px; gap: 12px; grid-template-columns: 1fr; }
  .sheet-foot { padding: 12px 16px; border-radius: 0; }
  .sheet-foot .btn { flex: 1; }
  .sheet-foot .btn-danger { flex: 0 0 auto; }
  .item { grid-template-columns: auto 1fr auto; grid-template-areas: "main main price" "status actions actions"; gap: 2px 10px; padding: 12px 14px; }
  .pill { justify-self: start; margin-top: 8px; }
  .item-actions { justify-content: flex-end; align-self: end; gap: 2px 12px; }
  .hide-s { display: none; }
  .masthead { padding-top: 18px; }
  .masthead h2 { font-size: 20px; }
  .toolbar { padding-top: 14px; flex-wrap: wrap; }
  .filters { margin-right: 0; max-width: 100%; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--navh)); z-index: 70;
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: var(--r); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-l); transition: opacity .2s ease, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   UNI · stanza studio
   ========================================================= */
.study { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--ink); }
.study[open] { animation: fade .25s var(--ease); }
.study-wrap { display: flex; flex-direction: column; height: 100%; }
.study-head { display: flex; align-items: center; gap: 14px; height: var(--toph); padding: 0 var(--pad); border-bottom: 1px solid var(--line); background: var(--white); }
.study-head > div { margin-right: auto; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.study-head h2 { margin: 0; font-size: 15px; font-weight: 650; font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-head p { margin: 0; font-size: 12.5px; white-space: nowrap; }
.study-head form { margin: 0; }
.study-head .btn { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.study-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; }
.study-pdf { display: none; width: 100%; height: 100%; border: 0; background: var(--panel); }
.study-side { display: flex; flex-direction: column; min-height: 0; padding: 0 var(--pad); max-width: 780px; width: 100%; margin: 0 auto; background: var(--white); }
.study-side .seg { margin-top: 4px; }
.study-pane { flex: 1; overflow-y: auto; padding: 24px 0 calc(28px + env(safe-area-inset-bottom)); }
@media (min-width: 980px) {
  .study-body { grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr); }
  .study-pdf { display: block; border-right: 1px solid var(--line); }
  .study-side { max-width: none; padding: 0 32px; }
}

.ai-start p, .ai-error p { max-width: 52ch; margin: 0 0 18px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.ai-error p { color: var(--ko); }
.ai-wait { display: flex; align-items: center; gap: 12px; padding: 24px 0; color: var(--muted); }
.ai-wait p { margin: 0; font-size: 13.5px; color: var(--muted); }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.75); } 40% { opacity: 1; transform: none; } }

.quiz-count { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: .04em; }
.quiz .bar { margin: 0 0 24px; }
.quiz-q { margin: 0 0 20px; font-size: clamp(18px, 2.4vw, 22px); line-height: 1.35; font-weight: 600; letter-spacing: -.015em; }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; align-items: baseline; gap: 12px; text-align: left; cursor: pointer; width: 100%;
  padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--white); line-height: 1.45; font-size: 14px;
  transition: border-color .15s ease, background .15s ease;
}
.opt:hover:not(:disabled) { border-color: #98A2B3; background: #FCFCFD; }
.opt-k { flex: 0 0 auto; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--panel); font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--muted); }
.opt.ok { border-color: #75E0A7; background: var(--ok-bg); }
.opt.ok .opt-k { background: var(--ok); color: #fff; }
.opt.ko { border-color: #FDA29B; background: var(--ko-bg); }
.opt.ko .opt-k { background: var(--ko); color: #fff; }
.opt.dim { opacity: .45; }
.opt:disabled { cursor: default; }
.explain { margin-top: 18px; padding: 12px 14px; border-radius: var(--r); background: var(--accent-bg); border-left: 3px solid var(--accent); animation: fade .3s var(--ease); }
.explain p { margin: 0 0 12px; line-height: 1.55; font-size: 13.5px; }

.score { margin: 4px 0 8px; font-family: var(--mono); font-size: clamp(56px, 10vw, 80px); font-weight: 500; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.score span { font-size: .4em; color: var(--muted); letter-spacing: 0; }
.quiz-end > .muted { font-size: 14.5px; color: var(--ink-2); }
.recap { padding-left: 18px; margin: 16px 0 22px; display: grid; gap: 10px; font-size: 13.5px; }
.recap li::marker { color: var(--accent); }
.oral form { display: grid; gap: 12px; }

.prose { line-height: 1.65; max-width: 70ch; font-size: 14px; color: var(--ink-2); }
.prose h4 { margin: 24px 0 6px; font-size: 15px; font-weight: 650; font-style: normal; color: var(--ink); }
.prose h4:first-child { margin-top: 0; }
.prose p { margin: 0 0 10px; }
.prose b { color: var(--ink); }
.prose ul { margin: 0 0 14px; padding-left: 18px; }
.prose li { margin: 4px 0; padding-left: 2px; }
.prose li::marker { color: var(--accent); }
.prose code { font-family: var(--mono); font-size: .9em; padding: 1px 5px; border-radius: 4px; background: var(--panel); }
article.prose + .btn { margin-top: 16px; }

.chat { display: grid; gap: 10px; margin-bottom: 14px; }
.chat > .muted { font-size: 14px; line-height: 1.5; margin: 0; color: var(--muted); max-width: 48ch; }
.msg { padding: 10px 14px; border-radius: 10px; max-width: 86%; font-size: 14px; animation: fade .25s var(--ease); }
.msg.me { justify-self: end; background: var(--ink); color: var(--white); border-bottom-right-radius: 3px; }
.msg.ai { justify-self: start; background: var(--panel); border-bottom-left-radius: 3px; }
.msg.ai p:last-child, .msg.ai ul:last-child { margin-bottom: 0; }
.ask { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 0 4px; background: linear-gradient(transparent, var(--white) 30%); }

/* =========================================================
   PALESTRA
   Ogni esercizio è una scheda; le serie sono righe da tabella
   con campi grandi per il pollice. Il tasto salva resta sempre
   raggiungibile in fondo allo schermo.
   ========================================================= */
.log { display: grid; gap: 12px; counter-reset: ex; padding-bottom: 8px; }
.log-date { max-width: 220px; margin: 16px 0 4px; }
.ex {
  min-width: 0; margin: 0; padding: 0; counter-increment: ex;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  overflow: hidden;
}
.ex legend { display: contents; }
.ex-name {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px 0;
  font-weight: 650; font-size: 15px; line-height: 1.3; letter-spacing: -.01em; font-style: normal;
}
.ex-name::before {
  content: counter(ex, decimal-leading-zero); flex: 0 0 auto; display: inline-grid; place-items: center;
  min-width: 26px; height: 22px; padding: 0 5px; border-radius: 5px;
  background: var(--gym-soft); color: var(--gym); font-family: var(--mono); font-size: 11.5px; font-weight: 600;
}
.ex-target { display: inline-flex; align-items: center; gap: 6px; margin: 8px 16px 0 52px; padding: 2px 8px; border-radius: 4px; background: var(--panel); font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ex-prev { margin: 6px 16px 0 52px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ex-prev::before { content: "Ultima volta · "; font-weight: 600; color: var(--faint); }
.sets { display: grid; gap: 6px; margin: 12px 0 0; padding: 10px 16px 12px; border-top: 1px solid var(--hair); background: #FCFCFD; }
.set { display: grid; grid-template-columns: 30px minmax(0, 1fr) 14px minmax(0, 1fr) 36px; align-items: center; gap: 8px; max-width: 460px; }
.set-n { display: inline-grid; place-items: center; height: 28px; border-radius: 5px; font-family: var(--mono); font-size: 12px; font-weight: 600; font-style: normal; color: var(--muted); background: var(--panel); }
.set .x { color: var(--faint); text-align: center; font-size: 13px; }
.set input {
  text-align: center; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 17px;
  min-height: 46px; padding: 6px; border-radius: var(--r-s);
}
.set input:not(:placeholder-shown) { border-color: #98A2B3; background: var(--white); }
.set:has(input:not(:placeholder-shown) + .x + input:not(:placeholder-shown)) .set-n { background: var(--gym); color: #fff; }
.set .icon-btn { width: 36px; height: 36px; }
.ex > .link-btn { display: block; width: 100%; margin: 0; padding: 10px 16px; border-top: 1px solid var(--hair); text-align: left; font-size: 12.5px; font-weight: 600; color: var(--gym); background: var(--white); }
.ex > .link-btn:hover { background: var(--gym-soft); color: var(--gym); }
.log > .btn-block, .log > .btn-primary {
  position: sticky; bottom: calc(12px + var(--navh)); z-index: 5;
  margin-top: 8px; box-shadow: 0 8px 24px -6px rgba(16, 24, 40, .35);
}
@media (max-width: 720px) {
  .ex-target, .ex-prev { margin-left: 16px; }
  .set { max-width: none; grid-template-columns: 30px minmax(0, 1fr) 12px minmax(0, 1fr) 36px; }
  .set input { min-height: 50px; font-size: 18px; }
}

.sub { margin: 32px 0 10px; font-size: 13px; font-weight: 600; font-style: normal; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.history { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.history > li { border-bottom: 1px solid var(--hair); }
.history > li:last-child { border-bottom: 0; }
.history summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; cursor: pointer; list-style: none; font-size: 13.5px; transition: background .12s ease; }
.history summary:hover { background: #FAFBFC; }
.history summary b { font-weight: 600; margin-right: 6px; }
.history summary > .muted { white-space: nowrap; font-family: var(--mono); font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.history summary::-webkit-details-marker { display: none; }
.history details[open] summary, .history li[open] summary { background: var(--panel); }
.hist-ex { list-style: none; margin: 0; padding: 8px 16px 12px; display: grid; gap: 0; font-size: 13px; }
.hist-ex li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--hair); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hist-ex li:last-child { border-bottom: 0; }

.plan { display: grid; gap: 12px; padding-top: 16px; }
@media (min-width: 900px) { .plan { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; } .plan > .btn, .plan > .target { grid-column: 1 / -1; justify-self: start; } }
.day { padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.plan > .btn { margin-top: 4px; }
.day-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); background: #FCFCFD; }
.day-head h3 { margin: 0 auto 0 0; font-size: 14px; font-weight: 650; font-style: normal; line-height: 1.3; }
.day-tools { display: inline-flex; gap: 0; flex: 0 0 auto; }
.ex-list { margin: 0; padding: 0; list-style: none; counter-reset: exl; }
.ex-list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 16px; border-bottom: 1px solid var(--hair); counter-increment: exl; }
.ex-list li:last-child { border-bottom: 0; }
.ex-list li::before { content: counter(exl); width: 18px; flex: 0 0 18px; font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--faint); }
.ex-line { margin-right: auto; min-width: 0; display: grid; font-size: 13.5px; }
.ex-line b { font-weight: 600; }
.ex-line .muted { font-size: 12px; font-variant-numeric: tabular-nums; }
.day > .link-btn, .day > .btn { margin: 8px 16px 12px; }
.target { max-width: 240px; margin-top: 8px; }

.ex-pick { max-width: 360px; margin-top: 16px; }
.stat-row { margin-top: 16px !important; }
.chart { position: relative; height: 320px; margin-top: 16px; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.chart-s { height: 220px; }
.pr { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.pr th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; padding: 10px 16px; background: #FCFCFD; border-bottom: 1px solid var(--line); }
.pr td { padding: 11px 16px; border-bottom: 1px solid var(--hair); }
.pr tbody tr:last-child td { border-bottom: 0; }
.pr td:first-child { font-weight: 600; }
.pr td:nth-child(3) { font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
.pr tbody tr:hover td { background: #FAFBFC; }
@media (max-width: 720px) {
  .pr th:nth-child(2), .pr td:nth-child(2) { display: none; }
  .pr th, .pr td { padding-left: 12px; padding-right: 12px; }
  .chart { height: 260px; padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* =========================================================
   LIFE · aggiunte
   ========================================================= */
.ic { width: 18px; height: 18px; flex: 0 0 auto; }
.btn .ic { width: 16px; height: 16px; }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.btn-lg { min-height: 46px; padding: 10px 20px; font-size: 15px; }
.show-s { display: none !important; }
@media (max-width: 720px) { .show-s { display: inline-flex !important; } }
.top-end #quick { width: 32px; height: 32px; background: var(--ink); color: var(--white); border-radius: 8px; }
.top-end #quick:hover { background: var(--accent); color: var(--white); }
.top-end #quick svg { width: 18px; height: 18px; }
.search { margin: 0 0 12px; max-width: 420px; }
.cnt { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-left: 2px; }
.chip[aria-pressed="true"] .cnt { color: var(--muted); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.sub .link-btn { float: right; text-transform: none; letter-spacing: 0; }
.lbl { margin: 4px 0 0; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
label.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); align-self: end; min-height: 40px; }
label.check input { width: 18px; height: 18px; min-height: 0; box-shadow: none; accent-color: var(--accent); }
.fields > label > span { font-size: 12.5px; }
.fields small { font-size: 11.5px; font-weight: 400; line-height: 1.35; }
.fields-tight { padding: 0; gap: 12px; margin-bottom: 4px; }
.loading.small { height: 120px; }
.bar.over span { background: var(--ko); }

/* menu a scelte */
.menu-sheet { width: min(420px, calc(100vw - 24px)); }
.menu { display: grid; padding: 8px; }
.menu-title { margin: 6px 10px 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px; border: 0; background: none; border-radius: 6px; text-align: left; font-size: 14.5px; font-weight: 500; cursor: pointer; color: var(--ink); }
.menu button:hover { background: var(--panel); }
.menu button .ic { color: var(--muted); }
.menu button.danger, .menu button.danger .ic { color: var(--ko); }
.menu .menu-cancel { justify-content: center; margin-top: 4px; border-top: 1px solid var(--hair); border-radius: 0 0 6px 6px; color: var(--muted); }
@media (max-width: 720px) { .menu-sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom); } .menu-sheet[open] { animation: up .25s var(--ease); } }

/* dialog a tutto schermo */
dialog.full { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--ink); overflow: hidden; }
dialog.full[open] { display: flex; flex-direction: column; animation: fade .2s var(--ease); }
dialog.full::backdrop { background: var(--bg); }

/* =========================================================
   OGGI
   ========================================================= */
.hello { padding: 28px 0 4px; }
.hello h2 { margin: 6px 0 0; font-size: clamp(26px, 4vw, 34px); font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.hello .hero-label { padding: 0; text-transform: capitalize; letter-spacing: 0; font-weight: 500; font-size: 13px; }
.dash { display: grid; gap: 12px; margin-top: 20px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .dash { grid-template-columns: repeat(3, minmax(0, 1fr)); } .w-agenda { grid-row: span 2; } }
.w { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px 16px; min-width: 0; }
.w > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.w > header h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.w > header h3 .ic { width: 16px; height: 16px; color: var(--muted); }
.wempty { margin: 6px 0; font-size: 13.5px; }
.wsub { margin: 14px 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.wl { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.wl li { display: grid; grid-template-columns: 52px 3px 1fr; gap: 10px; align-items: center; padding: 7px 0; font-size: 13.5px; }
.wl li.past { opacity: .5; }
.wl .wt { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.wl .wbar { align-self: stretch; border-radius: 2px; background: var(--c); }
.wl b { font-weight: 600; display: block; }
.wl small { display: block; color: var(--muted); font-size: 12px; }
.wl.small li { padding: 4px 0; font-size: 13px; }
.wtasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.wtasks li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13.5px; transition: opacity .3s; }
.wtasks li.is-done { opacity: .4; text-decoration: line-through; }
.wadd { display: flex; gap: 6px; align-items: center; }
.wadd input { min-height: 36px; padding: 6px 10px; font-size: 13.5px; }
.wadd .icon-btn { flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid #D0D5DD; background: var(--white); }
.whabits { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.whab { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); cursor: pointer; text-align: left; font-size: 13px; transition: all .15s; }
.whab b { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whab small { font-size: 11px; color: var(--muted); }
.whab.on { background: color-mix(in srgb, var(--c) 12%, white); border-color: color-mix(in srgb, var(--c) 45%, white); }
.whab.on b { font-weight: 600; }
.wbig { margin: 6px 0 10px; font-family: var(--mono); font-size: 28px; font-weight: 500; letter-spacing: -.03em; }
.wbig span { font-family: var(--sans); font-size: 13px; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.w .bar { margin: 0 0 12px; }
.w .btn-block { margin-top: 4px; }
.wtitle { margin: 0; font-weight: 600; }
.week-dots.big { gap: 6px; margin: 4px 0 6px; }
.week-dots.big i { height: 8px; max-width: none; border-radius: 3px; }
.week-dots i.today { outline: 1.5px solid var(--ink-2); outline-offset: 1px; }
.w-thought textarea { min-height: 70px; margin-bottom: 8px; }
.wnotes { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--hair); display: grid; gap: 4px; }
.wnotes li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.wnotes button { border: 0; background: none; padding: 2px 0; cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.wnotes button:hover { color: var(--ink); text-decoration: underline; }
.wnotes small { color: var(--faint); white-space: nowrap; }
.focus { position: relative; width: 150px; height: 150px; margin: 4px auto 12px; }
.fring { width: 100%; height: 100%; transform: rotate(-90deg); }
.fring circle { fill: none; stroke-width: 7; }
.fring .bg { stroke: var(--panel); }
.fring .fg { stroke: var(--ink); stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.fring .fg.brk { stroke: var(--ok); }
.fmid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.fmid b { font-family: var(--mono); font-size: 30px; font-weight: 500; letter-spacing: -.03em; }
.fmid small { color: var(--muted); font-size: 12px; }
.fbtns { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }

/* =========================================================
   CALENDARIO
   ========================================================= */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 20px 0 8px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav h2 { margin: 0 0 0 10px; font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.cal-actions { display: flex; align-items: center; gap: 8px; }
.cal-actions .filters { margin: 0; }
.cal-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 0 12px; }
.calchip { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 4px 10px 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font-size: 12px; font-weight: 500; cursor: pointer; color: var(--ink-2); }
.calchip i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.calchip[aria-pressed="false"] { opacity: .45; }
.calchip[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.cal-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .cal-layout:not([data-view="agenda"]) { grid-template-columns: minmax(0, 1fr) 320px; } }
.cal-main { min-width: 0; }
.month { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.mhead { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); background: #FCFCFD; }
.mhead span { padding: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mcell { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 108px; padding: 6px; border: 0; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); background: var(--white); text-align: left; cursor: pointer; overflow: hidden; }
.mcell:nth-child(7n) { border-right: 0; }
.mcell:hover { background: #FAFBFC; }
.mcell.out { background: #FCFCFD; }
.mcell.out .mnum { color: var(--faint); }
.mnum { align-self: flex-start; display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mcell.today .mnum { background: var(--accent); color: #fff; }
.mcell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.mev { display: grid; gap: 2px; min-width: 0; }
.mchip { display: block; padding: 1px 5px; border-radius: 4px; font-size: 11px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); background: color-mix(in srgb, var(--c) 14%, white); border-left: 2px solid var(--c); }
.mchip b { font-weight: 600; font-family: var(--mono); font-size: 10.5px; }
.mchip.allday { background: var(--c); color: #fff; border-left: 0; }
.mmore { font-size: 11px; color: var(--muted); padding-left: 4px; }
.mdots { display: none; gap: 3px; justify-content: center; }
.mdots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.mdots i.tk { background: #0E9384; border-radius: 1px; }
.mdots i.gy { background: var(--gym); border-radius: 1px; transform: rotate(45deg); }
@media (max-width: 720px) {
  .mcell { min-height: 58px; align-items: center; padding: 6px 2px; }
  .mnum { align-self: center; }
  .mev { display: none; }
  .mdots { display: flex; }
  .cal-nav h2 { font-size: 17px; margin-left: 6px; }
  .cal-head { padding-top: 14px; }
}
.cal-day { min-width: 0; }
.dayhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 10px; }
.dayhead h3 { margin: 0; font-size: 15px; font-weight: 650; }
.dayhead h3::first-letter { text-transform: uppercase; }
.dayempty { padding: 18px; background: var(--white); border: 1px dashed #D0D5DD; border-radius: var(--r); font-size: 13.5px; text-align: center; }
.agenda-row { grid-template-columns: 1fr auto !important; grid-template-areas: "main price" !important; cursor: pointer; }
.evrow { position: relative; padding-left: 22px !important; }
.evbar { position: absolute; left: 10px; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: var(--c); }
.agenda section { margin-bottom: 4px; }
.agenda .sub { margin-top: 20px; }
.agenda .sub::first-letter { text-transform: uppercase; }
.week { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.wgrid-head, .wallday { display: grid; grid-template-columns: 52px repeat(var(--n), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.wday { display: grid; justify-items: center; gap: 0; padding: 8px 2px; border: 0; background: #FCFCFD; cursor: pointer; border-left: 1px solid var(--hair); }
.wday small { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.wday b { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 14px; font-size: 15px; font-weight: 600; }
.wday.today b { background: var(--accent); color: #fff; }
.wallday { min-height: 30px; }
.wlbl { font-size: 10px; color: var(--faint); padding: 6px 4px; text-align: right; line-height: 1.1; }
.wad { display: grid; gap: 2px; padding: 3px; border-left: 1px solid var(--hair); align-content: start; }
.wscroll { height: min(64vh, 640px); overflow-y: auto; }
.wbody { position: relative; display: grid; grid-template-columns: 52px repeat(var(--n), minmax(0, 1fr)); background: repeating-linear-gradient(to bottom, transparent 0 calc(var(--h) - 1px), var(--hair) calc(var(--h) - 1px) var(--h)); }
.whours { position: relative; }
.whours span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 10.5px; font-family: var(--mono); color: var(--faint); }
.wcol { position: relative; border-left: 1px solid var(--hair); cursor: copy; }
.wcol.today { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.wev { position: absolute; display: flex; flex-direction: column; gap: 0; padding: 3px 6px; border: 0; border-radius: 5px; overflow: hidden; text-align: left; cursor: pointer; font-size: 11.5px; line-height: 1.3; color: var(--ink); background: color-mix(in srgb, var(--c) 16%, white); border-left: 3px solid var(--c); }
.wev b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wev small { color: var(--ink-2); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wev.allday { position: static; background: var(--c); color: #fff; border-left: 0; padding: 2px 6px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--ko); z-index: 2; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ko); }
.cal-edit { display: grid; gap: 8px; }
.ce-row { display: grid; grid-template-columns: 44px 1fr 36px; gap: 8px; align-items: center; }
.ce-row input[type="color"] { padding: 2px; height: 40px; cursor: pointer; }

/* =========================================================
   ATTIVITÀ
   ========================================================= */
.quickadd { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; }
.quickadd input { min-height: 46px; font-size: 15px; }
.quickadd .btn { min-height: 46px; }
.qa-preview { grid-column: 1 / -1; margin: 0; min-height: 1.2em; }
.tasklist .task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--hair); cursor: pointer; transition: background .12s, opacity .3s; }
.tasklist .task:last-child { border-bottom: 0; }
.tasklist .task:hover { background: #FAFBFC; }
.task.is-done .item-name { color: var(--muted); text-decoration: line-through; }
.task.p3 { box-shadow: inset 3px 0 0 var(--ko); }
.task.p2 { box-shadow: inset 3px 0 0 #DC6803; }
.tcheck { flex: 0 0 auto; display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px; padding: 0; border: 1.5px solid #98A2B3; border-radius: 50%; background: var(--white); color: transparent; cursor: pointer; transition: all .15s; }
.tcheck svg { width: 14px; height: 14px; stroke-width: 2.5; }
.tcheck:hover { border-color: var(--accent); color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tcheck[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tcheck.sm { width: 20px; height: 20px; }
.tcheck.sm svg { width: 12px; height: 12px; }
.prio { font-weight: 600; }
.prio.p3 { color: var(--ko); } .prio.p2 { color: #B54708; }
.today-tag { color: var(--accent); font-weight: 600; }

/* =========================================================
   ABITUDINI
   ========================================================= */
.habits { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.hrow { display: grid; grid-template-columns: minmax(130px, 1.6fr) repeat(7, minmax(30px, 1fr)) 76px; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--hair); }
.hrow:last-child { border-bottom: 0; }
.hhead { background: #FCFCFD; font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; }
.hhead span { display: grid; }
.hhead b { font-size: 13px; color: var(--ink-2); }
.hhead .today b { color: var(--accent); }
.hname { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 0; border: 0; background: none; text-align: left; cursor: pointer; }
.hname > span:last-child { display: grid; min-width: 0; }
.hname b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hname small { font-size: 11.5px; color: var(--muted); }
.hemoji { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; background: color-mix(in srgb, var(--c) 12%, white); font-size: 16px; }
.hday { justify-self: center; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--white); color: transparent; cursor: pointer; transition: all .15s; }
.hday svg { width: 16px; height: 16px; stroke-width: 2.4; }
.hday:hover { border-color: var(--c); }
.hday.today { border-color: color-mix(in srgb, var(--c) 50%, white); }
.hday.on { background: var(--c); border-color: var(--c); color: #fff; transform: scale(1.02); }
.hstreak { text-align: right; font-weight: 600; font-size: 14px; white-space: nowrap; }
.hstreak small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 500; }
@media (max-width: 720px) {
  .hrow { grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-areas: "n n n n n s s"; row-gap: 8px; padding: 10px; }
  .hhead { display: none; }
  .hname { grid-area: n; }
  .hstreak { grid-area: s; }
  .hday { width: 100%; max-width: 40px; height: 38px; }
}
.hmaps { display: grid; gap: 10px; }
.hmap { padding: 12px 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
.hmap p { display: flex; justify-content: space-between; margin: 0 0 8px; font-size: 13px; }
.heat { display: flex; gap: 3px; }
.heat > div { display: grid; grid-template-rows: repeat(7, 10px); gap: 3px; }
.heat i { width: 10px; height: 10px; border-radius: 2px; background: var(--panel); }
.heat i.on { background: var(--c, var(--gym)); }
.heat i.future { opacity: .35; }

/* =========================================================
   NOTE (pensieri)
   ========================================================= */
.ngrid { columns: 4 230px; column-gap: 12px; }
.ngrid > .empty { column-span: all; }
.ncard { position: relative; display: flex; flex-direction: column; gap: 6px; width: 100%; break-inside: avoid; margin: 0 0 12px; padding: 14px 14px 12px; text-align: left; cursor: pointer; background: var(--nc, var(--white)); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.ncard:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgba(16, 24, 40, .18); }
.ntitle { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
.ntext { font-size: 13px; line-height: 1.5; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.nthumb { width: 100%; display: block; border-radius: 6px; background: color-mix(in srgb, var(--white) 70%, transparent); mix-blend-mode: multiply; }
.nmeta { font-size: 11.5px; color: var(--muted); }
.npin { position: absolute; top: 10px; right: 10px; color: var(--accent); }
.npin .ic { width: 15px; height: 15px; }

.noteed { background: #ECEEF2 !important; }
.ne-head { display: flex; align-items: center; gap: 8px; height: var(--toph); padding: 0 12px; background: var(--white); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.ne-title { flex: 1; min-width: 0; border: 0; box-shadow: none; font-size: 17px; font-weight: 650; padding: 6px 8px; background: transparent; }
.ne-title:focus { box-shadow: none; background: var(--panel); }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-bg); }
.ne-modes { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--white); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: 0 0 auto; }
.ne-modes::-webkit-scrollbar { display: none; }
.ne-modes .filters { flex: 0 0 auto; margin: 0; }
.ne-modes .chip { display: inline-flex; align-items: center; gap: 6px; }
.ne-modes .chip .ic { width: 15px; height: 15px; }
.ne-textbar { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.ne-textbar button, .ne-textbar .tb-img { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: 6px; background: none; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.ne-textbar button:hover, .ne-textbar .tb-img:hover { background: var(--panel); }
.ne-textbar .mk::after { content: ""; width: 16px; height: 16px; border-radius: 4px; background: var(--c); }
.ne-textbar .tb-img .ic { width: 17px; height: 17px; }
.ne-textbar .sep, .inkbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; flex: 0 0 auto; }
.noteed[data-mode="text"] .ne-inkbar, .noteed[data-mode="draw"] .ne-textbar { display: none; }
.ne-inkbar .inkbar { border: 0; padding: 0; box-shadow: none; background: transparent; }
.ne-scroll { flex: 1; overflow-y: auto; padding: 24px 16px 80px; -webkit-overflow-scrolling: touch; }
.paper { --pc: #fff; position: relative; max-width: 860px; margin: 0 auto; background-color: var(--pc); border-radius: 4px; box-shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 0 0 1px rgba(16, 24, 40, .04); }
.paper-lines { background-image: linear-gradient(to bottom, transparent 31px, #D7E3F4 31px, #D7E3F4 32px); background-size: 100% 32px; background-position: 0 40px; }
.paper-grid { background-image: linear-gradient(#E4E9F1 1px, transparent 1px), linear-gradient(90deg, #E4E9F1 1px, transparent 1px); background-size: 24px 24px; }
.paper-dots { background-image: radial-gradient(#C7CFDB 1.2px, transparent 1.3px); background-size: 22px 22px; }
.nbody { position: relative; z-index: 1; min-height: 60vh; padding: 40px clamp(20px, 6vw, 64px) 60px; font-size: 16px; line-height: 32px; outline: none; color: var(--ink); }
.nbody:empty::before { content: attr(data-ph); color: var(--faint); }
.nbody h2 { font-size: 24px; line-height: 32px; margin: 0 0 0; font-weight: 700; letter-spacing: -.02em; }
.nbody h3 { font-size: 18px; line-height: 32px; margin: 0; font-weight: 650; }
.nbody p, .nbody div { margin: 0; }
.nbody ul, .nbody ol { margin: 0; padding-left: 24px; }
.nbody blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--ink-2); font-style: italic; }
.nbody img { max-width: 100%; border-radius: 6px; display: block; margin: 8px 0; }
.nbody ul.checklist { list-style: none; padding-left: 4px; }
.nbody ul.checklist > li { position: relative; padding-left: 28px; }
.nbody ul.checklist > li::before { content: ""; position: absolute; left: 0; top: 7px; width: 16px; height: 16px; border: 1.5px solid #98A2B3; border-radius: 4px; background: #fff; cursor: pointer; }
.nbody ul.checklist > li.checked { color: var(--muted); text-decoration: line-through; }
.nbody ul.checklist > li.checked::before { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--accent); }
.ne-ink { position: absolute; left: 0; top: 0; z-index: 2; mix-blend-mode: multiply; }
.noteed[data-mode="text"] .ne-ink { pointer-events: none !important; }
.noteed[data-mode="draw"] .nbody { user-select: none; -webkit-user-select: none; }
@media print {
  body.printing-note > *:not(dialog.print-me) { display: none !important; }
  body.printing-note dialog.print-me { position: static; display: block; height: auto; overflow: visible; background: #fff !important; }
  body.printing-note .ne-head, body.printing-note .ne-modes { display: none; }
  body.printing-note .ne-scroll { overflow: visible; padding: 0; }
  body.printing-note .paper { box-shadow: none; }
}

/* =========================================================
   BARRA STRUMENTI DI SCRITTURA (PDF e note)
   ========================================================= */
.inkbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.inkbar::-webkit-scrollbar { display: none; }
.inkbar .tools, .inkbar .acts, .inkbar .opts, .inkbar .swatches, .inkbar .sizes { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.inkbar .opts { gap: 8px; }
.inkbar button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; flex: 0 0 auto; }
.inkbar button:hover { background: var(--panel); }
.inkbar [data-tool][aria-pressed="true"] { background: var(--ink); color: #fff; }
.inkbar .sw { width: 26px; height: 26px; border-radius: 50%; position: relative; }
.inkbar .sw::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .12); }
.inkbar .sw[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); background: none; }
.inkbar .sizes button i { width: var(--s); height: var(--s); border-radius: 50%; background: var(--ink-2); }
.inkbar .sizes button[aria-pressed="true"] { background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.inkbar .hl-sw, .inkbar .pen-sw, .inkbar .sizes { display: none; }
.inkbar[data-tool="pen"] .pen-sw, .inkbar[data-tool="hl"] .hl-sw, .inkbar[data-tool="pen"] .sizes, .inkbar[data-tool="hl"] .sizes { display: flex; }
.inkbar:not([data-tool="pen"]):not([data-tool="hl"]) .opts + .sep { display: none; }
.inkbar:not([data-tool="pen"]):not([data-tool="hl"]) .opts { display: none; }
canvas.ink { touch-action: none; }

/* =========================================================
   STUDIO · stanza con PDF annotabile
   ========================================================= */
.note-item { cursor: pointer; }
.room-head { display: flex; align-items: center; gap: 10px; height: var(--toph); padding: 0 12px; background: var(--white); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.room-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.room-title h2 { margin: 0; font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-title p { margin: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pageno { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; padding: 3px 8px; border-radius: 5px; background: var(--panel); }
.pageno.saving { color: var(--accent); }
.room-tools { display: flex; align-items: center; gap: 2px; }
.ai-toggle { min-height: 34px; padding: 5px 12px; }
.room.ai-open .ai-toggle { background: var(--ink); color: #fff; border-color: var(--ink); }
.room-bar { display: flex; justify-content: center; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.room-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; position: relative; }
.pdfwrap { overflow: auto; min-height: 0; background: #E4E7EC; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pdfpages { transform-origin: 50% 0; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px 8px 120px; min-width: min-content; }
.pdfpage { position: relative; flex: 0 0 auto; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .14), 0 6px 20px -8px rgba(16, 24, 40, .2); }
.pdfpage .pdfc { position: absolute; inset: 0; width: 100%; height: 100%; }
.pdfpage .inkc { position: absolute; left: 0; top: 0; z-index: 2; mix-blend-mode: multiply; }
.pdfpage .tlayer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.pnum { position: absolute; right: -2px; bottom: -20px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.tnote { position: absolute; pointer-events: auto; display: flex; gap: 2px; min-width: 60px; padding: 4px 6px 4px 2px; background: var(--bg, #FEF7C3); border-radius: 4px; box-shadow: 0 2px 6px rgba(16, 24, 40, .18); font-family: var(--sans); line-height: 1.35; color: #101828; }
.tgrip { flex: 0 0 auto; cursor: grab; color: rgba(16, 24, 40, .35); font-size: .8em; letter-spacing: -2px; padding: 0 2px; touch-action: none; user-select: none; }
.tbody { flex: 1; min-width: 40px; outline: none; white-space: pre-wrap; word-break: break-word; }
.tdel { position: absolute; top: -9px; right: -9px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; display: none; }
.tnote:focus-within .tdel { display: block; }
.tnote:focus-within { box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(16, 24, 40, .18); }
.room-ai { display: none; flex-direction: column; min-height: 0; background: var(--white); border-left: 1px solid var(--line); padding: 0 20px; }
.room.ai-open .room-ai { display: flex; }
.room-ai .seg { margin-top: 0; flex: 0 0 auto; }
@media (min-width: 1100px) { .room.ai-open .room-body { grid-template-columns: minmax(0, 1fr) minmax(380px, 34%); } }
@media (max-width: 1099px) { .room.ai-open .room-ai { position: absolute; inset: 0; z-index: 5; border-left: 0; } }
@media (max-width: 720px) { .room-bar { justify-content: flex-start; padding: 6px 8px; } .room-title p { display: none; } .room-head { gap: 4px; padding: 0 6px; } .room-tools .icon-btn { width: 32px; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.chips .chip { border: 1px solid var(--line); background: var(--white); }
.pagelink { color: var(--accent); font-weight: 600; text-decoration: underline; padding: 0; }
.msg.pending { padding: 12px 16px; }
details.mine { margin: 16px 0; font-size: 13.5px; color: var(--ink-2); }
details.mine summary { cursor: pointer; color: var(--muted); }
#o-mic.rec { background: var(--ko-bg); color: var(--ko); border-color: #FDA29B; }

/* =========================================================
   PALESTRA
   ========================================================= */
.resume { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding: 18px 20px; background: var(--ink); color: #fff; border-radius: var(--r); box-shadow: var(--shadow-l); }
.resume h3 { margin: 4px 0 2px; font-size: 20px; font-weight: 650; }
.resume .hero-label, .resume .muted { color: #D0D5DD; padding: 0; }
.resume .btn-primary { background: var(--gym); border-color: var(--gym); }
.resume .link-btn.danger { color: #FDA29B; }
.weekcard { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 20px; margin-top: 16px; padding: 16px 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.weekcard .hero-label { padding: 0; }
.weeknum { margin: 0; font-family: var(--mono); font-size: 36px; font-weight: 500; letter-spacing: -.04em; line-height: 1.1; }
.weeknum span { font-size: .5em; color: var(--muted); }
.weekcard .week-dots { margin: 0; }
.weekcard .week-dots i { height: 12px; }
.weekcard > p { grid-column: 1 / -1; margin: 6px 0 0; }
.nextday { margin-top: 12px; padding: 16px 20px 12px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--gym); border-radius: var(--r); box-shadow: var(--shadow); }
.nextday .hero-label { padding: 0; }
.nd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 10px; }
.nd-head h3 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.nd-head .btn-primary { background: var(--gym); border-color: var(--gym); }
.nd-list { list-style: none; margin: 0; padding: 0; counter-reset: nd; }
.nd-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--hair); font-size: 13.5px; counter-increment: nd; }
.nd-list li span:first-child::before { content: counter(nd) ". "; color: var(--faint); font-family: var(--mono); font-size: 12px; }
.daygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.daycard { position: relative; display: grid; gap: 2px; padding: 14px 52px 14px 16px; text-align: left; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .15s; }
.daycard:hover { border-color: var(--gym); transform: translateY(-1px); }
.daycard.ghost { border-style: dashed; box-shadow: none; }
.dc-name { font-weight: 650; font-size: 14.5px; }
.dc-meta { font-size: 12.5px; color: var(--muted); }
.dc-go { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--gym-soft); color: var(--gym); }
.dc-go .ic { width: 14px; height: 14px; }
.bw { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bw input { width: 110px; text-align: center; font-family: var(--mono); }
.target-inline { display: flex; align-items: center; gap: 8px; margin-right: auto; font-size: 13px; }
.target-inline input { width: 64px; text-align: center; }
.day-notes { margin: 0; padding: 8px 16px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--hair); }
.add-ex { display: flex; align-items: center; gap: 6px; padding: 10px 16px !important; margin: 0 !important; color: var(--gym) !important; font-weight: 600 !important; }
.ss { display: inline-block; padding: 0 5px; border-radius: 4px; background: #F4F3FF; color: #5925DC; font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.heat-wrap { margin-top: 16px; padding: 14px 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
.heat-wrap .hero-label { padding: 0 0 8px; }
.hist-notes { margin: 0; padding: 0 16px 8px; font-size: 13px; color: var(--ink-2); font-style: italic; }
.hist-acts { display: flex; gap: 16px; padding: 4px 16px 12px; }
.edit-sets { display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.es-row { display: grid; grid-template-columns: 1fr 70px 12px 56px; gap: 6px; align-items: center; font-size: 12.5px; }
.es-row input { min-height: 34px; padding: 4px 6px; text-align: center; font-family: var(--mono); }
.prog-tools { flex-wrap: wrap; }
.prog-tools .ex-pick { margin: 0; max-width: 320px; }
.card-stats { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .card-stats { grid-template-columns: repeat(4, 1fr); } .card-stats li { border-bottom: 0; } }

/* ---------- allenamento in corso ---------- */
.workout { background: var(--bg) !important; }
.wk-head { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 10px; padding-top: env(safe-area-inset-top); background: var(--white); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.wk-title { flex: 1; min-width: 0; }
.wk-title h2 { margin: 0; font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-title p { margin: 0; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.wk-head .btn-primary { background: var(--gym); border-color: var(--gym); min-height: 38px; padding: 6px 18px; }
.wk-progress { height: 3px; background: var(--panel); flex: 0 0 auto; }
.wk-progress span { display: block; height: 100%; background: var(--gym); transition: width .4s var(--ease); }
.wk-body { flex: 1; overflow-y: auto; padding: 12px 10px 200px; -webkit-overflow-scrolling: touch; }
.wk-body > * { max-width: 680px; margin-left: auto; margin-right: auto; }
.wx { margin-bottom: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.wx.open { border-color: #FEC84B; box-shadow: 0 0 0 3px #FEF0C7, var(--shadow); }
.wx-head { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 12px; cursor: pointer; }
.wx-num { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--gym-soft); color: var(--gym); font-family: var(--mono); font-size: 13px; font-weight: 600; }
.wx.complete .wx-num { background: var(--ok); color: #fff; }
.wx.complete .wx-num svg { width: 18px; height: 18px; stroke-width: 2.5; }
.wx-title { flex: 1; min-width: 0; }
.wx-title h3 { margin: 0; font-size: 15.5px; font-weight: 650; line-height: 1.3; }
.wx-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wx-title p b { color: var(--ink-2); }
.wx-body { display: none; padding: 0 12px 10px; }
.wx.open .wx-body { display: block; }
.wx.complete:not(.open) .wx-title h3 { color: var(--muted); }
.wx-hint { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; padding: 9px 11px; border-radius: 8px; background: #F9FAFB; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.wx-hint .ic { width: 16px; height: 16px; margin-top: 1px; color: var(--gym); }
.wx-hint.up { background: var(--ok-bg); color: #05603A; }
.wx-hint.up .ic { color: var(--ok); }
.wx-note { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); font-style: italic; }
.wsets { display: grid; gap: 6px; }
.wrow { display: grid; grid-template-columns: 38px minmax(64px, 1fr) minmax(0, 1.1fr) minmax(0, 1fr) 52px; gap: 6px; align-items: center; }
.whead span { font-size: 10.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.wn { height: 44px; border: 0; border-radius: 8px; background: var(--panel); font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.t-W .wn { background: #FEF0C7; color: #93370D; }
.t-D .wn { background: #F4F3FF; color: #5925DC; }
.t-F .wn { background: var(--ko-bg); color: var(--ko); }
.wprev { height: 44px; border: 0; background: none; font-family: var(--mono); font-size: 13px; color: var(--muted); cursor: pointer; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.wprev:hover { background: var(--panel); color: var(--ink); }
.wrow input { height: 50px; min-height: 50px; padding: 4px; text-align: center; font-family: var(--mono); font-weight: 600; font-size: 19px; border-radius: 10px; border: 1.5px solid #D0D5DD; box-shadow: none; }
.wrow input::placeholder { color: #B0B8C4; font-weight: 500; }
.wrow input:focus { border-color: var(--gym); box-shadow: 0 0 0 3px #FEF0C7; }
.wdone { height: 50px; border: 1.5px solid #D0D5DD; border-radius: 10px; background: var(--white); color: #B0B8C4; cursor: pointer; display: grid; place-items: center; transition: all .15s; }
.wdone svg { width: 22px; height: 22px; stroke-width: 2.6; }
.wdone:active { transform: scale(.94); }
.wrow.done input { background: var(--ok-bg); border-color: #ABEFC6; color: #05603A; }
.wrow.done .wdone { background: var(--ok); border-color: var(--ok); color: #fff; }
.wx-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--hair); }
.wx-foot .link-btn { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--gym); }
.wx-foot .link-btn .ic { width: 15px; height: 15px; }
.wx-foot .muted { margin-left: auto; }
.addex { background: var(--white); border-style: dashed; }
.wk-notes { margin-top: 16px; }
.restbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; gap: 14px; width: min(560px, calc(100vw - 20px)); padding: 12px 14px; background: var(--ink); color: #fff; border-radius: 16px; box-shadow: 0 12px 30px -6px rgba(16, 24, 40, .5); animation: up .25s var(--ease); }
.restbar.over { background: var(--ok); }
.rest-ring { width: 48px; height: 48px; flex: 0 0 auto; }
.rest-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rest-ring circle { fill: none; stroke-width: 4; }
.rest-ring .bg { stroke: rgba(255, 255, 255, .15); }
.rest-ring .fg { stroke: #FDB022; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.rest-main { flex: 1; min-width: 0; }
.rest-lbl { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #98A2B3; }
.rest-time { margin: 0; font-family: var(--mono); font-size: 28px; font-weight: 600; line-height: 1.05; letter-spacing: -.02em; }
.rest-next { margin: 1px 0 0; font-size: 12px; color: #D0D5DD; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rest-btns { display: flex; gap: 6px; }
.rest-btns .btn { min-height: 40px; padding: 6px 10px; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .15); color: #fff; box-shadow: none; }
.rest-btns .btn-primary { background: #fff; color: var(--ink); }
@media (max-width: 480px) { .restbar { flex-wrap: wrap; } .rest-btns { width: 100%; } .rest-btns .btn { flex: 1; } }
.stepbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: #F2F4F7; border-top: 1px solid var(--line); }
.stepbar button { height: 46px; min-width: 64px; border: 1px solid #D0D5DD; border-radius: 10px; background: #fff; font-size: 24px; font-weight: 500; cursor: pointer; }
.stepbar button:active { background: var(--panel); }
.stepbar span { flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.stepbar .done { font-size: 14px; font-weight: 600; background: var(--ink); color: #fff; border-color: var(--ink); padding: 0 16px; }
.workout:has(.stepbar:not([hidden])) .restbar { display: none; }
.wk-summary { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(16, 24, 40, .5); overflow-y: auto; }
.wk-sum-card { display: grid; gap: 12px; width: min(460px, 100%); padding: 22px 20px; background: var(--white); border-radius: 16px; box-shadow: var(--shadow-l); animation: pop .25s var(--ease); }
.wk-sum-card .hero-label { padding: 0; color: var(--ok); }
.wk-sum-card h2 { margin: -6px 0 0; font-size: 22px; font-weight: 650; }
.sum-stats { border: 1px solid var(--line); border-radius: var(--r); grid-template-columns: repeat(2, 1fr) !important; }
.sum-stats li:nth-child(2n) { border-right: 0 !important; }
.sum-stats li:nth-child(n+3) { border-bottom: 0; }
.prs { padding: 10px 12px; border-radius: 8px; background: #FFFAEB; font-size: 13px; }
.prs p { margin: 0 0 4px; } .prs ul { margin: 0; padding-left: 18px; }
.rating { display: flex; gap: 6px; }
.rating button { flex: 1; height: 46px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); font-size: 22px; cursor: pointer; filter: grayscale(1); opacity: .6; }
.rating button[aria-pressed="true"] { filter: none; opacity: 1; border-color: var(--gym); background: var(--gym-soft); }
.sum-btns { justify-content: space-between; }

/* =========================================================
   CLOUD
   ========================================================= */
.cl-tools { flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-right: auto; min-width: 0; font-size: 14px; }
.crumbs button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.crumbs button:hover { background: var(--panel); }
.crumbs button:last-child { color: var(--ink); }
.crumbs span { color: var(--faint); }
.usebar { display: inline-block; width: 80px; height: 5px; margin-left: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; vertical-align: middle; }
.usebar i { display: block; height: 100%; background: var(--accent); }
.cl-list.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cl-item { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); transition: border-color .15s; min-width: 0; }
.cl-item:hover { border-color: #98A2B3; }
.cl-item > .icon-btn { position: absolute; top: 6px; right: 6px; background: rgba(255, 255, 255, .85); }
.cl-open { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 18px 10px 12px; border: 0; background: none; cursor: pointer; text-align: center; min-width: 0; }
.cl-open > .ic { width: 40px; height: 40px; stroke-width: 1.3; color: var(--muted); margin-bottom: 4px; }
.folder .cl-open > .ic { color: #F79009; fill: #FEF0C7; }
.cl-open img { width: 100%; height: 96px; object-fit: cover; border-radius: 6px; margin-bottom: 4px; background: var(--panel); }
.cl-open .ext { position: absolute; top: 46px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: var(--accent); letter-spacing: .03em; }
.cl-name { max-width: 100%; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.k-pdf .cl-open > .ic { color: #D92D20; } .k-image .cl-open > .ic { color: #7A5AF8; } .k-office .cl-open > .ic { color: #1570EF; } .k-text .cl-open > .ic { color: #0E9384; }
.cl-list.rows { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.cl-list.rows .cl-item { border: 0; border-bottom: 1px solid var(--hair); border-radius: 0; box-shadow: none; }
.cl-list.rows .cl-item:last-child { border-bottom: 0; }
.cl-list.rows .cl-open { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 48px 10px 14px; text-align: left; }
.cl-list.rows .cl-open > .ic { width: 22px; height: 22px; margin: 0; }
.cl-list.rows .cl-open img { width: 32px; height: 32px; margin: 0; }
.cl-list.rows .cl-name { flex: 1; }
.cl-list.rows .ext { display: none; }
.cl-list.rows .cl-item > .icon-btn { top: 50%; transform: translateY(-50%); }
.cl-hint { margin-top: 14px; }
.queue { margin-bottom: 12px; padding: 12px 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); }
.q-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.q-bar { height: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; }
.q-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.queue ul { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; }
.preview { background: #101828 !important; color: #fff; }
.pv-head { display: flex; align-items: center; gap: 10px; height: var(--toph); padding: 0 12px; background: #1D2939; flex: 0 0 auto; }
.pv-head .icon-btn { color: #D0D5DD; }
.pv-title { flex: 1; min-width: 0; display: grid; }
.pv-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pv-title small { color: #98A2B3 !important; font-size: 12px; }
.pv-body { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; padding: 12px; }
.pv-body img, .pv-body video { max-width: 100%; max-height: calc(100dvh - 90px); border-radius: 6px; }
.pv-body iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 4px; }
.pv-body .code { width: 100%; height: 100%; margin: 0; padding: 16px; overflow: auto; background: #0C111D; color: #E4E7EC; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; border-radius: 6px; white-space: pre; place-self: stretch; }
.pv-body .empty { background: #1D2939; border-color: #344054; color: #D0D5DD; }
.pv-body .empty p { color: #D0D5DD; }

/* =========================================================
   SPESE
   ========================================================= */
.mnav { display: flex; align-items: center; gap: 4px; }
.mnav h2 { min-width: 0; }
.spend { display: grid; grid-template-columns: auto 1fr 1.4fr auto auto; gap: 8px; align-items: center; margin-top: 16px; padding: 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.spend .catpick { grid-column: 1 / -1; display: flex; gap: 4px; flex-wrap: wrap; order: 9; }
.spend .catpick .chip { border: 1px solid var(--line); }
.spend .amt { font-family: var(--mono); font-size: 18px; font-weight: 600; text-align: right; }
.seg-k { display: inline-flex; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.seg-k button { border: 0; background: none; padding: 6px 10px; border-radius: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-k button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
@media (max-width: 720px) { .spend { grid-template-columns: 1fr 1fr; } .spend .seg-k { grid-column: 1 / -1; justify-self: start; } .spend input[name="note"] { grid-column: 1 / -1; } .spend .btn { grid-column: 1 / -1; order: 10; } }
.cats { display: grid; gap: 8px; padding: 14px 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); }
.catrow { display: grid; grid-template-columns: 140px 1fr 90px; gap: 12px; align-items: center; font-size: 13.5px; }
.catrow b { text-align: right; font-family: var(--mono); font-weight: 500; }
.catbar { height: 8px; border-radius: 4px; background: var(--panel); overflow: hidden; }
.catbar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.item.mv { grid-template-columns: 1fr auto; grid-template-areas: "main price"; cursor: pointer; }

/* =========================================================
   IMPOSTAZIONI
   ========================================================= */
.set-card { margin-top: 14px; padding: 18px 20px; max-width: 760px; }
.set-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 15px; font-weight: 650; }
.set-card > p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; }
.set-card .fields { padding: 0; }
.set-card code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; background: var(--panel); border-radius: 4px; }
details.mini { margin-top: 12px; }
details.mini summary { cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 500; }
a.btn, a.link-btn, a.act { text-decoration: none; }

.workout:has(.wk-summary) .restbar { display: none; }
.wk-body > .btn { display: flex; }

@media (max-width: 720px) { .hday:not(.on)::before { content: attr(data-wd); font-size: 10.5px; font-weight: 600; color: var(--faint); } .hday:not(.on) svg { display: none; } }
