/* =============================================================
   PURE WHITE – base.css
   Variabili, tipografia, reset, componenti condivisi
   ============================================================= */

/* ── Rimuovi contorno blu al tocco su dispositivi mobili ── */
* {
  -webkit-tap-highlight-color: transparent;
}
*:focus {
  outline: none;
}
*:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* ── Custom Properties – Tema Light (White-Blue, default) ── */
:root {
  --c-primary:               #1a1a1a;
  --c-on-primary:            #ffffff;
  --c-primary-container:     #f0f0f0;
  --c-on-primary-container:  #1a1a1a;
  --c-secondary:             #555555;
  --c-on-secondary:          #ffffff;
  --c-secondary-container:   #e8e8e8;
  --c-on-secondary-container:#333333;
  --c-background:            #f5f6f8;
  --c-surface:               #ffffff;
  --c-surface-low:           #fafafa;
  --c-surface-container:     #f5f5f5;
  --c-surface-high:          #eeeeee;
  --c-surface-highest:       #e5e5e5;
  --c-surface-lowest:        #ffffff;
  --c-on-surface:            #1a1a1a;
  --c-on-surface-variant:    #555555;
  --c-outline:               #888888;
  --c-outline-variant:       #d4d4d4;
  --c-accent:                #4a9eff;
  --c-on-accent:             #ffffff;
  --c-accent-container:      #d6eaff;
  --c-on-accent-container:   #003366;
  --c-error:                 #ba1a1a;
  --c-error-container:       #ffdad6;

  /* Chip colori statici (non dipendono dal tema) */
  --c-chip-neg:              #d05d00;
  --c-chip-neg-border:       #ffcc99;
  --c-chip-neg-bg:           #fff9f5;
  --c-chip-pos:              #1b7a43;
  --c-chip-pos-border:       #a3e2bd;
  --c-chip-pos-bg:           #f4fbf7;
}

/* ── Tema Dark-Violet ── */
[data-theme="dark-violet"] {
  --c-primary:               #e0d6f5;
  --c-on-primary:            #2a1f45;
  --c-primary-container:     #3a2e58;
  --c-on-primary-container:  #e0d6f5;
  --c-secondary:             #b0a0d0;
  --c-on-secondary:          #1e1630;
  --c-secondary-container:   #332850;
  --c-on-secondary-container:#cfc0ec;
  --c-background:            #1a1626;
  --c-surface:               #1a1626;
  --c-surface-low:           #201c30;
  --c-surface-container:     #252038;
  --c-surface-high:          #2e2840;
  --c-surface-highest:       #38304e;
  --c-surface-lowest:        #221d34;
  --c-on-surface:            #e8e2f5;
  --c-on-surface-variant:    #b0a0d0;
  --c-outline:               #6e5e8a;
  --c-outline-variant:       #3a3055;
  --c-accent:                #9b72e0;
  --c-on-accent:             #ffffff;
  --c-accent-container:      #3a2868;
  --c-on-accent-container:   #d8c0ff;
  --c-error:                 #f28b82;
  --c-error-container:       #4a1818;

  /* Colori chip adattati al tema scuro (con trasparenze premium) */
  --c-chip-neg:              #ffb74d;
  --c-chip-neg-border:       rgba(255, 183, 77, 0.4);
  --c-chip-neg-bg:           rgba(255, 183, 77, 0.1);
  --c-chip-pos:              #81c784;
  --c-chip-pos-border:       rgba(129, 199, 132, 0.4);
  --c-chip-pos-bg:           rgba(129, 199, 132, 0.1);

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.30);
  --shadow-nav:  0 -2px 16px rgba(0, 0, 0, 0.35);
  --shadow-btn:  0 4px 16px rgba(155, 114, 224, 0.35);
}

/* ── :root aggiuntivo: font, spacing, shadow base ── */
:root {
  --font-headline: 'Ubuntu', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body:     system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   24px;
  --r-full: 9999px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.04);
  --shadow-nav:  0 -2px 16px rgba(0, 0, 0, 0.05);
  --shadow-btn:  0 4px 16px rgba(74, 158, 255, 0.25);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html   { font-size: 16px; -webkit-text-size-adjust: 100%; height: 100%; height: -webkit-fill-available; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }
input  { font-family: inherit; }
a      { color: inherit; text-decoration: none; }

body {
  font-family: var(--font-body);
  background: var(--c-background);
  color: var(--c-on-surface);
  line-height: 1.5;
  height: 100%;
  height: -webkit-fill-available;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ── Material Symbols ── */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 22px;
  line-height: 1;
  user-select: none;
  display: inline-block;
}
.icon-filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ── Nav Icon (PNG) ── */
.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  /* Usa mask-image per adattare il colore dell'icona al tema (come Material Symbols) */
  mask-image: var(--nav-icon-url);
  -webkit-mask-image: var(--nav-icon-url);
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  background-color: currentColor;
  opacity: 0.6;
}
.nav-item.active .nav-icon {
  opacity: 1;
}

/* ══════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════ */
.app-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  height: -webkit-fill-available;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-background);
  overflow: hidden;
  position: relative;
}

/* ── Top Bar ── */
.top-bar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface);
  box-shadow: 0 1px 0 var(--c-outline-variant);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
.top-bar__title {
  font-family: var(--font-headline);
  font-size: 26px;
  font-weight: 700;
  color: #222222;
  letter-spacing: 0;
}
.top-bar__actions {
  position: absolute;
  right: 12px;
  display: flex;
  gap: 4px;
}
/* ── Icon Button ── */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-accent);
  transition: background 0.18s, transform 0.15s;
}
.icon-btn:hover  { background: var(--c-surface-container); }
.icon-btn:active { transform: scale(0.88); }

/* ── Main Scrollable Area ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 16px 24px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
}
.main-content--home {
  padding-top: 0;
}

/* ── Home Footer (Copyright) ── */
.home-footer {
  margin-top: auto;
  padding: 16px 16px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--c-on-surface-variant);
  line-height: 1.6;
  flex-shrink: 0;
}
.home-footer a {
  color: var(--c-accent);
  font-weight: 600;
  text-decoration: none;
}
.home-footer a:hover {
  text-decoration: underline;
}

/* ── Bottom Nav ── */
.bottom-nav {
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 8px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  background: var(--c-surface-lowest);
  box-shadow: var(--shadow-nav);
  border-top: 1px solid var(--c-outline-variant);
  z-index: 20;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 24px;
  border-radius: var(--r-md);
  color: var(--c-secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:active { transform: scale(0.9); }
.nav-item.active {
  background: var(--c-surface-high);
  color: var(--c-on-surface);
}
.nav-item.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* ══════════════════════════════════════════
   HOME – HEADER & CITAZIONE (NO BACKGROUND)
   ══════════════════════════════════════════ */
.home-header {
  padding: calc(32px + env(safe-area-inset-top, 0px)) 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.home-title {
  font-family: var(--font-headline);
  font-size: 36px;
  font-weight: 700;
  font-style: normal;
  color: var(--c-on-surface-variant);
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  line-height: 1.1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.quote-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative;
}
.home-quote-text {
  font-family: var(--font-headline);
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.4;
  color: var(--c-on-surface-variant);
  letter-spacing: -0.02em;
  transition: opacity 0.3s ease;
  max-width: 90%;
}
.home-quote-ref {
  display: block;
  font-family: var(--font-headline);
  font-size: 13px;
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  color: var(--c-on-surface-variant);
  letter-spacing: -0.01em;
  transition: opacity 0.3s ease;
}
.home-quote-hint {
  display: block;
  font-family: var(--font-body);
  font-size: 9.5px;
  color: var(--c-outline);
  margin-top: 12px;
  letter-spacing: 0.03em;
  opacity: 0.5;
}

/* ══════════════════════════════════════════
   HOME – WIDGET GRID
   ══════════════════════════════════════════ */
.widget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.widget-card {
  background: var(--c-surface-lowest);
  border-radius: var(--r-xl);
  padding: 16px;
  border: 1px solid var(--c-surface-high);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
.widget-card--primary { cursor: pointer; transition: box-shadow 0.2s, transform 0.15s; }
.widget-card--primary:active { transform: scale(0.97); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.widget-card--placeholder {
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0.6;
  border: 1px solid var(--c-surface-high);
}
.widget-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--c-accent);
}
.widget-header .material-symbols-outlined { font-size: 18px; }
.widget-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--c-accent);
}

/* ── Widget Servizio (icona SVG centrata) ── */
.widget-card--servizio {
  display: flex;
  flex-direction: column;
}
.widget-servizio-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 6px;
  padding-top: 8px;
}
.servizio-svg {
  width: 36px;
  height: 36px;
  display: block;
}
.widget-servizio-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--c-on-surface);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  text-align: center;
  width: 100%;
  display: block;
}
.widget-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}
.placeholder-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-full);
  background: var(--c-surface-high);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--c-secondary);
}
.placeholder-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
}

