/* =====================================================================
   UP TRAINING LAB — stile
   Derivato dal post: nero profondo, verde lime, titoli condensati in
   maiuscolo con parola in corsivo verde, card scure con bordo sottile,
   icone a linea.
   ===================================================================== */

:root {
  --bg: #0a0a0b;
  --surface: #131315;
  --surface-2: #1b1b1e;
  --surface-3: #25252a;
  --line: #2a2a2f;
  --text: #f5f5f6;
  --muted: #9b9ba3;
  --dim: #6c6c75;

  --lime: #a1cd16;
  --lime-bright: #b9e620;
  --lime-ink: #0a0a0b;
  --lime-soft: rgba(161, 205, 22, 0.14);

  --red: #ff453a;
  --red-soft: rgba(255, 69, 58, 0.15);
  --green: #30d158;
  --amber: #ffb020;
  --amber-soft: rgba(255, 176, 32, 0.15);

  --radius: 16px;
  --radius-sm: 10px;
  --font-title: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
svg.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { width: 96px; opacity: 0.9; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

/* ---------- Titoli ---------- */
.page-title, .auth-card h1 {
  font-family: var(--font-title);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 44px;
  line-height: 0.95;
  letter-spacing: 0.005em;
}
.page-title em, .auth-card h1 em, .accent {
  font-style: italic;
  color: var(--lime);
  font-weight: 800;
}
.kicker {
  display: inline-block;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime-ink);
  background: var(--lime);
  padding: 3px 12px 2px;
  border-radius: 4px;
  transform: skewX(-8deg);
  margin-bottom: 10px;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 8px; }
.section-title {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-title); font-weight: 700; font-size: 15px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text);
  margin: 28px 0 12px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.section-title .count { color: var(--lime); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- Layout ---------- */
.shell { min-height: 100vh; }
.side {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(10, 10, 11, 0.92);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand span { font-family: var(--font-title); font-weight: 700; font-size: 15px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user .who { text-align: right; line-height: 1.2; }
.side-user .who b { display: block; font-weight: 600; font-size: 14px; }
.side-user .who span { font-size: 12px; color: var(--muted); }
#view { padding: 20px 16px calc(var(--nav-h) + var(--safe-b) + 28px); width: 100%; max-width: 1100px; margin: 0 auto; animation: fade 0.2s; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(14, 14, 16, 0.94);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--dim); font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
}
.nav a:hover { text-decoration: none; color: var(--muted); }
.nav a svg.ic { width: 22px; height: 22px; }
.nav a.active { color: var(--lime); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; }
  .side {
    position: sticky; top: 0; height: 100vh; flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 8px; padding: 28px 18px 22px; border-bottom: 0; border-right: 1px solid var(--line); background: var(--bg);
  }
  .brand { padding: 0 8px 22px; }
  .brand img { height: 46px; }
  .nav {
    position: static; display: flex; flex-direction: column; justify-content: flex-start; height: auto; padding: 0;
    background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; gap: 4px; order: 2;
  }
  .nav a {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 14.5px;
    padding: 11px 14px; border-radius: 12px; color: var(--muted);
  }
  .nav a svg.ic { width: 20px; height: 20px; }
  .nav a:hover { background: var(--surface-2); color: var(--text); }
  .nav a.active { background: var(--lime-soft); color: var(--lime); }
  .side-user { order: 3; margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); justify-content: space-between; }
  .side-user .who { text-align: left; }
  #view { padding: 34px 40px 60px; }
  .page-title, .auth-card h1 { font-size: 54px; }
}

