/* BCW · Better ClasseViVa — design system Material 3 Expressive
   Colori generati con material-color-utilities (schema Tonal Spot, specifica 2025) dal rosso
   mattone di BCW (#A23E2F); materie e stati (bene, sufficiente, insufficiente, neutro) con le
   palette tonali dei colori dell'app. Font Google Sans Flex con l'asse ROND per i titoli,
   angoli ampi, forme (MaterialShapes) e animazioni a molla (approssimate con `linear()`). */

@font-face {
  font-family: "Google Sans Flex";
  src: url("../fonts/GoogleSansFlex-latin-wght-ROND.woff2") format("woff2");
  font-weight: 1 1000;
  font-style: normal;
  font-display: swap;
}

/* MARK: - Colori */

:root {
  color-scheme: light;
  --primary: #8c4e43; --on-primary: #fff7f6;
  --primary-container: #faaa9d; --on-primary-container: #602b22;
  --secondary: #785751; --on-secondary: #fff7f6;
  --secondary-container: #ffdad4; --on-secondary-container: #694a45;
  --tertiary: #795927; --on-tertiary: #fff8f2;
  --tertiary-container: #f6cb8d; --on-tertiary-container: #5f4211;
  --error: #a8364b; --on-error: #fff7f7; --error-container: #f97386; --on-error-container: #6e0523;
  --surface: #fff8f6; --surface-dim: #edd5d1; --surface-bright: #fff8f6;
  --surface-container-lowest: #fffcfb; --surface-container-low: #fff0ee; --surface-container: #fee9e6;
  --surface-container-high: #fae3df; --surface-container-highest: #f6ddd9;
  --on-surface: #3e2f2c; --on-surface-variant: #6d5b58;
  --outline: #8a7673; --outline-variant: #e3cdc9;
  --inverse-surface: #392e2c; --inverse-on-surface: #ffedea; --inverse-primary: #faaa9d;
  --brand: #a23e2f;

  --good: #2b6a45; --on-good: #ffffff; --good-container: #aff2c2; --on-good-container: #00210f;
  --fair: #855300; --on-fair: #ffffff; --fair-container: #ffddb8; --on-fair-container: #2a1700;
  --poor: #ab3429; --on-poor: #ffffff; --poor-container: #ffdad5; --on-poor-container: #410001;
  --neutral: #426182; --on-neutral: #ffffff; --neutral-container: #d1e4ff; --on-neutral-container: #001d35;

  --subject-0: #9e412b; --subject-0-container: #ffdad2; --on-subject-0-container: #3d0600;
  --subject-1: #29685f; --subject-1-container: #afefe2; --on-subject-1-container: #00201c;
  --subject-2: #5357a0; --subject-2-container: #e1e0ff; --on-subject-2-container: #0c0e5a;
  --subject-3: #7c5808; --subject-3-container: #ffdea9; --on-subject-3-container: #271900;
  --subject-4: #854a78; --subject-4-container: #ffd7f1; --on-subject-4-container: #370531;
  --subject-5: #306388; --subject-5-container: #cce5ff; --on-subject-5-container: #001e31;
  --subject-6: #4c671d; --subject-6-container: #cdee94; --on-subject-6-container: #131f00;
  --subject-7: #99452f; --subject-7-container: #ffdad2; --on-subject-7-container: #3c0800;
  --subject-8: #6b5c4a; --subject-8-container: #f4dfc9; --on-subject-8-container: #241a0c;
  --subject-9: #136779; --subject-9-container: #adecff; --on-subject-9-container: #001f26;
  --subject-10: #944555; --subject-10-container: #ffd9de; --on-subject-10-container: #3e0215;
  --subject-11: #47663c; --subject-11-container: #c8edb7; --on-subject-11-container: #042101;
  --break: #9a8c78;

  --scrim: rgb(29 17 15 / .38);
  --shadow-color: 29 17 15;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #f9b6ab; --on-primary: #61342c;
    --primary-container: #76453d; --on-primary-container: #ffdbd5;
    --secondary: #e7bdb6; --on-secondary: #563934;
    --secondary-container: #51342f; --on-secondary-container: #f2cbc4;
    --tertiary: #ffdaa8; --on-tertiary: #694a19;
    --tertiary-container: #6b4c1a; --on-tertiary-container: #ffdeb0;
    --error: #f97386; --on-error: #490013; --error-container: #871c34; --on-error-container: #ffb0bb;
    --surface: #130d0b; --surface-dim: #130d0b; --surface-bright: #372926;
    --surface-container-lowest: #0e0908; --surface-container-low: #1a1110; --surface-container: #221715;
    --surface-container-high: #291d1b; --surface-container-highest: #302220;
    --on-surface: #f9e0dc; --on-surface-variant: #bca6a2;
    --outline: #84716e; --outline-variant: #4a3a37;
    --inverse-surface: #f1dfdb; --inverse-on-surface: #392e2c; --inverse-primary: #8c4e43;
    --brand: #e3826a;

    --good: #94d5a7; --on-good: #00391d; --good-container: #0d512f; --on-good-container: #aff2c2;
    --fair: #ffb95f; --on-fair: #472a00; --fair-container: #653e00; --on-fair-container: #ffddb8;
    --poor: #ffb4a9; --on-poor: #690002; --poor-container: #8a1c14; --on-poor-container: #ffdad5;
    --neutral: #aac9ef; --on-neutral: #0f3251; --neutral-container: #2a4969; --on-neutral-container: #d1e4ff;

    --subject-0: #ffb4a3; --subject-0-container: #7f2a17; --on-subject-0-container: #ffdad2;
    --subject-1: #94d2c7; --subject-1-container: #055047; --on-subject-1-container: #afefe2;
    --subject-2: #bfc1ff; --subject-2-container: #3b3f86; --on-subject-2-container: #e1e0ff;
    --subject-3: #efbf6a; --subject-3-container: #5e4100; --on-subject-3-container: #ffdea9;
    --subject-4: #f8b0e4; --subject-4-container: #6a335f; --on-subject-4-container: #ffd7f1;
    --subject-5: #9cccf6; --subject-5-container: #114b6f; --on-subject-5-container: #cce5ff;
    --subject-6: #b1d27b; --subject-6-container: #354e04; --on-subject-6-container: #cdee94;
    --subject-7: #ffb4a2; --subject-7-container: #7b2e1a; --on-subject-7-container: #ffdad2;
    --subject-8: #d7c3ae; --subject-8-container: #524434; --on-subject-8-container: #f4dfc9;
    --subject-9: #8bd1e5; --subject-9-container: #004e5d; --on-subject-9-container: #adecff;
    --subject-10: #ffb2be; --subject-10-container: #772e3e; --on-subject-10-container: #ffd9de;
    --subject-11: #acd19d; --subject-11-container: #304e26; --on-subject-11-container: #c8edb7;
    --break: #b8ac98;

    --scrim: rgb(8 4 3 / .55);
    --shadow-color: 0 0 0;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #f9b6ab; --on-primary: #61342c;
  --primary-container: #76453d; --on-primary-container: #ffdbd5;
  --secondary: #e7bdb6; --on-secondary: #563934;
  --secondary-container: #51342f; --on-secondary-container: #f2cbc4;
  --tertiary: #ffdaa8; --on-tertiary: #694a19;
  --tertiary-container: #6b4c1a; --on-tertiary-container: #ffdeb0;
  --error: #f97386; --on-error: #490013; --error-container: #871c34; --on-error-container: #ffb0bb;
  --surface: #130d0b; --surface-dim: #130d0b; --surface-bright: #372926;
  --surface-container-lowest: #0e0908; --surface-container-low: #1a1110; --surface-container: #221715;
  --surface-container-high: #291d1b; --surface-container-highest: #302220;
  --on-surface: #f9e0dc; --on-surface-variant: #bca6a2;
  --outline: #84716e; --outline-variant: #4a3a37;
  --inverse-surface: #f1dfdb; --inverse-on-surface: #392e2c; --inverse-primary: #8c4e43;
  --brand: #e3826a;

  --good: #94d5a7; --on-good: #00391d; --good-container: #0d512f; --on-good-container: #aff2c2;
  --fair: #ffb95f; --on-fair: #472a00; --fair-container: #653e00; --on-fair-container: #ffddb8;
  --poor: #ffb4a9; --on-poor: #690002; --poor-container: #8a1c14; --on-poor-container: #ffdad5;
  --neutral: #aac9ef; --on-neutral: #0f3251; --neutral-container: #2a4969; --on-neutral-container: #d1e4ff;

  --subject-0: #ffb4a3; --subject-0-container: #7f2a17; --on-subject-0-container: #ffdad2;
  --subject-1: #94d2c7; --subject-1-container: #055047; --on-subject-1-container: #afefe2;
  --subject-2: #bfc1ff; --subject-2-container: #3b3f86; --on-subject-2-container: #e1e0ff;
  --subject-3: #efbf6a; --subject-3-container: #5e4100; --on-subject-3-container: #ffdea9;
  --subject-4: #f8b0e4; --subject-4-container: #6a335f; --on-subject-4-container: #ffd7f1;
  --subject-5: #9cccf6; --subject-5-container: #114b6f; --on-subject-5-container: #cce5ff;
  --subject-6: #b1d27b; --subject-6-container: #354e04; --on-subject-6-container: #cdee94;
  --subject-7: #ffb4a2; --subject-7-container: #7b2e1a; --on-subject-7-container: #ffdad2;
  --subject-8: #d7c3ae; --subject-8-container: #524434; --on-subject-8-container: #f4dfc9;
  --subject-9: #8bd1e5; --subject-9-container: #004e5d; --on-subject-9-container: #adecff;
  --subject-10: #ffb2be; --subject-10-container: #772e3e; --on-subject-10-container: #ffd9de;
  --subject-11: #acd19d; --subject-11-container: #304e26; --on-subject-11-container: #c8edb7;
  --break: #b8ac98;

  --scrim: rgb(8 4 3 / .55);
  --shadow-color: 0 0 0;
}

/* MARK: - Forme, tipografia, movimento */

:root {
  /* Nomi brevi usati nelle viste. */
  --bg: var(--surface);
  --card: var(--surface-container);
  --ink: var(--on-surface);
  --ink2: var(--on-surface-variant);
  --accent: var(--primary);
  --separator: var(--outline-variant);

  --r-xs: 4px; --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-li: 20px;
  --r-xl: 28px; --r-xli: 32px; --r-xxl: 48px; --r-full: 999px;
  /* Asse ROND di Google Sans Flex: titoli e testo. */
  --rond: 100; --rond-body: 30;

  --font: "Google Sans Flex", "Google Sans", "Roboto Flex", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;

  --elev-1: 0 1px 2px rgb(var(--shadow-color) / .22), 0 1px 3px 1px rgb(var(--shadow-color) / .1);
  --elev-2: 0 1px 2px rgb(var(--shadow-color) / .22), 0 2px 6px 2px rgb(var(--shadow-color) / .1);
  --elev-3: 0 1px 3px rgb(var(--shadow-color) / .22), 0 4px 8px 3px rgb(var(--shadow-color) / .1);

  /* Molle di M3 Expressive: spaziali (posizione, forma) con un piccolo rimbalzo, effetti (colore, opacità) senza. */
  --spring-fast: linear(0, 0.008 1.3%, 0.029 2.5%, 0.07 4%, 0.123 5.5%, 0.244 8.3%, 0.531 14%, 0.649 16.5%, 0.756 19%, 0.848 21.5%, 0.924 24%, 0.985 26.5%, 1.03 29%, 1.064 31.8%, 1.089 35.5%, 1.094 39.8%, 1.081 44.8%, 1.019 58.8%, 0.998 67.3%, 0.991 78%, 1);
  --spring-fast-dur: 360ms;
  --spring: linear(0, 0.005 1.3%, 0.024 2.8%, 0.053 4.3%, 0.098 6%, 0.201 9.3%, 0.431 15.8%, 0.532 18.8%, 0.631 22%, 0.718 25.3%, 0.785 28.2%, 0.846 31.5%, 0.894 34.8%, 0.932 38%, 0.964 41.8%, 0.987 45.8%, 1.003 50.2%, 1.012 55.3%, 1.015 64.8%, 1);
  --spring-dur: 435ms;
  --spring-slow-dur: 600ms;
  --effects: linear(0, 0.004 1%, 0.019 2.3%, 0.042 3.5%, 0.079 5%, 0.161 7.8%, 0.362 13.8%, 0.464 17%, 0.557 20.3%, 0.637 23.5%, 0.706 26.8%, 0.767 30.3%, 0.817 33.8%, 0.86 37.5%, 0.899 42%, 0.929 46.8%, 0.953 52.3%, 0.971 58.5%, 0.991 73.8%, 1);
  --effects-fast-dur: 150ms;
  --effects-dur: 230ms;
  --emphasized-decelerate: cubic-bezier(.05, .7, .1, 1);
  --emphasized-accelerate: cubic-bezier(.3, 0, .8, .15);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
}

@media (prefers-reduced-motion: reduce) {
  :root { --spring-fast: ease-out; --spring: ease-out; --spring-fast-dur: 120ms; --spring-dur: 150ms; --spring-slow-dur: 180ms; }
}

/* Aspetto scelto nelle Impostazioni (attributi impostati da js/theme.js e js/theme-boot.js). */
:root[data-corners="square"] { --r-xs: 2px; --r-s: 4px; --r-m: 8px; --r-l: 10px; --r-li: 12px; --r-xl: 16px; --r-xli: 20px; --r-xxl: 28px; }
:root[data-corners="round"] { --r-xs: 6px; --r-s: 12px; --r-m: 16px; --r-l: 22px; --r-li: 26px; --r-xl: 34px; --r-xli: 38px; --r-xxl: 56px; }
/* Animazioni standard: le curve di M3 senza rimbalzo; ridotte: brevi e senza movimenti ampi. */
:root[data-motion="standard"] { --spring-fast: cubic-bezier(.2, 0, 0, 1); --spring: cubic-bezier(.2, 0, 0, 1); --spring-fast-dur: 300ms; --spring-dur: 400ms; --spring-slow-dur: 500ms; }
:root[data-motion="reduced"] { --spring-fast: ease-out; --spring: ease-out; --spring-fast-dur: 120ms; --spring-dur: 150ms; --spring-slow-dur: 180ms; --effects-dur: 150ms; }
:root[data-rounded="all"] { --rond-body: 100; }
:root[data-rounded="none"] { --rond: 0; --rond-body: 0; }

/* Scala tipografica di M3 (le varianti "em" sono quelle enfatizzate di Expressive). */
.display-s { font-size: 36px; line-height: 44px; font-weight: 450; letter-spacing: 0; font-variation-settings: "ROND" var(--rond); }
.headline-l { font-size: 32px; line-height: 40px; font-weight: 450; font-variation-settings: "ROND" var(--rond); }
.headline-m { font-size: 28px; line-height: 36px; font-weight: 450; font-variation-settings: "ROND" var(--rond); }
.headline-s { font-size: 24px; line-height: 32px; font-weight: 450; font-variation-settings: "ROND" var(--rond); }
.title-l { font-size: 22px; line-height: 28px; font-weight: 450; font-variation-settings: "ROND" var(--rond); }
.title-m { font-size: 16px; line-height: 24px; font-weight: 550; letter-spacing: .15px; }
.title-s { font-size: 14px; line-height: 20px; font-weight: 550; letter-spacing: .1px; }
.body-l { font-size: 16px; line-height: 24px; letter-spacing: .3px; }
.body-m { font-size: 14px; line-height: 20px; letter-spacing: .2px; }
.body-s { font-size: 12px; line-height: 16px; letter-spacing: .3px; }
.label-l { font-size: 14px; line-height: 20px; font-weight: 550; letter-spacing: .1px; }
.label-m { font-size: 12px; line-height: 16px; font-weight: 550; letter-spacing: .4px; }
.label-s { font-size: 11px; line-height: 16px; font-weight: 550; letter-spacing: .4px; }
.em { font-weight: 700; }

/* MARK: - Base */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: .1px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  font-variation-settings: "ROND" var(--rond-body);
}

body { overflow: hidden; overscroll-behavior: none; }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; font-variation-settings: inherit; }

button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:disabled { cursor: default; }
a { color: var(--primary); }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; font-variation-settings: "ROND" var(--rond); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; border-radius: var(--r-m); }

#app { height: 100%; }

/* MARK: - Barre di scorrimento
   Sottili e nei colori del tema. Nelle pagine a più aree (colonne, bacheca, barra di
   navigazione) non compaiono mai: toglierebbero spazio orizzontale alle colonne. */

* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--on-surface-variant) 40%, transparent) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--on-surface-variant) 38%, transparent) padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--on-surface-variant) 60%, transparent); }

.split-side, .split-main, .mail-list, .mail-detail, .rail-scroll, .tt-side, .tt-main, .timeline-scroll { scrollbar-width: none; }
.split-side::-webkit-scrollbar, .split-main::-webkit-scrollbar, .mail-list::-webkit-scrollbar, .mail-detail::-webkit-scrollbar,
.rail-scroll::-webkit-scrollbar, .tt-side::-webkit-scrollbar, .tt-main::-webkit-scrollbar, .timeline-scroll::-webkit-scrollbar { display: none; }

/* Le aree scorrevoli scorrono solo in verticale. */
.page-scroll, .split-side, .split-main, .mail-list, .mail-detail, .rail-scroll, .sheet-body { overflow-x: hidden; }

/* MARK: - Utilità */

