/* ═══════════════════════════════════════════════════════════════
   GRIDPOINT — Stylesheet
   Breakpoints: mobile <600px | tablet 600-900px | desktop 900px+
   ═══════════════════════════════════════════════════════════════ */

/* ── THEME VARIABLES ── */
:root {
  --font-mono: 'Syne Mono', monospace;
  --font-body: 'DM Sans', sans-serif;
  --sidebar-w: 360px;
  --panel-radius: 16px;
  --drawer-peek: 56px; /* how much of the drawer shows when collapsed on mobile */
}

[data-theme="dark"] {
  --bg:        #0d0f14;
  --surface:   #141720;
  --surface2:  #1c2030;
  --border:    #2a2f42;
  --accent:    #00e5c0;
  --accent-fg: #0d0f14;
  --text:      #e8eaf0;
  --muted:     #6b7294;
  --error:     #ff6b6b;
  --btn-bg:    #1c2030;
  --btn-hover: #252b40;
}

[data-theme="light"] {
  --bg:        #f0f2f7;
  --surface:   #ffffff;
  --surface2:  #f5f7fc;
  --border:    #d0d5e8;
  --accent:    #0077cc;
  --accent-fg: #ffffff;
  --text:      #1a1e2e;
  --muted:     #7a82a0;
  --error:     #cc2200;
  --btn-bg:    #eef0f8;
  --btn-hover: #e2e5f0;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  transition: background 0.3s, color 0.3s;
}

/* ═══════════════════════════════════════
   DESKTOP LAYOUT (900px+)
   ═══════════════════════════════════════ */
#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  flex-shrink: 0;
  transition: background 0.3s, border-color 0.3s;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── BRAND ── */
#brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  transition: background 0.3s, border-color 0.3s;
}

.brand-icon {
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
  flex-shrink: 0;
  text-shadow: 0 0 10px var(--accent);
  transition: color 0.3s, text-shadow 0.3s;
}

.brand-text { flex: 1; min-width: 0; }

.brand-title {
  font-family: var(--font-mono);
  font-size: 17px;
  letter-spacing: 0.12em;
  color: var(--text);
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 1px;
}

.brand-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── LOCATE ME BUTTON ── */
#locate-me-btn {
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-width: 36px; min-height: 36px;
}

#locate-me-btn:hover  { color: var(--accent); border-color: var(--accent); background: var(--btn-hover); }
#locate-me-btn.locating {
  color: var(--accent); border-color: var(--accent);
  animation: pulse-btn 1s ease-in-out infinite;
}

@keyframes pulse-btn {
  0%,100% { box-shadow: 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
}

/* ── THEME TOGGLE ── */
#theme-toggle {
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}

#theme-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--btn-hover); }
.theme-icon { font-size: 13px; }

/* ── MAP TYPE BAR ── */
#map-type-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  transition: background 0.3s, border-color 0.3s;
}

.bar-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

.map-type-btns { display: flex; gap: 4px; flex: 1; }

.map-type-btn {
  flex: 1;
  padding: 7px 4px;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  min-height: 34px;
}

.map-type-btn:hover  { color: var(--text); border-color: var(--muted); }
.map-type-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }

/* ── GRID OVERLAY PANEL ── */
#grid-panel {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.3s;
}

.grid-toggle-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.grid-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
}

.grid-toggle-btn:hover  { color: var(--text); border-color: var(--muted); }
.grid-toggle-btn.active { color: var(--text); border-color: currentColor; background: var(--surface2); }

.grid-swatch {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.85;
}

/* ── INPUT PANEL ── */
#input-panel {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  transition: border-color 0.3s;
}

.panel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

select {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7294' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s, background 0.3s, color 0.3s;
  min-height: 44px;
}

select:focus { outline: none; border-color: var(--accent); }

#input-area { display: flex; flex-direction: column; gap: 8px; min-height: 44px; }

input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.3s, color 0.3s;
  min-height: 44px; /* iOS tap target */
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

input::placeholder { color: var(--muted); font-family: var(--font-body); font-size: 13px; }

.input-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#go-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.2s, background 0.3s;
  font-weight: 600;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}

#go-btn:hover  { opacity: 0.88; box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 40%, transparent); }
#go-btn:active { opacity: 0.75; }

#error-msg {
  font-size: 11px;
  color: var(--error);
  min-height: 14px;
  font-family: var(--font-mono);
  word-break: break-word;
  line-height: 1.4;
}

/* ── RESULTS ── */
#results-panel { padding: 16px 20px; border-bottom: 1px solid var(--border); }
#results-panel.hidden { display: none; }