/* ── Progress Bar ── */
.progress-row { display: flex; flex-direction: column; gap: 4px; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.progress-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-on-surface-variant);
}
.progress-value {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-on-surface);
}
.progress-track {
  width: 100%;
  height: 7px;
  background: var(--c-accent-container);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--c-accent);
  border-radius: var(--r-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 4px;
}

/* ══════════════════════════════════════════
   SERVIZIO PAGE
   ══════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.section-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--c-accent-container);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-on-accent-container);
  flex-shrink: 0;
}
.section-icon .material-symbols-outlined { font-size: 20px; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.section-title {
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 600;
  color: var(--c-on-surface);
  letter-spacing: -0.01em;
}
.section-title--centered {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
  letter-spacing: 0.02em;
}

/* ── Page Headline ── */
.page-headline {
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  color: var(--c-on-surface-variant);
  text-align: center;
  margin-bottom: -16px;
  letter-spacing: -0.01em;
}

/* Summary Card */
.summary-card {
  background: var(--c-surface-lowest);
  border-radius: var(--r-xl);
  padding: 24px 20px 22px;
  box-shadow: var(--shadow-card);
}
.summary-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-on-surface-variant);
  text-align: center;
  margin-bottom: 10px;
}
.summary-time {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  margin-bottom: 16px;
}
.summary-hours {
  font-family: var(--font-headline);
  font-size: 52px;
  font-weight: 700;
  color: var(--c-accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.summary-sep {
  font-family: var(--font-headline);
  font-size: 36px;
  font-weight: 300;
  color: var(--c-on-surface-variant);
  line-height: 1;
  margin: 0 2px;
}
.summary-minutes {
  font-family: var(--font-headline);
  font-size: 36px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.summary-goal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
  margin-top: 6px;
  letter-spacing: 0.03em;
}

/* Timer Card */
.timer-card {
  background: var(--c-surface-lowest);
  border-radius: var(--r-xl);
  padding: 24px 16px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.timer-display {
  font-family: var(--font-body);
  font-size: 46px;
  font-weight: 700;
  color: var(--c-on-surface);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 20px;
  line-height: 1;
}
.timer-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}
.timer-btn {
  width: 54px;
  height: 54px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.timer-btn:active { transform: scale(0.88); }
.timer-btn--play {
  background: var(--c-accent);
  color: var(--c-on-accent);
  box-shadow: var(--shadow-btn);
}
.timer-btn--play:hover { filter: brightness(1.12); }
.timer-btn--reset {
  background: var(--c-surface-high);
  color: var(--c-on-surface-variant);
}
.timer-btn--reset:hover { background: var(--c-surface-highest); }
.timer-btn--stop {
  background: var(--c-error-container);
  color: var(--c-error);
}
.timer-btn--stop:hover {
  background: var(--c-error);
  color: var(--c-error-container);
}
.timer-btn .material-symbols-outlined { font-size: 26px; }

/* Chips */
.chips-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
}
.chip {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 2px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--c-outline-variant);
  background: var(--c-surface-lowest);
  color: var(--c-on-surface-variant);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { background: var(--c-accent-container); border-color: var(--c-accent); color: var(--c-accent); }
.chip:active { transform: scale(0.92); }
.chip--neg {
  color: var(--c-chip-neg);
  border-color: var(--c-chip-neg-border);
  background: var(--c-chip-neg-bg);
}
.chip--neg:hover {
  background: var(--c-chip-neg-border);
  border-color: var(--c-chip-neg);
  color: var(--c-chip-neg);
}
.chip--pos {
  color: var(--c-chip-pos);
  border-color: var(--c-chip-pos-border);
  background: var(--c-chip-pos-bg);
}
.chip--pos:hover {
  background: var(--c-chip-pos-border);
  border-color: var(--c-chip-pos);
  color: var(--c-chip-pos);
}

/* Input Row */
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-on-surface-variant);
  padding-left: 4px;
}
.input-field {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--c-on-surface);
  background: var(--c-surface-lowest);
  border: 1.5px solid var(--c-outline-variant);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  width: 100%;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.input-field:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 15px;
  background: var(--c-accent);
  color: var(--c-on-accent);
  border-radius: var(--r-full);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.25);
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover  { filter: brightness(1.12); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary .material-symbols-outlined { font-size: 20px; }

/* ══════════════════════════════════════════
   BUTTON SECONDARY
   ══════════════════════════════════════════ */
.btn-secondary {
  width: 100%;
  padding: 14px;
  background: var(--c-surface-lowest);
  color: var(--c-primary);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid var(--c-outline-variant);
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.btn-secondary:hover  { background: var(--c-accent-container); border-color: var(--c-accent); }
.btn-secondary:active { transform: scale(0.97); }
.btn-secondary .material-symbols-outlined { font-size: 20px; }

/* ══════════════════════════════════════════
   BUTTON DANGER
   ══════════════════════════════════════════ */
.btn-danger {
  width: 100%;
  padding: 14px;
  background: var(--c-surface-lowest);
  color: var(--c-error);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid var(--c-error);
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.btn-danger:hover  { background: var(--c-error-container); border-color: var(--c-error); }
.btn-danger:active { transform: scale(0.97); }
.btn-danger .material-symbols-outlined { font-size: 20px; }

/* ══════════════════════════════════════════
   TOGGLE SEGMENTED (Anno solare / Anno teocratico)
   ══════════════════════════════════════════ */
.toggle-segment {
  display: flex;
  background: var(--c-surface-container);
  border-radius: var(--r-lg);
  padding: 3px;
  gap: 2px;
  position: relative;
}
.toggle-segment__btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: calc(var(--r-lg) - 2px);
  background: transparent;
  color: var(--c-on-surface-variant);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  line-height: 1.3;
  position: relative;
  z-index: 2;
  user-select: none;
}
.toggle-segment__btn:active {
  transform: scale(0.96);
}
.toggle-segment__btn.active {
  background: var(--c-surface-lowest);
  color: var(--c-on-surface);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ══════════════════════════════════════════
   TOGGLE SWITCH (On/Off)
   ══════════════════════════════════════════ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch__slider {
  position: absolute;
  inset: 0;
  background: var(--c-surface-container);
  border: 2px solid var(--c-outline-variant);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-switch__slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: var(--c-on-surface-variant);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-switch__native {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}
.toggle-switch input:checked + .toggle-switch__slider,
.toggle-switch__native:checked + .toggle-switch__slider {
  background: var(--c-primary);
  border-color: var(--c-primary);
}
.toggle-switch input:checked + .toggle-switch__slider::before,
.toggle-switch__native:checked + .toggle-switch__slider::before {
  transform: translateX(20px);
  background: var(--c-on-primary);
}
.toggle-switch input:focus-visible + .toggle-switch__slider,
.toggle-switch__native:focus-visible + .toggle-switch__slider {
  box-shadow: 0 0 0 3px var(--c-primary-container);
}

/* ══════════════════════════════════════════
   GDRIVE STATUS
   ══════════════════════════════════════════ */
.gdrive-status--connected {
  color: var(--c-primary) !important;
  font-weight: 600;
}

/* ══════════════════════════════════════════
   GDRIVE DISCONNECT MODAL
   ══════════════════════════════════════════ */
.gdrive-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gdrive-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.gdrive-modal__backdrop--visible {
  opacity: 1;
}
.gdrive-modal__content {
  position: relative;
  background: var(--c-surface-lowest);
  border-radius: var(--r-xl);
  padding: 28px 24px 20px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.gdrive-modal__content--visible {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.gdrive-modal__header {
  text-align: center;
  margin-bottom: 16px;
}
.gdrive-modal__icon {
  font-size: 40px;
  color: var(--c-error);
  display: block;
  margin-bottom: 8px;
}
.gdrive-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-on-surface);
  margin: 0;
}
.gdrive-modal__body {
  margin-bottom: 20px;
}
.gdrive-modal__body p {
  font-size: 14px;
  color: var(--c-on-surface-variant);
  line-height: 1.6;
  text-align: center;
  margin: 0;
}
.gdrive-modal__footer {
  display: flex;
  gap: 10px;
}
.gdrive-modal__footer .btn-secondary,
.gdrive-modal__footer .btn-danger {
  flex: 1;
}

/* ══════════════════════════════════════════
   OVERLAY / FULL-SCREEN MODAL
   ══════════════════════════════════════════ */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--c-background);
  z-index: 300;
  display: flex;
  flex-direction: column;
  animation: overlayIn 0.25s ease;
}
@keyframes overlayIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.overlay-content {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  height: -webkit-fill-available;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-background);
  overflow: hidden;
}
.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  flex-shrink: 0;
  border-bottom: 1px solid var(--c-outline-variant);
}
.overlay-title {
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 600;
  color: var(--c-accent);
}
.overlay-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

