/* ===== Giornate — stile ===== */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --surface-3: #e4e7f0;
  --text: #171a2b;
  --muted: #666c85;
  --border: #e2e5ee;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #e5e7ff;
  --on-accent: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 6px 18px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.18);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #171a24;
  --surface-2: #1f2331;
  --surface-3: #2a2f40;
  --text: #e9ebf3;
  --muted: #9298ad;
  --border: #2a2f3f;
  --accent: #8b8ff8;
  --accent-strong: #a5a8fb;
  --accent-soft: #2b2e5c;
  --on-accent: #0f1117;
  --danger: #f87171;
  --danger-soft: #3b1f22;
  --success: #4ade80;
  --success-soft: #16311f;
  --warning: #fbbf24;
  --warning-soft: #3a2d10;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
::selection { background: var(--accent-soft); }

.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; gap: 14px; color: var(--muted); }
.boot-logo, .logo {
  width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 28px; box-shadow: var(--shadow);
}

/* ===== Layout ===== */
.app { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.side { display: none; }
.main { padding: 12px 14px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1100px; width: 100%; margin: 0 auto; }
.tabbar {
  position: fixed; 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(6, 1fr); z-index: 30;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none;
  color: var(--muted); font-size: 10.5px; font-weight: 500; padding-top: 6px;
}
.tabbar a.active { color: var(--accent); }
.tabbar svg { width: 22px; height: 22px; }

@media (min-width: 900px) {
  .app { grid-template-columns: 236px 1fr; }
  .side {
    display: flex; flex-direction: column; gap: 4px; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
    background: var(--surface); border-right: 1px solid var(--border);
  }
  .side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 18px; }
  .side .brand .logo { width: 34px; height: 34px; border-radius: 10px; font-size: 18px; }
  .side a {
    display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; text-decoration: none;
    color: var(--muted); font-weight: 500; font-size: 14.5px;
  }
  .side a:hover { background: var(--surface-2); color: var(--text); }
  .side a.active { background: var(--accent-soft); color: var(--accent); }
  .side svg { width: 20px; height: 20px; }
  .side .spacer { flex: 1; }
  .side .sync-pill { margin: 0 4px; }
  .tabbar { display: none; }
  .main { padding: 24px 32px 40px; }
}

/* ===== Barra superiore ===== */
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; min-height: 40px; }
.topbar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 6px; }
.datenav { display: flex; align-items: center; gap: 2px; }