#results-coords { font-family: var(--font-mono); font-size: 9px; color: var(--accent); }

#results-grid { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }

.result-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 11px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
  animation: fadeIn 0.3s ease forwards;
  opacity: 0;
}

.result-item:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface2)); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

.result-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  margin-top: 2px;
  flex-shrink: 0;
}

.result-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  text-align: right;
  word-break: break-all;
  flex: 1;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 4px;
  flex-shrink: 0;
  transition: color 0.15s;
  font-size: 14px;
  line-height: 1;
  min-width: 28px; min-height: 28px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.copy-btn:hover { color: var(--accent); }
.result-item.copied { border-color: var(--accent); }

/* ── MAP HINT ── */
#map-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

/* ── CREDIT ── */
#credit {
  padding: 10px 20px 14px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

#credit a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
#credit a:hover { color: var(--accent); }

#credit strong {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.06em;
}

#github-link {
  margin-left: auto;
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

#github-link:hover { color: var(--accent); }

/* ── MAP ── */
#map {
  flex: 1;
  height: 100vh;
  min-height: 0;
  background: var(--bg);
  position: relative;
  z-index: 1;
}

#map.map-dark-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 20, 0.45);
  pointer-events: none;
  z-index: 400;
}

/* ── LOADING ── */
#loading {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--accent);
  z-index: 9999;
}

#loading.hidden { display: none; }

.loader-ring {
  width: 26px; height: 26px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── LEAFLET OVERRIDES ── */
.leaflet-container {
  background: var(--bg) !important;
  font-family: var(--font-body) !important;
  width: 100% !important;
  height: 100% !important;
}

.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
  color: var(--text) !important;
}

.leaflet-popup-tip { background: var(--surface) !important; }

.leaflet-popup-content {
  margin: 12px 16px !important;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--text) !important;
}

.popup-coord { color: var(--accent); }
.popup-label { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }

.custom-marker {
  background: var(--accent);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--accent);
}

/* ── GRID LABELS ── */
.grid-label {
  font-family: 'Syne Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  padding: 1px 4px;
  border-radius: 2px;
  position: absolute;
  transform: translate(-50%, -50%);
  opacity: 0.92;
  letter-spacing: 0.03em;
}

