/* Social Farm Studio · «Plancia di regia».
   System font, tabular figures, scale 12/14/16/20/28. Neutrals from the theme (Telegram's when inside the Mini App)
   plus one accent; status colours only for state and always with a shape and a word; page colours only as identity. */

/* ---------- tokens ---------- */
:root {
  --font: system-ui, -apple-system, "SF Pro Text", "SF Pro", Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --t12: .75rem; --t14: .875rem; --t16: 1rem; --t20: 1.25rem; --t28: 1.75rem;
  --r: 12px; --r-sm: 8px;
  --nav-h: 60px;
  --top-h: 52px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);   /* counts and chart draw-in (motion.js: 650 / 700 ms) */

  /* own palette, light */
  --own-ground: #f2f3f5; --own-surface: #ffffff; --own-raised: #f6f7f9;
  --own-line: #e2e5ea; --own-line-strong: #c4c9d1;
  --own-text: #14171c; --own-muted: #535a66;
  --own-accent: #1c5dc2; --own-accent-ink: #ffffff;
  --ok: #1d7a3b; --warn: #915400; --bad: #c22a2a; --on-state: #ffffff;
  --pc: var(--pcl, #5d6470);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --own-ground: #0e1013; --own-surface: #16191e; --own-raised: #1d2128;
    --own-line: #272c34; --own-line-strong: #3b414c;
    --own-text: #e8eaee; --own-muted: #a3aab5;
    --own-accent: #7aaaff; --own-accent-ink: #0a1222;
    --ok: #4cc472; --warn: #f2b33a; --bad: #ff7070; --on-state: #0e1013;
    --pc: var(--pcd, #9aa1ad);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --own-ground: #0e1013; --own-surface: #16191e; --own-raised: #1d2128;
  --own-line: #272c34; --own-line-strong: #3b414c;
  --own-text: #e8eaee; --own-muted: #a3aab5;
  --own-accent: #7aaaff; --own-accent-ink: #0a1222;
  --ok: #4cc472; --warn: #f2b33a; --bad: #ff7070; --on-state: #0e1013;
  --pc: var(--pcd, #9aa1ad);
  color-scheme: dark;
}
:root {
  --ground: var(--own-ground); --surface: var(--own-surface); --raised: var(--own-raised);
  --line: var(--own-line); --line-strong: var(--own-line-strong);
  --text: var(--own-text); --muted: var(--own-muted);
  --accent: var(--own-accent); --accent-ink: var(--own-accent-ink); --link: var(--own-accent);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
/* Inside Telegram: the neutrals and the accent come from themeParams (kept up to date by telegram-web-app.js on
   themeChanged). Muted text is derived from text and surface, never from hint_color, to keep 4.5:1. */
:root[data-tg] {
  --ground: var(--tg-theme-secondary-bg-color, var(--own-ground));
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--own-surface)));
  --text: var(--tg-theme-text-color, var(--own-text));
  --accent: var(--tg-theme-button-color, var(--own-accent));
  --accent-ink: var(--tg-theme-button-text-color, var(--own-accent-ink));
  --safe-t: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-b: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --safe-l: var(--tg-safe-area-inset-left, 0px); --safe-r: var(--tg-safe-area-inset-right, 0px);
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface));
    --ok-soft: color-mix(in srgb, var(--ok) 11%, var(--surface));
    --warn-soft: color-mix(in srgb, var(--warn) 13%, var(--surface));
    --bad-soft: color-mix(in srgb, var(--bad) 11%, var(--surface));
  }
  :root[data-tg] {
    --raised: color-mix(in srgb, var(--text) 4%, var(--surface));
    --line: var(--tg-theme-section-separator-color, color-mix(in srgb, var(--text) 12%, var(--surface)));
    --line-strong: color-mix(in srgb, var(--text) 26%, var(--surface));
    --muted: color-mix(in srgb, var(--text) 68%, var(--surface));
    --link: color-mix(in oklab, var(--tg-theme-link-color, var(--own-accent)) 82%, var(--text));
  }
}
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root { --accent-soft: var(--raised); --ok-soft: var(--raised); --warn-soft: var(--raised); --bad-soft: var(--raised); }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--ground); scrollbar-color: var(--line-strong) transparent; }
body {
  margin: 0; min-height: 100dvh; background: var(--ground); color: var(--text);
  font: 400 var(--t16)/1.45 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
html.sheet-open, html.sheet-open body { overflow: hidden; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--link); text-underline-offset: .2em; }
abbr { text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.salta { position: fixed; left: 12px; top: -60px; z-index: 50; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); }
.salta:focus { top: calc(var(--safe-t) + 8px); }
.cifra { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.ic { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -.25em; }
.ic.spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.app { min-height: 100dvh; }
.colonna { min-width: 0; }
.testata {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  min-height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l));
  background: var(--ground); border-bottom: 1px solid var(--line);
}
.testata h1 { font-size: var(--t20); font-weight: 650; line-height: 1.2; margin-right: auto; }
.mini-marchio { border-radius: 6px; }
.eta {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px;
  border-radius: 999px; font-size: var(--t12); color: var(--muted); border: 1px solid var(--line);
  background: var(--surface); white-space: nowrap;
}
.eta .ic { width: 14px; height: 14px; color: var(--ok); }
.eta.warn { color: var(--text); border-color: var(--warn); }
.eta.warn .ic { color: var(--warn); }
.eta.bad { color: var(--text); border-color: var(--bad); }
.eta.bad .ic { color: var(--bad); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; color: var(--muted); }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn .ic { width: 22px; height: 22px; }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 12px calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l)); padding: 12px 14px;
  background: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--r); font-size: var(--t14);
}
.banner span { flex: 1 1 220px; }
main { padding: 16px calc(16px + var(--safe-r)) calc(var(--nav-h) + var(--safe-b) + 32px) calc(16px + var(--safe-l)); outline: none; }
body.vecchi .tabellone, body.vecchi .area-stato, body.vecchi .sett { filter: grayscale(1); }

