/*
 * Viste: home, nuova richiesta (mappa del cantiere, tratte) e assistente AI.
 */

/* ── Home: intestazioni, funzioni, benvenuto ── */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(120deg, #ffffff 0%, #f4f5ff 55%, #e9efff 100%);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 22px 28px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.hero-text { min-width: 0; }
.hero-text h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--slate-100); }
.hero-text p {
  color: var(--slate-500);
  font-size: 14px;
  margin-top: 8px;
  max-width: 560px;
  line-height: 1.5;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(79,70,229,0.09);
  border: 1px solid rgba(79,70,229,0.18);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.hero-illus { width: 300px; max-width: 36%; flex-shrink: 0; }
.hero-illus img { width: 100%; height: auto; display: block; }
@media (max-width: 920px) {
  .hero-illus { display: none; }
}
.feat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 4px 0 18px; }
.feat-card {
  background: var(--superficie);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 16px 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; max-width: 1180px; }
.area-card { cursor: pointer; padding: 22px 20px 20px; gap: 10px; }
.area-card h4 { font-size: 16px; }
.area-card p { font-size: 13px; min-height: 2.6em; }
.area-card-btn { margin-top: auto; align-self: flex-start; font-size: 12px; }
.feat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #d4dcf2; }
.feat-ic {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 19px;
}
.feat-card h4 { font-size: 13.5px; font-weight: 700; color: var(--slate-100); }
.feat-card p { font-size: 12px; color: var(--slate-500); line-height: 1.45; }
.fi-blue { background: rgba(37,99,235,0.12); color: var(--informazione); }
.fi-green { background: rgba(5,150,105,0.12); color: var(--successo-vivo); }
.fi-violet { background: rgba(124,58,237,0.12); color: #7c3aed; }
.fi-amber { background: rgba(217,119,6,0.12); color: #d97706; }
.welcome-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
  position: relative;
  max-width: 860px;
  padding-right: 20px;
}
.welcome-step {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--slate-300);
}
.welcome-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6b63ef, #4f46e5);
  color: var(--testo-inverso);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-family: "JetBrains Mono", monospace;
}
.welcome-step-txt b { color: var(--slate-100); }
.cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(120deg, #eef1ff 0%, #e3ecff 100%);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 8px 28px;
  margin: 6px 0 18px;
  overflow: hidden;
}
.cta-text h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; color: var(--slate-100); }
.cta-text p { font-size: 13px; color: var(--slate-500); margin-top: 6px; max-width: 560px; line-height: 1.5; }
.cta-banner img { width: 230px; max-width: 34%; height: auto; flex-shrink: 0; }
@media (max-width: 920px) {
  .cta-banner img { display: none; }
}
.page-head { margin-bottom: 20px; }
.page-head h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--slate-100);
}
.page-ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(79,70,229,0.12);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.page-spark { color: var(--primary); font-size: 19px; }
.page-head > p { color: var(--slate-500); font-size: 14px; margin-top: 8px; }

/* ── Nuova richiesta: mappa e tratte ── */
.cantiere-map {
  width: 100%;
  height: 200px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
}
.cantiere-map iframe { width: 100%; height: 100%; border: 0; display: block; }
.tratte-editor { display: flex; flex-direction: column; gap: 8px; }
.tratta-row {
  display: grid;
  grid-template-columns: 108px 1fr 1fr 132px 78px 30px;
  gap: 8px;
  align-items: center;
}
.tratta-row select, .tratta-row input {
  padding: 7px 9px;
  border: 1px solid var(--glass-border-strong);
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--superficie);
  color: var(--slate-100);
  min-width: 0;
}
.tratta-del {
  border: none;
  background: var(--pericolo-sfondo);
  color: var(--pericolo);
  border-radius: 8px;
  padding: 7px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.tratta-del:hover { background: var(--pericolo-sfondo-hover); }
.tratta-add { align-self: flex-start; font-size: 12px; padding: 7px 12px; }
.tratte-head {
  display: grid;
  grid-template-columns: 108px 1fr 1fr 132px 78px 30px;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate-500);
  padding: 0 2px;
}
@media (max-width: 760px) {
  .tratta-row { grid-template-columns: 1fr 1fr; }
  .tratte-head { grid-template-columns: 1fr 1fr; display: none; }
}

