/* ==========================================================================
   Ticket · stile "carta e inchiostro"
   Superfici piatte, bordi sottili, un solo accento. Niente gradienti.
   ========================================================================== */

:root {
  --paper: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1d1c1a;
  --ink-2: #5d5a54;
  --ink-3: #8c887f;
  --line: #e3dfd6;
  --line-strong: #cfc9bd;
  --accent: #2f4ea2;
  --accent-hover: #243f87;
  --accent-ink: #ffffff;
  --accent-soft: #e9edf8;

  /* stati */
  --st-nuovo: #6f6b63;
  --st-riaperto: #bf3b27;
  --st-in_lavorazione: #a86400;
  --st-pronto: #1d7385;
  --st-pubblicato: #3b7a2a;
  --st-risolto: #23684b;
  --st-chiuso: #8c887f;

  /* gravità */
  --sev-bassa: #9a958b;
  --sev-media: #b88a00;
  --sev-alta: #c75c14;
  --sev-critica: #bf3b27;

  --type-bug: #bf3b27;
  --type-feature: var(--accent);

  --radius: 8px;
  --radius-sm: 6px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bs-body-font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-secondary-color: var(--ink-2);
  --bs-tertiary-color: var(--ink-3);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--line);
  --bs-primary: var(--accent);
  --bs-primary-rgb: 47, 78, 162;
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 47, 78, 162;
  --bs-link-hover-color: var(--accent-hover);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-focus-ring-color: rgba(47, 78, 162, .25);
}

[data-bs-theme="dark"] {
  --paper: #141412;
  --surface: #1c1b19;
  --surface-2: #222120;
  --ink: #ebe9e4;
  --ink-2: #aaa69d;
  --ink-3: #7c786f;
  --line: #2f2d2a;
  --line-strong: #403d38;
  --accent: #93a8ec;
  --accent-hover: #adbdf2;
  --accent-ink: #141412;
  --accent-soft: #232a3e;

  --st-nuovo: #a8a49b;
  --st-riaperto: #ef7a64;
  --st-in_lavorazione: #e0a33a;
  --st-pronto: #5cb8c9;
  --st-pubblicato: #7fbf6a;
  --st-risolto: #5fbf92;
  --st-chiuso: #7c786f;
  --sev-bassa: #7c786f;
  --sev-media: #d9ad2b;
  --sev-alta: #e58a45;
  --sev-critica: #ef7a64;
  --type-bug: #ef7a64;

  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-secondary-color: var(--ink-2);
  --bs-tertiary-color: var(--ink-3);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--line);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 147, 168, 236;
  --bs-link-hover-color: var(--accent-hover);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5 { letter-spacing: -.01em; color: var(--ink); }
.mono { font-family: var(--mono); }
::selection { background: var(--accent-soft); }

/* --- Superfici Bootstrap --- */
.card, .list-group, .modal-content, .dropdown-menu, .toast {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--line);
  --bs-card-border-radius: var(--radius);
  --bs-card-inner-border-radius: calc(var(--radius) - 1px);
  --bs-card-cap-bg: var(--surface-2);
  --bs-list-group-bg: var(--surface);
  --bs-list-group-border-color: var(--line);
  --bs-list-group-action-hover-bg: var(--surface-2);
  --bs-list-group-action-hover-color: var(--ink);
  --bs-modal-bg: var(--surface);
  --bs-modal-border-color: var(--line);
  --bs-modal-header-border-color: var(--line);
  --bs-modal-footer-border-color: var(--line);
  --bs-dropdown-bg: var(--surface);
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-link-hover-bg: var(--surface-2);
  --bs-dropdown-link-active-bg: var(--accent);
  --bs-dropdown-divider-bg: var(--line);
  --bs-toast-bg: var(--surface);
  --bs-toast-border-color: var(--line);
}
.dropdown-menu { box-shadow: 0 6px 20px rgba(30, 28, 24, .08); padding: .3rem; }
.dropdown-item { border-radius: 4px; font-size: .9rem; padding: .4rem .7rem; }
.form-control, .form-select {
  background-color: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.form-control::placeholder { color: var(--ink-3); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
  background-color: var(--surface);
  color: var(--ink);
}
.form-check-input { border-color: var(--line-strong); background-color: var(--surface); }
.form-check-input:checked, .form-check-input[type=checkbox]:indeterminate { background-color: var(--accent); border-color: var(--accent); }
.form-label { color: var(--ink); }
.form-text { color: var(--ink-3); }
.input-group-text { background: var(--surface); border-color: var(--line-strong); color: var(--ink-3); }
.breadcrumb { --bs-breadcrumb-divider-color: var(--ink-3); --bs-breadcrumb-item-active-color: var(--ink-3); font-size: .82rem; }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
hr { border-color: var(--line); opacity: 1; }
kbd { font-family: var(--mono); font-size: .72em; padding: .1em .35em; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; }
code { font-family: var(--mono); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); padding: .05em .3em; border-radius: 4px; font-size: .85em; }

