/* ============================================================
   app.css — application-specific styles for Autopilot.
   Loaded AFTER colors_and_type.css, components.css, layout.css.
   Only put here rules that are NOT part of the design system —
   page-level layout, page-specific components, modifiers.
   ============================================================ */

/* ---------- Global reset ---------- */
html, body { height: 100%; margin: 0; }

/* Inline-svg icons used everywhere (.icon class is added by lib/icons.php). */
.icon { display: inline-block; vertical-align: middle; flex: none; }

a.sidebar__item, a.brand { text-decoration: none; }

/* The logout form sits in the topbar; kill its default block margin. */
.topbar__right form { margin: 0; }

/* ---------- Sidebar supplements ---------- */
.sidebar__item .icon { color: currentColor; }
.sidebar__item--disabled { opacity: 0.45; cursor: not-allowed; }
.sidebar__item--disabled:hover {
  background: transparent;
  color: var(--text-secondary);
}

/* Per-project sidebar dot colors. Hardcoded list mirrors KNOWN_PROJECTS
   in lib/layout.php — kept in CSS (not inline style="...") so we can
   ship a strict CSP without style-src-attr 'unsafe-inline'. */
.sidebar__dot--hub            { background: #2ECC8E; }
.sidebar__dot--hqconcretis    { background: #eab308; }
.sidebar__dot--isoleelleniche { background: #6E61F1; }
.sidebar__dot--mailerkeipiai  { background: #3b82f6; }
.sidebar__dot--migliorirobot  { background: #ec4899; }

/* ---------- Topbar status pill ----------
   Hidden on tablet/phone via layout.css responsive rules. Desktop styling
   is scoped to ≥1025px so it does NOT override the @media hide rule. */
@media (min-width: 1025px) {
  .topbar__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 0 8px;
    height: 24px;
    border-radius: 9999px;
    background: var(--bg-overlay);
  }
}
.topbar__status .dot-success {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-success);
}
.topbar__status .label {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ---------- Page header / actions ---------- */
.page__header__actions { display: flex; gap: 8px; }

/* ============ v2 Dashboard ============ */
/* Sys-strip: daemon, locks, spend, rate-limit in una riga */
.sys-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.sys-strip__item { display: flex; align-items: center; gap: 6px; }
.sys-strip__item .dot-success,
.sys-strip__item .dot-warning,
.sys-strip__item .dot-danger {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
}
.sys-strip__item .dot-success { background: var(--status-success); }
.sys-strip__item .dot-warning { background: var(--status-warning); }
.sys-strip__item .dot-danger  { background: var(--status-danger); }
.sys-strip__sep { width: 1px; height: 14px; background: var(--border-subtle); }
.sys-strip__label { color: var(--text-tertiary); }
.sys-strip__num {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 500;
}
.sys-strip__num--accent  { color: var(--accent); }
.sys-strip__num--success { color: var(--status-success); }
.sys-strip__num--warning { color: var(--status-warning); }
.sys-strip__num--danger  { color: var(--status-danger); }
.sys-strip__meta {
  color: var(--text-tertiary);
  font-size: 11px;
  font-family: var(--font-mono);
}

/* Project matrix */
.matrix {
  padding: 0;
  overflow-x: auto;
  /* Hint visivo a destra: gradient che lascia intuire "c'è altro a destra"
     su mobile dove la tabella scrolla. Su desktop dove la tabella sta tutta
     dentro il viewport, l'effetto è impercettibile. */
  background:
    linear-gradient(to right, var(--bg-elevated), var(--bg-elevated)) left center,
    linear-gradient(to right, transparent, var(--bg-base)) right center;
  background-repeat: no-repeat;
  background-size: 20px 100%, 20px 100%;
  background-attachment: local, scroll;
}
.matrix__table { width: 100%; border-collapse: collapse; min-width: 720px; }
.matrix__table th, .matrix__table td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
.matrix__table th {
  background: var(--bg-overlay);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 500;
}
.matrix__table tr + tr { border-top: 1px solid var(--border-subtle); }
.matrix__table tbody tr:hover { background: var(--bg-overlay); }
.matrix__proj {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-primary); text-decoration: none;
  font-weight: 500;
}
.matrix__proj:hover { color: var(--accent); }
.matrix__proj-domain {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: 18px;
  margin-top: 2px;
  font-family: var(--font-mono);
}
.matrix__metric { font-family: var(--font-mono); }
.matrix__num {
  display: block;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}
.matrix__hint { font-size: 11px; color: var(--text-secondary); display: block; }
.matrix__alert {
  color: var(--status-warning);
  text-decoration: none;
  border-bottom: 1px dotted var(--status-warning);
  font-family: var(--font-sans);
}
.matrix__alert:hover { border-bottom-style: solid; }

/* Dashboard sections (needs human + recent activity) */
.dash-section { margin-top: 22px; }
.dash-section__head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px;
}
.dash-section__title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-weight: 500;
}
.dash-section__link {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
}
.dash-list { display: flex; flex-direction: column; gap: 6px; }
.dash-list__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.dash-list__item:hover {
  background: var(--bg-overlay);
  border-color: var(--border-default);
}
.dash-list__item--alert { border-left: 3px solid var(--status-warning); }
.dash-list__item--compact { padding: 6px 14px; }
.dash-list__title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-list__meta {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.dash-list__when {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  width: 56px;
  flex-shrink: 0;
}
.dash-list--compact .dash-list__item { padding: 6px 14px; }
.page__subtitle {
  display: block;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.page__subtitle code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- Report detail (Fase 13.A) ---------- */
.report-detail { padding: 0; }
.report-detail__body {
  margin: 0;
  padding: var(--space-6);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--surface-1);
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: var(--radius-md);
  overflow-x: auto;
}

/* ---------- Dashboard grid (responsive collapses live in layout.css) ---------- */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.dash-cols {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 12px;
}

/* ---------- Inline note / small text ---------- */
.note {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ---------- Empty states ---------- */
.empty-state {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.empty-state p { margin: 0; }
.empty-state a:not(.btn) { color: var(--accent); text-decoration: none; }
.empty-state a:not(.btn):hover { text-decoration: underline; }

/* ---------- Card variants ---------- */
.card--flush { padding: 0; }
.card--flush .table { margin: 0; }
.card--space-top { margin-top: var(--space-6); }
.card__heading {
  margin: 0 0 var(--space-4) 0;
  font-size: var(--text-md);
  font-weight: 600;
}

/* Section header inside a card (icon + title + meta). */
.card-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.card-section__title {
  font-size: 13px;
  font-weight: 600;
}
.card-section__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Flash banner (success / danger) ---------- */
.flash {
  border-left: 3px solid var(--border-default);
  margin-bottom: var(--space-4);
}
.flash--success { border-left-color: var(--status-success); }
.flash--danger  { border-left-color: var(--status-danger); }

/* ---------- Key/value grid (Stato sistema card) ---------- */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 6px;
  column-gap: 8px;
  font-size: 13px;
}

/* ---------- Activity feed link wrapper ---------- */
.feed__row--link { text-decoration: none; color: inherit; }

/* ---------- Vertical stacks ---------- */
.stack { display: flex; flex-direction: column; }
.stack--gap-3 { gap: 12px; }
.stack--gap-1 { gap: 6px; }

/* ---------- Stato attivi list rows ---------- */
.state-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.state-row__count {
  margin-left: auto;
  color: var(--text-secondary);
}

/* ---------- Stat tile tone modifiers ---------- */
.stat__value--warning { color: var(--status-warning); }
.stat__value--danger  { color: var(--status-danger); }

/* ---------- Reason code line under task title ---------- */
.task-reason {
  font-size: var(--text-xs);
  margin-top: 2px;
}

/* Inline row link inside tables: keeps the cell typography but signals
   clickability via underline-on-hover. */
.row-link {
  color: inherit;
  text-decoration: none;
}
.row-link:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Tasks list table: column widths ----------
   Layout: Titolo | Tipo | Stato | Project | Creato | Avviato | Finito.
   Titolo è la colonna principale (no width = grow). Le restanti hanno
   width fissa per evitare jitter quando i contenuti cambiano. */
.tasks-table th:nth-child(2) { width: 64px;  } /* Tipo (kind tag) */
.tasks-table th:nth-child(3) { width: 160px; } /* Stato */
.tasks-table th:nth-child(4) { width: 140px; } /* Project */
.tasks-table th:nth-child(n+5) {
  width: 90px;
  white-space: nowrap;
}
.tasks-table .col-id-inline { margin-right: 6px; }

/* Mobile: nasconde le colonne 5/6/7 (Creato/Avviato/Finito) per evitare
   overflow e il bug della cella -- orfana sotto la riga. */
@media (max-width: 640px) {
  .tasks-table th:nth-child(5), .tasks-table td:nth-child(5),
  .tasks-table th:nth-child(6), .tasks-table td:nth-child(6),
  .tasks-table th:nth-child(7), .tasks-table td:nth-child(7) {
    display: none;
  }
  /* Tutte le tabelle: i titoli lunghi (es. nomi file) wrappano invece di
     scappare a destra. La card --table-wrap ha già overflow-x ma
     preferiamo wrap del testo sui viewport stretti. */
  .card--table-wrap .table td a.link,
  .card--table-wrap .table td {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
}

/* ---------- Tasks: create-task form grid ---------- */
.new-task__grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-3);
  align-items: start;
}
.new-task__grid .field__label { padding-top: 8px; }
.new-task__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .new-task__grid { grid-template-columns: 1fr; gap: var(--space-2); }
  .new-task__grid .field__label { padding-top: 0; }
  .new-task__foot { justify-content: flex-end; }
  .new-task__foot .btn { width: 100%; justify-content: center; }
}

/* ---------- Task detail (server-rendered, <details>-based sections) ----------
   The kit's .section is JSX with .is-open class; here we use the native
   <details>/<summary> element so collapse works with no JS. */
details.section {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-5);
}
details.section[open] > summary .section__chevron { transform: rotate(90deg); }
details.section > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin-bottom: var(--space-2);
}
details.section > summary::-webkit-details-marker { display: none; }
details.section .section__chevron {
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}
details.section .section__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
details.section .section__meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
details.section .section__body {
  padding-left: 22px;
}

