@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset & tokens ──────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Core palette — deep blacks & greys */
  --bg: #080909;
  --surface: #0e0f10;
  --surface2: #141516;
  --surface3: #1a1b1d;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-md: rgba(255, 255, 255, 0.10);

  /* Accent — minimal blue */
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.12);
  --blue-glow: rgba(59, 130, 246, 0.20);

  /* Status */
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;

  /* Text */
  --text: #e8eaed;
  --text-dim: #9aa0a6;
  --text-mute: #4a4f56;

  /* Layout */
  --panel-w: 370px;
  --header-h: 52px;
  --radius: 10px;
  --radius-sm: 6px;

  /* Glassmorphism */
  --glass: rgba(10, 11, 12, 0.92);
  --glow: 0 0 20px rgba(59, 130, 246, 0.12);
}

html,
body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 1000;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.logo-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
}

.logo span {
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.72rem;
  color: var(--text-mute);
  font-weight: 400;
  margin-left: 2px;
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Live indicator */
#live-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  transition: background 0.4s, box-shadow 0.4s;
}

.live-dot.stale {
  background: var(--orange);
  box-shadow: 0 0 6px var(--orange);
}

.live-dot.pulse {
  animation: pulse 1.2s ease-out;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.9);
    opacity: 0.4;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Stat chips */
.stat-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 11px;
  font-size: 0.73rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-chip span {
  color: var(--text);
  font-weight: 600;
}

/* Divider dot */
.hdr-divider {
  width: 1px;
  height: 18px;
  background: var(--border-md);
}

/* Theme toggle button */
.theme-toggle {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-md);
}

/* Show moon in dark, sun in light */
.icon-sun {
  display: none;
}

.icon-moon {
  display: block;
}

:root.light-mode .icon-sun {
  display: block;
}

:root.light-mode .icon-moon {
  display: none;
}

/* Icon-only buttons — size driven entirely by font-size */
.icon-btn {
  font-size: 0.95rem;
  /* base: ~15px — bump this to scale everything */
  width: 2.2em;
  height: 2.2em;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.icon-btn svg {
  width: 1.15em;
  height: 1.15em;
  stroke-width: 2px;
}

/* ── Main content ────────────────────────────────────────────── */
.content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Map ─────────────────────────────────────────────────────── */
#map {
  flex: 1;
  z-index: 1;
}

/* Leaflet dark overrides */
.leaflet-tile-pane {
  filter: brightness(0.75) saturate(0.7) contrast(1.05);
}

.leaflet-control-zoom a {
  background: var(--surface2) !important;
  color: var(--text-dim) !important;
  border: 1px solid var(--border) !important;
  font-size: 14px !important;
  transition: all 0.15s !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface3) !important;
  color: var(--text) !important;
  border-color: var(--border-md) !important;
}

.leaflet-control-attribution {
  background: rgba(8, 9, 9, 0.7) !important;
  color: var(--text-mute) !important;
  font-size: 0.65rem !important;
}

.leaflet-control-attribution a {
  color: var(--text-dim) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-md) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), var(--glow) !important;
  backdrop-filter: blur(12px);
}

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

.leaflet-popup-close-button {
  color: var(--text-dim) !important;
}

.popup-content h3 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--blue);
}

.popup-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 0.8rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.popup-row:last-child {
  border: none;
}

.popup-row span:first-child {
  color: var(--text-dim);
}

.popup-row span:last-child {
  font-weight: 500;
}

/* Popup navigation bar (for overlapping circles) */
.popup-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

.popup-nav-btn {
  background: var(--surface3);
  border: 1px solid var(--border-md);
  color: var(--text-dim);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}

.popup-nav-btn:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.popup-nav-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.popup-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Gateway icon */
.gw-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 10px currentColor;
}

/* ── Side Panel ──────────────────────────────────────────────── */
#panel {
  width: var(--panel-w);
  background: var(--glass);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.tab-btn {
  flex: 1;
  padding: 13px 8px;
  font-size: 0.74rem;
  font-weight: 500;
  background: none;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.18s;
  letter-spacing: 0.03em;
  font-family: 'Inter', sans-serif;
}