.icon { width: 24px; height: 24px; flex: none; }
.icon.small { width: 18px; height: 18px; }
.numeral { font-variant-numeric: lining-nums tabular-nums; font-weight: 650; font-variation-settings: "ROND" var(--rond); }
.numeral-mono { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.flex { flex: 1 1 auto; }
.secondary { color: var(--on-surface-variant); }
.caption { font-size: 12px; line-height: 16px; letter-spacing: .3px; }
.small { font-size: 13px; }
.headline { font-size: 16px; line-height: 24px; font-weight: 550; }
.title3 { font-size: 22px; line-height: 28px; font-weight: 500; font-variation-settings: "ROND" var(--rond); }
.body-text { font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.big { font-size: 32px; line-height: 40px; }
.huge { font-size: 45px; line-height: 52px; }

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.baseline, .row-between.baseline { align-items: baseline; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.align-start { align-items: flex-start; }
.gap-2 { gap: 2px; } .gap-4 { gap: 4px; } .gap-5 { gap: 5px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-14 { gap: 14px; } .gap-16 { gap: 16px; } .gap-18 { gap: 18px; } .gap-20 { gap: 20px; }
.gap-22 { gap: 22px; } .gap-24 { gap: 24px; } .gap-26 { gap: 26px; } .gap-28 { gap: 28px; }

.launch { height: 100%; background: var(--surface); }

/* Velo degli stati (hover 8%, pressione 10%) sopra a un contenitore. */
.state { position: relative; isolation: isolate; }
.state::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--effects-fast-dur) linear;
  z-index: -1;
}

@media (hover: hover) { .state:hover:not(:disabled)::after { opacity: .08; } }
.state:active:not(:disabled)::after { opacity: .12; }

/* MARK: - Forme */

.shape { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; overflow: visible; }
.shaped { position: relative; display: inline-grid; place-items: center; flex: none; isolation: isolate; }
.shaped > .shape { z-index: -1; color: var(--shape-fill, var(--secondary-container)); transition: transform var(--spring-dur) var(--spring); }
.shaped > :not(.shape) { grid-area: 1 / 1; }

/* MARK: - Indicatore di caricamento (forme che cambiano e ruotano) */

.loading-indicator {
  --size: 48px;
  width: var(--size);
  height: var(--size);
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  flex: none;
  animation: m3-loading-turn 4666ms linear infinite;
}

.loading-indicator.contained { background: var(--primary-container); }
.loading-indicator > i {
  display: block;
  width: 79%;
  height: 79%;
  background: var(--primary);
  animation: m3-loading-morph 4550ms infinite, m3-loading-spin 2600ms infinite;
  animation-timing-function: linear(0, 0.024, 0.087, 0.177, 0.283, 0.396, 0.51, 0.619, 0.719, 0.808, 0.884, 0.948, 0.998, 1.036, 1.064, 1.082, 1.092, 1.095, 1.093, 1.087, 1.079, 1.069, 1.058, 1.047, 1.037, 1.027, 1.019, 1.012, 1.005, 1.001, 0.997, 0.994, 0.992, 0.991, 0.991, 0.991, 0.992, 0.992, 0.993, 0.994, 1);
}

.loading-indicator.contained > i { width: 62%; height: 62%; background: var(--on-primary-container); }
.loading-indicator.small { --size: 24px; }
.loading-indicator.medium { --size: 36px; }
.btn .loading-indicator, .icon-btn .loading-indicator { --size: 22px; }
.btn .loading-indicator > i, .icon-btn .loading-indicator > i { background: currentColor; }

@media (prefers-reduced-motion: reduce) { .loading-indicator, .loading-indicator > i { animation-duration: 9100ms, 5200ms; } }
:root[data-motion="reduced"] :is(.loading-indicator, .loading-indicator > i) { animation-duration: 9100ms, 5200ms; }
@keyframes m3-loading-spin { 0% { transform: rotate(0deg); } 25% { transform: rotate(90deg); } 50% { transform: rotate(180deg); } 75% { transform: rotate(270deg); } 100% { transform: rotate(360deg); } }
@keyframes m3-loading-turn { to { transform: rotate(360deg); } }
@keyframes m3-loading-morph {
  0% { clip-path: polygon(50% 0.82%,54.83% 4.02%,58.51% 9.94%,61.97% 13.17%,66.67% 12.55%,73.16% 9.88%,78.9% 10.22%,80.94% 15.64%,80.43% 22.6%,81.33% 27.24%,85.5% 29.5%,92.32% 31.16%,96.77% 34.8%,95.22% 40.39%,90.73% 45.72%,88.73% 50%,90.77% 54.28%,95.31% 59.63%,96.77% 65.2%,92.24% 68.81%,85.46% 70.48%,81.33% 72.76%,80.46% 77.43%,81% 84.43%,78.9% 89.78%,73.12% 90.04%,66.66% 87.41%,61.97% 86.83%,58.52% 90.09%,54.84% 96.07%,50% 99.18%,45.17% 95.98%,41.49% 90.06%,38.03% 86.83%,33.33% 87.45%,26.84% 90.12%,21.1% 89.78%,19.06% 84.36%,19.57% 77.4%,18.67% 72.76%,14.5% 70.5%,7.68% 68.84%,3.23% 65.2%,4.78% 59.61%,9.27% 54.28%,11.27% 50%,9.23% 45.72%,4.69% 40.37%,3.23% 34.8%,7.76% 31.19%,14.54% 29.52%,18.67% 27.24%,19.54% 22.57%,19% 15.57%,21.1% 10.22%,26.88% 9.96%,33.34% 12.59%,38.03% 13.17%,41.48% 9.91%,45.16% 3.93%); }
  14.286% { clip-path: polygon(50% 2.07%,54.95% 2.9%,59.48% 5.4%,63.55% 8.31%,67.93% 9.74%,73.1% 9.99%,78.06% 11.38%,82.18% 14.26%,85.14% 18.36%,86.62% 23.39%,88.15% 27.98%,90.95% 31.77%,94.83% 35.43%,97.33% 39.94%,98.17% 44.94%,97.3% 50%,94.91% 54.72%,93.62% 59.27%,93.84% 64.24%,94.05% 69.61%,92.47% 74.52%,89.37% 78.61%,84.95% 81.47%,80.22% 83.56%,76.65% 86.68%,73.75% 91.14%,69.95% 94.82%,65.25% 96.94%,60.07% 97.35%,54.83% 95.95%,50% 95.16%,45.17% 95.95%,39.93% 97.35%,34.75% 96.94%,30.05% 94.82%,26.25% 91.14%,23.35% 86.68%,19.78% 83.56%,15.05% 81.47%,10.63% 78.61%,7.53% 74.52%,5.95% 69.61%,6.16% 64.24%,6.38% 59.27%,5.09% 54.72%,2.7% 50%,1.83% 44.94%,2.67% 39.94%,5.17% 35.43%,9.05% 31.77%,11.85% 27.98%,13.38% 23.39%,14.86% 18.36%,17.82% 14.26%,21.94% 11.38%,26.9% 9.99%,32.07% 9.74%,36.45% 8.31%,40.52% 5.4%,45.05% 2.9%); }
  28.571% { clip-path: polygon(50% 4.79%,54.68% 5.46%,59.04% 7.45%,62.94% 10.18%,66.58% 12.75%,70.08% 15.22%,73.51% 17.64%,76.95% 20.07%,80.48% 22.56%,84.18% 25.17%,88.15% 27.97%,92.51% 31.07%,96.09% 35.02%,98.12% 39.77%,98.54% 44.9%,97.32% 50%,95.72% 54.81%,94.19% 59.39%,92.69% 63.87%,91.2% 68.34%,89.67% 72.91%,88.08% 77.67%,86.38% 82.76%,84.26% 88.05%,80.72% 92.29%,76.04% 95.1%,70.58% 96.22%,65.02% 96.23%,59.83% 96.23%,54.86% 96.23%,50% 96.23%,45.14% 96.23%,40.17% 96.23%,34.98% 96.23%,29.42% 96.22%,23.96% 95.1%,19.28% 92.29%,15.74% 88.05%,13.62% 82.76%,11.92% 77.67%,10.33% 72.91%,8.8% 68.34%,7.31% 63.87%,5.81% 59.39%,4.28% 54.81%,2.68% 50%,1.46% 44.9%,1.88% 39.77%,3.91% 35.02%,7.49% 31.07%,11.85% 27.97%,15.82% 25.17%,19.52% 22.56%,23.05% 20.07%,26.49% 17.64%,29.92% 15.22%,33.42% 12.75%,37.06% 10.18%,40.96% 7.45%,45.32% 5.46%); }
  42.857% { clip-path: polygon(50% 0.63%,55.25% 0.05%,60.55% 0.35%,65.88% 1.11%,71.12% 2.55%,76.17% 4.67%,80.93% 7.43%,85.3% 10.79%,89.21% 14.7%,92.57% 19.07%,95.33% 23.83%,97.45% 28.88%,98.89% 34.12%,99.65% 39.45%,99.95% 44.75%,99.37% 50%,98.19% 55.06%,96.45% 59.87%,94.22% 64.37%,91.54% 68.5%,88.49% 72.22%,85.2% 75.58%,81.98% 78.8%,78.8% 81.98%,75.58% 85.2%,72.22% 88.49%,68.5% 91.54%,64.37% 94.22%,59.87% 96.45%,55.06% 98.19%,50% 99.37%,44.75% 99.95%,39.45% 99.65%,34.12% 98.89%,28.88% 97.45%,23.83% 95.33%,19.07% 92.57%,14.7% 89.21%,10.79% 85.3%,7.43% 80.93%,4.67% 76.17%,2.55% 71.12%,1.11% 65.88%,0.35% 60.55%,0.05% 55.25%,0.63% 50%,1.81% 44.94%,3.55% 40.13%,5.78% 35.63%,8.46% 31.5%,11.51% 27.78%,14.8% 24.42%,18.02% 21.2%,21.2% 18.02%,24.42% 14.8%,27.78% 11.51%,31.5% 8.46%,35.63% 5.78%,40.13% 3.55%,44.94% 1.81%); }
  57.143% { clip-path: polygon(50% 0.62%,55% 2.44%,59.33% 6.13%,63.19% 9.42%,67.06% 11.68%,71.84% 12.18%,77.17% 12.6%,82.8% 13.58%,86.42% 17.2%,87.4% 22.83%,87.82% 28.16%,88.32% 32.94%,90.58% 36.81%,93.87% 40.67%,97.56% 45%,99.38% 50%,97.56% 55%,93.87% 59.33%,90.58% 63.19%,88.32% 67.06%,87.82% 71.84%,87.4% 77.17%,86.42% 82.8%,82.8% 86.42%,77.17% 87.4%,71.84% 87.82%,67.06% 88.32%,63.19% 90.58%,59.33% 93.87%,55% 97.56%,50% 99.38%,45% 97.56%,40.67% 93.87%,36.81% 90.58%,32.94% 88.32%,28.16% 87.82%,22.83% 87.4%,17.2% 86.42%,13.58% 82.8%,12.6% 77.17%,12.18% 71.84%,11.68% 67.06%,9.42% 63.19%,6.13% 59.33%,2.44% 55%,0.62% 50%,2.44% 45%,6.13% 40.67%,9.42% 36.81%,11.68% 32.94%,12.18% 28.16%,12.6% 22.83%,13.58% 17.2%,17.2% 13.58%,22.83% 12.6%,28.16% 12.18%,32.94% 11.68%,36.81% 9.42%,40.67% 6.13%,45% 2.44%); }
  71.429% { clip-path: polygon(50% 11.57%,54.08% 11.15%,58.57% 9.68%,63.81% 7.48%,69.47% 6.28%,75.09% 6.55%,80.36% 8.21%,85.05% 11.08%,88.92% 14.96%,91.78% 19.64%,93.44% 24.92%,93.7% 30.54%,92.49% 36.19%,90.3% 41.43%,88.84% 45.92%,88.43% 50%,88.85% 54.08%,90.32% 58.57%,92.52% 63.81%,93.72% 69.47%,93.45% 75.09%,91.79% 80.36%,88.92% 85.05%,85.04% 88.92%,80.36% 91.78%,75.08% 93.44%,69.46% 93.7%,63.81% 92.49%,58.57% 90.3%,54.08% 88.84%,50% 88.43%,45.92% 88.85%,41.43% 90.32%,36.19% 92.52%,30.53% 93.72%,24.91% 93.45%,19.64% 91.79%,14.95% 88.92%,11.08% 85.04%,8.22% 80.36%,6.56% 75.08%,6.3% 69.46%,7.51% 63.81%,9.7% 58.57%,11.16% 54.08%,11.57% 50%,11.15% 45.92%,9.68% 41.43%,7.48% 36.19%,6.28% 30.53%,6.55% 24.91%,8.21% 19.64%,11.08% 14.95%,14.96% 11.08%,19.64% 8.22%,24.92% 6.56%,30.54% 6.3%,36.19% 7.51%,41.43% 9.7%,45.92% 11.16%); }
  85.714% { clip-path: polygon(50% 5.96%,54.82% 4.16%,60.05% 2.71%,65.67% 1.76%,71.58% 1.53%,77.58% 2.23%,83.37% 4.07%,88.58% 7.16%,92.84% 11.42%,95.93% 16.63%,97.77% 22.42%,98.47% 28.42%,98.24% 34.33%,97.29% 39.95%,95.84% 45.18%,94.04% 50%,92% 54.41%,89.82% 58.46%,87.52% 62.19%,85.13% 65.64%,82.67% 68.86%,80.13% 71.89%,77.5% 74.76%,74.76% 77.5%,71.89% 80.13%,68.86% 82.67%,65.64% 85.13%,62.19% 87.52%,58.46% 89.82%,54.41% 92%,50% 94.04%,45.18% 95.84%,39.95% 97.29%,34.33% 98.24%,28.42% 98.47%,22.42% 97.77%,16.63% 95.93%,11.42% 92.84%,7.16% 88.58%,4.07% 83.37%,2.23% 77.58%,1.53% 71.58%,1.76% 65.67%,2.71% 60.05%,4.16% 54.82%,5.96% 50%,8% 45.59%,10.18% 41.54%,12.48% 37.81%,14.87% 34.36%,17.33% 31.14%,19.87% 28.11%,22.5% 25.24%,25.24% 22.5%,28.11% 19.87%,31.14% 17.33%,34.36% 14.87%,37.81% 12.48%,41.54% 10.18%,45.59% 8%); }
  100% { clip-path: polygon(50% 0.82%,54.83% 4.02%,58.51% 9.94%,61.97% 13.17%,66.67% 12.55%,73.16% 9.88%,78.9% 10.22%,80.94% 15.64%,80.43% 22.6%,81.33% 27.24%,85.5% 29.5%,92.32% 31.16%,96.77% 34.8%,95.22% 40.39%,90.73% 45.72%,88.73% 50%,90.77% 54.28%,95.31% 59.63%,96.77% 65.2%,92.24% 68.81%,85.46% 70.48%,81.33% 72.76%,80.46% 77.43%,81% 84.43%,78.9% 89.78%,73.12% 90.04%,66.66% 87.41%,61.97% 86.83%,58.52% 90.09%,54.84% 96.07%,50% 99.18%,45.17% 95.98%,41.49% 90.06%,38.03% 86.83%,33.33% 87.45%,26.84% 90.12%,21.1% 89.78%,19.06% 84.36%,19.57% 77.4%,18.67% 72.76%,14.5% 70.5%,7.68% 68.84%,3.23% 65.2%,4.78% 59.61%,9.27% 54.28%,11.27% 50%,9.23% 45.72%,4.69% 40.37%,3.23% 34.8%,7.76% 31.19%,14.54% 29.52%,18.67% 27.24%,19.54% 22.57%,19% 15.57%,21.1% 10.22%,26.88% 9.96%,33.34% 12.59%,38.03% 13.17%,41.48% 9.91%,45.16% 3.93%); }
}

/* MARK: - Pulsanti
   Taglie di M3 Expressive (XS 32, S 40, M 56); alla pressione gli angoli si stringono
   (morph della forma con la molla veloce). */

.btn {
  --h: 40px;
  --pressed: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  min-width: 48px;
  padding: 0 16px;
  border-radius: calc(var(--h) / 2);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .1px;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  isolation: isolate;
  color: var(--primary);
  transition: border-radius var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects),
    color var(--effects-dur) var(--effects), box-shadow var(--effects-dur) var(--effects);
}

.btn .icon { width: 20px; height: 20px; }
.btn::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; transition: opacity var(--effects-fast-dur) linear; pointer-events: none; }
@media (hover: hover) { .btn:hover:not(:disabled)::after { opacity: .08; } }
.btn:active:not(:disabled) { border-radius: var(--pressed); }
.btn:active:not(:disabled)::after { opacity: .12; }
.btn.filled, .btn-prominent { background: var(--primary); color: var(--on-primary); }
.btn.tonal, .btn-glass { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.outlined { box-shadow: inset 0 0 0 1px var(--outline-variant); color: var(--on-surface-variant); }
.btn.elevated { background: var(--surface-container-low); box-shadow: var(--elev-1); color: var(--primary); }
.btn.text, .btn-plain { padding: 0 12px; }
.btn.danger, .btn-destructive { background: var(--error); color: var(--on-error); }
.btn.danger-text { color: var(--error); }
/* Dopo le varianti, che hanno la stessa specificità: altrimenti un pulsante pieno disattivato teneva il testo
   on-primary (quasi bianco) sullo sfondo grigio chiaro. */
.btn:disabled { color: color-mix(in srgb, var(--on-surface) 38%, transparent); }
.btn.filled:disabled, .btn-prominent:disabled, .btn.tonal:disabled, .btn-glass:disabled, .btn.danger:disabled, .btn-destructive:disabled, .btn.elevated:disabled {
  background: color-mix(in srgb, var(--on-surface) 10%, transparent);
  box-shadow: none;
}

.btn.xs, .btn.small { --h: 32px; --pressed: 8px; padding: 0 12px; gap: 6px; }
.btn.m, .btn.large { --h: 56px; --pressed: 12px; padding: 0 24px; font-size: 16px; line-height: 24px; }
.btn.m .icon, .btn.large .icon { width: 24px; height: 24px; }
.btn.wide { width: 100%; }

/* Pulsanti a icona: standard, pieni, tonali e con contorno. */
.icon-btn {
  --s: 40px;
  width: var(--s);
  height: var(--s);
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: calc(var(--s) / 2);
  color: var(--on-surface-variant);
  position: relative;
  isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects), color var(--effects-dur) var(--effects);
}

.icon-btn::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; transition: opacity var(--effects-fast-dur) linear; pointer-events: none; }
@media (hover: hover) { .icon-btn:hover:not(:disabled)::after { opacity: .08; } }
.icon-btn:active:not(:disabled) { border-radius: 10px; }
.icon-btn:active:not(:disabled)::after { opacity: .12; }
.icon-btn.filled { background: var(--primary); color: var(--on-primary); }
.icon-btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.icon-btn.outlined { box-shadow: inset 0 0 0 1px var(--outline-variant); }
.icon-btn.selected { background: var(--secondary-container); color: var(--on-secondary-container); border-radius: var(--r-m); }
/* Dopo le varianti (come nell'app: l'icona si spegne, lo sfondo resta), es. i pulsanti del contatore al limite. */
.icon-btn:disabled { color: color-mix(in srgb, var(--on-surface) 38%, transparent); }
.icon-btn.small { --s: 32px; }
.icon-btn.small .icon { width: 20px; height: 20px; }
.icon-btn.m { --s: 56px; }
.icon-btn.danger { color: var(--error); }
.icon-btn .badge { position: absolute; top: 4px; right: 4px; }

/* Pulsante d'azione flottante (FAB) e FAB esteso. */
.fab {
  height: 56px;
  min-width: 56px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--r-l);
  background: var(--primary-container);
  color: var(--on-primary-container);
  box-shadow: var(--elev-3);
  font-size: 16px;
  font-weight: 600;
  position: relative;
  isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast), transform var(--spring-dur) var(--spring), box-shadow var(--effects-dur) var(--effects);
}

.fab::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .fab:hover::after { opacity: .08; } }
.fab:active { border-radius: var(--r-m); }
.fab:active::after { opacity: .12; }
.fab:disabled { opacity: .5; }

.link-button { color: var(--primary); font-weight: 600; font-size: 14px; text-align: left; border-radius: var(--r-s); }
.link-button:hover { text-decoration: underline; }

/* Gruppo di pulsanti collegati (sostituisce i controlli segmentati): il pulsante scelto diventa
   una pillola piena, quello premuto stringe gli angoli interni. */
.segmented {
  display: flex;
  gap: 2px;
  width: 100%;
}

.segmented > button {
  --inner: 8px;
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--inner);
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects), color var(--effects-dur) var(--effects);
}

.segmented > button:first-child { border-radius: 20px var(--inner) var(--inner) 20px; }
.segmented > button:last-child { border-radius: var(--inner) 20px 20px var(--inner); }
.segmented > button:only-child { border-radius: 20px; }
.segmented > button:active:not(.selected) { --inner: 4px; }
.segmented > button.selected { border-radius: 20px; background: var(--primary); color: var(--on-primary); font-weight: 650; }
.segmented > button::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .segmented > button:hover::after { opacity: .08; } }
.segmented > button .icon { width: 20px; height: 20px; }
.segmented.compact { width: auto; }
.segmented.compact > button { flex: 0 0 auto; min-width: 48px; padding: 0 16px; }
.segmented.icons > button { padding: 0 14px; }

/* MARK: - Card e griglie */

.card {
  display: block;
  width: 100%;
  padding: var(--pad, 16px);
  background: var(--card);
  border-radius: var(--r-li);
  text-align: left;
  color: inherit;
  text-decoration: none;
  position: relative;
}

button.card, a.card {
  isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects);
}

button.card::after, a.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--on-surface); opacity: 0; transition: opacity var(--effects-fast-dur) linear; pointer-events: none; }
@media (hover: hover) { button.card:hover:not(:disabled)::after, a.card:hover::after { opacity: .05; } }
button.card:active:not(:disabled), a.card:active { border-radius: var(--r-m); }
button.card:active:not(:disabled)::after, a.card:active::after { opacity: .1; }
.card.stack { display: flex; }
.card.flat { background: transparent; box-shadow: inset 0 0 0 1px var(--outline-variant); }
.card.hero { border-radius: var(--r-xl); }

.card-grid { display: flex; flex-direction: column; gap: 12px; }

.divider { border: 0; height: 1px; background: var(--outline-variant); margin: 0; width: 100%; flex: none; }
.divider.inset { margin-left: 56px; width: auto; }
.divider.inset-48 { margin-left: 48px; width: auto; }

.rows { display: flex; flex-direction: column; gap: 14px; }
.rows > .divider { margin: 0; }

/* MARK: - Liste segmentate (voci separate da 2 px, angoli esterni ampi) */

.list-group { display: flex; flex-direction: column; gap: 2px; }
.list-group > * { border-radius: var(--r-xs); background: var(--cell-bg, var(--card)); }
.list-group > * > .list-item { border-radius: inherit; }
.list-group > :first-child { border-top-left-radius: var(--r-li); border-top-right-radius: var(--r-li); }
.list-group > :last-child { border-bottom-left-radius: var(--r-li); border-bottom-right-radius: var(--r-li); }
/* Elenchi lunghi sugli schermi larghi: una larghezza comoda da leggere. */
.page.desktop .readable { max-width: 860px; }
.page.desktop .list-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 20px; align-items: start; }
.list-columns { display: flex; flex-direction: column; gap: 20px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 56px;
  padding: 8px 16px;
  background: var(--cell-bg, var(--card));
  color: var(--on-surface);
  text-align: left;
  text-decoration: none;
  position: relative;
  isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects);
}

.list-item.multiline .li-text strong { font-size: 15px; font-weight: 400; overflow-wrap: anywhere; }

button.list-item::after, a.list-item::after, label.list-item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--on-surface); opacity: 0; transition: opacity var(--effects-fast-dur) linear; pointer-events: none; }
@media (hover: hover) { button.list-item:hover:not(:disabled)::after, a.list-item:hover::after { opacity: .06; } }
button.list-item:active:not(:disabled), a.list-item:active { border-radius: var(--r-l); }
button.list-item:active:not(:disabled)::after, a.list-item:active::after { opacity: .1; }
.list-item.selected { background: var(--secondary-container); color: var(--on-secondary-container); border-radius: var(--r-l); }
.list-item:disabled { opacity: .5; }
.list-item .li-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.list-item .li-text strong { font-size: 16px; line-height: 24px; font-weight: 500; }
.list-item .li-text small { font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.list-item.danger { color: var(--error); }
.list-item .trailing { color: var(--on-surface-variant); font-size: 14px; white-space: nowrap; flex: none; }

/* MARK: - Intestazioni */

.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px; }
.section-header h3 { font-size: 22px; line-height: 28px; font-weight: 500; }
.section-header p { font-size: 14px; color: var(--on-surface-variant); margin-top: 2px; }
.section-toggle { width: 100%; display: block; border-radius: var(--r-m); }
/* La freccia sta sul bordo (in colonna con quelle dei giorni e delle sezioni segmentate) e al centro del titolo. */
.section-toggle > .section-header { padding-right: 0; align-items: center; }

/* Occhiello: etichetta breve sopra a un contenuto (title-small nei colori del tema). */
.eyebrow { font-size: 14px; line-height: 20px; font-weight: 650; letter-spacing: .1px; }

/* MARK: - Chip */