/* ---------- Lifecycle timeline ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border-subtle);
}
.timeline__row {
  display: grid;
  grid-template-columns: 16px 90px 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
}
.timeline__dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-tertiary);
  border: 2px solid var(--bg-elevated);
}
.timeline__dot--success { background: var(--status-success); }
.timeline__dot--info    { background: var(--status-info, var(--accent)); }
.timeline__dot--warning { background: var(--status-warning); }
.timeline__dot--danger  { background: var(--status-danger); }
.timeline__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.timeline__label {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}
.timeline__label .mono.tertiary { margin-right: 8px; }
@media (max-width: 640px) {
  .timeline__row { grid-template-columns: 16px 1fr; }
  .timeline__time { grid-column: 2; font-size: 11px; }
  .timeline__label { grid-column: 2; }
}

/* ---------- Worker events list (heartbeats) ---------- */
.events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.events__row {
  display: grid;
  grid-template-columns: 90px auto 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  font-size: 12px;
}
.events__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.events__type {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-overlay);
  white-space: nowrap;
}
.events__excerpt {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.events__tokens {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .events__row { grid-template-columns: 1fr; gap: 4px; }
  .events__excerpt { white-space: normal; }
}
/* Riga "in ascolto" mentre lo stream SSE è aperto e in attesa di eventi. */
.events__row--waiting { background: transparent; }
/* Badge "live" sullo streaming worker (task.php) — dot pulsante. */
.pill--xs { padding: 1px 6px; font-size: 10px; }
.pill--xs .dot { width: 5px; height: 5px; animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
  .pill--xs .dot { animation: none; }
}

/* ---------- Token rollup + Progress % (Fase 15 Strato 3) ---------- */
.rollup-progress { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rollup-progress__bar {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-base);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.rollup-progress__fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--status-success);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s ease-out;
}
.rollup-progress__meta { font-size: 12px; }
.rollup-progress__states { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rollup-fail { color: var(--status-danger); }

.rollup-tokens { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.rollup-tokens__total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}
.rollup-tokens__total-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rollup-tokens__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.rollup-tokens__table th,
.rollup-tokens__table td {
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.rollup-tokens__table th {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--weight-medium);
}
.rollup-tokens__table tr:last-child td { border-bottom: none; }

/* ---------- Analytics dashboard (Fase 10) ---------- */
.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 8px 0 16px;
}
.analytics-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.analytics-kpi__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}
.analytics-kpi__value {
  font-size: 22px;
  font-weight: var(--weight-medium);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.analytics-card { padding: 14px; }
.analytics-card--wide { grid-column: 1 / -1; }
.analytics-card__title {
  margin: 0 0 10px;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.analytics-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.analytics-table th, .analytics-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}
.analytics-table th {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--weight-medium);
}
.analytics-table tr:last-child td { border-bottom: none; }

