/* ======================================================================
   CHERNI VIT — COMMUNITY DASHBOARD
   Mobile: compact extension of the green site header.
   Desktop: persistent dashboard panel on the right side of the map.
   ====================================================================== */

:root{
  --cv-dash-green:#236d2d;
  --cv-dash-green-2:#3d9848;
  --cv-dash-deep:#174d20;
  --cv-dash-cream:#fffdf8;
  --cv-dash-soft:#f3f8f2;
  --cv-dash-line:rgba(32,103,42,.12);
  --cv-dash-muted:#69766b;
  --cv-dash-shadow:0 18px 52px rgba(20,60,27,.18),0 3px 10px rgba(20,60,27,.08);
  --cv-dash-panel-w:368px;
}

/* ---------- Main surface ---------- */
.cv-today{
  position:fixed;
  z-index:4400;
  color:#203423;
  background:
    radial-gradient(circle at 100% 0,rgba(86,167,96,.11),transparent 34%),
    linear-gradient(160deg,rgba(255,255,255,.985),rgba(250,252,248,.975));
  border:1px solid rgba(255,255,255,.92);
  box-shadow:var(--cv-dash-shadow);
  backdrop-filter:blur(20px) saturate(1.12);
  -webkit-backdrop-filter:blur(20px) saturate(1.12);
  overflow:visible;
  transition:box-shadow .24s ease,opacity .2s ease,transform .24s ease;
}
.cv-today::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius:inherit;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.72);
}
.cv-today-head{
  position:relative;
  z-index:2;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto 34px;
  align-items:center;
  gap:10px;
  cursor:pointer;
}
.cv-today-title{
  min-width:0;
  display:flex;
  align-items:center;
  gap:10px;
}
.cv-today-title-copy{min-width:0}
.cv-eyebrow{
  display:inline-flex;
  align-items:center;
  gap:6px;
  flex:0 0 auto;
  color:#5b8060;
  font-size:.62rem;
  font-weight:900;
  line-height:1;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.cv-live-dot{
  width:7px;
  height:7px;
  flex:0 0 7px;
  border-radius:50%;
  background:#3cad50;
  box-shadow:0 0 0 4px rgba(60,173,80,.11);
  animation:cvLivePulse 2.1s ease-in-out infinite;
}
@keyframes cvLivePulse{50%{box-shadow:0 0 0 8px rgba(60,173,80,0)}}
.cv-today h2,
.cv-panel h2{
  margin:0;
  color:#173d1d;
  font-size:1.15rem;
  line-height:1.12;
  letter-spacing:-.025em;
}
.cv-today-summary{
  margin:3px 0 0;
  min-width:0;
  overflow:hidden;
  color:#718074;
  font-size:.68rem;
  line-height:1.25;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.cv-today-collapse{
  position:relative!important;
  inset:auto!important;
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  border:1px solid rgba(35,109,45,.10)!important;
  border-radius:50%!important;
  background:#edf6ee!important;
  color:#1d6127!important;
  box-shadow:none!important;
  cursor:pointer;
  transition:background .18s ease,transform .24s cubic-bezier(.2,.8,.2,1)!important;
}
.cv-today-collapse span{display:block;font-size:1.2rem;line-height:1;transform:translateY(-1px)}
.cv-today-collapse:hover{background:#e1efe3!important}
.cv-today.is-expanded .cv-today-collapse{transform:rotate(180deg)}

/* ---------- Weather integrated into the surface ---------- */
.cv-today .weather-info-bar.cv-weather-integrated{
  position:relative!important;
  inset:auto!important;
  z-index:4!important;
  width:auto!important;
  min-width:112px!important;
  max-width:138px!important;
  margin:0!important;
  padding:7px 9px!important;
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:8px!important;
  border:1px solid rgba(35,109,45,.10)!important;
  border-radius:15px!important;
  background:linear-gradient(135deg,#f2f8ef,#edf6f7)!important;
  box-shadow:none!important;
  color:#214d27!important;
  text-align:left!important;
  cursor:pointer!important;
  transition:background .18s ease,transform .18s ease!important;
}
.cv-today .weather-info-bar.cv-weather-integrated:hover{
  transform:translateY(-1px)!important;
  background:linear-gradient(135deg,#eaf5e8,#e7f2f4)!important;
}
.cv-today .wib-weather-icon{
  flex:0 0 auto;
  margin:0!important;
  font-size:1.2rem!important;
  line-height:1!important;
  filter:none!important;
  animation:none!important;
}
.cv-today .cv-weather-copy{min-width:0;display:block!important}
.cv-today .wib-weather-line{display:flex;align-items:baseline;gap:6px;white-space:nowrap}
.cv-today .wib-weather-temp{
  color:#195b24!important;
  font-size:.9rem!important;
  font-weight:900!important;
  line-height:1!important;
}
.cv-today .wib-time{
  display:inline!important;
  color:#46634a!important;
  font-size:.66rem!important;
  font-weight:750!important;
  line-height:1!important;
  letter-spacing:.01em!important;
}
.cv-today .wib-date{
  margin-top:3px!important;
  color:#758178!important;
  font-size:.56rem!important;
  font-weight:800!important;
  line-height:1!important;
  text-transform:none!important;
  white-space:nowrap!important;
}
.cv-today .wib-event{display:none!important}
.cv-today .wib-tooltip{
  top:calc(100% + 10px)!important;
  right:0!important;
  left:auto!important;
  width:232px!important;
  max-width:min(232px,calc(100vw - 28px))!important;
  border-radius:17px!important;
  box-shadow:0 18px 42px rgba(11,52,20,.27)!important;
}
.cv-today .wib-tooltip::before{right:24px!important}
.cv-today .weather-info-bar.weather-warning{background:linear-gradient(135deg,#fff7df,#fff3e2)!important;border-color:rgba(224,147,34,.25)!important}
.cv-today .weather-info-bar.weather-danger{background:linear-gradient(135deg,#fff0ef,#ffe7e5)!important;border-color:rgba(202,54,47,.24)!important}

/* ---------- Expandable content ---------- */
.cv-today-body{
  position:relative;
  z-index:1;
  opacity:1;
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  transition:max-height .32s cubic-bezier(.2,.8,.2,1),opacity .18s ease,padding .28s ease;
}
.cv-today.is-collapsed .cv-today-body{
  max-height:0!important;
  padding-top:0!important;
  padding-bottom:0!important;
  opacity:0;
  overflow:hidden;
  pointer-events:none;
}
.cv-section-kicker{
  display:flex;
  align-items:center;
  gap:9px;
  margin-bottom:8px;
  color:#728075;
  font-size:.62rem;
  font-weight:900;
  letter-spacing:.09em;
  text-transform:uppercase;
}
.cv-section-kicker i{height:1px;flex:1;background:linear-gradient(90deg,rgba(35,109,45,.17),transparent)}

/* One calm metric surface instead of four floating windows. */
.cv-today-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  overflow:hidden;
  border:1px solid var(--cv-dash-line);
  border-radius:18px;
  background:rgba(247,250,246,.86);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.82);
}
.cv-live-card{
  min-width:0;
  min-height:66px;
  display:grid;
  grid-template-columns:32px minmax(0,1fr);
  align-items:center;
  gap:8px;
  padding:10px;
  background:transparent;
}
.cv-live-card:nth-child(odd){border-right:1px solid var(--cv-dash-line)}
.cv-live-card:nth-child(-n+2){border-bottom:1px solid var(--cv-dash-line)}
.cv-live-icon{
  width:31px;
  height:31px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:#fff;
  box-shadow:0 3px 9px rgba(34,72,39,.07);
  font-size:1rem;
}
.cv-live-card--alert .cv-live-icon{background:#fff1ed}
.cv-live-card--resolved .cv-live-icon{background:#eaf7ed}
.cv-live-card--community .cv-live-icon{background:#fff7e6}
.cv-live-card--event .cv-live-icon{background:#eef2ff}
.cv-live-copy{min-width:0}
.cv-live-card b{
  display:block;
  overflow:hidden;
  color:#183f1e;
  font-size:.95rem;
  line-height:1.08;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.cv-live-card span:not(.cv-live-icon){
  display:-webkit-box;
  margin-top:3px;
  overflow:hidden;
  color:#6f7b71;
  font-size:.62rem;
  line-height:1.2;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}
.cv-skeleton{
  height:66px;
  background:linear-gradient(90deg,#eef4ee,#fafcfa,#eef4ee);
  background-size:200% 100%;
  animation:cvsh 1.2s infinite;
}
@keyframes cvsh{to{background-position:-200% 0}}

.cv-today-actions,.cv-share-actions{display:grid;grid-template-columns:1.4fr 1fr;gap:8px}
.cv-primary-btn,.cv-secondary-btn{
  border:0;
  border-radius:13px;
  padding:10px 12px;
  font:800 .78rem/1.2 inherit;
  cursor:pointer;
  transition:transform .16s ease,box-shadow .16s ease,background .16s ease;
}
.cv-primary-btn{
  background:linear-gradient(135deg,#286f33,#3f9d4b);
  color:#fff;
  box-shadow:0 7px 17px rgba(39,116,51,.20);
}
.cv-primary-btn:hover{transform:translateY(-1px);box-shadow:0 10px 21px rgba(39,116,51,.24)}
.cv-secondary-btn{background:#eef5ef;color:#265e2e;border:1px solid rgba(35,109,45,.08)}
.cv-secondary-btn:hover{background:#e5f0e6}
.cv-secondary-btn.active{background:#d9ecdc;color:#15491c}
.cv-today .cv-primary-btn,.cv-today .cv-secondary-btn{min-height:41px;display:flex;align-items:center;justify-content:center;gap:7px}

/* ---------- Guardian / missions ---------- */
.cv-missions{margin-top:10px}
.cv-guardian{
  padding:11px;
  border:1px solid rgba(35,109,45,.10);
  border-radius:16px;
  background:linear-gradient(145deg,rgba(239,247,239,.88),rgba(250,252,248,.88));
}
.cv-guardian-row{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.cv-guardian-row>div{min-width:0}
.cv-guardian strong{display:block;color:#194c20;font-size:.78rem;line-height:1.22}
.cv-guardian small{display:block;margin-top:2px;color:#718074;font-size:.63rem;line-height:1.25}
.cv-guardian-row>span{
  flex:0 0 auto;
  padding:5px 7px;
  border-radius:999px;
  background:rgba(255,255,255,.72);
  color:#526654;
  font-size:.62rem;
  font-weight:850;
  white-space:nowrap;
}
.cv-guardian a{
  flex:0 0 auto;
  padding:7px 10px;
  border-radius:999px;
  background:#2e7d32;
  color:#fff;
  font-size:.68rem;
  font-weight:900;
  text-decoration:none;
}
.cv-progress{height:5px;margin-top:8px;overflow:hidden;border-radius:99px;background:rgba(35,109,45,.09)}
.cv-progress>i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#67ba70,#2f813a)}
.cv-badge-strip{display:flex;gap:5px;overflow-x:auto;padding:7px 0 1px;scrollbar-width:none}
.cv-badge-strip::-webkit-scrollbar{display:none}
.cv-badge-chip,.cv-badge-season,.cv-badge-empty{
  flex:0 0 auto;
  padding:5px 8px;
  border:1px solid rgba(35,109,45,.09);
  border-radius:999px;
  background:rgba(255,255,255,.74);
  color:#566858;
  font-size:.6rem;
  font-weight:800;
  white-space:nowrap;
}
.cv-badge-season{background:#ecf6ed;color:#2b6732}
.cv-mission-list{display:grid;gap:6px;margin-top:7px}
.cv-mission{
  display:grid;
  grid-template-columns:25px minmax(0,1fr) auto;
  align-items:center;
  gap:7px;
  padding:7px 8px;
  border:1px solid rgba(35,109,45,.07);
  border-radius:11px;
  background:rgba(255,255,255,.72);
  font-size:.68rem;
}
.cv-mission b{display:block;color:#304b34;font-size:.68rem;line-height:1.12}
.cv-mission small{display:block;margin-top:2px;color:#78847a;font-size:.58rem;line-height:1.18}
.cv-mission.done{opacity:.66}

/* ======================================================================
   DESKTOP — a true right-side dashboard, open by default from JS.
   ====================================================================== */
@media (min-width:761px) and (hover:hover), (min-width:761px) and (min-height:600px) {
  /*
   * Desktop right rail
   * 1. Leaflet layers
   * 2. "Черни Вит днес"
   * 3. "Подай сигнал"
   *
   * JS updates the vertical CSS variables from the real header/panel sizes,
   * so the three controls never overlap on different desktop heights.
   */
  .leaflet-top.leaflet-right{
    top:0!important;
    right:0!important;
    z-index:4700!important;
  }
  .leaflet-top.leaflet-right .leaflet-control-layers{
    position:fixed!important;
    top:var(--cv-desktop-layer-top,calc(var(--header-h,84px) + 14px))!important;
    right:18px!important;
    margin:0!important;
    z-index:4700!important;
    border:1px solid rgba(35,109,45,.10)!important;
    border-radius:14px!important;
    box-shadow:0 8px 24px rgba(25,66,31,.14)!important;
    overflow:visible!important;
  }
  .leaflet-control-layers-toggle{
    width:42px!important;
    height:42px!important;
    border-radius:13px!important;
    background-color:rgba(255,255,255,.97)!important;
    background-size:22px 22px!important;
  }
  .leaflet-control-layers-expanded{
    padding:10px 12px!important;
    border-radius:16px!important;
    background:rgba(255,255,255,.98)!important;
    backdrop-filter:blur(18px);
    -webkit-backdrop-filter:blur(18px);
  }

  .cv-today{
    top:var(--cv-desktop-panel-top,calc(var(--header-h,84px) + 68px));
    right:18px;
    width:var(--cv-dash-panel-w);
    max-height:var(--cv-desktop-panel-max-h,calc(100dvh - var(--header-h,84px) - 170px));
    padding:15px;
    border-radius:24px;
  }
  .cv-today-head{min-height:54px}
  .cv-today-title{display:block}
  .cv-eyebrow{margin-bottom:5px}
  .cv-today-summary{max-width:190px}
  .cv-today-body{
    max-height:calc(var(--cv-desktop-panel-max-h,600px) - 84px);
    padding-top:13px;
  }
  .cv-today.is-expanded{box-shadow:0 23px 62px rgba(18,57,24,.21),0 3px 12px rgba(18,57,24,.08)}
  .cv-today.is-collapsed{width:350px}
  .cv-today.is-collapsed .cv-today-head{min-height:50px}
  .cv-today .wib-tooltip{display:block}

  .submit-report-container{
    position:fixed!important;
    top:var(--cv-desktop-submit-top,auto)!important;
    right:18px!important;
    bottom:auto!important;
    z-index:4450!important;
  }
  /* On desktop the action menu opens to the left, so it never covers the dashboard above it. */
  .submit-report-container .submit-dropdown{
    top:0!important;
    right:calc(100% + 12px)!important;
    bottom:auto!important;
    transform:translateX(10px)!important;
    transform-origin:100% 0;
  }
  .submit-report-container.open .submit-dropdown{
    transform:translateX(0)!important;
  }
}

/* ======================================================================
   MOBILE — a modern second bar attached directly to the site header.
   Collapsed: ~58px. Expanded: dropdown dashboard over the map controls.
   ====================================================================== */
@media (max-width:760px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:760px) {
  .cv-today{
    top:var(--header-h,74px);
    left:0;
    right:0;
    width:100%;
    padding:0 11px;
    border-width:0 0 1px;
    border-color:rgba(35,109,45,.10);
    border-radius:0 0 19px 19px;
    background:
      linear-gradient(110deg,rgba(255,253,248,.99),rgba(247,251,246,.985) 70%,rgba(236,247,238,.985));
    box-shadow:0 7px 22px rgba(24,66,30,.14);
    backdrop-filter:blur(18px) saturate(1.08);
    -webkit-backdrop-filter:blur(18px) saturate(1.08);
  }
  .cv-today::after{
    content:"";
    position:absolute;
    top:0;
    left:0;
    right:0;
    height:2px;
    background:linear-gradient(90deg,rgba(201,162,39,.78),rgba(67,160,71,.38),rgba(201,162,39,.18));
    pointer-events:none;
  }
  .cv-today-head{
    min-height:58px;
    grid-template-columns:minmax(0,1fr) auto 31px;
    gap:7px;
  }
  .cv-today-title{gap:8px}
  .cv-eyebrow{
    width:auto;
    height:28px;
    padding:0 7px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:5px;
    border-radius:999px;
    background:#eaf5eb;
    color:#397044;
    font-size:.47rem;
    letter-spacing:.07em;
  }
  .cv-eyebrow .cv-live-dot{width:7px;height:7px;box-shadow:0 0 0 4px rgba(60,173,80,.12)}
  .cv-today h2{font-size:.94rem;line-height:1.05}
  .cv-today-summary{max-width:55vw;margin-top:3px;font-size:.58rem}
  .cv-today-collapse{width:29px;height:29px}
  .cv-today-collapse span{font-size:1.05rem}

  .cv-today .weather-info-bar.cv-weather-integrated{
    min-width:79px!important;
    max-width:86px!important;
    padding:6px 7px!important;
    gap:5px!important;
    border-radius:12px!important;
  }
  .cv-today .wib-weather-icon{font-size:1.05rem!important}
  .cv-today .wib-weather-line{gap:4px}
  .cv-today .wib-weather-temp{font-size:.8rem!important}
  .cv-today .wib-time{font-size:.53rem!important}
  .cv-today .wib-date{display:none!important}
  .cv-today .wib-tooltip{display:none!important}

  .cv-today-body{
    max-height:calc(100dvh - var(--header-h,74px) - 58px - 78px - env(safe-area-inset-bottom,0px));
    margin:0 -2px;
    padding:8px 2px 12px;
  }
  .cv-today.is-expanded{
    box-shadow:0 20px 50px rgba(18,57,24,.25),0 3px 10px rgba(18,57,24,.09);
  }
  .cv-today.is-expanded .cv-today-head{border-bottom:1px solid rgba(35,109,45,.08)}
  .cv-today.is-expanded .cv-today-body{padding-top:11px}

  .cv-section-kicker{margin:0 3px 7px;font-size:.57rem}
  .cv-today-grid{margin:0 0 8px;border-radius:15px}
  .cv-live-card{min-height:61px;grid-template-columns:29px minmax(0,1fr);gap:7px;padding:8px}
  .cv-live-icon{width:28px;height:28px;border-radius:9px;font-size:.92rem}
  .cv-live-card b{font-size:.84rem}
  .cv-live-card span:not(.cv-live-icon){font-size:.55rem}
  .cv-skeleton{height:61px}
  .cv-today-actions{grid-template-columns:1.35fr 1fr;gap:7px}
  .cv-today .cv-primary-btn,.cv-today .cv-secondary-btn{min-height:39px;padding:8px 9px;font-size:.7rem}
  .cv-missions{margin-top:8px}
  .cv-guardian{padding:9px;border-radius:14px}
  .cv-guardian strong{font-size:.71rem}
  .cv-guardian small{font-size:.58rem}
  .cv-guardian-row>span{font-size:.56rem;padding:4px 6px}
  .cv-mission-list{display:flex;gap:6px;overflow-x:auto;margin-top:6px;padding-bottom:2px;scrollbar-width:none}
  .cv-mission-list::-webkit-scrollbar{display:none}
  .cv-mission{flex:0 0 174px;min-height:48px;padding:7px}

  /* Map controls start below the collapsed header strip. Expanded panel simply covers them. */
  .leaflet-top{top:64px!important}
  .hamburger-btn{top:calc(var(--header-h,74px) + 69px)!important}

  /* The drawer and full-screen UI must win over the dashboard. */
  body.menu-open .cv-today,
  body.mobile-filter-open .cv-today{opacity:0;pointer-events:none;transform:translateY(-6px)}
}

@media (max-width:390px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:390px) {
  .cv-today{padding-left:8px;padding-right:8px}
  .cv-today-head{grid-template-columns:minmax(0,1fr) 76px 29px;gap:5px}
  .cv-today-title{gap:6px}
  .cv-eyebrow{height:26px;padding:0 6px;font-size:.43rem}
  .cv-today h2{font-size:.89rem}
  .cv-today-summary{max-width:49vw;font-size:.54rem}
  .cv-today .weather-info-bar.cv-weather-integrated{min-width:74px!important;max-width:76px!important;padding-left:5px!important;padding-right:5px!important}
  .cv-today .wib-time{display:none!important}
}

/* ---------- Feed / statistics modal ---------- */
.cv-overlay[hidden]{display:none}
.cv-overlay{
  position:fixed;
  z-index:12000;
  inset:0;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(8,22,10,.58);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
}
.cv-panel{
  width:min(760px,96vw);
  max-height:88vh;
  overflow:auto;
  padding:20px;
  border:1px solid rgba(255,255,255,.8);
  border-radius:24px;
  background:#f8fbf8;
  box-shadow:0 30px 90px rgba(0,0,0,.28);
}
.cv-panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.cv-icon-btn{width:38px;height:38px;border:0;border-radius:50%;background:#eaf3eb;font-size:1.4rem;cursor:pointer}
.cv-community-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:16px 0}
.cv-stat{padding:12px;text-align:center;border:1px solid #e2eee3;border-radius:15px;background:#fff}
.cv-stat b{display:block;color:#1d6825;font-size:1.35rem}
.cv-stat span{font-size:.7rem;color:#667466}
.cv-feed-list{display:grid;gap:10px}
.cv-feed-card{overflow:hidden;border:1px solid #e2eee3;border-radius:18px;background:#fff}
.cv-feed-main{display:flex;gap:12px;padding:13px;text-decoration:none;color:inherit}
.cv-feed-photo{width:84px;height:72px;flex:0 0 84px;object-fit:cover;border-radius:12px;background:#edf3ed}
.cv-feed-copy{min-width:0;flex:1}
.cv-feed-copy strong{display:block;margin-bottom:3px;color:#173d1d}
.cv-feed-copy p{margin:0;display:-webkit-box;overflow:hidden;color:#48564a;font-size:.82rem;line-height:1.35;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.cv-feed-copy time{display:block;margin-top:6px;color:#899489;font-size:.68rem}
.cv-reactions{display:flex;flex-wrap:wrap;gap:6px;padding:0 13px 12px}
.cv-react{padding:6px 9px;border:1px solid #dfeadf;border-radius:999px;background:#f7faf7;font-size:.74rem;cursor:pointer}
.cv-react.active{background:#e0f2e1;border-color:#7fc785}
.cv-share-btn{margin-left:auto;border:0;background:none;color:#2e7d32;font-weight:800;cursor:pointer}
.cv-share-panel canvas{display:block;width:min(100%,520px);height:auto;margin:14px auto;border-radius:18px;box-shadow:0 10px 28px rgba(0,0,0,.14)}
.cv-photo-marker{width:52px;height:52px;border:3px solid #fff;border-radius:15px;object-fit:cover;box-shadow:0 4px 14px rgba(0,0,0,.35)}
.cv-photo-divicon{background:none!important;border:0!important}
.cv-before-after{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:8px 0}
.cv-before-after img{width:100%;height:105px;object-fit:cover;border-radius:9px}
.cv-ba-label{margin-bottom:3px;color:#58705a;font-size:.65rem;font-weight:900}
.cv-popup-reactions{margin-top:8px;padding-top:8px;border-top:1px solid #edf1ed}

@media (max-width:760px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:760px) {
  .cv-panel{padding:15px;border-radius:20px}
  .cv-community-stats{grid-template-columns:1fr 1fr}
}

/* ---------- Dark theme ---------- */
body.dark-theme .cv-today,.dark-mode .cv-today,.dark .cv-today{
  color:#edf7ee;
  border-color:rgba(255,255,255,.07);
  background:
    radial-gradient(circle at 100% 0,rgba(80,153,91,.13),transparent 35%),
    linear-gradient(155deg,rgba(31,39,32,.985),rgba(24,31,25,.98));
}
body.dark-theme .cv-today h2,.dark-mode .cv-today h2,.dark .cv-today h2,
body.dark-theme .cv-guardian strong,.dark-mode .cv-guardian strong{color:#effbef}
body.dark-theme .cv-today-summary,.dark-mode .cv-today-summary{color:#b5c3b7}
body.dark-theme .cv-today .weather-info-bar.cv-weather-integrated,.dark-mode .cv-today .weather-info-bar.cv-weather-integrated{
  border-color:rgba(255,255,255,.07)!important;
  background:linear-gradient(135deg,#2a372c,#263438)!important;
}
body.dark-theme .cv-today .wib-weather-temp,body.dark-theme .cv-today .wib-time,body.dark-theme .cv-today .wib-date,
.dark-mode .cv-today .wib-weather-temp,.dark-mode .cv-today .wib-time,.dark-mode .cv-today .wib-date{color:#d8eadb!important}
body.dark-theme .cv-today-grid,.dark-mode .cv-today-grid{border-color:#3b4a3d;background:rgba(38,49,41,.78)}
body.dark-theme .cv-live-card,.dark-mode .cv-live-card{border-color:#3b4a3d}
body.dark-theme .cv-live-icon,.dark-mode .cv-live-icon{background:#303d32}
body.dark-theme .cv-live-card b,.dark-mode .cv-live-card b{color:#effbef}
body.dark-theme .cv-live-card span:not(.cv-live-icon),.dark-mode .cv-live-card span:not(.cv-live-icon){color:#b8c5ba}
body.dark-theme .cv-guardian,.dark-mode .cv-guardian{border-color:#3d4d40;background:linear-gradient(145deg,#27342a,#242f26)}
body.dark-theme .cv-mission,.dark-mode .cv-mission,
body.dark-theme .cv-badge-chip,body.dark-theme .cv-badge-season,body.dark-theme .cv-badge-empty,
.dark-mode .cv-mission,.dark-mode .cv-badge-chip,.dark-mode .cv-badge-season,.dark-mode .cv-badge-empty{border-color:#435446;background:#303b32;color:#e5efe6}
body.dark-theme .cv-panel,.dark-mode .cv-panel,.dark .cv-panel{background:#1f2821;color:#edf7ee;border-color:#3e4e41}
body.dark-theme .cv-feed-card,body.dark-theme .cv-stat,.dark-mode .cv-feed-card,.dark-mode .cv-stat{background:#29332b;border-color:#3d4c40}
body.dark-theme .cv-feed-copy p,.dark-mode .cv-feed-copy p{color:#c5d0c6}

/* ======================================================================
   MOBILE QUICK ACTION LABEL
   When the submit action collapses to the round + button, keep its purpose
   visible with the same compact floating-label language as the map legend.
   ====================================================================== */
@media (max-width:450px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:450px) {
  .submit-report-container::before{
    content:'Подай сигнал'!important;
    display:block!important;
    position:absolute!important;
    left:50%!important;
    bottom:calc(100% + 8px)!important;
    transform:translateX(-50%)!important;
    width:max-content!important;
    max-width:140px!important;
    margin:0!important;
    padding:5px 11px!important;
    border:1px solid rgba(76,175,80,.18)!important;
    border-radius:10px!important;
    background:rgba(255,255,255,.95)!important;
    box-shadow:0 6px 16px rgba(0,0,0,.10)!important;
    color:#19351d!important;
    font-size:.58rem!important;
    font-weight:800!important;
    line-height:1.15!important;
    letter-spacing:.28px!important;
    text-align:center!important;
    white-space:nowrap!important;
    pointer-events:none!important;
    opacity:1!important;
    visibility:visible!important;
    z-index:2!important;
    transition:opacity .16s ease,transform .16s ease!important;
  }

  /* The menu itself opens above the action button; hide the hint while open
     so the label never competes with the dropdown choices. */
  .submit-report-container.open::before{
    opacity:0!important;
    visibility:hidden!important;
    transform:translate(-50%,4px)!important;
  }

  body.dark-theme .submit-report-container::before,
  .dark-mode .submit-report-container::before,
  .dark .submit-report-container::before{
    color:#dff3e1!important;
    background:rgba(32,40,33,.96)!important;
    border-color:rgba(111,187,119,.30)!important;
    box-shadow:0 7px 18px rgba(0,0,0,.28)!important;
  }

  /* Keep the wording stable in positive-map mode too: this is the global
     quick action and should always be immediately understandable. */
  body.positive-mode .submit-report-container::before,
  body.dark-theme.positive-mode .submit-report-container::before{
    content:'Подай сигнал'!important;
  }
}

/* ======================================================================
   FIXED SUBMIT REPORT CONTROL
   Keep "Подай сигнал" permanently at the lower-right edge of the viewport,
   horizontally aligned with the legend control on the lower-left.
   This intentionally overrides the desktop dashboard stacking rules above.
   ====================================================================== */
.submit-report-container,
#submit-report-container{
  position:fixed !important;
  top:auto !important;
  right:20px !important;
  bottom:70px !important;
  left:auto !important;
  margin:0 !important;
  z-index:4800 !important;
  transform:none !important;
}

/* Desktop: keep the menu clear of the viewport edge while the trigger stays fixed. */
@media (min-width:761px) and (hover:hover), (min-width:761px) and (min-height:600px) {
  .submit-report-container .submit-dropdown,
  #submit-report-container .submit-dropdown{
    top:auto !important;
    right:0 !important;
    bottom:calc(100% + 10px) !important;
    transform:translateY(10px) !important;
    transform-origin:100% 100% !important;
  }
  .submit-report-container.open .submit-dropdown,
  #submit-report-container.open .submit-dropdown{
    transform:translateY(0) !important;
  }
}

/* Mobile/tablet: use exactly the same bottom rail as the legend. */
@media (max-width:760px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:760px) {
  .submit-report-container,
  #submit-report-container{
    top:auto !important;
    right:12px !important;
    bottom:calc(var(--cv-tabbar-gap, 72px) + 12px) !important;
    left:auto !important;
  }

  .submit-report-container .submit-dropdown,
  #submit-report-container .submit-dropdown{
    top:auto !important;
    right:0 !important;
    bottom:calc(100% + 10px) !important;
  }
}

@media (max-width:360px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:360px) {
  .submit-report-container,
  #submit-report-container{
    right:10px !important;
  }
}

/* ======================================================================
   INDEX APP-SHELL CONSISTENCY CONTRACT — 2026-09-28
   One coordinate system for the home map after every full navigation,
   bfcache restore, PWA viewport change and orientation change.
   The JS dashboard measures the REAL header/tabbar heights and updates
   these variables; the fallbacks keep first paint safe before JS runs.
   ====================================================================== */
:root{
  --cv-header-height:var(--header-h,84px);
  --cv-tabbar-height:calc(72px + env(safe-area-inset-bottom,0px));
  --cv-map-controls-bottom:calc(84px + env(safe-area-inset-bottom,0px));
  --cv-pwa-height:0px;
}

/* The bottom navigation is the permanent lower boundary of the map UI. */
.app-tabbar{
  position:fixed!important;
  left:0!important;
  right:0!important;
  bottom:0!important;
  z-index:5000!important;
  margin:0!important;
  transform:none!important;
}

/* Lower-left and lower-right controls MUST use viewport coordinates.
   Never position the legend relative to <main>; that is what allowed it
   to slip behind the tabbar after returning from another page. */
.legend,
#legend{
  position:fixed!important;
  top:auto!important;
  left:16px!important;
  right:auto!important;
  bottom:var(--cv-map-controls-bottom,84px)!important;
  margin:0!important;
  z-index:4800!important;
  transform:none!important;
}

.submit-report-container,
#submit-report-container{
  position:fixed!important;
  top:auto!important;
  right:18px!important;
  bottom:var(--cv-map-controls-bottom,84px)!important;
  left:auto!important;
  margin:0!important;
  z-index:4800!important;
  transform:none!important;
}

/* Menus open inward/upward while their triggers never move. */
.legend-content{
  top:auto!important;
  bottom:66px!important;
  /* IMPORTANT: a closed legend must occupy no interactive area. Previously
     this rule forced a large max-height even while opacity was 0, leaving an
     invisible panel over the map that swallowed drag, zoom and button taps. */
  max-height:0!important;
  pointer-events:none!important;
  overflow:hidden!important;
}
.legend-content.open{
  max-height:min(70vh,calc(100dvh - var(--cv-header-height,84px) - var(--cv-tabbar-height,72px) - 96px))!important;
  pointer-events:auto!important;
  overflow-y:auto!important;
}
.submit-report-container .submit-dropdown,
#submit-report-container .submit-dropdown{
  top:auto!important;
  right:0!important;
  bottom:calc(100% + 10px)!important;
  max-height:min(70vh,calc(100dvh - var(--cv-header-height,84px) - var(--cv-tabbar-height,72px) - 96px))!important;
  overflow-y:auto;
  pointer-events:none!important;
}
.submit-report-container.open .submit-dropdown,
#submit-report-container.open .submit-dropdown{
  pointer-events:auto!important;
}

/* PWA install prompt also respects the same permanent bottom navigation.
   JS automatically raises the two map controls while the prompt is visible. */
.pwa-install-bar{
  bottom:calc(var(--cv-tabbar-height,72px) + 10px)!important;
}

/* All top-attached map UI is anchored to the measured header height. */
@media (max-width:760px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:760px) {
  .cv-today{
    top:var(--cv-header-height,var(--header-h,74px))!important;
  }
  .hamburger-btn{
    top:calc(var(--cv-header-height,var(--header-h,74px)) + 69px)!important;
  }
  .legend,
  #legend{left:12px!important;}
  .submit-report-container,
  #submit-report-container{right:12px!important;}
  .cv-today-body{
    max-height:calc(100dvh - var(--cv-header-height,74px) - var(--cv-tabbar-height,72px) - 70px)!important;
  }
}

@media (max-width:360px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:360px) {
  .legend,
  #legend{left:10px!important;}
  .submit-report-container,
  #submit-report-container{right:10px!important;}
}

@media (min-width:761px) and (hover:hover), (min-width:761px) and (min-height:600px) {
  .leaflet-top.leaflet-right .leaflet-control-layers{
    top:var(--cv-desktop-layer-top,calc(var(--cv-header-height,84px) + 14px))!important;
  }
  .cv-today{
    top:var(--cv-desktop-panel-top,calc(var(--cv-header-height,84px) + 68px))!important;
    max-height:var(--cv-desktop-panel-max-h,calc(100dvh - var(--cv-header-height,84px) - var(--cv-tabbar-height,72px) - 32px))!important;
  }
  /* Submit remains on the lower rail even on desktop; do not stack it
     under the dashboard panel or derive its position from panel height. */
  .submit-report-container,
  #submit-report-container{
    top:auto!important;
    right:18px!important;
    bottom:var(--cv-map-controls-bottom,84px)!important;
  }
  .submit-report-container .submit-dropdown,
  #submit-report-container .submit-dropdown{
    top:auto!important;
    right:0!important;
    bottom:calc(100% + 10px)!important;
    transform:translateY(10px)!important;
    transform-origin:100% 100%!important;
  }
  .submit-report-container.open .submit-dropdown,
  #submit-report-container.open .submit-dropdown{
    transform:translateY(0)!important;
  }
}


/* ======================================================================
   INDEX FLOATING-UI SAFETY PASS
   Every lower map control uses the same measured bottom boundary. This also
   covers less-frequent controls ("За проекта", hints and admin place editor),
   so none of them can end up behind the persistent app tabbar after navigation.
   ====================================================================== */
.about-fab{
  position:fixed!important;
  left:82px!important;
  right:auto!important;
  bottom:var(--cv-map-controls-bottom,84px)!important;
  margin:0!important;
  z-index:4750!important;
}

.cv-hint-host{
  bottom:var(--cv-map-controls-bottom,84px)!important;
}

.places-dock{
  bottom:calc(var(--cv-tabbar-height,72px) + 18px)!important;
}

/* The open legend/dropdown must also stay inside the usable viewport. */
.legend-content.open,
.submit-report-container.open .submit-dropdown,
#submit-report-container.open .submit-dropdown{
  overscroll-behavior:contain;
}

@media (max-width:760px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:760px) {
  .about-fab{
    left:78px!important;
    bottom:var(--cv-map-controls-bottom,84px)!important;
  }
  .places-dock{
    bottom:calc(var(--cv-tabbar-height,72px) + 10px)!important;
    max-height:calc(100dvh - var(--cv-header-height,74px) - var(--cv-tabbar-height,72px) - 28px)!important;
  }
}

@media (max-width:360px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:360px) {
  .about-fab{left:72px!important;}
}


/* ======================================================================
   COMPACT MAP STYLE SWITCH INSIDE "ЧЕРНИ ВИТ ДНЕС"
   The real Leaflet layer control remains the source of truth, but is hidden.
   A compact four-position segmented switch controls it on phones.
   ====================================================================== */
.leaflet-top.leaflet-right .leaflet-control-layers{
  display:none!important;
}
.cv-map-layers-wrap{
  display:none;
  margin:7px 0 2px;
}
.cv-map-layers-slot{
  width:100%;
  min-width:0;
}
.cv-map-layers-slot .leaflet-control-layers,
.cv-map-layers-slot .cv-layers-source{
  display:none!important;
}
.cv-layer-switch{
  position:relative;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  width:100%;
  height:36px;
  padding:3px;
  overflow:hidden;
  border:1px solid rgba(35,109,45,.12);
  border-radius:12px;
  background:rgba(31,104,48,.075);
  box-shadow:inset 0 1px 2px rgba(24,77,35,.035);
  isolation:isolate;
}
.cv-layer-switch-thumb{
  position:absolute;
  z-index:0;
  top:3px;
  left:3px;
  width:calc((100% - 6px)/4);
  height:28px;
  border-radius:9px;
  background:#fff;
  box-shadow:0 2px 8px rgba(25,80,39,.16),0 0 0 1px rgba(35,109,45,.08);
  transition:transform .22s cubic-bezier(.2,.8,.2,1);
  pointer-events:none;
}
.cv-layer-switch button{
  position:relative;
  z-index:1;
  min-width:0;
  height:28px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:0 4px;
  border:0;
  border-radius:9px;
  background:transparent;
  color:#607466;
  font:inherit;
  font-size:.65rem;
  line-height:1;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  transition:color .16s ease,transform .1s ease;
}
.cv-layer-switch button:active{transform:scale(.97)}
.cv-layer-switch button span{font-size:.78rem;line-height:1}
.cv-layer-switch button b{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:800;
}
.cv-layer-switch button.is-active{color:#1f6d30}
.cv-layer-switch button:focus-visible{outline:2px solid #43a047;outline-offset:-2px}

@media (max-width:760px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:760px){
  .cv-map-layers-wrap{display:block}
}
@media (max-width:365px), (orientation:landscape) and (hover:none) and (pointer:coarse) and (max-height:365px){
  .cv-layer-switch{height:34px;border-radius:11px}
  .cv-layer-switch-thumb{height:26px;border-radius:8px}
  .cv-layer-switch button{height:26px;gap:3px;padding:0 2px;font-size:.61rem}
  .cv-layer-switch button span{font-size:.72rem}
}

/* Desktop: no standalone Leaflet layers button and no duplicate switch. */
@media (min-width:761px) and (hover:hover), (min-width:761px) and (min-height:600px){
  .cv-map-layers-wrap,
  .leaflet-top.leaflet-right .leaflet-control-layers{
    display:none!important;
  }
}

/* Village Pulse */
.cv-village-pulse{display:grid;gap:10px;margin-bottom:14px}.cv-pulse-recap,.cv-community-goal{background:linear-gradient(135deg,#f7fbf7,#fff);border:1px solid #dcebdd;border-radius:15px;padding:12px}.cv-pulse-recap>b,.cv-community-goal b{color:#1b5e20}.cv-pulse-recap>div{display:flex;flex-wrap:wrap;gap:7px;margin-top:7px}.cv-pulse-recap span{background:#fff;border:1px solid #e1ebe2;border-radius:999px;padding:5px 8px;font-size:.76rem}.cv-community-goal>div:first-child{display:flex;justify-content:space-between;gap:8px;align-items:center}.cv-community-goal>div:first-child span{font-size:.76rem;color:#657267;font-weight:800}.cv-community-goal small{display:block;margin-top:6px;color:#607064}
.cv-explore-switch{position:fixed;left:50%;transform:translateX(-50%);top:calc(var(--cv-header-height,84px) + 10px);z-index:780;display:flex;padding:4px;background:rgba(255,255,255,.94);backdrop-filter:blur(12px);border:1px solid rgba(27,94,32,.14);border-radius:999px;box-shadow:0 6px 20px rgba(20,50,24,.12)}.cv-explore-switch button{border:0;background:transparent;color:#536256;border-radius:999px;padding:7px 10px;font-weight:800;font-size:.72rem}.cv-explore-switch button.active{background:#1f6b2a;color:#fff;box-shadow:0 2px 7px rgba(31,107,42,.22)}
@media(max-width:760px){.cv-explore-switch{top:calc(var(--cv-header-height,72px) + 8px)}body.cv-today-expanded .cv-explore-switch{opacity:0;pointer-events:none}.cv-explore-switch button{padding:6px 9px}}
.cv-impact-icon div{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:#2e7d32;color:#fff;border:3px solid #fff;box-shadow:0 4px 12px rgba(25,80,35,.3);font-size:18px}.cv-today-actions .cv-secondary-btn.active{background:#e8f5e9;color:#1b5e20;border-color:#81c784}
