/* ============================================================
   Pubblica Richiesta — single-page form
   ============================================================ */

.pr-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 28px 100px;
}

/* ============== Header ============== */
.pr-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.pr-head-l { min-width: 0; max-width: 720px; }
.pr-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted-foreground);
  text-decoration: none;
  margin-bottom: 14px;
  transition: color 120ms;
}
.pr-back:hover { color: var(--foreground); }
.pr-back-ic { transition: transform 120ms; }
.pr-back:hover .pr-back-ic { transform: translateX(-2px); }

.pr-title {
  font-family: var(--font-display, inherit);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
  margin: 0 0 8px;
  line-height: 1.1;
}
.pr-sub {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.5;
  margin: 0;
}
.pr-sub strong { color: var(--foreground); font-weight: 600; }
.pr-link { color: var(--violet-bright, #7b55d0); text-decoration: none; font-weight: 500; }
.pr-link:hover { text-decoration: underline; }

.pr-quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(123,85,208,0.12);
  color: var(--violet-bright, #7b55d0);
  border: 1px solid rgba(123,85,208,0.22);
  white-space: nowrap;
}

/* ============== Layout ============== */
.pr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: flex-start;
}
@media (max-width: 980px) {
  .pr-layout { grid-template-columns: 1fr; }
}

.pr-form { display: flex; flex-direction: column; gap: 20px; }

/* ============== Section ============== */
.pr-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
}
.pr-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.pr-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display, inherit);
  flex-shrink: 0;
  margin-top: 1px;
}
.pr-section-t {
  font-family: var(--font-display, inherit);
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.01em;
}
.pr-req { color: #f59e0b; font-weight: 600; }
.pr-section-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted-foreground);
}