.analytics-bar {
  width: 80px;
  height: 6px;
  background: var(--bg-base);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.analytics-bar__fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* ---------- Inbox table (Fase 15 Strato 4) ---------- */
.inbox-table { width: 100%; }
.inbox-table__check { width: 32px; }
.inbox-table__check input { margin: 0; }
.inbox-table__title { color: var(--text-primary); text-decoration: none; font-weight: var(--weight-medium); }
.inbox-table__title:hover { color: var(--accent); text-decoration: underline; }
.inbox-table__body {
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
  max-width: 600px;
}

/* ---------- Kanban view (Fase 15 Strato 4) ---------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 8px;
  align-items: start;
}
@media (max-width: 980px) {
  .kanban { grid-template-columns: 1fr; }
}
.kanban__lane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-height: 200px;
}
.kanban__lane--todo        { border-top: 3px solid var(--text-tertiary); }
.kanban__lane--in_progress { border-top: 3px solid var(--accent); }
.kanban__lane--done        { border-top: 3px solid var(--status-success); }
.kanban__lane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 4px 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.kanban__lane-title {
  margin: 0;
  font-size: 13px;
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kanban__lane-count { font-size: 12px; }
.kanban__lane-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban__lane-empty {
  padding: 24px 8px;
  text-align: center;
  font-size: 13px;
}
.kanban-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
}
.kanban-card:hover { border-color: var(--border-default); }
.kanban-card.is-selected { border-color: var(--accent); background: var(--accent-bg); }
.kanban-card__head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
}
.kanban-card__check { display: inline-flex; align-items: center; cursor: pointer; }
.kanban-card__check input { margin: 0; }
.kanban-card__id { font-size: 11px; }
.kanban-card__title {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
  font-weight: var(--weight-medium);
}
.kanban-card__title:hover { color: var(--accent); text-decoration: underline; }
.kanban-card__progress { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.kanban-card__progress-bar {
  width: 100%;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--bg-base);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.kanban-card__progress-fill {
  display: block;
  height: 100%;
  background: var(--status-success);
}
.kanban-card__progress-meta { font-size: 11px; }
.kanban-card__foot { font-size: 11px; padding-top: 4px; }

/* v2: card "needs attention" + container */
.kanban-card--alert {
  border-left: 3px solid var(--status-warning);
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.04), var(--bg-elevated) 16%);
}
.kanban-card--container {
  border-style: dashed;
}
.kanban-card__alert {
  font-size: 11px;
  color: var(--status-warning);
  font-family: var(--font-mono);
  padding: 2px 0;
}

