/* ═══════════════════════════════════════════════════════════
   LAYOUT.CSS — App shell, topbar, sidebar structure
   ═══════════════════════════════════════════════════════════ */

/* ── App container ── */
.app {
  height: calc(100dvh - var(--sat) - var(--sab));
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ═══════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════ */
.topbar {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 5000;
  padding-top: var(--sat);
  contain: layout paint;

  border-bottom: 1px solid var(--ui-border);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--ui-surface-solid) 92%, transparent),
    color-mix(in srgb, var(--ui-surface) 70%, transparent)
  );
  backdrop-filter: var(--ui-blur);
  -webkit-backdrop-filter: var(--ui-blur);
  box-shadow: var(--ui-shadow-soft);
}

.topbar__row {
  gap: 10px;
  padding: 6px 10px;
  min-height: var(--topbar-h);
  box-sizing: border-box;
}

.topbar__row--1 {
  display: grid;
  align-items: center;
  grid-template-columns: max-content 1fr max-content;
}

.topbar__left {
  justify-self: start;
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar__center {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: min(720px, 100%);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topbar__center::-webkit-scrollbar { display: none; }

.topbar__right {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}

.topbar__row--2 {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h2);
  padding-top: 0;
  padding-bottom: 6px;
}

/* ── Brand ── */
body.theme-hud .brand__subtitle {
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ui-accent) 90%, transparent);
  white-space: nowrap;
}

/* ── Status indicator ── */
body.theme-hud .status-indicator,
body.theme-hud .hud-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ui-border);
  background: color-mix(in srgb, var(--ui-surface) 85%, transparent);
  color: var(--ui-text-2);
}

body.theme-hud .status-indicator__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(56, 255, 156, 0.95);
  box-shadow: 0 0 18px rgba(56, 255, 156, 0.35);
}

body.theme-hud .status-indicator__text,
body.theme-hud #hud-clock,
body.theme-hud .hud-mode {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

body.theme-hud .hud-mode {
  color: color-mix(in srgb, var(--ui-accent) 82%, transparent);
}

body.theme-hud .hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ui-accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--ui-accent) 35%, transparent);
}

/* ═══════════════════════════════════════
   LAYOUT GRID
   ═══════════════════════════════════════ */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: var(--layout-gap);
  grid-template-columns:
    minmax(0, var(--side-w-left))
    minmax(0, 1fr)
    minmax(0, var(--side-w-right));
  grid-template-rows: 1fr;
  padding: var(--layout-gap);
  box-sizing: border-box;
}

/* ── Sidebars ── */
.sidebar {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.sidebar__scroll {
  height: 100%;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Left sidebar scroll ── */
body.theme-hud .sidebar--left {
  overflow: hidden;
}

body.theme-hud .sidebar--left #filters-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.theme-hud .sidebar--left #filters-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

/* ── Right sidebar scroll ── */
body.theme-hud .sidebar--right {
  overflow: hidden;
}

body.theme-hud .sidebar--right,
body.theme-hud .sidebar--right * {
  min-width: 0;
}

body.theme-hud .sidebar--right .sidebar__scroll {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

/* ── Map wrapper ── */
.map-wrapper {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--ui-border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}

#map {
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* ── Tablet ── */
@media (max-width: 1200px) {
  :root {
    --side-w-left:  300px;
    --side-w-right: 320px;
    --layout-gap:   10px;
    --hudbar-w:     min(560px, calc(100% - 20px));
  }
}