/* --- Bottoni --- */
.btn { --bs-btn-font-weight: 500; --bs-btn-border-radius: var(--radius-sm); transition: background-color .15s, border-color .15s, color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: var(--accent-ink);
  --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover); --bs-btn-hover-color: var(--accent-ink);
  --bs-btn-active-bg: var(--accent-hover); --bs-btn-active-border-color: var(--accent-hover); --bs-btn-active-color: var(--accent-ink);
  --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); --bs-btn-disabled-color: var(--accent-ink);
}
.btn-outline-primary {
  --bs-btn-color: var(--accent); --bs-btn-border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  --bs-btn-hover-bg: var(--accent-soft); --bs-btn-hover-color: var(--accent); --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-bg: var(--accent-soft); --bs-btn-active-color: var(--accent); --bs-btn-active-border-color: var(--accent);
}
.btn-outline-secondary {
  --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line-strong); --bs-btn-bg: var(--surface);
  --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line-strong);
  --bs-btn-active-bg: var(--surface-2); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--ink-3);
}
.btn-success {
  --bs-btn-bg: var(--st-pubblicato); --bs-btn-border-color: var(--st-pubblicato); --bs-btn-color: #fff;
  --bs-btn-hover-bg: color-mix(in srgb, var(--st-pubblicato) 85%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--st-pubblicato) 85%, #000);
}
.btn-danger, .btn-outline-danger { --bs-btn-color: var(--st-riaperto); --bs-btn-border-color: color-mix(in srgb, var(--st-riaperto) 50%, transparent); --bs-btn-hover-bg: var(--st-riaperto); --bs-btn-hover-border-color: var(--st-riaperto); --bs-btn-hover-color: #fff; }
.btn-danger { --bs-btn-bg: var(--st-riaperto); --bs-btn-color: #fff; }
[data-bs-theme="dark"] .btn-success, [data-bs-theme="dark"] .btn-danger { --bs-btn-color: #141412; }
.btn-icon { border: 0; background: transparent; color: var(--ink-2); width: 2rem; height: 2rem; display: inline-grid; place-items: center; border-radius: var(--radius-sm); }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-link { --bs-btn-color: var(--accent); --bs-btn-hover-color: var(--accent-hover); }
.link-danger { color: var(--st-riaperto) !important; }
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--line); --bs-pagination-color: var(--ink-2); --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-hover-color: var(--ink); --bs-pagination-active-bg: var(--ink); --bs-pagination-active-border-color: var(--ink); --bs-pagination-active-color: var(--paper); font-family: var(--mono); }
.progress { --bs-progress-bg: var(--line); --bs-progress-bar-bg: var(--accent); border-radius: 2px; }
.alert-info { --bs-alert-bg: var(--accent-soft); --bs-alert-border-color: color-mix(in srgb, var(--accent) 25%, transparent); --bs-alert-color: var(--ink); }
.alert-secondary { --bs-alert-bg: var(--surface-2); --bs-alert-border-color: var(--line); --bs-alert-color: var(--ink-2); }

/* --- Navbar --- */
.app-nav { background: var(--surface); border-bottom: 1px solid var(--line); padding-top: .55rem; padding-bottom: .55rem; }
.app-nav > .container-xl { flex-wrap: nowrap; gap: .5rem; }
.min-w-0 { min-width: 0; }
.navbar-brand { color: var(--ink); font-weight: 600; font-size: 1rem; margin-right: .25rem; }
.navbar-brand:hover { color: var(--ink); }
.brand-mark {
  width: 1.9rem; height: 1.9rem; border-radius: var(--radius-sm);
  display: inline-grid; place-items: center;
  background: var(--ink); color: var(--paper); font-size: 1rem;
  transition: transform .25s var(--ease);
}
.navbar-brand:hover .brand-mark { transform: rotate(-8deg); }
.brand-mark-lg { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; border-radius: var(--radius); }
.btn-project {
  background: transparent; border: 1px solid var(--line-strong); color: var(--ink); font-weight: 500;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-project:hover, .btn-project.show { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 2px; background: var(--c); margin-right: .5rem; flex-shrink: 0; vertical-align: .05em; }
.project-swatch { display: inline-block; width: .5rem; height: 1.8rem; border-radius: 2px; background: var(--c); vertical-align: middle; }
.project-pill { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 500; color: var(--ink-2); border: 1px solid var(--line-strong); border-radius: 999px; padding: .25rem .7rem; }
.project-pill::before { content: ''; width: .5rem; height: .5rem; border-radius: 2px; background: var(--c); }
[data-bs-theme="light"] .theme-light-hide, [data-bs-theme="dark"] .theme-dark-hide { display: none; }

/* --- Avatar --- */
.avatar {
  --h: 220;
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  color: hsl(var(--h) 30% 28%); background: hsl(var(--h) 28% 88%);
}
[data-bs-theme="dark"] .avatar { color: hsl(var(--h) 30% 82%); background: hsl(var(--h) 14% 26%); }
.avatar-sm { width: 1.6rem; height: 1.6rem; font-size: .62rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1rem; }

/* --- Etichette: stato, gravità, tipo, ambito, build --- */
.status {
  --c: var(--st-nuovo);
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .76rem; font-weight: 500; line-height: 1; white-space: nowrap;
  color: var(--c); padding: .32rem .55rem .32rem .5rem;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  border-radius: 999px; background: color-mix(in srgb, var(--c) 6%, var(--surface));
}
.status::before { content: ''; width: .45rem; height: .45rem; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.status-nuovo { --c: var(--st-nuovo); }
.status-riaperto { --c: var(--st-riaperto); }
.status-in_lavorazione { --c: var(--st-in_lavorazione); }
.status-pronto { --c: var(--st-pronto); }
.status-pubblicato { --c: var(--st-pubblicato); }
.status-risolto { --c: var(--st-risolto); }
.status-risolto::before { content: '✓'; width: auto; height: auto; background: none; font-size: .7rem; font-weight: 700; }
.status-chiuso { --c: var(--st-chiuso); }
.status-plain { border: 0; background: none; padding: 0; }

.sev { --c: var(--sev-media); display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; color: var(--ink-2); white-space: nowrap; }
.sev-meter { display: inline-flex; align-items: flex-end; gap: 2px; height: .75rem; }
.sev-meter i { display: block; width: 3px; border-radius: 1px; background: var(--line-strong); }
.sev-meter i:nth-child(1) { height: 35%; }
.sev-meter i:nth-child(2) { height: 55%; }
.sev-meter i:nth-child(3) { height: 78%; }
.sev-meter i:nth-child(4) { height: 100%; }
.sev-bassa   { --c: var(--sev-bassa); }
.sev-media   { --c: var(--sev-media); }
.sev-alta    { --c: var(--sev-alta); }
.sev-critica { --c: var(--sev-critica); }
.sev.sev-critica { color: var(--sev-critica); font-weight: 600; }
.sev-bassa .sev-meter i:nth-child(-n+1),
.sev-media .sev-meter i:nth-child(-n+2),
.sev-alta .sev-meter i:nth-child(-n+3),
.sev-critica .sev-meter i:nth-child(-n+4) { background: var(--c); }

.type { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.type i { font-size: .9rem; }
.type-bug i { color: var(--type-bug); }
.type-feature i { color: var(--type-feature); }

.tag { display: inline-flex; align-items: center; font-size: .74rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: .15rem .45rem; white-space: nowrap; }
.role-tag { font-size: .62rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 3px; padding: .08rem .3rem; vertical-align: .1em; }
.build-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--mono); font-size: .72rem; font-weight: 500; color: var(--ink-2);
  padding: .2rem .45rem; border-radius: 4px; border: 1px dashed var(--line-strong); background: var(--surface);
  white-space: nowrap;
}
.build-chip i { color: var(--ink-3); }
.pop { animation: pop .3s var(--ease); }
@keyframes pop { from { transform: scale(.88); opacity: .3 } to { transform: none; opacity: 1 } }

/* --- Ingresso discreto --- */
.page-enter { animation: fadeIn .22s ease-out both; }
.stagger { animation: fadeUp .28s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }

/* --- Titoli di pagina --- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-title { font-size: 1.5rem; font-weight: 600; margin: 0; }
.page-sub { color: var(--ink-2); margin: .15rem 0 0; font-size: .9rem; }
.eyebrow { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.section-title { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: .75rem; }

/* --- Home: progetti --- */
.project-card { position: relative; display: block; height: 100%; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; border-left: 4px solid var(--c); }
.project-card:hover { border-color: var(--line-strong); border-left-color: var(--c); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(30, 28, 24, .06); color: inherit; }
.project-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px dashed var(--line-strong); margin-top: 1rem; padding-top: .85rem; }
.project-stats div { text-align: left; }
.project-stats b { display: block; font-family: var(--mono); font-size: 1.15rem; font-weight: 500; color: var(--ink); line-height: 1.2; }
.project-stats span { font-size: .72rem; color: var(--ink-3); }
.project-stats .hot b { color: var(--st-riaperto); }
.progress-thin { height: 4px; }

/* --- Stato vuoto --- */
.empty-state { padding: 3.5rem 1rem; text-align: center; }
.empty-icon {
  width: 4rem; height: 4rem; margin: 0 auto 1rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.6rem; color: var(--ink-3);
  border: 1.5px dashed var(--line-strong);
}

/* --- Schede di stato (sottolineate) --- */
.tabs-scroll { overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.status-tabs { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; flex-wrap: nowrap; }
.status-tabs .nav-link {
  position: relative; display: inline-flex; align-items: center; gap: .4rem;
  white-space: nowrap; color: var(--ink-2); font-weight: 500; font-size: .88rem;
  padding: .55rem 0 .7rem; border: 0; background: none; border-radius: 0;
  transition: color .15s;
}
.status-tabs .nav-link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--ink); transform: scaleX(0); transition: transform .2s var(--ease);
}
.status-tabs .nav-link:hover { color: var(--ink); }
.status-tabs .nav-link.active { color: var(--ink); }
.status-tabs .nav-link.active::after { transform: scaleX(1); }
.tab-dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--c, var(--ink-3)); }
.tab-count { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); font-weight: 400; transition: color .2s; }
.nav-link.active .tab-count { color: var(--ink-2); }
.tab-count.bump { animation: pop .3s var(--ease); }