/* ============ v2: split-view task + chat ============ */
.page--task-split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr);
  gap: 0;
  align-items: start;
}
.page--task-split .task-pane {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  padding: 18px 22px;
  min-width: 0;
}
.chat-pane {
  display: flex;
  flex-direction: column;
  background: #1a1726;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--brand-violet);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  min-height: 75vh;
  max-height: 90vh;
  position: sticky;
  top: 60px;
  overflow: hidden;
}
.chat-pane::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--brand-violet), transparent);
  opacity: 0.7;
}
.chat-pane__head {
  padding: 12px 16px;
  background: rgba(110, 97, 241, 0.12);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.chat-pane__agent-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand-violet);
  box-shadow: 0 0 0 3px rgba(110, 97, 241, 0.30);
}
.chat-pane__agent-name { font-weight: 600; }
.chat-pane__head-meta { color: var(--text-tertiary); font-size: 11px; }
.chat-pane__head-scope {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 11px;
}
.chat-pane__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-pane__empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-secondary);
  font-size: 13px;
}
.chat-pane__empty p { margin: 0 0 8px; line-height: 1.5; }
.chat-pane__empty code {
  background: rgba(0,0,0,0.30); padding: 1px 5px; border-radius: 3px;
  font-family: var(--font-mono); font-size: 12px;
}
.chat-pane__empty a { color: var(--accent); text-decoration: none; }
.chat-pane__empty a:hover { text-decoration: underline; }

