/* =====================================================================
   OPERAÇÃO ARCACHON — sistema de design
   Estética: "diário de viagem vintage" + app moderna.
   Azul Bayon · bordeaux · areia da duna · verde dos vinhedos.
   ===================================================================== */

:root {
  /* paleta */
  --ocean:        #1b3a5b;
  --ocean-700:    #214a73;
  --ocean-600:    #2a5d8f;
  --sky:          #3b82c4;
  --azure:        #5aa9e6;
  --azure-soft:   #d9ecf9;

  --wine:         #7a2138;
  --wine-600:     #93304a;
  --wine-soft:    #f3e0e5;

  --sand:         #e6d2a8;
  --sand-deep:    #cda863;
  --sand-soft:    #f4ecd8;
  --gold:         #d9a441;

  --vine:         #4f7942;
  --vine-soft:    #e4eedd;

  --coral:        #e8763a;

  --paper:        #fbf6ec;
  --paper-2:      #f5ecdc;
  --card:         #ffffff;
  --ink:          #1f2733;
  --ink-soft:     #44505f;
  --muted:        #7c8794;
  --line:         #e7ddca;
  --line-2:       #efe7d6;

  --ok:           #3f9d5a;
  --warn:         #d98a2b;
  --danger:       #c0413b;

  /* tipografia */
  --serif: "Fraunces", "Georgia", serif;
  --sans:  "Inter", "Segoe UI", system-ui, sans-serif;

  /* forma */
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(27,58,91,.06), 0 2px 8px rgba(27,58,91,.05);
  --shadow:    0 6px 22px rgba(27,58,91,.10), 0 2px 6px rgba(27,58,91,.06);
  --shadow-lg: 0 18px 50px rgba(27,58,91,.18);

  --nav-w: 264px;
  --header-h: 64px;
  --bottom-nav-h: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 85% -10%, #fff7e8 0%, transparent 55%),
    radial-gradient(900px 500px at -5% 110%, var(--azure-soft) 0%, transparent 50%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1,h2,h3,h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; color: var(--ocean); margin: 0; letter-spacing: -.01em; }
a { color: var(--ocean-600); }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--gold); color: #2a210a; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #d8cbb0; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c3b491; background-clip: content-box; }

/* =====================================================================
   LAYOUT
   ===================================================================== */
.app { display: flex; min-height: 100vh; }

/* ----- Sidebar nav ----- */
.sidebar {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: linear-gradient(180deg, var(--ocean) 0%, #16314c 100%);
  color: #eaf1f8;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
  box-shadow: var(--shadow-lg);
}
.brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.brand-badge {
  display: flex; align-items: center; gap: 12px;
}
.brand-car {
  width: 44px; height: 44px; flex: 0 0 44px;
  background: rgba(255,255,255,.10);
  border-radius: 12px;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.12);
}
.brand-car svg { width: 30px; height: 30px; }
.brand-title { font-family: var(--serif); font-size: 1.18rem; color: #fff; line-height: 1.05; }
.brand-sub { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--sand); margin-top: 3px; }

.nav { padding: 12px 12px 8px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 11px 13px; margin-bottom: 3px;
  border: none; background: transparent;
  color: #d4e0ec; border-radius: 11px;
  font-size: .93rem; font-weight: 500;
  transition: background .15s, color .15s, transform .1s;
}
.nav-item .ic { font-size: 1.18rem; width: 24px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, var(--gold), #e7b85a);
  color: #2c2204; font-weight: 600;
  box-shadow: 0 4px 14px rgba(217,164,65,.35);
}
.nav-foot {
  padding: 14px 18px; font-size: .72rem; color: #95aac0;
  border-top: 1px solid rgba(255,255,255,.10);
}
.nav-foot b { color: var(--sand); }

/* ----- Main ----- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px;
  background: rgba(251,246,236,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar .menu-btn { display: none; }
.topbar h2 { font-size: 1.18rem; }
.topbar .crumb { color: var(--muted); font-size: .82rem; font-family: var(--sans); }
.topbar .spacer { flex: 1; }
.mini-progress { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--ink-soft); }
.mini-progress .bar { width: 120px; height: 8px; background: var(--line); border-radius: 20px; overflow: hidden; }
.mini-progress .bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--vine), var(--gold)); border-radius: 20px; transition: width .5s; }

.view { padding: 26px clamp(16px, 3vw, 36px) 60px; max-width: 1280px; width: 100%; margin: 0 auto; }
.view.full { max-width: none; padding: 0; }

/* page head */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.page-head p { color: var(--ink-soft); margin: 6px 0 0; max-width: 70ch; }
.eyebrow { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--wine); font-weight: 700; }