.gl-maidenhead { color: #00e5c0; text-shadow: 0 0 4px rgba(0,0,0,0.8); }
.gl-osgrid     { color: #ff6b35; text-shadow: 0 0 4px rgba(0,0,0,0.8); }
.gl-wab        { color: #f5c518; text-shadow: 0 0 4px rgba(0,0,0,0.8); }
.gl-pluscode   { color: #a78bfa; text-shadow: 0 0 4px rgba(0,0,0,0.8); }
.gl-cqzone     { color: #34d399; text-shadow: 0 0 4px rgba(0,0,0,0.8); }
.gl-ituzone    { color: #f472b6; text-shadow: 0 0 4px rgba(0,0,0,0.8); }
.gl-latlon     { color: #60a5fa; text-shadow: 0 0 4px rgba(0,0,0,0.8); }

[data-theme="light"] .gl-maidenhead { color: #008866; text-shadow: 0 0 3px rgba(255,255,255,0.9); }
[data-theme="light"] .gl-osgrid     { color: #c94010; text-shadow: 0 0 3px rgba(255,255,255,0.9); }
[data-theme="light"] .gl-wab        { color: #997700; text-shadow: 0 0 3px rgba(255,255,255,0.9); }
[data-theme="light"] .gl-pluscode   { color: #6d28d9; text-shadow: 0 0 3px rgba(255,255,255,0.9); }
[data-theme="light"] .gl-cqzone     { color: #065f46; text-shadow: 0 0 3px rgba(255,255,255,0.9); }
[data-theme="light"] .gl-ituzone    { color: #9d174d; text-shadow: 0 0 3px rgba(255,255,255,0.9); }
[data-theme="light"] .gl-latlon     { color: #1d4ed8; text-shadow: 0 0 3px rgba(255,255,255,0.9); }


/* ═══════════════════════════════════════
   TABLET LAYOUT (600px – 900px)
   Narrow sidebar, map fills the rest
   ═══════════════════════════════════════ */
@media (max-width: 900px) and (min-width: 600px) {
  :root { --sidebar-w: 280px; }

  .brand-title { font-size: 14px; }
  .brand-sub   { display: none; }

  #map-hint    { display: none; }

  select, input[type="text"], input[type="number"] { font-size: 13px; }
}


/* ═══════════════════════════════════════
   MOBILE LAYOUT (<600px)
   Map fills full screen.
   Sidebar becomes a bottom drawer.
   ═══════════════════════════════════════ */
@media (max-width: 599px) {

  #app {
    flex-direction: column;
    position: relative;
  }

  /* Map fills the whole screen */
  #map {
    position: absolute;
    inset: 0;
    height: 100vh;
    width: 100vw;
    z-index: 1;
  }

  /* Sidebar becomes a bottom sheet drawer */
  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    min-width: unset;
    height: auto;
    max-height: 85vh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: var(--panel-radius) var(--panel-radius) 0 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    /* Collapsed: only the handle + brand visible (~56px) */
    transform: translateY(calc(100% - var(--drawer-peek)));
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  }

  #sidebar.drawer-open {
    transform: translateY(0);
  }

  /* Drag handle at top of drawer */
  #sidebar::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }

  /* Brand row doubles as the tap-to-expand handle */
  #brand {
    cursor: pointer;
    padding: 10px 16px 12px;
    -webkit-tap-highlight-color: transparent;
  }

  .brand-sub { display: none; }

  /* Tighten up all padding on mobile */
  #map-type-bar  { padding: 8px 16px; }
  #grid-panel    { padding: 10px 16px; }
  #input-panel   { padding: 12px 16px; }
  #results-panel { padding: 12px 16px; }
  #map-hint      { display: none; }
  #credit        { padding: 8px 16px 16px; }

  /* Slightly larger tap targets */
  .map-type-btn   { padding: 8px 6px; font-size: 11px; }
  .grid-toggle-btn { padding: 7px 10px; }

  /* Floating locate button visible over the map when drawer is collapsed */
  #locate-me-btn {
    position: fixed;
    bottom: calc(var(--drawer-peek) + 12px);
    right: 16px;
    z-index: 200;
    background: var(--surface);
    border-color: var(--border);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    padding: 0;
  }

  /* Move zoom controls up so they don't clash with the drawer */
  .leaflet-bottom.leaflet-right {
    bottom: calc(var(--drawer-peek) + 8px) !important;
  }
}

/* ═══════════════════════════════════════
   SIDEBAR TABS (Location / Bearing)
   ═══════════════════════════════════════ */

#sidebar-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 42px;
}
.sidebar-tab + .sidebar-tab { border-left: 1px solid var(--border); }
.sidebar-tab:hover { color: var(--text); }
.sidebar-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

/* Sidebar panes */
.sidebar-pane { display: none !important; }
.sidebar-pane.active { display: block !important; }

/* ═══════════════════════════════════════
   BEARING & DISTANCE PANEL
   ═══════════════════════════════════════ */

.brg-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.brg-section:last-child { border-bottom: none; }


/* Home station row */
.brg-geo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.brg-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.brg-dot--idle  { background: var(--muted); }
.brg-dot--warn  { background: #f5c518; }
.brg-dot--ok    { background: #00e5c0; }
.brg-dot--err   { background: var(--error); }

.brg-geo-status {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brg-small-btn {
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  min-height: 32px;
  -webkit-tap-highlight-color: transparent;
}
.brg-small-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--btn-hover); }

.brg-wide-btn {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 9px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 38px;
  -webkit-tap-highlight-color: transparent;
}
.brg-wide-btn:hover { border-color: var(--accent); background: var(--btn-hover); }

.brg-manual-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

/* Target tabs */
.brg-tabs {
  display: flex;
  margin: 8px 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.brg-tab {
  flex: 1;
  padding: 7px 4px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 32px;
  -webkit-tap-highlight-color: transparent;
}
.brg-tab + .brg-tab { border-left: 1px solid var(--border); }
.brg-tab.active { background: var(--surface2); color: var(--accent); }
.brg-tab:hover:not(.active) { color: var(--text); }

.brg-pane { display: none; }
.brg-pane.active { display: block; }

.brg-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.brg-input-row input { flex: 1; }

.brg-place-result {
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-top: 5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--font-mono);
}
.brg-place-result:hover { border-color: var(--accent); background: var(--btn-hover); }

.brg-searching, .brg-no-results {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  display: block;
  margin-top: 6px;
}

.brg-error {
  font-size: 11px;
  color: var(--error);
  font-family: var(--font-mono);
  margin-top: 8px;
  word-break: break-word;
  line-height: 1.4;
}

/* Result metrics row */
.brg-result-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 10px 0 14px;
}
.brg-metric { text-align: center; }
.brg-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}
.brg-val--sm { font-size: 16px; }
.brg-lbl {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* Compass */
.brg-compass-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 12px;
}

/* Detail rows */
.brg-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  padding: 5px 0;
  border-top: 1px solid var(--border);
}
.brg-detail-row span:first-child {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brg-detail-row span:last-child {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