.chat-pane .msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 88%;
  position: relative;
  /* Word-break sui messaggi: il container ha max-width:88%, ma se il body
   * contiene URL/hash/path lunghi senza spazi escono fuori (scrollbar
   * orizzontale durante streaming live). overflow-wrap:anywhere spezza
   * anche le parole non-breakable per stare nei limiti. */
  overflow-wrap: anywhere;
  word-break: break-word;
}
.chat-pane .msg .msg__content {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Sovrascrive le proprietà globali `pre { ... }` di colors_and_type.css
   * (overflow:auto + background/border/padding) che davano scrollbar
   * orizzontale durante streaming live e sporcavano il bubble parent. */
  overflow: hidden;
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
}
.chat-pane .msg--user {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(79, 142, 255, 0.20);
}
.chat-pane .msg--user code {
  background: rgba(255,255,255,0.15); color: white;
  padding: 1px 5px; border-radius: 3px;
  font-family: var(--font-mono); font-size: 12px;
}
.chat-pane .msg--asst {
  background: #221d33;
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(110, 97, 241, 0.15);
}
.chat-pane .msg--asst code {
  background: rgba(0,0,0,0.30); padding: 1px 5px; border-radius: 3px;
  font-family: var(--font-mono); font-size: 12px;
}
.chat-pane .msg__role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-violet);
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.chat-pane__input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(110, 97, 241, 0.04);
}
.chat-pane__input textarea {
  flex: 1;
  background: var(--bg-input);
  border: 2px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  resize: none;
  min-height: 42px;
  box-shadow: 0 0 0 3px rgba(79, 142, 255, 0.08);
  transition: box-shadow 150ms;
}
.chat-pane__input textarea:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(79, 142, 255, 0.18);
}
.chat-pane__hint {
  padding: 6px 16px 12px;
  font-size: 11px;
  margin: 0;
}