/* ── Trend Chart (andamento ultimi 12 mesi) ── */
.trend-chart-section {
  margin-bottom: 20px;
  padding: 12px 0 4px;
}
.trend-chart__title {
  font-family: var(--font-headline);
  font-size: 16px;
  font-weight: 600;
  color: var(--c-on-surface);
  text-align: center;
  margin-bottom: 12px;
}
.trend-chart__wrapper {
  background: var(--c-surface-lowest);
  border-radius: var(--r-xl);
  padding: 12px 8px 8px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--c-surface-high);
}
.trend-chart__wrapper canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-md);
}

/* ── Months List ── */
.months-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}
.month-item {
  background: var(--c-surface-lowest);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--c-surface-high);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.month-item:active { transform: scale(0.97); background: var(--c-surface-container); }
.month-item__left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.month-item__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-on-surface);
}
.month-item__total {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
}
.month-item__arrow {
  color: var(--c-outline);
  font-size: 20px;
}

/* ── Pulsante "Mostra altro" ── */
.show-more-btn {
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 24px;
  width: 100%;
  max-width: 300px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--r-lg, 12px);
}

/* ── Month Detail ── */
.month-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.month-detail__back {
  align-self: flex-start;
  margin-bottom: 4px;
}
.detail-month-title {
  font-family: var(--font-headline);
  font-size: 24px;
  font-weight: 600;
  color: var(--c-on-surface);
  margin-bottom: 4px;
}

/* ── Detail Add Form ── */
.detail-add {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--c-surface-low);
  border-radius: var(--r-xl);
}
.detail-add__inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.detail-add__input {
  width: 100px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  padding: 10px 8px;
}
.detail-add__sep {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-on-surface-variant);
}
.detail-add__btn {
  margin-top: 0;
  padding: 12px;
  font-size: 14px;
}

/* ══════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--c-accent);
  color: var(--c-on-accent);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--r-full);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 100;
  max-width: 88vw;
  text-align: center;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── FAQ accordion (future-proof) ── */
.faq-item { border-bottom: 1px solid var(--c-outline-variant); }
.faq-question {
  list-style: none;
  cursor: pointer;
  padding: 14px 32px 14px 0;
  font-weight: 600;
  font-size: 14px;
  background: url('../img/chevron-down.svg') no-repeat right center / 20px;
}
.faq-question::-webkit-details-marker { display: none; }
details[open] .faq-question { background-image: url('../img/chevron-up.svg'); }
.faq-answer { padding: 0 0 14px; font-size: 14px; line-height: 1.6; color: var(--c-on-surface-variant); }

/* ══════════════════════════════════════════
   MODAL (Delete Confirmation)
   ══════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
}

.modal-content {
  position: relative;
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 24px 8px;
  text-align: center;
}

.modal-icon {
  font-size: 40px;
  color: var(--c-error);
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--c-error-container);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.modal-title {
  font-family: var(--font-headline);
  font-size: 18px;
  font-weight: 700;
  color: var(--c-on-surface);
  margin: 0;
}

.modal-body {
  padding: 8px 24px 16px;
  text-align: center;
}

.modal-body p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-on-surface-variant);
  margin: 0;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 8px 24px 24px;
}

.modal-footer .btn-secondary,
.modal-footer .btn-danger {
  flex: 1;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
  transition: all 0.18s;
}

.modal-footer .btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-footer .btn-danger {
  background: var(--c-error);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(186, 26, 26, 0.25);
}

.modal-footer .btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(186, 26, 26, 0.4);
}

/* ══════════════════════════════════════════
   STORICO ENTRATE
   ══════════════════════════════════════════ */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  background: var(--c-surface-lowest);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--c-surface-high);
}
.history-item__left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-item__date {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-on-surface-variant);
}
.history-item__time {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-accent);
}
.history-item__delete {
  color: var(--c-outline);
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
}
.history-item__delete:hover {
  background: var(--c-error-container);
  color: var(--c-error);
}
.history-item__delete:active {
  transform: scale(0.88);
}
.history-item__delete .material-symbols-outlined {
  font-size: 20px;
}
.history-empty {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--c-on-surface-variant);
  background: var(--c-surface-low);
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--c-outline-variant);
}

/* ══════════════════════════════════════════
   CUSTOM DIALOG / MODAL
   ══════════════════════════════════════════ */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 26, 35, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.dialog-overlay.show {
  opacity: 1;
}
.dialog-box {
  background: var(--c-surface-lowest);
  border-radius: var(--r-xl);
  padding: 24px;
  width: 88%;
  max-width: 380px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.10);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dialog-overlay.show .dialog-box {
  transform: scale(1);
}
.dialog-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: var(--c-error-container);
  color: var(--c-error);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.dialog-icon .material-symbols-outlined {
  font-size: 24px;
}
.dialog-title {
  font-family: var(--font-headline);
  font-size: 20px;
  font-weight: 700;
  color: var(--c-on-surface);
  margin-bottom: 8px;
}
.dialog-message {
  font-size: 13.5px;
  color: var(--c-on-surface-variant);
  line-height: 1.5;
  margin-bottom: 24px;
}
.dialog-actions {
  display: flex;
  gap: 12px;
}
.dialog-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s;
}
.dialog-btn--cancel {
  background: var(--c-surface-high);
  color: var(--c-on-surface-variant);
}
.dialog-btn--cancel:hover {
  background: var(--c-surface-highest);
}
.dialog-btn--confirm {
  background: var(--c-error);
  color: var(--c-surface-lowest);
}
.dialog-btn--confirm:hover {
  filter: brightness(0.85);
}

/* ══════════════════════════════════════════
   THEME PICKER (Profilo)
   ══════════════════════════════════════════ */