.chip-row { margin: 0 calc(var(--gutter) * -1); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row-inner { display: inline-flex; gap: 8px; padding: 2px var(--gutter); align-items: center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 16px;
  border-radius: var(--r-s);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  color: var(--on-surface-variant);
  box-shadow: inset 0 0 0 1px var(--outline-variant);
  position: relative;
  isolation: isolate;
  transition: background-color var(--effects-dur) var(--effects), color var(--effects-dur) var(--effects), border-radius var(--spring-fast-dur) var(--spring-fast), padding var(--spring-fast-dur) var(--spring-fast);
}

.chip:has(.icon:first-child) { padding-left: 8px; }
.chip:has(.icon:last-child) { padding-right: 8px; }
.chip .icon { width: 18px; height: 18px; }
.chip::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .chip:hover::after { opacity: .08; } }
.chip:active::after { opacity: .12; }
.chip:active { border-radius: var(--r-m); }
.chip.selected { background: var(--secondary-container); color: var(--on-secondary-container); box-shadow: none; }
.chip-divider { width: 1px; height: 24px; background: var(--outline-variant); flex: none; }
.flow-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* MARK: - Etichette */

.pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-s);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .3px;
  white-space: nowrap;
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 15%, transparent);
}

.pill.filled { color: var(--surface); background: var(--tint); }
.pill.bold { font-weight: 750; }
.pill.small { height: 20px; font-size: 11px; padding: 0 6px; }
.pill.count { font-variant-numeric: tabular-nums; min-width: 24px; justify-content: center; border-radius: var(--r-full); }
.pill .short { display: none; }

@media (max-width: 370px) {
  .pill.has-short .long { display: none; }
  .pill.has-short .short { display: inline; }
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--error);
  color: var(--on-error);
  font-size: 11px;
  font-weight: 650;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.subject-tag { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.subject-tag .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; transform: rotate(45deg); }
.subject-tag .name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot.big { width: 12px; height: 12px; border-radius: 50%; flex: none; }

.icon-badge {
  display: inline-grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: calc(var(--size) * .34);
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 15%, transparent);
}

.icon-badge .icon { width: calc(var(--size) * .58); height: calc(var(--size) * .58); }

.avatar {
  --size: 40px;
  width: var(--size);
  height: var(--size);
  color: var(--on-primary-container);
  font-weight: 650;
  font-size: calc(var(--size) * .4);
  font-variation-settings: "ROND" var(--rond);
  font-variant-numeric: lining-nums;
}

.avatar > .shape { color: var(--avatar-fill, var(--primary-container)); }
.avatar.tinted > .shape { color: color-mix(in srgb, var(--tint) 28%, var(--surface-container-highest)); }
.avatar.tinted { color: var(--on-surface); }
@media (hover: hover) { button:hover > .avatar.morph > .shape, .avatar.morph:hover > .shape { transform: rotate(30deg) scale(1.04); } }

/* MARK: - Interruttori, contatori, scelte, campi */

.switch { position: relative; display: inline-flex; flex: none; width: 52px; height: 32px; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: inherit; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--surface-container-highest);
  box-shadow: inset 0 0 0 2px var(--outline);
  transition: background-color var(--effects-dur) var(--effects), box-shadow var(--effects-dur) var(--effects);
}

.switch span::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 16px;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: var(--outline);
  transition: left var(--spring-fast-dur) var(--spring-fast), width var(--spring-fast-dur) var(--spring-fast),
    height var(--spring-fast-dur) var(--spring-fast), margin var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects);
}

.switch span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 36px;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: var(--on-primary-container);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: scale(.4);
  transition: opacity var(--effects-fast-dur) linear, transform var(--spring-fast-dur) var(--spring-fast);
}

.switch input:checked + span { background: var(--primary); box-shadow: none; }
.switch input:checked + span::before { left: 36px; width: 24px; height: 24px; margin: -12px 0 0 -12px; background: var(--on-primary); }
.switch input:checked + span::after { opacity: 1; transform: none; }
.switch:active input:not(:disabled) + span::before { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
.switch input:disabled + span { opacity: .38; }
.switch input:focus-visible + span { outline: 3px solid var(--secondary); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.stepper .numeral { min-width: 44px; text-align: center; font-size: 16px; }

.select-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  max-width: 100%;
  padding: 0 8px 0 14px;
  border-radius: var(--r-m);
  background: var(--surface-container-high);
  color: var(--on-surface);
  font-size: 14px;
  font-weight: 550;
  /* Come nell'app il valore resta intero: semmai va a capo il titolo della riga. */
  flex: none;
  min-width: 0;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast);
}

.select-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn:hover { background: var(--surface-container-highest); }
.select-btn:active { border-radius: var(--r-xl); }
.select-btn .icon { color: var(--on-surface-variant); }

.text-input, textarea.reply {
  width: 100%;
  min-height: 56px;
  padding: 16px;
  border: 0;
  border-radius: var(--r-l);
  background: var(--surface-container-highest);
  color: var(--on-surface);
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow var(--effects-dur) var(--effects), border-radius var(--spring-dur) var(--spring);
}

textarea.text-input, textarea.reply { min-height: 96px; resize: vertical; line-height: 22px; }
.text-input:focus, textarea.reply:focus { box-shadow: inset 0 0 0 2px var(--primary); border-radius: var(--r-m); }
.text-input::placeholder, textarea::placeholder, input::placeholder { color: var(--on-surface-variant); opacity: .85; }
input[type="time"].text-input, input[type="date"].text-input { min-height: 44px; padding: 8px 12px; width: auto; font-variant-numeric: tabular-nums; }
input[type="color"].color-input { width: 48px; height: 40px; padding: 0; border: 0; border-radius: var(--r-m); background: none; cursor: pointer; }
input[type="color"].color-input::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].color-input::-webkit-color-swatch { border: 0; border-radius: var(--r-m); }

/* Barra di ricerca (56 px, angoli pieni). */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 8px 0 16px;
  border-radius: 28px;
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
  cursor: text;
  transition: background-color var(--effects-dur) var(--effects), border-radius var(--spring-dur) var(--spring);
}

.search-bar input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  color: var(--on-surface);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.search-bar input::-webkit-search-cancel-button { display: none; }
.search-bar:focus-within { background: var(--surface-container-highest); }
.search-bar.local-search { height: 48px; border-radius: 24px; max-width: 420px; }
.page-search { margin: 0 var(--gutter) 12px; }

/* MARK: - Sezioni comprimibili */

.collapsible { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--spring-dur) var(--spring); }
.collapsible.open { grid-template-rows: 1fr; }
.collapsible-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0 10px 14px;
  margin: 0 -10px -14px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
}

.collapsible.open .collapsible-inner { -webkit-mask-image: none; mask-image: none; }
.collapsible:not(.open) .collapsible-inner { padding-bottom: 0; margin-bottom: 0; }
.collapsible-content { padding-top: var(--gap); transition: visibility 0s; }
.collapsible:not(.open) .collapsible-content { visibility: hidden; transition: visibility 0s .4s; }


.chev { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 16px; background: var(--surface-container-highest); color: var(--on-surface-variant); flex: none; transition: transform var(--spring-dur) var(--spring); }
.chev .icon { width: 20px; height: 20px; }
.chev.left { transform: rotate(-90deg); }
.chev.up { transform: rotate(180deg); }

/* MARK: - Stati */

.status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-l);
  background: var(--fair-container);
  color: var(--on-fair-container);
  font-size: 14px;
  line-height: 20px;
}

.status-banner .icon { width: 20px; height: 20px; }

.loading { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 64px; color: var(--on-surface-variant); font-size: 14px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 40px 24px;
  color: var(--on-surface-variant);
}

.empty-state .empty-art { width: 88px; height: 88px; margin-bottom: 10px; color: var(--on-secondary-container); --shape-fill: var(--secondary-container); }
.empty-state .empty-art .icon { width: 40px; height: 40px; }
.empty-state h3 { font-size: 22px; line-height: 28px; font-weight: 500; color: var(--on-surface); }
.empty-state p { font-size: 14px; line-height: 20px; max-width: 360px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }

.detail-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 20px; }
.detail-row > span:first-child { color: var(--on-surface-variant); }
.detail-row > span:last-child { text-align: right; font-weight: 550; }

.status-line { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.status-line .icon { width: 20px; height: 20px; }

.warning-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-l); background: var(--poor-container); color: var(--on-poor-container); font-weight: 600; font-size: 14px; }
.warning-box .icon { width: 22px; height: 22px; }

/* Avanzamento lineare ondulato: parte piena ondulata, spazio, traccia e punto finale. */
.wavy-progress { position: relative; height: 12px; display: flex; align-items: center; }
.wavy-progress .wp-active {
  height: 12px;
  width: calc(var(--p) * 100%);
  background: var(--primary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='12' viewBox='0 0 40 12'%3E%3Cpath d='M0 6 Q10 0.5 20 6 T40 6' fill='none' stroke='black' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") left center / 40px 12px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='12' viewBox='0 0 40 12'%3E%3Cpath d='M0 6 Q10 0.5 20 6 T40 6' fill='none' stroke='black' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") left center / 40px 12px repeat-x;
  border-radius: 6px;
  animation: wave-flow 1.6s linear infinite;
}

.wavy-progress .wp-track { flex: 1; height: 4px; margin-left: 6px; border-radius: 2px; background: var(--secondary-container); position: relative; }
.wavy-progress .wp-track:first-child { margin-left: 0; }
.wavy-progress .wp-track::after { content: ""; position: absolute; right: 0; top: 0; width: 4px; height: 4px; border-radius: 2px; background: var(--primary); }
@keyframes wave-flow { to { -webkit-mask-position: 40px center; mask-position: 40px center; } }
@media (prefers-reduced-motion: reduce) { .wavy-progress .wp-active { animation: none; } }
:root[data-motion="reduced"] .wavy-progress .wp-active { animation: none; }

.wavy-line {
  flex: 1;
  height: 6px;
  min-width: 12px;
  color: color-mix(in srgb, var(--on-surface-variant) 55%, transparent);
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='6' viewBox='0 0 11 6'%3E%3Cpath d='M0 3 Q2.75 -0.6 5.5 3 T11 3' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E") center / 11px 6px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='6' viewBox='0 0 11 6'%3E%3Cpath d='M0 3 Q2.75 -0.6 5.5 3 T11 3' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E") center / 11px 6px repeat-x;
}

/* MARK: - Shell: telefoni (barra in basso) e tablet (barra laterale) */

.shell { height: 100%; display: flex; background: var(--surface); }
.shell.mobile { flex-direction: column; }
.shell.mobile.medium { flex-direction: row-reverse; }
.shell.mobile > .page { flex: 1; min-height: 0; min-width: 0; transition: opacity var(--effects-dur) ease-in; }
.shell.mobile.changing > .page, .shell.mobile.changing > .nav-bar { opacity: 0; transition: opacity .2s ease-out; }

.page { display: flex; flex-direction: column; position: relative; }
.page-main { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.page-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.page.mobile .page-body { padding: 4px var(--gutter) 32px; }
.page.mobile .page-body.bottom-inset { padding-bottom: 72px; }
/* Spazio per il pulsante d'azione flottante o la barra degli strumenti. */
.page.mobile .page-body.fab-inset, .page.desktop .page-body.fab-inset { padding-bottom: 112px; }
/* Cambiando scheda o pagina tutto il contenuto (anche la parte ferma in alto) sale dal basso. */
.page.mobile .page-scroll, .page.mobile .page-fixed { animation: page-in var(--spring-dur) var(--spring); }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } }
/* Parte ferma sopra l'area che scorre (la settimana di Dashboard e Orario). */
.page-fixed { flex: none; position: relative; z-index: 4; background: var(--surface); }
.page-fixed .tt-extras { padding: 0 var(--gutter) 12px; }
/* La settimana alla stessa altezza nelle due schede: la barra di ricerca è 4 px più alta del titolo. */
.app-bar + .page-fixed .calendar-bar { padding-top: 4px; }

/* Barra superiore di Material 3 (64 px). Le pagine principali delle schede hanno il titolo
   grande nella riga dei pulsanti; quelle aperte da un'altra il titolo piccolo e la freccia. */
.app-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: calc(64px + var(--safe-top));
  padding: var(--safe-top) 4px 0 16px;
  background: var(--surface);
  position: relative;
  z-index: 5;
  transition: background-color var(--effects-dur) var(--effects);
}

.app-bar.has-leading { padding-left: 4px; }
.app-bar.scrolled { background: var(--surface-container); }
.app-bar-title { flex: 1; min-width: 0; }
.app-bar-title h1 { font-size: 22px; line-height: 28px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-bar.large .app-bar-title h1 { font-size: 34px; line-height: 40px; font-weight: 550; letter-spacing: -.3px; }
.app-bar-title p { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-bar.has-leading .app-bar-title { padding-left: 4px; }
.app-bar-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.bar-gap { width: 4px; flex: none; }
.bar-text { margin: 0 4px; }

/* Barra di ricerca in alto (come Gmail e Google Foto): pillola sospesa di 56 px. */
.search-app-bar { flex: none; padding: calc(4px + var(--safe-top)) 16px 8px; background: var(--surface); position: relative; z-index: 5; }
.sab-pill {
  display: flex;
  align-items: center;
  height: 56px;
  border-radius: 28px;
  background: var(--surface-container-high);
  transition: background-color var(--effects-dur) var(--effects);
}

.sab-pill.active { background: var(--surface-container-highest); padding: 0 4px; animation: sab-open var(--spring-dur) var(--spring); }
@keyframes sab-open { from { transform: scaleX(.96); } }
.sab-open { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 14px; padding-left: 16px; border-radius: 28px 0 0 28px; color: var(--on-surface); }
.sab-open span { color: var(--on-surface-variant); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sab-trail { display: flex; align-items: center; padding-right: 4px; }
.sab-pill input { flex: 1; min-width: 0; height: 100%; padding: 0 4px; border: 0; background: none; outline: none; font-size: 16px; color: var(--on-surface); -webkit-appearance: none; appearance: none; }
.sab-pill input::-webkit-search-cancel-button { display: none; }
.account-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.account-avatar .avatar { transition: transform var(--spring-dur) var(--spring); }
@media (hover: hover) { .account-avatar:hover .avatar > .shape { transform: rotate(30deg); } }
.account-avatar:active .avatar { transform: scale(.92); }
.fade-through { animation: fade-through var(--spring-dur) var(--spring) 50ms backwards; }
@keyframes fade-through { from { opacity: 0; transform: scale(.94); } }
/* Lista e Giorno dell'Orario si scambiano con la stessa dissolvenza, ancorata in alto: la giornata
   è più alta dello schermo (e scorre subito alla prima ora, misurata con la vista già ridotta). */
.view-swap { animation: fade-through var(--spring-dur) var(--spring) 50ms backwards; transform-origin: 50% 0; }

/* Trascina per aggiornare: l'indicatore di caricamento in un cerchio. */
.ptr { height: 0; overflow: hidden; display: grid; place-items: center; opacity: 0; transition: height .25s var(--emphasized-decelerate), opacity .2s; }
.ptr.active { height: 72px; opacity: 1; }
/* Nascosto non gira: le tre animazioni infinite (la forma con clip-path) restavano attive in ogni pagina. */
.ptr:not(.active, .pulling) :is(.loading-indicator, .loading-indicator > i) { animation-play-state: paused; }

/* Barra di navigazione (corta, 68 px) con l'indicatore a pillola 56 × 32. */
.nav-bar {
  flex: none;
  display: flex;
  justify-content: space-around;
  padding: 0 4px var(--safe-bottom);
  min-height: calc(68px + var(--safe-bottom));
  background: var(--surface-container);
  position: relative;
  z-index: 6;
  transition: transform var(--spring-dur) var(--spring), opacity var(--effects-dur) ease-in;
}

/* Una modalità temporanea (ricerca, modifica dell'orario) nasconde la barra. */
.shell.compact.nav-hidden > .nav-bar { display: none; }
.shell.medium.nav-hidden > .nav-bar { visibility: hidden; }

.nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 0 10px;
  color: var(--on-surface-variant);
  -webkit-touch-callout: none;
  user-select: none;
}

.nav-indicator { position: relative; display: grid; place-items: center; width: 56px; height: 32px; border-radius: 16px; isolation: isolate; }
.nav-indicator::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--secondary-container);
  transform: scaleX(0);
  opacity: 0;
  z-index: -1;
  transition: transform var(--spring-dur) var(--spring), opacity var(--effects-fast-dur) linear;
}

.nav-indicator::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .nav-item:hover .nav-indicator::after { opacity: .08; } }
.nav-item:active .nav-indicator::after { opacity: .12; }
.nav-item.selected .nav-indicator { color: var(--on-secondary-container); }
.nav-item.selected .nav-indicator::before { transform: none; opacity: 1; }
.nav-indicator .badge { position: absolute; top: -2px; left: 32px; }
.nav-label { font-size: 12px; line-height: 16px; font-weight: 550; letter-spacing: .3px; white-space: nowrap; }
.nav-item.selected .nav-label { color: var(--secondary); font-weight: 750; }

/* Telefoni (3.3, come nell'app): barra di navigazione flottante di M3 Expressive, una pillola di
   56 px sospesa sul contenuto con i nomi delle schede; quella aperta è piena nel primario, con
   l'icona. Sta 14 px sopra il bordo, o scende un po' (10 px) nello spazio sicuro quando c'è
   l'indicatore della Home. Le pagine lasciano libero lo spazio sotto (`--nav-space`). */
.shell.compact {
  position: relative;
  --nav-bottom: max(14px, calc(var(--safe-bottom) - 10px));
  --nav-space: max(calc(64px + var(--safe-bottom)), calc(var(--nav-bottom) + 64px));
}
.shell.compact > .nav-bar.floating {
  position: absolute;
  left: 50%;
  bottom: var(--nav-bottom);
  translate: -50% 0;
  justify-content: center;
  gap: 2px;
  height: 56px;
  min-height: 0;
  max-width: calc(100% - 16px);
  padding: 6px;
  border-radius: 28px;
  background: var(--surface-container-high);
  box-shadow: 0 1px 3px rgb(var(--shadow-color) / .2), 0 6px 14px rgb(var(--shadow-color) / .14);
}
.nav-tab {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 13px;
  border-radius: 22px;
  color: var(--on-surface-variant);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  position: relative;
  isolation: isolate;
  -webkit-touch-callout: none;
  user-select: none;
  transition: scale var(--spring-fast-dur) var(--spring-fast), color var(--spring-dur) var(--effects);
}
/* La pillola che scivola sta dentro la scheda aperta: le altre schede le passano sopra, così i loro
   nomi restano leggibili mentre la pillola le attraversa. */
.nav-tab:not(.selected) { z-index: 1; }
.nav-tab::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .nav-tab:not(.selected):hover::after { opacity: .08; } }
.nav-tab:not(.selected):active::after { opacity: .12; }
.nav-tab:active { scale: .95; }
.nav-tab.selected { padding: 0 16px; color: var(--on-primary); font-weight: 650; }
.nav-pill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 22px; background: var(--primary); z-index: -1; }
.nav-tab-icon { display: grid; place-items: center; animation: nav-icon-in var(--spring-dur) var(--spring); }
.nav-tab-icon .icon { width: 20px; height: 20px; }
@keyframes nav-icon-in { from { opacity: 0; scale: .4; } }
.nav-tab .badge { position: static; }
.nav-tab.selected .badge { box-shadow: 0 0 0 2px var(--primary); }
/* Pagine sotto la barra flottante: il contenuto scorre fin sotto, ma l'ultima riga resta visibile. */
.shell.compact:not(.nav-hidden) .page.mobile .page-body { padding-bottom: calc(32px + var(--nav-space)); }
.shell.compact:not(.nav-hidden) .page.mobile .page-body.fab-inset { padding-bottom: calc(96px + var(--nav-space)); }
.shell.compact:not(.nav-hidden) .fab-stack, .shell.compact:not(.nav-hidden) .page-fab { bottom: calc(16px + var(--nav-space)); }
@media (max-width: 360px) {
  .nav-tab { padding: 0 10px; font-size: 13px; }
  .nav-tab.selected { padding: 0 12px; }
}

/* Tablet in verticale (600–839 px): le stesse schede in una barra di navigazione laterale. */
.shell.medium > .nav-bar {
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  width: 88px;
  min-height: 0;
  padding: calc(44px + var(--safe-top)) 0 var(--safe-bottom);
  background: var(--surface);
}

.shell.medium .nav-item { flex: none; padding: 4px 0; }

/* Pulsante d'azione flottante della pagina. */
.page-fab { position: absolute; right: 16px; bottom: 16px; z-index: 4; animation: fab-in var(--spring-dur) var(--spring); }
@keyframes fab-in { from { transform: scale(.2); opacity: 0; } }

/* Menu del pulsante d'azione flottante (M3 Expressive): il FAB nel contenitore primario diventa
   un cerchio pieno con la X e sopra salgono, allineate a destra, le voci a pillola. */
.fab-menu { position: absolute; inset: auto 0 0 auto; z-index: 8; pointer-events: none; }
.fab-menu.open { inset: 0; }
.fab-scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 60%, transparent); pointer-events: auto; animation: fade-in var(--effects-dur) var(--effects); }
.fab-stack { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: auto; }
.fab-toggle {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--r-l);
  background: var(--primary-container);
  color: var(--on-primary-container);
  box-shadow: var(--elev-3);
  position: relative;
  isolation: isolate;
  animation: fab-in var(--spring-dur) var(--spring);
  transition: border-radius var(--spring-dur) var(--spring), background-color var(--effects-dur) var(--effects), color var(--effects-dur) var(--effects), box-shadow var(--effects-dur) var(--effects);
}