.tab-btn:hover {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: rgba(59, 130, 246, 0.04);
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

/* Scrollbar */
.tab-content::-webkit-scrollbar {
  width: 3px;
}

.tab-content::-webkit-scrollbar-track {
  background: transparent;
}

.tab-content::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 2px;
}

/* ── Panel sections ──────────────────────────────────────────── */
.panel-section {
  padding: 14px 16px;
}

.panel-section+.panel-section {
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
  background: #4f94f8;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.40);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.72rem;
}

.btn-sm.icon-btn {
  font-size: 0.95rem;
  padding: 0;
}

/* icon-btn overrides btn-sm sizing */

.btn-ghost {
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-md);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.10);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.20);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.20);
}

/* ── Gateway list ────────────────────────────────────────────── */
#gateway-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gateway-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}

.gateway-card:hover {
  border-color: rgba(59, 130, 246, 0.25);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.08);
}

.gw-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 5px;
}

.gw-card-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.gw-card-actions {
  display: flex;
  gap: 3px;
}

.gw-card-id {
  font-size: 0.69rem;
  color: var(--text-mute);
  font-family: monospace;
  margin-bottom: 7px;
}

.gw-card-coords {
  font-size: 0.73rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.gw-card-coords.no-coords {
  color: var(--orange);
}

.coord-badge {
  background: var(--surface3);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 0.69rem;
  color: var(--text);
}

/* ── Gateway form ────────────────────────────────────────────── */
#gateway-form-container {
  background: var(--surface2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 8px;
  display: none;
}

#gateway-form-container.visible {
  display: block;
}

.form-title {
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-dim);
}

.form-group {
  margin-bottom: 9px;
}

.form-group label {
  display: block;
  font-size: 0.71rem;
  color: var(--text-mute);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.form-group input {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.form-group input::placeholder {
  color: var(--text-mute);
}

.form-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.map-click-hint {
  font-size: 0.7rem;
  color: var(--blue);
  margin-top: 6px;
  display: none;
  align-items: center;
  gap: 4px;
  opacity: 0.8;
}

.map-click-hint.visible {
  display: flex;
}

/* ── Node cards ──────────────────────────────────────────────── */
#node-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.node-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.node-card:hover {
  border-color: rgba(59, 130, 246, 0.20);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.06);
}

.node-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.node-card-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.node-card-eui {
  font-size: 0.67rem;
  color: var(--text-mute);
  font-family: monospace;
  margin-bottom: 9px;
}

.rssi-bar-wrap {
  margin-bottom: 7px;
}

.rssi-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-mute);
  margin-bottom: 4px;
}

.rssi-track {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}

.rssi-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--red), var(--orange), #22c55e);
}

.node-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-pill {
  background: var(--surface3);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 0.7rem;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  gap: 3px;
}

.stat-pill strong {
  color: var(--text-dim);
  font-weight: 500;
}

.age-badge {
  font-size: 0.69rem;
  padding: 2px 7px;
  border-radius: 14px;
  background: rgba(34, 197, 94, 0.10);
  color: var(--green);
}

/* stale = ≥1 min, shown in grey (orange removed) */
.age-badge.stale {
  background: rgba(74, 79, 86, 0.20);
  color: var(--text-mute);
}

/* Per-node colour indicator dot */
.node-card-name-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.node-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.4s, box-shadow 0.4s;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-mute);
  font-size: 0.8rem;
}

.empty-state .empty-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
  opacity: 0.3;
}

/* ── Model tuning tab ────────────────────────────────────────── */
.model-section {
  padding: 14px 16px;
}

.model-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 10px;
}

.model-card-title {
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.slider-group {
  margin-bottom: 16px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.slider-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

.slider-value {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-dim);
  padding: 2px 8px;
  border-radius: 5px;
}

input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--surface3);
  outline: none;
  cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.45);
  transition: transform 0.15s;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.distance-preview {
  background: var(--surface3);
  border-radius: 7px;
  padding: 11px;
  text-align: center;
  margin-top: 12px;
  border: 1px solid var(--border);
}