.theme-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.theme-card {
  position: relative;
  border-radius: var(--r-xl);
  padding: 16px 14px 14px;
  border: 2px solid var(--c-outline-variant);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  background: var(--c-surface-lowest);
}
.theme-card:active { transform: scale(0.96); }
.theme-card.active {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 20%, transparent);
}
.theme-card__preview {
  width: 100%;
  height: 52px;
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}
/* Anteprima tema Light */
.theme-card--light .theme-card__preview {
  background: #ffffff;
  border: 1px solid #e0e0e0;
}
.theme-card--light .tp-bar-1 { width: 28px; height: 8px; border-radius: 4px; background: #4a9eff; }
.theme-card--light .tp-bar-2 { width: 18px; height: 8px; border-radius: 4px; background: #d6eaff; }
.theme-card--light .tp-dot   { width: 10px; height: 10px; border-radius: 50%; background: #4a9eff; }
/* Anteprima tema Dark-Violet */
.theme-card--dark-violet .theme-card__preview {
  background: #1a1626;
  border: 1px solid #3a3055;
}
.theme-card--dark-violet .tp-bar-1 { width: 28px; height: 8px; border-radius: 4px; background: #9b72e0; }
.theme-card--dark-violet .tp-bar-2 { width: 18px; height: 8px; border-radius: 4px; background: #3a2868; }
.theme-card--dark-violet .tp-dot   { width: 10px; height: 10px; border-radius: 50%; background: #9b72e0; }

.theme-card__name {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-on-surface);
  letter-spacing: 0.02em;
  text-align: center;
}
.theme-card__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-on-accent);
  display: none;
  align-items: center;
  justify-content: center;
}
.theme-card__check .material-symbols-outlined { font-size: 14px; }
.theme-card.active .theme-card__check { display: flex; }

/* ══════════════════════════════════════════
   INSTALL PWA POPUP (bottom sheet)
   ══════════════════════════════════════════ */
.install-popup {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(110%);
  width: 100%;
  max-width: 480px;
  background: var(--c-surface-lowest);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.14);
  border-top: 1px solid var(--c-outline-variant);
  z-index: 500;
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.install-popup.show {
  transform: translateX(-50%) translateY(0);
}
.install-popup__drag {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--c-outline-variant);
  margin: 0 auto -4px;
}
.install-popup__row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.install-popup__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.install-popup__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.install-popup__text { flex: 1; }
.install-popup__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-on-surface);
  line-height: 1.3;
}
.install-popup__sub {
  font-size: 12px;
  color: var(--c-on-surface-variant);
  margin-top: 2px;
  line-height: 1.4;
}
.install-popup__actions {
  display: flex;
  gap: 10px;
}
.install-popup__btn-install {
  flex: 1;
  padding: 13px;
  background: var(--c-accent);
  color: var(--c-on-accent);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.install-popup__btn-install:hover  { filter: brightness(1.1); }
.install-popup__btn-install:active { transform: scale(0.96); }
.install-popup__btn-dismiss {
  padding: 13px 18px;
  background: var(--c-surface-high);
  color: var(--c-on-surface-variant);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--c-outline-variant);
  cursor: pointer;
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.install-popup__btn-dismiss:hover  { background: var(--c-surface-highest); }
.install-popup__btn-dismiss:active { transform: scale(0.96); }

/* ══════════════════════════════════════════
   CUSTOM SELECT MENU (Language & generic)
   ══════════════════════════════════════════ */
.custom-select {
  position: relative;
  width: 100%;
  user-select: none;
  text-align: left;
}
.custom-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--c-on-surface);
  background: var(--c-surface-lowest);
  border: 1.5px solid var(--c-outline-variant);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.custom-select__trigger:hover {
  border-color: var(--c-primary);
}
.custom-select__trigger:focus-visible {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 20%, transparent);
}
.custom-select__arrow {
  color: var(--c-on-surface-variant);
  transition: transform 0.2s ease;
  font-size: 20px;
}
.custom-select.open .custom-select__arrow {
  transform: rotate(180deg);
}
.custom-select__options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  background: var(--c-surface-lowest);
  border: 1.5px solid var(--c-outline-variant);
  border-radius: var(--r-lg);
  margin: 0;
  padding: 6px 0;
  list-style: none;
  z-index: 100;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.custom-select.open .custom-select__options {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.custom-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-on-surface);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.custom-select__option:hover {
  background: var(--c-surface-high);
}
.custom-select__option.selected {
  color: var(--c-primary);
  font-weight: 700;
  background: var(--c-primary-container);
}
.custom-select__option.selected::after {
  content: 'check';
  font-family: 'Material Symbols Outlined';
  font-size: 18px;
  font-weight: normal;
  font-style: normal;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════
   WIDGET DISPONIBILITÀ (Home)
   ══════════════════════════════════════════ */
.widget-card--disponibilita {
  cursor: pointer;
}
.widget-card--disponibilita:hover { box-shadow: 0 4px 20px rgba(74,158,255,0.15); }
.widget-disp-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  margin-bottom: 6px;
}
.widget-disp-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
}
.widget-disp-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.widget-disp-stat-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.widget-disp-stat-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-on-surface-variant);
}
.widget-disp-stat-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-on-surface);
}
.widget-disp-stat-sep {
  color: var(--c-outline);
  font-size: 9px;
  font-weight: 800;
  margin: 0 2px;
}
.widget-disp-desc {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
  margin: 0 0 8px;
  line-height: 1.3;
}

/* ══════════════════════════════════════════
   PAGINA DISPONIBILITÀ
   ══════════════════════════════════════════ */

/* Header */
.disp-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 4px 4px;
  flex-shrink: 0;
}
.disp-title-row .page-headline {
  margin: 0;
  text-align: center;
}
.disp-title-row .disp-filter-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}
.disp-filter-btn {
  color: var(--c-accent);
  position: relative;
}
.disp-filter-btn.active {
  background: var(--c-accent-container);
}
.disp-filter-btn.active::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-accent);
}

/* Pannello Filtro */
.disp-filter-panel {
  background: var(--c-surface-lowest);
  border: 1.5px solid var(--c-accent-container);
  border-radius: var(--r-xl);
  padding: 14px 12px 16px;
  animation: dispFilterIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.disp-filter-panel[hidden] { display: none; }
@keyframes dispFilterIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.disp-filter-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 10px;
  text-align: center;
}
.disp-filter-gender-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--c-outline-variant);
  padding-bottom: 12px;
}
.disp-filter-gender-btn {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--r-full);
  border: 1.5px solid var(--c-outline-variant);
  background: transparent;
  color: var(--c-on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.disp-filter-gender-btn .material-symbols-outlined {
  font-size: 14px;
}
.disp-filter-gender-btn.active {
  background: var(--c-accent-container);
  border-color: var(--c-accent);
  color: var(--c-accent);
}

/* Riga settimana (condivisa filtro + card) */
.disp-week-row {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  align-items: flex-end;
}
.disp-week-row-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}
.disp-time-labels-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding-bottom: 2px;
}
.disp-time-row-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--c-on-surface-variant);
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  opacity: 0.75;
}
/* Etichette M/P compatte (lista persone con slot --sm) */
.disp-person-card .disp-time-row-label {
  height: 14px;
}
.disp-day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.disp-day-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-on-surface-variant);
  line-height: 1;
  margin-bottom: 2px;
}

/* Slot mattina/pomeriggio */
.disp-slot {
  width: 100%;
  height: 22px;
  border-radius: 10px;
  border: none;
  background: rgba(120, 120, 130, 0.20);
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  display: block;
  padding: 0;
}
.disp-slot:active { transform: scale(0.88); }
.disp-slot[aria-pressed="true"],
.disp-slot--readonly[aria-pressed="true"],
.disp-slot--readonly.active {
  background: var(--c-accent);
  border: none;
  box-shadow: none;
}

/* Slot compatti (lista persone) */
.disp-slot--sm {
  height: 14px;
  border-radius: 8px;
}

/* Slot nel filtro: colore blu accento flat */
.disp-slot--filter[aria-pressed="true"] {
  background: var(--c-accent);
  border: none;
  box-shadow: none;
}