/* bottom tab bar (phone) */
.nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav .marchio { display: none; }
.nav ul { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--nav-h); }
.nav button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 100%; height: 100%; color: var(--muted); font-size: var(--t12); font-weight: 500;
}
.nav button .ic { width: 24px; height: 24px; padding: 0; transition: color .15s; }
.nav button[aria-current="page"] { color: var(--text); font-weight: 650; }
.nav button[aria-current="page"] .ic { color: var(--accent); }
.nav button[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font-size: 11px; line-height: 18px; font-weight: 700; text-align: center;
  background: var(--text); color: var(--surface);
}
.badge.urg { background: var(--bad); color: var(--on-state); }

/* desktop: side bar */
@media (min-width: 1024px) {
  :root { --top-h: 60px; }
  .app { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .nav {
    position: sticky; top: 0; height: 100dvh; padding: 20px 12px; border-top: 0; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 24px;
  }
  .nav .marchio { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
  .nav .marchio img { border-radius: 7px; }
  .nav .marchio b { display: block; font-size: var(--t14); }
  .nav .marchio span span { display: block; font-size: var(--t12); color: var(--muted); }
  .nav ul { display: flex; flex-direction: column; gap: 2px; height: auto; }
  .nav button { flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 12px; border-radius: 10px; font-size: var(--t14); }
  .nav button:hover { background: var(--raised); color: var(--text); }
  .nav button[aria-current="page"] { background: var(--accent-soft); }
  .nav button[aria-current="page"]::before { display: none; }
  .badge { position: static; margin-left: auto; }
  .mini-marchio { display: none; }
  .testata { padding: 0 32px; border-bottom: 0; }
  .testata h1 { font-size: var(--t28); }
  .banner { margin: 0 32px 8px; }
  main { padding: 4px 32px 24px; max-width: 1320px; }
}

/* ---------- shared blocks ---------- */
.blocco { margin-top: 32px; }
.blocco > h2, .h2row h2 { font-size: var(--t20); font-weight: 650; line-height: 1.25; margin-bottom: 12px; display: flex; align-items: baseline; gap: 8px; }
.h2row { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.h2row h2 { margin-bottom: 0; }
.h3 { font-size: var(--t16); font-weight: 650; margin: 24px 0 8px; }
h2 .n { font-size: var(--t14); font-weight: 600; color: var(--muted); }
.nota { font-size: var(--t12); color: var(--muted); }
.nota.fonte { margin-top: 12px; }
.notice { padding: 12px 14px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--line); font-size: var(--t14); margin-bottom: 16px; }
.empty, .empty-row, .nodata { color: var(--muted); font-size: var(--t14); }
.empty { padding: 20px 4px; display: grid; gap: 12px; justify-items: start; }
.empty-row { padding: 14px 16px; }
.pg { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pc); flex: none; }
.can { display: inline-flex; align-items: center; gap: 4px; }
.can .ic { width: 14px; height: 14px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: var(--t12); color: var(--muted); border: 1px solid var(--line-strong); white-space: nowrap; }
.neg { color: var(--bad); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: var(--t14); font-weight: 600; text-decoration: none; transition: background .15s;
}
.btn:hover { background: var(--raised); }
.btn .ic { width: 18px; height: 18px; }
.btn.small { min-height: 36px; padding: 0 12px; }
.btn.piena { width: 100%; margin-top: 12px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.hbar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--muted); }
.dl { display: inline-flex; align-items: center; gap: 2px; font-size: var(--t12); font-weight: 600; white-space: nowrap; }
.dl .ic { width: 13px; height: 13px; }
.dl.pos { color: var(--ok); }
.dl.neg { color: var(--bad); }
.dl.flat, .dl.na { color: var(--muted); }

/* skeletons: the real shape, no shimmer */
.sk { display: block; height: 14px; border-radius: 6px; background: var(--line); margin: 8px 0; }
.sk.row { height: 44px; }
.sk.big { height: 24px; }
.sk.chart { height: 140px; border-radius: var(--r); margin: 0; }
.w30 { width: 30%; } .w40 { width: 40%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; } .w90 { width: 90%; }
@media (prefers-reduced-motion: no-preference) {
  .sk { animation: breathe 1.6s ease-in-out infinite alternate; }
  @keyframes breathe { from { opacity: 1; } to { opacity: .55; } }
}

/* ---------- OGGI ---------- */
.oggi { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "stato" "settimana" "problemi" "tabellone" "lavoro" "crediti"; }
.area-stato { grid-area: stato; } .area-settimana { grid-area: settimana; } .area-problemi { grid-area: problemi; } .area-tabellone { grid-area: tabellone; }
.area-lavoro { grid-area: lavoro; } .area-crediti { grid-area: crediti; }

.stato { display: grid; gap: 8px; padding: 4px 0 0; }
.frase { display: flex; align-items: flex-start; gap: 10px; font-size: var(--t20); font-weight: 650; line-height: 1.3; }
.frase .lv { display: inline-flex; padding-top: 2px; }
.frase .lv .ic { width: 24px; height: 24px; }
.lv-ok .frase .lv { color: var(--ok); }
.lv-attenzione .frase .lv { color: var(--warn); }
.lv-problema .frase .lv { color: var(--bad); }
.prossimo { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding-left: 34px; }
.prossimo .lbl { font-size: var(--t14); color: var(--muted); }
.prossimo b { font-size: var(--t28); font-weight: 700; line-height: 1.1; }
.prossimo #countdown { font-size: var(--t16); }
.salute { display: flex; gap: 6px; align-items: flex-start; padding-left: 34px; font-size: var(--t14); color: var(--muted); }
.salute.off { color: var(--bad); font-weight: 600; }
.salute .ic { width: 16px; height: 16px; margin-top: 2px; }