/* ===== Bottoni ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 550; font-size: 14px;
  line-height: 1.2; transition: background 0.12s, transform 0.08s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-soft { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; border-color: transparent; background: transparent; border-radius: 10px; color: var(--muted); }
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-google { gap: 10px; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); width: 56px; height: 56px;
  border-radius: 18px; background: var(--accent); color: var(--on-accent); border: none; box-shadow: var(--shadow-lg);
  display: grid; place-items: center; z-index: 25;
}
.fab svg { width: 26px; height: 26px; }
@media (min-width: 900px) { .fab { bottom: 28px; right: 28px; } }

/* ===== Card, sezioni ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card + .card, .section + .section { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { flex: 1; }
.card-head .count { color: var(--muted); font-weight: 500; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .card + .card { margin-top: 0; } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.empty { padding: 18px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.empty svg { width: 30px; height: 30px; opacity: 0.5; margin-bottom: 6px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 10px 0; }

/* ===== Form ===== */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  outline: none; transition: border-color 0.12s, box-shadow 0.12s; min-height: 42px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.input-title { font-size: 18px; font-weight: 600; background: transparent; border-color: transparent; padding-left: 4px; }
.input-title:focus { background: var(--surface-2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch input { width: 42px; height: 24px; appearance: none; background: var(--surface-3); border-radius: 99px; position: relative; cursor: pointer; transition: background 0.15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.help { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.quick-add { display: flex; gap: 8px; align-items: center; }
.quick-add .input { flex: 1; }
.quick-add input[type="date"] { width: auto; }

/* ===== Chip ===== */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; line-height: 1.2;
}
.chip svg { width: 14px; height: 14px; }
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.tag.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--accent)); }
.tag.overdue { background: var(--danger-soft); color: var(--danger); }
.tag.today { background: var(--accent-soft); color: var(--accent); }
.tag svg { width: 12px; height: 12px; }
.segmented { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 10px; gap: 2px; }
.segmented button { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.color-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; background: var(--c); cursor: pointer; padding: 0; }
.color-dot.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.prio-btn { border-color: transparent; background: var(--surface-2); }
.prio-btn.active { background: var(--p); color: #fff; }
.weekday-toggles { display: flex; gap: 5px; }
.weekday-toggles button { flex: 1; padding: 8px 0; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.weekday-toggles button.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ===== Attività ===== */
.task-list { display: flex; flex-direction: column; }
.task {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.task:last-child { border-bottom: none; }
.task:hover { background: var(--surface-2); border-radius: 8px; }
.task.sub { padding-left: 34px; }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 500; overflow-wrap: anywhere; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; align-items: center; }
.task .meta .tag { font-weight: 500; }
.task.selected { outline: 2px solid var(--accent); border-radius: 8px; }
.task.dragging { opacity: 0.4; }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--p, var(--muted)); background: transparent; flex: none;
  display: grid; place-items: center; margin-top: 1px; color: transparent; padding: 0; transition: background 0.12s;
}
.check:hover { background: color-mix(in srgb, var(--p, var(--muted)) 18%, transparent); }
.check.on { background: var(--p, var(--muted)); color: #fff; border-color: var(--p, var(--muted)); }
.check svg { width: 14px; height: 14px; }
.group-title { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 0 4px; }
.group-title:first-child { margin-top: 0; }
.drag-handle { color: var(--muted); cursor: grab; opacity: 0.6; }

/* ===== Priorità del giorno ===== */
.prio-list { display: flex; flex-direction: column; gap: 6px; }
.prio-item { display: flex; align-items: center; gap: 10px; }
.prio-item .n { width: 24px; height: 24px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.prio-item input { flex: 1; border: none; background: transparent; padding: 8px 6px; border-radius: 8px; outline: none; }
.prio-item input:focus { background: var(--surface-2); }
.prio-item.done input { text-decoration: line-through; color: var(--muted); }

/* ===== Timeline ===== */
.tl-wrap { position: relative; padding: 8px 0 12px; }
.tl-allday { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px 52px; }
.tl { position: relative; display: grid; grid-template-columns: 48px 1fr; }
.tl-hours { position: relative; }
.tl-hour { position: absolute; right: 8px; font-size: 11px; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.tl-grid { position: relative; border-left: 1px solid var(--border); }
.tl-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.tl-line.half { border-top-style: dashed; opacity: 0.5; }
.tl-slot { position: absolute; left: 0; right: 0; cursor: pointer; }
.tl-slot:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tl-slot.drop { background: color-mix(in srgb, var(--accent) 18%, transparent); outline: 2px dashed var(--accent); outline-offset: -2px; z-index: 2; }
.tl-event {
  position: absolute; border-radius: 8px; padding: 4px 8px; overflow: hidden; cursor: pointer; font-size: 12.5px; line-height: 1.25;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-left: 3px solid var(--c); color: var(--text); z-index: 3;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06); transition: filter 0.1s;
}
.tl-event:hover { filter: brightness(0.96); z-index: 4; }
.tl-event .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-event .h { color: var(--muted); font-size: 11px; }
.tl-event.done { opacity: 0.55; }
.tl-event.done .t { text-decoration: line-through; }
.tl-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 5; pointer-events: none; }
.tl-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.tl-scroll { max-height: 70vh; overflow-y: auto; }

/* ===== Settimana ===== */
.week-head { display: grid; grid-template-columns: 48px repeat(7, 1fr); margin-bottom: 4px; }
.week-head .d { text-align: center; padding: 6px 0; font-size: 12px; color: var(--muted); border-radius: 10px; cursor: pointer; }
.week-head .d b { display: block; font-size: 17px; color: var(--text); font-weight: 600; }
.week-head .d.today b { color: var(--accent); }
.week-head .d.active { background: var(--accent-soft); }
.week-grid { display: grid; grid-template-columns: 48px repeat(7, 1fr); }
.week-grid .tl { grid-template-columns: 1fr; }
.week-grid .tl-grid { border-left: 1px solid var(--border); }
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 12px; }
.day-strip button { border: 1px solid transparent; background: var(--surface); border-radius: 12px; padding: 6px 0; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.day-strip button b { font-size: 16px; color: var(--text); }
.day-strip button.active { background: var(--accent); border-color: var(--accent); }
.day-strip button.active b, .day-strip button.active { color: var(--on-accent); }
.day-strip button.today:not(.active) b { color: var(--accent); }
.day-strip .dots { display: flex; gap: 2px; height: 4px; }
.day-strip .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: 0.7; }
.day-strip button.active .dots i { background: var(--on-accent); }