/* Azioni drawer: Elimina + Salva affiancati */
.disp-drawer__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.disp-drawer__actions .disp-btn-delete {
  flex: 0 0 auto;
  width: auto;
  padding: 10px 16px;
  font-size: 13px;
  border-radius: var(--r-lg);
}
.disp-drawer__actions .disp-btn-save {
  flex: 1;
  width: auto;
  padding: 12px;
  font-size: 14px;
  border-radius: var(--r-lg);
}
.disp-drawer__actions .disp-btn-delete .material-symbols-outlined,
.disp-drawer__actions .disp-btn-save .material-symbols-outlined {
  font-size: 18px;
}

/* Pulsante Seleziona Tutti */
.disp-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.disp-btn-select-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--c-accent);
  background: transparent;
  color: var(--c-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.disp-btn-select-all:active {
  background: var(--c-accent-container);
}
.disp-btn-select-all .material-symbols-outlined {
  font-size: 16px;
}

/* Lista persone */
.disp-people-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Card persona */
.disp-person-card {
  background: var(--c-surface-lowest);
  border-radius: var(--r-xl);
  padding: 14px;
  border: 1px solid var(--c-surface-high);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s, opacity 0.4s ease, order 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}
.disp-person-card:active { transform: scale(0.98); }
.disp-person-card--dimmed {
  opacity: 0.3;
}
.disp-person-card__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-on-surface);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.disp-person-card__name .material-symbols-outlined {
  font-size: 16px;
  color: var(--c-on-surface-variant);
}

/* Stato vuoto / nessun risultato */
.disp-empty,
.disp-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.disp-empty[hidden],
.disp-no-results[hidden] { display: none; }
.disp-empty-icon {
  font-size: 52px;
  color: var(--c-outline);
  opacity: 0.5;
}
.disp-empty-text {
  font-size: 14px;
  color: var(--c-on-surface-variant);
  line-height: 1.5;
  max-width: 240px;
}

/* FAB */
.disp-fab {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  right: calc(50% - 240px + 16px);
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  color: var(--c-on-accent);
  box-shadow: 0 6px 20px rgba(74,158,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform 0.18s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
  border: none;
  cursor: pointer;
}
.disp-fab:hover   { box-shadow: 0 8px 28px rgba(74,158,255,0.5); transform: translateY(-2px); }
.disp-fab:active  { transform: scale(0.92); }
.disp-fab .material-symbols-outlined { font-size: 26px; }
@media (max-width: 480px) {
  .disp-fab { right: 16px; }
}

/* ── Drawer (bottom sheet) ── */
.disp-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: max(8px, env(safe-area-inset-top));
}
.disp-drawer-overlay[hidden] { display: none; }
.disp-drawer {
  width: 100%;
  max-width: 480px;
  background: var(--c-surface-lowest);
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  padding: 0 0 calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  animation: drawerDown 0.32s cubic-bezier(0.34,1.56,0.64,1);
  max-height: calc(100dvh - max(8px, env(safe-area-inset-top)));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@keyframes drawerDown {
  from { transform: translateY(-100%); opacity: 0.5; }
  to   { transform: translateY(0);    opacity: 1; }
}
.disp-drawer__handle {
  width: 40px;
  height: 4px;
  background: var(--c-outline-variant);
  border-radius: 2px;
  margin: 0 auto 8px;
  padding-top: 12px;
}
.disp-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--c-outline-variant);
}
.disp-drawer__title {
  font-family: var(--font-headline);
  font-size: 20px;
  font-weight: 700;
  color: var(--c-on-surface);
}
.disp-drawer__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.disp-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.disp-input-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-on-surface-variant);
  padding-left: 4px;
}
.disp-name-input {
  font-size: 17px;
  font-weight: 600;
  text-align: left;
}
.disp-grid-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.disp-grid-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  font-size: 11px;
  color: var(--c-on-surface-variant);
  font-weight: 600;
}
.disp-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.disp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  border: 1.5px solid var(--c-outline-variant);
  background: transparent;
}
.disp-legend-dot--available {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.disp-legend-dot--unavailable {
  background: transparent;
  border-color: var(--c-outline-variant);
}
/* Selettore Genere nel Drawer */
.disp-gender-selector {
  display: flex;
  gap: 10px;
}
.disp-gender-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-xl);
  border: 2px solid var(--c-outline-variant);
  background: var(--c-surface-lowest);
  color: var(--c-on-surface-variant);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.disp-gender-option:hover {
  background: var(--c-surface-high);
}
.disp-gender-option.active[data-gender="M"] {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
}
.disp-gender-option.active[data-gender="F"] {
  border-color: #ec4899;
  background: rgba(236, 72, 153, 0.08);
  color: #be185d;
}
/* Icone di genere (drawer + filtro) */
.disp-gender-icon-svg {
  width: 22px;
  height: 22px;
  display: inline-block;
  object-fit: contain;
  opacity: 0.5;
}
.disp-gender-option.active .disp-gender-icon-svg,
.disp-filter-gender-btn.active .disp-gender-icon-svg {
  opacity: 1;
}
.disp-filter-gender-btn .disp-gender-icon-svg {
  width: 16px;
  height: 16px;
}

/* Badge di genere sulle card persone */
.disp-person-card__gender-svg {
  width: 20px;
  height: 20px;
  display: inline-block;
  object-fit: contain;
}

/* ══════════════════════════════════════════
   WIDGET APPUNTI (Home)
   ══════════════════════════════════════════ */
.widget-card--appunti { cursor: pointer; }
.widget-appunti-icon {
  font-size: 38px;
  color: var(--c-accent);
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 40;
  margin-bottom: 2px;
}
.widget-appunti-count {
  display: flex;
  align-items: baseline;
  gap: 5px;
  justify-content: center;
  padding-bottom: 4px;
}
.widget-appunti-num {
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  color: var(--c-accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.widget-appunti-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-on-surface-variant);
}

/* ══════════════════════════════════════════
   APPUNTI – MAIN PAGE
   ══════════════════════════════════════════ */
.notes-main {
  padding-top: 0 !important;
  gap: 0 !important;
  overflow-x: hidden;
}

/* ── Top Bar ── */
.notes-topbar {
  display: flex;
  align-items: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 8px 12px;
  gap: 4px;
  background: var(--c-background);
  position: sticky;
  top: 0;
  z-index: 30;
}
.notes-topbar__title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  text-align: center;
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 700;
  color: var(--c-on-surface);
  letter-spacing: -0.01em;
  white-space: nowrap;
  max-width: calc(100% - 120px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.notes-topbar__actions {
  display: flex;
  gap: 0;
  margin-left: auto;
}

/* ── Search Bar (sempre visibile) ── */
.notes-search-bar {
  padding: 0 12px;
  background: var(--c-background);
}
.notes-search-inner {
  display: flex;
  align-items: center;
  background: var(--c-surface-container);
  border-radius: var(--r-full);
  padding: 0 8px 0 14px;
  gap: 6px;
  border: 1.5px solid var(--c-outline-variant);
  transition: border-color 0.2s;
}
.notes-search-inner:focus-within {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(74,158,255,0.12);
}
.notes-search-icon {
  font-size: 20px;
  color: var(--c-on-surface-variant);
  flex-shrink: 0;
}
.notes-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--c-on-surface);
  padding: 11px 0;
  outline: none;
  font-family: var(--font-body);
}
.notes-search-input::placeholder { color: var(--c-outline); }

/* ── Sort Dropdown ── */
.notes-sort-dropdown {
  position: absolute;
  top: 72px;
  right: 12px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-outline-variant);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 100;
  min-width: 220px;
  overflow: hidden;
  animation: dropdownIn 0.18s cubic-bezier(0.4,0,0.2,1);
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.notes-sort-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-on-surface);
  background: none;
  text-align: left;
  transition: background 0.15s;
}
.notes-sort-option .material-symbols-outlined { font-size: 18px; color: var(--c-on-surface-variant); }
.notes-sort-option .sort-arrow { margin-left: auto; }
.notes-sort-option:hover { background: var(--c-surface-container); }
.notes-sort-option.active { color: var(--c-accent); }
.notes-sort-option.active .material-symbols-outlined { color: var(--c-accent); }

