/* Scadenzia — design system (mobile first, tema chiaro/scuro) */
:root {
  --navy: #082e55;
  --blue: #07659d;
  --teal: #0aa898;
  --teal-strong: #078a7d;
  --grad: linear-gradient(105deg, #07659d, #049e91);
  --bg: #f4f8fa;
  --surface: #ffffff;
  --surface-2: #f1f6f8;
  --ink: #14314d;
  --heading: #082e55;
  --sub: #5b7189;
  --muted: #8297aa;
  --border: #dce7ee;
  --border-strong: #c6d6df;
  --red: #c0392b;
  --red-bg: #fdecea;
  --amber: #b45309;
  --amber-bg: #fef3e2;
  --green: #0f8b7d;
  --green-bg: #e6f7f3;
  --blue-bg: #e8f2fa;
  --shadow: 0 1px 2px #0b2a4410, 0 6px 18px #0b2a440d;
  --shadow-lg: 0 18px 50px #0b2a4426;
  --radius: 16px;
  --radius-sm: 11px;
  --nav-h: 68px;
  --side-w: 248px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #cfe3f5; --blue: #4fa8e0; --teal: #2dd4bf; --teal-strong: #5eead4;
    --bg: #0b1622; --surface: #111f2e; --surface-2: #162839; --ink: #dbe7f1; --heading: #eef5fb;
    --sub: #9db2c6; --muted: #7890a6; --border: #22384d; --border-strong: #2d475f;
    --red: #f87171; --red-bg: #3b1518; --amber: #fbbf24; --amber-bg: #3a2a0c; --green: #34d399; --green-bg: #0f3229; --blue-bg: #12304a;
    --shadow: 0 1px 2px #0006, 0 6px 18px #0004; --shadow-lg: 0 18px 50px #0009; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy: #cfe3f5; --blue: #4fa8e0; --teal: #2dd4bf; --teal-strong: #5eead4;
  --bg: #0b1622; --surface: #111f2e; --surface-2: #162839; --ink: #dbe7f1; --heading: #eef5fb;
  --sub: #9db2c6; --muted: #7890a6; --border: #22384d; --border-strong: #2d475f;
  --red: #f87171; --red-bg: #3b1518; --amber: #fbbf24; --amber-bg: #3a2a0c; --green: #34d399; --green-bg: #0f3229; --blue-bg: #12304a;
  --shadow: 0 1px 2px #0006, 0 6px 18px #0004; --shadow-lg: 0 18px 50px #0009; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { font-size: 15px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { color: var(--heading); letter-spacing: -.025em; line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Avvio e errori Blazor ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.boot img { width: 210px; height: auto; }
.boot-bar { width: 160px; height: 4px; margin: 22px auto 0; background: var(--border); border-radius: 4px; overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: var(--blazor-load-percentage, 10%); background: var(--grad); transition: width .2s; }
#blazor-error-ui { display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1000; background: var(--red-bg); color: var(--red); border: 1px solid var(--red); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); }
#blazor-error-ui .reload { font-weight: 700; margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ---------- Layout applicazione ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.topbar .logo img { height: 40px; width: auto; display: block; }
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.main { padding: 18px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); max-width: 1040px; margin: 0 auto; }
.bottom-nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .7rem; font-weight: 600; text-decoration: none; }
.bottom-nav a .ico { font-size: 1.3rem; line-height: 1; filter: grayscale(.6); opacity: .8; }
.bottom-nav a.active { color: var(--blue); }
.bottom-nav a.active .ico { filter: none; opacity: 1; }
.bottom-nav .fab { position: relative; }
.bottom-nav .fab span.plus { width: 50px; height: 50px; margin-top: -22px; border-radius: 18px; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 28px; font-weight: 400; box-shadow: 0 8px 20px #07659d44; }
.bottom-nav .badge { position: absolute; top: 8px; margin-left: 22px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: var(--surface); border-right: 1px solid var(--border); }
  .sidebar .logo img { width: 180px; height: auto; margin: 0 6px 22px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--sub); font-weight: 600; text-decoration: none; }
  .sidebar nav a:hover { background: var(--surface-2); }
  .sidebar nav a.active { background: var(--blue-bg); color: var(--blue); }
  .sidebar nav a .ico { width: 24px; text-align: center; font-size: 1.1rem; }
  .sidebar nav .badge { margin-left: auto; }
  .sidebar .side-cta { margin: 18px 0; }
  .sidebar .side-foot { margin-top: auto; font-size: .78rem; color: var(--muted); padding: 0 8px; }
  .topbar .logo { display: none; }
  .topbar { justify-content: flex-end; border-bottom: 0; background: transparent; backdrop-filter: none; }
  .bottom-nav { display: none; }
  .main { padding: 8px 32px 48px; }
}

