/* ═══════════════════════════════════════════════════════
   NewDance Prototipo v2 — Architectural sketch (B/W)
   - Inter (sans geometrico) + JetBrains Mono per dati tecnici
   - Solo bianco/nero/grigi, linee sottili, niente arrotondamenti
   - Coerenza totale su pulsanti/link/input
   ═══════════════════════════════════════════════════════ */

/* ─── RESET ─── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; background: transparent; border: none; outline: none; }

/* ─── TOKEN: PALETTE ARCHITECT ─── */
:root {
  /* solo grigi, no colori */
  --ink-0:   #ffffff;
  --ink-50:  #fafafa;
  --ink-100: #f2f2f2;
  --ink-150: #e8e8e8;
  --ink-200: #dcdcdc;
  --ink-300: #bcbcbc;
  --ink-400: #8a8a8a;
  --ink-500: #5e5e5e;
  --ink-600: #3a3a3a;
  --ink-700: #1f1f1f;
  --ink-900: #000000;
  --ink-900-alpha-50: rgba(0,0,0,0.5);

  /* semantici monocromatici (variazioni di pattern non di colore) */
  --line:      var(--ink-200);
  --line-soft: var(--ink-150);
  --line-strong: var(--ink-900);
  --bg:        var(--ink-50);
  --surface:   var(--ink-0);
  --surface-2: var(--ink-100);
  --text:      var(--ink-900);
  --text-mute: var(--ink-500);
  --text-faint:var(--ink-400);

  /* tipografia */
  --ff-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* misure */
  --side-w: 240px;
  --top-h: 56px;
  --foot-h: 28px;
  --panel-w: 560px;

  /* dimensioni font */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 15px;
  --fs-xl: 19px;
  --fs-xxl: 26px;
}

/* ─── BASE ─── */
body {
  font-family: var(--ff-sans);
  font-size: var(--fs-md);
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.005em;
}

.mono { font-family: var(--ff-mono); font-feature-settings: 'tnum' 1; }
.uc   { text-transform: uppercase; letter-spacing: 0.08em; }
.muted{ color: var(--text-mute); }
.faint{ color: var(--text-faint); }

/* ─── LAYOUT ─── */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.brand {
  padding: 16px 20px 20px;
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand__mark {
  width: 32px; height: 32px;
  border: 1.5px solid var(--ink-900);
  font-family: var(--ff-mono);
  font-weight: 600;
  font-size: 11px;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
}
.brand__name { font-weight: 600; font-size: 14px; letter-spacing: 0.01em; }
.brand__sub  { font-family: var(--ff-mono); font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 1px; }
.brand__ann-link {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--ff-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--ink-900);
}
.brand__ann-link:hover { color: var(--text-mute); border-bottom-color: var(--text-mute); }

.nav { flex: 1; overflow-y: auto; padding: 12px 0 24px; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: var(--ink-200); }

