/* ─── Layout ────────────────────────────────────────────────────────────── */
.cloud-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 50px);
}
.cloud-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 14px 80px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.cloud-side-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cloud-side-header h2 {
  margin: 0;
  font-size: 16px;
}
.cloud-side-counter { font-size: 12px; color: var(--muted); }
.cloud-side-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.cloud-side-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 12px 0;
  text-align: center;
}
.station-card-side {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.05s;
  display: flex;
  gap: 8px;
  align-items: center;
}
.station-card-side:hover { border-color: var(--primary); }
.station-card-side:active { transform: scale(0.99); }
.station-card-side .ico {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface);
}
.station-card-side .info {
  flex: 1;
  min-width: 0;
}
.station-card-side .info .name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.station-card-side .info .sub {
  font-size: 11px;
  color: var(--muted);
}
.station-card-side .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
}
.station-card-side .badge-dot.active { background: #4caf50; }

.cloud-main {
  position: relative;
  overflow: hidden;
}
.cloud-map {
  height: 100%;
  background: #ddd;
}
.cloud-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 12px;
  z-index: 500;
  display: flex;
  justify-content: space-between;
}

/* ─── Add/edit modal fields ────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field > span { color: var(--muted); }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn.selected { border-color: var(--primary); background: rgba(0, 135, 54, 0.1); }

/* ─── Map markers (adaptive by zoom) ────────────────────────────────────── */
.st-mk-wrap { background: transparent; border: none; }

.st-mk {
  --mk-color: #008736;
  position: relative;
  background: var(--surface, #232323);
  border: 2px solid var(--mk-color);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  color: var(--text, #f0efeb);
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--font, sans-serif);
  line-height: 1.1;
  transition: transform .12s ease, box-shadow .12s ease;
}
.st-mk:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.5); cursor: pointer; }
/* Хвостик-pin вниз по центру */
.st-mk .pin {
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid var(--mk-color);
}
.st-mk.inactive {
  --mk-color: #888;
  opacity: 0.78;
  filter: saturate(0.4);
}

/* full: иконка + название + значение (block layout) */
.st-mk-full { padding: 5px 10px 6px; gap: 8px; }
.st-mk-full .ico { font-size: 22px; flex-shrink: 0; }
.st-mk-full .text { display: flex; flex-direction: column; gap: 1px; }
.st-mk-full .text .name { font-size: 12px; font-weight: 600; color: var(--text); max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.st-mk-full .text .val  { font-size: 13px; font-weight: 700; color: var(--mk-color); }

/* compact: иконка + значение, без названия */
.st-mk-compact { padding: 3px 8px 4px; gap: 5px; border-radius: 14px; }
.st-mk-compact .ico { font-size: 15px; }
.st-mk-compact .val { font-size: 12px; font-weight: 700; color: var(--mk-color); }

/* tiny: только значение, очень маленький */
.st-mk-tiny { padding: 2px 6px; border-radius: 10px; border-width: 1.5px; }
.st-mk-tiny .val { font-size: 11px; font-weight: 700; color: var(--mk-color); }
.st-mk-tiny .pin {
  border-left-width: 5px;
  border-right-width: 5px;
  border-top-width: 6px;
  bottom: -6px;
}

/* Светлая тема */
body.light .st-mk { background: #fff; color: #222; }
body.light .st-mk .text .name { color: #222; }

/* ─── Expanded station card content ────────────────────────────────────── */
.station-photo {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin: 8px 0;
}
.station-photo-empty {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 8px;
  font-size: 64px;
  margin: 8px 0;
}
.station-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 10px;
}
.station-meta .status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  background: #999;
}
.station-meta .status-dot.active { background: #4caf50; }

.station-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.station-widget {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  position: relative;
}
.station-widget:hover { border-color: var(--primary); }
.station-widget .label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.station-widget .value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 2px 0;
}
.station-widget .age {
  font-size: 10px;
  color: var(--muted);
}
.station-widget .hide-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  width: 18px; height: 18px;
  border-radius: 4px;
  line-height: 1;
}
.station-widget .hide-btn:hover { background: var(--surface); color: #e53935; }

.station-widget.hidden-w {
  opacity: 0.5;
}

.station-chart-container {
  height: 260px;
  margin-top: 10px;
}

.station-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ─── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cloud-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .cloud-sidebar {
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px 12px;
  }
  .cloud-side-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
  }
}