/* Mobile / narrow: stack verticale */
@media (max-width: 1100px) {
  .page--task-split { grid-template-columns: 1fr; }
  .page--task-split .task-pane { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .chat-pane {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-left: 1px solid var(--border-subtle);
    border-top: 3px solid var(--brand-violet);
    position: static;
    max-height: none;
  }
}

/* v2: project header persistente (apparirà su tutte le sotto-pagine del progetto) */
.proj-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.proj-header__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.proj-header__dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.proj-header__name { margin: 0; font-size: 22px; font-weight: 600; line-height: 1; }
.proj-header__meta {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.proj-header__actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .proj-header__actions { margin-left: 0; width: 100%; }
  .proj-header__actions .btn { flex: 1; justify-content: center; }
}
.kanban__legend { margin-top: 16px; font-size: 12px; text-align: center; }

/* Multi-select batch bar (Sub-B) */
.kanban-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}
.kanban-batch-bar[hidden] { display: none; }
.kanban-batch-bar__count {
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--accent);
}
.kanban-batch-bar__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Project plan card (Fase 15 Strato 3) ---------- */
.proposals--plans { border-left: 3px solid var(--brand-violet, var(--accent)); }
.plan {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
}
.plan--pending { border-color: var(--accent); background: var(--accent-bg); }
.plan__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.plan__title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
}
.plan__summary summary { font-size: 11px; cursor: pointer; }
.plan__summary-md {
  margin: 6px 0 0;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-sans);
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.5;
}
.plan__tasks-head {
  font-size: 12px;
  margin-top: 4px;
}
.plan__tasks {
  margin: 6px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.plan__tasks li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Chat proposals — pannello "Modifiche proposte" (Fase 15 Strato 2) ---------- */
.proposals {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  border-left: 3px solid var(--accent);
}
.proposals__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.proposals__title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
}
.proposals__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.proposals__list--compact { gap: 4px; }
.proposal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
}
.proposal--pending {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.proposal--decided {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  font-size: 12px;
}
.proposal__head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.proposal__body {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}
.proposal__details summary { font-size: 11px; cursor: pointer; }
.proposal__payload {
  margin: 6px 0 0;
  padding: 6px 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow: auto;
}
.proposal__actions { display: flex; gap: 8px; }
.proposals__decided summary { padding: 4px 0; }

/* ---------- Prod status dashboard (Fase 9.5) ---------- */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.prod-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.prod-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.prod-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.prod-card__domain {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prod-card__body { display: flex; flex-direction: column; gap: 12px; }
.prod-card__section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.prod-card__section:first-child { border-top: none; padding-top: 0; }
.prod-card__section-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11px;
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}
.prod-card__row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  flex-wrap: wrap;
}
.prod-card__label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.prod-card__subject {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
  word-break: break-word;
}
.prod-card__error {
  font-size: 12px;
  color: var(--status-danger);
  background: var(--status-danger-bg);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.prod-card__errors-detail { margin-top: 4px; }
.prod-card__errors-detail summary { font-size: 12px; cursor: pointer; }
.prod-card__errors-line {
  margin: 6px 0 0;
  padding: 6px 8px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

/* ---------- Task detail page-level layout ---------- */
.task-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.task-detail__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.task-detail__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
  flex-wrap: wrap;
}
.task-detail__body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
.task-detail__empty-body {
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 13px;
}
.task-detail__id-prefix     { font-size: 0.7em; }
.task-detail__streams-grid  { grid-template-columns: 90px 1fr; }
.task-detail__stream-info   { word-break: break-all; font-size: 12px; }
.task-detail__hash          { font-size: 10px; margin-top: 2px; }
.task-detail__reason-note   { margin-top: var(--space-3); }
.task-detail__transition-note { margin-top: 2px; }

/* ---------- Login page ---------- */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: var(--space-4);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  box-shadow: var(--shadow-md);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.login-brand__mark {
  height: 56px;
  width: 56px;
  object-fit: contain;
}
.login-brand__wordmark {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
h1.login-title {
  font-size: var(--text-lg);
  font-weight: 600;
  text-align: center;
  margin: 0 0 var(--space-5) 0;
  letter-spacing: -0.005em;
}
.login-page .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-4);
}
.login-page .field__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}
.login-error {
  background: var(--status-danger-bg);
  border: 1px solid var(--status-danger);
  border-left-width: 3px;
  color: var(--status-danger);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}
