/* =========================================================
   Studio — stile iOS
   ========================================================= */

:root {
  --accent: #007AFF;
  --bg: #F2F2F7;
  --bg2: #FFFFFF;
  --bg3: #F2F2F7;
  --elevated: #FFFFFF;
  --label: #000000;
  --label2: rgba(60, 60, 67, .6);
  --label3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .29);
  --sep-opaque: #C6C6C8;
  --fill: rgba(120, 120, 128, .2);
  --fill2: rgba(120, 120, 128, .16);
  --fill3: rgba(118, 118, 128, .12);
  --chrome: rgba(249, 249, 249, .82);
  --chrome-border: rgba(0, 0, 0, .3);
  --red: #FF3B30;
  --orange: #FF9500;
  --yellow: #FFCC00;
  --green: #34C759;
  --mint: #00C7BE;
  --teal: #30B0C7;
  --cyan: #32ADE6;
  --blue: #007AFF;
  --indigo: #5856D6;
  --purple: #AF52DE;
  --pink: #FF2D55;
  --brown: #A2845E;
  --gray: #8E8E93;
  --ring-a: #2BD45B;
  --ring-b: #A3F23A;
  --ring-track: rgba(52, 199, 89, .16);
  --goal-a: #0A84FF;
  --goal-b: #5AC8FA;
  --goal-track: rgba(10, 132, 255, .14);
  --shadow-card: 0 1px 0 rgba(0,0,0,.02);
  --tab-h: 50px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --hour-h: 52px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg2: #1C1C1E; --bg3: #2C2C2E; --elevated: #1C1C1E;
    --label: #FFFFFF; --label2: rgba(235, 235, 245, .6); --label3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .65); --sep-opaque: #38383A;
    --fill: rgba(120, 120, 128, .36); --fill2: rgba(120, 120, 128, .32); --fill3: rgba(118, 118, 128, .24);
    --chrome: rgba(22, 22, 22, .8); --chrome-border: rgba(255, 255, 255, .15);
    --red: #FF453A; --orange: #FF9F0A; --yellow: #FFD60A; --green: #30D158; --mint: #63E6E2;
    --teal: #40C8E0; --cyan: #64D2FF; --blue: #0A84FF; --indigo: #5E5CE6; --purple: #BF5AF2;
    --pink: #FF375F; --brown: #AC8E68; --gray: #8E8E93;
    --ring-track: rgba(48, 209, 88, .2); --goal-track: rgba(10, 132, 255, .22);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg2: #1C1C1E; --bg3: #2C2C2E; --elevated: #1C1C1E;
  --label: #FFFFFF; --label2: rgba(235, 235, 245, .6); --label3: rgba(235, 235, 245, .3);
  --sep: rgba(84, 84, 88, .65); --sep-opaque: #38383A;
  --fill: rgba(120, 120, 128, .36); --fill2: rgba(120, 120, 128, .32); --fill3: rgba(118, 118, 128, .24);
  --chrome: rgba(22, 22, 22, .8); --chrome-border: rgba(255, 255, 255, .15);
  --red: #FF453A; --orange: #FF9F0A; --yellow: #FFD60A; --green: #30D158; --mint: #63E6E2;
  --teal: #40C8E0; --cyan: #64D2FF; --blue: #0A84FF; --indigo: #5E5CE6; --purple: #BF5AF2;
  --pink: #FF375F; --brown: #AC8E68; --gray: #8E8E93;
  --ring-track: rgba(48, 209, 88, .2); --goal-track: rgba(10, 132, 255, .22);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.29;
  letter-spacing: -0.41px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
svg { display: block; }
.hidden { display: none !important; }
.muted { color: var(--label2); }
.tint { color: var(--accent); }
.red { color: var(--red); } .green { color: var(--green); } .orange { color: var(--orange); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; transition: transform .45s cubic-bezier(.32,.72,0,1), border-radius .45s, filter .45s; transform-origin: 50% 0; background: var(--bg); }
body.sheet-open .shell { transform: scale(.94) translateY(calc(var(--safe-t) + 10px)); border-radius: 12px; overflow: hidden; height: 100vh; filter: brightness(.82); }
@media (min-width: 900px) { body.sheet-open .shell { transform: none; border-radius: 0; filter: none; height: auto; } }

.stage { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 24px); min-height: 100vh; }

