/* Attivita', Cervello, schede, Chiedi, Oggi, impostazioni, ricerca. */

/* ---- Attivita' ---- */

.task-list { display: flex; flex-direction: column; }
.task-list.card { padding: 2px 0; }
.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 8px 9px 12px; position: relative; }
.task-row + .task-row { border-top: 1px solid var(--border); }
.task-check {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.6px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.12s, border-color 0.12s;
}
.task-check:hover { border-color: var(--accent); }
.task-row.done .task-check { background: var(--accent); border-color: var(--accent); }
.task-main { cursor: pointer; min-width: 0; }
.task-text { line-height: 1.4; overflow-wrap: anywhere; }
.task-row.done .task-text { color: var(--text-3); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.task-meta:empty { display: none; }
.task-meta .chip { height: 22px; font-size: 12px; max-width: 220px; }
.task-meta .chip .avatar { width: 16px; height: 16px; font-size: 8px; margin-left: -5px; }
.task-row .icon-btn { margin: -5px 0; opacity: 0.55; }
.task-row:hover .icon-btn, .task-row .icon-btn[aria-expanded="true"] { opacity: 1; }

.task-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.task-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.task-add input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 34px; }
.task-add input::placeholder { color: var(--text-3); }

.progress { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.progress-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width 0.25s; }

.section-toggle { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 4px 0; color: var(--text-2); text-align: left; }
.wait-group + .wait-group { border-top: 1px solid var(--border); }
.wait-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 2px; color: inherit; text-decoration: none; font-size: 14px; }
.wait-head:hover { text-decoration: none; color: var(--accent-text); }
.wait-group .task-row { padding-left: 46px; }

/* ---- Cervello ---- */

.tabs-scroll { padding: 0 20px 10px; overflow-x: auto; flex: none; scrollbar-width: none; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.seg .count { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; }
.card > .list-row + .list-row { border-top: 1px solid var(--border); border-radius: 0; }
.card > .list-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card > .list-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.card > .list-row:only-child { border-radius: var(--radius); }
.decision-row { align-items: flex-start; }
.decision-row .icon { margin-top: 3px; }
.ai-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ai); flex: none; }
.tile {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.tile.lg { width: 44px; height: 44px; border-radius: 11px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar.more { background: var(--surface-3); color: var(--text-2); }

.capture {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.capture:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.capture textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; padding: 7px 0; line-height: 1.45; field-sizing: content; max-height: 160px; }
.capture textarea::placeholder { color: var(--text-3); }
.personal { background: var(--surface); field-sizing: content; min-height: 76px; }

/* ---- Chiedi ---- */

.ask-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--ai) 35%, var(--border-strong));
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.ask-box:focus-within { box-shadow: 0 0 0 3px var(--ai-soft); }
.ask-box textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; line-height: 1.5; field-sizing: content; min-height: 44px; max-height: 200px; }
.ask-box textarea::placeholder { color: var(--text-3); }
.qa-q { display: flex; align-items: flex-start; gap: 8px; font-weight: 600; }

/* ---- Oggi ---- */

.today-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 8px 28px; max-width: 1180px; margin: 0 auto; }

/* ---- Impostazioni ---- */

.set-card { padding: 4px 16px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.set-row + .set-row, .set-row + .set-note, .set-note + .set-details, .set-row + .set-details, .set-note + .set-note { border-top: 1px solid var(--border); }
.set-label { font-weight: 550; }
.set-control { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.set-note { display: flex; align-items: flex-start; gap: 9px; padding: 12px 0; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.set-note .icon { margin-top: 2px; flex: none; }
.set-note.err { color: var(--danger); }
.set-note code, .set-details code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.set-details { padding: 10px 0; }
.set-details summary { cursor: pointer; font-size: 13.5px; font-weight: 550; color: var(--text-2); }

/* ---- Ricerca rapida ---- */

.palette-overlay { place-items: start center; padding-top: min(14vh, 120px); }
.palette {
  width: min(640px, 100%);
  max-height: min(70dvh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: pop 0.12s ease-out;
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; height: 34px; }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
}
.palette-item.on { background: var(--surface-2); }
.palette-item .title { font-weight: 550; }

@media (max-width: 900px) {
  .today-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .tabs-scroll { padding: 0 14px 8px; }
  .palette-overlay { padding: calc(8px + var(--safe-top)) 8px 0; }
  .palette { max-height: 80dvh; }
  .set-row { flex-wrap: wrap; }
  .set-control { justify-content: flex-start; }
  .task-row .icon-btn { opacity: 1; }
}

/* ---- Grafo, ore per commessa ---- */

.graph-wrap { flex: 1; min-height: 0; position: relative; border-top: 1px solid var(--border); background: var(--surface); }
.graph-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.graph-legend {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}
.graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.graph-legend i { width: 9px; height: 9px; border-radius: 50%; }
.graph-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-1); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.stats > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stats strong { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--text-2); }
.inline-icon { display: inline-block; vertical-align: -2px; }
label.icon-btn { cursor: pointer; }