/* ---------- Componenti base ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-head p { color: var(--sub); margin: 4px 0 0; }
.kicker { font-size: .7rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--teal-strong); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 14px; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.muted { color: var(--sub); }
.small { font-size: .84rem; }
.tiny { font-size: .74rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 13px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none !important; transition: filter .15s, background .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 6px 16px #07659d33; }
.btn.primary:hover { filter: brightness(.96); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.danger.solid { background: var(--red); color: #fff; border: 0; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .84rem; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid transparent; background: transparent; font-size: 1.15rem; color: var(--sub); }
.icon-btn:hover { background: var(--surface-2); }

.badge { display: inline-flex; align-items: center; gap: 4px; min-width: 20px; height: 20px; padding: 0 7px; border-radius: 10px; font-size: .7rem; font-weight: 800; background: var(--red); color: #fff; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--surface-2); color: var(--sub); border: 1px solid var(--border); white-space: nowrap; }
.chip.overdue { background: var(--red-bg); color: var(--red); border-color: transparent; }
.chip.urgent { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.chip.soon { background: var(--blue-bg); color: var(--blue); border-color: transparent; }
.chip.later, .chip.ok { background: var(--green-bg); color: var(--green); border-color: transparent; }
.chip.done { background: var(--surface-2); color: var(--muted); }
.chip.warn { background: var(--amber-bg); color: var(--amber); border-color: transparent; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: .84rem; font-weight: 650; color: var(--sub); }
.field .hint { font-size: .76rem; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent); }
.input.invalid { border-color: var(--red); }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--teal); flex: none; }
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 28px; background: var(--border-strong); transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px #0003; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::before { transform: translateX(18px); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.setting:first-of-type { border-top: 0; }
.setting .grow > div:first-child { font-weight: 650; }
.form-error, .alert { padding: 12px 14px; border-radius: 12px; font-size: .88rem; margin-bottom: 14px; }
.form-error, .alert.error { background: var(--red-bg); color: var(--red); }
.alert.info { background: var(--blue-bg); color: var(--blue); }
.alert.success { background: var(--green-bg); color: var(--green); }
.alert.warn { background: var(--amber-bg); color: var(--amber); }
.form-error ul { margin: 6px 0 0; padding-left: 18px; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; font-weight: 650; font-size: .84rem; color: var(--sub); }
.segmented button.on { background: var(--surface); color: var(--heading); box-shadow: var(--shadow); }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-select button { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-weight: 600; font-size: .85rem; color: var(--sub); }
.chips-select button.on { background: var(--green-bg); border-color: var(--teal); color: var(--teal-strong); }

/* ---------- Dashboard ---------- */
.hello h1 { font-size: 1.45rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-decoration: none !important; color: inherit; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; letter-spacing: -.03em; color: var(--heading); }
.stat span { font-size: .78rem; font-weight: 650; color: var(--sub); }
.stat.red b { color: var(--red); }
.stat.amber b { color: var(--amber); }
.stat.teal b { color: var(--teal-strong); }
.money { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.money div { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.money b { display: block; font-size: 1.15rem; color: var(--heading); }

/* ---------- Liste scadenze ---------- */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--border); color: inherit; text-decoration: none !important; border-radius: 10px; }
.item:first-child { border-top: 0; }
a.item:hover, button.item:hover { background: var(--surface-2); }
button.item { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: transparent; text-align: left; }
.item .ico { width: 44px; height: 44px; flex: none; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); font-size: 1.3rem; }
.item .ico.overdue { background: var(--red-bg); }
.item .ico.urgent { background: var(--amber-bg); }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 650; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { font-size: .8rem; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.item .date { font-size: .76rem; color: var(--muted); }
.group-title { font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 20px 4px 6px; }

/* ---------- Suggerimenti ---------- */
.discover { background: linear-gradient(135deg, var(--green-bg), var(--blue-bg)); border: 1px solid color-mix(in srgb, var(--teal) 25%, transparent); border-radius: var(--radius); padding: 18px; }
.discover h2 { display: flex; gap: 8px; align-items: center; }
.sugg { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.sugg + .sugg { margin-top: 10px; }
.sugg.selected { border-color: var(--teal); box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 30%, transparent); }
.sugg .head { display: flex; gap: 12px; align-items: flex-start; }
.sugg .head .ico { font-size: 1.4rem; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.sugg .reason { font-size: .82rem; color: var(--sub); }
.sugg .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sugg .controls .input { width: auto; min-height: 40px; padding: 7px 10px; }

/* ---------- Onboarding ---------- */
.onb { max-width: 760px; margin: 0 auto; }
.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps span { height: 5px; flex: 1; border-radius: 4px; background: var(--border); }
.steps span.on { background: var(--grad); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; padding: 14px; min-height: 112px; display: flex; flex-direction: column; gap: 4px; }
.tile .emoji { font-size: 1.6rem; }
.tile strong { color: var(--heading); font-size: .95rem; }
.tile small { color: var(--sub); font-size: .76rem; line-height: 1.35; }
.tile.on { border: 2px solid var(--teal); background: var(--green-bg); padding: 13px; }
.tile.on::after { content: "✓"; position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 800; font-size: .8rem; display: grid; place-items: center; }
.onb-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 10px; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); margin-top: 10px; }
@media (min-width: 900px) { .onb-actions { bottom: 0; } }
.sub-card { border: 1px dashed var(--border-strong); border-radius: 14px; padding: 14px; margin-top: 10px; background: var(--surface); }