/* ---------- Card, liste ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-title { font-family: var(--font-title); font-weight: 700; font-size: 20px; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr; }
.grid.stats { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.stats { grid-template-columns: repeat(4, 1fr); }
  .grid.two.wide-left { grid-template-columns: 1.3fr 1fr; }
}
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; }
.stat .n { font-family: var(--font-title); font-weight: 800; font-size: 44px; line-height: 1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stat.hot .n { color: var(--lime); }
.stat svg.ic { position: absolute; right: 14px; top: 14px; width: 22px; height: 22px; color: var(--dim); }

.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--line); color: var(--text);
}
.row:last-child { border-bottom: 0; }
a.row:hover, .row.click:hover { text-decoration: none; background: rgba(255, 255, 255, 0.03); }
.row.click { cursor: pointer; }
.row .grow { flex: 1; min-width: 0; }
.row .t { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { display: block; color: var(--muted); font-size: 13px; }
.row .time { font-family: var(--font-title); font-weight: 700; font-size: 20px; width: 56px; color: var(--lime); flex: none; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-3); border: 1.5px solid var(--lime); color: var(--lime);
  font-family: var(--font-title); font-weight: 700; font-size: 17px; letter-spacing: 0.03em;
}
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty svg.ic { width: 30px; height: 30px; color: var(--dim); margin-bottom: 8px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.badge svg.ic { width: 13px; height: 13px; }
.badge.lime { background: var(--lime-soft); color: var(--lime); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-weight: 600; cursor: pointer; min-height: 42px;
  transition: background 0.15s, transform 0.05s, border-color 0.15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.btn.primary:hover { background: var(--lime-bright); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255, 69, 58, 0.4); background: transparent; }
.btn.danger:hover { background: var(--red-soft); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13.5px; border-radius: 10px; }
.btn.icon { padding: 0; width: 40px; min-height: 40px; }
.btn.sm.icon { width: 34px; min-height: 34px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.link-btn { background: none; border: 0; padding: 0; color: var(--lime); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Form ---------- */
.form { display: grid; gap: 14px; }
.form .two { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .form .two { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time],
input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; font-size: 16px; color: var(--text); min-height: 44px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-soft); }
input::placeholder, textarea::placeholder { color: var(--dim); }
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239b9ba3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
option { background: #1b1b1e; }
input[type=date], input[type=time] { color-scheme: dark; }
.search { position: relative; }
.search svg.ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search input { padding-left: 42px; }
.hint { font-size: 13px; color: var(--muted); }
.error-box { background: var(--red-soft); border: 1px solid rgba(255, 69, 58, 0.4); color: #ffb4ae; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.info-box { background: var(--lime-soft); border: 1px solid rgba(161, 205, 22, 0.35); color: #d9f08a; padding: 10px 14px; border-radius: 12px; font-size: 14px; }

/* Interruttore stile iOS */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 51px; height: 31px; border-radius: 16px; background: #3a3a3e; position: relative; transition: background 0.2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4); transition: transform 0.2s; }
.switch input:checked + .track { background: var(--amber); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--lime-soft); }
.switch.lime input:checked + .track { background: var(--lime); }

/* Slider a 3 posizioni (debole / neutro / forte) stile iOS */
.tri-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tri-row:last-child { border-bottom: 0; }
.tri-row .name { font-weight: 600; flex: 1; }
.tri { display: flex; align-items: center; gap: 10px; --track: #3a3a3e; }
.tri[data-v="-1"] { --track: var(--red); }
.tri[data-v="1"] { --track: var(--green); }
.tri .val { width: 52px; font-size: 12.5px; font-weight: 600; text-align: right; color: var(--muted); transition: color 0.2s; }
.tri[data-v="-1"] .val { color: var(--red); }
.tri[data-v="1"] .val { color: var(--green); }
.tri input[type=range] {
  -webkit-appearance: none; appearance: none; width: 118px; height: 31px; background: transparent; margin: 0; padding: 0; cursor: pointer; border: 0; min-height: 0;
}
.tri input[type=range]:focus { outline: none; box-shadow: none; }
.tri input[type=range]::-webkit-slider-runnable-track { height: 31px; border-radius: 16px; background: var(--track); transition: background 0.2s; }
.tri input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 27px; height: 27px; margin-top: 2px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.tri input[type=range]::-moz-range-track { height: 31px; border-radius: 16px; background: var(--track); }
.tri input[type=range]::-moz-range-thumb { width: 27px; height: 27px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.tri input[type=range]:focus-visible::-webkit-slider-runnable-track { box-shadow: 0 0 0 3px var(--lime-soft); }

/* ---------- Tab e chip ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 6px 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 1; text-align: center; padding: 10px 8px; color: var(--muted); font-family: var(--font-title); font-weight: 700; font-size: 17px; letter-spacing: 0.08em;
  text-transform: uppercase; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
@media (min-width: 700px) { .tabs a { flex: none; padding: 10px 18px; } }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--lime); border-bottom-color: var(--lime); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 6px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--lime-soft); border-color: var(--lime); color: var(--lime); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 14px; font-size: 14px; }
.back:hover { color: var(--text); text-decoration: none; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 200px; }

/* ---------- Tabella ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl td.wrap { white-space: normal; min-width: 120px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { font-family: var(--font-title); font-weight: 700; font-size: 19px; white-space: nowrap; }
.tbl td.actions { text-align: right; white-space: nowrap; }
.delta { font-size: 12.5px; font-weight: 600; margin-left: 6px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

/* ---------- Grafico ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 15px; fill: var(--muted); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--lime); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--bg); stroke: var(--lime); stroke-width: 2.5; }
.chart .dot.last { fill: var(--lime); }
.chart .val { fill: var(--text); font-weight: 600; font-size: 17px; text-anchor: middle; }
.chart .axis { text-anchor: end; }
.chart .xl { text-anchor: middle; }
.load-card { cursor: pointer; }
.load-card.on { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime) inset; }
.kg { font-family: var(--font-title); font-weight: 800; font-size: 30px; line-height: 1; }
.kg small { font-size: 15px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.load-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.load-grid .card { padding: 12px 14px; margin-top: 0; }
.load-grid .nm { font-size: 13px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Agenda ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.week-nav .label { font-family: var(--font-title); font-weight: 700; font-size: 21px; letter-spacing: 0.05em; text-transform: uppercase; text-align: center; flex: 1; }
.week-nav .label small { display: block; font-family: var(--font); font-weight: 400; font-size: 12px; letter-spacing: 0; color: var(--muted); text-transform: none; }
.wk { display: grid; grid-template-columns: 44px repeat(var(--cols, 6), 1fr); gap: 5px; align-items: stretch; }
.wk .h { text-align: center; font-family: var(--font-title); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-bottom: 4px; line-height: 1.1; cursor: pointer; }
.wk .h b { display: block; font-size: 19px; color: var(--text); }
.wk .h.today b { color: var(--lime); }
.wk .h.sel { color: var(--lime); }
.wk .o { font-family: var(--font-title); font-weight: 700; font-size: 15px; color: var(--muted); display: flex; align-items: center; }
.wk .c {
  min-height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer;
  background-image: linear-gradient(rgba(161, 205, 22, calc(var(--r, 0) * 0.55)), rgba(161, 205, 22, calc(var(--r, 0) * 0.55)));
}
.wk .c.free { border: 1px dashed var(--lime); color: var(--lime); background: transparent; }
.wk .c.full { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.wk .c.over { background: var(--amber); color: #1a1000; border-color: var(--amber); }
.wk .c.none { background: transparent; border-color: transparent; cursor: default; color: var(--dim); font-weight: 400; }
.wk .c.past { opacity: 0.45; }
.wk .c.sel { outline: 2px solid #fff; outline-offset: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--line); }
.legend i.free { border: 1px dashed var(--lime); }
.legend i.part { background: rgba(161, 205, 22, 0.35); }
.legend i.full { background: var(--lime); border-color: var(--lime); }
.legend i.over { background: var(--amber); border-color: var(--amber); }
.slot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 0 4px; }
.slot-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.slot-block .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.slot-block .hr { font-family: var(--font-title); font-weight: 800; font-size: 28px; color: var(--lime); line-height: 1; }
.slot-block .occ { font-size: 13px; color: var(--muted); }
.slot-block.over .occ { color: var(--amber); }
.state-btns { display: flex; gap: 4px; }
.st { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.st.on.svolto { background: var(--lime-soft); border-color: var(--lime); color: var(--lime); }
.st.on.assente { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.st.on.annullato { background: var(--surface-3); border-color: var(--dim); color: var(--text); }
.struck { text-decoration: line-through; color: var(--dim); }
.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin: 8px 0 4px; }
.progress > i { display: block; height: 100%; background: var(--lime); border-radius: 4px; }

/* ---------- Modal e toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); display: flex; align-items: flex-end; justify-content: center; z-index: 100; animation: fade 0.15s; }
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px 22px 0 0; width: 100%; max-width: 580px;
  max-height: 92vh; overflow-y: auto; padding: 22px 20px calc(22px + var(--safe-b)); animation: rise 0.2s;
}
.modal h2 { font-family: var(--font-title); font-weight: 800; font-size: 28px; text-transform: uppercase; margin-bottom: 14px; letter-spacing: 0.01em; }
.modal h2 em { font-style: italic; color: var(--lime); }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 22px; } }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.toast { background: #fff; color: #111; font-weight: 600; padding: 11px 18px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); animation: rise 0.2s; max-width: 90vw; font-size: 14px; }
.toast.err { background: var(--red); color: #fff; }

/* ---------- Accesso ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; position: relative; overflow: hidden; }
.auth::before {
  content: ''; position: absolute; top: -230px; right: -190px; width: 560px; height: 560px; border-radius: 50%;
  border: 20px solid transparent; border-left-color: var(--lime); border-bottom-color: var(--lime); transform: rotate(-30deg); opacity: 0.9; pointer-events: none;
}
.auth::after {
  content: ''; position: absolute; bottom: -260px; left: -200px; width: 520px; height: 520px; border-radius: 50%;
  border: 1px solid var(--line); pointer-events: none;
}
@media (max-width: 600px) { .auth::before { width: 300px; height: 300px; top: -170px; right: -120px; border-width: 14px; } }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 420px; }
.auth-card .logo { width: 128px; margin-bottom: 26px; }
.auth-card h1 { margin-bottom: 8px; }
.auth-card .lead { color: var(--muted); margin-bottom: 22px; }
.auth-card .links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 18px; font-size: 14px; }
.auth-card .form { margin-top: 4px; }

/* ---------- Varie ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.hr-line { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
.chip-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-pick label { cursor: pointer; }
.chip-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-pick span { display: inline-block; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: 14px; color: var(--muted); }
.chip-pick input:checked + span { background: var(--lime-soft); border-color: var(--lime); color: var(--lime); }
.chip-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--lime-soft); }
.fab { position: fixed; right: 18px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 35; width: 56px; height: 56px; border-radius: 50%; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.fab svg.ic { width: 26px; height: 26px; }
@media (min-width: 900px) { .fab { display: none; } }
@media (max-width: 899px) { .desktop-only { display: none !important; } }
@media (min-width: 900px) { .mobile-only { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Aggiunte ---------- */
[hidden] { display: none !important; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; border-width: 1px; }
.pick-list { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.pick:last-child { border-bottom: 0; }
.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick:has(input:checked) { background: var(--lime-soft); color: var(--lime); font-weight: 600; }
.pick:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--lime) inset; }
.slot-block.sel { border-color: var(--lime); }
.fasce-day { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fasce-day:last-child { border-bottom: 0; }
.fasce-day .d { width: 44px; flex: none; font-family: var(--font-title); font-weight: 700; font-size: 17px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-top: 5px; }
.fasce-day .chips .chip { font-weight: 600; }
.fasce-day .chips .chip small { color: var(--dim); font-weight: 500; margin-left: 4px; }
.inline-add { display: flex; gap: 10px; margin-top: 12px; }
.inline-add input { flex: 1; }
details.pack > summary { list-style: none; cursor: pointer; }
details.pack > summary::-webkit-details-marker { display: none; }
details.pack > summary .chev { transition: transform 0.2s; color: var(--dim); }
details.pack[open] > summary .chev { transform: rotate(90deg); }
.pack-head { display: flex; align-items: center; gap: 12px; }
.pack-head .grow { flex: 1; min-width: 0; }
.pack-head .ttl { font-family: var(--font-title); font-weight: 800; font-size: 24px; text-transform: uppercase; line-height: 1.05; }
.lesson { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lesson .when { flex: 1; min-width: 140px; }
.lesson .when b { font-weight: 600; }
.lesson .n { font-family: var(--font-title); font-weight: 700; color: var(--dim); width: 24px; }

/* ---------- Mappa di affluenza ---------- */
.wk { gap: 4px; }
.wk .c { position: relative; min-height: 30px; font-size: 13px; padding: 0; }
.wk .c.free { color: rgba(161, 205, 22, 0.55); font-weight: 500; }
.wk .c.arr::after { content: ''; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.wk .o { font-size: 12px; font-weight: 600; opacity: 0.55; }
.wk .o.hh { font-size: 15px; opacity: 1; }
.wk .gap { height: 10px; }
.legend i.arr { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); border: 0; margin: 0 8px 0 4px; vertical-align: 2px; }
.card.presenza { margin-bottom: 14px; }
.card.presenza.over { border-color: var(--amber); }
.card.presenza .card-title { margin-bottom: 8px; font-size: 18px; }
a.badge { text-decoration: none; }
/* Affluenza (Home): barre continue su scala oraria comune */
.aff { padding: 2px 0 0; }
.aff-row, .aff-axis { display: grid; grid-template-columns: 58px 1fr 48px; column-gap: 10px; align-items: center; }
.aff-row { padding: 9px 0 8px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.aff-row:hover .bar { outline: 1px solid rgba(161, 205, 22, 0.5); }
.aff-row .lbl { font-size: 13px; color: var(--muted); white-space: nowrap; }
.aff-row .lbl b { color: var(--text); font-family: var(--font-title); font-size: 15px; letter-spacing: 0.05em; text-transform: uppercase; margin-right: 3px; }
.aff-row .pk { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.aff-row .pk b { color: var(--text); font-size: 15px; }
.aff-row .pk b.over { color: var(--amber); }
.aff-row .pk em { font-style: normal; color: var(--dim); }
.aff-row.off .lbl b { color: var(--dim); }
.aff .bar { display: flex; gap: 6px; height: 16px; }
.aff .bar .seg { position: relative; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.aff-row .bar .seg { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); }
.aff .bar i { position: absolute; top: 0; bottom: 0; background: rgba(161, 205, 22, calc(0.35 + var(--r, 0) * 0.65)); }
.aff .bar i.full { background: var(--lime); }
.aff .bar i.over { background: var(--amber); }
.aff .bar i.closed { background: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255, 255, 255, 0.05) 4px 8px); }
.aff-axis { margin-bottom: 4px; }
.aff-axis .bar { height: 14px; }
.aff-axis .bar .seg { background: none; overflow: visible; }
.aff-axis b { position: absolute; top: 0; font-size: 11px; font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; }
.aff-row .starts { grid-column: 2; margin-top: 5px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.aff-leg { border-top: 1px solid var(--line); padding-top: 10px; font-size: 12px; color: var(--dim); }

/* Durata lezione */
.dur { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dur input { width: 110px; flex: none; }
.dur .chip { padding: 7px 12px; }
.badge.dur-b { font-variant-numeric: tabular-nums; }

/* ---------- Schermi larghi: il contenuto usa lo spazio, in più colonne ---------- */
@media (min-width: 1200px) {
  #view { max-width: 1680px; padding: 36px 56px 60px; }
  .page-title { font-size: 60px; }
  body { font-size: 16px; }
  .card { padding: 22px; }

  /* Home: tre colonne */

  /* Agenda: mappa a sinistra, dettaglio del giorno a destra */
  .ag-grid { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 28px; align-items: start; }
  .ag-grid #detail { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding-right: 4px; }
  .ag-grid #detail .section-title { margin-top: 0; }
  .wk .c { min-height: 34px; }

  /* Carichi: elenco esercizi a sinistra, grafico e storico a destra */
  .car-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 26px; align-items: start; }
  .car-grid .load-grid { grid-template-columns: 1fr; position: sticky; top: 24px; }
  .car-grid .section-title:first-child { margin-top: 0; }
  .chart { max-height: 460px; }

  /* Elenchi lunghi su due colonne */
  .list.cols { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
}
@media (min-width: 1700px) {
  .list.cols { grid-template-columns: 1fr 1fr 1fr; }
  .car-grid { grid-template-columns: 340px minmax(0, 1fr); }
}
@media (min-width: 900px) and (max-width: 1499px) {
  .home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
  .home-grid .side-col { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
}
@media (min-width: 1500px) {
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 22px; align-items: start; margin-top: 6px; }
  .home-grid .side-col { display: flex; flex-direction: column; }
}

/* Filtro elenco esercizi (Carichi) */
.car-filter { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.car-filter .chips { gap: 6px; }
.car-filter .chip { padding: 6px 12px; font-size: 13px; }
.load-card[hidden] { display: none; }
@media (min-width: 1200px) { .car-grid aside { position: sticky; top: 24px; } .car-grid .load-grid { position: static; } }