.fab-toggle::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .fab-toggle:hover::after { opacity: .08; } }
.fab-toggle:active::after { opacity: .12; }
.fab-toggle .icon { transition: transform var(--spring-dur) var(--spring); }
.fab-menu.open .fab-toggle { margin-top: 6px; border-radius: 28px; background: var(--primary); color: var(--on-primary); box-shadow: var(--elev-1); animation: none; }
.fab-menu.open .fab-toggle .icon { transform: rotate(90deg); }
.fab-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 24px 0 20px;
  border-radius: 28px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  box-shadow: var(--elev-1);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  position: relative;
  isolation: isolate;
  transform-origin: right bottom;
  animation: fab-item-in var(--spring-dur) var(--spring) calc(var(--i) * 35ms) backwards;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast);
}

.fab-item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .fab-item:hover::after { opacity: .08; } }
.fab-item:active { border-radius: var(--r-l); }
.fab-item:active::after { opacity: .12; }
.fab-item:disabled { opacity: .5; }
@keyframes fab-item-in { from { opacity: 0; transform: scale(.4); } }

/* Barra degli strumenti flottante (64 px, in basso al centro); vivace in una modalità temporanea. */
.toolbar-slot { position: absolute; left: 0; right: 0; bottom: calc(16px + var(--safe-bottom)); z-index: 8; display: flex; justify-content: center; pointer-events: none; animation: toolbar-in var(--spring-dur) var(--spring); }
@keyframes toolbar-in { from { opacity: 0; transform: translateY(40px); } }
.floating-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 64px;
  padding: 8px;
  border-radius: var(--r-full);
  background: var(--surface-container);
  color: var(--on-surface-variant);
  box-shadow: var(--elev-3);
  pointer-events: auto;
}

.floating-toolbar.vibrant { background: var(--primary-container); color: var(--on-primary-container); }
.tb-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: inherit;
  position: relative;
  isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects), color var(--effects-dur) var(--effects);
}

.tb-btn::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .tb-btn:hover::after { opacity: .08; } }
.tb-btn:active { border-radius: var(--r-m); }
.tb-btn:active::after { opacity: .12; }
.tb-btn.selected { background: var(--primary); color: var(--on-primary); }
.tb-sep { width: 1px; height: 24px; margin: 0 4px; background: color-mix(in srgb, currentColor 25%, transparent); }
/* "Fine" come nell'app: a riposo una pillola alta 48 px, a 8 px dal bordo della barra (64 px) in
   alto, in basso e a destra, quindi con gli angoli concentrici (32 − 8 = 24); premuto si
   stringe come i pulsanti a icona della barra. */
.tb-done { --h: 48px; --pressed: var(--r-m); margin-left: 4px; padding: 0 20px 0 16px; }

/* MARK: - Shell: schermi larghi (barra superiore con la ricerca, barra di navigazione espansa
   e pannello della pagina con angoli ampi) */

.shell.desktop { flex-direction: column; background: var(--surface-container); --rail: 264px; }
.shell.desktop.rail-collapsed { --rail: 96px; }
/* Tra 840 e 1000 px la barra espansa si apre sopra il pannello, che resta al suo posto. */
.shell.desktop.rail-overlays { --rail: 96px; }
.shell.desktop.rail-overlays.rail-open .rail { width: 264px; }
.shell.desktop.changing .page.desktop { opacity: 0; transition: opacity .2s ease-out; }

.top-bar { flex: none; display: flex; align-items: center; gap: 8px; height: 72px; padding: 8px 16px 0 20px; }
.top-lead { display: flex; align-items: center; gap: 12px; width: calc(var(--rail) - 20px); min-width: 164px; flex: none; transition: width var(--spring-dur) var(--spring); }
.top-logo { font-size: 22px; }
/* Il logo porta alla Dashboard: un'area cliccabile con lo stato di M3 al passaggio e al tocco. */
.top-home { display: inline-flex; align-items: center; height: 40px; padding: 0 10px; margin-left: -10px; border-radius: 20px; color: inherit; text-decoration: none;
  transition: background-color var(--effects-dur) var(--effects), border-radius var(--spring-fast-dur) var(--spring-fast); -webkit-tap-highlight-color: transparent; }
.top-home:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.top-home:active { background: color-mix(in srgb, var(--on-surface) 12%, transparent); border-radius: 12px; }
.top-home:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }
/* Logo: "BCW" e la linea del marchio, in em così si ridimensiona con font-size. La linea è
   centrata sulle maiuscole (alte .73em in Google Sans Flex): parte dalla linea di base e sale
   di .365em − metà spessore (un margine non conterebbe nell'allineamento alla linea di base). */
.bcw-logo { display: inline-flex; align-items: baseline; gap: .42em; font-size: 20px; line-height: 1; color: var(--on-surface); white-space: nowrap; }
.logo-text { font-family: var(--font); font-weight: 800; letter-spacing: -.01em; font-variation-settings: "ROND" var(--rond); }
.logo-line { display: inline-block; width: 1.1em; height: .15em; transform: translateY(-.28em); border-radius: var(--r-full); background: var(--brand); }
/* Barra sotto la scritta, centrata (come nell'introduzione e nell'icona dell'app): la parte alta
   della barra 0,31 sotto la linea di base, come nell'app. Con un'interlinea di 1 la scatola della
   scritta finisce 0,16 sotto la linea di base (Google Sans Flex: salita 0,97, discesa 0,29), quindi
   0,15 di spazio. Sopra le maiuscole (0,74) restano 0,10 di vuoto: si toglie, così il centro del
   logo è quello che si vede. */
.bcw-logo.stacked { flex-direction: column; align-items: center; gap: .15em; }
.bcw-logo.stacked .logo-text { margin-top: -.1em; }
.bcw-logo.stacked .logo-line { transform: none; }
.icon.flipped { transform: scaleX(-1); }
.top-search { flex: 1 1 auto; min-width: 0; max-width: 720px; }
.global-search { height: 52px; border-radius: 26px; padding: 0 8px 0 16px; background: var(--surface-container-highest); }
.global-search:focus-within { background: var(--surface-container-lowest); box-shadow: var(--elev-1); }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }

.shell-body { flex: 1; min-height: 0; display: flex; position: relative; }

/* Barra di navigazione espansa (M3 Expressive): voci di 56 px con l'indicatore a pillola. */
.rail {
  width: var(--rail);
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 12px;
  background: var(--surface-container);
  transition: width var(--spring-dur) var(--spring);
  overflow: hidden;
  z-index: 10;
}

.rail-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.rail-group { display: flex; flex-direction: column; gap: 2px; }
.rail-group h2 { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--on-surface-variant); padding: 16px 16px 6px; white-space: nowrap; overflow: hidden; }
.rail-group hr { display: none; }

.rail-item {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  padding: 0 8px 0 4px;
  border-radius: 28px;
  color: var(--on-surface-variant);
  position: relative;
  isolation: isolate;
  flex: none;
}

.rail-item::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--secondary-container); opacity: 0; transform: scaleX(.7); transform-origin: left; z-index: -1; transition: transform var(--spring-dur) var(--spring), opacity var(--effects-fast-dur) linear; }
.rail-item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .rail-item:hover::after { opacity: .08; } }
.rail-item:active::after { opacity: .12; }
.rail-item.selected { color: var(--on-secondary-container); }
.rail-item.selected::before { opacity: 1; transform: none; }
.rail-indicator { position: relative; display: grid; place-items: center; width: 52px; height: 32px; flex: none; }
.rail-indicator .badge { display: none; position: absolute; top: -2px; left: 32px; }
.rail-label { flex: 1; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-item.selected .rail-label { font-weight: 750; }
.rail-count { font-size: 12px; font-weight: 650; padding: 0 8px; font-variant-numeric: tabular-nums; }
.rail-scrim { display: none; }

/* Barra ridotta: solo icone, con le etichette sotto. */
.shell.rail-collapsed .rail { padding: 8px 8px 12px; }
.shell.rail-collapsed .rail-group h2 { display: none; }
.shell.rail-collapsed .rail-group hr { display: block; border: 0; height: 1px; background: var(--outline-variant); margin: 8px 16px; }
.shell.rail-collapsed .rail-item { flex-direction: column; height: auto; padding: 4px 0 6px; gap: 4px; border-radius: 0; }
.shell.rail-collapsed .rail-item::before, .shell.rail-collapsed .rail-item::after { inset: 4px 12px auto; height: 32px; border-radius: 16px; transform-origin: center; }
.shell.rail-collapsed .rail-indicator { width: 56px; }
.shell.rail-collapsed .rail-indicator .badge { display: grid; }
.shell.rail-collapsed .rail-label { flex: none; width: 100%; font-size: 12px; line-height: 16px; text-align: center; padding: 0 2px; }
.shell.rail-collapsed .rail-count { display: none; }

/* Pannello della pagina: angoli extra large sul colore della barra di navigazione. */
.page.desktop {
  flex: 1;
  min-width: 0;
  margin: 0 12px 12px 0;
  border-radius: var(--r-xl);
  background: var(--surface);
  overflow: hidden;
  transition: opacity var(--effects-dur) ease-in;
}

.page.desktop .app-bar { min-height: 76px; padding: 8px 20px 0 28px; background: var(--surface); }
.page.desktop .app-bar:has(> .icon-btn:first-child) { padding-left: 16px; }
.page.desktop .app-bar.scrolled { background: var(--surface-container-low); }
.page.desktop .app-bar-title h1 { font-size: 24px; line-height: 32px; }
.page.desktop .app-bar.large .app-bar-title h1 { font-size: 32px; line-height: 40px; font-weight: 550; letter-spacing: -.2px; }
.page-content { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.page.desktop .page-scroll { padding: 0; }
.page.desktop .page-body { padding: 8px 28px 40px; max-width: 1400px; }
.page.desktop .page-body.narrow { max-width: 760px; }
.page.desktop .fab-stack { right: 24px; bottom: 24px; }

.split { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
.split-side, .split-main { overflow-y: auto; min-height: 0; }
.split-side > .column { padding: 8px 12px 40px 28px; display: flex; flex-direction: column; gap: 20px; }
.split-main > .column { padding: 8px 28px 112px 16px; display: flex; flex-direction: column; gap: 20px; max-width: 980px; }

/* Su finestre strette la barra espansa si apre sopra il contenuto, con il velo. */
.shell.rail-overlays.rail-open .rail { position: absolute; inset: 0 auto 0 0; box-shadow: var(--elev-3); border-radius: 0 var(--r-l) var(--r-l) 0; animation: rail-in var(--spring-dur) var(--spring); }
.shell.rail-overlays.rail-open .rail-scrim { display: block; position: absolute; inset: 0; z-index: 9; background: var(--scrim); animation: fade-in var(--effects-dur) var(--effects); }
.shell.rail-overlays.rail-open .page.desktop { margin-left: 96px; }
@keyframes rail-in { from { width: 96px; } }

/* MARK: - Sovrapposizioni: velo, fogli, dialoghi, menu, snackbar */

.scrim, .menu-scrim { position: absolute; inset: 0; }
.scrim { background: var(--scrim); animation: fade-in var(--effects-dur) var(--effects); }
@keyframes fade-in { from { opacity: 0; } }

.sheet-layer, .dialog-layer, .menu-layer { position: fixed; inset: 0; z-index: 50; }
.sheet-layer { display: flex; justify-content: center; align-items: flex-end; }
.sheet-layer.centered { align-items: center; padding: 24px; }

.sheet {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100% - 48px - var(--safe-top));
  display: flex;
  flex-direction: column;
  background: var(--surface-container-low);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--elev-1);
  animation: sheet-up var(--spring-slow-dur) var(--spring);
}

.sheet.large { height: calc(100% - 48px - var(--safe-top)); }
.sheet.medium { min-height: 50%; }
.sheet-layer.centered .sheet { border-radius: var(--r-xl); background: var(--surface-container-high); box-shadow: var(--elev-3); max-height: min(780px, 100%); max-width: 600px; animation: sheet-pop var(--spring-dur) var(--spring); }
.sheet-layer.centered .sheet.large { height: min(860px, 100%); max-width: 680px; }
.sheet-layer.centered .sheet.viewer { max-width: 920px; }
.sheet-layer.centered .sheet.medium { min-height: 0; }
/* Non `.login`: il foglio prenderebbe le regole della schermata di accesso (altezza piena, margini). */
.sheet-layer.centered .sheet.login-sheet { max-width: 460px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-pop { from { opacity: 0; transform: scale(.92); } }

.sheet-handle { display: block; width: 32px; height: 4px; border-radius: 2px; background: var(--on-surface-variant); opacity: .45; margin: 14px auto 0; flex: none; }
/* I pulsanti ai lati restano interi: con un titolo lungo è il titolo a stringersi (con i puntini). */
.sheet-bar { display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr); align-items: center; gap: 8px; min-height: 64px; padding: 4px 12px; flex: none; }
.sheet-bar h2 { font-size: 20px; line-height: 28px; font-weight: 500; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sheet-lead { display: flex; align-items: center; justify-content: flex-start; min-width: 0; }
.sheet-trail { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 0 calc(24px + var(--safe-bottom)); }
.sheet-pad { padding: 8px 20px 20px; }
.sheet-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px calc(16px + var(--safe-bottom)); border-top: 1px solid var(--outline-variant); flex: none; }
.sheet-layer.centered .sheet-body { padding-bottom: 24px; }

.dialog-layer { display: grid; place-items: center; padding: 24px; }
.dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--surface-container-high);
  box-shadow: var(--elev-3);
  animation: sheet-pop var(--spring-dur) var(--spring);
}

.dialog h2 { font-size: 24px; line-height: 32px; font-weight: 450; margin-bottom: 16px; }
.dialog p { font-size: 14px; line-height: 20px; color: var(--on-surface-variant); white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.dialog .btn.strong { font-weight: 700; }
.dialog.stacked .dialog-actions { flex-direction: column; align-items: stretch; }
.dialog.stacked .dialog-actions .btn { justify-content: flex-end; white-space: normal; height: auto; min-height: 40px; text-align: right; }

/* Menu espressivo: angoli 16, voci alte 44, voce scelta nel contenitore terziario. */
.menu {
  position: fixed;
  min-width: 200px;
  max-width: min(320px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--r-l);
  background: var(--surface-container-low);
  box-shadow: var(--elev-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: menu-in var(--spring-fast-dur) var(--spring-fast);
}

:root[data-theme="dark"] .menu { background: var(--surface-container-high); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .menu { background: var(--surface-container-high); } }
@keyframes menu-in { from { opacity: 0; transform: scale(.85); } }
.menu h3 { font-size: 12px; line-height: 16px; font-weight: 650; color: var(--on-surface-variant); padding: 10px 12px 4px; letter-spacing: .4px; }
.menu hr { border: 0; height: 1px; background: var(--outline-variant); margin: 4px 8px; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: var(--r-xs);
  font-size: 15px;
  text-align: left;
  position: relative;
  isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast);
}

.menu-item:first-child, .menu h3 + .menu-item { border-top-left-radius: var(--r-m); border-top-right-radius: var(--r-m); }
.menu-item:last-child { border-bottom-left-radius: var(--r-m); border-bottom-right-radius: var(--r-m); }
.menu-item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .menu-item:hover:not(:disabled)::after { opacity: .08; } }
.menu-item:active:not(:disabled)::after { opacity: .12; }
.menu-item.checked { background: var(--tertiary-container); color: var(--on-tertiary-container); border-radius: var(--r-m); }
.menu-item:disabled:not(.checked) { opacity: .38; }
.menu-item.checked:disabled { cursor: default; }
.menu-item.destructive { color: var(--error); }
.menu-item small { display: block; font-size: 12px; color: var(--on-surface-variant); }
.menu-item.checked small { color: inherit; opacity: .8; }
.menu-lead { width: 20px; display: grid; place-items: center; flex: none; color: var(--on-surface-variant); }
.menu-item.checked .menu-lead, .menu-item.destructive .menu-lead { color: inherit; }
.menu-lead .icon { width: 20px; height: 20px; }
.menu-trail { font-size: 13px; color: var(--on-surface-variant); }

.snackbar {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  max-width: min(600px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: var(--r-m);
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
  box-shadow: var(--elev-3);
  font-size: 14px;
  line-height: 20px;
  animation: snack-in var(--spring-dur) var(--spring);
}

.snackbar .icon { width: 20px; height: 20px; color: var(--inverse-primary); }
.shell.desktop ~ .snackbar, .snackbar:only-of-type { bottom: calc(24px + var(--safe-bottom)); }
@keyframes snack-in { from { opacity: 0; transform: translate(-50%, 24px) scale(.9); } }

/* Anteprima dei file (js/viewer.js). */
.viewer-bar { grid-template-columns: auto minmax(0, 1fr) auto; }
.viewer-bar h2 { text-align: left; padding-left: 4px; }
.viewer-bar .sheet-trail { align-items: center; gap: 4px; }
.viewer-bar .viewer-download { margin-left: 4px; }
.viewer-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 16px 16px; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; border-radius: var(--r-l); background: var(--surface-container-lowest); }
/* Immagini: adattate all'area; ingrandite si scorrono in tutte le direzioni (unica eccezione
   allo scorrimento orizzontale, come in qualsiasi visore di immagini). */
.viewer-scroll { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; scrollbar-width: thin; }
.viewer-stage { display: flex; width: 100%; height: 100%; padding: 0 16px 88px; }
.viewer-stage img { display: block; flex: none; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-l); user-select: none; -webkit-user-select: none; -webkit-user-drag: none; cursor: zoom-in; }
.viewer-scroll.zoomed .viewer-stage { width: max-content; height: max-content; min-width: 100%; min-height: 100%; padding: 0 0 88px; }
.viewer-scroll.zoomed .viewer-stage img { max-width: none; max-height: none; border-radius: 0; cursor: grab; }
.viewer-scroll.dragging, .viewer-scroll.dragging img { cursor: grabbing; }
.viewer-toolbar {
  position: absolute; left: 50%; bottom: calc(16px + var(--safe-bottom)); z-index: 2; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--r-full);
  background: var(--surface-container-highest); color: var(--on-surface); box-shadow: var(--elev-3);
}
.viewer-zoom-label { min-width: 72px; height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-full); background: var(--secondary-container); color: var(--on-secondary-container); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; transition: border-radius var(--spring-fast-dur) var(--spring-fast); }
.viewer-zoom-label:active { border-radius: var(--r-m); }
.viewer-toolbar-divider { width: 1px; height: 24px; margin: 0 4px; background: var(--outline-variant); }
/* Schermo intero: riempie la finestra, i controlli restano in alto. */
.viewer-layer.full { padding: 0; }
.sheet-layer.centered.viewer-layer.full .sheet.viewer { max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; background: var(--surface-container-lowest); }
.viewer-layer.full .viewer-bar { padding-top: calc(4px + var(--safe-top)); background: var(--surface-container); }
.viewer-layer.full .viewer-stage { padding-top: 16px; }
.viewer-layer.full .viewer-scroll.zoomed .viewer-stage { padding-top: 0; }
.viewer-layer.full .viewer-body { padding: 16px; }
@media (max-width: 599px) {
  .viewer-download span { display: none; }
  .viewer-download { width: 40px; min-width: 40px; padding: 0; }
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 24px;
  background: var(--surface);
}

.lock-center { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.lock-art { width: 112px; height: 112px; color: var(--on-primary-container); --shape-fill: var(--primary-container); animation: lock-spin 18s linear infinite; }
.lock-art > .icon { width: 44px; height: 44px; animation: lock-spin 18s linear infinite reverse; }
@keyframes lock-spin { to { transform: rotate(360deg); } }
.lock-center h2 { font-size: 28px; line-height: 36px; }
.lock-center .error { color: var(--error); font-size: 14px; }
/* Larga fino a 320 px come nell'app: dentro la colonna centrata la percentuale del modulo si riferiva al
   contenitore stretto quanto il contenuto, e campo e pulsante restavano larghi 200 px. */
.lock-actions { width: min(320px, 100%); display: flex; flex-direction: column; }
.lock-actions > .btn, .pin-form { width: 100%; }
.pin-form { display: flex; flex-direction: column; gap: 12px; }
/* Con le animazioni ridotte le forme stanno ferme, come nell'app. */
@media (prefers-reduced-motion: reduce) { :is(.lock-art, .lock-art > .icon, .login-art .shape) { animation-play-state: paused; } }
:root[data-motion="reduced"] :is(.lock-art, .lock-art > .icon, .login-art .shape) { animation-play-state: paused; }

/* MARK: - Griglie di card su schermi larghi */

.page.desktop .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--min), 100%), 1fr)); gap: 12px; align-items: start; }
.page-footer { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 0; color: var(--on-surface-variant); font-size: 12px; text-align: center; }
.page-footer .bcw-logo { font-size: 15px; margin-bottom: 2px; }
.page-footer strong { font-size: 13px; font-weight: 600; }
.banner-slot { margin-bottom: 12px; }

/* MARK: - Liste: intestazioni e piè di pagina */

