/* ===========================================================================
   Zub Mishka — базовая тема (светлая/тёмная) и layout.
   Умеренно строгий, приглушённый. CSS-переменные переключаются по [data-theme].
   =========================================================================== */

:root {
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #eef1f5;
  --text: #1c232e;
  --text-muted: #5b6675;
  --text-faint: #8a94a3;
  --border: #d9dee5;
  --border-strong: #c4ccd6;
  --accent: #2f6fdb;
  --accent-weak: #e6eefc;
  --danger: #c62828;
  --ok: #2e7d32;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --radius: 8px;
  --radius-sm: 6px;
  --topbar-h: 52px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter,
          "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0f1318;
  --bg-elev: #161b22;
  --bg-elev-2: #1c232c;
  --text: #e6e9ef;
  --text-muted: #9aa4b2;
  --text-faint: #6b7585;
  --border: #28313c;
  --border-strong: #3a4552;
  --accent: #4d8bf0;
  --accent-weak: #16243a;
  --danger: #ef5350;
  --ok: #66bb6a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Topbar ---------------------------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.topbar__brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar__logo {
  font-size: 20px;
  color: var(--accent);
  line-height: 1;
}
.topbar__title { font-weight: 600; letter-spacing: 0.2px; white-space: nowrap; }

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}
.tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tab__icon { display: flex; flex: 0 0 auto; }
/* Мобильные: названия скрыты, остаются только значки (title-подсказка остаётся) */
@media (max-width: 640px) {
  .tab__label { display: none; }
  .tab { padding: 7px 9px; }
  .topbar__title { display: none; } /* место под значки вкладок */
  /* Шапка может стать двухстрочной: строка поиска на всю ширину
     (открывается тапом по иконке лупы, см. map.css / search.js). */
  .topbar { height: auto; min-height: var(--topbar-h); flex-wrap: wrap; padding: 6px 10px; }
}
.tab:hover:not(:disabled) { color: var(--text); background: var(--bg-elev-2); }
.tab--active, .tab--active:hover {
  color: var(--accent);
  background: var(--accent-weak);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}
.tab:disabled { opacity: 0.45; cursor: not-allowed; }

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  appearance: none;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  transition: border-color 0.12s, background 0.12s;
}
.theme-toggle:hover { border-color: var(--border-strong); }

/* --- Кнопка «Обновить» (иконка рядом с переключателем темы) ---------------- */
.refresh-icon { display: block; }
.refresh-btn--spin .refresh-icon { animation: zm-refresh-spin 0.6s linear; }
@keyframes zm-refresh-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* --- Layout ---------------------------------------------------------------- */
/* body — flex-колонка: topbar (фикс.) + .layout (заполняет остаток).        */
/* Раньше было height:100% + sticky topbar — высота считалась неверно, карта */
/* занимала часть экрана, внизу оставалось пустое место.                     */
html, body { height: 100%; }
body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.layout {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}
.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.panel[hidden] { display: none; }

/* --- Placeholder (telemetry stub) ----------------------------------------- */
.placeholder {
  margin: auto;
  text-align: center;
  color: var(--text-faint);
  padding: 40px;
}
.placeholder__icon { font-size: 40px; margin-bottom: 8px; opacity: 0.6; }