/* --- Filtri --- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filter-bar .search { flex: 1 1 260px; min-width: 200px; }
.filter-bar .form-select { width: auto; min-width: 0; flex: 0 1 auto; }
.btn-check:checked + .btn-filter { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* --- Lista ticket --- */
.ticket-list { overflow: hidden; }
.ticket-list-head {
  display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  font-size: .78rem; color: var(--ink-3);
}
.ticket-row {
  --sev-c: var(--line-strong);
  position: relative; display: flex; align-items: center; gap: .9rem;
  padding: .7rem 1rem .7rem 1.1rem;
  border-bottom: 1px solid var(--line);
  transition: background-color .12s;
}
.ticket-row:last-child { border-bottom: 0; }
.ticket-row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sev-c); }
.ticket-row.sev-bassa   { --sev-c: var(--line-strong); }
.ticket-row.sev-media   { --sev-c: var(--sev-media); }
.ticket-row.sev-alta    { --sev-c: var(--sev-alta); }
.ticket-row.sev-critica { --sev-c: var(--sev-critica); }
.ticket-row:hover { background: var(--surface-2); }
.ticket-row.selected { background: var(--accent-soft); }
.ticket-row .form-check-input { position: relative; z-index: 2; margin: 0; flex-shrink: 0; }
.ticket-num { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); width: 2.6rem; flex-shrink: 0; }
.ticket-type { font-size: 1rem; width: 1.1rem; text-align: center; flex-shrink: 0; }
.ticket-type .bi-bug { color: var(--type-bug); }
.ticket-type .bi-stars { color: var(--type-feature); }
.ticket-main { min-width: 0; flex: 1; }
.ticket-title {
  display: block; color: var(--ink); font-weight: 500; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticket-title:hover { color: var(--accent); }
.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .9rem; font-size: .76rem; color: var(--ink-3); margin-top: .2rem; }
.ticket-meta .sev { font-size: .74rem; }
.ticket-side { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; position: relative; z-index: 2; }
.btn-next {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font-size: .78rem; padding: .25rem .5rem;
  opacity: .0; transition: opacity .15s, color .15s, border-color .15s;
}
.ticket-row:hover .btn-next, .btn-next:focus-visible { opacity: 1; }
@media (hover: none) { .btn-next { opacity: 1; } }
.btn-next:hover { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.ticket-row.leaving { animation: rowOut .35s var(--ease) forwards; }
@keyframes rowOut {
  0%   { opacity: 1; max-height: 120px; }
  45%  { opacity: 0; max-height: 120px; }
  100% { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; border-width: 0; }
}
.ticket-row.flash { animation: rowFlash .9s ease-out; }
@keyframes rowFlash { from { background: var(--accent-soft) } to { background: transparent } }

@media (max-width: 575.98px) {
  .ticket-row { flex-wrap: wrap; row-gap: .4rem; }
  .ticket-num { width: auto; }
  .ticket-side { width: 100%; padding-left: 2.1rem; }
  .ticket-title { white-space: normal; }
}

/* --- Barra azioni multiple --- */
#bulkForm { padding-bottom: 4.5rem; }
.bulk-bar {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 1040;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: center;
  max-width: calc(100% - 2rem);
  padding: .55rem .7rem .55rem 1rem; border-radius: var(--radius);
  background: var(--ink); color: var(--paper);
  box-shadow: 0 10px 30px rgba(20, 18, 15, .25);
  transform: translate(-50%, 130%); opacity: 0; pointer-events: none;
  transition: transform .25s var(--ease), opacity .2s;
}
.bulk-bar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.bulk-bar .form-select, .bulk-bar .form-control { width: auto; min-width: 10rem; }
.bulk-bar .btn-apply { background: var(--paper); color: var(--ink); border: 0; font-weight: 600; }
.bulk-bar .btn-apply:hover { background: var(--surface-2); }
.bulk-bar .btn-clear { color: color-mix(in srgb, var(--paper) 60%, transparent); }
.bulk-bar .btn-clear:hover { color: var(--paper); }
#bulkCount { font-family: var(--mono); }

/* --- Modulo nuova segnalazione --- */
.form-sheet { padding: 0; overflow: hidden; }
.form-step { padding: 1.4rem 1.5rem; border-bottom: 1px dashed var(--line-strong); }
.form-step:last-of-type { border-bottom: 0; }
.step-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .85rem; }
.step-num { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); }
.step-title { font-weight: 600; font-size: .98rem; }
.step-opt { font-size: .8rem; color: var(--ink-3); }
.form-sheet-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.5rem; background: var(--surface-2); border-top: 1px solid var(--line); }
@media (max-width: 575.98px) { .form-step { padding: 1.1rem 1rem; } .form-sheet-foot { padding: .9rem 1rem; } }