.list-section { display: flex; flex-direction: column; }
.list-header { font-size: 14px; line-height: 20px; font-weight: 650; color: var(--primary); padding: 0 16px 8px; }
.list-footer { font-size: 12px; line-height: 16px; letter-spacing: .3px; color: var(--on-surface-variant); padding: 8px 16px 0; }
.list-footer .icon { width: 14px; height: 14px; vertical-align: -2px; }
.trailing-icon { color: var(--on-surface-variant); width: 20px; height: 20px; }
.form { display: flex; flex-direction: column; gap: 24px; }
.form-row { min-height: 56px; }
.form-row .li-text strong { font-size: 16px; }
.form-icon { display: grid; place-items: center; width: 24px; color: var(--on-surface-variant); flex: none; }
.form-icon .icon { width: 22px; height: 22px; }
.form-value { color: var(--on-surface-variant); font-size: 14px; text-align: right; overflow-wrap: anywhere; max-width: 60%; }
.form-button .li-text strong { color: var(--primary); font-weight: 600; }
.form-button .form-icon { color: var(--primary); }
.form-button.danger .li-text strong, .form-button.danger .form-icon { color: var(--error); }
.toggle-row { cursor: pointer; }
.toggle-row.disabled { cursor: default; }
.toggle-row .li-text strong { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.value-row .li-text { flex: 0 1 auto; }
.value-row .form-value { margin-left: auto; }

/* Impostazioni › Aspetto: campioni del colore d'accento (in alto il primario, in basso
   secondario e terziario, come su Android) e anteprima dei componenti. */
.accent-picker { flex-direction: column; align-items: stretch; gap: 14px; padding-block: 16px; }
.accent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 12px 8px; justify-items: center; }
.accent-swatch {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0;
  border-radius: 50%; background: none; color: var(--on-surface); cursor: pointer; isolation: isolate;
  transition: border-radius var(--spring-dur) var(--spring), transform var(--spring-fast-dur) var(--spring-fast);
}
.accent-fill {
  position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: conic-gradient(from 90deg, var(--c3) 0 25%, var(--c2) 0 50%, var(--c1) 0 100%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on-surface) 12%, transparent);
}
.accent-swatch.custom:not(.selected) .accent-fill {
  background: conic-gradient(var(--subject-0), var(--subject-3), var(--subject-6), var(--subject-1), var(--subject-9), var(--subject-5), var(--subject-2), var(--subject-4), var(--subject-0));
}
.accent-check { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-container-lowest); color: var(--on-surface); }
.accent-check .icon { width: 18px; height: 18px; }
.accent-swatch.selected { border-radius: var(--r-l); outline: 2px solid var(--on-surface); outline-offset: 3px; }
.accent-swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
@media (hover: hover) { .accent-swatch:hover { transform: scale(1.06); } }
.accent-swatch:active { transform: scale(.94); }
.accent-swatch:focus-visible, .accent-swatch:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 3px; }
.accent-value { display: flex; align-items: center; gap: 10px; min-height: 32px; color: var(--on-surface-variant); font-size: 14px; }
.accent-value .btn { margin-left: auto; }
.accent-dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on-surface) 15%, transparent); }

.theme-preview { gap: 14px; padding-block: 14px; }
.tp-shape { --shape-fill: var(--primary-container); width: 56px; height: 56px; color: var(--on-primary-container); }
.tp-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tp-body strong { font-size: 16px; font-variation-settings: "ROND" var(--rond); }
.tp-body small { color: var(--on-surface-variant); font-size: 13px; }
.tp-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tp-row .btn { pointer-events: none; }
.tp-chip { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-s); background: var(--tertiary-container); color: var(--on-tertiary-container); font-size: 14px; font-weight: 550; }
.tp-tones { display: grid; grid-template-columns: repeat(2, 16px); gap: 6px; flex: none; align-self: flex-start; margin-top: 4px; }
.tp-tones i { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on-surface) 12%, transparent); }
@media (max-width: 380px) { .tp-tones { display: none; } }
.sheet-form { padding: 8px 20px 0; }

.account-row { display: flex; align-items: center; background: var(--card); border-radius: var(--r-xs); padding-right: 8px; }
.account-row > .list-item { background: transparent; flex: 1; }
.account-row > .list-item.selected { background: transparent; color: inherit; }
.active-check { color: var(--primary); display: grid; place-items: center; }
.account-remove { color: var(--on-surface-variant); }
.account-header { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 8px 0 4px; }
.account-header h2 { font-size: 28px; line-height: 36px; }
.account-header p { color: var(--on-surface-variant); }
.account-line { display: flex; align-items: center; gap: 12px; }

/* MARK: - Accesso */

/* Le forme che ruotano dietro al logo escono un po' dai lati: niente scorrimento orizzontale. */
.login-screen { height: 100%; overflow: hidden auto; background: var(--surface); }
.login { max-width: 440px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: calc(32px + var(--safe-top)) 24px calc(32px + var(--safe-bottom)); }
.login.adding { min-height: 0; padding: 0 20px 24px; }
.login-header { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; min-height: 200px; isolation: isolate; }
/* Sotto il logo il titolo va a capo centrato (al massimo tre righe). Tra la barra e le sue maiuscole
   lo stesso vuoto che tra la scritta e la barra (0,31 × 44 = 13,6 px): la scatola del titolo (16 px,
   interlinea 1,4) ha 4,8 px sopra le maiuscole, quindi 9 px di spazio. */
.login-header .logo-subtitle { max-width: 100%; text-align: center; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.login-art { animation: fade-in var(--effects-dur) var(--effects); }
.login.adding .login-header { min-height: 0; padding: 0 0 8px; }
.login-art { position: absolute; inset: 0; z-index: -1; opacity: .9; }
.login-art .shape { inset: auto; }
.login-art .a { width: 96px; height: 96px; left: calc(50% - 190px); top: 4px; color: var(--primary-container); animation: lock-spin 40s linear infinite; }
.login-art .b { width: 76px; height: 76px; left: calc(50% + 112px); top: 92px; color: var(--tertiary-container); animation: lock-spin 32s linear infinite reverse; }
.login-art .c { width: 44px; height: 44px; left: calc(50% + 64px); top: 6px; color: var(--secondary-container); animation: lock-spin 24s linear infinite; }
.login .logo { font-size: 44px; }
.logo-subtitle { font-size: 16px; color: var(--on-surface-variant); font-weight: 500; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.login-field { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; border-radius: var(--r-l); background: var(--surface-container-highest); color: var(--on-surface-variant); transition: box-shadow var(--effects-dur) var(--effects), border-radius var(--spring-dur) var(--spring); }
.login-field:focus-within { box-shadow: inset 0 0 0 2px var(--primary); border-radius: var(--r-m); }
.login-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; color: var(--on-surface); height: 100%; }
.login-error { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-l); background: var(--poor-container); color: var(--on-poor-container); font-size: 14px; }
.login-error .icon { width: 20px; height: 20px; }
.login-footer { display: flex; flex-direction: column; gap: 8px; text-align: center; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.login-mode .segmented > button { height: 48px; font-size: 15px; }
.login-intro { margin: 0; text-align: center; font-size: 15px; line-height: 22px; color: var(--on-surface-variant); }
.login-hint { margin: -4px 4px 2px; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.login-notice { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 16px; border-radius: var(--r-l); background: var(--secondary-container); color: var(--on-secondary-container); font-size: 14px; }
.login-notice .icon { width: 20px; height: 20px; flex: none; }
.login-footer-area { display: grid; align-items: start; }
.login-footer-area > .login-footer { grid-area: 1 / 1; }
.login-footer.inactive, .login-copy.inactive { visibility: hidden; }
.login-header { animation: login-header-in var(--effects-dur) var(--effects); }
@keyframes login-header-in { from { opacity: 0; } }

/* Telefono con la tastiera aperta: logo piccolo e titolo su una riga, tutto in alto. */
.login-screen:has(.login.compact) { height: var(--keyboard-viewport, 100%); transform: translateY(var(--keyboard-top, 0px)); }
.login.compact { justify-content: flex-start; gap: 16px; padding: calc(12px + var(--safe-top)) 24px 16px; }
.login .login-header.compact { --logo-size: 21px; flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 14px; min-height: 0; padding-top: 8px; }
.login .login-header.compact .logo { font-size: var(--logo-size); }
/* Titolo centrato sul logo (sul testo visibile, non sulle scatole): sulla stessa linea di base
   lo si alza della differenza tra i centri dei due testi. In Google Sans Flex il centro di "BCW"
   (maiuscole nere, alte .734em) sta .358em sopra la linea di base, quello del titolo (maiuscole
   e aste, alte .743em) .363em: con il logo più grande il titolo resterebbe 1,7 px più in basso. */
.login .login-header.compact .logo-subtitle { position: relative; top: calc(.363em - .358 * var(--logo-size)); min-width: 0; text-align: left; }
/* Accanto al logo piccolo un titolo lungo va a capo allineato a sinistra, con il blocco centrato
   sul logo. */
.login .login-header.compact .logo-subtitle.wraps { align-self: center; top: 0; }

/* Schermi larghi: pannello in due colonne con le note sotto. */
.login.wide { max-width: none; align-items: center; gap: 16px; padding: 40px; }
.login-card { width: min(1040px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; padding: 48px; border-radius: var(--r-xli); background: var(--surface-container); }
.login-aside { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.login.wide .login-brand .logo { font-size: 40px; }
.login-copies { display: grid; }
.login-copy { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 12px; }
.login-copy h1 { margin: 0; font-size: 36px; line-height: 44px; font-weight: 500; font-variation-settings: "ROND" var(--rond); color: var(--on-surface); }
.login-copy p { margin: 0; font-size: 16px; line-height: 24px; color: var(--on-surface-variant); max-width: 440px; }
.login-copy .login-copy-note { font-size: 14px; line-height: 20px; }
.login.wide .login-art { position: relative; inset: auto; z-index: 0; margin-top: auto; height: 150px; opacity: 1; }
.login.wide .login-art .shape { position: absolute; }
.login.wide .login-art .a { width: 128px; height: 128px; left: 0; top: 18px; }
.login.wide .login-art .b { width: 92px; height: 92px; left: 150px; top: 54px; }
.login.wide .login-art .c { width: 52px; height: 52px; left: 118px; top: 0; }
.login-main { display: flex; flex-direction: column; justify-content: center; gap: 24px; min-width: 0; }
.login-legal { width: min(1040px, 100%); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 24px; padding: 0 24px; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.login-legal .proxy-line { margin: 0; }
/* Rivedi l'introduzione e cambia server, uno accanto all'altro (vanno a capo se non ci stanno). */
.login-links { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 20px; }
.proxy-line { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.proxy-line .icon { width: 16px; height: 16px; }
/* "· Modifica" resta unito: andando a capo il punto non resta in fondo alla riga sopra. */
.proxy-edit { display: inline-flex; align-items: center; gap: 6px; }
.proxy-warning { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-li); background: var(--fair-container); color: var(--on-fair-container); font-size: 14px; }

/* MARK: - Settimana e mese (gruppo di pulsanti di M3 Expressive) */

.calendar-bar { padding: 0 var(--gutter) 12px; display: flex; flex-direction: column; gap: 6px; }
.split-side .calendar-bar, .tt-side .calendar-bar, .tt-main-head .calendar-bar { padding: 0; }
.cb-head { display: flex; align-items: center; height: 44px; margin-right: -8px; }
.cb-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  margin-left: -12px;
  padding: 0 12px;
  border-radius: 20px;
  color: var(--on-surface-variant);
  font-size: 15px;
  font-weight: 600;
  position: relative;
  isolation: isolate;
}

.cb-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .cb-title:hover::after { opacity: .08; } }
.cb-title:active::after { opacity: .12; }
.cb-rows { overflow: hidden; margin: -4px; padding: 4px; touch-action: pan-y; }
.cb-page { display: flex; flex-direction: column; gap: 4px; }
.cb-row { display: flex; gap: 4px; height: 44px; }
.cb-row.week { height: 68px; }
.cb-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; height: 20px; font-size: 12px; font-weight: 600; color: var(--on-surface-variant); text-align: center; }

.cb-day {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: var(--r-l);
  background: var(--surface-container-high);
  color: var(--on-surface);
  position: relative;
  isolation: isolate;
  transition: flex-grow var(--spring-dur) var(--spring), border-radius var(--spring-fast-dur) var(--spring-fast),
    background-color var(--effects-dur) var(--effects), color var(--effects-dur) var(--effects), transform var(--spring-fast-dur) var(--spring-fast);
}

.cb-day::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--on-surface); opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .cb-day:hover::after { opacity: .06; } }
.cb-day:active { border-radius: var(--r-s); transform: scale(.94); }
.cb-day:active::after { opacity: .1; }
/* Il giorno scelto è pieno, tutto arrotondato e più largo; gli altri si stringono. */
.cb-row.week .cb-day.selected { flex-grow: 1.45; }
.cb-day.selected { background: var(--primary); color: var(--on-primary); border-radius: 34px; }
.cb-day.today:not(.selected) { color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.cb-day.quiet { color: var(--on-surface-variant); }
.cb-wd { font-size: 12px; line-height: 16px; font-weight: 550; white-space: nowrap; }
.cb-num { font-size: 20px; line-height: 24px; font-weight: 550; }
.cb-day.selected .cb-wd, .cb-day.selected .cb-num, .cb-day.today .cb-num { font-weight: 700; }
.cb-dots { display: flex; gap: 3px; height: 5px; }
.cb-dots i { width: 5px; height: 5px; border-radius: 50%; }
/* Mese: gli stessi pulsanti, più bassi; quelli dei mesi accanto attenuati. */
.calendar-bar.month .cb-day { border-radius: var(--r-m); gap: 0; }
.calendar-bar.month .cb-day.selected { border-radius: 22px; }
.calendar-bar.month .cb-num { font-size: 16px; line-height: 20px; }
.calendar-bar.month .cb-dots { gap: 2px; height: 4px; }
.calendar-bar.month .cb-dots i { width: 4px; height: 4px; }
.cb-day.outside:not(.selected) { background: var(--surface-container); }
.cb-day.outside:not(.selected) > * { opacity: .45; }

.slide-1 { animation: slide-from-right var(--spring-dur) var(--spring); }
.slide--1 { animation: slide-from-left var(--spring-dur) var(--spring); }
@keyframes slide-from-right { from { transform: translateX(30%); opacity: 0; } }
@keyframes slide-from-left { from { transform: translateX(-30%); opacity: 0; } }

.day-swipe { transition: transform var(--spring-dur) var(--spring); touch-action: pan-y; }

/* Transizione ad asse condiviso X (giorni, schede): la pagina che entra arriva dal lato del
   verso; quella che esce (disegnata sopra per un istante) scivola dall'altro e svanisce. */
.axis { position: relative; }
.axis-in { animation: axis-in var(--spring-dur) var(--spring); }
@keyframes axis-in { from { opacity: 0; transform: translateX(calc(var(--dir) * 48px)); } }
.axis-exit-layer { position: fixed; z-index: 7; overflow: hidden; pointer-events: none; }
.axis-exit { position: absolute; margin: 0; animation: axis-out 200ms var(--effects) forwards; }
@keyframes axis-out { from { opacity: 1; transform: translateX(var(--from)); } to { opacity: 0; transform: translateX(var(--to)); } }
:root[data-motion="reduced"] .axis-in { animation-name: fade-in; }
:root[data-motion="reduced"] .axis-exit { animation-duration: 100ms; }

/* MARK: - Giorno (Dashboard e Orario) */

/* Il giorno in grande con i chip di stato. */
.day-hero { display: flex; flex-direction: column; gap: 12px; padding: 4px 4px 0; }
.day-hero-row { display: flex; align-items: center; gap: 12px; }
.day-hero-text { flex: 1; min-width: 0; }
.day-hero h2 { font-size: 40px; line-height: 48px; font-weight: 500; letter-spacing: -.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-hero p { font-size: 16px; line-height: 22px; font-weight: 500; color: var(--on-surface-variant); }
.day-jump { flex: none; animation: fab-in var(--spring-dur) var(--spring); }
.chip-flow { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-flow.center { justify-content: center; }

/* Chip di stato (32 px, contenitore tonale). */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 8px;
  border-radius: var(--r-s);
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex: none;
}

.status-chip .icon { width: 18px; height: 18px; }
.status-chip.tone-tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.status-chip.tone-good { background: var(--good-container); color: var(--on-good-container); }
.status-chip.tone-poor { background: var(--poor-container); color: var(--on-poor-container); }
.status-chip.tone-fair { background: var(--fair-container); color: var(--on-fair-container); }
.status-chip.tone-neutral { background: var(--neutral-container); color: var(--on-neutral-container); }
.status-chip.tone-surface { background: var(--surface-container-high); color: var(--on-surface-variant); }

/* Sezione segmentata: intestazione comprimibile e lista segmentata. */
.seg-section { display: flex; flex-direction: column; }
.seg-head { display: flex; align-items: center; gap: 12px; min-height: 44px; padding-left: 8px; border-radius: var(--r-m); text-align: left; }
.seg-icon { display: grid; place-items: center; }
.seg-icon .icon { width: 20px; height: 20px; }
.seg-title { font-size: 16px; font-weight: 600; }
.seg-trailing { font-size: 13px; font-weight: 600; color: var(--on-surface-variant); }
.seg-progress { width: 44px; flex: none; }
.seg-progress .wavy-progress { height: 10px; }
.seg-progress .wavy-progress .wp-active { height: 10px; }
.seg-cell { padding: 14px 16px; background: var(--cell-bg, var(--card)); }

.empty-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 20px; border-radius: var(--r-xl); background: var(--surface-container-low); text-align: center; }
.empty-day-art { width: 88px; height: 88px; margin-bottom: 10px; color: var(--on-tertiary-container); --shape-fill: var(--tertiary-container); }
.empty-day-art .icon { width: 40px; height: 40px; }
.empty-day h3 { font-size: 22px; line-height: 28px; font-weight: 500; }
.empty-day p { font-size: 14px; color: var(--on-surface-variant); }

.row-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-head > .subject-tag { flex: 0 1 auto; }
.row-title { font-size: 16px; font-weight: 550; }
.row-sub { font-size: 14px; color: var(--on-surface-variant); }
.row-caption { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); margin-top: 2px; }
.row-note { font-size: 13px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-line { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; }
.label-line .icon { width: 20px; height: 20px; }

.agenda-row { display: flex; gap: 12px; align-items: flex-start; }
.agenda-row > .grow { cursor: pointer; }
.check, .agenda-lead { width: 32px; height: 32px; margin: -4px -2px 0; display: grid; place-items: center; flex: none; color: var(--tint); border-radius: 50%; position: relative; isolation: isolate; transition: transform var(--spring-fast-dur) var(--spring-fast); }
.check::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .check:hover::after { opacity: .1; } }
.check:active { transform: scale(.86); }
.check.done { animation: check-pop var(--spring-fast-dur) var(--spring-fast); }
@keyframes check-pop { 40% { transform: scale(1.18); } }
.agenda-lead { color: var(--tint); }
.agenda-lead .icon { width: 22px; height: 22px; }
.agenda-notes { font-size: 15px; line-height: 21px; margin-top: 3px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.agenda-row.expanded .agenda-notes { -webkit-line-clamp: unset; display: block; }
.agenda-notes.done { text-decoration: line-through; color: var(--on-surface-variant); }

.absence-row { display: flex; align-items: center; gap: 14px; }
.absence-letter { width: 40px; height: 40px; font-size: 15px; }
.justified { color: var(--good); display: grid; place-items: center; }

.lesson-row { display: flex; gap: 14px; align-items: flex-start; }
.lesson-hour { width: 44px; height: 48px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 14px; background: color-mix(in srgb, var(--tint) 16%, transparent); color: var(--tint); }
.lesson-hour .numeral { font-size: 20px; line-height: 22px; }
.lesson-hour small { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.lesson-topic { font-size: 15px; line-height: 21px; margin-top: 4px; }

/* "Nei prossimi giorni", come la vista Programma di Google Calendar. */
.upcoming { display: flex; flex-direction: column; }
.upcoming-day { display: flex; align-items: flex-start; gap: 12px; }
.upcoming-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.upcoming-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 58px; border-radius: var(--r-m); text-align: left; }
.upcoming-head strong { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-head small { display: block; font-size: 13px; color: var(--on-surface-variant); }
.upcoming-body .collapsible-inner { padding-bottom: 0; margin-bottom: 0; }
.date-badge-btn { flex: none; border-radius: var(--r-l); transition: border-radius var(--spring-fast-dur) var(--spring-fast), transform var(--spring-fast-dur) var(--spring-fast); }
.date-badge-btn:active { transform: scale(.94); }
.date-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 52px; height: 58px; border-radius: var(--r-l); background: var(--surface-container-high); color: var(--on-surface); }
.date-badge small { font-size: 11px; font-weight: 700; letter-spacing: .6px; line-height: 14px; }
.date-badge .numeral { font-size: 22px; line-height: 26px; }
.date-badge.highlighted { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.date-badge.today { background: var(--primary); color: var(--on-primary); }

/* MARK: - Voti */

.grade-badge { width: var(--size); height: var(--size); color: var(--on-surface-variant); --shape-fill: var(--surface-container-highest); }
.grade-badge.counts { color: var(--on-tone-container); --shape-fill: var(--tone-container); }
.grade-badge > span:last-child { font-weight: 700; font-variant-numeric: lining-nums tabular-nums; font-variation-settings: "ROND" var(--rond); letter-spacing: -.3px; }
.grade-badge.canceled > span:last-child { text-decoration: line-through; }
@media (hover: hover) { button:hover > .grade-badge.counts > .shape { transform: rotate(20deg); } }

.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; overflow: visible; }
.ring-track { fill: none; stroke: var(--tone-container); stroke-linecap: round; }
.ring-fill { fill: none; stroke: var(--tone); stroke-linecap: round; stroke-linejoin: round; }
.ring-label { position: relative; color: var(--on-surface); font-weight: 700; letter-spacing: -.5px; }

/* Media in primo piano: anello grande al centro, poi i periodi in un gruppo collegato. */
.average-hero { display: flex; flex-direction: column; gap: 20px; padding-top: 4px; }
.ah-main { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.ah-text h2 { font-size: 22px; line-height: 28px; font-weight: 500; }
.average-hero.subject .ah-text h2 { font-size: 24px; line-height: 32px; }
.ah-text p { font-size: 14px; color: var(--on-surface-variant); margin-top: 4px; }
.cg-stack { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.cg-stack small { font-size: 12px; font-weight: 600; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cg-stack strong { font-size: 19px; line-height: 24px; font-weight: 700; }
.connected-group > button.selected .cg-stack small { opacity: 1; }

/* Gruppo di pulsanti collegati con etichette libere. */
.connected-group { display: flex; gap: 2px; width: 100%; }
.connected-group > button {
  --inner: var(--r-s);
  --outer: min(calc(var(--h) / 2), var(--r-xl));
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--h);
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: var(--inner);
  background: var(--surface-container-high);
  color: var(--on-surface);
  font-size: 14px;
  font-weight: 600;
  position: relative;
  isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects), color var(--effects-dur) var(--effects), transform var(--spring-fast-dur) var(--spring-fast);
}

.connected-group > button:first-child { border-radius: var(--outer) var(--inner) var(--inner) var(--outer); }
.connected-group > button:last-child { border-radius: var(--inner) var(--outer) var(--outer) var(--inner); }
.connected-group > button:only-child { border-radius: var(--outer); }
.connected-group > button.selected { border-radius: var(--outer); background: var(--primary); color: var(--on-primary); }
.connected-group > button:active:not(.selected) { --inner: 4px; transform: scale(.97); }
.connected-group > button::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .connected-group > button:hover::after { opacity: .08; } }
.connected-group > button > span:not(.cg-stack) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Schede principali: etichette di uguale larghezza, indicatore sotto quella scelta. */
.primary-tabs { display: flex; margin: 0 calc(var(--gutter) * -1); box-shadow: inset 0 -1px 0 var(--outline-variant); }
.page.desktop .primary-tabs { margin: 0; }
.primary-tabs > button { flex: 1 1 0; height: 48px; display: grid; place-items: center; color: var(--on-surface-variant); font-size: 15px; font-weight: 550; position: relative; transition: background-color var(--effects-fast-dur) linear; }
@media (hover: hover) { .primary-tabs > button:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); } }
.primary-tabs > button:active { background: color-mix(in srgb, var(--on-surface) 10%, transparent); }
.primary-tabs > button > span { position: relative; height: 100%; display: grid; place-items: center; padding: 0 2px; }
.primary-tabs > button i { position: absolute; left: -2px; right: -2px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); transform: scaleX(0); transition: transform var(--spring-dur) var(--spring); }
.primary-tabs > button.selected { color: var(--primary); font-weight: 650; }
.primary-tabs > button.selected i { transform: none; }