/* La settimana: three numbers against the week before and the views gained each day. The whole block opens Numeri. */
.oggi .area-settimana { margin-top: 24px; cursor: pointer; }
.area-settimana .h2row { margin-bottom: 8px; flex-wrap: nowrap; align-items: center; }
.area-settimana h2 { flex-wrap: wrap; row-gap: 0; }
.area-settimana h2 .n { font-size: var(--t12); font-weight: 500; }
.vai {
  display: inline-flex; flex-direction: row-reverse; align-items: center; gap: 2px; flex: none;
  min-height: 44px; margin: -10px -8px -10px 0; padding: 0 6px 0 10px; border-radius: 10px;
  font-size: var(--t14); font-weight: 600; color: var(--link); transition: background .15s;
}
.vai .ic { width: 18px; height: 18px; }
.vai:hover { background: var(--raised); }
.sett { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 10px; transition: border-color .15s; }
.area-settimana:hover .sett { border-color: var(--line-strong); }
.kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi > div { min-width: 0; display: grid; gap: 2px; align-content: start; padding: 0 10px; }
.kpi > div:first-child { padding-left: 0; }
.kpi > div:last-child { padding-right: 0; }
.kpi > div + div { border-left: 1px solid var(--line); }
.kpi dt { font-size: var(--t12); font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi dd { display: grid; gap: 4px; justify-items: start; }
.kpi .v { display: inline-block; font-size: var(--t28); font-weight: 700; line-height: 1.1; white-space: nowrap; }
.wk-fig { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.wk-fig figcaption { font-size: var(--t12); font-weight: 600; color: var(--muted); margin-bottom: 20px; }
.wk-fig .nodata { padding: 8px 0 4px; }
.plot.wk { height: 88px; cursor: crosshair; }
.plot.wk .ymax { left: 0; right: auto; }
.plot .area { fill: var(--accent); fill-opacity: .14; stroke: none; }
.plot.wk .line { stroke: var(--accent); }
.plot.wk .pt { background: var(--accent); }
.pt.fine { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 2px solid var(--surface); pointer-events: none; }
.fine-v { position: absolute; right: 2px; transform: translateY(calc(-100% - 8px)); font-size: var(--t14); font-weight: 700; line-height: 1; color: var(--text); pointer-events: none; transition: opacity .15s; }
.fine-v.sotto { transform: translateY(10px); }
.plot.wk.on .fine-v { opacity: 0; }
@media (max-width: 419px) { .kpi .v.lungo { font-size: var(--t20); line-height: 1.4; } }
.tip.wk-tip {
  top: -10px; min-width: 228px; padding: 8px 10px; white-space: normal; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  box-shadow: 0 6px 20px rgb(0 0 0 / .22); font-weight: 500;
}
.wk-tip .t { display: flex; justify-content: space-between; gap: 12px; font-weight: 650; }
.wk-tip ul { display: grid; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.wk-tip li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.wk-tip li span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-tip li b { font-weight: 650; }
/* the pages under the chart: two by two (name and views on one line) where four would cut the names, one row of
   four (name over views) where the block is wide enough */
.sett { container-type: inline-size; }
.wk-pagine { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; margin: 8px -6px 0; padding-top: 4px; border-top: 1px solid var(--line); }
.wk-pagine button { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; min-width: 0; min-height: 44px; padding: 6px; border-radius: var(--r-sm); text-align: left; transition: background .15s; }
.wk-pagine button:hover { background: var(--raised); }
.wk-pagine .pg { gap: 6px; font-size: var(--t14); font-weight: 500; color: var(--muted); }
.wk-pagine .pg span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-pagine b { font-size: var(--t16); font-weight: 650; line-height: 1.2; }
@container (min-width: 380px) {
  .wk-pagine { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); column-gap: 0; }
  .wk-pagine button { flex-direction: column; justify-content: center; align-items: flex-start; gap: 1px; min-height: 48px; }
  .wk-pagine .pg { gap: 5px; font-size: var(--t12); font-weight: 600; }
}
.sett.vecchio .kpi, .sett.vecchio .wk-fig, .sett.vecchio .wk-pagine { filter: grayscale(1); }
.sett.vecchio .v { color: var(--muted); }
.sett-eta { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 10px; font-size: var(--t12); }
.sett-eta .ic { width: 15px; height: 15px; color: var(--warn); }
.sett.vuota p { display: grid; gap: 2px; padding: 2px 0 4px; }
.sett.vuota .d { font-size: var(--t14); color: var(--muted); }
.sk-sett .kpi > div { gap: 0; }
.sk-sett .sk { animation: none; margin: 4px 0; }
.sk-sett .sk.big { height: 30px; }
.sk-sett > .sk.w60 { margin-top: 18px; width: 50%; }
.sk-sett .sk.graf { height: 88px; margin: 20px 0 22px; border-radius: var(--r-sm); }

/* open problems */
.problemi { display: grid; gap: 8px; }
.prob {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 20px; align-items: start; gap: 4px 10px; width: 100%;
  padding: 12px 12px 12px 8px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  transition: background .15s;
}
.prob:hover { background: var(--raised); }
.prob.sev-urgente { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.sev { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 650; line-height: 1.2; }
.sev .ic { width: 22px; height: 22px; }
.sev-urgente .sev { color: var(--bad); }
.sev-avviso .sev { color: var(--warn); }
.sev-info .sev { color: var(--muted); }
.sev .w { color: var(--text); font-weight: 600; }
.corpo { display: grid; gap: 3px; min-width: 0; }
.corpo .t { font-size: var(--t16); font-weight: 650; line-height: 1.3; }
.corpo .d { font-size: var(--t14); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: var(--t12); color: var(--muted); margin-top: 2px; }
.meta .pg { color: var(--text); font-weight: 500; }
.volte { font-weight: 600; color: var(--text); }
.preso { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-weight: 600; }
.preso .ic { width: 14px; height: 14px; color: var(--accent); }
.libero { font-style: normal; }
.chev { color: var(--muted); align-self: center; }
.chev .ic { width: 18px; height: 18px; }
.tranquillo { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.tranquillo .lv { color: var(--ok); }
.tranquillo .lv .ic { width: 22px; height: 22px; }
.tranquillo b { display: block; }
.tranquillo .d { display: block; font-size: var(--t14); color: var(--muted); }

/* the departures board */
.sk-slot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
.tabellone { display: grid; gap: 16px; }
.slot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 4px 4px; scroll-margin-top: calc(var(--top-h) + var(--safe-t) + 12px); transition: background .4s var(--ease); }
.slot.fase-in_corso { border: 2px solid var(--accent); padding: 3px; }
.slot.cercato { background: var(--accent-soft); }
.slot > header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 10px 10px 8px; }
.slot h3 { font-size: var(--t20); font-weight: 700; line-height: 1.1; }
.fase { font-size: var(--t12); font-weight: 650; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.fase-in_corso .fase { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.conto { margin-left: auto; font-size: var(--t14); color: var(--muted); }
.conto .neg { font-weight: 650; }
.board { width: 100%; border-collapse: collapse; table-layout: fixed; }
.board col.c-pg { width: 34%; }
.board thead th { padding: 0 6px 6px; font-size: var(--t12); font-weight: 600; color: var(--muted); text-align: left; }
.ph { display: inline-flex; align-items: center; gap: 4px; }
.ph .ic { width: 15px; height: 15px; }
.board tbody { border-top: 1px solid var(--line); }
.board th[scope="row"] { padding: 6px 6px 6px 10px; text-align: left; font-size: var(--t14); font-weight: 600; line-height: 1.25; vertical-align: middle; }
.board th[scope="row"] .pg { align-items: baseline; }
.board th[scope="row"] .dot { transform: translateY(-1px); }
.board .vt { display: none; }
.board td { padding: 3px 2px; vertical-align: middle; }
.cell {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ic s" "w w"; align-items: center; gap: 1px 4px;
  width: 100%; min-height: 44px; padding: 5px 6px; border-radius: var(--r-sm);
  font-size: var(--t12); line-height: 1.25; text-align: left; transition: background .15s;
}
.cell > .ic { grid-area: ic; width: 15px; height: 15px; }
button.cell:hover { background: var(--raised); }
.cell .w { grid-area: w; font-weight: 650; white-space: nowrap; color: var(--text); }
.cell .lungo { display: none; }
.cell .s { grid-area: s; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-pubblicato .ic { color: var(--ok); }
.st-in_invio .ic { color: var(--warn); }
.cell.st-fallito { background: var(--bad-soft); }
.st-fallito .ic { color: var(--bad); }
.st-fallito .w { color: var(--bad); }
.st-in_attesa .w { color: var(--muted); font-weight: 500; }
.cell.none { place-items: center start; padding-left: 12px; color: var(--muted); }
td.flash .cell { animation: flash .6s var(--ease); }
@keyframes flash { from { background: var(--accent-soft); } }
.motivo td { padding: 0 8px 10px 10px; }
.motivo p { display: flex; gap: 6px; align-items: flex-start; font-size: var(--t14); line-height: 1.35; color: var(--text); }
.motivo p + p { margin-top: 4px; }
.motivo .ic { width: 16px; height: 16px; margin-top: 2px; color: var(--bad); }
.motivo b { color: var(--bad); }
@media (min-width: 560px) {
  .board col.c-pg { width: 31%; }
  .cell { grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "ic w s"; column-gap: 6px; }
  .cell .s { padding-left: 4px; }
  .cell .lungo { display: inline; }
  .cell .corto { display: none; }
  .board .vt { display: block; margin-top: 2px; font-size: var(--t12); font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* in progress and credits */
.lavorazione { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.job { padding: 12px 14px; display: grid; gap: 4px; }
.job + .job { border-top: 1px solid var(--line); }
.job .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--t14); }
.job .pc { font-weight: 650; }
.job .t { font-weight: 600; }
.job .d { font-size: var(--t14); color: var(--muted); }
.job .bar { margin-top: 4px; }
.crediti {
  display: grid; grid-template-columns: minmax(0, 1fr) 20px; width: 100%; padding: 4px 4px 4px 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: background .15s;
}
.crediti:hover { background: var(--raised); }
.crediti .chev { grid-column: 2; grid-row: 1 / span 3; }
.cr { grid-column: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; padding: 10px 14px; }
.cr + .cr { border-top: 1px solid var(--line); }
.cr .lbl { font-size: var(--t14); font-weight: 600; }
.cr b { font-size: var(--t16); font-weight: 650; text-align: right; }
.cr .d { grid-column: 1 / -1; font-size: var(--t12); color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cr .d .ic { width: 14px; height: 14px; }
.cr.lv-urgente .d .ic { color: var(--bad); }
.cr.lv-avviso .d .ic { color: var(--warn); }
.cr .w { color: var(--text); font-weight: 600; }

@media (min-width: 1024px) {
  .oggi {
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); column-gap: 32px; align-items: start;
    grid-template-areas: "stato settimana" "tabellone settimana" "tabellone problemi" "tabellone lavoro" "tabellone crediti";
    grid-template-rows: auto auto auto auto 1fr;
  }
  /* The week sits at the top of the right column: the left one (status + the 3 × 4 board) is fixed and already fills
     the screen; the right one grows with the problems anyway. */
  .oggi .area-settimana { margin-top: 4px; }
  .oggi .area-problemi { margin-top: 20px; }
  .sett { padding: 12px 14px 8px; }
  .wk-fig { margin-top: 10px; padding-top: 10px; }
  .wk-fig figcaption { margin-bottom: 18px; }
  .plot.wk, .sk-sett .sk.graf { height: 64px; }
  .oggi .area-tabellone { margin-top: 24px; }
  .oggi .area-lavoro, .oggi .area-crediti { margin-top: 24px; }
  .area-tabellone > h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .oggi .area-tabellone { margin-top: 16px; }
  .oggi .area-lavoro, .oggi .area-crediti { margin-top: 16px; }
  .tabellone { gap: 10px; }
  .slot > header { padding: 6px 10px 2px; }
  .slot h3 { font-size: var(--t16); }
  .board .vt { display: none !important; }
  .board th[scope="row"] { padding-top: 2px; padding-bottom: 2px; }
  .board td { padding: 1px 2px; }
  .cell { min-height: 36px; padding: 3px 6px; }
  .board thead th { padding-bottom: 2px; }
  .stato { grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 4px 24px; }
  .frase { grid-column: 1 / -1; }
  .salute { padding-left: 0; }
  .prob { padding: 10px 10px 10px 6px; }
  .prob .corpo .d { -webkit-line-clamp: 1; }
  .job { padding: 9px 14px; }
  .crediti { grid-template-columns: repeat(3, minmax(0, 1fr)) 20px; }
  .crediti .chev { grid-column: 4; grid-row: 1; }
  .cr { grid-column: auto; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 2px; padding: 10px 12px; }
  .cr + .cr { border-top: 0; border-left: 1px solid var(--line); }
  .cr .lbl { font-size: var(--t12); color: var(--muted); font-weight: 600; }
  .cr b { text-align: left; font-size: var(--t20); }
  .job { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 8px 14px; }
  .job .r1 { display: contents; }
  .job .r1 .pg { grid-column: 1; grid-row: 1; font-size: var(--t14); }
  .job .pc { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: var(--t16); }
  .job .t { grid-column: 1; grid-row: 2; font-size: var(--t14); }
  .job .d { grid-column: 1; grid-row: 3; font-size: var(--t12); }
  .job .bar { grid-column: 1 / -1; grid-row: 4; }
  .sev { font-size: 11px; }
  .prob { grid-template-columns: 48px minmax(0, 1fr) 18px; }
  .blocco > h2 { margin-bottom: 8px; }
}

/* ---------- NUMERI ---------- */
.barra-periodo {
  position: sticky; z-index: 10; top: calc(var(--top-h) + var(--safe-t)); margin: -16px calc(-16px - var(--safe-r)) 0 calc(-16px - var(--safe-l));
  padding: 8px calc(16px + var(--safe-r)) 2px calc(16px + var(--safe-l)); background: var(--ground); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
}
@media (min-width: 1024px) { .barra-periodo { margin: -8px -32px 0; padding: 10px 32px; flex-wrap: nowrap; } }
.periodo-nota { margin-top: 10px; }

/* the pages: «Tutte» + one chip per page. Chosen = filled with the text colour, a tick and bolder type (never only a
   hue); the row scrolls sideways on a phone, the page never does. */
.chips {
  display: flex; gap: 6px; flex: 1 1 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain;
  margin: 0 calc(-16px - var(--safe-r)) 0 calc(-16px - var(--safe-l)); padding: 0 calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l));
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips button {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; margin: 4px 0;
  padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: var(--t14); font-weight: 500; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.chips button::before { content: ""; position: absolute; inset: -4px 0; }   /* 44 px to the finger */
.chips button:hover { border-color: var(--muted); }
.chips button .ic { display: none; width: 15px; height: 15px; margin-left: -4px; }
.chips button[aria-checked="true"] { background: var(--text); border-color: var(--text); color: var(--surface); font-weight: 650; }
.chips button[aria-checked="true"] .ic { display: inline-block; }
.chips button[aria-checked="true"] .dot { box-shadow: 0 0 0 2px var(--surface); }
.chips button:focus-visible { outline-offset: 3px; }
.chips .lungo { display: none; }
@media (min-width: 720px) { .chips .lungo { display: inline; } .chips .corto { display: none; } }
@media (min-width: 1024px) { .chips { flex: 1 1 auto; margin: 0; padding: 0; } }
.segmenti { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); }
.segmenti button { min-height: 38px; padding: 0 16px; border-radius: 9px; font-size: var(--t14); font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.segmenti button:hover { color: var(--text); }
.segmenti button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 0 0 1px var(--line-strong); }
.segmenti.small button { min-height: 36px; padding: 0 12px; }

.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
table.pagine { width: 100%; border-collapse: collapse; }
.pagine th, .pagine td { padding: 10px 10px; text-align: left; vertical-align: top; }
.pagine thead th { font-size: var(--t12); font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.pagine .num { text-align: right; }
.pagine td b, .pagine tfoot b { display: block; font-size: var(--t16); font-weight: 650; }
.pagine .dl { justify-content: flex-end; }
.pagine tbody tr { border-top: 1px solid var(--line); cursor: pointer; transition: background .15s; }
.pagine tbody tr:first-child { border-top: 0; }
.pagine tbody tr:hover { background: var(--raised); }
.pagine th[scope="row"] { font-size: var(--t14); font-weight: 650; }
.sub { display: block; font-size: var(--t12); font-weight: 400; color: var(--muted); margin-top: 2px; }
.pagine tfoot tr { border-top: 1px solid var(--line-strong); background: var(--raised); }
.pagine .wide { display: none; }
@media (min-width: 720px) { .pagine .wide { display: table-cell; } .pagine th, .pagine td { padding: 12px 16px; } }
.blocco > .nota { margin-top: 8px; }
.tbl-wrap + .nota { margin-top: 8px; }

.mults { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1024px) { .mults { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.mult { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; min-width: 0; }
.mult figcaption { display: grid; gap: 2px; margin-bottom: 10px; font-size: var(--t14); font-weight: 600; }
.mult figcaption .pg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; }
.mult figcaption b { font-size: var(--t20); font-weight: 700; }
.mult figcaption .dl-inline { font-size: var(--t12); color: var(--muted); font-weight: 600; }
.plot { position: relative; height: 76px; touch-action: pan-y; cursor: crosshair; }
.plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot .segni { position: absolute; inset: 0; }
.plot .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.plot .base { stroke: var(--line-strong); stroke-width: 1; }
.plot .line { fill: none; stroke: var(--pc); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .bars rect { fill: var(--pc); }
.plot .cross { stroke: var(--muted); stroke-width: 1; opacity: 0; }
.plot.on .cross { opacity: 1; }
.ymax { position: absolute; top: -2px; right: 0; transform: translateY(-100%); font-size: 11px; color: var(--muted); }
.pt { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--pc); border: 2px solid var(--surface); pointer-events: none; }
.tip {
  position: absolute; top: -8px; transform: translate(-50%, -100%); z-index: 2; pointer-events: none; white-space: nowrap;
  padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--surface); font-size: var(--t12); font-weight: 600;
}
.xax { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }
.nodata { padding: 24px 0; }

.canali { display: grid; gap: 12px; }
@media (min-width: 720px) { .canali { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.canale { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.ch { display: flex; align-items: center; gap: 8px; font-size: var(--t14); font-weight: 650; }
.ch .ic { width: 18px; height: 18px; }
.canale .v { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 10px; }
.canale .v b { font-size: var(--t28); font-weight: 700; line-height: 1.1; }
.mini { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: var(--t14); }
.mini dt { color: var(--muted); }
.mini dd { text-align: right; font-weight: 600; }
@media (max-width: 719px) { .mini { grid-template-columns: repeat(2, 1fr auto); } }

.cfs { display: grid; gap: 12px; }
@media (min-width: 1024px) { .cfs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cf { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px 6px; }
.cf .h3 { margin: 14px 0 4px; }
.cft { width: 100%; border-collapse: collapse; font-size: var(--t14); }
.cft thead th { font-size: var(--t12); font-weight: 600; color: var(--muted); text-align: left; padding: 6px 0; }
.cft th[scope="row"] { text-align: left; font-weight: 600; padding: 8px 8px 8px 0; }
.cft td { padding: 8px 0 8px 8px; }
.cft .num { text-align: right; }
.cft tbody tr { border-top: 1px solid var(--line); }
.cft td b { font-weight: 650; }
.cf .nodata { padding: 4px 0 14px; }

/* the page's card: a thin rule of its colour under the name, then the same panels as the rest of the Studio */
.pannello { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }
p.nodata.pannello { padding: 14px; }
.sch-testa { padding: 20px 0 12px; margin-bottom: 16px; border-bottom: 2px solid var(--pc); }
.sch-testa h2 { font-size: var(--t28); font-weight: 700; line-height: 1.15; gap: 10px; }
.sch-testa h2 .dot { width: 12px; height: 12px; }
.sch-testa .sub { font-size: var(--t14); margin-top: 6px; }
.scheda > .notice { margin-bottom: 16px; }
.scheda .h2 { font-size: var(--t20); font-weight: 650; line-height: 1.25; margin-bottom: 12px; }
.scheda .h2row .h2 { margin-bottom: 0; }
.h4 { font-size: var(--t14); font-weight: 650; margin: 0 0 8px; }
.sch-numeri > .nota { margin-top: 8px; }
.sch-numeri .wk-fig figcaption .n { font-weight: 500; }
.kpi.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi.k4 > div:nth-child(odd) { border-left: 0; padding-left: 0; }
.kpi.k4 > div:nth-child(even) { padding-right: 0; }
.kpi.k4 > div:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.plot.grande { height: 132px; }
.plot.grande .ymax { left: 0; right: auto; }
.plot.grande .area { fill: var(--pc); fill-opacity: .16; }
.plot.on .fine-v { opacity: 0; }
.ymin { position: absolute; left: 0; bottom: 3px; padding: 0 3px; border-radius: 3px; font-size: 11px; line-height: 1.3; color: var(--muted); background: var(--surface); }
.plot.grande .fine-v { right: 0; }

.canali-t { width: 100%; border-collapse: collapse; font-size: var(--t14); }
.canali-t th, .canali-t td { padding: 9px 12px; vertical-align: top; }
.canali-t thead th { font-size: var(--t12); font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.canali-t .ch { display: inline-flex; gap: 6px; font-size: var(--t12); font-weight: 600; }
.canali-t .ch .ic { width: 16px; height: 16px; }
.canali-t tbody th { text-align: left; font-weight: 500; color: var(--muted); white-space: nowrap; }
.canali-t .num { text-align: right; }
.canali-t td b { display: block; font-weight: 650; }
.canali-t td .dl { justify-content: flex-end; }
.canali-t tbody tr + tr { border-top: 1px solid var(--line); }
.canali-t .lungo { display: none; }
@media (min-width: 560px) { .canali-t .lungo { display: inline; } .canali-t .corto { display: none; } }
@media (max-width: 419px) { .canali-t th, .canali-t td { padding: 8px 8px; } .canali-t tbody th { padding-left: 12px; } }

.fol-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.fol-head b { font-size: var(--t28); font-weight: 700; line-height: 1.1; }
.fol-head > span:not(.dl) { font-size: var(--t14); color: var(--muted); }
#sch-follower { margin-top: 24px; }

.cf-pg { display: grid; gap: 20px; }
.barre { display: grid; gap: 12px; }
.barre li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "et val" "barra barra"; gap: 5px 12px; align-items: baseline; }
.barre .et { grid-area: et; min-width: 0; font-size: var(--t14); font-weight: 600; }
.barre .sub { display: inline; margin: 0 0 0 6px; }
.barre .val { grid-area: val; display: flex; align-items: baseline; gap: 2px; font-size: var(--t14); }
.barre .val b { font-weight: 650; }
.barra { grid-area: barra; display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 3px; background: var(--pc); }

.piano-pg { display: grid; gap: 10px; }
.avanz b { font-size: var(--t20); font-weight: 700; }
.piano-pg .h4 { margin: 8px 0 0; }
.vlist.compatta .vrow { grid-template-columns: minmax(0, 1fr) auto; }
.vlist.compatta .thumb { display: none; }
.sk-scheda .sk.big { height: 32px; margin-top: 24px; }
.sk-scheda .sk.chart { margin-top: 16px; height: 220px; }

@media (min-width: 720px) {
  .kpi.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi.k4 > div:nth-child(n) { border-top: 0; margin-top: 0; padding: 0 12px; }
  .kpi.k4 > div:first-child { padding-left: 0; }
  .kpi.k4 > div:last-child { padding-right: 0; }
  .kpi.k4 > div:nth-child(n+2) { border-left: 1px solid var(--line); }
  .plot.grande { height: 180px; }
}
@media (min-width: 1024px) {
  .sch-testa { padding-top: 24px; }
  .sch-numeri .pannello { padding: 16px 20px 12px; }
  .plot.grande { height: 220px; }
  .sch-due { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; align-items: start; }
  .piano-pg { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .piano-pg > .avanz, .piano-pg > .bar { grid-column: 1 / -1; }
  .piano-pg > .h4 { grid-column: 1; }
  .piano-pg > .argomenti { grid-column: 1; }
  .piano-pg > .trend, .piano-pg > details { grid-column: 2; grid-row: 3 / span 2; }
  .piano-pg > details { grid-row: auto; }
}

/* ---------- VIDEO ---------- */
.filtri { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: center; }
.filtri label { display: flex; min-width: 0; }
.filtri select { width: 100%; }
.filtri .cerca, .filtri .segmenti, .filtri .giorno { grid-column: 1 / -1; }
.filtri .segmenti { justify-self: start; }
@media (min-width: 720px) {
  .filtri { display: flex; flex-wrap: wrap; }
  .filtri select { width: auto; }
}
.filtri select, .filtri input {
  min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface);
  font-size: var(--t16); color: var(--text); max-width: 100%;
}
.filtri select { padding-right: 8px; }
.cerca { position: relative; flex: 1 1 100%; }
.filtri .giorno input { flex: 1; }
@media (min-width: 720px) { .filtri .giorno input { flex: none; } }
.cerca .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.cerca input { width: 100%; padding-left: 40px; }
.filtri input::placeholder { color: var(--muted); opacity: 1; }
.filtri .giorno { align-items: center; gap: 8px; font-size: var(--t14); color: var(--muted); }
@media (min-width: 720px) { .cerca { flex: 1 1 260px; } }

.vlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.vlist > li + li { border-top: 1px solid var(--line); }
.vrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; transition: background .15s; }
.vrow:hover { background: var(--raised); }
.thumb { position: relative; width: 44px; aspect-ratio: 9 / 16; border-radius: 6px; background: var(--raised); border: 1px solid var(--line); overflow: hidden; }
.thumb::after { content: ""; position: absolute; left: 6px; bottom: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--pc); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.thumb.big { width: 72px; }
.vrow .corpo .t { font-size: var(--t14); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.per { display: flex; gap: 12px; font-size: var(--t12); color: var(--muted); }
.per .pc { display: inline-flex; align-items: center; gap: 3px; }
.per .ic { width: 13px; height: 13px; }
.tot { display: grid; justify-items: end; }
.tot b { font-size: var(--t16); font-weight: 700; }
.tot .lbl { font-size: 11px; color: var(--muted); }

.piani { display: grid; gap: 12px; }
@media (min-width: 720px) { .piani { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.piano { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; align-content: start; }
.piano header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.piano .h3 { margin: 0; }
.argomenti { list-style: decimal; padding-left: 20px; display: grid; gap: 4px; font-size: var(--t14); }
.argomenti li::marker { color: var(--muted); }
details summary { cursor: pointer; font-size: var(--t14); color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.usati { font-size: var(--t14); display: grid; gap: 4px; padding-top: 4px; }
.usati .when { color: var(--muted); font-size: var(--t12); }
.trend { font-size: var(--t14); }
.trend .lbl { display: block; font-size: var(--t12); color: var(--muted); }

/* ---------- REGISTRO ---------- */
.registro .filtri { margin-bottom: 8px; }
.rlista { display: grid; gap: 8px; }
.giorno { scroll-margin-top: calc(var(--top-h) + var(--safe-t)); }
.gh {
  position: sticky; z-index: 5; top: calc(var(--top-h) + var(--safe-t)); display: flex; justify-content: space-between; gap: 8px;
  padding: 14px 2px 8px; background: var(--ground); font-size: var(--t14); font-weight: 650;
}
.gh .n { color: var(--muted); font-weight: 500; }
.evs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.evs > li + li { border-top: 1px solid var(--line); }
.ev { display: grid; grid-template-columns: 44px 52px minmax(0, 1fr); gap: 2px 8px; align-items: start; width: 100%; padding: 10px 12px 10px 10px; transition: background .15s; }
.ev:hover { background: var(--raised); }
.ev.sev-urgente { background: var(--bad-soft); }
.ev .when { font-size: var(--t14); color: var(--muted); padding-top: 1px; }
.ev .sev .ic { width: 18px; height: 18px; }
.ev .corpo .t { font-size: var(--t14); }
.ev .corpo .d { font-size: var(--t14); }
.ev .tipo { color: var(--muted); }
.has-link .ic { width: 14px; height: 14px; }
#r-stato { margin-top: 8px; }

/* ---------- the sheet ---------- */
.foglio {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 640px; max-height: calc(100dvh - var(--safe-t) - 40px);
  padding: 0 0 var(--safe-b); border: 0; border-radius: 16px 16px 0 0; background: var(--surface); color: var(--text);
  box-shadow: 0 -8px 32px rgb(0 0 0 / .22); display: none; flex-direction: column; overflow: hidden;
}
.foglio[open] { display: flex; }
.foglio::backdrop { background: rgb(0 0 0 / .45); }
.maniglia { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
.foglio > header { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 16px; flex: none; }
.foglio > header h2:focus { outline: none; }
.foglio > header h2 { flex: 1; font-size: var(--t20); font-weight: 650; line-height: 1.25; padding: 8px 0; }
.foglio .indietro { margin-left: -12px; }
.foglio .indietro .ic { transform: scaleX(-1); }
.foglio .corpo { display: block; overflow: auto; overscroll-behavior: contain; padding: 4px 16px 24px; }
.foglio .lead { font-size: var(--t16); margin-bottom: 12px; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.foglio .lead.neg { color: var(--text); background: var(--bad-soft); padding: 12px; border-radius: var(--r-sm); flex-wrap: nowrap; }
.foglio .lead.neg .ic { color: var(--bad); width: 20px; height: 20px; }
.kv { display: grid; grid-template-columns: minmax(96px, auto) minmax(0, 1fr); gap: 10px 16px; font-size: var(--t14); margin: 8px 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 500; }
.sevw { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.sevw .ic { width: 18px; height: 18px; }
.sevw.sev-urgente .ic, .sevw.st-fallito .ic { color: var(--bad); }
.sevw.sev-avviso .ic, .sevw.st-in_invio .ic { color: var(--warn); }
.sevw.st-pubblicato .ic { color: var(--ok); }
.sevw.sev-info .ic, .sevw.st-in_attesa .ic { color: var(--muted); }
.presa { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); font-size: var(--t14); margin-bottom: 12px; }
.presa .ic { color: var(--accent); width: 18px; height: 18px; }
.presa.libero { background: var(--raised); color: var(--muted); }
.riga-link { display: grid; grid-template-columns: 22px minmax(0, 1fr) 18px; gap: 10px; align-items: center; width: 100%; padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--line); margin: 4px 0 12px; }
.riga-link:hover { background: var(--raised); }
.riga-link > span { display: grid; gap: 2px; }
.riga-link .lbl { font-size: var(--t12); color: var(--muted); }
.riga-link .ic { color: var(--muted); }
.plain { display: grid; }
.plain > li + li { border-top: 1px solid var(--line); }
.proj { padding: 12px 0; display: grid; gap: 6px; }
.proj .r1 { display: flex; justify-content: space-between; gap: 8px; }
.proj .d { font-size: var(--t14); color: var(--muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.proj .d .ic { width: 15px; height: 15px; }
.proj.lv-urgente .bar i { background: var(--bad); }
.proj.lv-urgente .d .ic { color: var(--bad); }
.proj.lv-avviso .bar i { background: var(--warn); }
.proj.lv-avviso .d .ic { color: var(--warn); }
.tags { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--t12); }
.vhead { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; margin-bottom: 8px; }
.vtitle { font-size: var(--t16); font-weight: 650; line-height: 1.3; }
.vhead .meta { margin: 6px 0; }
.vhead .tot { display: block; font-size: var(--t14); color: var(--muted); }
.vhead .tot b { font-size: var(--t20); color: var(--text); }
.vch { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 0; font-size: var(--t14); }
.vch .nums { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); }
.vch .nums b { color: var(--text); }
.vch .link { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; font-weight: 600; }
.vch .link .ic { width: 16px; height: 16px; }
.tries { display: grid; gap: 8px; font-size: var(--t14); }
.tries li { display: flex; gap: 8px; align-items: flex-start; }
.tries .when, .ev-mini .when { color: var(--muted); white-space: nowrap; font-size: var(--t12); padding-top: 2px; }
.tries .ic { width: 16px; height: 16px; margin-top: 2px; }
.tries .raw { display: block; font-size: var(--t12); color: var(--muted); word-break: break-word; }
.ev-mini { display: flex; gap: 10px; width: 100%; padding: 10px 0; font-size: var(--t14); text-align: left; }
.ev-mini.sev-urgente span:last-child { color: var(--bad); font-weight: 600; }
.foglio .nota { margin-top: 16px; }
.azioni { margin-top: 20px; }
@media (min-width: 1024px) {
  .foglio { inset: 0 0 0 auto; margin: 0; width: 440px; max-width: 440px; height: 100dvh; max-height: 100dvh; border-radius: 0; border-left: 1px solid var(--line); box-shadow: -8px 0 32px rgb(0 0 0 / .18); }
  .maniglia { display: none; }
  .foglio > header { padding: 16px 12px 8px 24px; }
  .foglio .corpo { padding: 4px 24px 32px; }
}
@media (prefers-reduced-motion: no-preference) {
  .foglio[open] { animation: up .25s var(--ease); }
  @media (min-width: 1024px) { .foglio[open] { animation-name: side; } }
  @keyframes up { from { transform: translateY(40px); opacity: .4; } }
  @keyframes side { from { transform: translateX(40px); opacity: .4; } }
}

/* ---------- blocked sign-in ---------- */
.bloccato { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 32px 24px; text-align: center; max-width: 480px; margin: 0 auto; }
.bloccato h1 { font-size: var(--t20); }
.bloccato p { color: var(--muted); }
.bloccato img { border-radius: 12px; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- login page ---------- */
.accesso { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); }
.accesso main { width: 100%; max-width: 380px; padding: 0; }
.accesso .marchio { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.accesso .marchio img { border-radius: 10px; }
.accesso .marchio b { display: block; font-size: var(--t20); }
.accesso .marchio span span { color: var(--muted); font-size: var(--t14); }
.accesso form { display: grid; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.accesso label { display: grid; gap: 6px; font-size: var(--t14); font-weight: 600; }
.accesso input { min-height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--ground); font-size: var(--t16); }
.accesso button[type="submit"] { min-height: 48px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: var(--t16); text-align: center; }
.accesso button[type="submit"]:hover { filter: brightness(1.06); }
.errore { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bad-soft); font-size: var(--t14); }
.errore .ic { color: var(--bad); width: 18px; height: 18px; margin-top: 1px; }
.accesso .nota { margin-top: 16px; text-align: center; }

/* Page identity on the element that carries its colours (--pcd/--pcl set inline): --pc resolved at :root would only
   ever see the grey fallback, since a custom property inherits its computed value. */
[style*="--pcd"] { --pc: var(--pcl, #5d6470); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [style*="--pcd"] { --pc: var(--pcd, #9aa1ad); }
}
:root[data-theme="dark"] [style*="--pcd"] { --pc: var(--pcd, #9aa1ad); }