/* ── Notes Grid (masonry 2-col) ── */
.notes-grid {
  column-count: 2;
  column-gap: 12px;
  padding: 10px 8px 100px;
}

/* ── Note Card ── */
.note-card {
  background: var(--c-surface);
  border-radius: 10px;
  border: 1.5px solid var(--c-outline-variant);
  overflow: hidden;
  display: inline-flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  -webkit-tap-highlight-color: transparent;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  animation: cardFadeIn 0.25s ease;
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.note-card:active { transform: scale(0.97); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.note-card__cover {
  width: 100%;
  display: block;
  border-bottom: 1px solid var(--c-outline-variant);
  overflow: hidden;
}
.note-card__cover img {
  width: 100%;
  height: auto;
  display: block;
}
.note-card__body {
  padding: 10px 10px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.note-card__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-on-surface);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.note-card__title a {
  color: var(--c-on-surface-variant);
  text-decoration: none;
}
.note-card__title a:hover {
  text-decoration: underline;
}
.note-card__preview {
  font-size: 11px;
  color: var(--c-on-surface-variant);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 10;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.note-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--c-outline-variant);
  background: var(--c-surface-container);
  color: var(--c-on-surface-variant);
  font-size: 0.85em;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: text-bottom;
}
.note-preview-link::before {
  content: 'link';
  font-family: 'Material Symbols Outlined';
  font-size: 11px;
  font-weight: 400;
  color: var(--c-on-surface-variant);
}
.note-preview-check {
  display: block;
  font-size: 11px;
  color: var(--c-on-surface-variant);
  margin: 2px 0;
}
.note-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.note-card__date {
  font-size: 9px;
  color: var(--c-outline);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.note-card__tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--c-surface-container-high);
  color: var(--c-on-surface-variant);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-card__tag:only-child {
  max-width: none;
  overflow: visible;
}
.note-card--archived { opacity: 1; }

/* ── Sezione archiviate nella griglia note ── */
.notes-archived-header {
  width: 100%;
  column-span: all;
  -webkit-column-span: all;
  break-before: column;
  -webkit-column-break-before: always;
  margin: 16px 0 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--c-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  grid-column: 1 / -1;
}

/* ── Note Card Selection ── */
.note-card__select {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--c-outline-variant);
  background: var(--c-surface);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--c-on-accent);
}
.note-card__select .material-symbols-outlined {
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.15s;
}
.note-card--selected .note-card__select {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.note-card--selected .note-card__select .material-symbols-outlined {
  opacity: 1;
}
.note-card--selected {
  box-shadow: 0 0 0 2px var(--c-accent), 0 2px 10px rgba(0,0,0,0.08);
}

/* ── Selection Bar ── */
.notes-selection-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--c-surface);
  border-top: 1px solid var(--c-outline-variant);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  animation: selectionBarUp 0.25s ease;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
@keyframes selectionBarUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.notes-selection-bar__inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 12px;
}
.notes-selection-bar__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-on-surface-variant);
  flex-shrink: 0;
}
.notes-selection-bar__count {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-on-surface);
  flex-shrink: 0;
  min-width: 24px;
  text-align: center;
}
.notes-selection-bar__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.notes-selection-bar__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  font-size: 10px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
  background: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.notes-selection-bar__btn:hover {
  background: var(--c-surface-container);
}
.notes-selection-bar__btn .material-symbols-outlined {
  font-size: 22px;
}
.notes-selection-bar__btn:last-child {
  color: var(--c-error);
}

/* ── Batch Tag Popup ── */
.notes-batch-tag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: linkActionFadeIn 0.15s ease;
}
.notes-batch-tag-sheet {
  background: var(--c-surface);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px rgba(0,0,0,0.14);
  animation: linkActionSlideUp 0.2s ease;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}
.notes-batch-tag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.notes-batch-tag-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-on-surface);
}
.notes-batch-tag-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}
.notes-batch-tag-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-on-surface);
  background: none;
  border-radius: 10px;
  text-align: left;
  transition: background 0.15s;
  cursor: pointer;
}
.notes-batch-tag-option:hover {
  background: var(--c-surface-container);
}
.notes-batch-tag-option.active {
  background: var(--c-accent-container);
  color: var(--c-accent);
  font-weight: 600;
}
.notes-batch-tag-option .material-symbols-outlined {
  font-size: 20px;
  color: var(--c-on-surface-variant);
}
.notes-batch-tag-option.active .material-symbols-outlined {
  color: var(--c-accent);
}
.notes-batch-tag-new {
  display: flex;
  border-top: 1px solid var(--c-outline-variant);
  padding-top: 10px;
  margin-top: 10px;
  gap: 8px;
}
.notes-batch-tag-new input {
  flex: 1;
  border: 1.5px solid var(--c-outline-variant);
  border-radius: var(--r-lg);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--c-on-surface);
  background: var(--c-surface-container);
  outline: none;
}
.notes-batch-tag-new input:focus {
  border-color: var(--c-accent);
}
.notes-batch-tag-new-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notes-batch-tag-new-btn .material-symbols-outlined {
  font-size: 20px;
}

/* ── Empty State ── */
.notes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 24px;
  text-align: center;
}
.notes-empty__icon {
  font-size: 64px;
  color: var(--c-outline-variant);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 48;
}
.notes-empty__text {
  font-size: 15px;
  color: var(--c-on-surface-variant);
  font-weight: 500;
  line-height: 1.5;
}

/* ── FAB (nuova nota) ── */
.notes-fab {
  position: fixed;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  right: 18px;
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  color: var(--c-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(74,158,255,0.40);
  z-index: 25;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.notes-fab .material-symbols-outlined { font-size: 28px; }
.notes-fab:active { transform: scale(0.90); box-shadow: 0 2px 8px rgba(74,158,255,0.30); }
.notes-fab:hover  { filter: brightness(1.12); }

/* ══════════════════════════════════════════
   APPUNTI – TAG DRAWER (sidebar sinistra)
   ══════════════════════════════════════════ */
.notes-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 50;
  animation: fadeIn 0.2s ease;
}
.notes-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--c-surface);
  z-index: 51;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 32px rgba(0,0,0,0.18);
  transform: translateX(0);
  animation: drawerSlideIn 0.28s cubic-bezier(0.4,0,0.2,1);
}
@keyframes drawerSlideIn {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
.notes-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 16px 12px;
  border-bottom: 1px solid var(--c-outline-variant);
}
.notes-drawer__title {
  font-family: var(--font-headline);
  font-size: 20px;
  font-weight: 700;
  color: var(--c-on-surface);
}
.notes-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notes-drawer__sep {
  border: none;
  border-top: 1px solid var(--c-outline-variant);
  margin: 8px 8px;
}
.notes-tag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-lg);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.notes-tag-item .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }
.notes-tag-item:hover  { background: var(--c-surface-container); }
.notes-tag-item.active { background: var(--c-accent-container); color: var(--c-accent); }
.notes-tag-item.active .material-symbols-outlined { color: var(--c-accent); }
.notes-tag-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--c-surface-high);
  color: var(--c-on-surface-variant);
  border-radius: var(--r-full);
  padding: 2px 8px;
  min-width: 24px;
  text-align: center;
}
.notes-tag-item.active .notes-tag-count {
  background: var(--c-accent);
  color: var(--c-on-accent);
}
/* Etichette utente nella lista drawer — swipe bidirezionale */
.notes-tags-list { display: flex; flex-direction: column; gap: 4px; }
.notes-tag-swipe-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.notes-tag-swipe-delete {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.notes-tag-swipe-delete--left {
  right: 0;
  background: var(--c-error);
  color: #fff;
}
.notes-tag-swipe-delete--right {
  left: 0;
  background: var(--c-error);
  color: #fff;
}
.notes-tag-swipe-row.swiped-left .notes-tag-swipe-delete--left,
.notes-tag-swipe-row.swiping-left .notes-tag-swipe-delete--left,
.notes-tag-swipe-row.swiped-right .notes-tag-swipe-delete--right,
.notes-tag-swipe-row.swiping-right .notes-tag-swipe-delete--right {
  opacity: 1;
}
.notes-tag-swipe-delete .material-symbols-outlined { font-size: 20px; }
.notes-tag-swipe-row .notes-tag-item {
  position: relative;
  z-index: 1;
  background: var(--c-surface);
  transition: none;
  width: 100%;
  margin: 0;
  border-radius: var(--r-lg);
}
.notes-tag-swipe-row .notes-tag-item.active {
  background: var(--c-accent-container);
}
/* Aggiungi nuova etichetta */
.notes-new-tag-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 6px 4px;
  margin-top: 4px;
  border-top: 1px solid var(--c-outline-variant);
}
.notes-new-tag-input {
  flex: 1;
  border: 1.5px solid var(--c-outline-variant);
  border-radius: var(--r-lg);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--c-on-surface);
  background: var(--c-surface-container);
  outline: none;
  transition: border-color 0.2s;
}
.notes-new-tag-input:focus { border-color: var(--c-accent); }
.notes-new-tag-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  color: var(--c-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: filter 0.15s;
}
.notes-new-tag-btn:hover { filter: brightness(1.12); }
.notes-new-tag-btn .material-symbols-outlined { font-size: 20px; }