.login-submit { width: 100%; margin-top: var(--space-2); }
.login-foot {
  margin-top: var(--space-5);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* Snapshot card (Fase 2.3 / vista task.php) */
.snapshot {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  background: var(--surface-2);
}
.snapshot__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}
.snapshot__path { font-size: 12px; color: var(--text-secondary); flex: 1; word-break: break-all; }
.snapshot__grid { grid-template-columns: 130px 1fr; gap: 4px var(--space-3); margin-bottom: var(--space-3); }
.snapshot__action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--border);
}
.snapshot__note { flex: 1; font-size: 12px; }

/* Verification checks (Fase 3 / vista task.php) */
.checks { list-style: none; padding: 0; margin: 0; }
.checks__row {
  display: grid;
  grid-template-columns: 90px 60px 1fr 90px 70px 60px;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}
.checks__name { font-weight: 500; }
.checks__target { word-break: break-all; color: var(--text-secondary); }
.checks__details { grid-column: 1 / -1; margin-top: var(--space-2); }
.checks__output {
  background: var(--surface-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
  margin: var(--space-2) 0;
}
.check__count { font-size: 11px; padding: 0 var(--space-2); border-radius: var(--radius-sm); margin-right: var(--space-2); }
.check__count--pass    { color: var(--status-success); }
.check__count--fail    { color: var(--status-danger); }
.check__count--warning { color: var(--status-warning); }
.check__count--skip    { color: var(--text-tertiary); }

/* Task new form */
.page--narrow { max-width: 720px; margin: 0 auto; }
.form-stack { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); }
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); }
.field__hint { font-size: 11px; }
.radio-row { display: flex; flex-direction: column; gap: var(--space-2); }
.radio { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: var(--transition-fast); }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-bg-subtle); }
.radio input { margin: 0; }
.radio__label { font-size: var(--text-sm); }
.task-new__body { font-family: var(--font-mono); font-size: 12px; resize: vertical; }
.form-actions { display: flex; gap: var(--space-3); justify-content: flex-end; padding-top: var(--space-3); border-top: 1px solid var(--border); }

/* Ask response (kind=ask, vista task.php) */
.ask-response {
  background: var(--surface-2);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  white-space: pre-wrap;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.6;
  max-height: 600px;
  overflow: auto;
  margin: 0;
}

/* Plan decision (Fase 5.2 / vista task.php) */
.plan-decision {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
}
.plan-decision__note { flex: 1; font-size: 12px; }
.plan-decision__final-note { margin-top: var(--space-2); }
.plan-finalized { padding-top: var(--space-2); }

/* Checkbox component (form task-new) */
.checkbox { display: flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.checkbox:has(input:checked) { border-color: var(--accent); background: var(--accent-bg-subtle); }
.checkbox input { margin-top: 3px; }
.checkbox__label { font-size: var(--text-sm); flex: 1; }

/* Release section (Fase 6.1 / vista task.php) */
.release-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
}
.release-actions__note { flex: 1; font-size: 12px; }
.release-actions__hint {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
  font-size: 13px;
}
.release__grid { grid-template-columns: 130px 1fr; gap: 4px var(--space-3); margin-bottom: var(--space-3); }
.release-diff { margin-bottom: var(--space-3); }
.release-diff-content {
  background: var(--surface-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre;
  max-height: 400px;
  overflow: auto;
  margin: var(--space-2) 0;
}

/* xs button (minimal, per icone inline) */
.btn--xs { height: 20px; padding: 0 6px; font-size: 11px; }

/* Chat (Fase 7) */
.chat-history { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); max-height: 65vh; overflow-y: auto; }
.chat-msg { border-radius: var(--radius-md); padding: var(--space-3); }
.chat-msg--user      { background: var(--surface-2); border-left: 3px solid var(--accent); }
.chat-msg--assistant { background: var(--surface-3); border-left: 3px solid var(--status-success); }
.chat-msg__head { display: flex; gap: var(--space-2); font-size: 11px; margin-bottom: var(--space-2); align-items: center; }
/* overflow-wrap: anywhere = spezza anche parole lunghe senza spazi (URL, hash,
 * path) per evitare scrollbar orizzontale durante lo streaming live. Senza
 * questa regola, pre-wrap soltanto wrappa sugli spazi → URL lungo = overflow.
 * Bug emerso 2026-06-03: messaggi statici (post-refresh) si vedevano bene
 * solo perché short-form; gli streaming live con URL/hash uscivano fuori. */
