/* ─────────────────────────────────────────────────────────────
   Logic Electric — design primitives & global tokens
   Tokens namespaced --le-* so they don't clash with existing :root vars.
   New code should consume these; old code keeps its own.
   ───────────────────────────────────────────────────────────── */

:root {
  /* Surfaces */
  --le-bg:           #0B1020;
  --le-surface:      #161E33;
  --le-surface-2:    #1E2740;
  --le-surface-3:    #2A344E;
  --le-border:       #2A344E;
  --le-border-soft:  #1E2740;
  --le-border-hover: #3C4866;

  /* Text */
  --le-text:         #E8ECF5;
  --le-text-muted:   #8A93A6;
  --le-text-dim:     #5F6A82;

  /* Brand cyan */
  --le-cyan:         #3FB6E8;
  --le-cyan-hi:      #5BC4ED;
  --le-cyan-low:     #2A8FBE;
  --le-cyan-glow:    rgba(63, 182, 232, 0.18);
  --le-cyan-tint:    rgba(63, 182, 232, 0.08);

  /* Semantic */
  --le-danger:       #F87171;
  --le-warn:         #FBBF24;
  --le-success:      #34D399;
  --le-violet:       #A78BFA;

  /* Type */
  --le-font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --le-font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ===== Button ============================================== */
.le-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--le-font-sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: filter .12s, background .12s, border-color .12s, transform .06s;
  outline: none;
}
.le-btn:focus-visible { box-shadow: 0 0 0 3px var(--le-cyan-glow); }

/* Variants */
.le-btn--primary {
  background: linear-gradient(180deg, var(--le-cyan-hi), var(--le-cyan));
  color: #061224;
  border-color: var(--le-cyan-low);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 1px 8px var(--le-cyan-glow);
}
.le-btn--primary:hover { filter: brightness(1.08); }
.le-btn--primary:active { transform: translateY(1px); }

.le-btn--secondary {
  background: var(--le-surface);
  color: var(--le-text);
  border-color: var(--le-border);
}
.le-btn--secondary:hover { background: var(--le-surface-2); border-color: var(--le-border-hover); }

.le-btn--ghost {
  background: transparent;
  color: var(--le-text);
  border-color: transparent;
}
.le-btn--ghost:hover { background: var(--le-surface-2); }

.le-btn--danger {
  background: rgba(248, 113, 113, 0.12);
  color: var(--le-danger);
  border-color: rgba(248, 113, 113, 0.35);
}
.le-btn--danger:hover { background: rgba(248, 113, 113, 0.2); }

/* Sizes */
.le-btn--sm { height: 30px; padding: 0 10px; font-size: 12px; }
.le-btn--md { /* default */ }
.le-btn--lg { height: 44px; padding: 0 18px; font-size: 14px; }

.le-btn--block { width: 100%; }

/* ===== IconButton ========================================== */
.le-icon-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--le-text-muted);
  cursor: pointer;
  position: relative;
  transition: background .12s, color .12s, border-color .12s;
  flex-shrink: 0;
  outline: none;
}
.le-icon-btn:hover { background: var(--le-surface-2); color: var(--le-text); border-color: var(--le-border); }
.le-icon-btn:focus-visible { box-shadow: 0 0 0 3px var(--le-cyan-glow); }
.le-icon-btn--lg { width: 44px; height: 44px; border-radius: 10px; }

.le-icon-btn .le-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--le-cyan);
  box-shadow: 0 0 0 2px var(--le-bg);
}
.le-icon-btn .le-count {
  position: absolute;
  top: 4px; right: 2px;
  min-width: 16px;
  height: 14px;
  padding: 0 4px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--le-font-mono);
  background: var(--le-danger);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--le-bg);
}