/* =====================================================================
   COMPONENTES
   ===================================================================== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px){ .cols-4 { grid-template-columns: repeat(2,1fr);} .cols-3{grid-template-columns:repeat(2,1fr);} }
@media (max-width: 720px){ .cols-2,.cols-3,.cols-4 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ocean); font-weight: 600; font-size: .88rem;
  transition: all .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--sand-deep); }
.btn.primary { background: var(--ocean); color: #fff; border-color: var(--ocean); }
.btn.primary:hover { background: var(--ocean-700); }
.btn.gold { background: var(--gold); color: #2c2204; border-color: var(--gold); }
.btn.wine { background: var(--wine); color: #fff; border-color: var(--wine); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.sm { padding: 6px 11px; font-size: .8rem; }
.btn.danger { color: var(--danger); border-color: #eccac8; }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600;
  background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line);
}
.pill.ocean { background: var(--azure-soft); color: var(--ocean); border-color: #bfe0f4; }
.pill.wine  { background: var(--wine-soft); color: var(--wine); border-color: #e9c9d1; }
.pill.vine  { background: var(--vine-soft); color: #36572b; border-color: #cfe0c2; }
.pill.gold  { background: #fbedca; color: #87611a; border-color: #efd79b; }
.pill.warn  { background: #fcecd2; color: #8a5b14; border-color: #f1d49a; }

.tag-camping { background: var(--vine-soft); color:#36572b; border-color:#cfe0c2;}
.tag-airbnb  { background: #ffe9e0; color:#9a4422; border-color:#f6cdbd;}
.tag-hotel   { background: var(--wine-soft); color:var(--wine); border-color:#e9c9d1;}
.tag-home    { background: var(--azure-soft); color:var(--ocean); border-color:#bfe0f4;}

/* =====================================================================
   DASHBOARD
   ===================================================================== */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  background: linear-gradient(120deg, var(--ocean) 0%, var(--ocean-600) 55%, var(--wine) 140%);
  color: #fff; padding: 32px clamp(22px,4vw,44px);
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content:""; position:absolute; inset:0;
  background:
    radial-gradient(420px 220px at 88% 10%, rgba(217,164,65,.35), transparent 60%),
    radial-gradient(360px 260px at 10% 120%, rgba(90,169,230,.30), transparent 60%);
  pointer-events:none;
}
.hero .eyebrow { color: var(--sand); }
.hero h1 { color: #fff; font-size: clamp(2rem, 5vw, 3.1rem); margin: 6px 0 4px; }
.hero .lead { color: #d7e4f0; max-width: 56ch; margin: 0 0 22px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 26px; position: relative; }
.hstat .n { font-family: var(--serif); font-size: 2rem; color: var(--gold); line-height: 1; }
.hstat .l { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: #bcccdb; margin-top: 4px; }

.countdown { display: flex; gap: 10px; margin-top: 4px; }
.cd-box { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); border-radius: 14px; padding: 12px 16px; text-align: center; min-width: 66px; }
.cd-box .n { font-family: var(--serif); font-size: 1.8rem; color: #fff; line-height: 1; }
.cd-box .l { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--sand); margin-top: 5px; }

.stat-card { padding: 18px 20px; display: flex; align-items: center; gap: 15px; }
.stat-card .ic { font-size: 1.7rem; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--paper-2); flex: 0 0 52px; }
.stat-card .n { font-family: var(--serif); font-size: 1.6rem; color: var(--ocean); line-height: 1; }
.stat-card .l { font-size: .78rem; color: var(--muted); margin-top: 3px; }

.next-stop { padding: 20px 22px; }
.next-stop h3 { font-size: 1.05rem; margin-bottom: 4px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; }
.section-title h2 { font-size: 1.4rem; }
.section-title .line { flex: 1; height: 1px; background: var(--line); }

/* =====================================================================
   MAPA
   ===================================================================== */
.map-wrap { display: grid; grid-template-columns: 340px 1fr; gap: 0; height: calc(100vh - var(--header-h)); }
.map-side {
  border-right: 1px solid var(--line); background: var(--paper);
  overflow-y: auto; padding: 18px 16px 40px;
}
#map { height: 100%; width: 100%; z-index: 1; background: #aadaff; }
@media (max-width: 900px){
  .map-wrap { grid-template-columns: 1fr; height: auto; }
  /* mapa em destaque: topo e grande */
  #map { order: -1; height: 56vh; height: 56dvh; min-height: 340px; border-radius: 0 0 16px 16px; }
  .map-side { border-right: none; border-bottom: none; max-height: none; padding: 16px var(--safe-pad, 16px) calc(var(--bottom-nav-h) + 24px); }
}
.map-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toggle {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: .8rem; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.toggle input { display: none; }
.toggle .dot { width: 14px; height: 4px; border-radius: 4px; }
.toggle .dot.ida { background: var(--ocean); }
.toggle .dot.volta { background: var(--wine); }
.toggle.off { opacity: .45; }

.route-total {
  background: linear-gradient(135deg, var(--ocean), var(--ocean-600));
  color: #fff; border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px;
  display: flex; justify-content: space-between; gap: 10px; box-shadow: var(--shadow);
}
.route-total .b { text-align: center; }
.route-total .n { font-family: var(--serif); font-size: 1.45rem; color: var(--gold); line-height: 1; }
.route-total .l { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: #c4d3e2; margin-top: 4px; }

.stop-row {
  display: flex; gap: 11px; padding: 11px 11px; border-radius: 12px;
  border: 1px solid transparent; cursor: pointer; transition: all .14s; align-items: flex-start;
  margin-bottom: 2px;
}
.stop-row:hover { background: #fff; border-color: var(--line); box-shadow: var(--shadow-sm); }
.stop-row.active { background: #fff; border-color: var(--sand-deep); box-shadow: var(--shadow); }
.stop-row.visited .stop-name { color: var(--muted); }
.stop-dot {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: #fff;
  background: var(--ocean); margin-top: 1px; position: relative;
}
.stop-dot.type-stop { background: var(--azure); }
.stop-dot.type-overnight { background: var(--ocean); }
.stop-dot.type-base { background: var(--vine); }
.stop-dot.type-birthday { background: var(--wine); }
.stop-dot.type-start { background: var(--ink); }
.stop-dot.type-optional { background: var(--sand-deep); }
.stop-row.visited .stop-dot::after {
  content:"✓"; position:absolute; inset:0; display:grid; place-items:center;
  background: var(--ok); border-radius:50%; font-size:.85rem;
}
.stop-name { font-weight: 600; font-size: .92rem; color: var(--ink); }
.stop-meta { font-size: .76rem; color: var(--muted); margin-top: 1px; }
.stop-short { font-size: .78rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.35; }
.stop-actions { margin-top: 8px; display: flex; gap: 6px; }

.legend { font-size: .76rem; color: var(--ink-soft); margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.legend .row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.legend .sw { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px; }

/* Leaflet popup skin */
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 14px 16px; font-family: var(--sans); }
.popup h4 { font-size: 1.02rem; margin-bottom: 2px; }
.popup .meta { font-size: .76rem; color: var(--muted); margin-bottom: 8px; }
.popup p { margin: 0 0 10px; font-size: .85rem; color: var(--ink-soft); }
.popup .pbtn { display:flex; gap:6px; }

/* car marker */
.car-marker { filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.passing-marker { background: #fff; border: 2px dashed var(--muted); border-radius: 50%; }

/* =====================================================================
   ITINERÁRIO
   ===================================================================== */
.day-card { overflow: hidden; }
.day-head {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; cursor: pointer;
  transition: background .15s;
}
.day-head:hover { background: var(--paper); }
.day-num {
  width: 50px; height: 50px; flex: 0 0 50px; border-radius: 14px;
  background: linear-gradient(135deg, var(--ocean), var(--ocean-600)); color: #fff;
  display: grid; place-items: center; text-align: center; line-height: 1;
}
.day-num.volta { background: linear-gradient(135deg, var(--wine), var(--wine-600)); }
.day-num .d { font-family: var(--serif); font-size: 1.3rem; }
.day-num .s { font-size: .54rem; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.day-info { flex: 1; min-width: 0; }
.day-info .t { font-weight: 700; color: var(--ink); font-size: 1.02rem; }
.day-info .m { font-size: .79rem; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.day-stats { text-align: right; font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.day-stats b { color: var(--ocean); font-family: var(--serif); font-size: 1rem; }
.day-chevron { transition: transform .25s; color: var(--muted); }
.day-card.open .day-chevron { transform: rotate(90deg); }
.day-body { display: none; padding: 4px 20px 20px; border-top: 1px solid var(--line-2); }
.day-card.open .day-body { display: block; }

.day-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }

.timeline { position: relative; margin: 8px 0 0; padding-left: 26px; }
.timeline::before { content:""; position:absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 6px 0 14px; }
.tl-item::before {
  content:""; position:absolute; left: -22px; top: 9px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid var(--azure);
}
.tl-item.t-stop::before { border-color: var(--ocean); }
.tl-item.t-food::before { border-color: var(--coral); }
.tl-item.t-sight::before { border-color: var(--vine); }
.tl-item.t-sleep::before { border-color: var(--wine); }
.tl-item.t-pass::before { border-color: var(--muted); background: repeating-conic-gradient(var(--muted) 0 25%, #fff 0 50%); }
.tl-item.t-arrive::before, .tl-item.t-drive::before { border-color: var(--sand-deep); }
.tl-time { font-size: .74rem; font-weight: 700; color: var(--ocean); letter-spacing: .03em; }
.tl-text { font-size: .87rem; color: var(--ink-soft); margin-top: 1px; }
.tl-dur { font-size: .7rem; color: var(--coral); font-weight: 600; }

.alert-box { background: #fff7ea; border: 1px solid #f0dcb0; border-left: 4px solid var(--warn); border-radius: 10px; padding: 10px 14px; margin-top: 8px; font-size: .83rem; color: #6f5012; }
.alert-box b { color: var(--warn); }
.note-box { background: var(--azure-soft); border: 1px solid #c5e2f4; border-radius: 10px; padding: 10px 14px; margin-top: 10px; font-size: .83rem; color: var(--ocean); }

/* =====================================================================
   BAGAGEM
   ===================================================================== */
.pack-toolbar { display:flex; flex-wrap:wrap; gap:12px; align-items:center; margin-bottom: 20px; }
.progress-ring { display:flex; align-items:center; gap: 14px; }
.pack-cat { margin-bottom: 18px; }
.pack-cat-head { display:flex; align-items:center; justify-content:space-between; padding: 12px 18px; cursor:pointer; }
.pack-cat-head h3 { font-size: 1.05rem; }
.pack-cat-head .count { font-size: .8rem; color: var(--muted); font-weight: 600; }
.pack-list { padding: 0 12px 12px; }
.pack-item {
  display:flex; align-items:flex-start; gap: 12px; padding: 10px 12px; border-radius: 11px;
  transition: background .12s; border: 1px solid transparent;
}
.pack-item:hover { background: var(--paper); border-color: var(--line-2); }
.pack-item.done { opacity: .58; }
.pack-item.done .pi-name { text-decoration: line-through; }
.checkbox {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 7px; border: 2px solid var(--sand-deep);
  background: #fff; display: grid; place-items: center; margin-top: 1px; transition: all .15s; color: #fff; font-size: .8rem;
}
.pack-item.done .checkbox, .check-on { background: var(--ok); border-color: var(--ok); }
.pi-name { font-size: .9rem; font-weight: 500; color: var(--ink); }
.pi-note { font-size: .78rem; color: var(--coral); margin-top: 3px; line-height: 1.35; }
.pi-ess { font-size:.62rem; letter-spacing:.06em; text-transform:uppercase; color: var(--wine); font-weight:700; margin-left: 6px; }
.pi-actions { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.pack-item:hover .pi-actions { opacity: 1; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.icon-btn:hover { color: var(--ocean); border-color: var(--sand-deep); }
.icon-btn.del:hover { color: var(--danger); border-color: #eccac8; }

/* =====================================================================
   SELOS / STAMPS
   ===================================================================== */
.stamps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px; align-items: start; }
.stamp { background: none; border: none; padding: 0; cursor: pointer; display: block; width: 100%; }
.stamp-svg { width: 100%; height: auto; display: block; transition: transform .25s, filter .25s; }
.stamp.earned { animation: stampPop .55s cubic-bezier(.2,1.3,.5,1) both; }
.stamp.earned:hover .stamp-svg { transform: rotate(-2.5deg) scale(1.05); }
.stamp.locked .stamp-svg { filter: grayscale(.7) contrast(.95); }
.stamp.locked:hover .stamp-svg { filter: grayscale(.25); transform: scale(1.03); }
@keyframes stampPop { 0%{transform: scale(0) rotate(-22deg); opacity:0;} 60%{transform: scale(1.1) rotate(5deg);} 100%{transform: scale(1) rotate(-1.5deg); opacity:1;} }
.stamp-mini { width: 80px; cursor: pointer; transition: transform .2s; }
.stamp-mini:hover { transform: translateY(-3px) rotate(-2deg); }
.stamp-mini svg { width: 100%; height: auto; display: block; }
.stamp-mini.locked svg { filter: grayscale(.75); opacity: .85; }

.stamp-progress { text-align: center; margin: 4px 0 30px; }
.big-ring { width: 130px; height: 130px; margin: 0 auto 6px; }

.surprise {
  margin-top: 30px; border-radius: var(--r-lg); padding: 36px;
  background: linear-gradient(135deg, var(--wine), var(--ocean));
  color: #fff; text-align: center; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.surprise.locked { background: #efe7d6; color: var(--muted); }
.surprise h2 { color: #fff; font-size: 1.8rem; }
.surprise.locked h2 { color: var(--muted); }

/* =====================================================================
   CURIOSIDADES
   ===================================================================== */
.curio-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.curio-head { padding: 16px 20px 12px; display:flex; justify-content:space-between; align-items:flex-start; gap: 10px; border-bottom: 1px solid var(--line-2); background: var(--paper); }
.curio-head h3 { font-size: 1.12rem; }
.curio-time { font-size: .72rem; font-weight: 700; white-space: nowrap; }
.curio-body { padding: 14px 20px 18px; }
.curio-sec { margin-bottom: 12px; }
.curio-sec h4 { font-family: var(--sans); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--wine); margin-bottom: 6px; }
.curio-sec ul { margin: 0; padding-left: 18px; }
.curio-sec li { font-size: .85rem; color: var(--ink-soft); margin-bottom: 4px; line-height: 1.4; }
.fact { font-size: .85rem; color: var(--ink-soft); display: flex; gap: 8px; margin-bottom: 7px; line-height: 1.4; }
.fact::before { content:"💡"; flex: 0 0 auto; }
.chip-row { display:flex; flex-wrap:wrap; gap:6px; }
.chip { font-size: .8rem; padding: 5px 11px; border-radius: 20px; background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-soft); }

/* =====================================================================
   CUSTOS
   ===================================================================== */
.cost-cat { padding: 18px 20px; }
.cost-cat-head { display:flex; align-items:center; gap:12px; margin-bottom: 12px; }
.cost-cat-head .ic { font-size:1.4rem; }
.cost-cat-head .ttl { font-weight:700; color:var(--ink); flex:1; }
.cost-cat-head .amt { font-family:var(--serif); color:var(--ocean); font-size:1.1rem; }
.cost-item { display:flex; justify-content:space-between; gap:12px; padding: 8px 0; border-bottom:1px dashed var(--line-2); font-size:.86rem; }
.cost-item:last-child { border-bottom:none; }
.cost-item .nm { color:var(--ink-soft); }
.cost-item .dt { color:var(--muted); font-size:.76rem; }
.cost-item .vl { font-weight:600; color:var(--ink); white-space:nowrap; }
.cost-total { background: linear-gradient(135deg, var(--ocean), var(--wine)); color:#fff; border-radius:var(--r-lg); padding: 26px; text-align:center; box-shadow: var(--shadow); }
.cost-total .n { font-family:var(--serif); font-size:2.4rem; color:var(--gold); }

/* bars */
.bar-track { height: 10px; background: var(--line); border-radius: 20px; overflow: hidden; }
.bar-track > i { display:block; height:100%; border-radius:20px; background: linear-gradient(90deg, var(--ocean), var(--azure)); transition: width .5s; }

/* =====================================================================
   DIÁRIO
   ===================================================================== */
.journal-day { padding: 16px 20px; margin-bottom: 14px; }
.journal-day h3 { font-size: 1rem; margin-bottom: 8px; display:flex; align-items:center; gap:10px; }
.journal-day textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-family: var(--sans); font-size: .9rem; color: var(--ink); resize: vertical; min-height: 72px;
  background: var(--paper); transition: border .15s, background .15s;
}
.journal-day textarea:focus { outline:none; border-color: var(--azure); background: #fff; box-shadow: 0 0 0 3px var(--azure-soft); }

/* =====================================================================
   RESERVAS
   ===================================================================== */
.resv-item { display:flex; gap:12px; align-items:center; padding: 13px 16px; border-bottom:1px solid var(--line-2); }
.resv-item:last-child { border-bottom:none; }
.resv-item.done { opacity:.55; }
.resv-item.done .resv-text { text-decoration: line-through; }
.resv-text { font-size:.9rem; color:var(--ink); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.resv-link { display:inline-block; margin-top:3px; font-size:.78rem; color:var(--ocean-600); text-decoration:none; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.resv-link:hover { text-decoration:underline; }
.resv-actions { display:flex; gap:5px; flex:0 0 auto; }
.prio { font-size:.62rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; padding:2px 8px; border-radius:12px; flex:0 0 auto; }
.prio.alta { background:#fbe3e0; color:var(--danger);}
.prio.média { background:#fcecd2; color:#8a5b14;}
.prio.baixa { background:var(--vine-soft); color:#36572b;}

/* =====================================================================
   EDITOR DE ROTA (mapa)
   ===================================================================== */
.toggle.btn-edit { cursor:pointer; }
.toggle.active-edit { background: var(--ocean); color:#fff; border-color: var(--ocean); }
.route-editor { background:#fff; border:1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.re-title { font-size:.74rem; color:var(--muted); margin-bottom:10px; line-height:1.4; }
.re-seg { margin-bottom: 12px; }
.re-seg:last-child { margin-bottom:0; }
.re-seg-head { display:flex; align-items:center; gap:8px; font-size:.86rem; color:var(--ink); margin-bottom:6px; }
.re-dot { width:12px; height:4px; border-radius:4px; flex:0 0 12px; }
.re-count { font-size:.7rem; color:var(--muted); font-weight:600; margin-left:auto; }
.re-count.warn { color:var(--danger); }
.re-list { border:1px solid var(--line-2); border-radius:10px; overflow:hidden; }
.re-item { display:flex; align-items:center; gap:8px; padding:6px 10px; border-bottom:1px solid var(--line-2); font-size:.83rem; }
.re-item:last-child { border-bottom:none; }
.re-item.off { opacity:.45; background:repeating-linear-gradient(45deg,#fafafa,#fafafa 6px,#f1f1f1 6px,#f1f1f1 12px); }
.re-name { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--ink); }
.re-lock { font-size:.7rem; }
.re-ctrls { display:flex; gap:3px; flex:0 0 auto; }
.re-ctrls .icon-btn { width:26px; height:26px; font-size:.8rem; }
.icon-btn:disabled { opacity:.3; cursor:not-allowed; }

/* =====================================================================
   FOTOS DO DIÁRIO
   ===================================================================== */
.photo-row { display:flex; flex-wrap:wrap; gap:10px; margin-top:12px; }
.photo-thumb { position:relative; width:88px; height:88px; border-radius:12px; overflow:hidden; border:1px solid var(--line); box-shadow:var(--shadow-sm); cursor:pointer; transition:transform .15s; }
.photo-thumb:hover { transform:scale(1.04); }
.photo-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.photo-del { position:absolute; top:3px; right:3px; width:22px; height:22px; border-radius:50%; border:none; background:rgba(20,30,45,.7); color:#fff; font-size:.9rem; line-height:1; display:grid; place-items:center; opacity:0; transition:opacity .15s; }
.photo-thumb:hover .photo-del { opacity:1; }
.photo-add { width:88px; height:88px; border-radius:12px; border:2px dashed var(--sand-deep); background:var(--paper); color:var(--muted); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; font-size:1.3rem; cursor:pointer; transition:all .15s; }
.photo-add span { font-size:.66rem; }
.photo-add:hover { border-color:var(--ocean); color:var(--ocean); background:#fff; }
.lightbox { display:grid; place-items:center; }
.lightbox img { max-width:100%; max-height:68vh; border-radius:12px; }
.modal.wide { max-width: 760px; }

/* =====================================================================
   MODAL & TOAST
   ===================================================================== */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20,30,45,.55); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-bg.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 440px; padding: 24px; animation: modalIn .25s ease both;
}
@keyframes modalIn { from{opacity:0; transform: translateY(14px) scale(.97);} to{opacity:1; transform:none;} }
.modal h3 { margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.field label { display:block; font-size:.78rem; font-weight:600; color:var(--ink-soft); margin-bottom:5px; }
.field input, .field select, .field textarea {
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px; font-family:inherit; font-size:.9rem; color:var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline:none; border-color:var(--azure); box-shadow:0 0 0 3px var(--azure-soft); }
.modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top: 18px; }

.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 2000; display:flex; flex-direction:column; gap:10px; }
.toast {
  background: var(--ocean); color:#fff; padding: 13px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: .88rem; font-weight: 500; display:flex; align-items:center; gap:10px; animation: toastIn .3s ease both; max-width: 340px;
}
.toast.gold { background: linear-gradient(135deg, var(--gold), #e7b85a); color:#2c2204; }
.toast.win { background: linear-gradient(135deg, var(--wine), var(--ocean)); }
@keyframes toastIn { from{opacity:0; transform: translateX(40px);} to{opacity:1; transform:none;} }

.empty { text-align:center; color:var(--muted); padding: 30px; font-size:.9rem; }

/* confetti canvas */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1500; display: none; }

/* =====================================================================
   RESPONSIVE NAV
   ===================================================================== */
@media (max-width: 860px){
  /* navegação passa para a barra inferior — esconder sidebar */
  .sidebar { display: none; }
  .scrim { display: none !important; }
  .bottom-nav { display: flex; }

  /* header compacto */
  .topbar { height: 50px; padding: 0 14px; }
  .topbar h2 { font-size: 1.04rem; }
  .topbar .crumb { display: none; }
  .topbar .menu-btn { display: none; }
  .mini-progress { gap: 7px; }
  .mini-progress .bar { width: 56px; }

  /* respiro para a barra inferior */
  .view { padding: 16px 16px calc(var(--bottom-nav-h) + 26px); }
  .view.full { padding: 0; }

  /* tipografia / proporção */
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: clamp(1.55rem, 6.5vw, 2rem); }
  .page-head p { font-size: .9rem; }
  .eyebrow { font-size: .68rem; }
  .section-title { margin: 24px 0 12px; }
  .section-title h2 { font-size: 1.2rem; }

  /* dashboard / hero */
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: clamp(1.9rem, 9vw, 2.6rem); }
  .hero .lead { font-size: .92rem; }
  .hero-img { width: min(320px, 74vw) !important; margin: 0 auto; }
  .hero-stats { gap: 14px 20px !important; }
  .hstat .n { font-size: 1.6rem; }
  .cd-box { min-width: 58px; padding: 10px 12px; }

  /* itinerário compacto */
  .day-head { gap: 12px; padding: 13px 14px; }
  .day-num { width: 44px; height: 44px; flex-basis: 44px; }
  .day-info .t { font-size: .95rem; }

  /* ações sempre visíveis (sem hover no telemóvel) + alvos de toque */
  .pi-actions, .photo-del { opacity: 1; }
  .icon-btn { width: 40px; height: 40px; }
  .re-ctrls .icon-btn { width: 34px; height: 34px; }

  /* selos 2 por linha */
  .stamps-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }

  /* reservas: ações não espremem o texto */
  .resv-item { flex-wrap: wrap; }
  .resv-item .resv-text { font-size: .88rem; }
  .prio { order: 3; }
  .resv-actions { margin-left: auto; }

  /* custos comparação */
  .cmp-head { flex-wrap: wrap; gap: 4px; }

  /* álbum */
  .album-toolbar { flex-direction: column; align-items: stretch; }
  .album-toolbar .btn { width: 100%; justify-content: center; }
  .album-page { padding: 22px 18px; }
  .album-page.cover { min-height: 0; }
  .ap-head h2 { font-size: 1.12rem; }
  .ap-photos, .ap-photos.n3, .ap-photos.n4 { grid-template-columns: 1fr; }
}
@media (min-width: 861px){
  .bottom-nav, .sheet, .sheet-scrim { display: none !important; }
}

.fade { animation: fade .35s ease both; }
@keyframes fade { from{opacity:0; transform: translateY(8px);} to{opacity:1; transform:none;} }

/* =====================================================================
   NAVEGAÇÃO INFERIOR (mobile) + SHEET "Mais"
   ===================================================================== */
.bottom-nav {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom-nav-h);
  background: rgba(251,246,236,.97); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); z-index: 60;
  padding-bottom: env(safe-area-inset-bottom);
}
/* a barra inferior só aparece no mobile; no desktop é escondida pela media query min-width:861 */
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: none; background: none; color: var(--muted); font-size: .62rem; font-weight: 600;
  cursor: pointer; padding: 6px 2px; position: relative; font-family: inherit;
}
.bn-item .ic { font-size: 1.32rem; line-height: 1; }
.bn-item.active { color: var(--ocean); }
.bn-item.active::before { content:""; position:absolute; top:0; left:50%; transform:translateX(-50%); width:28px; height:3px; border-radius:0 0 4px 4px; background: var(--gold); }

.sheet-scrim { display: none; position: fixed; inset: 0; background: rgba(20,30,45,.5); z-index: 65; }
.sheet-scrim.show { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 66;
  background: #fff; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(110%); transition: transform .3s cubic-bezier(.2,.85,.3,1);
  padding: 10px 16px calc(22px + env(safe-area-inset-bottom)); max-height: 82vh; overflow-y: auto;
}
.sheet.show { transform: translateY(0); }
.sheet-handle { width: 42px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 14px; }
.sheet-title { font-family: var(--serif); font-size: 1.12rem; color: var(--ocean); margin-bottom: 14px; text-align: center; }
.sheet-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-item { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 16px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); cursor: pointer; text-align: center; font-family: inherit; }
.sheet-item .ic { font-size: 1.55rem; line-height: 1; }
.sheet-item .l { font-size: .72rem; font-weight: 600; color: var(--ink); }
.sheet-item.active { border-color: var(--gold); background: #fbedca; }
@media print { .bottom-nav, .sheet, .sheet-scrim { display: none !important; } }

/* ===== pin de cidade opcional (mapa) ===== */
.opt-pin { width:24px; height:24px; border-radius:50%; background:#fff; border:2px solid #2a9d8f; color:#2a9d8f; display:grid; place-items:center; font-weight:700; font-size:.85rem; box-shadow:0 2px 5px rgba(0,0,0,.35); cursor:pointer; transition:transform .12s, background .12s; }
.opt-pin:hover { background:#2a9d8f; color:#fff; transform:scale(1.18); }

/* ===== comparação de custos ===== */
.cmp-row { margin-bottom:14px; }
.cmp-row:last-child { margin-bottom:0; }
.cmp-head { display:flex; justify-content:space-between; gap:10px; font-size:.86rem; color:var(--ink); margin-bottom:5px; }
.cmp-val { font-weight:600; white-space:nowrap; }
.cmp-val.over { color:var(--danger); }
.cmp-bar { position:relative; height:12px; background:var(--line); border-radius:20px; overflow:hidden; }
.cmp-bar .cmp-plan { position:absolute; left:0; top:0; bottom:0; background:repeating-linear-gradient(45deg,#e3d8bd,#e3d8bd 5px,#efe7d6 5px,#efe7d6 10px); }
.cmp-bar i { position:absolute; left:0; top:0; bottom:0; background:linear-gradient(90deg,var(--vine),#6fae7a); border-radius:20px; transition:width .5s; }
.cmp-bar i.over { background:linear-gradient(90deg,var(--coral),var(--danger)); }
.cost-amt { font-family:var(--serif); color:var(--ocean); font-weight:600; white-space:nowrap; flex:0 0 auto; }

/* ===== nota de reserva ===== */
.resv-note { font-size:.8rem; color:var(--ink-soft); margin-top:5px; background:var(--paper-2); border-radius:8px; padding:5px 10px; border-left:3px solid var(--sand-deep); line-height:1.4; }

/* =====================================================================
   ÁLBUM
   ===================================================================== */
.album-toolbar { display:flex; gap:16px; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; margin-bottom:14px; }
.album-root { display:flex; flex-direction:column; align-items:center; gap:26px; }
.album-page { width:100%; max-width:780px; background:#fff; border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow); padding:34px 40px; }
.album-page.cover { padding:0; overflow:hidden; position:relative; display:flex; flex-direction:column; min-height:520px; }
.cover-art { flex:1; overflow:hidden; min-height:300px; background:linear-gradient(135deg,var(--ocean),var(--wine)); }
.cover-art img { width:100%; height:100%; object-fit:cover; display:block; }
.cover-band { background:linear-gradient(180deg,#fff,var(--paper)); padding:26px 30px 32px; text-align:center; border-top:4px solid var(--gold); }
.cover-eyebrow { letter-spacing:.18em; text-transform:uppercase; font-size:.7rem; color:var(--wine); font-weight:700; }
.cover-band h1 { font-size:clamp(2rem,5vw,3rem); margin:6px 0 2px; }
.cover-band p { color:var(--ink-soft); margin:0 0 12px; }
.cover-meta { font-size:.86rem; color:var(--ocean); font-weight:600; }
.cover-sign { font-family:var(--serif); color:var(--muted); margin-top:10px; font-size:.92rem; }
.ap-head { display:flex; gap:16px; align-items:flex-start; border-bottom:2px solid var(--line); padding-bottom:14px; margin-bottom:16px; }
.ap-daynum { width:52px; height:52px; flex:0 0 52px; border-radius:13px; background:linear-gradient(135deg,var(--ocean),var(--ocean-600)); color:#fff; display:grid; place-items:center; font-family:var(--serif); font-size:1.5rem; }
.ap-daynum.volta { background:linear-gradient(135deg,var(--wine),var(--wine-600)); }
.ap-date { font-size:.76rem; color:var(--muted); letter-spacing:.04em; }
.ap-head h2 { font-size:1.3rem; margin:2px 0 7px; }
.ap-cities { display:flex; flex-wrap:wrap; gap:6px; }
.ap-cities span { font-size:.78rem; background:var(--paper-2); border:1px solid var(--line); border-radius:20px; padding:2px 10px; color:var(--ink-soft); }
.ap-journal { font-size:.95rem; line-height:1.65; color:var(--ink); margin-bottom:16px; }
.ap-journal.empty { color:var(--muted); font-style:italic; }
.ap-photos { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-bottom:16px; }
.ap-photos.n1 { grid-template-columns:1fr; }
.ap-photos img { width:100%; height:180px; object-fit:cover; border-radius:8px; }
.ap-stamps { display:flex; flex-wrap:wrap; gap:10px; }
.ap-stamps.wrap { justify-content:center; gap:14px; margin:20px 0; }
.ap-stamp { width:94px; }
.ap-stamp.sm { width:78px; }
.ap-stamp svg { width:100%; height:auto; display:block; }
.closing-stats { display:flex; justify-content:center; flex-wrap:wrap; gap:30px; margin:20px 0; }
.closing-stats div { text-align:center; }
.closing-stats b { font-family:var(--serif); font-size:1.7rem; color:var(--ocean); display:block; }
.closing-stats span { font-size:.74rem; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.closing-msg { text-align:center; font-family:var(--serif); font-size:1.15rem; color:var(--wine); line-height:1.7; }
.closing-msg span { font-size:.85rem; color:var(--muted); }

/* =====================================================================
   CADEADO (PIN) + INDICADOR DE SINCRONIZAÇÃO
   ===================================================================== */
.pin-gate {
  position: fixed; inset: 0; z-index: 3000;
  display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 80% -10%, #214a73, transparent 60%),
              radial-gradient(700px 500px at 0% 120%, #5a1f30, transparent 55%),
              linear-gradient(160deg, var(--ocean), #16314c);
  animation: fade .3s ease both;
}
.pin-gate.out { opacity: 0; transition: opacity .35s; pointer-events: none; }
.pin-card {
  width: 100%; max-width: 360px; background: #fff; border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 30px 28px; text-align: center;
}
.pin-car { width: 60px; height: 60px; margin: 0 auto 10px; background: var(--azure-soft); border-radius: 16px; display: grid; place-items: center; }
.pin-card h2 { font-size: 1.4rem; }
.pin-card p { color: var(--ink-soft); font-size: .88rem; margin: 6px 0 18px; }
.pin-card input {
  width: 100%; padding: 13px 14px; border: 2px solid var(--line); border-radius: 12px;
  font-family: var(--sans); font-size: 1.2rem; text-align: center; letter-spacing: .25em; color: var(--ink);
}
.pin-card input:focus { outline: none; border-color: var(--azure); box-shadow: 0 0 0 3px var(--azure-soft); }
.pin-card .btn { width: 100%; justify-content: center; margin-top: 14px; padding: 12px; }
.pin-err { color: var(--danger); font-size: .82rem; min-height: 18px; margin-top: 8px; }
.pin-card.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-7px)} 40%,80%{transform:translateX(7px)} }

.sync-badge {
  position: fixed; bottom: 16px; right: 16px; z-index: 1900;
  background: var(--ocean); color: #fff; font-size: .76rem; font-weight: 600;
  padding: 7px 13px; border-radius: 20px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(8px); pointer-events: none;
}
.sync-badge.show { animation: badgeInOut 2.6s ease both; }
@keyframes badgeInOut { 0%{opacity:0;transform:translateY(8px)} 12%,75%{opacity:1;transform:none} 100%{opacity:0;transform:translateY(8px)} }
@media print { .pin-gate, .sync-badge { display: none !important; } }

/* ===== impressão do álbum (Guardar como PDF) ===== */
@media print {
  @page { size: A4; margin: 11mm; }
  body { background:#fff !important; }
  body, .album-page, .stamp-svg, .cover-art, .ap-photos img { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .sidebar, .topbar, .scrim, .album-toolbar, .album-hint, .toast-wrap, #confetti { display:none !important; }
  .app, .main, .view { display:block !important; padding:0 !important; margin:0 !important; max-width:none !important; }
  .album-root { display:block; gap:0; }
  .album-page { break-after:page; page-break-after:always; box-shadow:none !important; border:none !important; border-radius:0 !important; max-width:none !important; width:100%; padding:0 0 8mm; margin:0; }
  .album-page:last-child { break-after:auto; page-break-after:auto; }
  .album-page.cover { min-height:255mm; }
  .ap-photos img { height:58mm; }
  .ap-head, .ap-journal, .ap-stamps { break-inside:avoid; }
}