/* ---------- Dettaglio ---------- */
.detail-head { display: flex; gap: 14px; align-items: flex-start; }
.detail-head .ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.8rem; background: var(--surface-2); flex: none; }
.big-date { font-size: 1.9rem; font-weight: 800; color: var(--heading); letter-spacing: -.03em; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: .9rem; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); border: 2px solid var(--surface); }
.timeline li:last-child { border-left-color: transparent; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: .84rem; max-width: 100%; }
.file a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

/* ---------- Modale e toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: #03223a80; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { width: 100%; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .2s; }
@media (min-width: 640px) { .overlay { align-items: center; } .modal { max-width: 520px; border-radius: 22px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 24px)); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 13px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: .9rem; animation: up .2s; }
:root[data-theme="dark"] .toast { background: #1f3b56; }
.toast.error { background: var(--red); }
.toast.success { background: #0f766e; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }

/* ---------- Varie ---------- */
.empty { text-align: center; padding: 36px 18px; color: var(--sub); }
.empty .emoji { font-size: 2.4rem; margin-bottom: 6px; }
.empty h3 { margin-bottom: 6px; }
.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; height: 64px; margin-bottom: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--blue-bg); color: var(--blue); font-size: .88rem; margin-bottom: 14px; }
.banner .grow b { display: block; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { min-height: 42px; }
.search { position: relative; flex: 1; min-width: 200px; }
.search .input { padding-left: 38px; }
.search::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: .9rem; opacity: .6; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 0%, var(--green-bg), transparent 45%), radial-gradient(circle at 100% 100%, var(--blue-bg), transparent 45%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { display: block; width: 200px; margin: 0 auto 18px; }
.auth-card h1 { font-size: 1.35rem; text-align: center; margin-bottom: 6px; }
.auth-card .lead { text-align: center; color: var(--sub); margin-bottom: 18px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: .9rem; color: var(--sub); }
.legal { max-width: 760px; }
.legal h2 { margin: 22px 0 8px; }
.legal li { margin-bottom: 6px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .7rem; font-weight: 800; color: var(--muted); padding: 4px 0; text-transform: uppercase; }
.cal .day { min-height: 74px; border: 1px solid var(--border); border-radius: 10px; padding: 4px; background: var(--surface); font-size: .72rem; overflow: hidden; }
.cal .day.other { opacity: .45; }
.cal .day.today { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.cal .day .n { font-weight: 800; color: var(--sub); }
.cal .ev { display: block; margin-top: 3px; padding: 2px 5px; border-radius: 6px; background: var(--blue-bg); color: var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; }
.cal .ev.overdue { background: var(--red-bg); color: var(--red); }
.cal .ev.urgent { background: var(--amber-bg); color: var(--amber); }
@media (max-width: 600px) { .cal .day { min-height: 52px; } .cal .ev { font-size: 0; height: 6px; padding: 0; } }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-top: 0; }
.table-wrap { overflow-x: auto; }
.drop { border: 2px dashed var(--border-strong); border-radius: 16px; padding: 28px 16px; text-align: center; background: var(--surface); position: relative; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .emoji { font-size: 2.2rem; }
.preview-img { max-height: 240px; border-radius: 12px; border: 1px solid var(--border); display: block; margin: 0 auto 12px; }
.capoweb { font-size: .76rem; color: var(--muted); text-align: center; margin-top: 26px; }
.capoweb b { color: var(--sub); }

/* ---------- Ritocchi mobile ---------- */
.item .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
@media (max-width: 560px) {
  .item { gap: 10px; align-items: flex-start; }
  .item .ico { width: 38px; height: 38px; font-size: 1.1rem; border-radius: 11px; }
  .item .end .chip { font-size: .66rem; padding: 3px 7px; }
  .banner { font-size: .8rem; padding: 10px 12px; }
  .banner .grow b { font-size: .86rem; }
  .stat b { font-size: 1.45rem; }
  .stat span { font-size: .72rem; }
}

/* ---------- Marchio CapoWeb ---------- */
.made-by { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.side-foot .made-by { justify-content: flex-start; margin-top: 6px; }
.capoweb-link { display: inline-flex; line-height: 0; }
.capoweb-link:hover { opacity: .85; }
.capoweb-logo { height: 20px; width: auto; display: block; }
.capoweb + .capoweb { margin-top: 8px; }

/* ---------- Consigli «Da sapere» ---------- */
.tip { font-size: .82rem; line-height: 1.45; padding: 9px 11px; border-radius: 10px; background: var(--amber-bg); color: var(--ink); border-left: 3px solid var(--amber); }

/* ---------- Privacy ---------- */
.privacy-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; color: var(--sub); margin: 10px 0; }
.privacy-note ul { margin: 0; padding-left: 18px; }
.privacy-note li { margin: 4px 0; font-size: .86rem; }
.privacy-note b { color: var(--heading); }

.add-in-cat { display: inline-block; margin: 8px 0 4px; font-size: .84rem; font-weight: 650; }

/* Abbonamento */
.usage{padding:8px 0;border-bottom:1px solid var(--border)}
.usage:last-child{border-bottom:0}
.usage-bar{height:6px;border-radius:6px;background:var(--border);margin-top:6px;overflow:hidden}
.usage-bar span{display:block;height:100%;background:var(--teal,#0eb8a7);border-radius:6px}
.usage-bar span.full,.usage-full{color:#b45309;background:#f59e0b}
.usage-full{background:none;font-weight:600}
