:root {
  --green: #1e5c39;
  --green-700: #164a2d;
  --green-300: #4f9b6e;
  --terra: #c75b39;
  --terra-600: #a8462a;
  --sand: #f7f4ee;
  --card: #ffffff;
  --ink: #20251f;
  --muted: #6c7568;
  --line: #e7e1d6;
  --gold: #e0a93b;
  --shadow: 0 6px 22px rgba(30, 50, 30, .12);
  --radius: 18px;
  --maxw: 480px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, #e9efe5, #dfe9ea);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.device {
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  min-height: 100vh;
  background: var(--sand);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0,0,0,.12);
  overflow: hidden;
}
@media (min-width: 520px) {
  body { padding: 24px 0; align-items: flex-start; }
  .device { min-height: calc(100vh - 48px); border-radius: 30px; border: 1px solid rgba(0,0,0,.06); }
}

/* Phone column wrapper */
.phone-col { width: 100%; max-width: var(--maxw); display: flex; flex-direction: column; align-items: center; }
#desktopMain { width: 100%; display: flex; justify-content: center; }
#desktopPnrr { display: none; }

/* Desktop: scenic backdrop + phone frame */
#desktopAside { display: none; }
@media (min-width: 860px) {
  body {
    padding: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: linear-gradient(rgba(16,46,30,.62), rgba(16,46,30,.72)), url('../img/montefalco.jpg') center/cover no-repeat fixed, #14492d;
  }
  #desktopMain {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 32px 0;
  }
  .phone-col { width: auto; max-width: none; }
  .device {
    max-width: 412px;
    height: min(800px, calc(100vh - 160px)); min-height: 0;
    border-radius: 46px; border: 11px solid #0f141d;
    box-shadow: 0 36px 90px rgba(0,0,0,.5);
  }
  #desktopPnrr {
    display: block;
    background: rgba(255,255,255,.97);
    border-top: 3px solid #1e5c39;
  }
  .dpnrr-inner {
    max-width: 960px; margin: 0 auto;
    padding: 20px 32px;
    display: flex; align-items: center; gap: 40px;
  }
  .dpnrr-logos { display: flex; align-items: center; gap: 24px; flex-shrink: 0; }
  .dpnrr-eu { height: 56px; width: auto; object-fit: contain; }
  .dpnrr-sep { width: 1px; height: 40px; background: #ccc; flex-shrink: 0; }
  .dpnrr-mic { height: 44px; width: auto; object-fit: contain; }
  .dpnrr-text { font-size: 13px; color: #444; line-height: 1.6; }
  .dpnrr-text p { margin: 0 0 2px; }
  .dpnrr-text strong { color: #1a1a1a; }
}
@media (min-width: 1080px) {
  #desktopMain { gap: 60px; }
  #desktopAside {
    display: block; color: #fff; max-width: 380px;
    text-shadow: 0 2px 14px rgba(0,0,0,.35);
  }
  .da-brand { display: flex; align-items: center; gap: 10px; font-size: 19px; margin-bottom: 18px; }
  .da-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.16); color: #fff; }
  #desktopAside h2 { font-size: 52px; line-height: 1.02; margin: 0 0 18px; font-weight: 800; letter-spacing: -.5px; }
  #desktopAside p { font-size: 16px; line-height: 1.5; opacity: .94; margin: 0 0 22px; max-width: 340px; }
  .da-feats { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 12px; }
  .da-feats li { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
  .da-feats li span { font-size: 20px; width: 26px; text-align: center; }
  .da-note { display: inline-block; font-size: 13px; font-weight: 700; background: rgba(255,255,255,.16); padding: 8px 14px; border-radius: 999px; }
}

/* Header */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--green);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: rgba(255,255,255,.14); border-radius: 11px; color: #fff; }
.brand-text { font-size: 17px; letter-spacing: .2px; }
.brand-text b { color: #ffe; }
.lang-btn {
  border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1); color: #fff;
  border-radius: 999px; padding: 6px 13px; font-weight: 700; font-size: 13px; cursor: pointer;
}

/* View */
.view { flex: 1; overflow-y: auto; padding: 0 0 90px; -webkit-overflow-scrolling: touch; }
.view:focus { outline: none; }
.section { padding: 18px 16px; }
.section + .section { padding-top: 4px; }