.nav__section {
  font-family: var(--ff-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 14px 20px 6px;
}

.nav__item {
  display: flex;
  align-items: center;
  padding: 7px 20px;
  font-size: var(--fs-md);
  color: var(--text);
  border-left: 2px solid transparent;
  position: relative;
  transition: background .12s, border-color .12s;
}
.nav__item:hover { background: var(--ink-100); }
.nav__item.is-active {
  border-left-color: var(--ink-900);
  background: var(--ink-100);
  font-weight: 500;
}

.sidebar__foot {
  border-top: 1px solid var(--line);
  padding: 10px 20px;
  font-size: var(--fs-xs);
  color: var(--text-mute);
}
.legend { display: flex; align-items: center; gap: 4px; font-family: var(--ff-mono); font-size: 10px; }
.legend__dot { width: 8px; height: 8px; display: inline-block; border: 1px solid var(--ink-900); }
.legend__dot--ok   { background: var(--ink-0); }
.legend__dot--warn { background: repeating-linear-gradient(45deg, var(--ink-0), var(--ink-0) 2px, var(--ink-900-alpha-50) 2px, var(--ink-900) 3px); }
.legend__dot--ko   { background: var(--ink-900); }

/* ─── TOPBAR ─── */
.main {
  display: grid;
  grid-template-rows: var(--top-h) 1fr var(--foot-h);
  min-height: 100vh;
  min-width: 0;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.crumbs { font-family: var(--ff-mono); font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.1em; }
.crumbs__root { color: var(--text-faint); }
.crumbs__sep { margin: 0 6px; color: var(--text-faint); }
.crumbs__page { color: var(--text); font-weight: 500; }

.topbar__right { display: flex; align-items: center; gap: 18px; }
.role { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.role__lbl { font-family: var(--ff-mono); font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.1em; }
.role__select {
  border: 1px solid var(--ink-900);
  padding: 4px 8px;
  background: var(--surface);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.role__select:focus { outline: 2px solid var(--ink-900); outline-offset: -1px; }
.who { font-family: var(--ff-mono); font-size: 11px; color: var(--text-mute); }

/* ─── CONTENT ─── */
.content { padding: 24px 28px 40px; min-width: 0; overflow-x: hidden; }

/* ─── STATUSBAR ─── */
.statusbar {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0 24px;
  display: flex;
  align-items: center;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.statusbar .sep { margin: 0 8px; color: var(--text-faint); }

/* ═══ PRIMITIVES UI ═══ */

/* — Page header — */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink-900);
  gap: 24px;
}
.page-head__title {
  font-size: var(--fs-xxl);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.page-head__sub {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 4px;
}
.page-head__actions { display: flex; gap: 8px; align-items: center; }

/* — Section — */
.section { margin-bottom: 32px; }
.section__title {
  font-size: var(--fs-md);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}

/* — Buttons (un solo stile, varianti coerenti) — */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--ink-900);
  background: var(--surface);
  color: var(--ink-900);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background .12s, color .12s;
  text-transform: uppercase;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.btn:hover { background: var(--ink-900); color: var(--ink-0); }
.btn:active { background: var(--ink-700); }
.btn--primary { background: var(--ink-900); color: var(--ink-0); }
.btn--primary:hover { background: var(--ink-0); color: var(--ink-900); }
.btn--ghost { border-color: var(--line); color: var(--text-mute); }
.btn--ghost:hover { border-color: var(--ink-900); background: var(--surface); color: var(--ink-900); }
.btn--sm { padding: 3px 8px; font-size: 10px; }
.btn--icon { padding: 4px 8px; }
.btn[disabled] { opacity: .35; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--surface); color: var(--ink-900); }

/* — Link inline — */
.link {
  color: var(--ink-900);
  border-bottom: 1px solid var(--ink-900);
  padding-bottom: 0;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.link:hover { color: var(--text-mute); border-bottom-color: var(--text-mute); }

/* — Inputs / form — */
.input, .select, .textarea {
  border: 1px solid var(--ink-900);
  background: var(--surface);
  padding: 6px 10px;
  font-size: var(--fs-sm);
  color: var(--text);
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--ink-900); outline-offset: -2px; }
.input::placeholder { color: var(--text-faint); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field__lbl { font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-mute); }
.field__hint { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

.search-select {
  position: relative;
}
.search-select::after {
  content: '⌕';
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--text-mute);
  pointer-events: none;
}
.search-select__input {
  padding-right: 28px;
}
.search-select__menu {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--ink-900);
  background: var(--surface);
  z-index: 20;
  box-shadow: 0 10px 20px -16px rgba(0,0,0,.35);
}
.search-select__option,
.search-select__empty {
  width: 100%;
  padding: 8px 10px;
  border-top: 1px solid var(--line-soft);
  text-align: left;
  background: var(--surface);
}
.search-select__option:first-child,
.search-select__empty:first-child {
  border-top: none;
}
.search-select__option {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-select__option:hover,
.search-select__option.is-active {
  background: var(--ink-100);
}
.search-select__label {
  font-size: var(--fs-sm);
}
.search-select__meta,
.search-select__empty {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--text-mute);
}

/* — Cards / boxes — */
.card {
  background: var(--surface);
  border: 1px solid var(--ink-900);
  padding: 16px;
}
.card--soft { border-color: var(--line); }
.card__title {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.card__big {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum' 1;
}
.card__sub { font-size: 11px; color: var(--text-mute); margin-top: 4px; font-family: var(--ff-mono); }

/* — Grid utility — */
.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--5 { grid-template-columns: repeat(5, 1fr); }
.grid--6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1100px) { .grid--4, .grid--5, .grid--6 { grid-template-columns: repeat(2, 1fr); } }

/* — KPI strip — */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; border: 1px solid var(--ink-900); }
.kpi { padding: 14px 16px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: none; }
.kpi__lbl { font-family: var(--ff-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-mute); }
.kpi__val { font-size: 22px; font-weight: 600; margin-top: 4px; font-feature-settings: 'tnum' 1; }
.kpi__delta { font-family: var(--ff-mono); font-size: 10px; color: var(--text-mute); margin-top: 2px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } .kpi:nth-child(3n) { border-right: none; } .kpi { border-bottom: 1px solid var(--line); } }