.trend-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--r-xl); background: var(--surface-container-low); }
.trend-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.trend-label, .card-title { font-size: 14px; font-weight: 600; color: var(--on-surface-variant); }
.card-title { font-size: 18px; color: var(--on-surface); font-weight: 550; }
.trend-value { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.trend-value strong { font-size: 34px; line-height: 40px; font-weight: 650; }
.trend-value span { font-size: 13px; color: var(--on-surface-variant); }
.trend-card .chart { margin-top: 0; }
.chart-band { fill: var(--poor-container); opacity: .22; }
.chart-dot { stroke: var(--surface-container-low); stroke-width: 3; }

.goal { padding: 18px; border-radius: var(--r-xl); background: var(--surface-container-low); font-size: 16px; }
.goal-head { display: flex; align-items: center; gap: 12px; }
.goal-head strong { display: block; font-size: 18px; font-weight: 550; }
.goal-head small { display: block; font-size: 13px; color: var(--on-surface-variant); }
.goal-art { width: 40px; height: 40px; color: var(--on-tertiary-container); --shape-fill: var(--tertiary-container); }
.goal-art .icon { width: 22px; height: 22px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 15px; }
.delta .icon { width: 18px; height: 18px; }

.chart { width: 100%; margin-top: 8px; }
.chart svg { display: block; overflow: visible; }
.chart-grid { stroke: var(--outline-variant); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-label { fill: var(--on-surface-variant); font-size: 11px; font-family: var(--font); }
.chart-rule { stroke: var(--poor); stroke-width: 1.2; stroke-dasharray: 3 4; opacity: .7; }

.grade-cell { padding: 12px 16px; }
.grade-head { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border-radius: var(--r-l); }
.grade-head .grow { display: flex; flex-direction: column; gap: 2px; }
.note-box { padding: 12px 14px; border-radius: var(--r-l); background: var(--surface-container-high); font-size: 14px; line-height: 20px; }
.subject-row { display: flex; align-items: center; gap: 14px; }
.subject-row strong { display: block; font-size: 16px; font-weight: 600; }
.mini-grades { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mini-grade { min-width: 30px; height: 24px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: var(--r-s); font-size: 12px; font-weight: 700; color: var(--tint); background: color-mix(in srgb, var(--tint) 15%, transparent); }
.chev-right { color: var(--on-surface-variant); width: 22px; height: 22px; }
.goal .row-between { min-height: 40px; }

/* "E se prendessi…" (3.3): card come l'obiettivo; nei Voti si comprime toccando l'intestazione
   (lo spazio tra intestazione e modulo sta dentro la parte che si comprime, così da chiusa la
   card ha lo stesso margine sopra e sotto). */
.sim-card { padding: 18px; border-radius: var(--r-xl); background: var(--surface-container-low); font-size: 16px; }
.sim-head { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border-radius: var(--r-l); }
.sim-heading { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.sim-heading strong { display: block; font-size: 18px; font-weight: 550; }
.sim-heading small { display: block; font-size: 13px; color: var(--on-surface-variant); }
.sim-art { width: 40px; height: 40px; color: var(--on-secondary-container); --shape-fill: var(--secondary-container); }
.sim-art .icon { width: 22px; height: 22px; }
.sim-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.sim-row > span:first-child { flex: none; }
.sim-subject .select-btn { flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 8px 8px 8px 12px; justify-content: space-between; border-radius: var(--r-l); background: var(--surface-container-highest); font-size: 15px; text-align: left; }
.sim-subject .select-btn > span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.sim-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sim-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 10px; border-radius: 16px; background: var(--chip-bg); color: var(--chip-fg); font-size: 12px; font-weight: 550; max-width: 100%; animation: fab-item-in var(--spring-dur) var(--spring); transition: border-radius var(--spring-fast-dur) var(--spring-fast); }
.sim-chip:active { border-radius: 8px; }
.sim-chip strong { font-size: 15px; font-weight: 700; }
.sim-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sim-chip .icon { width: 16px; height: 16px; flex: none; }
.sim-results { display: flex; flex-direction: column; gap: 10px; }
.sim-result { display: flex; align-items: baseline; gap: 8px; color: var(--on-surface-variant); }
.sim-result .icon { width: 16px; height: 16px; align-self: center; flex: none; }
.sim-result-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 550; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sim-before { font-size: 15px; font-weight: 500; }
.sim-after { font-size: 20px; line-height: 1.1; font-weight: 650; }
.sim-result.prominent .sim-after { font-size: 32px; }
.sim-delta { align-self: center; flex: none; height: 22px; padding: 0 7px; border-radius: 11px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-delta.up { background: var(--good-container); color: var(--on-good-container); }
.sim-delta.down { background: var(--poor-container); color: var(--on-poor-container); }
.sim-reset { display: flex; justify-content: flex-end; }
.subject-row { padding-top: 14px; padding-bottom: 14px; }
.big { font-size: 32px; }

/* MARK: - Tu */

/* Profilo centrato, come la pagina dell'account Google. */
.profile-hero { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 8px; text-align: center; }
.profile-avatar { border-radius: 50%; }
.profile-avatar .avatar > .shape { transform: rotate(var(--turn, 0deg)); transition: transform var(--spring-slow-dur) var(--spring); }
.profile-text h2 { font-size: 28px; line-height: 36px; font-weight: 500; }
.profile-text p { font-size: 14px; color: var(--on-surface-variant); margin-top: 4px; }
.profile-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Riquadri con un numero; in una griglia collegata angoli ampi solo verso l'esterno. */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid.connected { gap: 2px; }
.stat-tile { display: flex; align-items: center; gap: 12px; min-height: 84px; padding: 0 16px; border-radius: var(--r-li); text-align: left; }
.stat-tile.vertical { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
.stat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stat-icon { width: 40px; height: 40px; flex: none; color: var(--tint); --shape-fill: color-mix(in srgb, var(--tint) 18%, var(--surface-container-high)); }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-value { font-size: 30px; line-height: 36px; }
.stat-tile.vertical .stat-value { font-size: 28px; line-height: 34px; }
.stat-title { font-size: 13px; line-height: 16px; color: var(--on-surface-variant); font-weight: 550; overflow-wrap: anywhere; }
/* Con l'icona accanto il titolo resta su una riga, come nell'app (che lo rimpicciolisce fino
   all'80%): andando a capo il numero non sarebbe più alla stessa altezza di quello accanto. La
   larghezza si stima dai caratteri (`--len`, circa 0,55 em ciascuno in Google Sans Flex). */
.stat-tile:not(.vertical) .stat-text { container-type: inline-size; }
.stat-tile:not(.vertical) .stat-title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: clamp(10.4px, 100cqi / (var(--len, 1) * .55), 13px);
}
.stat-tile[class*="corners-"] { --w: var(--r-li); --n: var(--r-xs); border-radius: var(--n); }
.stat-tile.corners-tl { border-top-left-radius: var(--w); }
.stat-tile.corners-tr { border-top-right-radius: var(--w); }
.stat-tile.corners-bl { border-bottom-left-radius: var(--w); }
.stat-tile.corners-br { border-bottom-right-radius: var(--w); }
.stat-tile.corners-l { border-top-left-radius: var(--w); border-bottom-left-radius: var(--w); }
.stat-tile.corners-r { border-top-right-radius: var(--w); border-bottom-right-radius: var(--w); }

.attention .list-item .li-text strong { font-weight: 600; color: var(--on-secondary-container); }
.you-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.you-top.side { grid-template-columns: minmax(300px, 1fr) minmax(0, 1.4fr); align-items: start; }
.you-top.side .profile-hero { padding-top: 24px; }
.you-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 24px; align-items: start; }

/* MARK: - Ricerca */

.search-grade { display: flex; align-items: center; gap: 12px; }
.file-icon { display: grid; place-items: center; color: var(--primary); flex: none; }

/* MARK: - Bacheca */

.notice-row { align-items: flex-start; gap: 12px; padding: 14px 16px; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.notice-row.unread .unread-dot { background: var(--primary); }
.notice-title { display: block; font-size: 15px; line-height: 21px; font-weight: 500; overflow-wrap: anywhere; }
.notice-row.unread .notice-title { font-weight: 700; }
.notice-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--on-surface-variant); flex-wrap: wrap; }
.notice-meta .category { color: var(--primary); font-weight: 650; }
.notice-row.selected { background: var(--secondary-container); color: var(--on-secondary-container); border-radius: var(--r-l); }
.detail-title { font-size: 26px; line-height: 34px; font-weight: 500; }
.notice-text { font-size: 15px; line-height: 23px; white-space: pre-line; overflow-wrap: anywhere; }
.attachment { gap: 14px; }
textarea.reply { width: 100%; }
.mail-split { flex: 1; min-height: 0; display: grid; grid-template-columns: 400px minmax(0, 1fr); }
.mail-list { overflow-y: auto; }
.mail-list .column { padding: 8px 12px 40px 28px; }
.mail-detail { overflow-y: auto; margin: 0 16px 16px 4px; border-radius: var(--r-xl); background: var(--surface-container-low); }
.mail-detail .column { padding: 24px 28px 40px; max-width: 780px; }
.mail-detail > .empty-state { height: 100%; justify-content: center; }

/* MARK: - Sezioni di Tu */

.note-text { font-size: 15px; line-height: 22px; white-space: pre-line; overflow-wrap: anywhere; }
.absence-day { display: flex; align-items: center; gap: 12px; }
.absence-day .absence-row { flex: 1; min-width: 0; }
.date-box { width: 44px; flex: none; display: flex; flex-direction: column; align-items: center; }
.date-box .numeral { font-size: 22px; line-height: 26px; }
.date-box small { font-size: 11px; color: var(--on-surface-variant); font-weight: 600; text-transform: uppercase; }
.topic-row { display: grid; grid-template-columns: 56px 1fr; gap: 10px; font-size: 14px; line-height: 20px; }
.topic-row > :first-child { color: var(--on-surface-variant); }
.day-navigator { display: flex; align-items: center; gap: 8px; }
.date-field { flex: 1; min-width: 0; height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 20px; background: var(--surface-container-high); color: var(--on-surface); font-size: 15px; font-weight: 550; transition: border-radius var(--spring-fast-dur) var(--spring-fast); }
.date-field .icon { color: var(--on-surface-variant); }
.date-field span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-field:active { border-radius: var(--r-m); }
.day-title { font-size: 22px; line-height: 28px; font-weight: 500; padding: 0 4px; }
.teacher-head { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.teacher-head h3 { font-size: 18px; font-weight: 550; }
.teacher-initial { width: 36px; height: 36px; border-radius: var(--r-m); display: grid; place-items: center; color: var(--surface); font-size: 16px; }
.folder-card { overflow: hidden; }
.folder-card .file-row { background: transparent; }
.folder-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; }
.folder-head strong { display: block; font-size: 15px; font-weight: 600; }
.folder-head small { display: block; font-size: 12px; color: var(--on-surface-variant); }
.folder-icon { color: var(--subject-3); display: grid; place-items: center; }
.folder-card .collapsible-inner { padding: 0; margin: 0; }
.file-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; text-align: left; }
.file-row:hover { background: color-mix(in srgb, var(--on-surface) 5%, transparent); }
.file-row small { display: block; font-size: 12px; color: var(--on-surface-variant); }
.document-button { gap: 14px; }
.period-average { font-size: 28px; }
.list-row { display: flex; align-items: center; gap: 14px; }
.list-row strong { display: block; font-size: 16px; font-weight: 550; }
.list-row small { display: block; font-size: 13px; color: var(--on-surface-variant); }
.list-average { font-size: 18px; }
.book { width: 100%; }
.book strong { font-size: 15px; font-weight: 600; }
.isbn { font-size: 11px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.holiday-row { gap: 12px; font-size: 15px; min-height: 52px; }
.holiday-row.past { color: var(--on-surface-variant); }
.year-summary { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
.year-summary .next-holiday { flex: 1; align-items: center; justify-content: center; text-align: center; }
.text-sheet { padding: 4px 20px 20px; white-space: pre-line; font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }

/* MARK: - Orario */

.tt-extras { display: flex; flex-direction: column; gap: 10px; }
.split-main .tt-extras { margin-bottom: 4px; }
.tt-list { display: flex; flex-direction: column; gap: 10px; }
/* Lezioni di seguito: una lista segmentata (2 px tra l'una e l'altra, angoli ampi all'esterno). */
.tt-run { display: flex; flex-direction: column; gap: 2px; transition: gap var(--spring-slow-dur) var(--spring); }
.tt-run > * { border-radius: var(--r-xs); overflow: hidden; transition: border-radius var(--spring-slow-dur) var(--spring); }
.tt-run > :first-child { border-top-left-radius: var(--r-li); border-top-right-radius: var(--r-li); }
.tt-run > :last-child { border-bottom-left-radius: var(--r-li); border-bottom-right-radius: var(--r-li); }
.tt-run > .tt-columns { overflow: visible; }

.tt-block {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--tint) 18%, var(--surface-container-low));
  transition: background-color var(--effects-dur) var(--effects);
}

/* Anteprima della bozza (come nell'app dalla 3.3, al posto del bordo tratteggiato): pillole
   staccate più piene nella tinta, che compaiono a scaglioni lungo la giornata, con un'onda al
   posto della barretta e un'onda di luce che scende lungo la giornata. Applicando la classe
   `draft` sparisce dagli stessi elementi: angoli, spazi, colori e barretta si assestano con la molla. */
.tt-run.draft { gap: 6px; }
.tt-run.draft > * { border-radius: var(--r-xl); }
.tt-run.draft .tt-column > .tt-block { border-radius: var(--r-l); }
.tt-block.draft { background: color-mix(in srgb, var(--tint) 28%, var(--surface-container-low)); }
.tt-block.draft, .tt-break.draft, .tt-seg.draft { animation: draft-in var(--spring-dur) var(--spring) var(--draft-delay, 0ms) backwards; }
@keyframes draft-in { from { opacity: 0; transform: scale(.86); } }
.draft-sheen {
  --sheen: light-dark(color-mix(in srgb, var(--surface-container-lowest) 42%, transparent), color-mix(in srgb, var(--on-surface) 14%, transparent));
  position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit;
  background: linear-gradient(135deg, transparent 40%, var(--sheen) 50%, transparent 60%) 100% 100% / 300% 300% no-repeat;
  animation: draft-sheen 3.4s linear infinite;
}
@keyframes draft-sheen { 0% { background-position: 100% 100%; } 32%, 100% { background-position: 0% 0%; } }
@media (prefers-reduced-motion: reduce) { .draft-sheen { animation: none; opacity: 0; } }
:root[data-motion="reduced"] .draft-sheen { animation: none; opacity: 0; }
.tt-entry { display: flex; align-items: stretch; gap: 12px; width: 100%; padding: 12px 14px 12px 12px; text-align: left; position: relative; isolation: isolate; }
.tt-entry::after { content: ""; position: absolute; inset: 0; background: var(--on-surface); opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .tt-entry:hover::after { opacity: .05; } }
.tt-entry:active::after { opacity: .1; }
.tt-times { width: 46px; flex: none; display: flex; flex-direction: column; align-items: flex-end; padding-top: 1px; }
.tt-times strong { font-size: 15px; font-weight: 650; }
.tt-times small { font-size: 12px; color: var(--on-surface-variant); }
.tt-bar { width: 4px; flex: none; border-radius: 2px; background: var(--tint); }
/* Nella lista la barretta di un'ora di un gruppo arriva al bordo verso le ore accanto (meno 2 px):
   le barrette formano una barra a segmenti con 4 px di stacco, come i gruppi collegati di M3
   Expressive (prima una linea tratteggiata separava le ore). In anteprima è un'onda larga 10 px,
   che applicando si raddrizza (dissolvenza tra le due e larghezza con la molla). */
.tt-entry .tt-bar { position: relative; background: none; transition: width var(--spring-slow-dur) var(--spring), margin var(--spring-slow-dur) var(--spring); }
.tt-entry .tt-bar::before, .tt-entry .tt-bar::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--tint); transition: opacity var(--effects-dur) var(--effects); }
.tt-entry .tt-bar::after, .tt-seg-wave { opacity: 0; border-radius: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='16' viewBox='0 0 10 16'%3E%3Cpath d='M5 0 Q10 4 5 8 T5 16' fill='none' stroke='black' stroke-width='4'/%3E%3C/svg%3E") center top / 10px 16px repeat-y;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='16' viewBox='0 0 10 16'%3E%3Cpath d='M5 0 Q10 4 5 8 T5 16' fill='none' stroke='black' stroke-width='4'/%3E%3C/svg%3E") center top / 10px 16px repeat-y; }
.tt-entry.join-up .tt-bar { margin-top: -10px; }
.tt-entry.join-down .tt-bar { margin-bottom: -10px; }
.tt-entry.compact.join-up .tt-bar { margin-top: -8px; }
.tt-entry.compact.join-down .tt-bar { margin-bottom: -8px; }
.tt-block.draft .tt-bar { width: 10px; }
.tt-block.draft .tt-bar::before { opacity: 0; }
.tt-block.draft .tt-bar::after { opacity: 1; }
.tt-entry-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tt-title-row { display: flex; align-items: flex-start; gap: 8px; }
.tt-title { flex: 1; min-width: 0; font-size: 16px; line-height: 22px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tt-details { font-size: 12px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-badges { display: flex; gap: 10px; font-size: 12px; color: var(--on-surface-variant); }
.tt-badges span { display: inline-flex; align-items: center; gap: 3px; }
.tt-badges .icon { width: 14px; height: 14px; }
.tt-entry.compact { gap: 8px; padding: 10px; }
.tt-entry.compact .tt-time { font-size: 12px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.tt-entry.compact .tt-title { font-size: 14px; line-height: 19px; -webkit-line-clamp: 3; }
.tt-entry.compact.follow .tt-title { opacity: .55; }
.tt-entry.compact .tt-details { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tt-columns { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; align-items: start; border-radius: inherit; }
.tt-column { display: flex; flex-direction: column; gap: 2px; }
.tt-run > .tt-columns .tt-block { border-radius: inherit; }
/* Ogni colonna ha gli angoli della cella, come nell'app: prima gli angoli interni erano dritti e,
   con colonne di altezze diverse, quella più bassa finiva con un solo angolo arrotondato. */
.tt-columns > .tt-column { border-radius: inherit; }
.tt-column > .tt-block { border-radius: var(--r-xs); }

.tt-break { display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px 8px; color: var(--on-surface-variant); border-radius: var(--r-m); }
.tt-break.draft { opacity: .75; }
.tt-break-label {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px; border-radius: 15px;
  background: color-mix(in srgb, var(--tint) 20%, var(--surface-container-high));
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; transition: background-color var(--effects-dur) var(--effects);
}
@media (hover: hover) { .tt-break:hover .tt-break-label { background: color-mix(in srgb, var(--tint) 32%, var(--surface-container-high)); } }
.tt-break-label .icon { color: var(--tint); }
.tt-gap { display: flex; align-items: center; gap: 10px; padding: 2px 8px; font-size: 12px; color: var(--on-surface-variant); }
.tt-gap hr { flex: 1; border: 0; height: 1px; background: var(--outline-variant); margin: 0; }
.tt-empty { padding: 0; }

.tt-test-row { display: flex; align-items: flex-start; gap: 12px; width: 100%; }
.tt-test-row strong, .tt-hidden-row strong { display: block; font-size: 15px; font-weight: 600; }
.tt-test-icon { color: var(--primary); display: grid; place-items: center; padding-top: 2px; }
.tt-test-row.hidden .tt-test-icon { color: var(--on-surface-variant); }
.tt-test-notes { font-size: 14px; line-height: 20px; }
.tt-test-row.hidden .tt-test-notes { text-decoration: line-through; color: var(--on-surface-variant); }
.tt-test-mark { color: var(--primary); display: inline-grid; vertical-align: -3px; }
.tt-test-mark .icon { width: 16px; height: 16px; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tt-hidden-row { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.tt-hidden-row .reason { display: inline-flex; align-items: center; gap: 4px; }
.tt-hidden-row .reason .icon { width: 14px; height: 14px; }

.tt-draft-header { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--r-xl); background: var(--tertiary-container); color: var(--on-tertiary-container); transform-origin: top; animation: draft-header-in var(--spring-dur) var(--spring); }
@keyframes draft-header-in { from { opacity: 0; transform: scale(.92); } }
.tt-draft-header strong { display: block; font-size: 17px; line-height: 22px; font-weight: 600; font-variation-settings: "ROND" var(--rond); }
.tt-draft-header p { font-size: 12px; line-height: 16px; opacity: .85; margin-top: 2px; }
.tt-draft-header .tt-draft-free { font-weight: 600; opacity: 1; }
.tt-draft-art { width: 52px; height: 52px; --shape-fill: color-mix(in srgb, var(--on-tertiary-container) 14%, transparent); }
.tt-draft-art .icon { width: 24px; height: 24px; }
/* La forma ruota lentamente, come nell'app (14 s per giro). */
.tt-draft-art > .shape { animation: m3-loading-turn 14s linear infinite; }
@media (prefers-reduced-motion: reduce) { .tt-draft-art > .shape { animation: none; } }
:root[data-motion="reduced"] .tt-draft-art > .shape { animation: none; }
.tt-draft-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-li); background: var(--secondary-container); color: var(--on-secondary-container); font-size: 14px; }
.tt-edit-bar { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-li); background: var(--tertiary-container); color: var(--on-tertiary-container); }
.tt-edit-bar .icon { width: 20px; height: 20px; flex: none; }
.tt-edit-bar strong { display: block; font-size: 14px; font-weight: 650; }
.tt-edit-bar p { font-size: 12px; line-height: 16px; opacity: .85; margin-top: 2px; }

/* La lezione in corso (o la prossima), nel contenitore primario. */
.now-card {
  display: flex; flex-direction: column; gap: 14px; width: 100%; padding: 20px; border-radius: var(--r-xl);
  background: var(--primary-container); color: var(--on-primary-container); text-align: left; position: relative; isolation: isolate;
  transition: border-radius var(--spring-fast-dur) var(--spring-fast);
}
.now-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .now-card:hover::after { opacity: .06; } }
.now-card:active { border-radius: var(--r-l); }
.now-top { display: flex; align-items: flex-start; gap: 14px; }
.now-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.now-text small { font-size: 12px; font-weight: 750; letter-spacing: .8px; opacity: .8; }
.now-text strong { font-size: 26px; line-height: 32px; font-weight: 500; font-variation-settings: "ROND" var(--rond); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.now-text span { font-size: 14px; opacity: .85; }
.now-art { width: 56px; height: 56px; --shape-fill: color-mix(in srgb, var(--on-primary-container) 12%, transparent); }
.now-art .icon { width: 26px; height: 26px; }
.now-card .wavy-progress .wp-active { background: var(--on-primary-container); }
.now-card .wavy-progress .wp-track { background: color-mix(in srgb, var(--on-primary-container) 22%, transparent); }
.now-card .wavy-progress .wp-track::after { background: var(--on-primary-container); }
.now-next { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; max-width: 100%; height: 36px; padding: 0 12px; border-radius: 18px; background: color-mix(in srgb, var(--on-primary-container) 8%, transparent); font-size: 14px; font-weight: 600; }
.now-next span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-next .icon { width: 18px; height: 18px; flex: none; }
.tt-unmatched-capsule { display: flex; align-items: center; gap: 8px; align-self: flex-start; padding: 8px 14px; border-radius: 20px; background: var(--fair-container); color: var(--on-fair-container); font-size: 13px; font-weight: 550; }

.tt-week-row { gap: 10px; min-height: 60px; }
.tt-week-row .li-text strong { font-size: 15px; font-weight: 600; }
.tt-week-row .li-text small { font-size: 12px; line-height: 16px; }
.tt-week-row.selected .li-text small { color: inherit; opacity: .8; }
.tt-bars { display: flex; gap: 2px; flex: none; }
.tt-bars i { height: 14px; border-radius: 3px; }
.tt-week-row.draft .tt-bars i { opacity: .5; }

/* Giornata a ore. */
.tt-timeline { position: relative; }
.tt-timeline.mobile { margin: 0 calc(var(--gutter) * -1 + 4px); }
.tt-days-head { display: grid; grid-template-columns: 54px repeat(auto-fit, minmax(0, 1fr)); padding: 4px 6px 8px 0; border-bottom: 1px solid var(--outline-variant); }
.tt-day-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 13px; color: var(--on-surface-variant); border-radius: var(--r-l); }
.tt-day-head:hover { background: color-mix(in srgb, var(--on-surface) 5%, transparent); }
.tt-day-num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 15px; color: var(--on-surface); }
.tt-day-head.today .tt-day-num { color: var(--primary); }
.tt-day-head.selected { color: var(--primary); }
.tt-day-head.selected .tt-day-num { background: var(--primary); color: var(--on-primary); }
.tt-grid { position: relative; margin: 8px 0 12px; }
.tt-hour { position: absolute; left: 0; right: 6px; height: 0; border-top: 1px solid var(--outline-variant); }
.tt-hour span { position: absolute; left: 0; width: 44px; top: -8px; text-align: right; font-size: 11px; color: var(--on-surface-variant); background: var(--surface); padding-right: 4px; }
.tt-timeline-card .tt-hour span { background: var(--surface-container-low); }
.tt-cols {
  position: absolute;
  inset: 0 6px 0 54px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hh) / 2 - .5px), color-mix(in srgb, var(--outline-variant) 45%, transparent) calc(var(--hh) / 2 - .5px), color-mix(in srgb, var(--outline-variant) 45%, transparent) calc(var(--hh) / 2 + .5px), transparent calc(var(--hh) / 2 + .5px), transparent var(--hh));
}