/* Tabbar */
.tabbar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around; align-items: center;
  background: #fff; border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.tab svg { width: 24px; height: 24px; fill: currentColor; }
.tab.active { color: var(--green); }
.tab-cta svg { background: var(--terra); fill: #fff; border-radius: 14px; padding: 7px; width: 38px; height: 38px; margin-top: -16px; box-shadow: var(--shadow); }
.tab-cta { color: var(--terra); }
.tab-cta.active { color: var(--terra-600); }

/* Hero */
.hero {
  position: relative; color: #fff; padding: 26px 18px 30px;
  background: linear-gradient(150deg, #1e5c39, #2f7d4f 55%, #4f9b6e);
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: auto -20px -30px -20px; height: 80px;
  background: var(--sand); border-radius: 60% 60% 0 0 / 100% 100% 0 0;
}
.hero-hills { position: absolute; right: -10px; bottom: 18px; opacity: .25; width: 180px; }
.hero h1 { font-size: 26px; margin: 6px 0 4px; line-height: 1.15; position: relative; }
.hero p { margin: 0; opacity: .92; font-size: 14px; position: relative; max-width: 78%; }
.kicker { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.16); padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .4px; }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: -14px; position: relative; z-index: 2; }
.quick-card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); }
.quick-card .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #eef5ef; color: var(--green); }
.quick-card .ic svg { width: 22px; height: 22px; fill: currentColor; }
.quick-card b { font-size: 15px; }
.quick-card span { font-size: 12px; color: var(--muted); }
.quick-card.alt .ic { background: #fbeee8; color: var(--terra); }

/* Section heads */
.head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 12px; }
.head h2 { font-size: 18px; margin: 0; }
.head a { font-size: 13px; color: var(--green); text-decoration: none; font-weight: 700; }

/* Place cards horizontal scroll */
.h-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.h-scroll::-webkit-scrollbar { display: none; }
.place {
  min-width: 200px; max-width: 200px; scroll-snap-align: start;
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink); border: 1px solid var(--line);
}
.place .ph { height: 110px; position: relative; }
.place .body { padding: 10px 12px 13px; }
.place .cat { font-size: 11px; font-weight: 700; color: var(--terra); text-transform: uppercase; letter-spacing: .4px; }
.place h3 { font-size: 15px; margin: 3px 0 4px; }
.place .meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.badge-rating { background: rgba(255,255,255,.92); color: var(--ink); position: absolute; top: 8px; right: 8px; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 3px; }
.badge-rating svg { width: 12px; height: 12px; fill: var(--gold); }

/* Generic list card */
.list { display: flex; flex-direction: column; gap: 12px; }
.lcard { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; display: flex; text-decoration: none; color: var(--ink); }
.lcard .ph { width: 96px; flex: 0 0 96px; }
.lcard .body { padding: 11px 12px; flex: 1; min-width: 0; }
.lcard h3 { margin: 2px 0 3px; font-size: 15px; }
.lcard p { margin: 0; font-size: 12px; color: var(--muted); }

/* Map */
.leaflet-map { height: 300px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); position: relative; z-index: 0; background: #dfeede; }
.leaflet-container { font-family: inherit; }
.leaflet-popup-content { margin: 10px 14px; }
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.map-wrap svg { display: block; width: 100%; height: auto; background: #dfeede; }
.pin { cursor: pointer; transition: transform .15s; transform-origin: center bottom; }
.pin:hover { transform: scale(1.15); }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: middle; }