/* — Table — */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--surface); }
.tbl th, .tbl td { padding: 8px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-soft); }
.tbl thead th {
  font-family: var(--ff-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  border-bottom: 1px solid var(--ink-900);
  background: var(--surface);
  font-weight: 500;
  white-space: nowrap;
}
.tbl tbody tr[onclick] { cursor: pointer; }
.tbl tbody tr[onclick]:hover { background: var(--ink-50); }
.tbl td.num { text-align: right; font-family: var(--ff-mono); font-feature-settings: 'tnum' 1; }
.tbl th.num { text-align: right; }
.tbl--compact th, .tbl--compact td { padding: 5px 8px; font-size: var(--fs-xs); }

/* — Badge / pill / tag — */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-family: var(--ff-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--ink-900);
  background: var(--surface);
  color: var(--ink-900);
  white-space: nowrap;
}
.badge--solid { background: var(--ink-900); color: var(--ink-0); }
.badge--soft  { border-color: var(--line); color: var(--text-mute); }
.badge--dash  {
  border-style: dashed;
}
/* Stati semantici monocromatici (pattern) */
.badge--ok    { background: var(--ink-0); color: var(--ink-900); }
.badge--warn  { background: repeating-linear-gradient(45deg, var(--ink-0), var(--ink-0) 3px, var(--ink-900-alpha-50) 3px, var(--ink-900) 4px); color: var(--ink-900); padding-left: 10px; padding-right: 10px; }
.badge--ko    { background: var(--ink-900); color: var(--ink-0); }

/* — Person avatar (iniziali) — */
.avatar {
  width: 28px; height: 28px;
  border: 1px solid var(--ink-900);
  display: inline-grid;
  place-items: center;
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  background: var(--surface);
  flex-shrink: 0;
}
.avatar--lg { width: 56px; height: 56px; font-size: 16px; }
.avatar--sm { width: 22px; height: 22px; font-size: 9px; }

/* — Person row (compatto) — */
.person-row { display: flex; align-items: center; gap: 8px; }
.person-row__name { font-weight: 500; }
.person-row__meta { font-family: var(--ff-mono); font-size: 10px; color: var(--text-mute); }

/* — Searchbar — */
.searchbar {
  display: flex; align-items: center;
  border: 1px solid var(--ink-900);
  background: var(--surface);
  padding: 4px 10px;
  width: 320px;
}
.searchbar input { flex: 1; border: none; padding: 4px 0; background: transparent; }
.searchbar__icon { font-family: var(--ff-mono); color: var(--text-mute); font-size: 12px; }

/* — Filter chips — */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  padding: 3px 10px;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-mute);
  transition: all .1s;
}
.chip:hover { border-color: var(--ink-900); color: var(--ink-900); }
.chip.is-active { border-color: var(--ink-900); background: var(--ink-900); color: var(--ink-0); }

.people-filters {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.people-filters__bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.people-filters__search {
  flex: 1 1 340px;
  min-width: 280px;
  width: auto;
}
.people-filters__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.people-filters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.people-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.people-filter__shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 35px;
  padding: 0 10px;
  border: 1px solid var(--ink-900);
  background: var(--surface);
}
.people-filter__shell::after {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--text-mute);
  pointer-events: none;
}
.people-filter__shell--select::after {
  content: '▾';
}
.people-filter__shell--search::after {
  content: '⌕';
}
.people-filter__shell:focus-within {
  outline: 2px solid var(--ink-900);
  outline-offset: -2px;
}
.people-filter__control {
  width: 100%;
  min-height: 33px;
  padding: 0;
  border: none;
  background: transparent;
}
.people-filter__control:focus {
  outline: none;
}
.people-filter__shell > .select.people-filter__control {
  padding-right: 20px;
  appearance: none;
  -webkit-appearance: none;
}
.people-filter__shell > .input.people-filter__control {
  padding-right: 22px;
}
.people-filter__shell--compact {
  min-height: 32px;
  min-width: 74px;
  padding: 0 8px;
}
.people-filter__control--compact {
  min-height: 30px;
}