.tt-col { position: relative; }
.tt-col + .tt-col { box-shadow: inset 1px 0 0 color-mix(in srgb, var(--outline-variant) 60%, transparent); }
.tt-col.selected { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.tt-grid.editing .tt-col { cursor: copy; }

.tt-seg {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  padding: 4px 4px 4px 10px;
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--tint) 36%, var(--surface));
  text-align: left;
  font-size: 12px;
  line-height: 15px;
  z-index: 1;
  transition: box-shadow var(--effects-dur) var(--effects), transform var(--spring-fast-dur) var(--spring-fast);
}

.tt-seg.rt { border-top-left-radius: var(--r-m); border-top-right-radius: var(--r-m); }
.tt-seg.rb { border-bottom-left-radius: var(--r-m); border-bottom-right-radius: var(--r-m); }
.tt-seg:hover { filter: brightness(.97); }
.tt-seg.break {
  z-index: 2;
  padding-left: 8px;
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--tint) 25%, transparent) 0 3px, transparent 3px 10px), color-mix(in srgb, var(--tint) 32%, var(--surface-container-lowest));
  box-shadow: inset 0 0 0 .75px color-mix(in srgb, var(--tint) 60%, transparent), 0 1px 3px rgb(var(--shadow-color) / .12);
  border-radius: 10px;
}

.tt-seg.draft { background: color-mix(in srgb, var(--tint) 30%, var(--surface)); padding-left: 18px; border-radius: var(--r-l); }
.tt-seg.draft.rt { border-top-left-radius: var(--r-xl); border-top-right-radius: var(--r-xl); }
.tt-seg.draft.rb { border-bottom-left-radius: var(--r-xl); border-bottom-right-radius: var(--r-xl); }
.tt-seg.draft.break { padding-left: 8px; border-radius: 10px; }
.tt-seg-wave { position: absolute; left: 5px; top: 8px; bottom: 8px; width: 10px; background: var(--tint); opacity: 1; }
/* Nella vista Giorno l'onda di luce sta sotto il testo, come nell'app. */
.tt-seg.draft > .tt-seg-title, .tt-seg.draft > .tt-seg-time, .tt-seg.draft > .tt-seg-line, .tt-seg.draft > .tt-seg-pill { position: relative; z-index: 2; }
/* Il nome sta in un elemento a parte: i puntini di sospensione non valgono per il testo diretto
   di un contenitore flex (i nomi lunghi venivano tagliati di netto) e l'icona della verifica
   resta visibile accanto. */
.tt-seg-title { font-weight: 650; display: flex; align-items: flex-start; gap: 4px; min-width: 0; overflow: hidden; }
.tt-seg-title .tt-seg-test { flex: none; }
.tt-seg-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-seg-title.two .tt-seg-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tt-seg-time { font-size: 11px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-seg-line { display: flex; gap: 6px; white-space: nowrap; overflow: hidden; }
.tt-seg-line .tt-seg-title { flex: 0 1 auto; }
.tt-seg-line .tt-seg-time { flex: 0 1 auto; }
.tt-seg-pill { font-size: 11px; font-weight: 750; color: var(--primary); }
.tt-seg-test { color: var(--primary); display: inline-grid; }
.tt-seg-test .icon { width: 14px; height: 14px; }
.tt-grid.editing .tt-seg { cursor: grab; touch-action: none; }
.tt-seg.dragging { z-index: 20; cursor: grabbing; box-shadow: 0 4px 16px rgb(var(--shadow-color) / .22); overflow: visible; transition: none; }
.tt-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 12px; cursor: ns-resize; display: grid; place-items: center; }
.tt-resize i { width: 22px; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--on-surface) 35%, transparent); }
.tt-drag-capsule { position: absolute; top: -26px; left: 4px; padding: 2px 10px; border-radius: 12px; background: var(--primary); color: var(--on-primary); font-size: 11px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: var(--elev-2); }
.tt-now { position: absolute; left: 50px; right: 6px; height: 2px; background: var(--poor); z-index: 5; pointer-events: none; }
.tt-now::before { content: ""; position: absolute; left: 0; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--poor); }
.tt-now-label { position: absolute; left: -50px; top: -9px; padding: 1px 5px; border-radius: 8px; background: var(--poor); color: var(--on-poor); font-size: 11px; font-weight: 700; }
.tt-col-empty { position: absolute; left: 12px; right: 12px; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--surface-container-high) 95%, transparent); text-align: center; pointer-events: none; }
.tt-col-empty strong { font-size: 14px; font-weight: 600; }
.tt-col-empty span { font-size: 12px; color: var(--on-surface-variant); }

.tt-split { flex: 1; min-height: 0; display: grid; grid-template-columns: 378px minmax(0, 1fr); }
.tt-split.single { grid-template-columns: minmax(0, 1fr); }
.tt-side { overflow-y: auto; min-height: 0; }
.tt-side > .column { padding: 8px 12px 40px 28px; display: flex; flex-direction: column; gap: 16px; }
.tt-main { min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 8px 28px 20px 16px; }
.tt-split.single .tt-main { padding-left: 28px; }
.tt-main-head { display: flex; flex-direction: column; gap: 12px; }
.tt-main-head:empty { display: none; }
.tt-timeline-card { flex: 1; min-height: 0; padding: 4px 0 0; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-xl); background: var(--surface-container-low); }
.tt-timeline-card .tt-timeline { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.timeline-scroll { flex: 1; min-height: 0; overflow-y: auto; }

.tt-detail-head { display: flex; gap: 14px; padding: 16px; border-radius: var(--r-li); background: color-mix(in srgb, var(--tint) 20%, var(--surface-container-high)); }
.tt-detail-head .tt-bar { width: 6px; border-radius: 3px; }
.tt-detail-head h2 { font-size: 24px; line-height: 32px; font-weight: 500; }
.tt-detail-head p { font-size: 14px; line-height: 20px; }
.note-item { padding: 8px; }
.note-item textarea { background: transparent; min-height: 64px; }
.note-item textarea:focus { background: var(--surface-container-highest); }
.tt-attachment { gap: 4px; padding-right: 8px; }
.tt-attachment-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; text-align: left; }

/* Moduli nei fogli. */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--on-surface-variant); padding-left: 4px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; align-items: end; }
.field-value { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--r-l); background: var(--surface-container); font-size: 15px; }
.field .select-btn { min-height: 44px; justify-content: space-between; border-radius: var(--r-l); background: var(--surface-container-highest); }
.text-input.time { min-height: 44px; padding: 8px 12px; width: 100%; }
.form-row .text-input.time { width: auto; min-width: 110px; }
.weekday-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekday-chip { text-align: center; height: 40px; border-radius: var(--r-m); background: var(--surface-container-highest); font-size: 13px; font-weight: 550; transition: background-color var(--effects-dur) var(--effects), border-radius var(--spring-fast-dur) var(--spring-fast); }
.weekday-chip.selected { background: var(--primary); color: var(--on-primary); font-weight: 700; border-radius: 20px; }
.editor .segmented > button { height: 44px; }
.color-row .trailing { margin-left: auto; }
.swatch-dot { width: 24px; height: 24px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgb(var(--shadow-color) / .1); }
.swatch-dot.big { width: 36px; height: 36px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 10px; justify-items: center; }
.swatches.small { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 8px; justify-items: start; }
.swatch { width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; background: var(--swatch); color: #fffefd; box-shadow: inset 0 0 0 1px rgb(var(--shadow-color) / .1); transition: transform var(--spring-fast-dur) var(--spring-fast), border-radius var(--spring-fast-dur) var(--spring-fast); }
.swatch:hover { transform: scale(1.08); }
.swatch.selected { border-radius: 30%; outline: 2px solid var(--on-surface); outline-offset: 3px; }
.swatch .icon { width: 60%; height: 60%; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .3)); }
.palette-block { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r-li); background: var(--surface-container); }
.palette-block strong { font-size: 14px; font-weight: 600; }
.palette-strip { display: flex; height: 18px; width: 100%; border-radius: 9px; overflow: hidden; }
.palette-strip i { flex: 1; }
.palette-strip.gapped { gap: 2px; }
/* Scorre fino ai bordi del foglio, come le file di chip. */
.palette-cards { display: flex; gap: 10px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 8px; scroll-padding-inline: 20px; scrollbar-width: none; }
.palette-card { flex: none; width: 112px; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: var(--r-l); background: var(--surface-container); box-shadow: inset 0 0 0 1px var(--outline-variant); font-size: 12px; text-align: left; transition: border-radius var(--spring-fast-dur) var(--spring-fast); }
.palette-card.selected { box-shadow: inset 0 0 0 2px var(--primary); font-weight: 700; border-radius: 22px; }
.palette-card.new { align-items: center; justify-content: center; color: var(--primary); }
.series-row { gap: 12px; }
.series-row.selected { background: var(--card); color: inherit; border-radius: var(--r-xs); }
.series-check { color: var(--on-surface-variant); display: grid; place-items: center; }
.series-row.selected .series-check { color: var(--primary); }
.series-bar { width: 6px; height: 30px; border-radius: 3px; flex: none; }

/* Sposta gli orari (Modifica orario): il valore per tutti i giorni nel contenitore primario, con
   le scorciatoie; sotto un giorno per riga con i suoi minuti e, aperto, gli eventi con l'orario nuovo. */
.shift-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px; border-radius: var(--r-xl); background: var(--primary-container); color: var(--on-primary-container); text-align: center; }
.shift-hero > small { font-size: 12px; font-weight: 750; letter-spacing: .8px; opacity: .8; }
.shift-hero > p { font-size: 13px; font-weight: 550; opacity: .85; }
.shift-hero .icon-btn.tonal { --s: 48px; background: color-mix(in srgb, var(--on-primary-container) 10%, transparent); color: var(--on-primary-container); }
.shift-shortcuts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; width: 100%; }
.shift-shortcut { min-height: 36px; border-radius: 18px; background: color-mix(in srgb, var(--on-primary-container) 8%, transparent); color: var(--on-primary-container); font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; transition: border-radius var(--spring-fast-dur) var(--spring-fast), background-color var(--effects-dur) var(--effects), color var(--effects-dur) var(--effects); }
.shift-shortcut:active { border-radius: 10px; }
.shift-shortcut.selected { background: var(--primary); color: var(--on-primary); }
.minutes-field { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.minutes-field.large { gap: 12px; }
.mf-value { display: inline-flex; align-items: baseline; justify-content: center; min-width: 44px; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.minutes-field.large .mf-value { min-width: 140px; font-size: 40px; line-height: 48px; font-weight: 600; }
.mf-sign { min-width: 12px; min-height: 32px; padding: 0 1px; color: inherit; font: inherit; border-radius: var(--r-s); }
.minutes-field.large .mf-sign { min-width: 22px; min-height: 44px; }
.mf-sign.zero { opacity: .35; }
.mf-input { width: 3ch; field-sizing: content; min-width: 1ch; max-width: 4ch; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: center; outline: none; border-radius: var(--r-xs); }
.mf-input::placeholder { color: inherit; opacity: 1; }
.mf-input:focus-visible { box-shadow: 0 2px 0 currentColor; }
.mf-unit { font-size: 18px; font-weight: 500; margin-left: 4px; }
.shift-notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-li); background: var(--tertiary-container); color: var(--on-tertiary-container); font-size: 13px; font-weight: 550; line-height: 18px; animation: fade-in var(--effects-dur) var(--effects); }
.shift-notice .icon { width: 20px; height: 20px; flex: none; }
.shift-day-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.shift-day-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; border-radius: var(--r-m); }
.shift-day-toggle .li-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shift-day-toggle strong { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-day-toggle small { font-size: 12px; color: var(--on-surface-variant); }
.shift-entries { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 8px; }
.shift-entry { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px; border-radius: var(--r-m); text-align: left; position: relative; isolation: isolate; transition: border-radius var(--spring-fast-dur) var(--spring-fast); }
.shift-entry::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--on-surface); opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .shift-entry:hover::after { opacity: .05; } }
.shift-entry:active { border-radius: var(--r-s); }
.shift-entry:active::after { opacity: .1; }
.shift-entry .series-bar { width: 4px; height: 28px; border-radius: 2px; }
.shift-entry .li-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shift-entry strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-entry:not(.on) strong { color: var(--on-surface-variant); }
.shift-entry small { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--on-surface-variant); white-space: nowrap; }
.shift-entry small .old { text-decoration: line-through; }
.shift-entry small .new { font-weight: 600; color: var(--primary); }
.shift-entry small .icon { width: 14px; height: 14px; }
.shift-check { display: grid; place-items: center; color: var(--outline); }
.shift-check .icon { width: 22px; height: 22px; }
.shift-entry.on .shift-check { color: var(--primary); }
.gen-break { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.gen-break-head, .gen-break-controls { display: flex; align-items: center; gap: 16px; min-width: 0; }
.gen-break-controls { gap: 12px; padding-left: 40px; }
.period-date { flex: 0 1 220px; }
.word-add { gap: 8px; }
.word-add .btn { flex: none; }
/* "Eventi" sulla stessa linea di "Tutti" e "Nessuno". */
.series-events-head .list-header { padding-bottom: 0; }

/* MARK: - Adattamenti per larghezza */

@media (min-width: 600px) {
  :root { --gutter: 24px; }
}

@media (max-width: 720px) {
  .year-summary { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1100px) and (min-width: 840px) {
  .mail-split { grid-template-columns: 340px minmax(0, 1fr); }
}

@media (max-width: 380px) {
  .nav-indicator { width: 48px; }
  .day-hero h2 { font-size: 34px; line-height: 42px; }
  .app-bar.large .app-bar-title h1 { font-size: 30px; }
}

/* MARK: - Selettore della data (Material 3, modale) */

.date-picker { max-width: 360px; padding: 0; background: var(--surface-container-high); overflow: hidden; }
.dp-head { display: flex; flex-direction: column; gap: 28px; padding: 20px 24px 12px; }
.dp-label { font-size: 14px; font-weight: 550; color: var(--on-surface-variant); }
.dialog .dp-headline { margin: 0; font-size: 32px; line-height: 40px; font-weight: 450; }
.dp-month-row { display: flex; align-items: center; height: 48px; padding: 8px 12px 0; }
.dp-month-btn { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px; border-radius: 20px; color: var(--on-surface-variant); font-size: 15px; font-weight: 600; }
@media (hover: hover) { .dp-month-btn:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); } }
.dp-caret { display: grid; place-items: center; transition: transform var(--spring-dur) var(--spring); }
.dp-caret .icon { width: 18px; height: 18px; }
.dp-caret.up { transform: rotate(180deg); }
.dp-body { height: 300px; padding: 0 12px; overflow: hidden; }
.dp-days { touch-action: pan-y; }
.dp-weekdays, .dp-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dp-weekdays { height: 40px; align-items: center; text-align: center; font-size: 14px; font-weight: 500; }
.dp-page { display: flex; flex-direction: column; gap: 4px; }
.dp-cell { display: grid; place-items: center; height: 40px; }
/* I pulsanti ereditano l'allineamento del testo (all'inizio, `button` in alto): il numero va centrato. */
.dp-day { display: grid; place-items: center; width: 40px; height: 40px; text-align: center; border-radius: 50%; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--on-surface); position: relative; isolation: isolate; transition: background-color var(--effects-dur) var(--effects); }
.dp-day::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--effects-fast-dur) linear; }
@media (hover: hover) { .dp-day:hover:not(:disabled)::after { opacity: .08; } }
.dp-day.today { color: var(--primary); font-weight: 650; box-shadow: inset 0 0 0 1px var(--primary); }
.dp-day.selected { background: var(--primary); color: var(--on-primary); font-weight: 650; box-shadow: none; }
.dp-day:disabled { opacity: .38; }
.dp-months { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; animation: fade-through var(--spring-dur) var(--spring); }
.dp-year-row { display: flex; align-items: center; justify-content: space-between; }
.dp-year-row strong { font-size: 18px; }
.dp-month-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; padding: 0 8px; }
.dp-month { display: grid; place-items: center; height: 44px; text-align: center; border-radius: 22px; background: var(--surface-container-highest); font-size: 15px; font-weight: 500; }
.dp-month.selected { background: var(--primary); color: var(--on-primary); font-weight: 650; }
.dp-actions { display: flex; align-items: center; gap: 4px; padding: 0 12px 12px; }