/* Chips / filters */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer; font-weight: 700; font-size: 15px; padding: 14px 18px; border-radius: 14px; text-decoration: none; }
.btn-primary { background: var(--terra); color: #fff; box-shadow: var(--shadow); }
.btn-primary:active { background: var(--terra-600); }
.btn-ghost { background: #fff; color: var(--green); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Detail / hero image header */
.detail-hero { height: 220px; position: relative; }
.detail-back { position: absolute; top: 14px; left: 14px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.detail-back svg { width: 20px; height: 20px; fill: currentColor; }
.detail-body { padding: 16px; }
.detail-body h1 { font-size: 23px; margin: 0 0 6px; }
.pillrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.pill { background: #eef5ef; color: var(--green); font-size: 12px; font-weight: 700; padding: 6px 11px; border-radius: 999px; }
.pill.gold { background: #fbf2dd; color: #946a12; }

/* Cars */
.car { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; margin-bottom: 14px; }
.car .ph { height: 150px; display: grid; place-items: center; background: linear-gradient(135deg,#10131a,#283142); color: #cfe3ff; }
.car .body { padding: 14px; }
.car .specs { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 12px 0; }
.spec { background: var(--sand); border-radius: 12px; padding: 9px; text-align: center; }
.spec b { display: block; font-size: 15px; }
.spec span { font-size: 11px; color: var(--muted); }
.price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
.price-row .p { font-size: 22px; font-weight: 800; color: var(--green); }
.price-row .p small { font-size: 13px; color: var(--muted); font-weight: 600; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; background: #fff; font-family: inherit; color: var(--ink);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Itinerary builder */
.it-pick { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 10px; }
.it-pick .ph { width: 56px; height: 56px; border-radius: 11px; flex: 0 0 56px; }
.it-pick .info { flex: 1; min-width: 0; }
.it-pick .info b { font-size: 14px; }
.it-pick .info span { font-size: 12px; color: var(--muted); display: block; }
.add-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--green); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.add-btn.in { background: var(--terra); }
.it-summary { background: #fff; border: 1px dashed var(--green-300); border-radius: var(--radius); padding: 16px; margin-top: 6px; text-align: center; }
.it-summary b { font-size: 16px; }
.timeline { list-style: none; padding: 0; margin: 10px 0 0; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.timeline li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--terra); margin-top: 4px; flex: 0 0 12px; box-shadow: 0 0 0 3px #fbeee8; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 5px; top: 18px; bottom: -6px; width: 2px; background: var(--line); }

/* Archive / community feed */
.exp { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; margin-bottom: 14px; }
.exp .ph { height: 150px; }
.exp .body { padding: 13px 14px 15px; }
.exp .who { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.exp .who .av { width: 34px; height: 34px; border-radius: 50%; background: var(--green-300); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.exp .who b { font-size: 14px; }
.exp .who span { font-size: 12px; color: var(--muted); }
.exp .route { font-size: 12px; color: var(--green); font-weight: 700; margin-bottom: 6px; }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 13px; }
.opendata { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--green); background: #eef5ef; padding: 4px 9px; border-radius: 999px; }

/* Stat banner */
.stat-banner { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; background: var(--green); color: #fff; border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.stat-banner div { text-align: center; }
.stat-banner b { font-size: 20px; display: block; }
.stat-banner span { font-size: 11px; opacity: .85; }

/* Profile */
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head .av { width: 64px; height: 64px; border-radius: 50%; background: var(--terra); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.profile-head h1 { margin: 0; font-size: 20px; }
.profile-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.menu { margin-top: 18px; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 14px 15px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); font-size: 15px; }
.menu a:last-child { border-bottom: none; }
.menu a svg { width: 20px; height: 20px; fill: var(--muted); }
.menu a .arr { margin-left: auto; color: var(--muted); }

/* Contact box (rent request) */
.contact-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--green); }
.contact-box .email-link { font-size: 19px; color: var(--green); cursor: pointer; word-break: break-all; border-bottom: 2px dashed var(--green-300); padding-bottom: 2px; }
.contact-box .email-link:active { opacity: .6; }

/* Stars input */
.star-input { font-size: 30px; color: var(--line); cursor: pointer; }
.star-input span.on { color: var(--gold); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: transl(-50%, 20px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90%; text-align: center; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* PNRR footer */
.pnrr-footer { margin: 24px 0 0; padding: 16px; border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.pnrr-ref { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.6; margin: 0 0 12px; }
.pnrr-logos { display: flex; align-items: center; justify-content: space-around; gap: 16px; }
.pnrr-eu { height: 40px; width: auto; object-fit: contain; }
.pnrr-mic { height: 32px; width: auto; object-fit: contain; }

/* Misc */
.muted { color: var(--muted); font-size: 13px; }
.note { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--green-300); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--muted); margin-top: 12px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