.people-source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.people-source__dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--ink-900);
  background: var(--ink-0);
  flex-shrink: 0;
}
.people-source--loading .people-source__dot {
  background: repeating-linear-gradient(45deg, var(--ink-0), var(--ink-0) 2px, var(--ink-900-alpha-50) 2px, var(--ink-900-alpha-50) 3px);
}
.people-source--error .people-source__dot {
  background: var(--ink-900);
}
.people-source--ok .people-source__dot {
  background: var(--ink-150);
}

.people-results__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.people-page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.people-page-size .select {
  min-width: 74px;
}
.people-page-size .people-filter__shell {
  flex-shrink: 0;
}

.people-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.people-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.people-tag--accent {
  border-color: var(--ink-900);
}
.people-tag--family {
  border-style: dashed;
}
.people-tag--flow {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: var(--ink-0);
}
.people-tag--minor {
  background: repeating-linear-gradient(45deg, var(--surface) 0 4px, var(--ink-150) 4px 8px);
  border-color: var(--ink-900);
}

.people-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.people-pagination__summary {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.people-pagination__controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.people-pager__btn {
  min-width: 40px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--text);
}
.people-pager__btn:hover:not(:disabled) {
  border-color: var(--ink-900);
}
.people-pager__btn:disabled {
  opacity: .35;
  cursor: default;
}
.people-pager__btn.is-active {
  border-color: var(--ink-900);
  background: var(--ink-900);
  color: var(--ink-0);
}

/* — Toolbar — */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.toolbar__left, .toolbar__right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* — Empty state — */
.empty {
  border: 1px dashed var(--line);
  padding: 40px;
  text-align: center;
  color: var(--text-mute);
  font-size: var(--fs-sm);
}

/* — Panel slide-in — */
.panel-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  opacity: 0; visibility: hidden;
  transition: opacity .18s, visibility .18s;
  z-index: 100;
}
.panel-overlay.is-active { opacity: 1; visibility: visible; }

.panel {
  position: fixed;
  top: 0; right: 0;
  width: var(--panel-w);
  max-width: 95vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--ink-900);
  transform: translateX(100%);
  transition: transform .22s ease-out;
  display: flex;
  flex-direction: column;
  z-index: 101;
  box-shadow: -8px 0 24px -10px rgba(0,0,0,.18);
}
.panel.is-open { transform: translateX(0); }

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ink-900);
  background: var(--surface);
}
.panel__path {
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.panel__crumb { color: var(--text-mute); cursor: pointer; }
.panel__crumb:not(.panel__crumb--last):hover { color: var(--ink-900); border-bottom: 1px solid var(--ink-900); }
.panel__crumb--last { color: var(--ink-900); font-weight: 600; }
.panel__crumb-sep { color: var(--text-faint); }
.panel__close {
  font-size: 22px;
  width: 28px; height: 28px;
  border: 1px solid var(--ink-900);
  display: grid; place-items: center;
  line-height: 1;
}
.panel__close:hover { background: var(--ink-900); color: var(--ink-0); }
.panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
body.panel-open { overflow: hidden; }

/* — Toast — */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-900);
  color: var(--ink-0);
  padding: 10px 18px;
  font-size: var(--fs-sm);
  font-family: var(--ff-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--ink-900);
  opacity: 0; visibility: hidden;
  transition: opacity .2s, transform .2s, visibility .2s;
  z-index: 200;
}
.toast.is-on { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* — Tabs — */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--ink-900);
  margin-bottom: 18px;
}
.tab {
  padding: 8px 18px;
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  position: relative;
  top: 1px;
  background: transparent;
}
.tab:hover { color: var(--ink-900); }
.tab.is-active {
  background: var(--surface);
  border-color: var(--ink-900);
  color: var(--ink-900);
  font-weight: 500;
}

/* — Calendar / planning grid — */
.cal {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--ink-900);
  background: var(--surface);
  font-size: var(--fs-xs);
}
.cal__hh { background: var(--ink-50); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 6px; font-family: var(--ff-mono); font-size: 10px; color: var(--text-mute); text-align: right; }
.cal__head { background: var(--ink-100); border-right: 1px solid var(--line); border-bottom: 1px solid var(--ink-900); padding: 6px 8px; font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.cal__head:last-child, .cal__cell:last-child { border-right: none; }
.cal__cell { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); position: relative; min-height: 38px; }
.cal__lesson {
  position: absolute;
  left: 2px; right: 2px;
  background: var(--surface);
  border: 1px solid var(--ink-900);
  padding: 3px 5px;
  font-size: 10px;
  line-height: 1.25;
  cursor: pointer;
  overflow: hidden;
  z-index: 1;
}
.cal__lesson:hover { background: var(--ink-900); color: var(--ink-0); z-index: 2; }
.cal__lesson--solid { background: var(--ink-900); color: var(--ink-0); }
.cal__lesson--dash  { border-style: dashed; }
.cal__lesson__title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__lesson__meta  { font-family: var(--ff-mono); font-size: 9px; opacity: .8; white-space: nowrap; }