.chat-msg__content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Sovrascrive le proprietà globali `pre { ... }` di colors_and_type.css
   * che davano scrollbar (overflow:auto), background/border/padding al
   * pre messaggio. Il bubble parent ha già il proprio stile. */
  overflow: hidden;
  background: transparent;
  border: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.55;
  margin: 0;
}
.chat-input { display: flex; gap: var(--space-2); padding: var(--space-3); border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input__msg { flex: 1; font-family: var(--font-mono); font-size: 13px; resize: vertical; }

/* ---------- needs_human assistito (§7.10) ---------- */
.nh-details { white-space: pre-wrap; line-height: 1.55; margin: 0 0 var(--space-3); }
.nh-options { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-3) 0; }
.nh-option {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
}
.nh-option--reco { border-color: var(--status-success); background: var(--status-success-bg); }
.nh-option__head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: 4px; }
.nh-option__id {
  font-weight: var(--weight-bold); font-size: var(--text-sm);
  background: var(--bg-overlay); border-radius: var(--radius-sm);
  padding: 0 8px; line-height: 1.6;
}
.nh-option__summary { font-size: var(--text-sm); line-height: 1.5; margin-bottom: 4px; }
.nh-option__pro { font-size: 12px; color: var(--status-success); }
.nh-option__con { font-size: 12px; color: var(--status-warning); }
.nh-reco-reason { margin: var(--space-2) 0 var(--space-3); line-height: 1.5; }
.nh-resolve { flex-wrap: wrap; gap: var(--space-2); }
.nh-resolve textarea { width: 100%; font-family: var(--font-sans); font-size: var(--text-sm); resize: vertical; }

/* needs_human — Q&A col worker (§7.10 Cap.3) */
.nh-qa { margin: var(--space-3) 0; }
.nh-qa > summary { cursor: pointer; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.nh-qa__thread { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-3) 0; }
.nh-qa__msg { border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); }
.nh-qa__msg--user   { background: var(--bg-overlay); }
.nh-qa__msg--worker { background: var(--surface-3, var(--bg-elevated)); border-left: 3px solid var(--accent); }
.nh-qa__role { font-size: 11px; color: var(--text-tertiary); margin-bottom: 4px; }
.nh-qa__content { font-size: var(--text-sm); line-height: 1.55; }
.nh-qa__form { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.nh-qa__form textarea { width: 100%; font-family: var(--font-sans); font-size: var(--text-sm); resize: vertical; }
.nh-qa__hint { font-size: 11px; margin-top: 4px; }

/* needs_human — parere advisor (§7.10 Cap.2) */
.nh-advisor { margin: var(--space-3) 0; }
.nh-advisor__head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.nh-advisor__content {
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  white-space: pre-wrap;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.55;
  margin: 0 0 var(--space-2);
}

/* Chat streaming — cursore typing durante la risposta SSE (Fase 12) */
.chat-msg--streaming .chat-msg__content::after {
  content: '\258B';            /* ▋ */
  display: inline-block;
  margin-left: 1px;
  color: var(--accent);
  animation: chat-blink 1s steps(2, end) infinite;
}
@keyframes chat-blink { 50% { opacity: 0; } }

/* ============ Onboard wizard (project-new.php) ============ */
.onboard-stepper {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  flex-wrap: wrap;
}
.onboard-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-overlay);
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
}
.onboard-step__n {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-base);
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-family: var(--font-mono);
}
.onboard-step--current { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.onboard-step--current .onboard-step__n { background: var(--accent); color: white; }
.onboard-step--done { color: var(--status-success); border-color: var(--status-success); }
.onboard-step--done .onboard-step__n { background: var(--status-success); color: white; }
.onboard-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