/* ============== Service grid (visual pickers) ============== */
.pr-svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.pr-svc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 14px 14px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--foreground);
  transition: border-color 140ms, background 140ms, transform 100ms;
  min-height: 110px;
}
.pr-svc-card:hover {
  border-color: rgba(123,85,208,0.45);
  background: color-mix(in oklab, var(--card) 92%, var(--violet-bright, #7b55d0) 8%);
}
.pr-svc-card:active { transform: scale(0.985); }
.pr-svc-card.active {
  border-color: var(--violet-bright, #7b55d0);
  background: linear-gradient(180deg, rgba(123,85,208,0.10), rgba(123,85,208,0.03));
  box-shadow: 0 0 0 4px rgba(123,85,208,0.10);
}
.pr-svc-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(123,85,208,0.10);
  color: var(--violet-bright, #7b55d0);
  margin-bottom: 2px;
}
.pr-svc-card.active .pr-svc-ic {
  background: rgba(123,85,208,0.20);
}
.pr-svc-label {
  font-family: var(--font-display, inherit);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.pr-svc-sub {
  font-size: 11.5px;
  color: var(--muted-foreground);
  line-height: 1.35;
}
.pr-svc-pop {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245,158,11,0.16);
  color: #f59e0b;
}
.pr-svc-tick {
  position: absolute;
  top: 10px; right: 10px;
  width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--violet-bright, #7b55d0);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pr-svc-card.active .pr-svc-pop { display: none; }

/* ============== Brief textarea ============== */
.pr-brief-wrap { display: flex; flex-direction: column; gap: 10px; }
.pr-textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px 16px;
  background: var(--background);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--foreground);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 140ms, box-shadow 140ms;
}
.pr-textarea::placeholder { color: var(--muted-foreground); }
.pr-textarea:focus {
  outline: none;
  border-color: var(--violet-bright, #7b55d0);
  box-shadow: 0 0 0 4px rgba(123,85,208,0.12);
}
.pr-textarea.warn { border-color: rgba(245,158,11,0.55); }

.pr-brief-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pr-brief-l { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.pr-brief-r {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted-foreground);
  margin-left: auto;
}
.pr-warn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #f59e0b;
  font-weight: 500;
}
.pr-count { font-variant-numeric: tabular-nums; }

.pr-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid rgba(123,85,208,0.30);
  background: rgba(123,85,208,0.08);
  color: var(--violet-bright, #7b55d0);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.pr-ai-btn:hover:not(:disabled) {
  background: rgba(123,85,208,0.14);
  border-color: rgba(123,85,208,0.45);
}
.pr-ai-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.pr-template-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.pr-template-btn:hover {
  background: var(--muted);
  color: var(--foreground);
  border-color: transparent;
}

/* ============== AI panel ============== */
.pr-ai-panel {
  margin-top: 8px;
  border: 1px solid rgba(123,85,208,0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(123,85,208,0.08), rgba(123,85,208,0.02));
  padding: 14px 16px;
  animation: pr-ai-in 200ms ease-out;
}
@keyframes pr-ai-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pr-ai-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.pr-ai-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--violet-bright, #7b55d0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pr-ai-close {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: var(--muted-foreground);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pr-ai-close:hover { background: var(--muted); color: var(--foreground); }
.pr-ai-body { min-height: 40px; }
.pr-ai-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--foreground);
  white-space: pre-wrap;
}
.pr-ai-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted-foreground);
}
.pr-ai-dot {
  width: 5px; height: 5px;
  border-radius: 999px;
  background: var(--violet-bright, #7b55d0);
  animation: pr-ai-bounce 1.2s ease-in-out infinite;
}
.pr-ai-dot:nth-child(2) { animation-delay: 0.15s; }
.pr-ai-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes pr-ai-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}
.pr-ai-error {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  color: #f59e0b;
}
.pr-ai-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(123,85,208,0.20);
}
.pr-ai-secondary, .pr-ai-primary {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 120ms;
}
.pr-ai-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}
.pr-ai-secondary:hover { background: var(--muted); }
.pr-ai-primary {
  background: var(--violet-bright, #7b55d0);
  color: white;
  border: 1px solid var(--violet-bright, #7b55d0);
}
.pr-ai-primary:hover { background: color-mix(in oklab, var(--violet-bright, #7b55d0) 90%, white); }

/* ============== Files / upload ============== */
.pr-files { display: flex; flex-direction: column; gap: 12px; }
.pr-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 20px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  font-family: inherit;
  color: var(--foreground);
  cursor: pointer;
  transition: border-color 140ms, background 140ms;
}
.pr-upload:hover {
  border-color: rgba(123,85,208,0.45);
  background: rgba(123,85,208,0.04);
}
.pr-upload-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  background: rgba(123,85,208,0.10);
  color: var(--violet-bright, #7b55d0);
}
.pr-upload-t {
  font-size: 14px;
  font-weight: 500;
}
.pr-upload-s {
  font-size: 11.5px;
  color: var(--muted-foreground);
}

.pr-file-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pr-file {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.pr-file-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(123,85,208,0.10);
  color: var(--violet-bright, #7b55d0);
}
.pr-file-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pr-file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pr-file-meta {
  font-size: 11px;
  color: var(--muted-foreground);
}
.pr-file-x {
  width: 26px; height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pr-file-x:hover { background: var(--muted); color: var(--foreground); }

.pr-link-add {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 14px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted-foreground);
}
.pr-link-input {
  border: 0 !important;
  background: transparent !important;
  padding: 8px 0 !important;
}
.pr-link-input:focus { outline: none; box-shadow: none !important; }
.pr-link-add-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
}
.pr-link-add-btn:hover { background: var(--muted); }

/* ============== Inputs / chips ============== */
.pr-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--background);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--foreground);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 140ms, box-shadow 140ms;
}
.pr-input:focus {
  outline: none;
  border-color: var(--violet-bright, #7b55d0);
  box-shadow: 0 0 0 4px rgba(123,85,208,0.12);
}
.pr-input-num { padding-left: 28px; }
.pr-input-prefix { position: relative; display: inline-block; width: 110px; }
.pr-prefix {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--muted-foreground);
  pointer-events: none;
}
.pr-input-date {
  font-family: inherit;
  width: auto;
  min-width: 160px;
}

.pr-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pr-chip {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 140ms, background 140ms, color 140ms;
}
.pr-chip:hover { border-color: rgba(123,85,208,0.45); }
.pr-chip.active {
  background: rgba(123,85,208,0.14);
  color: var(--violet-bright, #7b55d0);
  border-color: var(--violet-bright, #7b55d0);
}

.pr-or {
  font-size: 12px;
  color: var(--muted-foreground);
  margin: 0 4px;
}

.pr-budget { display: flex; flex-direction: column; gap: 14px; }
.pr-budget-custom {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.pr-budget-sep {
  color: var(--muted-foreground);
  font-size: 16px;
  margin-bottom: 12px;
}
.pr-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pr-field-inline { flex-direction: row; align-items: center; }
.pr-field-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============== Visibility ============== */
.pr-vis { display: flex; flex-direction: column; gap: 10px; }
.pr-vis-row {
  display: grid;
  grid-template-columns: 36px 1fr 18px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--background);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--foreground);
  transition: border-color 140ms, background 140ms;
}
.pr-vis-row:hover { border-color: rgba(123,85,208,0.45); }
.pr-vis-row.active {
  border-color: var(--violet-bright, #7b55d0);
  background: rgba(123,85,208,0.06);
}
.pr-vis-ic {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(123,85,208,0.10);
  color: var(--violet-bright, #7b55d0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pr-vis-body { display: flex; flex-direction: column; gap: 3px; }
.pr-vis-t { font-size: 14px; font-weight: 600; color: var(--foreground); }
.pr-vis-s { font-size: 12.5px; color: var(--muted-foreground); line-height: 1.4; }
.pr-vis-radio {
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 2px solid var(--border);
  position: relative;
}
.pr-vis-row.active .pr-vis-radio {
  border-color: var(--violet-bright, #7b55d0);
}
.pr-vis-row.active .pr-vis-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  background: var(--violet-bright, #7b55d0);
}

/* ============== Sticky summary ============== */
.pr-summary { position: relative; }
.pr-summary-card {
  position: sticky;
  top: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pr-summary-h {
  font-family: var(--font-display, inherit);
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.005em;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11.5px;
  color: var(--muted-foreground);
}
.pr-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pr-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
}
.pr-sum-label {
  color: var(--muted-foreground);
  font-size: 12px;
  flex-shrink: 0;
}
.pr-sum-value {
  text-align: right;
  color: var(--foreground);
  font-weight: 500;
  font-size: 13px;
  min-width: 0;
  line-height: 1.3;
}
.pr-sum-value.empty {
  color: var(--muted-foreground);
  font-weight: 400;
  font-style: italic;
}
.pr-sum-row.muted .pr-sum-value:not(.empty) { color: var(--muted-foreground); }

.pr-summary-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.pr-summary-trust {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--background);
  border-radius: 10px;
}
.pr-summary-trust-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted-foreground);
}
.pr-summary-trust-row :first-child { color: var(--violet-bright, #7b55d0); flex-shrink: 0; margin-top: 1px; }

.pr-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: 10px;
  border: 0;
  background: var(--violet-bright, #7b55d0);
  color: white;
  cursor: pointer;
  text-decoration: none;
  transition: background 140ms, transform 100ms;
}
.pr-submit-btn:hover:not(:disabled) {
  background: color-mix(in oklab, var(--violet-bright, #7b55d0) 88%, white);
}
.pr-submit-btn:active:not(:disabled) { transform: scale(0.99); }
.pr-submit-btn:disabled {
  background: var(--muted);
  color: var(--muted-foreground);
  cursor: not-allowed;
}

.pr-summary-note {
  margin: 0;
  font-size: 11px;
  color: var(--muted-foreground);
  line-height: 1.45;
  text-align: center;
}

.pr-submit-mobile { display: none; }
@media (max-width: 980px) {
  .pr-summary { order: -1; }
  .pr-summary-card { position: static; }
  .pr-submit-mobile {
    display: block;
    position: sticky;
    bottom: 12px;
    z-index: 10;
  }
  .pr-submit-mobile .pr-submit-btn {
    box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5);
  }
}

/* ============== Success state ============== */
.pr-success-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 80px 28px;
}
.pr-success-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.pr-success-ic {
  width: 64px; height: 64px;
  border-radius: 999px;
  background: rgba(34,197,94,0.14);
  color: #22c55e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(34,197,94,0.30);
}
.pr-success-t {
  font-family: var(--font-display, inherit);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
  margin: 0;
}
.pr-success-s {
  font-size: 14.5px;
  color: var(--muted-foreground);
  line-height: 1.55;
  margin: 0;
  max-width: 460px;
}
.pr-success-s strong { color: var(--foreground); font-weight: 600; }
.pr-success-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}
.pr-success-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.pr-success-stat-n {
  font-family: var(--font-display, inherit);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
}
.pr-success-stat-l {
  font-size: 11.5px;
  color: var(--muted-foreground);
}
.pr-success-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.pr-success-actions .pr-submit-btn { width: auto; padding: 12px 22px; }
.pr-success-secondary {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
}
.pr-success-secondary:hover { background: var(--muted); }