/* — Sketchy decorative rule — */
.rule {
  border: none;
  border-top: 1px solid var(--ink-900);
  margin: 18px 0;
}
.rule--soft { border-top-color: var(--line); }
.rule--dash { border-top-style: dashed; }

/* — Stack helper — */
.stack > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }

/* — Definition list — */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 16px; font-size: var(--fs-sm); }
.dl dt { font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); padding-top: 2px; }
.dl dd { color: var(--text); }
.dl--panel-person {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.dl--panel-person > div {
  display: grid;
  gap: 3px;
  align-content: start;
}
.dl--panel-person > div > .mono {
  display: block;
  overflow-wrap: anywhere;
}
@media (max-width: 720px) {
  .dl--panel-person {
    grid-template-columns: 1fr;
  }
}

.person-actions-bar {
  background: var(--ink-900);
  color: var(--ink-0);
  border: 1px solid var(--ink-900);
  padding: 10px;
}
.person-actions-bar__title {
  font-family: var(--ff-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.person-actions-bar .btn,
.person-actions-bar .btn--primary,
.person-actions-bar .btn--ghost {
  background: var(--ink-0);
  color: var(--ink-900);
  border-color: var(--ink-0);
}
.person-actions-bar .btn:hover,
.person-actions-bar .btn--primary:hover,
.person-actions-bar .btn--ghost:hover {
  background: var(--ink-100);
  color: var(--ink-900);
  border-color: var(--ink-100);
}

/* — Mobile frame (per app allievo/docente) — */
.phone-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 380px)); gap: 24px; justify-content: start; }
.phone {
  width: 360px;
  border: 1.5px solid var(--ink-900);
  border-radius: 28px;
  padding: 8px;
  background: var(--ink-0);
  position: relative;
}
.phone::before {
  content: ''; display: block;
  width: 80px; height: 4px;
  background: var(--ink-900);
  border-radius: 2px;
  margin: 4px auto 8px;
}
.phone__screen {
  border: 1px solid var(--ink-900);
  border-radius: 18px;
  padding: 12px 14px;
  min-height: 620px;
  font-size: 12px;
  background: var(--surface);
  overflow: hidden;
}
.phone__title { font-size: 14px; font-weight: 600; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--ink-900); }
.phone__caption { font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); text-align: center; margin-top: 8px; }

/* — Misc — */
.indent { padding-left: 16px; border-left: 1px solid var(--line); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* — Print-like footer note — */
.note {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-mute);
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  margin-top: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Banner stagione storica (mono, hatch warn) ─── */
.season-banner {
  background: repeating-linear-gradient(45deg, var(--ink-0), var(--ink-0) 4px, var(--ink-100) 4px, var(--ink-100) 8px);
  border-bottom: 1px solid var(--ink-900);
  border-top: 1px solid var(--ink-900);
  color: var(--text);
  padding: 8px 24px;
  font-size: 12.5px;
  font-family: var(--ff-mono);
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}
body.is-historical-season .topbar {
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 8px, var(--ink-100) 8px, var(--ink-100) 16px);
}

/* ─── Compliance: tre regimi (mono, distinti per spessore bordo sx) ─── */
.regime-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.regime {
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--ink-0);
}
.regime__name {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  font-family: var(--ff-mono);
  color: var(--text-mute); margin-bottom: 6px;
}
.regime__title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.regime__body { font-size: 12.5px; line-height: 1.5; color: var(--text); }
/* sicurezza = nero pieno */
.regime--block  { border-left: 4px solid var(--ink-900); }
/* formale = hatch */
.regime--signal { border-left: 4px solid transparent;
  background-image: linear-gradient(var(--ink-0), var(--ink-0)), repeating-linear-gradient(45deg, var(--ink-0), var(--ink-0) 2px, var(--ink-900) 2px, var(--ink-900) 3px);
  background-clip: padding-box, border-box;
  background-origin: border-box;
}
/* documentale = linea sottile */
.regime--doc    { border-left: 1px solid var(--ink-900); padding-left: 17px; }