.distance-preview .preview-label {
  font-size: 0.7rem;
  color: var(--text-mute);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.preview-values {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-item {
  text-align: center;
}

.preview-rssi {
  font-size: 0.68rem;
  color: var(--text-mute);
}

.preview-dist {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--blue);
}

.model-formula {
  font-size: 0.72rem;
  color: var(--text-mute);
  text-align: center;
  font-family: monospace;
  margin-top: 10px;
  line-height: 1.7;
  background: var(--bg);
  border-radius: 5px;
  padding: 8px;
  border: 1px solid var(--border);
}

/* ── Toast notifications ─────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 0.8rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.25s ease, toastOut 0.25s ease 2.75s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  white-space: nowrap;
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.30);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.30);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* ── Logs Tab ────────────────────────────────────────────────── */
#log-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: monospace;
  font-size: 0.7rem;
}

.log-entry {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-row-1 {
  display: flex;
  justify-content: space-between;
  color: var(--text-mute);
}

.log-row-2 {
  display: flex;
  gap: 6px;
  color: var(--text);
  word-break: break-all;
}

.log-method {
  font-weight: 600;
}

.log-method.get {
  color: var(--blue);
}

.log-method.post {
  color: var(--green);
}

.log-method.put {
  color: var(--orange);
}

.log-method.delete {
  color: var(--red);
}

.log-status.ok {
  color: var(--green);
}

.log-status.err {
  color: var(--red);
}

/* ── Light mode ─────────────────────────────────────────── */
:root.light-mode {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #f0f1f3;
  --surface3: #e8e9eb;
  --border: rgba(0, 0, 0, 0.07);
  --border-md: rgba(0, 0, 0, 0.12);
  --blue: #2563eb;
  --blue-dim: rgba(37, 99, 235, 0.10);
  --blue-glow: rgba(37, 99, 235, 0.15);
  --text: #111214;
  --text-dim: #3d4249;
  --text-mute: #828a96;
  --glass: rgba(255, 255, 255, 0.94);
  --glow: 0 0 20px rgba(37, 99, 235, 0.10);
}


/* ── Mobile / Responsive ───────────────────────────────────────── */

/* Floating panel toggle button (mobile only) */
#panel-toggle-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.45);
  align-items: center;
  gap: 7px;
  letter-spacing: 0.02em;
  transition: transform 0.18s, box-shadow 0.18s;
  white-space: nowrap;
  display: none;
  /* hidden by default, shown only on mobile */
}

#panel-toggle-btn:active {
  transform: translateX(-50%) scale(0.96);
}

#panel-toggle-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Backdrop overlay */
#panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 399;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

#panel-backdrop.visible {
  display: block;
}

@media (max-width: 768px) {

  /* Show toggle button */
  #panel-toggle-btn {
    display: flex;
  }

  /* Stat chips hidden to save header space */
  .stat-chip {
    display: none;
  }

  /* first divider (after stat chips) hidden */
  .header-right>.hdr-divider:first-of-type {
    display: none;
  }

  /* Layout: column so map fills */
  .content {
    flex-direction: column;
    overflow: visible;
    position: relative;
  }

  /* Map fills full remaining height */
  #map {
    flex: 1;
    width: 100%;
    min-height: 0;
  }

  /* Panel becomes a bottom sheet */
  #panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70vh;
    max-height: 80vh;
    border-left: none;
    border-top: 1px solid var(--border-md);
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 400;
    box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.5);
  }

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

  /* Drag handle visual */
  .panel-drag-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-md);
    border-radius: 2px;
    margin: 10px auto 4px;
    flex-shrink: 0;
  }
}

@media (min-width: 769px) {
  #panel-toggle-btn {
    display: none !important;
  }

  #panel-backdrop {
    display: none !important;
  }

  .panel-drag-handle {
    display: none !important;
  }
}