/* ===== Abitudini ===== */
.habit { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.habit:last-child { border-bottom: none; }
.habit .icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); flex: none; }
.habit .body { flex: 1; min-width: 0; cursor: pointer; }
.habit .name { font-weight: 600; }
.habit .streak { font-size: 12.5px; color: var(--muted); }
.habit-days { display: flex; gap: 4px; }
.habit-days button { width: 22px; height: 22px; border-radius: 6px; border: none; background: var(--surface-2); padding: 0; font-size: 9px; color: var(--muted); }
.habit-days button.on { background: var(--c); color: #fff; }
.habit-days button.na { opacity: 0.3; }
.habit-toggle { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--c); background: transparent; color: var(--c); display: grid; place-items: center; flex: none; padding: 0; font-weight: 700; font-size: 12px; }
.habit-toggle.on { background: var(--c); color: #fff; }
.habit-toggle svg { width: 20px; height: 20px; }
.habit-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.habit-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px 8px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-weight: 550; font-size: 13.5px; }
.habit-chip.on { background: color-mix(in srgb, var(--c) 18%, var(--surface)); border-color: var(--c); }
.habit-chip .em { font-size: 16px; }
.habit-chip .cnt { font-size: 11.5px; color: var(--muted); }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 99px; }

/* ===== Note ===== */
.note-card { padding: 12px 14px; cursor: pointer; }
.note-card h3 { margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.note-card .ex { color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.note-card .when { font-size: 12px; color: var(--muted); margin-top: 6px; }
.notes-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .notes-grid { grid-template-columns: 1fr 1fr; } }
.md { line-height: 1.6; }
.md h2, .md h3, .md h4, .md h5 { margin: 12px 0 4px; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li.done { color: var(--muted); text-decoration: line-through; }
.md ul.md-tasks { list-style: none; padding-left: 4px; }
.md code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--surface-2); padding: 10px 12px; border-radius: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 8px; padding: 4px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
textarea.editor-area { min-height: 40vh; font-family: var(--mono); font-size: 14px; }

/* ===== Statistiche ===== */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.tile .l { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tile .delta { font-size: 12px; margin-top: 4px; }
.tile .delta.up { color: var(--success); }
.tile .delta.down { color: var(--danger); }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--muted); }
.chart .bar { fill: var(--accent); }
.chart .bar.h { fill: var(--success); }
.chart .axis { stroke: var(--border); }
.stat-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-row .progress { flex: 1; }
.stat-row .pct { width: 42px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 12, 25, 0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.15s ease-out;
}
.modal {
  background: var(--surface); width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  animation: up 0.2s ease-out; box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.modal-head h2 { flex: 1; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.modal-foot .left { margin-right: auto; }
.sheet-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 10px; border: none; background: transparent; border-radius: 10px; text-align: left; font-size: 15px; font-weight: 500; }
.sheet-list button:hover { background: var(--surface-2); }
.sheet-list svg { width: 22px; height: 22px; color: var(--accent); }
@media (min-width: 700px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { max-width: 560px; border-radius: 18px; padding: 20px 22px; max-height: 88vh; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===== Toast, sync ===== */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); max-width: 92vw;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 5px 9px; border-radius: 99px; background: var(--surface-2); }
.sync-pill svg { width: 14px; height: 14px; }
.sync-pill.error { color: var(--danger); background: var(--danger-soft); }
.sync-pill.syncing svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--warning-soft); color: var(--text); font-size: 13.5px; margin-bottom: 12px; }
.banner svg { width: 18px; height: 18px; color: var(--warning); flex: none; }
.banner.info { background: var(--accent-soft); }
.banner.info svg { color: var(--accent); }

/* ===== Login ===== */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: 100%; max-width: 400px; padding: 28px 24px; text-align: center; }
.login .logo { margin: 0 auto 14px; }
.login h1 { font-size: 24px; margin-bottom: 6px; }
.login .stack { margin-top: 20px; text-align: left; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 6px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ===== Pianificazione ===== */
.plan-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .plan-layout { grid-template-columns: 380px 1fr; align-items: start; } .plan-layout .card + .card { margin-top: 0; } }
.plan-hint { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.dur-chips button { padding: 5px 9px; }

/* ===== Impostazioni ===== */
.settings-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }
.settings-row .body { flex: 1; min-width: 0; }
.settings-row .title { font-weight: 550; }
.settings-row .desc { font-size: 12.5px; color: var(--muted); }
kbd { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; overflow-x: auto; white-space: pre; }