.search-results { display: flex; flex-direction: column; gap: 20px; }
.page.desktop .search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); align-items: start; }
.search-suggestions .flow-chips { padding: 0 4px; }

/* MARK: - Introduzione (3.3, come nell'app)
   Alla prima apertura BCW è in bianco e nero (`data-mono` su <html>, da js/theme-boot.js) finché
   nell'introduzione non si sceglie un colore. Tocca solo i ruoli di Material 3: materie, voti e
   stati restano colorati. Superfici quasi bianche e quasi nere, mai pure. */
:root[data-mono] {
  --primary: #141414; --on-primary: #fafafa; --primary-container: #e4e4e4; --on-primary-container: #111111;
  --secondary: #333333; --on-secondary: #fafafa; --secondary-container: #e8e8e8; --on-secondary-container: #151515;
  --tertiary: #4a4a4a; --on-tertiary: #fafafa; --tertiary-container: #dadada; --on-tertiary-container: #151515;
  --error: #2a2a2a; --on-error: #fafafa; --error-container: #e4e4e4; --on-error-container: #111111;
  --surface: #fbfbfb; --surface-dim: #e6e6e6; --surface-bright: #fbfbfb;
  --surface-container-lowest: #fefefe; --surface-container-low: #f5f5f5; --surface-container: #efefef;
  --surface-container-high: #e9e9e9; --surface-container-highest: #e2e2e2;
  --on-surface: #111111; --on-surface-variant: #4a4a4a; --outline: #767676; --outline-variant: #c8c8c8;
  --inverse-surface: #1c1c1c; --inverse-on-surface: #f3f3f3; --inverse-primary: #cccccc;
  --brand: #141414; --scrim: rgb(0 0 0 / .38); --shadow-color: 0 0 0;
}
@media (prefers-color-scheme: dark) {
  :root[data-mono]:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #f2f2f2; --on-primary: #111111; --primary-container: #2e2e2e; --on-primary-container: #f5f5f5;
    --secondary: #d4d4d4; --on-secondary: #111111; --secondary-container: #2a2a2a; --on-secondary-container: #efefef;
    --tertiary: #bdbdbd; --on-tertiary: #111111; --tertiary-container: #363636; --on-tertiary-container: #efefef;
    --error: #f2f2f2; --on-error: #111111; --error-container: #2e2e2e; --on-error-container: #f5f5f5;
    --surface: #0b0b0b; --surface-dim: #0b0b0b; --surface-bright: #2c2c2c;
    --surface-container-lowest: #060606; --surface-container-low: #141414; --surface-container: #1b1b1b;
    --surface-container-high: #232323; --surface-container-highest: #2d2d2d;
    --on-surface: #f5f5f5; --on-surface-variant: #bdbdbd; --outline: #8a8a8a; --outline-variant: #444444;
    --inverse-surface: #ededed; --inverse-on-surface: #1b1b1b; --inverse-primary: #333333;
    --brand: #f2f2f2; --scrim: rgb(0 0 0 / .55); --shadow-color: 0 0 0;
  }
}
:root[data-mono][data-theme="dark"] {
  color-scheme: dark;
  --primary: #f2f2f2; --on-primary: #111111; --primary-container: #2e2e2e; --on-primary-container: #f5f5f5;
  --secondary: #d4d4d4; --on-secondary: #111111; --secondary-container: #2a2a2a; --on-secondary-container: #efefef;
  --tertiary: #bdbdbd; --on-tertiary: #111111; --tertiary-container: #363636; --on-tertiary-container: #efefef;
  --error: #f2f2f2; --on-error: #111111; --error-container: #2e2e2e; --on-error-container: #f5f5f5;
  --surface: #0b0b0b; --surface-dim: #0b0b0b; --surface-bright: #2c2c2c;
  --surface-container-lowest: #060606; --surface-container-low: #141414; --surface-container: #1b1b1b;
  --surface-container-high: #232323; --surface-container-highest: #2d2d2d;
  --on-surface: #f5f5f5; --on-surface-variant: #bdbdbd; --outline: #8a8a8a; --outline-variant: #444444;
  --inverse-surface: #ededed; --inverse-on-surface: #1b1b1b; --inverse-primary: #333333;
  --brand: #f2f2f2; --scrim: rgb(0 0 0 / .55); --shadow-color: 0 0 0;
}

/* Cerchio dei colori (`revealTheme`): la pagina nuova compare in un cerchio sopra la fotografia di
   quella di prima; con le animazioni ridotte una dissolvenza breve. */
html.theme-reveal:not(.reduced-reveal)::view-transition-old(root),
html.theme-reveal:not(.reduced-reveal)::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.reduced-reveal::view-transition-old(root),
html.reduced-reveal::view-transition-new(root) { animation-duration: .2s; }
/* Il fronte dell'onda: un anello del nuovo colore primario, in un gruppo suo sopra le due
   fotografie (le animazioni le dà `revealTheme`). */
/* Raggio e spessore animati da `revealTheme` su <html> (per l'anello) e sulla pagina nuova (per il
   cerchio): registrati, così si interpolano, e letti dallo stesso fotogramma. */
@property --reveal-r { syntax: "<length>"; inherits: true; initial-value: 0px; }
@property --reveal-w { syntax: "<length>"; inherits: true; initial-value: 0px; }
html.theme-reveal:not(.reduced-reveal)::view-transition-new(root) { clip-path: circle(var(--reveal-r) at var(--reveal-x, 50%) var(--reveal-y, 50%)); }
.reveal-ring { position: fixed; inset: 0; z-index: 1000; pointer-events: none; overflow: hidden; view-transition-name: reveal-ring; }
/* Il tratto è centrato sul bordo del cerchio: metà sopra la pagina di prima, metà sopra la nuova. */
.reveal-ring i { position: absolute; display: block; box-sizing: border-box; border: var(--reveal-w) solid var(--primary); border-radius: 50%; opacity: 0;
  left: calc(var(--reveal-x) - var(--reveal-r) - var(--reveal-w) / 2); top: calc(var(--reveal-y) - var(--reveal-r) - var(--reveal-w) / 2);
  width: calc(2 * var(--reveal-r) + var(--reveal-w)); height: calc(2 * var(--reveal-r) + var(--reveal-w)); }
html.theme-reveal::view-transition-group(reveal-ring),
html.theme-reveal::view-transition-old(reveal-ring),
html.theme-reveal::view-transition-new(reveal-ring) { animation: none; }

/* L'introduzione a tutta pagina: una colonna di 560 px al massimo. */
.onboarding { position: fixed; inset: 0; z-index: 6; display: flex; justify-content: center; background: var(--surface); overflow: hidden; }
.ob-column { width: 100%; max-width: 560px; height: 100%; display: flex; flex-direction: column; padding: var(--safe-top) 0 var(--safe-bottom); }
.ob-top { flex: none; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px; animation: fade-in var(--effects-dur) var(--effects); }
.ob-top .wavy-progress { flex: 1; margin: 0 4px; }
.ob-top-spacer { flex: none; height: 8px; }
.ob-axis { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ob-axis > .axis-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ob-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ob-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.ob-scroll::-webkit-scrollbar { display: none; }
.ob-content { display: flex; flex-direction: column; gap: 20px; padding: 14px 24px 16px; }
.ob-heading { display: flex; flex-direction: column; gap: 8px; }
.ob-heading h1 { font-size: 32px; line-height: 40px; font-weight: 500; letter-spacing: -.3px; color: var(--on-surface); }
.ob-heading p { font-size: 15px; line-height: 21px; color: var(--on-surface-variant); }
.ob-actions { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px 24px 12px; }
.ob-row { display: flex; gap: 8px; }
.ob-row > * { flex: 1; min-width: 0; }
.ob-next .ob-arrow { transform: rotate(180deg); width: 22px; height: 22px; }
.ob-center-page .ob-center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 16px 28px; text-align: center; }
.ob-big { font-size: 36px; line-height: 44px; font-weight: 500; letter-spacing: -.5px; color: var(--on-surface); }
.ob-big.done { font-size: 40px; line-height: 48px; }
.ob-center p { font-size: 16px; line-height: 24px; color: var(--on-surface-variant); }
/* Gli elementi di una pagina salgono e compaiono uno dopo l'altro. */
.ob-page .stagger, .ob-aside .stagger { animation: ob-in var(--spring-slow-dur) var(--spring) calc(50ms + var(--i, 0) * 55ms) backwards; }
@keyframes ob-in { from { opacity: 0; transform: translateY(22px) scale(.97); } }

/* La forma in cima: cambia misura con la molla, ruota piano e si trasforma nella successiva. */
.ob-hero { --size: var(--base); flex: none; position: relative; height: calc(var(--size) + 8px); margin-top: 8px; display: grid; place-items: center; transition: height var(--spring-slow-dur) var(--spring); }
.ob-hero.welcome { margin-top: 24px; }
.ob-hero-art { display: grid; place-items: center; }
.ob-hero-art > * { grid-area: 1 / 1; }
.ob-main { width: var(--size); height: var(--size); color: var(--primary-container); transition: width var(--spring-slow-dur) var(--spring), height var(--spring-slow-dur) var(--spring); }
.ob-sat { width: calc(var(--size) * var(--s)); height: calc(var(--size) * var(--s)); transform: translate(calc(var(--size) * var(--x)), calc(var(--size) * var(--y)));
  transition: transform var(--spring-slow-dur) var(--spring), width var(--spring-slow-dur) var(--spring), height var(--spring-slow-dur) var(--spring); }
.ob-sat.a { color: var(--secondary-container); }
.ob-sat.b { color: var(--tertiary-container); }
.ob-shape { width: 100%; height: 100%; display: block; fill: currentColor; overflow: visible; animation: m3-loading-turn 40s linear infinite; }
.ob-sat .ob-shape { animation-duration: 26s; animation-direction: reverse; }
@media (prefers-reduced-motion: reduce) { .ob-shape { animation: none; } }
:root[data-motion="reduced"] .ob-shape { animation: none; }
.ob-hero-center { position: relative; display: grid; place-items: center; color: var(--on-primary-container); animation: ob-center-in var(--spring-dur) var(--spring); }
.ob-hero-center .icon { width: calc(var(--size) * .4); height: calc(var(--size) * .4); }
.ob-hero-center .ob-logo { font-size: 46px; color: var(--on-primary-container); }
@keyframes ob-center-in { from { opacity: 0; transform: scale(.5); } }
.onboarding.typing .ob-hero { display: none; }
/* Pagina finale: coriandoli di forme che escono dal centro, ruotano e svaniscono. */
.ob-burst { position: relative; width: 0; height: 0; pointer-events: none; }
.ob-burst i { position: absolute; left: calc(var(--piece) / -2); top: calc(var(--piece) / -2); width: var(--piece); height: var(--piece); opacity: 0; animation: ob-burst 1.7s cubic-bezier(.2, .9, .3, 1.1) .12s; }
.ob-burst i .shape { position: absolute; inset: 0; }
@keyframes ob-burst {
  0% { opacity: 0; transform: translate(0, 0) rotate(0) scale(.2); }
  45% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--spin)) scale(1); }
  60% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--spin)) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .ob-burst { display: none; } }
:root[data-motion="reduced"] .ob-burst { display: none; }

/* Colori: ogni campione è una forma di M3 Expressive con il primario sopra, il secondario e il
   terziario sotto (come i campioni di Android). */
.ob-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 14px 6px; }
.ob-swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; cursor: pointer; transition: scale var(--spring-fast-dur) var(--spring-fast); -webkit-tap-highlight-color: transparent; }
.ob-swatch:active { scale: .9; }
.ob-swatch-art { width: 62px; height: 62px; display: grid; place-items: center; }
.ob-swatch-art > * { grid-area: 1 / 1; }
.ob-swatch-fill { width: 54px; height: 54px; transition: width var(--spring-dur) var(--spring), height var(--spring-dur) var(--spring);
  background: linear-gradient(var(--c1) 0 50%, transparent 50%), linear-gradient(90deg, var(--c2) 0 50%, var(--c3) 50%);
  -webkit-mask: var(--mask) center / contain no-repeat; mask: var(--mask) center / contain no-repeat; }
.ob-swatch-fill.rainbow { background: conic-gradient(var(--subject-0), var(--subject-3), var(--subject-6), var(--subject-1), var(--subject-9), var(--subject-5), var(--subject-2), var(--subject-4), var(--subject-0)); }
.ob-swatch.selected .ob-swatch-fill { width: 60px; height: 60px; }
.ob-swatch-check { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-container-lowest); color: var(--on-surface); animation: fab-in var(--spring-dur) var(--spring); }
.ob-swatch-check .icon { width: 20px; height: 20px; }
.ob-swatch-name { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ob-swatch.selected .ob-swatch-name { font-weight: 700; color: var(--on-surface); }
.ob-swatch input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.ob-mode { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; }
.ob-mode .icon { width: 22px; height: 22px; }

/* Una scelta tra due: card grandi con un'anteprima stilizzata, titolo e sottotitolo centrati sotto. */
.ob-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ob-choice { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: var(--r-xl); background: var(--surface-container-low); box-shadow: inset 0 0 0 2px transparent; text-align: center;
  transition: background-color var(--effects-dur) var(--effects), box-shadow var(--effects-dur) var(--effects), border-radius var(--spring-fast-dur) var(--spring-fast); }
.ob-choice:active { border-radius: var(--r-l); }
.ob-choice.selected { background: var(--secondary-container); box-shadow: inset 0 0 0 2px var(--primary); }
.ob-choice-preview { height: 124px; border-radius: var(--r-l); background: var(--surface-container-high); overflow: hidden; display: block; }
.ob-choice-text { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.ob-choice-text strong { font-size: 15px; font-weight: 650; color: var(--on-surface); }
.ob-choice-text small { font-size: 12px; color: var(--on-surface-variant); }
.ob-choice.selected .ob-choice-text strong, .ob-choice.selected .ob-choice-text small { color: var(--on-secondary-container); }
.ob-choice-check { position: absolute; top: 16px; right: 16px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-container-lowest); color: var(--primary); animation: fab-in var(--spring-dur) var(--spring); }
.ob-choice-check .icon { width: 24px; height: 24px; }
.ob-pv { display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.ob-pv i { display: block; }
.ob-pv-week, .ob-pv-month { display: grid; gap: 3px; }
.ob-pv-week { grid-template-columns: repeat(5, 1fr); }
.ob-pv-week i { height: 22px; border-radius: 5px; background: var(--surface-container-highest); }
.ob-pv-week i.on { border-radius: 11px; background: var(--primary); }
.ob-pv-month { grid-template-columns: repeat(7, 1fr); }
.ob-pv-month i { height: 16px; border-radius: 3px; background: var(--surface-container-highest); }
.ob-pv-month i.on { border-radius: 8px; background: var(--primary); }
.ob-pv-title { width: 44px; height: 7px; border-radius: 3px; background: color-mix(in srgb, var(--on-surface-variant) 35%, transparent); }
.ob-pv-row { height: 16px; border-radius: 6px; background: var(--surface-container-highest); }
.ob-pv-row.accent { background: var(--primary-container); }

/* Accesso, account e orario. */
.ob-form { gap: 10px; }
.ob-note { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.ob-server { justify-content: flex-start; font-size: 12px; }
.ob-error { margin: 0; }
.ob-summary { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-xl); background: var(--surface-container-low); }
.ob-summary strong { display: block; font-size: 18px; font-weight: 600; }
.ob-summary small { display: block; font-size: 14px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-summary-art { width: 52px; height: 52px; color: var(--on-secondary-container); --shape-fill: var(--secondary-container); }
/* La settimana dell'anteprima: una colonna per giorno, le lezioni come pillole con l'onda di luce. */
.ob-glance { display: flex; gap: 4px; padding: 10px; border-radius: var(--r-xl); background: var(--surface-container-low); }
.ob-glance-day { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.ob-glance-day > small { font-size: 12px; font-weight: 650; color: var(--on-surface-variant); text-align: center; }
.ob-glance-col { position: relative; }
.ob-glance-block { position: absolute; display: grid; place-items: center; overflow: hidden; padding: 0 3px; border-radius: var(--r-m); background: color-mix(in srgb, var(--tint) 34%, var(--surface));
  animation: ob-in var(--spring-slow-dur) var(--spring) calc(50ms + var(--i, 0) * 55ms) backwards; }
.ob-glance-name { position: relative; z-index: 2; font-size: 10.5px; line-height: 13px; font-weight: 650; color: var(--on-surface); text-align: center; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (min-width: 600px) {
  .ob-content { padding-left: 32px; padding-right: 32px; }
  .ob-actions { padding-left: 32px; padding-right: 32px; padding-bottom: 24px; }
}

/* Schermi larghi (da 840 px), come la shell dell'app: la barra in alto sullo sfondo e un pannello
   con angoli ampi in due colonne. A sinistra titolo e spiegazione con sotto la forma, che riempie
   lo spazio rimasto; a destra il contenuto che scorre e le azioni in fondo a destra (la principale
   per ultima). Accoglienza e fine: la forma, più grande, al centro della colonna a sinistra e a
   destra titolo, testo e pulsanti. Celle e controlli restano come nell'app (pannello `surface`). */
.onboarding.wide { background: var(--surface-container); }
.ob-frame { width: 100%; max-width: 1240px; height: 100%; display: flex; flex-direction: column; justify-content: center; padding: var(--safe-top) 24px calc(24px + var(--safe-bottom)); }
.onboarding.wide .ob-top { height: 64px; padding: 0 4px; gap: 12px; }
.onboarding.wide .ob-top .btn { --h: 40px; padding: 0 16px; font-size: 14px; }
.onboarding.wide .ob-top-spacer { height: 64px; }
.ob-panel { flex: 1; min-height: 0; max-height: 820px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: minmax(0, 1fr); gap: 56px;
  padding: 40px 48px 32px; border-radius: var(--r-xli); background: var(--surface); }
.ob-aside { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.ob-aside-axis { flex: none; display: flex; flex-direction: column; }
.ob-aside .ob-heading { gap: 12px; padding-bottom: 16px; }
.ob-aside .ob-heading h1 { font-size: 40px; line-height: 48px; letter-spacing: -.4px; font-variation-settings: "ROND" var(--rond); }
.ob-aside .ob-heading p { font-size: 16px; line-height: 24px; }
.onboarding.wide .ob-hero { --size: min(var(--wide), 21vw, 33vh); flex: 1; min-height: 0; height: auto; margin: 0; transition: none; }
.onboarding.wide .ob-hero-center .ob-logo { font-size: calc(var(--size) * .235); }
@media (min-width: 1600px) and (min-height: 960px) { .onboarding.wide .ob-hero { --size: min(calc(var(--wide) * 1.25), 21vw, 33vh); } }
.onboarding.wide .ob-axis { min-width: 0; }
.onboarding.wide .ob-content { gap: 24px; padding: 4px 8px 24px; }
.onboarding.wide .ob-scroll { margin: 0 -8px; }
.onboarding.wide .ob-actions { flex-direction: row-reverse; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 16px 0 0; }
.onboarding.wide .ob-row { display: contents; }
.onboarding.wide .ob-actions .btn { width: auto; flex: none; --h: 56px; --pressed: 12px; padding: 0 24px; font-size: 16px; line-height: 24px; }
.onboarding.wide .ob-actions .btn.filled { min-width: 176px; }
.onboarding.wide .ob-center-page { justify-content: center; gap: 36px; }
.onboarding.wide .ob-center-page .ob-center { flex: none; gap: 16px; padding: 0; text-align: left; }
.onboarding.wide .ob-big, .onboarding.wide .ob-big.done { font-size: 52px; line-height: 60px; letter-spacing: -.8px; font-variation-settings: "ROND" var(--rond); }
.onboarding.wide .ob-center p { max-width: 480px; font-size: 18px; line-height: 28px; }
.onboarding.wide .ob-center-page .ob-actions { flex-direction: row; justify-content: flex-start; padding: 0; }
.onboarding.wide .ob-swatches { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 20px 8px; }
.onboarding.wide .ob-swatch-art { width: 76px; height: 76px; }
.onboarding.wide .ob-swatch-fill { width: 66px; height: 66px; }
.onboarding.wide .ob-swatch.selected .ob-swatch-fill { width: 74px; height: 74px; }
.onboarding.wide .ob-swatch-name { font-size: 13px; }
.onboarding.wide .ob-choices { gap: 16px; }
.onboarding.wide .ob-choice { padding: 12px; }
.onboarding.wide .ob-choice-preview { height: 168px; }
.onboarding.wide .ob-pv { gap: 8px; padding: 14px; }
.onboarding.wide .ob-pv-week i { height: 30px; }
.onboarding.wide .ob-pv-month i { height: 22px; }
.onboarding.wide .ob-pv-row { height: 20px; }