.choice-card {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; height: 100%;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.choice-card i { font-size: 1.35rem; color: var(--ink-3); transition: color .15s; }
.choice-card small { display: block; color: var(--ink-3); font-size: .78rem; }
.choice-card:hover { border-color: var(--ink-3); }
.btn-check:checked + .choice-card { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.btn-check:checked + .choice-card[data-tone="bug"] i { color: var(--type-bug); }
.btn-check:checked + .choice-card[data-tone="feature"] i { color: var(--type-feature); }
.btn-check:focus-visible + .choice-card, .btn-check:focus-visible + .sev-option, .btn-check:focus-visible + .chip { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip {
  display: inline-block; font-size: .85rem; padding: .35rem .8rem; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); background: var(--surface);
  transition: background-color .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-check:checked + .chip { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.severity-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
@media (max-width: 575.98px) { .severity-picker { grid-template-columns: repeat(2, 1fr); } }
.sev-option {
  display: flex; flex-direction: column; gap: .3rem;
  padding: .75rem .85rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.sev-option .sev { font-size: .9rem; color: var(--ink); font-weight: 600; }
.sev-option .sev-meter { height: .9rem; }
.sev-option .sev-meter i { width: 4px; }
.sev-option small { color: var(--ink-3); font-size: .75rem; line-height: 1.35; }
.sev-option:hover { border-color: var(--ink-3); }
.btn-check:checked + .sev-option { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.hint-feature, .sev-label-feature { display: none; }
.is-feature .hint-feature, .is-feature .sev-label-feature { display: inline; }
.is-feature .hint-bug, .is-feature .sev-label-bug { display: none; }

/* --- Dropzone --- */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2);
  transition: border-color .15s, background-color .15s;
}
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-label { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 1.4rem 1rem; text-align: center; cursor: pointer; margin: 0; color: var(--ink-2); font-size: .9rem; }
.dropzone-label > i { font-size: 1.5rem; color: var(--ink-3); }
.dropzone-label u { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.dropzone-label small { color: var(--ink-3); font-size: .76rem; }
.dropzone-compact .dropzone-label { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: .5rem .75rem; font-size: .82rem; gap: .5rem; }
.dropzone-compact .dropzone-label > i { font-size: 1rem; }
.dropzone-compact .dropzone-label small { display: none; }
.dropzone-previews { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1rem; }
.dropzone-previews:not(:empty) { padding: 0 1rem 1rem; }
.dz-thumb {
  position: relative; width: 88px; height: 88px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line-strong);
  animation: pop .25s var(--ease);
}
.dz-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dz-thumb .dz-remove {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 4px; border: 0;
  background: var(--ink); color: var(--paper); font-size: .65rem; display: grid; place-items: center;
  opacity: 0; transition: opacity .12s;
}
.dz-thumb:hover .dz-remove, .dz-remove:focus-visible { opacity: 1; }
@media (hover: none) { .dz-thumb .dz-remove { opacity: 1; } }
.dz-thumb .dz-size { position: absolute; left: 0; right: 0; bottom: 0; font-family: var(--mono); font-size: .6rem; color: var(--ink-2); background: var(--surface); border-top: 1px solid var(--line); padding: 1px 4px; }

/* --- Matrice del ticket (testata con strappo) --- */
.ticket-stub {
  --notch: 18px;
  position: relative; display: grid; grid-template-columns: 9.5rem 1fr;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.stub-id {
  position: relative; padding: 1.25rem 1.1rem; border-right: 1.5px dashed var(--line-strong);
  display: flex; flex-direction: column; gap: .35rem;
}
/* tacche dello strappo */
.stub-id::before, .stub-id::after {
  content: ''; position: absolute; right: calc(var(--notch) / -2 - 1px); width: var(--notch); height: var(--notch);
  border-radius: 50%; background: var(--paper); border: 1px solid var(--line);
}
.stub-id::before { top: calc(var(--notch) / -2 - 1px); clip-path: inset(50% 0 0 0); }
.stub-id::after { bottom: calc(var(--notch) / -2 - 1px); clip-path: inset(0 0 50% 0); }
.stub-num { font-family: var(--mono); font-size: 1.9rem; font-weight: 500; line-height: 1; color: var(--ink); letter-spacing: -.02em; }
.stub-project { font-size: .78rem; color: var(--ink-2); display: flex; align-items: center; }
.stub-body { padding: 1.25rem 1.4rem 1.1rem; min-width: 0; }
.stub-title { font-size: 1.4rem; font-weight: 600; line-height: 1.3; margin: 0 0 .7rem; overflow-wrap: anywhere; }
.stub-labels { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.stub-actions { position: absolute; top: .75rem; right: .75rem; }
@media (max-width: 767.98px) {
  .ticket-stub { grid-template-columns: 1fr; }
  .stub-id { flex-direction: row; align-items: baseline; justify-content: space-between; border-right: 0; border-bottom: 1.5px dashed var(--line-strong); padding: .9rem 1rem; }
  .stub-id::before { top: auto; bottom: calc(var(--notch) / -2 - 1px); left: calc(var(--notch) / -2 - 1px); right: auto; clip-path: inset(0 0 0 50%); }
  .stub-id::after { bottom: calc(var(--notch) / -2 - 1px); right: calc(var(--notch) / -2 - 1px); clip-path: inset(0 50% 0 0); }
  .stub-num { font-size: 1.4rem; }
  .stub-body { padding: 1rem; }
  .stub-title { font-size: 1.2rem; padding-right: 2.5rem; }
  .stub-actions { top: auto; right: .6rem; bottom: auto; margin-top: -2.4rem; position: relative; text-align: right; height: 0; }
}

/* Avanzamento */
.stepper { list-style: none; display: flex; padding: 1rem 0 0; margin: 1rem 0 0; border-top: 1px solid var(--line); }
.step { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; }
.step::before { content: ''; position: absolute; top: .45rem; right: 50%; width: 100%; height: 2px; background: var(--line); }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--ink); }
.step-dot {
  position: relative; z-index: 1; width: 1rem; height: 1rem; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-strong);
  display: grid; place-items: center; font-size: .6rem; color: var(--paper);
  transition: all .2s var(--ease);
}
.step.done .step-dot { background: var(--ink); border-color: var(--ink); }
.step.current .step-dot { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 10px var(--ink); }
.step-label { font-size: .74rem; color: var(--ink-3); }
.step.done .step-label { color: var(--ink-2); }
.step.current .step-label { color: var(--ink); font-weight: 600; }
@media (max-width: 575.98px) { .step-label { font-size: .64rem; } }

.ticket-desc { font-size: .96rem; line-height: 1.65; overflow-wrap: anywhere; }
.env-line { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .76rem; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface-2); padding: .25rem .55rem; border-radius: 4px; }
.verify-card { border-color: color-mix(in srgb, var(--st-pubblicato) 40%, var(--line)); border-left: 4px solid var(--st-pubblicato); }
.verify-icon { width: 2.4rem; height: 2.4rem; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 1.1rem; color: var(--st-pubblicato); border: 1px solid color-mix(in srgb, var(--st-pubblicato) 35%, transparent); }

.gallery { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.gallery-item { display: block; width: 116px; height: 86px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line-strong); background: var(--surface-2); transition: border-color .15s; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s var(--ease); }
.gallery-item:hover { border-color: var(--ink-3); }
.gallery-item:hover img { transform: scale(1.04); }

/* Cronologia */
.timeline { position: relative; }
.timeline::before { content: ''; position: absolute; left: .8rem; top: .4rem; bottom: .4rem; width: 1px; background: var(--line-strong); }
.tl-item { position: relative; display: flex; gap: .75rem; margin-bottom: 1rem; }
.tl-icon {
  position: relative; z-index: 1; width: 1.6rem; height: 1.6rem; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%; font-size: .72rem;
  background: var(--paper); border: 1px solid var(--line-strong); color: var(--ink-2);
}
.tl-text { padding-top: .15rem; color: var(--ink-2); }
.tl-text b { color: var(--ink); font-weight: 600; }
.tl-time { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); }
.tl-note { margin-top: .4rem; padding: .55rem .75rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); font-size: .86rem; color: var(--ink); }
.tl-avatar { position: relative; z-index: 1; }
.tl-avatar .avatar { box-shadow: 0 0 0 3px var(--paper); }
.tl-bubble { flex: 1; min-width: 0; padding: .7rem .9rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; }
.tl-bubble.from-admin { border-left: 3px solid var(--accent); }
.tl-item:target .tl-bubble, .tl-item:target .tl-note { animation: rowFlash 1.4s ease-out; }
.comment-form textarea { resize: none; }

