/* Porcino.ai map component. Colors come from --pm-* tokens so the host page can theme it. */
.pm-root {
  --pm-picco: #7a3a17;
  --pm-stagione: #c0862b;
  --pm-margine: #e3cf96;
  --pm-fuori: #9aa39b;
  --pm-route: #1f6fd1;
  --pm-bg: #f3f4ef;
  --pm-surface: #ffffff;
  --pm-fg: #1b2a20;
  --pm-muted: #5d6b61;
  --pm-line: #d8dcd2;
  --pm-forest: #1f4a32;
  --pm-height: 640px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto var(--pm-height);
  grid-template-areas: "bar bar" "map panel";
  border: 1px solid var(--pm-line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--pm-surface);
  color: var(--pm-fg);
  position: relative;
  font: inherit;
}
.pm-map { grid-area: map; min-width: 0; background: #d6e4e9; }
.pm-panel { grid-area: panel; overflow-y: auto; padding: 18px 18px 22px; border-left: 1px solid var(--pm-line); background: var(--pm-surface); }
.pm-bar { grid-area: bar; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 14px; border-bottom: 1px solid var(--pm-line); background: var(--pm-bg); }
.pm-month { display: flex; align-items: center; gap: 10px; font-size: .85rem; flex: 1 1 260px; min-width: 0; }
.pm-month span { color: var(--pm-muted); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.pm-month input { flex: 1; min-width: 0; accent-color: var(--pm-picco); }
.pm-month output { min-width: 6.5em; font-weight: 600; }
.pm-toggles { display: flex; gap: 4px; }
.pm-toggles button, .pm-add, .pm-btn, .pm-draw button, .pm-back {
  font: inherit; font-size: .82rem; border-radius: 999px; border: 1px solid var(--pm-line); background: var(--pm-surface); color: var(--pm-fg);
  padding: 6px 12px; cursor: pointer; line-height: 1.2;
}
.pm-toggles button[aria-pressed="true"] { background: #1f4a32; color: #fff; border-color: #1f4a32; }
.pm-add { background: var(--pm-picco); color: #fff; border-color: var(--pm-picco); font-weight: 600; }
.pm-btn.is-primary, .pm-draw .is-primary { background: #1f4a32; border-color: #1f4a32; color: #fff; font-weight: 600; }
.pm-danger { color: #a3261b; border-color: #e3b5ae; }
.pm-root button:focus-visible, .pm-root input:focus-visible, .pm-root select:focus-visible, .pm-root textarea:focus-visible { outline: 2px solid var(--pm-route); outline-offset: 2px; }
.pm-btn:disabled { opacity: .6; cursor: progress; }

/* map styling */
.pm-relief { filter: saturate(.9); }
.pm-region { stroke: #6d7a70; stroke-opacity: .55; stroke-dasharray: 3 3; }
.pm-lake { fill: #b7d3de; fill-opacity: 1; stroke: #8fb6c6; }
.pm-river { stroke: #7fb0c6; stroke-opacity: .9; fill: none; }
.pm-zone { fill-opacity: .55; stroke-opacity: .95; cursor: pointer; transition: fill-opacity .2s; }
.pm-zone:hover { fill-opacity: .75; }
.pm-zone.s-picco { fill: var(--pm-picco); stroke: var(--pm-picco); }
.pm-zone.s-stagione { fill: var(--pm-stagione); stroke: #96661c; }
.pm-zone.s-margine { fill: var(--pm-margine); stroke: #b49a55; }
.pm-zone.s-fuori { fill: var(--pm-fuori); fill-opacity: .18; stroke: #7d877f; stroke-dasharray: 3 3; }
.pm-zone.is-selected { stroke: #111; stroke-width: 2.5; fill-opacity: .8; }
.pm-route { stroke: var(--pm-route); stroke-linecap: round; stroke-linejoin: round; fill: none; cursor: pointer; }
.pm-route.is-draft { stroke-dasharray: 6 5; }
.pm-vertex { fill: #fff; stroke: var(--pm-route); stroke-width: 2; fill-opacity: 1; }
.is-drawing .pm-map { cursor: crosshair; }
.is-drawing .leaflet-interactive { cursor: crosshair; }
.pm-news-pin span {
  display: block; font: 600 10px/20px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em; text-align: center;
  background: #fff; color: #1b2a20; border: 1.5px solid #1b2a20; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.pm-news-pin.e-buona span { background: #1f4a32; color: #fff; border-color: #1f4a32; }
.pm-news-pin.e-scarsa span { background: #fff; color: #7a3a17; border-color: #7a3a17; }
.pm-news-pin.e-in-arrivo span { background: #f4e6c4; color: #5b3d0c; border-color: #b8862c; }
.pm-tip { font: 600 12px system-ui, sans-serif; }
.leaflet-container { font: inherit; }
.pm-root .leaflet-control-attribution { font-size: 10px; line-height: 1.4; }

/* panel content */
.pm-kicker { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--pm-muted); }
.pm-h { margin: 4px 0 10px; font-size: 1.25rem; line-height: 1.2; text-wrap: balance; }
.pm-sub { margin: 18px 0 6px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--pm-muted); }
.pm-p { margin: 6px 0; font-size: .9rem; line-height: 1.5; }
.pm-note { margin-top: 14px; font-size: .78rem; color: var(--pm-muted); line-height: 1.45; }
.pm-err { color: #a3261b; font-size: .85rem; }
.pm-back { margin-bottom: 12px; padding: 4px 10px; }
.pm-link { font: inherit; background: none; border: 0; padding: 0; color: var(--pm-forest); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; }
.pm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .9rem; }
.pm-list small { color: var(--pm-muted); }
.pm-legend { display: grid; gap: 6px; margin: 8px 0 4px; }
.pm-leg { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: center; font-size: .88rem; }
.pm-leg i { width: 14px; height: 14px; border-radius: 50%; }
.pm-leg b { font-variant-numeric: tabular-nums; }
.pm-leg i.s-picco, .pm-cal-m.s-picco, .pm-pill.s-picco { background: var(--pm-picco); color: #fff; }
.pm-leg i.s-stagione, .pm-cal-m.s-stagione, .pm-pill.s-stagione { background: var(--pm-stagione); color: #1b1408; }
.pm-leg i.s-margine, .pm-pill.s-margine { background: var(--pm-margine); color: #3b2c08; }
.pm-leg i.s-fuori, .pm-cal-m.s-fuori, .pm-pill.s-fuori { background: #e3e6e0; color: #4b554e; }
.pm-leg i.s-fuori { border: 1px dashed #7d877f; }
.pm-pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pm-cal { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; margin: 12px 0 4px; }
.pm-cal-m { font-size: .68rem; text-align: center; padding: 4px 0; border-radius: 3px; font-weight: 600; }
.pm-cal-m.is-now { outline: 2px solid var(--pm-fg); outline-offset: 1px; }
.pm-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: .88rem; }
.pm-dl dt { color: var(--pm-muted); }
.pm-dl dd { margin: 0; }
.pm-news { border: 1px solid var(--pm-line); border-left: 4px solid var(--pm-fuori); border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-size: .86rem; }
.pm-news.e-buona { border-left-color: var(--pm-forest); }
.pm-news.e-scarsa { border-left-color: var(--pm-picco); }
.pm-news.e-in-arrivo { border-left-color: var(--pm-stagione); }
.pm-news p { margin: 6px 0; line-height: 1.45; }
.pm-news a { color: var(--pm-forest); font-weight: 600; }
.pm-news-meta { display: flex; justify-content: space-between; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pm-muted); }
.pm-form { display: grid; gap: 6px; }
.pm-form label { font-size: .78rem; color: var(--pm-muted); margin-top: 6px; }
.pm-form input, .pm-form select, .pm-form textarea { font: inherit; font-size: .92rem; padding: 8px 10px; border: 1px solid var(--pm-line); border-radius: 8px; background: var(--pm-bg); color: var(--pm-fg); width: 100%; box-sizing: border-box; }
.pm-form .pm-check { display: flex; gap: 8px; align-items: flex-start; color: var(--pm-fg); font-size: .85rem; }
.pm-form .pm-check input { width: auto; margin-top: 3px; }
.pm-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.pm-file { display: inline-flex; position: relative; margin: 8px 0; }
.pm-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pm-file span { border: 1px dashed var(--pm-forest); color: var(--pm-forest); border-radius: 8px; padding: 10px 14px; font-weight: 600; font-size: .88rem; }
.pm-file:focus-within span { outline: 2px solid var(--pm-route); }
.pm-confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: .88rem; }

.pm-draw { grid-area: map; align-self: end; justify-self: center; position: relative; margin: 0 12px 28px; z-index: 900; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  background: var(--pm-surface); border: 1px solid var(--pm-line); border-radius: 14px; padding: 8px 10px; box-shadow: 0 4px 16px rgba(0,0,0,.18); font-size: .85rem; max-width: calc(100% - 24px); box-sizing: border-box; }
.pm-draw[hidden] { display: none; }
.pm-draw b { font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .pm-root { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto min(70vh, 520px) auto; grid-template-areas: "bar" "map" "panel"; }
  .pm-panel { border-left: 0; border-top: 1px solid var(--pm-line); max-height: none; }
}
a.pm-btn { display: inline-block; text-decoration: none; }
.pm-modes { display: flex; background: var(--pm-surface); border: 1px solid var(--pm-line); border-radius: 999px; padding: 3px; }
.pm-modes button { font: inherit; font-size: .82rem; border: 0; background: transparent; color: var(--pm-fg); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.pm-modes button[aria-pressed="true"] { background: #7a3a17; color: #fff; font-weight: 600; }
.pm-month[hidden] { display: none; }
.pm-reasons { margin: 8px 0; padding-left: 16px; font-size: .84rem; line-height: 1.45; }
.pm-rain { display: flex; align-items: flex-end; gap: 1px; height: 34px; border-bottom: 1px solid var(--pm-line); }
.pm-rain-b { flex: 1; background: #6f9fc0; border-radius: 1px 1px 0 0; min-width: 0; }
.pm-rain-b.is-today { background: var(--pm-fg); }
.pm-rain-b.is-fc { background: repeating-linear-gradient(45deg, #6f9fc0, #6f9fc0 2px, transparent 2px, transparent 4px); }
.pm-rain-l { display: flex; justify-content: space-between; position: relative; font-size: .66rem; color: var(--pm-muted); margin-top: 2px; }
.pm-rain-today { position: absolute; top: 0; transform: translateX(-50%); color: var(--pm-fg); font-weight: 600; }
.pm-pro { margin: 10px 0; padding: 8px 10px; border: 1px dashed #7a3a17; border-radius: 10px; font-size: .84rem; }
.pm-pro-tag { display: inline-block; background: #7a3a17; color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .06em; padding: 1px 6px; border-radius: 4px; }
.pm-trend { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; margin: 8px 0 4px; }
.pm-trend-d { text-align: center; font-size: .64rem; font-weight: 600; padding: 4px 0; border-radius: 4px; }
.pm-trend-d.s-picco { background: #7a3a17; color: #fff; }
.pm-trend-d.s-stagione { background: #c0862b; color: #1b1408; }
.pm-trend-d.s-margine { background: #e3cf96; color: #3b2c08; }
.pm-trend-d.s-fuori { background: #e3e6e0; color: #4b554e; }
.pm-fav { font: inherit; font-size: .82rem; font-weight: 600; border: 1px solid #b07a22; color: #7a4a10; background: transparent; border-radius: 999px; padding: 4px 12px; margin: 0 0 10px; cursor: pointer; }
.pm-fav.is-on { background: #c0862b; color: #1b1408; border-color: #c0862b; }
.pm-check-row { display: flex; gap: 8px; align-items: center; font-size: .85rem; margin-top: 8px; }
.pm-start { justify-content: flex-start; align-items: center; }
.pm-resume { border: 1px solid var(--pm-line); border-left: 4px solid #c2452d; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: .88rem; }
.pm-rec { grid-area: map; align-self: end; justify-self: center; position: relative; margin: 0 12px 28px; z-index: 900; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px;
  background: var(--pm-surface); border: 1px solid var(--pm-line); border-radius: 14px; padding: 8px 12px; box-shadow: 0 4px 16px rgba(0,0,0,.2); font-size: .9rem; max-width: calc(100% - 24px); box-sizing: border-box; }
.pm-rec[hidden], .pm-rec-confirm[hidden] { display: none; }
.pm-rec b, .pm-rec-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.pm-rec-acc { font-size: .75rem; color: var(--pm-muted); }
.pm-rec button { font: inherit; font-size: .82rem; border-radius: 999px; border: 1px solid var(--pm-line); background: var(--pm-surface); color: var(--pm-fg); padding: 5px 12px; cursor: pointer; }
.pm-rec .is-primary { background: #1f4a32; color: #fff; border-color: #1f4a32; }
.pm-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #c2452d; animation: pm-blink 1.2s infinite; }
.pm-rec.is-paused .pm-rec-dot { animation: none; background: #9aa39b; }
@keyframes pm-blink { 50% { opacity: .25; } }
.is-recording .pm-add { display: none; }
@media (prefers-reduced-motion: reduce) { .pm-rec-dot { animation: none; } }
.pm-map { scroll-margin-top: 120px; }