/* ===== Badge ============================================== */
.le-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  font-family: var(--le-font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--le-surface-3);
  color: var(--le-text-muted);
  border: 1px solid var(--le-border);
  white-space: nowrap;
}
.le-badge--cyan    { background: var(--le-cyan-tint);          color: var(--le-cyan);    border-color: rgba(63,182,232,0.3); }
.le-badge--success { background: rgba(52,211,153,0.12);        color: var(--le-success); border-color: rgba(52,211,153,0.3); }
.le-badge--warn    { background: rgba(251,191,36,0.12);        color: var(--le-warn);    border-color: rgba(251,191,36,0.3); }
.le-badge--danger  { background: rgba(248,113,113,0.12);       color: var(--le-danger);  border-color: rgba(248,113,113,0.3); }
.le-badge--neutral { /* default */ }

/* ===== Avatar ============================================== */
.le-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--le-cyan), var(--le-violet));
  color: var(--le-bg);
  font-family: var(--le-font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  border: 1.5px solid var(--le-bg);
  box-shadow: 0 0 0 1px var(--le-border);
  flex-shrink: 0;
  text-transform: uppercase;
  overflow: hidden;
}
.le-avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.le-avatar--lg { width: 44px; height: 44px; font-size: 14px; }
.le-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===== KbdPill ============================================ */
.le-kbd {
  display: inline-flex;
  align-items: center;
  font-family: var(--le-font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--le-surface-2);
  color: var(--le-text-dim);
  border: 1px solid var(--le-border);
  line-height: 1;
  white-space: nowrap;
}

/* ===== EnvChip ============================================ */
.le-envchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-family: var(--le-font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.le-envchip--live    { background: rgba(52,211,153,0.12); color: var(--le-success); border: 1px solid rgba(52,211,153,0.3); }
.le-envchip--staging { background: rgba(251,191,36,0.12); color: var(--le-warn);    border: 1px solid rgba(251,191,36,0.3); }
.le-envchip .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: le-pulse 2s infinite;
}
@keyframes le-pulse {
  0%   { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70%  { box-shadow: 0 0 0 6px transparent; opacity: 0.3; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

/* ===== Card =============================================== */
.le-card {
  background: var(--le-surface);
  border: 1px solid var(--le-border-soft);
  border-radius: 12px;
  padding: 14px;
  color: var(--le-text);
}

/* ===== Sheet / Popover base animations ==================== */
@keyframes le-sheet-up    { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes le-sheet-down  { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes le-sheet-left  { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes le-sheet-right { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes le-fade-in     { from { opacity: 0; } to { opacity: 1; } }

.le-scrim {
  position: fixed;
  inset: 0;
  background: rgba(5,8,17,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 8500;
  animation: le-fade-in .15s ease-out;
}

.le-sheet {
  position: fixed;
  background: var(--le-bg);
  border: 1px solid var(--le-border);
  z-index: 8600;
  color: var(--le-text);
  font-family: var(--le-font-sans);
  display: flex;
  flex-direction: column;
}
.le-sheet--left   { top: 0; left: 0; bottom: 0; width: 85%; max-width: 320px; border-right: 1px solid var(--le-border); animation: le-sheet-left .22s cubic-bezier(.2,.7,.3,1); }
.le-sheet--right  { top: 0; right: 0; bottom: 0; width: 85%; max-width: 380px; border-left: 1px solid var(--le-border); animation: le-sheet-right .22s cubic-bezier(.2,.7,.3,1); }
.le-sheet--bottom { left: 0; right: 0; bottom: 0; max-height: 85vh; border-top-left-radius: 16px; border-top-right-radius: 16px; padding-bottom: env(safe-area-inset-bottom); background: var(--le-surface); animation: le-sheet-up .22s cubic-bezier(.2,.7,.3,1); }
.le-sheet--top    { left: 0; right: 0; top: 0; max-height: 85vh; animation: le-sheet-down .22s cubic-bezier(.2,.7,.3,1); }
.le-sheet--full   { inset: 0; max-height: none; }

.le-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--le-surface-3);
  margin: 8px auto 4px;
}

/* ===== Breakpoint visibility (desktop vs mobile topbars) ===== */
@media (max-width: 767.98px) {
  #topbar-mount { display: none !important; }
}
@media (min-width: 768px) {
  #topbar-mobile-mount { display: none !important; }
}