/* ── Assistente AI ── */
.ai-panel {
  border: 1px solid #d8e3fb;
  background: linear-gradient(180deg, #f5f8ff, #ffffff);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
}
.ai-panel.disabled { opacity: 0.65; }
.ai-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ai-badge { font-weight: 800; color: var(--blue-dark); font-size: 13px; letter-spacing: 0.01em; }
.ai-hint { font-size: 11px; color: var(--slate-500); }
.ai-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 300px;
  overflow: auto;
}
.ai-log:empty { display: none; }
.ai-msg { padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.ai-msg.user { background: var(--blue); color: var(--testo-inverso); align-self: flex-end; max-width: 80%; }
.ai-msg.bot {
  background: var(--superficie);
  border: 1px solid var(--glass-border);
  color: var(--slate-100);
  max-width: 94%;
}
.ai-msg.bot.loading { color: var(--slate-500); font-style: italic; }
.ai-input-row { display: flex; gap: 8px; }
.ai-input-row input {
  flex: 1;
  background: var(--superficie);
  border: 1px solid var(--glass-border-strong);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--slate-100);
}
.ai-input-row input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.ai-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 30px 30px 26px;
  margin-bottom: 16px;
  background: linear-gradient(140deg, #0e2746 0%, #0b1f39 58%, #16294c 100%);
  border: 1px solid rgba(80,130,190,0.30);
  box-shadow: 0 22px 52px rgba(6,16,33,0.45);
}
.ai-hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(440px 210px at 88% -12%, rgba(56,189,248,0.20), transparent 70%), radial-gradient(380px 190px at 8% 125%, rgba(99,102,241,0.16), transparent 70%);
}
.ai-hero-inner { position: relative; }
.ai-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a9c6e8;
  background: rgba(56,116,180,0.16);
  border: 1px solid rgba(80,130,190,0.40);
  padding: 5px 12px;
  border-radius: 999px;
}
.ai-hero-title {
  color: var(--testo-inverso);
  font-size: 23px;
  font-weight: 800;
  margin: 14px 0 4px;
  letter-spacing: -0.02em;
}
.ai-hero-sub { color: #aebfd6; font-size: 13.5px; line-height: 1.5; margin-bottom: 18px; max-width: 660px; }
.ai-hero-inputwrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.97);
  border-radius: 14px;
  padding: 7px 7px 7px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.5);
}
.ai-hero-spark { color: var(--informazione); font-size: 17px; }
.ai-hero-inputwrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14.5px;
  color: #1f2a44;
  font-family: inherit;
  padding: 8px 4px;
}
.ai-hero-btn {
  border: none;
  border-radius: 10px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  background: linear-gradient(135deg, #2f6fed, #1d4ed8);
  color: var(--testo-inverso);
  box-shadow: 0 6px 16px rgba(29,78,216,0.5);
  transition: transform .12s, box-shadow .18s;
  white-space: nowrap;
}
.ai-hero-btn:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(29,78,216,0.62); }
.ai-hero-btn:disabled { opacity: .7; cursor: default; }
.ai-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.ai-chip-lbl {
  font-size: 11px;
  color: #8aa0c0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ai-chip {
  font-size: 11.5px;
  color: #cfe0f5;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(110,150,200,0.28);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.ai-chip:hover { background: rgba(255,255,255,0.14); }
.ai-cronologia { margin-top: 20px; border-top: 1px solid rgba(110,150,200,0.20); padding-top: 16px; }
.ai-cron-h {
  font-size: 11px;
  color: #8aa0c0;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.ai-cron-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.ai-cron-card {
  flex: 0 0 auto;
  min-width: 178px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(110,150,200,0.24);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .12s, border-color .15s;
}
.ai-cron-card:hover {
  background: rgba(255,255,255,0.13);
  transform: translateY(-2px);
  border-color: rgba(110,150,200,0.50);
}
.ai-cron-card .acc-code {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  color: #7fb0e6;
  letter-spacing: 0.04em;
}
.ai-cron-card .acc-comm {
  font-size: 13px;
  font-weight: 700;
  color: var(--testo-inverso);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.ai-cron-card .acc-meta { font-size: 11px; color: #aebfd6; }