/* ─── State machine certificato medico (mono, riusa logica badge) ─── */
.state-flow {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-family: var(--ff-mono); font-size: 11px;
  margin-top: 8px;
  align-items: center;
}
.state-flow__step {
  border: 1px solid var(--ink-900);
  padding: 4px 8px;
  background: var(--surface);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.state-flow__step--block { background: var(--ink-900); color: var(--ink-0); }
.state-flow__step--ok    { background: var(--ink-0); color: var(--ink-900); }
.state-flow__step--warn  { background: repeating-linear-gradient(45deg, var(--ink-0), var(--ink-0) 3px, var(--ink-900-alpha-50) 3px, var(--ink-900) 4px); color: var(--ink-900); }
.state-flow__step--soft  { border-color: var(--line); color: var(--text-mute); }
.state-flow__arrow { color: var(--text-mute); padding: 0 2px; font-family: var(--ff-mono); }

/* ─── Banner alert / info (mono) ─── */
.banner-alert {
  border: 1.5px solid var(--ink-900);
  background: var(--ink-900);
  color: var(--ink-0);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.banner-alert b, .banner-alert i { color: var(--ink-0); }
.banner-info {
  border: 1px solid var(--ink-900);
  background: repeating-linear-gradient(45deg, var(--ink-0), var(--ink-0) 6px, var(--ink-100) 6px, var(--ink-100) 12px);
  color: var(--text);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}

/* ─── Viste salvate (B.7) ─── */
.saved-views {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--ink-50);
  margin-bottom: 12px;
}
.saved-views__lbl {
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}
.saved-views__list {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.saved-views__hint { font-size: 11px; margin-left: 6px; }
.chip--view {
  cursor: pointer;
  border: 1px solid var(--ink-900);
  background: var(--ink-0);
  font-family: var(--ff-mono);
  font-size: 11px;
  padding: 3px 8px;
  text-transform: lowercase;
}
.chip--view--active {
  background: var(--ink-900);
  color: var(--ink-0);
}
.btn--sm { font-size: 11px; padding: 4px 8px; }

/* ─── Appunti visuali (prototipo) ─── */
body.notes-mode,
body.notes-mode * {
  cursor: crosshair !important;
}

.proto-note-parent {
  min-height: 1px;
}

.proto-note-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid #111;
  transform: translate(-50%, -50%);
  z-index: 16;
  padding: 0;
}

.proto-note-marker.is-open {
  background: #e02020;
}

.proto-note-marker.is-complete {
  background: #1f9d47;
}

.proto-note-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1400;
}

.proto-note-modal__box {
  width: min(460px, 92vw);
  background: #fff;
  border: 1px solid #111;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.proto-note-modal__title {
  font-weight: 600;
}

.proto-note-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.proto-note-modal__meta {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
}

.proto-note-modal__meta-label {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.proto-note-modal__meta-value {
  color: var(--text);
}

.proto-note-modal__textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid #111;
  padding: 8px;
  font: 14px/1.4 var(--ff-ui, sans-serif);
  resize: vertical;
}

.proto-note-modal__check {
  display: inline-flex;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  align-items: center;
}

.proto-note-modal__actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.ann-list {
  display: grid;
  gap: 8px;
}

.ann-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.ann-tabs__btn {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 6px 10px;
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.ann-tabs__btn.is-active {
  border-color: var(--ink-900);
  background: var(--ink-900);
  color: var(--ink-0);
}

.ann-list__item {
  display: block;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px;
  cursor: pointer;
}

.ann-list__item:hover {
  border-color: var(--ink-900);
}

.ann-list__item:focus-visible {
  outline: 2px solid var(--ink-900);
  outline-offset: 1px;
}

.ann-list__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.ann-list__state {
  font-size: 11px;
  font-family: var(--ff-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ann-list__state.is-open { color: #b00000; }
.ann-list__state.is-complete { color: #0f7a33; }
.ann-list__state.is-deleted { color: var(--text-mute); }

.ann-list__time {
  font-size: 11px;
  color: var(--text-mute);
}

.ann-list__text {
  font-size: 13px;
  line-height: 1.4;
}

.ann-list__meta {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-faint);
}

.ann-list__actions {
  margin-top: 8px;
}

.ann-pager {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.ann-pager__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.proto-note-pulse {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #ff2b2b;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: protoNotePulse 1.2s ease-out 2;
  z-index: 18;
}

@keyframes protoNotePulse {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); }
}