/* ══════════════════════════════════════════
   APPUNTI – EDITOR FULLSCREEN
   ══════════════════════════════════════════ */
.notes-editor-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-background);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--keyboard-height, 0px);
  animation: editorSlideUp 0.28s cubic-bezier(0.4,0,0.2,1);
}
@keyframes editorSlideUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to   { transform: translateY(0);    opacity: 1;   }
}
.notes-editor-overlay.closing {
  animation: editorSlideDown 0.24s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes editorSlideDown {
  from { transform: translateY(0);    opacity: 1; }
  to   { transform: translateY(100%); opacity: 0; }
}
.notes-editor-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* Editor Header */
.notes-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 8px 10px;
  background: var(--c-background);
  flex-shrink: 0;
  z-index: 10;
}
.notes-editor-header-actions { display: flex; gap: 2px; }

/* Header Tag Dropdown */
.notes-header-tag-dropdown {
  position: absolute;
  top: calc(56px + env(safe-area-inset-top, 0px));
  right: 12px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-outline-variant);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 300;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  animation: dropdownIn 0.18s ease;
  display: flex;
  flex-direction: column;
}
.notes-header-tag-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
}
.notes-header-tag-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 2px 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-on-surface);
  background: none;
  border-radius: 10px;
  text-align: left;
  transition: background 0.15s, color 0.15s, transform 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
}
.notes-header-tag-option:hover { background: var(--c-surface-container); }
.notes-header-tag-option.active {
  background: var(--c-accent-container);
  color: var(--c-on-accent-container);
  font-weight: 600;
}
.notes-header-tag-option .material-symbols-outlined {
  font-size: 20px;
  color: var(--c-on-surface-variant);
  transition: color 0.15s;
}
.notes-header-tag-option.active .material-symbols-outlined { color: var(--c-accent); }
.notes-header-tag-new {
  display: flex;
  border-top: 1px solid var(--c-outline-variant);
  background: var(--c-surface-container);
  position: sticky;
  bottom: 0;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
}
.notes-header-tag-new input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--c-on-surface);
  outline: none;
}
.notes-header-tag-new input::placeholder { color: var(--c-outline); }
.notes-header-tag-new button {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--c-accent);
  cursor: pointer;
  border-left: 1px solid var(--c-outline-variant);
  transition: background 0.15s;
}
.notes-header-tag-new button:hover { background: rgba(0,0,0,0.04); }

/* Editor Scrollable Content */
.notes-editor-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Copertina */
.notes-cover-area { display: flex; flex-direction: column; gap: 8px; }
.notes-cover-preview {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1.5px solid var(--c-outline-variant);
}
.notes-cover-img {
  width: 100%;
  height: auto;
  display: block;
}
.notes-cover-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.notes-cover-remove:hover { background: rgba(0,0,0,0.8); }
.notes-cover-remove .material-symbols-outlined { font-size: 16px; }
.notes-cover-add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--c-outline-variant);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-on-surface-variant);
  background: var(--c-surface-container);
  transition: border-color 0.2s, color 0.2s;
  width: 100%;
  justify-content: center;
}
.notes-cover-add-btn:hover { border-color: var(--c-accent); color: var(--c-accent); }
.notes-cover-add-btn .material-symbols-outlined { font-size: 20px; }

/* Titolo nota */
.notes-title-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-headline);
  font-size: 24px;
  font-weight: 700;
  color: var(--c-on-surface);
  outline: none;
  padding: 4px 0;
  line-height: 1.25;
}
.notes-title-input::placeholder { color: var(--c-outline); }

/* Tag inline nell'editor */
.notes-inline-tags {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  position: relative;
  margin-bottom: 4px;
}
.notes-inline-tags__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.notes-inline-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 10px;
  border-radius: var(--r-full);
  background: var(--c-accent-container);
  color: var(--c-on-accent-container);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.notes-inline-tag-remove {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  background: none;
  padding: 0;
}
.notes-inline-tag-remove .material-symbols-outlined { font-size: 12px; }
.notes-inline-tags__add {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  border: 1.5px dashed var(--c-outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-on-surface-variant);
  background: none;
  transition: border-color 0.15s, color 0.15s;
}
.notes-inline-tags__add:hover { border-color: var(--c-accent); color: var(--c-accent); }
.notes-inline-tags__add .material-symbols-outlined { font-size: 16px; }

/* Dropdown scelta tag */
.notes-tag-picker {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  background: var(--c-surface);
  border: 1.5px solid var(--c-outline-variant);
  border-radius: var(--r-lg);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
  z-index: 150;
  min-width: 200px;
  max-height: 260px;
  overflow-y: auto;
  animation: dropdownUp 0.15s ease;
  display: flex;
  flex-direction: column;
}
@keyframes dropdownUp {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.notes-tag-picker__empty {
  padding: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--c-on-surface-variant);
}
.notes-tag-picker__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-on-surface);
  background: none;
  text-align: left;
  transition: background 0.15s;
}
.notes-tag-picker__option:hover { background: var(--c-surface-container); }
.notes-tag-picker__option.active { color: var(--c-accent); font-weight: 700; }
.notes-tag-picker__option .material-symbols-outlined { font-size: 18px; color: var(--c-on-surface-variant); }
.notes-tag-picker__option.active .material-symbols-outlined { color: var(--c-accent); }

/* Input per nuova targhetta */
.notes-tag-picker__new {
  display: flex;
  border-top: 1px solid var(--c-outline-variant);
  background: var(--c-surface-container);
  margin-top: auto;
  position: sticky;
  bottom: 0;
}
.notes-tag-picker__input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--c-on-surface);
  outline: none;
}
.notes-tag-picker__input::placeholder { color: var(--c-outline); }
.notes-tag-picker__add-btn {
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--c-accent);
  cursor: pointer;
  border-left: 1px solid var(--c-outline-variant);
}
.notes-tag-picker__add-btn:hover { background: rgba(0,0,0,0.05); }
.notes-tag-picker__add-btn .material-symbols-outlined { font-size: 18px; }

