html,body{
    height:100%;margin:0;background:#f6f7fb;overflow:hidden;
    font-family:Tahoma, Arial, sans-serif;
  }
  #app{
    height:100vh;
    display:grid;
    grid-template-columns: 1fr 430px;
    gap:12px;
    padding:12px;
    box-sizing:border-box;
  }
  #map{
    height:calc(100vh - 24px);
    border-radius:16px;
    box-shadow:0 4px 16px rgba(0,0,0,.12);
    overflow:hidden;
  }
  #panel{
    height:calc(100vh - 24px);
    overflow-y:auto;
    padding-right:4px;
  }
  .card{
    background:#fff;border-radius:16px;padding:12px;
    box-shadow:0 4px 16px rgba(0,0,0,.12);
    margin-bottom:12px;
  }
  .tabs{display:flex; gap:8px;}
  .tabbtn{
    flex:1; cursor:pointer; padding:10px 12px;
    border-radius:14px; border:1px solid #e2e8f0;
    background:#fff; font-weight:900; text-align:center; user-select:none;
  }
  .tabbtn.active{background:#0ea5e9; color:#fff; border-color:#0ea5e9;}
  .row{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap}
  .field{display:flex;flex-direction:column;gap:6px;flex:1}
  label{font-size:12px;color:#334155}
  select,input{
    padding:9px 10px;border-radius:12px;border:1px solid #cbd5e1;width:100%;box-sizing:border-box;
    font-family:Tahoma, Arial, sans-serif;
  }
  /* unified buttons */
  .btnrow{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
  button{
    cursor:pointer;
    height:40px;
    padding:0 14px;
    border-radius:12px;border:none;font-weight:900;
    font-family:Tahoma, Arial, sans-serif;
    display:inline-flex;align-items:center;justify-content:center;
    white-space:nowrap;
  }
  .btn{background:#0ea5e9;color:#fff}
  .btn-ghost{background:#e2e8f0;color:#0f172a}
  .btn-warn{background:#f97316;color:#fff}
  button:disabled{opacity:.55;cursor:not-allowed}
  .muted{font-size:12px;color:#64748b}
  .mono{font-family:ui-monospace,Menlo,Consolas,monospace}
  .list{max-height:360px;overflow:auto;border:1px solid #e2e8f0;border-radius:12px;padding:6px}
  .item{display:flex;gap:8px;align-items:flex-start;border:1px solid #f1f5f9;border-radius:10px;padding:8px;margin:6px 0}
  .item .txt{flex:1}
  .pill{display:inline-block;padding:2px 8px;border-radius:999px;background:#f1f5f9;color:#334155;font-size:12px}
  .title{margin:0 0 8px;font-size:18px}
  .subttl{margin:10px 0 6px;font-size:14px}
  
  /* Лендинг */
  .hero{padding:14px}
  .heroTop{display:flex;gap:12px;align-items:center}
  .heroTitle{font-weight:900;font-size:18px;line-height:1.15}
  .people{display:flex;gap:10px;flex-wrap:nowrap;margin-top:10px}
  .person{flex:1;display:flex;gap:10px;align-items:center;border:1px solid #f1f5f9;border-radius:14px;padding:10px}
  .avatar{width:40px;height:40px;border-radius:50%;object-fit:cover;background:#e2e8f0}
  .pname{font-weight:900}
  
  /* Контрол слоёв НА карте */
  .leaflet-control.custom-layers{
    background:#fff;
    border-radius:14px;
    box-shadow:0 4px 16px rgba(0,0,0,.12);
    padding:10px;
    width:330px;
    max-height:330px;
    overflow:auto;
    border:1px solid #e2e8f0;
  }
  .leaflet-control.custom-layers .hdr{font-weight:900;margin:0 0 8px;font-size:14px;}
  .layers{max-height:250px;overflow:auto;border:1px solid #e2e8f0;border-radius:12px;padding:6px}
  .layer-row{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:10px;border:1px solid #f1f5f9;margin:6px 0}
  .layer-row input{width:16px;height:16px}
  .layer-row .name{font-size:12px;color:#0f172a}
  
  /* Analytics */
  .kgrid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .kbox{border:1px solid #f1f5f9;border-radius:14px;padding:10px}
  .kbox .k{font-weight:900;font-size:14px}
  .chartbox{border:1px solid #f1f5f9;border-radius:14px;padding:10px;margin-top:10px}
  canvas{max-width:100%}
  
  .postBadge{
    display:flex; gap:10px; align-items:flex-start;
    border:1px solid #f1f5f9; border-radius:14px; padding:10px;
  }
  .postBadge .code{font-weight:900;font-size:16px}
  .postBadge .name{font-weight:900}
  .postBadge .meta{margin-top:4px}
  
  /* Mini boxes with icons */
  .miniGrid{display:grid;grid-template-columns:repeat(2, 1fr);gap:10px;margin-top:10px}
  .miniBox{
    border:1px solid #f1f5f9;border-radius:14px;padding:12px;
    background:#f8fafc;
    transition:all 0.2s;
  }
  .miniBox:hover{
    border-color:#0ea5e9;
    box-shadow:0 2px 8px rgba(14,165,233,0.1);
  }
  .miniBox .h{
    font-weight:900;font-size:11px;color:#64748b;
    text-transform:uppercase;letter-spacing:0.5px;
    margin-bottom:6px;
  }
  .miniBox .v{
    font-weight:900;font-size:18px;margin-top:4px;
    color:#0f172a;
  }
  .miniBox .unit{
    font-size:11px;color:#64748b;margin-left:4px;
  }
  .miniBox.with-icon{
    display:flex;align-items:center;gap:10px;
  }
  .miniBox.with-icon .icon{
    width:32px;height:32px;border-radius:10px;
    background:#e0f2fe;color:#0ea5e9;
    display:flex;align-items:center;justify-content:center;
    font-size:16px;font-weight:900;
  }
  .miniBox.with-icon .content{
    flex:1;
  }
  
  /* Extended grid for 4 columns */
  .extGrid4{display:grid;grid-template-columns:repeat(4, 1fr);gap:10px;margin-top:10px}
  
  /* Scene item redesign */
  .scene-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background:#f8fafc;
  }
  .scene-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }
  .scene-date {
    font-weight: 900;
    font-size: 14px;
    color:#0f172a;
  }
  .scene-buttons {
    display: flex;
    gap: 6px;
  }
  .scene-details {
    font-size: 12px;
    color: #64748b;
  }
  .scene-details div {
    margin-bottom: 2px;
  }
  .scene-id {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 10px;
    background:#e2e8f0;
    padding:2px 6px;
    border-radius:6px;
    margin-top:4px;
    display:inline-block;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  
  /* Image analysis */
  .analysis-area {
    border: 2px dashed #0ea5e9;
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
    background: rgba(14, 165, 233, 0.05);
  }
  .index-selector {
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }
  .index-option {
    flex: 1;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    font-weight: 900;
    background:#fff;
    transition:all 0.2s;
  }
  .index-option:hover {
    border-color:#0ea5e9;
    background:#f0f9ff;
  }
  .index-option.selected {
    background: #0ea5e9;
    color: white;
    border-color: #0ea5e9;
  }
  .histogram {
    height: 120px;
    margin-top: 10px;
  }
  
  /* Drawing controls */
  .draw-controls {
    position: absolute;
    top: 120px;
    right: 10px;
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 1000;
    border: 1px solid #e2e8f0;
  }
  .draw-buttons {
    display: flex;
    gap: 8px;
  }
  .draw-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
  }
  .draw-btn:hover {
    background: #f1f5f9;
  }
  .draw-btn.active {
    background: #0ea5e9;
    color: white;
    border-color: #0ea5e9;
  }
  
  /* Stats display */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
  }
  .stat-box {
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
  }
  .stat-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
  }
  .stat-value {
    font-weight: 900;
    font-size: 16px;
    color: #0f172a;
  }
  
  /* Icefree years */
  .year-item {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
  }
  .year-header {
    font-weight: 900;
    font-size: 14px;
    color: #0f172a;
    margin-bottom: 8px;
  }
  .year-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .year-stat {
    text-align: center;
  }
  .year-stat-label {
    font-size: 10px;
    color: #64748b;
    margin-bottom: 2px;
  }
  .year-stat-value {
    font-weight: 900;
    font-size: 12px;
    color: #0f172a;
  }
  
  /* Checkboxes for months */
  .months-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
  }
  .month-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .month-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }
  .month-checkbox label {
    font-size: 12px;
    cursor: pointer;
  }
/* ── Убираем флаг Leaflet, оставляем OSM ── */
.leaflet-attribution-flag {
  display: none !important;
}
.leaflet-control-attribution {
  font-size: 10px !important;
  opacity: 0.6;
  background: rgba(255,255,255,0.7) !important;
}

/* ── Welcome modal ── */
#welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#welcome-modal {
  background: #fff;
  border-radius: 20px;
  max-width: 560px;
  width: 100%;
  padding: 36px 40px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  position: relative;
}
#welcome-modal .wm-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
#welcome-modal .wm-logo-icon {
  font-size: 28px;
  line-height: 1;
}
#welcome-modal .wm-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}
#welcome-modal .wm-logo-sub {
  font-size: 12px;
  color: #64748b;
  font-weight: 400;
}
#welcome-modal h2 {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 14px;
}
#welcome-modal p {
  font-size: 14px;
  color: #334155;
  line-height: 1.65;
  margin: 0 0 12px;
}
#welcome-modal .wm-contacts {
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.8;
}
#welcome-modal .wm-contacts a {
  color: #0ea5e9;
  text-decoration: none;
}
#welcome-modal .wm-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  background: #0ea5e9;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}
#welcome-modal .wm-btn:hover {
  background: #0284c7;
}
