:root {
  --peach-glow: #f1bf98;
  --frosted-mint: #e1f4cb;
  --dry-sage: #bacba9;
  --dim-grey: #717568;
  --charcoal-brown: #3f4739;
  --bg: #f7f8f3;
  --card: #ffffff;
  --border: rgba(63, 71, 57, 0.1);
  --shadow: 0 12px 32px rgba(63, 71, 57, 0.08);
}
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, #fbfcf8 100%);
  color: var(--charcoal-brown);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.page-shell { padding: 1.25rem 0 3rem; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.05; letter-spacing: -0.03em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: 1.4rem; margin-top: 0; }
h3 { font-size: 1.1rem; }
.muted { color: var(--dim-grey); }
.flash-stack { display: grid; gap: .7rem; margin-bottom: 1rem; }
.flash { padding: .9rem 1rem; border-radius: 16px; }
.flash.success { background: rgba(225,244,203,.75); }
.flash.error { background: rgba(241,191,152,.55); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .85rem 1.1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--charcoal-brown); font-weight: 700; cursor: pointer; font: inherit; }
.btn-primary { background: var(--charcoal-brown); color: white; }
.btn-danger { background: rgba(241,191,152,.55); border-color: rgba(63,71,57,.15); }
.inline-form, .actions-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.inline-form select, .inline-form input, input, textarea, select {
  width: 100%;
  border: 1px solid rgba(63, 71, 57, 0.16);
  background: white;
  border-radius: 14px;
  padding: .9rem 1rem;
  font: inherit;
  color: inherit;
}
/* Select come gli altri campi (niente bordo viola / stile OS) */
select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1.5L7 7l6-5.5' stroke='%233f4739' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-color: #fff;
}
select:focus,
select:focus-visible,
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible {
  outline: none;
  border-color: rgba(63, 71, 57, 0.35);
  box-shadow: 0 0 0 3px rgba(186, 203, 169, 0.45);
}
.form-grid { display: grid; gap: 1rem; }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid label { display: grid; gap: .4rem; font-weight: 600; font-size: .95rem; }
.form-grid .full { grid-column: 1 / -1; }
.auth-card, .narrow { max-width: 560px; margin: 3rem auto; }
.narrow-wide { max-width: 860px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); padding: 1rem; }
.tag-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.tag { display: inline-flex; padding: .55rem .9rem; border-radius: 999px; background: rgba(186,203,169,.22); color: var(--charcoal-brown); border: 1px solid rgba(63,71,57,.1); font-size: .9rem; }
.tag.active { background: var(--charcoal-brown); color: white; }
.tag.ghost { background: transparent; }
.card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-row { display: flex; gap: .75rem; flex-wrap: wrap; color: var(--dim-grey); font-size: .95rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .9rem .75rem; border-bottom: 1px solid var(--border); font-size: .95rem; vertical-align: top; }
.compact-inline input { min-width: 180px; }
.tag-options { display: flex; gap: .65rem; flex-wrap: wrap; }
.check-chip { display: inline-flex; align-items: center; gap: .4rem; background: rgba(225,244,203,.45); padding: .7rem .9rem; border-radius: 999px; }
.label-inline { display: block; font-weight: 600; margin-bottom: .6rem; }
.modal { position: fixed; inset: 0; z-index: 10050; background: rgba(63,71,57,.48); display: grid; place-items: center; padding: 1rem; }
.modal.hidden { display: none; }
.modal-card { width: min(460px, 100%); background: white; border-radius: 24px; padding: 1.25rem; box-shadow: var(--shadow); display: grid; gap: 1rem; }
#map, #adminMap, #routePreviewMap { width: 100%; min-height: 420px; border-radius: 22px; overflow: hidden; border: 1px solid var(--border); }
@media (max-width: 760px) {
  .form-grid.two-col, .card-grid.three { grid-template-columns: 1fr; }
}
