/* PoP Tracker — foglio di stile unico, nessuna build step.
   ponytail: utility CSS scritte a mano invece di una toolchain Tailwind;
   se il team crescerà molto oltre queste pagine, si introduce un build step. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #dfe3e8;
  --border-strong: #c4cad2;
  --text: #1b2430;
  --text-muted: #5c6775;
  --text-faint: #8a94a2;

  --accent: #1f5f8b;
  --accent-dark: #17486a;
  --accent-soft: #e8f1f8;

  --good: #1a7f5a;
  --good-soft: #e3f5ec;
  --warn: #8a5a00;
  --warn-soft: #fdf1dc;
  --bad: #a52020;
  --bad-soft: #fbe9e9;
  --info: #1f5f8b;
  --info-soft: #e8f1f8;
  --muted: #5c6775;
  --muted-soft: #eceff2;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 4px 12px rgba(20, 30, 45, .05);
  --shadow-lg: 0 8px 32px rgba(20, 30, 45, .16);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .5rem 1rem;
}
.skip-link:focus { left: 0; }

/* ---------- layout ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #16202c;
  color: #c8d1dc;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__brand {
  padding: 1rem 1.125rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__brand strong { color: #fff; display: block; font-size: 1rem; letter-spacing: .01em; }
.sidebar__brand span { font-size: .75rem; color: #8998aa; }

.sidebar__nav { padding: .5rem 0; flex: 1; }
.sidebar__nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1.125rem;
  color: #c8d1dc; font-size: .875rem;
  border-left: 3px solid transparent;
}
.sidebar__nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; color: #fff; }
.sidebar__nav a[aria-current="page"] {
  background: rgba(255,255,255,.08);
  border-left-color: #4f9ed1;
  color: #fff; font-weight: 600;
}
.sidebar__nav .badge-count {
  margin-left: auto; background: rgba(255,255,255,.14);
  border-radius: 10px; padding: 0 .4rem; font-size: .7rem;
}

.sidebar__footer {
  padding: .875rem 1.125rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
}
.sidebar__footer .who { color: #fff; font-weight: 600; }
.sidebar__footer .role { color: #8998aa; font-size: .72rem; }
.sidebar__footer form { margin-top: .5rem; }
.sidebar__footer button {
  background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: #c8d1dc; border-radius: var(--radius-sm);
  padding: .3rem .6rem; font-size: .78rem; cursor: pointer; width: 100%;
}
.sidebar__footer button:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .875rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { flex: 1; min-width: 12rem; }
.topbar .subtitle { color: var(--text-muted); font-size: .8rem; font-weight: 400; }

.content { padding: 1.5rem; flex: 1; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { position: static; width: 100%; flex: none; height: auto; }
  .sidebar__nav { display: flex; flex-wrap: wrap; }
  .sidebar__nav a { border-left: none; border-bottom: 3px solid transparent; }
  .sidebar__nav a[aria-current="page"] { border-left: none; border-bottom-color: #4f9ed1; }
  .content { padding: 1rem; }
}

/* ---------- card / griglie ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card__head {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.card__head h2, .card__head h3 { flex: 1; min-width: 8rem; }
.card__body { padding: 1rem; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: 1rem; }
.grid--kpi { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
[hidden] { display: none !important; }
.row--end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------- KPI ---------- */

.kpi {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  padding: .75rem .875rem;
  box-shadow: var(--shadow);
  color: inherit;
}
.kpi:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lg); }
.kpi__value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__label { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }
.kpi--good { border-left-color: var(--good); }
.kpi--warn { border-left-color: var(--warn); }
.kpi--bad  { border-left-color: var(--bad); }
.kpi--info { border-left-color: var(--info); }
.kpi--neutral { border-left-color: var(--border-strong); }

