/* Componenti riusabili — nomenclatura e misure dal design system del mock. */

/* Bottoni */
.btn {
  border: 1px solid var(--line2);
  background: var(--surface);
  border-radius: var(--r);
  padding: 8px 14px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 450;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: 0.12s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink3); background: var(--surface2); }
.btn svg { width: 16px; height: 16px; stroke-width: 1.9; }
.btn.pri { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.pri:hover { background: #2c322e; }
.btn.ag { background: var(--agent); color: #fff; border-color: var(--agent); }
.btn.ag:hover { background: #5a54d6; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.sel { border-color: var(--agent); color: var(--agent); }
.btn[disabled] { opacity: 0.55; cursor: default; }

/* Pill e dot di stato */
.pill {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 450;
  white-space: nowrap;
}
.pill svg { width: 12px; height: 12px; stroke-width: 2; }
.tagrow { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.p-int { background: var(--teal-bg); color: var(--teal-tx); }
.p-ext { background: var(--coral-bg); color: var(--coral-tx); }
.p-ag { background: var(--agent-bg); color: var(--agent-tx); }
.p-proj { background: var(--proj-bg); color: var(--proj-tx); }
.p-amber { background: var(--amber-bg); color: var(--amber); }
.p-neu { background: var(--surface3); color: var(--ink2); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.int { background: var(--teal-dot); }
.dot.ext { background: var(--coral-dot); }

/* Card, griglie, statistiche */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rc); padding: 16px 18px; }
.card.disclaimer { border-left: 3px solid var(--teal); background: transparent; padding: 12px 16px; margin: 6px 0 18px; font-size: 13px; color: var(--ink3); line-height: 1.5; }
.card.disclaimer b { color: var(--ink2); font-weight: 600; }
.grid { display: grid; gap: 14px; }
.g3 { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rc); padding: 15px 16px; }
.stat .l { font-size: 12.5px; color: var(--ink2); display: flex; align-items: center; gap: 7px; }
.stat .l svg { width: 16px; height: 16px; stroke-width: 1.8; }
.stat .v { font-family: var(--disp); font-size: 30px; font-weight: 500; margin-top: 8px; line-height: 1; }
.stat .s { font-size: 12px; color: var(--ink3); margin-top: 5px; }

/* Card spazio */
.sc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--rc);
  padding: 15px;
  cursor: pointer;
  transition: 0.12s;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.sc:hover { border-color: var(--line2); transform: translateY(-1px); }
.sc .r1 { display: flex; justify-content: space-between; align-items: flex-start; }
.sc .ic { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.sc .ic svg { width: 19px; height: 19px; stroke-width: 1.7; }
.sc h3 { font-size: 15.5px; font-weight: 500; margin-top: 12px; }
.sc .ty { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.sc .r2 {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink2);
}
.sc .r2 span { display: flex; align-items: center; gap: 5px; }
.sc .r2 svg { width: 15px; height: 15px; stroke-width: 1.8; }
.sc .r2 .upd { margin-left: auto; color: var(--ink3); font-size: 11.5px; }

/* Pannelli con righe */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rc); margin-bottom: 14px; overflow: hidden; }
.panel .ptitle {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--disp);
  font-weight: 500;
  font-size: 14.5px;
}
.panel .ptitle svg { width: 18px; height: 18px; stroke-width: 1.7; color: var(--ink2); }
.panel .pbody { padding: 6px 18px 14px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.prow:first-child { border-top: none; }
.prow.click { cursor: pointer; }
.prow .bd { flex: 1; min-width: 0; }
.prow .bd h4 { font-size: 14px; font-weight: 500; }
.prow .bd p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink3); }
.prow .rt { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.provic { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: none; }
.provic svg { width: 16px; height: 16px; stroke-width: 1.8; }
.avc {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; font-family: var(--disp); flex: none;
}

/* Intestazioni pagina */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.ph h1 { font-size: 27px; font-weight: 600; }
.ph p { color: var(--ink2); margin: 5px 0 0; font-size: 14px; }
.eyebrow { font-size: 12px; font-weight: 500; color: var(--ink3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.dhead { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.dhead .ic { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.dhead .ic svg { width: 24px; height: 24px; stroke-width: 1.6; }
.dhead h1 { font-size: 24px; font-weight: 600; }
.dhead .ty { color: var(--ink3); font-size: 13px; margin-top: 1px; }
.crumb { font-size: 13px; color: var(--ink3); margin-bottom: 16px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.crumb .lk { color: var(--teal); cursor: pointer; background: none; border: none; padding: 0; font-size: 13px; }
.crumb .lk:hover { text-decoration: underline; }
.crumb svg { width: 15px; height: 15px; stroke-width: 2; }

/* Chat */
.chat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rc); overflow: hidden; }
.msg { padding: 16px 18px; border-top: 1px solid var(--line); }
.msg:first-child { border-top: none; }
.msg.q { background: var(--surface2); }
.msg .who { font-size: 12px; color: var(--ink3); font-weight: 500; margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.msg .who.ai { color: var(--agent); }
.msg .who svg { width: 15px; height: 15px; stroke-width: 1.8; }
.msg .actions { display: flex; gap: 8px; margin-top: 12px; }
.cite {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--teal-bg); color: var(--teal-tx);
  border: none; border-radius: 6px; padding: 1px 7px;
  font-size: 11.5px; font-weight: 450; margin: 0 1px;
  cursor: pointer; vertical-align: baseline;
}
.cite svg { width: 12px; height: 12px; stroke-width: 2; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface2); }
.chipq { border: 1px solid var(--line2); background: var(--surface); border-radius: 20px; padding: 6px 13px; font-size: 13px; cursor: pointer; color: var(--ink2); }
.chipq:hover { border-color: var(--agent); color: var(--agent); }
.askbar { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); align-items: center; }
.askbar input { flex: 1; border: 1px solid var(--line2); border-radius: var(--r); padding: 10px 13px; font-size: 14px; min-width: 0; }

/* Note e frontiera */
.note {
  background: var(--surface2);
  border-left: 3px solid var(--teal);
  padding: 11px 14px;
  border-radius: 0 var(--r) var(--r) 0;
  font-size: 13px;
  color: var(--ink2);
  margin-top: 10px;
  line-height: 1.5;
}
.note svg { width: 15px; height: 15px; stroke-width: 1.8; vertical-align: -3px; }
.frontier {
  background: var(--amber-bg);
  border-left: 3px solid var(--amber);
  padding: 11px 14px;
  border-radius: 0 var(--r) var(--r) 0;
  font-size: 13px;
  color: var(--ink);
  margin-top: 10px;
  line-height: 1.5;
}
.frontier .fw { font-weight: 500; color: var(--amber); display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.frontier .fw svg { width: 14px; height: 14px; stroke-width: 2; }
.frontier .meta { font-size: 11.5px; color: var(--ink3); margin-top: 3px; }

/* Form */
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; font-size: 12.5px; color: var(--ink2); margin-bottom: 6px; }
.fld input, .fld textarea, .fld select {
  width: 100%;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 9px 12px;
  background: var(--surface);
}
.fld textarea { min-height: 90px; resize: vertical; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.field:first-child { border-top: none; }
.err { color: var(--danger); background: var(--danger-bg); border-radius: var(--r); padding: 9px 12px; font-size: 13px; margin-top: 10px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: var(--r);
  font-size: 13.5px; opacity: 0; transition: 0.25s;
  z-index: 100; pointer-events: none;
  display: flex; align-items: center; gap: 9px;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 17px; height: 17px; stroke-width: 2; color: var(--teal-dot); }