.side-card .card-body { padding: 1.1rem 1.2rem; }
.side-title { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .8rem; }
.status-extra { display: none; }
.status-extra.show { display: block; animation: fadeIn .2s ease-out; }
.details-list { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; font-size: .85rem; }
.details-list dt { font-weight: 400; color: var(--ink-3); }
.details-list dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* --- Lightbox --- */
.lightbox .modal-dialog { max-width: min(1400px, 95vw); }
.lightbox-stage { position: relative; display: grid; place-items: center; min-height: 40vh; }
.lightbox-stage img { max-width: 100%; max-height: 85vh; border-radius: var(--radius-sm); background: #fff; }
.lb-btn {
  position: absolute; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-sm); border: 0;
  background: rgba(20, 18, 15, .7); color: #fff; display: grid; place-items: center; font-size: 1rem;
  transition: background-color .15s;
}
.lb-btn:hover { background: rgba(20, 18, 15, .9); }
.lb-prev { left: .5rem; top: 50%; margin-top: -1.25rem; }
.lb-next { right: .5rem; top: 50%; margin-top: -1.25rem; }
.lb-close { right: .5rem; top: .5rem; }
.lightbox-caption { text-align: center; color: #e9e6df; font-family: var(--mono); font-size: .78rem; margin-top: .6rem; }
.lightbox-caption a { color: #e9e6df; }
.modal-backdrop { --bs-backdrop-bg: #14120f; }
.modal-backdrop.show { --bs-backdrop-opacity: .8; }

/* --- Changelog --- */
.changelog { position: relative; padding-left: 1.75rem; }
.changelog::before { content: ''; position: absolute; left: .4rem; top: .8rem; bottom: .5rem; width: 1px; background: var(--line-strong); }
.cl-build { position: relative; margin-bottom: 1.25rem; }
.cl-marker { position: absolute; left: -1.75rem; top: 1.15rem; width: .85rem; height: .85rem; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.cl-build:first-child .cl-marker { background: var(--ink); }
.cl-version { font-family: var(--mono); font-size: 1.1rem; font-weight: 500; }
.cl-list li { padding: .25rem 0; display: flex; gap: .6rem; align-items: baseline; }
.cl-list .ticket-num { width: auto; }
.cl-list a { color: var(--ink); text-decoration: none; }
.cl-list a:hover { color: var(--accent); }

/* --- Toast --- */
.toast-container { z-index: 1090; }
.toast { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line) !important; box-shadow: 0 8px 24px rgba(30, 28, 24, .1); font-size: .88rem; }
.toast.showing, .toast.show { animation: toastIn .25s var(--ease); }
@keyframes toastIn { from { transform: translateY(-6px); opacity: 0 } to { transform: none; opacity: 1 } }
.toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.toast-success::before { background: var(--st-pubblicato); }
.toast-success .toast-body i { color: var(--st-pubblicato); }
.toast-danger::before { background: var(--st-riaperto); }
.toast-danger .toast-body i { color: var(--st-riaperto); }
.toast-warning::before { background: var(--sev-media); }
.toast-warning .toast-body i { color: var(--sev-media); }

/* --- Pagine di accesso: un biglietto --- */
.auth-body { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-ticket {
  --notch: 22px;
  position: relative; width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -20px rgba(30, 28, 24, .25);
}
.auth-head { display: flex; align-items: center; gap: .75rem; padding: 1.4rem 1.6rem 1.2rem; }
.auth-head .eyebrow { display: block; }
.auth-head .auth-app { font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.auth-tear { position: relative; height: 0; border-top: 1.5px dashed var(--line-strong); margin: 0 1rem; }
.auth-tear::before, .auth-tear::after {
  content: ''; position: absolute; top: calc(var(--notch) / -2 - 1px); width: var(--notch); height: var(--notch);
  border-radius: 50%; background: var(--paper); border: 1px solid var(--line);
}
.auth-tear::before { left: calc(-1rem - var(--notch) / 2 - 1px); clip-path: inset(0 0 0 50%); }
.auth-tear::after { right: calc(-1rem - var(--notch) / 2 - 1px); clip-path: inset(0 50% 0 0); }
.auth-body-inner { padding: 1.5rem 1.6rem 1.7rem; }
.auth-title { font-size: 1.3rem; font-weight: 600; margin-bottom: .25rem; }
.auth-foot { font-size: .8rem; color: var(--ink-3); text-align: center; margin-top: 1rem; }
.form-floating > .form-control, .form-floating > .form-select { height: calc(3.25rem + 2px); min-height: calc(3.25rem + 2px); }
.form-floating > label { color: var(--ink-3); }
.form-floating > .form-control:focus ~ label, .form-floating > .form-control:not(:placeholder-shown) ~ label { color: var(--ink-2); }
.form-floating > .form-control:focus ~ label::after, .form-floating > .form-control:not(:placeholder-shown) ~ label::after { background: transparent; }

/* --- Admin --- */
.invite-box { font-family: var(--mono); font-size: .8rem; }
.member-row + .member-row { border-top: 1px solid var(--line); padding-top: .6rem; }

/* --- Movimento ridotto --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