/* ---------- badge / pill ---------- */

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  font-size: .74rem; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge--good { background: var(--good-soft); color: var(--good); border-color: #bfe6d4; }
.badge--warn { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb4; }
.badge--bad  { background: var(--bad-soft);  color: var(--bad);  border-color: #f2c9c9; }
.badge--info { background: var(--info-soft); color: var(--info); border-color: #c6dced; }
.badge--muted, .badge--neutral { background: var(--muted-soft); color: var(--muted); border-color: var(--border); }
.badge--plain::before { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: .1rem .5rem; font-size: .75rem;
}
.chip a { color: var(--text-muted); font-weight: 700; line-height: 1; }

.code {
  font-family: var(--mono); font-size: .78rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .05rem .3rem;
  white-space: nowrap;
}

/* ---------- tabelle ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .82rem;
}
table.data th, table.data td {
  padding: .5rem .625rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
table.data thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-2);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 700;
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}
table.data thead th a { color: inherit; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tbody tr.is-archived { opacity: .62; }
table.data tbody tr.is-archived td:first-child { border-left: 3px solid var(--text-faint); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }
table.data .title-cell { min-width: 18rem; max-width: 32rem; }
table.data tfoot td { background: var(--surface-2); font-weight: 600; }
table.data--compact th, table.data--compact td { padding: .35rem .5rem; }

.sort-indicator { font-size: .7rem; color: var(--accent); }

/* ---------- progress ---------- */

.progress {
  position: relative;
  /* è uno <span>: senza inline-block altezza e larghezza non si applicano */
  display: inline-block; vertical-align: middle;
  height: 1.1rem; min-width: 4.5rem;
  background: var(--muted-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.progress__bar { height: 100%; background: var(--accent); }
.progress__text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- form ---------- */

label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: .2rem; }
label .req { color: var(--bad); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit; font-size: .85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .375rem .5rem;
  min-height: 2rem;
}
select[multiple] { min-height: 5.5rem; }
textarea { min-height: 4.5rem; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: var(--muted-soft); color: var(--text-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.field { margin-bottom: .75rem; }
.field--inline { display: flex; align-items: center; gap: .5rem; margin: 0; }
.field--inline label { margin: 0; white-space: nowrap; }
.field__hint { font-size: .72rem; color: var(--text-faint); margin-top: .2rem; }
.field__error { font-size: .75rem; color: var(--bad); margin-top: .2rem; font-weight: 600; }

.form-grid { display: grid; gap: .75rem 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid .span-2 { grid-column: span 1; } }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .875rem; margin: 0 0 1rem; }
legend { font-size: .8rem; font-weight: 700; color: var(--text-muted); padding: 0 .35rem; }

.checkbox { display: flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 400; color: var(--text); }
.checkbox input { width: auto; min-height: 0; }

/* ---------- bottoni ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  font: inherit; font-size: .82rem; font-weight: 600;
  padding: .4rem .75rem; min-height: 2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--danger:hover { filter: brightness(.92); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--sm { font-size: .75rem; padding: .2rem .45rem; min-height: 1.6rem; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; z-index: 1; }

/* ---------- messaggi ---------- */

.alert {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .625rem .875rem;
  background: var(--surface);
  font-size: .85rem;
}
.alert--good { border-left-color: var(--good); background: var(--good-soft); }
.alert--warn { border-left-color: var(--warn); background: var(--warn-soft); }
.alert--bad  { border-left-color: var(--bad);  background: var(--bad-soft); }
.alert--info { border-left-color: var(--info); background: var(--info-soft); }
.alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }

.empty {
  text-align: center; padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty__icon { font-size: 1.75rem; opacity: .5; }
.empty h3 { margin: .5rem 0 .25rem; color: var(--text); }

#toasts {
  position: fixed; bottom: 1.25rem; right: 1.25rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 200; max-width: min(26rem, calc(100vw - 2.5rem));
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--good);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: .625rem .875rem; font-size: .85rem;
  display: flex; gap: .5rem; align-items: flex-start;
}
.toast--warn { border-left-color: var(--warn); }
.toast--bad { border-left-color: var(--bad); }
.toast button { background: none; border: none; cursor: pointer; color: var(--text-faint); font-size: 1rem; line-height: 1; }

/* ---------- caricamento ---------- */

.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request table.data tbody { opacity: .45; }

.spinner {
  width: 1rem; height: 1rem;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--muted-soft) 25%, #f4f6f8 50%, var(--muted-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius-sm);
  height: 1rem;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .skeleton { animation: none; }
}

/* ---------- drawer / dialog ---------- */

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 22, 32, .45);
  z-index: 90;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(640px, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 95;
  display: flex; flex-direction: column;
}
.drawer__head {
  padding: .875rem 1.125rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: .75rem;
}
.drawer__body { padding: 1.125rem; overflow-y: auto; flex: 1; }
.drawer__foot {
  padding: .75rem 1.125rem; border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; gap: .5rem; justify-content: flex-end;
}

/* ---------- filtri ---------- */

.filters { display: grid; gap: .625rem .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.filters__actions { display: flex; gap: .5rem; align-items: flex-end; }
details.filters-box > summary {
  cursor: pointer; font-weight: 600; font-size: .85rem;
  padding: .5rem 0; list-style: none;
}
details.filters-box > summary::-webkit-details-marker { display: none; }
details.filters-box > summary::before { content: "▸ "; color: var(--text-muted); }
details.filters-box[open] > summary::before { content: "▾ "; }

.active-filters { display: flex; gap: .35rem; flex-wrap: wrap; }

.pagination { display: flex; align-items: center; gap: .5rem; padding: .625rem 1rem; font-size: .8rem; color: var(--text-muted); flex-wrap: wrap; }

/* ---------- timeline audit ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  border-left: 2px solid var(--border);
  padding: 0 0 .875rem 1rem;
  margin-left: .35rem;
  position: relative;
}
.timeline li::before {
  content: ""; position: absolute; left: -.3rem; top: .3rem;
  width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
}
.timeline__meta { font-size: .76rem; color: var(--text-muted); }
.timeline__changes { margin: .3rem 0 0; padding: 0; list-style: none; font-size: .78rem; }
.timeline__changes li { border: none; padding: .1rem 0; margin: 0; }
.timeline__changes li::before { display: none; }
.timeline__changes del { color: var(--bad); text-decoration: line-through; }
.timeline__changes ins { color: var(--good); text-decoration: none; }

/* ---------- gantt ---------- */

.gantt {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.gantt__toolbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .625rem .875rem; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.gantt__scroll { overflow: auto; max-height: 72vh; position: relative; }
.gantt__grid { display: grid; grid-template-columns: var(--label-w, 260px) 1fr; min-width: 100%; }

.gantt__labels { position: sticky; left: 0; z-index: 6; background: var(--surface); border-right: 1px solid var(--border-strong); }
.gantt__labels-head, .gantt__timeline-head {
  position: sticky; top: 0; z-index: 7;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-strong);
  height: 3rem;
}
.gantt__labels-head { z-index: 8; display: flex; align-items: center; padding: 0 .625rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; }

.gantt__row-label {
  height: 1.75rem;
  display: flex; align-items: center; gap: .4rem;
  padding: 0 .625rem;
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
  overflow: hidden;
}
.gantt__row-label span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt__group-label {
  height: 1.75rem; display: flex; align-items: center; gap: .35rem;
  padding: 0 .5rem; background: var(--muted-soft);
  border-bottom: 1px solid var(--border-strong);
  font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted);
  cursor: pointer;
}

.gantt__timeline { position: relative; }
.gantt__timeline-head { position: sticky; top: 0; }
.gantt__ticks { position: relative; height: 3rem; }
.gantt__tick {
  position: absolute; top: 0; bottom: 0;
  border-left: 1px solid var(--border);
  font-size: .68rem; color: var(--text-muted);
  padding: .15rem .25rem; white-space: nowrap; overflow: hidden;
}
.gantt__tick--major { border-left-color: var(--border-strong); font-weight: 700; color: var(--text); }
.gantt__tick--weekend { background: rgba(0,0,0,.03); }

.gantt__body { position: relative; }
.gantt__row { height: 1.75rem; border-bottom: 1px solid var(--border); position: relative; }
.gantt__row--group { height: 1.75rem; background: var(--muted-soft); border-bottom: 1px solid var(--border-strong); }
.gantt__row:nth-child(even) { background: rgba(0,0,0,.012); }

.gantt__today {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #d13b3b; z-index: 4; pointer-events: none;
}
.gantt__today::after {
  content: "oggi"; position: absolute; top: -1.35rem; left: -1rem;
  background: #d13b3b; color: #fff; font-size: .62rem;
  padding: 0 .25rem; border-radius: 2px;
}

.gantt__bar {
  position: absolute; top: .28rem; height: 1.2rem;
  border-radius: 4px;
  background: var(--accent);
  border: 1px solid rgba(0,0,0,.18);
  cursor: grab;
  display: flex; align-items: center;
  overflow: visible;
  min-width: 5px;
  z-index: 2;
}
.gantt__bar:focus-visible { outline: 2px solid #111; outline-offset: 1px; }
.gantt__bar.dragging { cursor: grabbing; opacity: .85; z-index: 8; }
.gantt__bar.dirty { box-shadow: 0 0 0 2px #8a5a00; }
.gantt__bar-fill { height: 100%; background: rgba(255,255,255,.35); border-right: 1px solid rgba(255,255,255,.6); border-radius: 3px 0 0 3px; }
.gantt__bar-text {
  position: absolute; left: calc(100% + .35rem);
  font-size: .7rem; color: var(--text); white-space: nowrap; pointer-events: none;
}
.gantt__handle {
  position: absolute; top: 0; bottom: 0; width: 7px;
  cursor: ew-resize; background: rgba(255,255,255,.35);
}
.gantt__handle--start { left: 0; border-radius: 3px 0 0 3px; }
.gantt__handle--end { right: 0; border-radius: 0 3px 3px 0; }

.tone-good { background: var(--good); }
.tone-warn { background: var(--warn); }
.tone-bad  { background: var(--bad); }
.tone-info { background: var(--info); }
.tone-muted { background: var(--muted); }
.tone-neutral { background: #7a8493; }

.gantt__dep { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: visible; }

.gantt__tooltip {
  position: fixed; z-index: 300;
  background: #16202c; color: #fff;
  border-radius: var(--radius-sm);
  padding: .5rem .625rem; font-size: .76rem;
  box-shadow: var(--shadow-lg);
  max-width: 22rem; pointer-events: none;
}
.gantt__tooltip dl { display: grid; grid-template-columns: auto 1fr; gap: .1rem .5rem; margin: .35rem 0 0; }
.gantt__tooltip dt { color: #9fb0c2; }
.gantt__tooltip dd { margin: 0; }

.gantt__legend { display: flex; gap: .75rem; flex-wrap: wrap; padding: .5rem .875rem; border-top: 1px solid var(--border); font-size: .74rem; color: var(--text-muted); }
.gantt__legend i { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px; margin-right: .25rem; vertical-align: -1px; }

.pending-bar {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .875rem; background: var(--warn-soft);
  border-top: 1px solid #f0dcb4; font-size: .82rem;
}
/* l'attributo hidden deve vincere sul display:flex dichiarato sopra */
.pending-bar[hidden] { display: none; }

/* ---------- matrice carichi ---------- */

.matrix td.m { text-align: center; font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.matrix td.m[data-load="0"] { color: var(--text-faint); }
.matrix .heat { display: inline-block; min-width: 1.6rem; padding: 0 .25rem; border-radius: 3px; font-weight: 600; }
.matrix .heat-0 { background: transparent; color: var(--text-faint); }
.matrix .heat-1 { background: #e8f1f8; }
.matrix .heat-2 { background: #cfe3f1; }
.matrix .heat-3 { background: #a9cde6; }
.matrix .heat-4 { background: #7fb3d8; color: #10222e; }
.matrix .heat-5 { background: #4f93c4; color: #fff; }

/* ---------- login ---------- */

.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, #16202c 0%, #23394d 100%);
  padding: 1.5rem;
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
}
.login-card h1 { margin-bottom: .25rem; }
.login-card .muted { color: var(--text-muted); font-size: .85rem; margin-bottom: 1.25rem; }

/* ---------- utilità ---------- */

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .78rem; }
.tiny { font-size: .72rem; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: inline-block; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; border: 0; }
.chart-box { position: relative; height: 240px; }
.chart-box--tall { height: 300px; }

@media print {
  .sidebar, .topbar, .btn, #toasts { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; }
}