/* Editor Body (contenteditable) */
.notes-editor-body {
  flex: 1;
  min-height: 200px;
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--c-on-surface);
  line-height: 1.7;
  outline: none;
  padding: 2px 0 24px;
  word-break: break-word;
  caret-color: var(--c-accent);
}
.notes-editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--c-outline);
  pointer-events: none;
}
/* Stili dimensione testo nell'editor */
.notes-editor-body .size-small   { font-size: 12px; }
.notes-editor-body .size-normal  { font-size: 16px; }
.notes-editor-body .size-large   { font-size: 20px; }
.notes-editor-body .size-heading { font-size: 26px; font-weight: 700; font-family: var(--font-headline); }
/* Checklist */
.notes-editor-body .note-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 3px 0;
  list-style: none;
}
.notes-editor-body .note-checklist-item input[type="checkbox"] {
  margin-top: 4px;
  accent-color: var(--c-accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}
.notes-editor-body .note-checklist-item.checked > span {
  text-decoration: line-through;
  color: var(--c-outline);
}
/* Link come targhette chip */
.notes-editor-body a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px 1px 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-outline-variant);
  background: var(--c-surface-container);
  color: var(--c-on-surface-variant);
  font-size: 0.85em;
  font-weight: 500;
  text-decoration: none;
  word-break: normal;
  white-space: nowrap;
  vertical-align: text-bottom;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, filter 0.15s;
  line-height: 1.5;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
}
.notes-editor-body a .link-text {
  pointer-events: auto;
}
.notes-editor-body a::before {
  content: 'link';
  font-family: 'Material Symbols Outlined';
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  color: var(--c-on-surface-variant);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.notes-editor-body a:hover {
  background: var(--c-surface-container-high);
  border-color: var(--c-outline);
}

/* ── Link Action Popup ── */
.notes-link-action-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: linkActionFadeIn 0.15s ease;
}
@keyframes linkActionFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.notes-link-action-sheet {
  background: var(--c-surface);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px rgba(0,0,0,0.14);
  animation: linkActionSlideUp 0.2s ease;
}
@keyframes linkActionSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.notes-link-action-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--c-outline-variant);
  margin-bottom: 8px;
}
.notes-link-action-header .material-symbols-outlined {
  font-size: 20px;
  color: var(--c-on-surface-variant);
  flex-shrink: 0;
}
.notes-link-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--c-on-surface);
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.notes-link-action-btn:hover {
  background: var(--c-surface-container);
}
.notes-link-action-btn .material-symbols-outlined {
  font-size: 22px;
  color: var(--c-on-surface-variant);
}
.notes-link-action-cancel {
  margin-top: 4px;
  color: var(--c-on-surface-variant);
}

/* ── Batch Delete Confirmation ── */
.notes-batch-delete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: linkActionFadeIn 0.15s ease;
}
.notes-batch-delete-sheet {
  background: var(--c-surface);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px rgba(0,0,0,0.14);
  animation: linkActionSlideUp 0.2s ease;
  text-align: center;
}
.notes-batch-delete-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-error-container);
  color: var(--c-error);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.notes-batch-delete-icon .material-symbols-outlined {
  font-size: 28px;
}
.notes-batch-delete-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--c-on-surface);
  margin-bottom: 8px;
}
.notes-batch-delete-msg {
  font-size: 13px;
  color: var(--c-on-surface-variant);
  line-height: 1.5;
  margin-bottom: 20px;
}
.notes-batch-delete-actions {
  display: flex;
  gap: 10px;
}
.notes-batch-delete-cancel {
  flex: 1;
  padding: 13px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-on-surface-variant);
  background: var(--c-surface-container);
  transition: background 0.15s;
}
.notes-batch-delete-cancel:hover {
  background: var(--c-surface-high);
}
.notes-batch-delete-confirm {
  flex: 1;
  padding: 13px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  background: var(--c-error);
  transition: filter 0.15s;
}
.notes-batch-delete-confirm:hover {
  filter: brightness(0.85);
}

/* ── Toolbar formattazione ── */
.notes-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--c-surface);
  border-top: 1px solid var(--c-outline-variant);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.notes-tool-btn {
  min-width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-on-surface-variant);
  background: none;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  position: relative;
}
.notes-tool-btn:hover  { background: var(--c-surface-container); color: var(--c-on-surface); }
.notes-tool-btn[aria-pressed="true"] { background: var(--c-accent-container); color: var(--c-accent); }
.notes-tool-btn .material-symbols-outlined { font-size: 22px; }
.notes-tool-dropdown-wrap { position: relative; }
/* Dropdowns della toolbar */
.notes-tool-dropdown {
  position: fixed;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-outline-variant);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  z-index: 250;
  min-width: 150px;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}
/* Dropdown grandezza testo */
.notes-size-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--c-on-surface);
  background: none;
  transition: background 0.12s;
}
.notes-size-option[data-size="small"]   { font-size: 12px; }
.notes-size-option[data-size="normal"]  { font-size: 14px; }
.notes-size-option[data-size="large"]   { font-size: 18px; }
.notes-size-option[data-size="heading"] { font-size: 22px; font-weight: 700; }
.notes-size-option:hover { background: var(--c-surface-container); }
.notes-size-option.active { color: var(--c-accent); background: var(--c-accent-container); }
/* Palette colori */
.notes-color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  min-width: 0;
  width: 176px;
}
.notes-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  border: 2px solid var(--c-outline-variant);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.notes-color-swatch:hover { transform: scale(1.2); border-color: var(--c-outline); }
[data-theme="dark-violet"] .notes-color-swatch[data-color="#1a1a1a"] {
  border-color: var(--c-outline);
  box-shadow: 0 0 0 1px var(--c-outline-variant);
}
.notes-color-swatch--reset {
  background: var(--c-surface-high) !important;
  color: var(--c-on-surface-variant);
  border-color: var(--c-outline-variant);
}
/* Link card dropdown */
.notes-link-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  min-width: 260px;
  overflow: hidden;
}
.notes-link-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-outline-variant);
}
.notes-link-field__icon {
  font-size: 18px;
  color: var(--c-on-surface-variant);
  flex-shrink: 0;
}
.notes-link-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--c-on-surface);
  outline: none;
}
.notes-link-input::placeholder { color: var(--c-outline); }
.notes-link-confirm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  background: var(--c-accent);
  color: var(--c-on-accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}
.notes-link-confirm-btn:hover { filter: brightness(1.1); }
.notes-link-confirm-btn .material-symbols-outlined { font-size: 18px; }

/* ── Checkbox Editor ── */
.note-todo-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
  margin-top: 6px;
  width: 100%;
}
.note-todo-text {
  flex: 1;
  min-width: 0;
  outline: none;
  transition: color 0.2s;
}
.note-todo-chk:checked + .note-todo-text {
  text-decoration: line-through;
  color: var(--c-outline);
}
.note-todo-chk {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--c-outline-variant);
  border-radius: 6px;
  background: var(--c-surface);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s;
}
.note-todo-chk:hover {
  border-color: var(--c-accent);
}
.note-todo-chk:checked {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.note-todo-chk:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 7px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ══════════════════════════════════════════
   OFFLINE BANNER
   ══════════════════════════════════════════ */
#offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f59e0b;
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Ubuntu', system-ui, sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
#offline-banner.show {
  transform: translateY(0);
  opacity: 1;
}
#offline-banner .offline-banner__icon {
  display: flex;
  align-items: center;
  font-size: 18px;
}
#offline-banner .offline-banner__icon .material-symbols-outlined {
  font-size: 18px;
}
#offline-banner .offline-banner__text {
  line-height: 1.3;
}

/* Tema scuro: banner offline */
[data-theme="dark-violet"] #offline-banner {
  background: #d97706;
  color: #ffffff;
}

/* ══════════════════════════════════════════
   IOS INSTALL GUIDE
   ══════════════════════════════════════════ */
.ios-install-guide {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #1a1a1a;
  padding: 16px;
  border-radius: var(--r-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 400px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  font-family: var(--font-body);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.ios-install-guide.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.ios-install-guide.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}
.ios-install-guide__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  line-height: 1.4;
}
.ios-install-guide__content p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.ios-install-guide__arrow {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; 
  height: 0; 
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid rgba(255, 255, 255, 0.95);
}
[data-theme="dark-violet"] .ios-install-guide {
  background: rgba(42, 31, 69, 0.95);
  color: #e8e2f5;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
[data-theme="dark-violet"] .ios-install-guide__arrow {
  border-top-color: rgba(42, 31, 69, 0.95);
}