/* ---------- Nav bar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(44px + var(--safe-t)); padding-top: var(--safe-t);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding-left: 8px; padding-right: 8px;
  background: transparent;
  transition: background .2s, box-shadow .2s;
}
.navbar.scrolled, .navbar.solid {
  background: var(--chrome);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 var(--chrome-border);
}
.nav-title { font-weight: 600; font-size: 17px; text-align: center; opacity: 0; transition: opacity .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.navbar.scrolled .nav-title, .navbar.solid .nav-title { opacity: 1; }
.nav-left, .nav-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nav-right { justify-content: flex-end; }
.nav-btn { color: var(--accent); font-size: 17px; height: 44px; padding: 0 8px; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.nav-btn:active { opacity: .4; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.icon { width: 44px; justify-content: center; padding: 0; }
.nav-btn.back svg { width: 13px; height: 21px; margin-right: 4px; }
.nav-btn.bold { font-weight: 600; }

.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; margin: 0; padding: 0 16px 8px; }
.title-eyebrow { font-size: 13px; font-weight: 600; color: var(--label2); text-transform: uppercase; letter-spacing: -.08px; padding: 0 16px; margin-top: 2px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--chrome);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -.5px 0 var(--chrome-border);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; gap: 2px; color: var(--gray); font-size: 10px; font-weight: 500; letter-spacing: .1px; position: relative; }
.tab svg { width: 25px; height: 25px; }
.tab.active { color: var(--accent); }
.badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 13px; font-weight: 500; line-height: 18px; text-align: center; padding: 0 5px; letter-spacing: 0; }

/* ---------- Sidebar (iPad / desktop) ---------- */
.sidebar { display: none; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .stage { padding-bottom: 40px; margin-left: 300px; }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; width: 300px; z-index: 25;
    background: var(--bg); border-right: .5px solid var(--sep); padding: calc(var(--safe-t) + 18px) 12px 18px; overflow-y: auto;
  }
  :root[data-theme="dark"] .sidebar { background: #111; }
  .side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; }
  .side-brand .logo { width: 44px; height: 44px; border-radius: 11px; }
  .side-brand b { font-size: 22px; font-weight: 700; letter-spacing: .35px; display: block; }
  .side-brand small { color: var(--label2); font-size: 13px; }
  .side-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; font-size: 17px; color: var(--label); position: relative; }
  .side-item svg { width: 24px; height: 24px; color: var(--accent); }
  .side-item.active { background: var(--accent); color: #fff; }
  .side-item.active svg { color: #fff; }
  .side-item .count { margin-left: auto; color: var(--label2); font-size: 15px; }
  .side-item.active .count { color: rgba(255,255,255,.8); }
  .side-sep { height: 18px; }
  .side-foot { margin-top: auto; padding: 12px; color: var(--label2); font-size: 12px; }
  .page-wrap { max-width: 980px; margin: 0 auto; }
}

/* ---------- Grouped lists ---------- */
.section { margin: 0 16px 0; }
.section + .section { margin-top: 0; }
.group-header { font-size: 13px; line-height: 18px; color: var(--label2); text-transform: uppercase; letter-spacing: -.08px; padding: 0 16px 7px; margin: 24px 16px 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.group-header .action { text-transform: none; color: var(--accent); font-size: 15px; }
.group-header.big { text-transform: none; font-size: 20px; line-height: 25px; font-weight: 600; color: var(--label); letter-spacing: .38px; padding-left: 4px; }
.group-footer { font-size: 13px; line-height: 18px; color: var(--label2); padding: 7px 16px 0; margin: 0 16px; letter-spacing: -.08px; }
.list { background: var(--bg2); border-radius: 10px; overflow: hidden; margin: 0 16px; }
.group-header + .list { margin-top: 0; }
.list.first { margin-top: 18px; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 16px; background: var(--bg2); width: 100%; text-align: left;
}
.row + .row::before, .row + .row-sub::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: .5px; background: var(--sep); transform: scaleY(1); }
.row.has-icon + .row::before, .row + .row.has-icon::before { left: 57px; }
.row.has-avatar + .row::before, .row + .row.has-avatar::before { left: 64px; }
button.row:active, .row.tap:active, a.row:active { background: var(--fill); }
.row-icon { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.row-icon svg { width: 18px; height: 18px; }
.row-main { flex: 1; min-width: 0; padding: 11px 0; }
.row-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 15px; color: var(--label2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row-sub svg { width: 13px; height: 13px; flex: none; }
.row-detail { color: var(--label2); font-size: 17px; white-space: nowrap; flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.row-trail { display: flex; align-items: center; gap: 10px; flex: none; }
.chev { width: 8px; height: 14px; color: var(--label3); flex: none; }
.row.center { justify-content: center; color: var(--accent); }
.row.destructive { color: var(--red); justify-content: center; }
.row.action { color: var(--accent); }
.row.action svg { width: 20px; height: 20px; }
.row.empty { color: var(--label2); font-size: 15px; justify-content: center; min-height: 52px; }

/* inputs inside rows */
.row label.lbl { flex: none; min-width: 96px; }
.row input.field, .row select.field, .row textarea.field {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; padding: 11px 0; text-align: right; color: var(--label2);
  -webkit-appearance: none; appearance: none;
}
.row input.field:focus, .row textarea.field:focus { color: var(--label); }
.row input.field.left, .row textarea.field.left { text-align: left; color: var(--label); }
.row input.field::placeholder, .row textarea.field::placeholder { color: var(--label3); }
.row textarea.field { min-height: 96px; resize: none; text-align: left; color: var(--label); line-height: 1.35; }
.row select.field { direction: rtl; padding-right: 2px; cursor: pointer; }
.row select.field option { direction: ltr; }
.row .field-chev { width: 8px; height: 14px; color: var(--label3); margin-left: -6px; flex: none; }
.row input[type="date"].field, .row input[type="time"].field, .row input[type="month"].field, .row input[type="datetime-local"].field { color: var(--label); }
.pickers { display: flex; gap: 6px; flex: none; }
.chip-input {
  background: var(--fill3); border-radius: 6px; padding: 6px 11px; border: 0; outline: 0; font-size: 17px; color: var(--label);
  -webkit-appearance: none; appearance: none; min-height: 34px; font-variant-numeric: tabular-nums;
}
.chip-input:focus { color: var(--accent); }
input[type="date"].chip-input::-webkit-calendar-picker-indicator,
input[type="time"].chip-input::-webkit-calendar-picker-indicator { display: none; }
.req { color: var(--red); margin-left: 2px; }

/* Switch */
.switch { -webkit-appearance: none; appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill); position: relative; flex: none; cursor: pointer; transition: background .25s; outline: 0; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 3px 1px rgba(0,0,0,.06); transition: transform .25s cubic-bezier(.3,.7,.4,1); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* Segmented control */
.seg { display: flex; background: var(--fill3); border-radius: 9px; padding: 2px; position: relative; margin: 0 16px; }
.seg button { flex: 1; height: 28px; font-size: 13px; font-weight: 500; border-radius: 7px; position: relative; z-index: 1; letter-spacing: -.08px; white-space: nowrap; }
.seg button.on { background: var(--elevated); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); font-weight: 600; }
:root[data-theme="dark"] .seg button.on { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { background: #636366; } }
.seg.compact { margin: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 50px; border-radius: 12px; padding: 0 20px; font-size: 17px; font-weight: 600; background: var(--accent); color: #fff; width: 100%; }
.btn:active { opacity: .7; }
.btn.gray { background: var(--fill3); color: var(--accent); }
.btn.small { height: 34px; border-radius: 17px; font-size: 15px; padding: 0 14px; width: auto; }
.btn.tinted { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.btn svg { width: 18px; height: 18px; }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 13px; font-weight: 600; letter-spacing: -.08px; white-space: nowrap; }
.pill.paid { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.pill.due { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.pill.loan { background: var(--fill3); color: var(--label2); }
.pill.status { font-weight: 500; }
.pill svg { width: 12px; height: 12px; }
button.pill:active { opacity: .5; }

.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 15px; flex: none; letter-spacing: 0; background: linear-gradient(180deg, #A5ABB6, #858994); }
.avatar.xl { width: 84px; height: 84px; font-size: 34px; }

/* Search field */
.search { margin: 2px 16px 10px; display: flex; align-items: center; gap: 6px; background: var(--fill3); border-radius: 10px; height: 36px; padding: 0 8px; color: var(--label2); }
.search svg { width: 16px; height: 16px; flex: none; }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--label); min-width: 0; }
.search input::placeholder { color: var(--label2); }

/* Cards (dashboard) */
.cards { display: grid; gap: 16px; margin: 0 16px; }
@media (min-width: 700px) { .cards.two { grid-template-columns: 1fr 1fr; } }
.card { background: var(--bg2); border-radius: 16px; padding: 16px; position: relative; overflow: hidden; }
.card.tap:active { transform: scale(.985); transition: transform .1s; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.card-title svg { width: 17px; height: 17px; }
.card-meta { font-size: 15px; color: var(--label2); display: flex; align-items: center; gap: 4px; }
.card-meta .chev { color: var(--label3); }

.ring-wrap { display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }
.ring { position: relative; }
.ring svg { transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; }
.ring .track { stroke: var(--ring-track); }
.ring .prog { transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 22%; }
.ring-value { font-size: 34px; font-weight: 700; letter-spacing: .3px; font-variant-numeric: tabular-nums; line-height: 1.05; white-space: nowrap; }
.ring-caption { font-size: 13px; color: var(--label2); margin-top: 4px; line-height: 1.25; }
.ring.goal .track { stroke: var(--goal-track); }
.ring.small .ring-value { font-size: 20px; }
.ring.small .ring-caption { font-size: 12px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: var(--bg3); border-radius: 12px; padding: 10px 12px; min-width: 0; }
:root[data-theme="dark"] .stat { background: #2C2C2E; }
.stat .k { font-size: 12px; color: var(--label2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 19px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .1px; }

.goal-line { display: flex; align-items: center; gap: 18px; }
.goal-text b { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.goal-text .of { color: var(--label2); font-size: 17px; font-weight: 600; }
.goal-text .hint { color: var(--label2); font-size: 15px; margin-top: 4px; }
.progress { height: 8px; border-radius: 4px; background: var(--goal-track); overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--goal-a), var(--goal-b)); transition: width .8s cubic-bezier(.2,.8,.2,1); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; margin-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar i { width: 100%; max-width: 22px; border-radius: 4px 4px 2px 2px; background: var(--fill); min-height: 2px; transition: height .8s cubic-bezier(.2,.8,.2,1); }
.bar.cur i { background: linear-gradient(180deg, var(--ring-b), var(--ring-a)); }
.bar.has i { background: color-mix(in srgb, var(--green) 55%, var(--fill)); }
.bar span { font-size: 11px; color: var(--label2); font-weight: 500; }
.bar.cur span { color: var(--label); font-weight: 700; }

.mini-ev { display: flex; gap: 10px; padding: 7px 0; align-items: stretch; }
.mini-ev + .mini-ev { border-top: .5px solid var(--sep); }
.mini-ev .bar-c { width: 4px; border-radius: 2px; flex: none; }
.mini-ev .t { font-size: 15px; font-weight: 600; }
.mini-ev .s { font-size: 13px; color: var(--label2); }

/* Month switcher */
.month-switch { display: flex; align-items: center; justify-content: space-between; margin: 4px 16px 12px; }
.month-switch .label { font-size: 20px; font-weight: 600; letter-spacing: .38px; position: relative; }
.month-switch .label input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.month-switch .arrows { display: flex; gap: 4px; }
.circle-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--fill3); color: var(--accent); display: grid; place-items: center; }
.circle-btn svg { width: 14px; height: 14px; }
.circle-btn:active { opacity: .5; }

/* Summary card in pagamenti */
.summary { background: var(--bg2); border-radius: 16px; margin: 0 16px; padding: 16px; }
.summary .big { font-size: 34px; font-weight: 700; letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.summary .cap { font-size: 13px; color: var(--label2); font-weight: 500; text-transform: uppercase; }

/* Client section header */
.client-head { display: flex; align-items: center; gap: 8px; margin: 26px 16px 7px; padding: 0 4px; }
.client-head .name { font-size: 20px; font-weight: 700; letter-spacing: .38px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-head .tot { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.client-head button.name { text-align: left; }
.client-head .avatar { width: 28px; height: 28px; font-size: 12px; }

.video-row .price { font-size: 17px; font-variant-numeric: tabular-nums; }
.video-row .row-title.untitled { color: var(--label3); font-style: italic; }
.flag { color: var(--orange); display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; }
.flag svg { width: 13px; height: 13px; }

.disclosure { display: flex; align-items: center; gap: 6px; margin: 30px 16px 4px; padding: 0 4px; color: var(--label2); font-size: 20px; font-weight: 700; letter-spacing: .38px; }
.disclosure svg { width: 14px; height: 14px; color: var(--accent); transition: transform .2s; }
.disclosure.open svg { transform: rotate(90deg); }

/* Empty states */
.empty-state { text-align: center; padding: 60px 32px; color: var(--label2); }
.empty-state svg { width: 56px; height: 56px; margin: 0 auto 14px; color: var(--label3); }
.empty-state h3 { color: var(--label); font-size: 22px; font-weight: 700; margin: 0 0 6px; letter-spacing: .35px; }
.empty-state p { margin: 0 0 18px; font-size: 15px; }

/* Status chips colors */
.st-lungo { --c: var(--green); } .st-amico { --c: var(--pink); } .st-breve { --c: var(--blue); }
.st-dacapire { --c: var(--orange); } .st-inattivo { --c: var(--gray); }
.pill.status { background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }

/* ---------- Sheets ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; }
.backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.0); transition: background .35s; }
.overlay.in .backdrop { background: rgba(0,0,0,.25); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; top: calc(var(--safe-t) + 18px);
  background: var(--bg); border-radius: 12px 12px 0 0; display: flex; flex-direction: column;
  transform: translateY(105%); transition: transform .45s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -2px 20px rgba(0,0,0,.12); overflow: hidden;
}
:root[data-theme="dark"] .sheet { background: #1C1C1E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet { background: #1C1C1E; } }
:root[data-theme="dark"] .sheet .list, :root[data-theme="dark"] .sheet .row { background: #2C2C2E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet .list, :root:not([data-theme="light"]) .sheet .row { background: #2C2C2E; } }
.overlay.in .sheet { transform: translateY(0); }
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 56px; padding: 0 8px; flex: none; position: relative; }
.sheet-bar .grab { position: absolute; top: 5px; left: 50%; width: 36px; height: 5px; border-radius: 3px; background: var(--fill); transform: translateX(-50%); }
.sheet-bar .ttl { font-weight: 600; font-size: 17px; text-align: center; }
.sheet-bar .nav-btn:disabled { color: var(--label3); }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(40px + var(--safe-b)); }
.sheet-body .group-header:first-child, .sheet-body .list:first-child { margin-top: 8px; }
.sheet-body .list + .list { margin-top: 28px; }
.sheet-body .group-footer + .list { margin-top: 28px; }
@media (min-width: 900px) {
  .sheet { left: 50%; top: 50%; bottom: auto; width: 560px; max-height: 86vh; border-radius: 14px; transform: translate(-50%, -40%) scale(.96); opacity: 0; transition: transform .3s cubic-bezier(.32,.72,0,1), opacity .2s; }
  .overlay.in .sheet { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet-body { padding-bottom: 28px; }
  .sheet.tall { height: 86vh; }
}

/* Action sheet */
.asheet { position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); transform: translateY(120%); transition: transform .4s cubic-bezier(.32,.72,0,1); max-width: 520px; margin: 0 auto; }
.overlay.in .asheet { transform: translateY(0); }
.asheet .grp { background: rgba(250,250,250,.86); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); border-radius: 14px; overflow: hidden; }
:root[data-theme="dark"] .asheet .grp { background: rgba(40,40,40,.86); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .asheet .grp { background: rgba(40,40,40,.86); } }
.asheet .grp + .grp { margin-top: 8px; }
.asheet .head { text-align: center; padding: 14px 16px; font-size: 13px; color: var(--label2); border-bottom: .5px solid var(--sep); }
.asheet .head b { display: block; font-weight: 600; margin-bottom: 2px; }
.asheet button { display: block; width: 100%; height: 57px; font-size: 20px; color: var(--accent); letter-spacing: .38px; }
.asheet button + button { border-top: .5px solid var(--sep); }
.asheet button.destructive { color: var(--red); }
.asheet button.cancel { font-weight: 600; }
.asheet .grp.cancel-grp { background: var(--elevated); }
:root[data-theme="dark"] .asheet .grp.cancel-grp { background: #2C2C2E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .asheet .grp.cancel-grp { background: #2C2C2E; } }
.asheet button:active { background: var(--fill2); }

/* Alert */
.alert { position: absolute; left: 50%; top: 50%; width: 270px; transform: translate(-50%, -50%) scale(1.15); opacity: 0; transition: transform .25s cubic-bezier(.3,.8,.3,1), opacity .2s; background: rgba(242,242,242,.88); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); border-radius: 14px; text-align: center; overflow: hidden; }
:root[data-theme="dark"] .alert { background: rgba(37,37,37,.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .alert { background: rgba(37,37,37,.9); } }
.overlay.in .alert { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.alert .content { padding: 19px 16px 18px; }
.alert h4 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.alert p { margin: 0; font-size: 13px; line-height: 1.35; letter-spacing: -.08px; }
.alert input { width: 100%; margin-top: 14px; height: 30px; border-radius: 7px; border: .5px solid var(--sep); background: var(--bg2); padding: 0 8px; font-size: 13px; outline: 0; }
.alert .btns { display: flex; border-top: .5px solid var(--sep); }
.alert .btns.stack { flex-direction: column; }
.alert .btns button { flex: 1; height: 44px; color: var(--accent); font-size: 17px; }
.alert .btns button + button { border-left: .5px solid var(--sep); }
.alert .btns.stack button + button { border-left: 0; border-top: .5px solid var(--sep); }
.alert .btns button.bold { font-weight: 600; }
.alert .btns button.destructive { color: var(--red); }
.alert .btns button:active { background: var(--fill2); }

/* Toast / banner */
.toast-host { position: fixed; top: calc(var(--safe-t) + 8px); left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 8px; }
.toast { pointer-events: auto; max-width: 420px; width: 100%; background: rgba(245,245,245,.9); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); border-radius: 18px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.18); transform: translateY(-140%); transition: transform .45s cubic-bezier(.32,.72,0,1); }
:root[data-theme="dark"] .toast { background: rgba(44,44,46,.92); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: rgba(44,44,46,.92); } }
.toast.in { transform: translateY(0); }
.toast .ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.toast .ic svg { width: 20px; height: 20px; }
.toast b { display: block; font-size: 15px; font-weight: 600; }
.toast span { font-size: 15px; color: var(--label); line-height: 1.25; }
.toast small { color: var(--label2); font-size: 13px; display: block; }

/* ---------- Calendario ---------- */
.cal-top { position: sticky; top: calc(44px + var(--safe-t)); z-index: 15; background: var(--bg2); }
.cal-head-title { font-size: 34px; font-weight: 700; letter-spacing: .37px; padding: 0 16px 6px; }
.cal-head-title .yr { color: var(--red); }
.cal-seg { padding: 6px 0 10px; background: var(--bg2); }
.page-cal { background: var(--bg2); min-height: 100vh; }
.page-cal .navbar.scrolled, .page-cal .navbar.solid { background: var(--bg2); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.wk-head { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 13px; text-align: center; color: var(--label); padding: 4px 0 6px; border-bottom: .5px solid var(--sep); background: var(--bg2); }
.wk-head span.we { color: var(--label2); }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.mcell { border-top: .5px solid var(--sep); min-height: 64px; padding: 6px 1px 4px; display: flex; flex-direction: column; align-items: center; cursor: pointer; position: relative; min-width: 0; }
.mcell.other { visibility: hidden; }
.mcell .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 400; letter-spacing: .38px; font-variant-numeric: tabular-nums; }
.mcell.we .n { color: var(--label2); }
.mcell.today .n { color: var(--red); font-weight: 600; }
.mcell.sel .n { background: var(--label); color: var(--bg2); font-weight: 600; }
.mcell.sel.today .n { background: var(--red); color: #fff; }
.mcell .dots { display: flex; gap: 3px; margin-top: 4px; height: 6px; }
.mcell .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gray); }
.mcell .pills { display: none; width: 100%; flex-direction: column; gap: 2px; margin-top: 3px; padding: 0 3px; }
.mcell .pills div { font-size: 11px; line-height: 15px; border-radius: 4px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.mcell .pills .more { color: var(--label2); background: none; }
@media (min-width: 700px) {
  .mcell { min-height: 108px; align-items: stretch; }
  .mcell .n { align-self: flex-end; font-size: 17px; width: 28px; height: 28px; margin-right: 4px; }
  .mcell .dots { display: none; }
  .mcell .pills { display: flex; }
  .mcell.other { visibility: visible; opacity: .35; }
}

.day-list { padding-bottom: 20px; }
.day-list-head { font-size: 15px; font-weight: 600; color: var(--label2); padding: 14px 16px 6px; border-top: .5px solid var(--sep); }
.ev-item { display: flex; gap: 12px; padding: 9px 16px; align-items: stretch; cursor: pointer; width: 100%; text-align: left; }
.ev-item:active { background: var(--fill2); }
.ev-item .cb { width: 4px; border-radius: 2px; flex: none; }
.ev-item .main { flex: 1; min-width: 0; }
.ev-item .t { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-item .l { font-size: 15px; color: var(--label2); }
.ev-item .tm { font-size: 15px; color: var(--label2); text-align: right; flex: none; font-variant-numeric: tabular-nums; line-height: 1.3; }
.ev-item .rep { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--label2); }
.ev-item .rep svg { width: 13px; height: 13px; }
.no-ev { color: var(--label2); text-align: center; padding: 28px 16px; font-size: 17px; }

/* week strip in day view */
.wstrip { display: grid; grid-template-columns: repeat(7, 1fr); padding: 2px 4px 6px; background: var(--bg2); }
.wstrip .d { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.wstrip .d small { font-size: 10px; font-weight: 600; color: var(--label2); }
.wstrip .d b { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 400; font-variant-numeric: tabular-nums; }
.wstrip .d.today b { color: var(--red); font-weight: 600; }
.wstrip .d.sel b { background: var(--label); color: var(--bg2); font-weight: 600; }
.wstrip .d.sel.today b { background: var(--red); color: #fff; }
.day-caption { text-align: center; font-size: 15px; padding: 6px 0 8px; border-bottom: .5px solid var(--sep); background: var(--bg2); }

.allday { display: flex; border-bottom: .5px solid var(--sep); min-height: 26px; background: var(--bg2); }
.allday .lbl { width: 54px; flex: none; font-size: 11px; color: var(--label2); padding: 5px 0 0 8px; }
.allday .items { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 3px 4px 3px 0; min-width: 0; }
.allday.week .items { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.allday .chipev { font-size: 12px; font-weight: 600; border-radius: 4px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

.timeline { position: relative; height: calc(var(--hour-h) * 24 + 20px); margin-top: 0; user-select: none; -webkit-user-select: none; }
.timeline .hr { position: absolute; left: 0; right: 0; height: 0; }
.timeline .hr span { position: absolute; left: 6px; top: -7px; font-size: 11px; color: var(--label2); width: 44px; font-variant-numeric: tabular-nums; }
.timeline .hr::after { content: ""; position: absolute; left: 54px; right: 0; top: 0; border-top: .5px solid var(--sep); }
.timeline.week .hr span { width: 36px; left: 4px; }
.timeline.week .hr::after { left: 44px; }
.timeline .slots { position: absolute; left: 54px; right: 0; top: 10px; bottom: 10px; cursor: pointer; }
.timeline.week .slots { left: 44px; }
.timeline .vlines { position: absolute; left: 44px; right: 0; top: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(7, 1fr); pointer-events: none; }
.timeline .vlines i { border-left: .5px solid var(--sep); }
.timeline .vlines i.today { background: color-mix(in srgb, var(--red) 4%, transparent); }
.evb {
  position: absolute; border-radius: 5px; padding: 3px 6px 3px 8px; overflow: hidden; cursor: pointer; font-size: 12px; line-height: 15px;
  touch-action: pan-y; transition: box-shadow .15s, transform .05s; z-index: 2;
}
.evb::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ec); }
.evb b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evb small { display: block; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evb.lifted { z-index: 10; box-shadow: 0 10px 25px rgba(0,0,0,.25); opacity: .95; transition: none; }
.evb .grip { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; cursor: ns-resize; }
.evb.lifted .grip::after { content: ""; position: absolute; right: 8px; bottom: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--bg2); border: 2px solid var(--ec); }
.nowline { position: absolute; left: 50px; right: 0; height: 0; border-top: 1.5px solid var(--red); z-index: 5; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.nowlabel { position: absolute; left: 4px; font-size: 11px; font-weight: 600; color: var(--red); background: var(--bg2); z-index: 6; padding: 0 2px; transform: translateY(-50%); font-variant-numeric: tabular-nums; pointer-events: none; }
.timeline.week .nowline { left: 40px; }
.drag-time { position: absolute; left: 4px; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--bg2); z-index: 11; transform: translateY(-50%); pointer-events: none; padding: 0 2px; }

.week-head { display: grid; grid-template-columns: 44px repeat(7, 1fr); background: var(--bg2); border-bottom: .5px solid var(--sep); padding: 4px 0 6px; }
.week-head .d { text-align: center; cursor: pointer; }
.week-head .d small { display: block; font-size: 11px; color: var(--label2); font-weight: 600; }
.week-head .d b { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; font-weight: 400; }
.week-head .d.today b { background: var(--red); color: #fff; font-weight: 600; }

.year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 14px; padding: 6px 14px 30px; }
@media (min-width: 700px) { .year-grid { grid-template-columns: repeat(4, 1fr); } }
.ymonth { cursor: pointer; }
.ymonth h5 { margin: 0 0 6px; font-size: 18px; font-weight: 600; color: var(--red); letter-spacing: .3px; }
.ymonth .g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.ymonth .g span { font-size: 9px; text-align: center; height: 14px; line-height: 14px; font-weight: 500; font-variant-numeric: tabular-nums; border-radius: 50%; }
.ymonth .g span.t { background: var(--red); color: #fff; font-weight: 700; }

.cal-toolbar { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 26; display: flex; justify-content: space-between; align-items: center; height: 44px; padding: 0 8px; background: var(--chrome); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 -.5px 0 var(--chrome-border); }
@media (min-width: 900px) { .cal-toolbar { left: 300px; bottom: 0; } }
.page-cal .stage-pad { height: 50px; }

.ev-detail h2 { font-size: 28px; font-weight: 700; margin: 4px 0 2px; letter-spacing: .36px; }
.ev-detail .meta { color: var(--label2); font-size: 17px; line-height: 1.45; }
.ev-detail .meta b { color: var(--label); font-weight: 400; }

.cal-color { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.color-choices { display: flex; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.color-choices button { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 0 var(--bg2); transition: box-shadow .15s; }
.color-choices button.on { box-shadow: 0 0 0 2px var(--bg2), 0 0 0 4px currentColor; }

/* Settings profile */
.profile { display: flex; flex-direction: column; align-items: center; padding: 8px 16px 4px; text-align: center; }
.profile .logo { width: 84px; height: 84px; border-radius: 20px; font-size: 34px; }
.profile h2 { margin: 12px 0 2px; font-size: 24px; font-weight: 700; letter-spacing: .3px; }
.profile p { margin: 0; color: var(--label2); font-size: 15px; }
.logo { display: grid; place-items: center; color: #fff; font-weight: 700; background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); overflow: hidden; flex: none; letter-spacing: 0; }
.logo img { width: 100%; height: 100%; object-fit: cover; }

.sync-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--gray); }
.sync-dot.ok { background: var(--green); } .sync-dot.err { background: var(--red); } .sync-dot.busy { background: var(--orange); }

.issue-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.issue-tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 10px; background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); display: inline-flex; gap: 4px; align-items: center; }
.issue-tag.red { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.issue-tag.gray { background: var(--fill3); color: var(--label2); }
.fix-row { align-items: flex-start; }
.fix-row .row-main { padding: 12px 0; }
.fix-row .row-trail { padding-top: 12px; }

.hint-banner { margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--bg2)); font-size: 15px; display: flex; gap: 10px; align-items: flex-start; }
.hint-banner svg { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 1px; }

.fab-row { display: flex; gap: 10px; margin: 16px; }
.fab-row .btn { flex: 1; }

.spacer { height: 24px; }
.center-text { text-align: center; }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.nav-logo { width: 32px; height: 32px; border-radius: 50%; font-size: 13px; }
.fade-in-once { }
.pill.chip-on { background: var(--accent); color: #fff; }
@media (min-width: 900px) {
  .side-brand { color: var(--label); }
  .side-item.active svg [fill="#fff"] { fill: var(--accent); }
  .side-item.active svg [stroke="#fff"] { stroke: var(--accent); }
}

/* =========================================================
   LIQUID GLASS — stile iOS 26/27
   Sfondo luminoso sfumato, superfici in vetro con bordo bianco,
   controlli a capsula, barra a schede fluttuante.
   ========================================================= */
:root {
  --glass: rgba(255, 255, 255, .56);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-soft: rgba(255, 255, 255, .45);
  --glass-sel: rgba(0, 0, 0, .065);
  --glass-border: rgba(255, 255, 255, .92);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-shadow: 0 12px 34px -10px rgba(40, 55, 100, .18), 0 2px 8px rgba(40, 55, 100, .05);
  --glass-inset: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 -1px 1px rgba(255, 255, 255, .4);
  --blur: blur(26px) saturate(190%);
  --sheet-bg: rgba(246, 247, 251, .84);
  --solid: #FFFFFF;
  --sep: rgba(60, 60, 67, .16);
  --fill3: rgba(120, 120, 128, .1);
  --wall-base: #EAF0F7;
  --wall: radial-gradient(55% 45% at 0% 0%, #C9E0FF 0%, rgba(201,224,255,0) 70%),
          radial-gradient(45% 40% at 100% 8%, #CFF3DE 0%, rgba(207,243,222,0) 70%),
          radial-gradient(60% 45% at 85% 100%, #FFE0D2 0%, rgba(255,224,210,0) 70%),
          radial-gradient(50% 45% at 5% 95%, #E4DAFF 0%, rgba(228,218,255,0) 70%);
  --ring-track: rgba(52, 199, 89, .14);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(255, 255, 255, .1); --glass-strong: rgba(70, 72, 82, .55); --glass-soft: rgba(255, 255, 255, .08);
    --glass-sel: rgba(255, 255, 255, .16); --glass-border: rgba(255, 255, 255, .26); --glass-edge: rgba(255, 255, 255, .18);
    --glass-shadow: 0 14px 40px -12px rgba(0, 0, 0, .55);
    --glass-inset: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -1px 1px rgba(255, 255, 255, .06);
    --sheet-bg: rgba(38, 40, 48, .82); --solid: #1C1D22; --sep: rgba(255, 255, 255, .13);
    --wall-base: #141A27;
    --wall: radial-gradient(55% 45% at 0% 0%, #23467D 0%, rgba(35,70,125,0) 70%),
            radial-gradient(45% 40% at 100% 10%, #145A47 0%, rgba(20,90,71,0) 70%),
            radial-gradient(60% 45% at 85% 100%, #4B2E6B 0%, rgba(75,46,107,0) 70%),
            radial-gradient(50% 45% at 5% 95%, #2E4E6E 0%, rgba(46,78,110,0) 70%);
    --ring-track: rgba(48, 209, 88, .2);
  }
}
:root[data-theme="dark"] {
  --glass: rgba(255, 255, 255, .1); --glass-strong: rgba(70, 72, 82, .55); --glass-soft: rgba(255, 255, 255, .08);
  --glass-sel: rgba(255, 255, 255, .16); --glass-border: rgba(255, 255, 255, .26); --glass-edge: rgba(255, 255, 255, .18);
  --glass-shadow: 0 14px 40px -12px rgba(0, 0, 0, .55);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -1px 1px rgba(255, 255, 255, .06);
  --sheet-bg: rgba(38, 40, 48, .82); --solid: #1C1D22; --sep: rgba(255, 255, 255, .13);
  --wall-base: #141A27;
  --wall: radial-gradient(55% 45% at 0% 0%, #23467D 0%, rgba(35,70,125,0) 70%),
          radial-gradient(45% 40% at 100% 10%, #145A47 0%, rgba(20,90,71,0) 70%),
          radial-gradient(60% 45% at 85% 100%, #4B2E6B 0%, rgba(75,46,107,0) 70%),
          radial-gradient(50% 45% at 5% 95%, #2E4E6E 0%, rgba(46,78,110,0) 70%);
  --ring-track: rgba(48, 209, 88, .2);
}

/* Sfondo */
body { background: var(--wall-base); }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--wall), var(--wall-base); pointer-events: none; }
.shell { background: transparent; }
body.sheet-open .shell { background: transparent; filter: brightness(.9); }

/* Superfici in vetro */
.card, .list, .summary, .sidebar, .tabbar, .toast, .menu, .asheet .grp, .alert, .search, .hint-banner {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inset);
}
.list { border-radius: 24px; }
.card, .summary { border-radius: 28px; }
.card { padding: 18px; }
.row, .sheet .row { background: transparent; }
:root[data-theme="dark"] .sheet .list, :root[data-theme="dark"] .sheet .row { background: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet .list, :root:not([data-theme="light"]) .sheet .row { background: transparent; } }
.sheet .list { background: var(--glass-soft); }
.row + .row::before { left: 20px; }
.row { padding: 0 20px; }
a.row, a.row:visited { color: inherit; }
button.row:active, .row.tap:active, a.row:active { background: var(--glass-sel); }

.stat { background: var(--glass-soft); border: 1px solid var(--glass-edge); border-radius: 18px; box-shadow: var(--glass-inset); }
:root[data-theme="dark"] .stat { background: var(--glass-soft); }

/* Controlli a capsula */
.seg { border-radius: 999px; padding: 3px; background: var(--glass-soft); border: 1px solid var(--glass-edge); box-shadow: var(--glass-inset); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.seg button { border-radius: 999px; height: 32px; font-size: 14px; }
.seg button.on, :root[data-theme="dark"] .seg button.on { background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: 0 4px 14px rgba(0,0,0,.1), var(--glass-inset); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { background: var(--glass-strong); } }

.nav-btn {
  height: 44px; min-width: 44px; padding: 0 16px; border-radius: 22px; color: var(--label); font-weight: 500;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  box-shadow: 0 6px 18px -6px rgba(0,0,0,.18), var(--glass-inset);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  transition: transform .15s;
}
.nav-btn:active { opacity: 1; transform: scale(.92); }
.nav-btn.icon { width: 44px; padding: 0; }
.nav-btn.icon svg { width: 20px; height: 20px; }
.nav-btn.back svg { width: 11px; height: 18px; margin-right: 6px; }
.nav-btn.primary { background: var(--accent); color: #fff; border-color: color-mix(in srgb, #fff 45%, var(--accent)); font-weight: 600; }
.nav-btn.primary svg { width: 20px; height: 20px; }
.nav-left, .nav-right { gap: 10px; }
.nav-btn .logo, .nav-btn .nav-logo { width: 34px; height: 34px; }
a.nav-btn.icon:has(.nav-logo) { padding: 0; overflow: hidden; }
.navbar { padding-left: 16px; padding-right: 16px; height: calc(56px + var(--safe-t)); }
.navbar.scrolled, .navbar.solid { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.navbar::before { content: ""; position: absolute; inset: 0 0 -24px 0; z-index: -1; opacity: 0; transition: opacity .25s;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--wall-base) 75%, transparent), transparent);
  -webkit-mask-image: linear-gradient(black 55%, transparent); mask-image: linear-gradient(black 55%, transparent); }
.navbar.scrolled::before { opacity: 1; }

.circle-btn { background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: 0 4px 12px -4px rgba(0,0,0,.15), var(--glass-inset); width: 36px; height: 36px; color: var(--label); }
.btn { border-radius: 999px; }
.btn.tinted { background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), var(--glass-inset); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); color: var(--accent); }
.search { border-radius: 999px; height: 42px; padding: 0 14px; }
.chip-input { background: var(--glass-soft); border: 1px solid var(--glass-edge); border-radius: 12px; box-shadow: var(--glass-inset); }
.hint-banner { border-radius: 22px; background: color-mix(in srgb, var(--accent) 9%, var(--glass)); }
select.field { pointer-events: none; }
select option { background: var(--solid); color: var(--label); }
.row:has(select.field) { cursor: pointer; }

/* Barra a schede fluttuante */
.tabbar {
  left: 50%; right: auto; transform: translateX(-50%); bottom: calc(var(--safe-b) + 10px);
  width: min(calc(100vw - 24px), 480px); height: 66px; padding: 5px; border-radius: 33px;
  background: var(--glass-strong); gap: 2px;
}
.tab { border-radius: 28px; padding-top: 7px; color: var(--label); font-size: 10.5px; transition: background .25s; }
.tab svg { width: 24px; height: 24px; }
.tab.active { background: var(--glass-sel); color: var(--accent); font-weight: 600; }
.stage { padding-bottom: calc(66px + var(--safe-b) + 36px); }
.badge { top: 3px; box-shadow: 0 0 0 2px var(--glass-border); }

/* Anelli e grafici: verdi, con bagliore e disco in vetro */
.ring.goal .prog { filter: drop-shadow(0 0 7px rgba(10, 132, 255, .45)); }
.ring-center::before { content: ""; position: absolute; inset: var(--ri, 34px); border-radius: 50%; z-index: -1;
  background: var(--glass-soft); border: 1px solid var(--glass-edge); box-shadow: var(--glass-inset), 0 6px 20px -8px rgba(0,0,0,.12); }
.ring-wrap .ring-value { font-size: 38px; }
.bar i { background: var(--glass-soft); border: 1px solid var(--glass-edge); border-radius: 8px; max-width: 26px; }
.bar.has i { background: color-mix(in srgb, var(--green) 45%, var(--glass-soft)); }
.bar.cur i { background: linear-gradient(180deg, var(--ring-b), var(--ring-a)); border-color: rgba(255,255,255,.7); box-shadow: 0 0 14px rgba(52,199,89,.45); }
.progress { height: 10px; border-radius: 5px; border: 1px solid var(--glass-edge); background: var(--goal-track); }
.progress > i { box-shadow: 0 0 10px rgba(10,132,255,.4); }

/* Fogli (sheet) */
.sheet { background: var(--sheet-bg); -webkit-backdrop-filter: blur(40px) saturate(190%); backdrop-filter: blur(40px) saturate(190%);
  border-radius: 34px 34px 0 0; border: 1px solid var(--glass-border); border-bottom: 0; box-shadow: 0 -10px 40px rgba(0,0,0,.15), var(--glass-inset); }
:root[data-theme="dark"] .sheet { background: var(--sheet-bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet { background: var(--sheet-bg); } }
.sheet-bar { height: 70px; padding: 8px 16px 0; }
.sheet-bar .grab { top: 6px; }
@media (min-width: 900px) { .sheet { border-radius: 34px; border-bottom: 1px solid var(--glass-border); } }

/* Action sheet, avvisi, banner */
.asheet .grp { border-radius: 28px; }
.asheet .grp.cancel-grp, :root[data-theme="dark"] .asheet .grp.cancel-grp { background: var(--glass-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .asheet .grp.cancel-grp, :root:not([data-theme="light"]) .asheet .grp { background: var(--glass-strong); } }
:root[data-theme="dark"] .asheet .grp { background: var(--glass-strong); }
.asheet button + button, .asheet .head { border-color: var(--sep); }
.alert { width: 300px; border-radius: 34px; background: var(--sheet-bg); }
:root[data-theme="dark"] .alert { background: var(--sheet-bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .alert { background: var(--sheet-bg); } }
.alert .content { padding: 24px 22px 8px; }
.alert input { border-radius: 12px; height: 38px; font-size: 16px; background: var(--glass-soft); border: 1px solid var(--glass-edge); }
.alert .btns { border-top: 0; gap: 10px; padding: 14px 16px 16px; }
.alert .btns button { height: 46px; border-radius: 23px; background: var(--glass-sel); color: var(--label); font-weight: 500; }
.alert .btns button + button { border-left: 0; }
.alert .btns.stack button + button { border-top: 0; }
.alert .btns button.bold { background: var(--accent); color: #fff; font-weight: 600; }
.alert .btns button.destructive { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.toast { border-radius: 26px; background: var(--glass-strong); }
:root[data-theme="dark"] .toast { background: var(--glass-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: var(--glass-strong); } }

/* Menu in vetro (al posto delle tendine) */
.menu-ov { z-index: 300; }
.menu { position: fixed; border-radius: 22px; padding: 6px; overflow-y: auto; background: var(--sheet-bg);
  -webkit-backdrop-filter: blur(40px) saturate(190%); backdrop-filter: blur(40px) saturate(190%);
  transform: scale(.85); opacity: 0; transition: transform .25s cubic-bezier(.3,1.3,.5,1), opacity .15s; }
.menu-ov.in .menu { transform: scale(1); opacity: 1; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px 0 8px; border-radius: 14px; font-size: 17px; text-align: left; color: var(--label); }
.menu button:hover, .menu button:active { background: var(--glass-sel); }
.menu button.dis { color: var(--label3); }
.menu .mk { width: 20px; flex: none; color: var(--label); }
.menu .mk svg { width: 16px; height: 16px; }
.menu .ml { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Desktop / iPad: barra laterale in vetro fluttuante */
@media (min-width: 900px) {
  .sidebar { top: 12px; bottom: 12px; left: 12px; width: 276px; border-radius: 30px; padding-top: 18px; }
  :root[data-theme="dark"] .sidebar { background: var(--glass); }
  .stage { margin-left: 300px; padding-bottom: 40px; }
  .side-item { border-radius: 16px; }
  .side-item.active { background: var(--accent); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }
  .cal-toolbar { left: 300px; }
}

/* Calendario: pagina chiara e leggibile, barra degli strumenti fluttuante */
.page-cal { background: transparent; }
.cal-top, .cal-seg, .wk-head, .wstrip, .day-caption, .allday, .week-head, .page-cal .navbar.scrolled, .page-cal .navbar.solid { background: var(--solid); }
.page-cal .month-grid, .page-cal .day-list, .page-cal .timeline, .page-cal .year-grid { background: var(--solid); }
.page-cal .navbar::before { display: none; }
.nowlabel, .drag-time { background: var(--solid); }
.cal-toolbar { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; bottom: calc(var(--safe-b) + 86px); padding: 0 16px; height: 48px; }
.page-cal .stage-pad { height: 90px; background: var(--solid); }
.issue-tag svg { width: 12px; height: 12px; flex: none; }
.issue-tag { align-items: center; }

/* ---- Anelli e barre "liquid glass" (tubo di vetro + gelatina lucida) ---- */
.ring svg { transform: none !important; }
.ring .prog { transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.2,1); }
.ring .prog.body { filter: drop-shadow(0 0 10px var(--glow)) drop-shadow(0 2px 3px rgba(0,0,0,.18)); }
.ring.goal .prog { filter: none; }
.ring.goal .prog.body { filter: drop-shadow(0 0 8px var(--glow)); }
.ring .tube { filter: drop-shadow(0 0 14px rgba(52,199,89,.18)); }
.ring.goal .tube { filter: drop-shadow(0 0 10px rgba(10,132,255,.18)); }
.ring-center::before {
  inset: var(--ri, 34px);
  background: radial-gradient(120% 90% at 30% 15%, rgba(255,255,255,.22), rgba(255,255,255,.04) 60%), var(--glass-soft);
  border: 1.5px solid rgba(255,255,255,.55);
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,.6), inset 0 -12px 28px rgba(0,0,0,.08), 0 10px 30px -10px rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}

.bar i {
  background: linear-gradient(180deg, rgba(52,199,89,.22), rgba(52,199,89,.12));
  border: 1px solid rgba(255,255,255,.6); border-radius: 13px;
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,.55), inset 0 -2px 4px rgba(0,60,20,.08);
}
.bar.has i { background: linear-gradient(180deg, rgba(120,230,120,.75), rgba(37,201,90,.6)); box-shadow: inset 0 2px 2px rgba(255,255,255,.6), inset 0 -3px 6px rgba(0,70,25,.2), 0 0 10px rgba(52,199,89,.3); }
.bar.cur i { background: linear-gradient(160deg, #B4FF7A, #25C95A); border-color: rgba(255,255,255,.75);
  box-shadow: inset 2px 3px 3px rgba(255,255,255,.75), inset -2px -4px 7px rgba(0,70,25,.3), 0 0 16px rgba(52,199,89,.6); }

.progress { height: 14px; border-radius: 7px; background: rgba(10,132,255,.2); border: 1px solid rgba(255,255,255,.55);
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,.5), inset 0 -2px 4px rgba(0,50,120,.12); overflow: visible; }
.progress > i { border-radius: 7px; background: linear-gradient(160deg, #8BDCFF, #0A84FF);
  box-shadow: inset 2px 3px 3px rgba(255,255,255,.7), inset -1px -3px 5px rgba(0,50,120,.3), 0 0 12px rgba(10,132,255,.55); }

/* Dettagli bianchi delle icone: restano visibili su qualsiasi colore */
:root { --icon-detail: #fff; }
:root[data-theme="dark"] { --icon-detail: #1B2030; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --icon-detail: #1B2030; } }
.tab svg [fill="#fff"], .nav-btn svg [fill="#fff"], .side-item svg [fill="#fff"], .card-title svg [fill="#fff"], .row.action svg [fill="#fff"], .btn svg [fill="#fff"] { fill: var(--icon-detail); }
.tab svg [stroke="#fff"], .nav-btn svg [stroke="#fff"], .side-item svg [stroke="#fff"], .card-title svg [stroke="#fff"], .row.action svg [stroke="#fff"], .btn svg [stroke="#fff"] { stroke: var(--icon-detail); }
.tab.active svg [fill="#fff"], .row.action svg [fill="#fff"], .card-title svg [fill="#fff"] { fill: #fff; }
.tab.active svg [stroke="#fff"], .row.action svg [stroke="#fff"], .card-title svg [stroke="#fff"] { stroke: #fff; }
.row-icon svg [fill="#fff"] { fill: rgba(0, 0, 0, .32); }
.row-icon svg [stroke="#fff"] { stroke: rgba(0, 0, 0, .32); }

/* ---- Account: schermata di accesso e pagina Account ---- */
.side-foot { display: block; text-decoration: none; border-radius: 12px; }
.side-foot:hover { background: var(--glass-soft); }
.auth-gate { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto; background: rgba(120, 140, 170, .18); -webkit-backdrop-filter: blur(28px) saturate(1.6); backdrop-filter: blur(28px) saturate(1.6); animation: authIn .35s ease both; }
.auth-gate.out { animation: authOut .28s ease both; }
@keyframes authIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes authOut { to { opacity: 0; } }
.auth-card { position: relative; width: 100%; max-width: 400px; padding: 30px 22px 22px; border-radius: 34px; text-align: center;
  background: var(--glass-strong); border: 1px solid var(--glass-border, rgba(255,255,255,.6)); box-shadow: var(--glass-shadow, 0 20px 60px rgba(0,0,0,.18)), var(--glass-inset, inset 0 1px 0 rgba(255,255,255,.7));
  -webkit-backdrop-filter: blur(30px) saturate(1.8); backdrop-filter: blur(30px) saturate(1.8); animation: authCard .45s cubic-bezier(.2,.9,.25,1.1) both; }
@keyframes authCard { from { transform: translateY(24px) scale(.96); opacity: 0; } }
.auth-close { position: absolute; top: 14px; left: 14px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.auth-brand .logo { width: 72px; height: 72px; border-radius: 18px; font-size: 30px; box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.4); }
.auth-name { font-size: 15px; font-weight: 600; color: var(--label2); }
.auth-card h1 { margin: 14px 0 6px; font-size: 28px; font-weight: 700; letter-spacing: .3px; }
.auth-sub { margin: 0 6px 18px; color: var(--label2); font-size: 15px; line-height: 1.35; }
.auth-seg { margin: 0 0 14px; }
.auth-card .auth-list { margin: 0; text-align: left; }
.auth-card .auth-list .field { font-size: 17px; }
.auth-msg { margin: 10px 4px 0; color: var(--red); font-size: 14px; text-align: left; }
.auth-go { margin-top: 16px; border-radius: 25px; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }
.auth-go[disabled] { opacity: .75; }
.auth-links { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.auth-links button { color: var(--accent); font-size: 15px; padding: 8px; }
.auth-links button.muted { color: var(--label2); }
.auth-foot { margin: 8px 4px 0; font-size: 12px; color: var(--label2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar-acc { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 18px; letter-spacing: .5px;
  background: linear-gradient(160deg, #A2A9B8, #6C7385); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 2px 6px rgba(0,0,0,.12); }
.avatar-acc.big { width: 84px; height: 84px; font-size: 32px; }
.avatar-acc.empty svg { width: 26px; height: 26px; }
.avatar-acc.empty svg [fill="#fff"] { fill: rgba(0,0,0,.25); }
.acc-row { gap: 12px; padding-top: 10px; padding-bottom: 10px; text-decoration: none; color: inherit; }
.acc-row .row-title { font-size: 17px; font-weight: 600; }
.acc-profile h2 { font-size: 20px; word-break: break-all; }
