/* ══════════════════════════════════════════════════════════════════════════
   Mumble Web Client – style.css
   Mobile-first, dark/light themes, glassmorphism, micro-animations
   ══════════════════════════════════════════════════════════════════════════ */

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

/* ── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  22px;
  --radius-xl:  32px;
  --transition: 0.22s cubic-bezier(.4,0,.2,1);
  --font:       'Inter', system-ui, sans-serif;
  --header-h:   60px;
  --bottom-nav-h: 72px;
}

/* Dark Theme (default) */
[data-theme="dark"] {
  --bg:          #0d0d1a;
  --bg-glass:    rgba(22, 22, 44, 0.72);
  --bg-card:     #16182e;
  --bg-hover:    #1e2040;
  --bg-input:    #1a1c38;
  --accent:      #7c3aed;
  --accent-2:    #a855f7;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --accent-grad: linear-gradient(135deg,#7c3aed,#a855f7);
  --text:        #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #64748b;
  --border:      rgba(255,255,255,0.08);
  --border-2:    rgba(255,255,255,0.14);
  --shadow:      0 8px 32px rgba(0,0,0,0.55);
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.4);
  --status-ok:   #10b981;
  --status-warn: #f59e0b;
  --status-err:  #ef4444;
  --ptt-idle:    rgba(124,58,237,0.2);
  --ptt-active:  rgba(16,185,129,0.25);
  --ptt-toggle:  rgba(245,158,11,0.25);
  --scrollbar:   rgba(255,255,255,0.1);
}

/* Light Theme */
[data-theme="light"] {
  --bg:          #f0f2ff;
  --bg-glass:    rgba(255, 255, 255, 0.78);
  --bg-card:     #ffffff;
  --bg-hover:    #f1f0ff;
  --bg-input:    #f8f7ff;
  --accent:      #7c3aed;
  --accent-2:    #a855f7;
  --accent-glow: rgba(124, 58, 237, 0.2);
  --accent-grad: linear-gradient(135deg,#7c3aed,#a855f7);
  --text:        #1e1b4b;
  --text-2:      #4c4980;
  --text-3:      #9492b8;
  --border:      rgba(0,0,0,0.08);
  --border-2:    rgba(0,0,0,0.14);
  --shadow:      0 8px 32px rgba(100,80,200,0.12);
  --shadow-sm:   0 2px 12px rgba(100,80,200,0.08);
  --status-ok:   #059669;
  --status-warn: #d97706;
  --status-err:  #dc2626;
  --ptt-idle:    rgba(124,58,237,0.1);
  --ptt-active:  rgba(5,150,105,0.15);
  --ptt-toggle:  rgba(217,119,6,0.15);
  --scrollbar:   rgba(0,0,0,0.12);
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
  transition: background var(--transition), color var(--transition);
}

/* Scrollbars */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── App Wrapper ────────────────────────────────────────────────────────── */
.app {
  width: 100vw;
  height: 100dvh;
  display: grid;
  position: relative;
  overflow: hidden;
}

/* ── Screens ────────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transition: opacity var(--transition), transform var(--transition);
}
.screen.hidden   { opacity: 0; pointer-events: none; transform: translateX(20px); }
.screen.active   { opacity: 1; transform: none; }

/* ── Glassmorphism helper ───────────────────────────────────────────────── */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--border-2);
}

/* ══════════════════════════════════════════════════════════════════════════
   APP HEADER (shared)
   ══════════════════════════════════════════════════════════════════════════ */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-icon { font-size: 1.4rem; }

/* ── Icon Button ────────────────────────────────────────────────────────── */
.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), box-shadow var(--transition);
}
.icon-btn:hover  { background: var(--bg-hover); }
.icon-btn.danger:hover { background: rgba(239,68,68,0.15); color: var(--status-err); }
.icon-btn.sm     { width: 32px; height: 32px; font-size: 0.9rem; }

/* ── Generic Buttons ────────────────────────────────────────────────────── */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover  { box-shadow: 0 6px 24px var(--accent-glow); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-2);
}
.btn-ghost:hover { background: var(--bg-hover); }

/* ══════════════════════════════════════════════════════════════════════════
   SERVER LIST SCREEN
   ══════════════════════════════════════════════════════════════════════════ */
.server-list-page {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 100px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Server Card */
.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  animation: slideIn 0.25s ease forwards;
}
.server-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.server-avatar {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.server-info { flex: 1; min-width: 0; }
.server-card-name {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-card-details {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-connect {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent-grad);
  color: #fff;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-connect:hover  { box-shadow: 0 4px 16px var(--accent-glow); transform: scale(1.04); }
.btn-connect:active { transform: scale(0.96); }

.btn-delete {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.btn-delete:hover { background: rgba(239,68,68,0.12); color: var(--status-err); border-color: rgba(239,68,68,0.3); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
}
.empty-state .empty-icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* FAB */
.fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent-grad);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 6px 24px var(--accent-glow);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  z-index: 100;
}
.fab:hover  { transform: scale(1.1) rotate(90deg); box-shadow: 0 10px 32px var(--accent-glow); }
.fab:active { transform: scale(0.93); }

/* ══════════════════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal {
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  animation: slideUp 0.3s cubic-bezier(.4,0,.2,1);
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-bottom: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* Form */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.82rem; font-weight: 500; color: var(--text-2); }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"] {
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-row { flex-direction: row !important; gap: 12px; }
.form-row > * { flex: 1; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  margin-top: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--bg-input);
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-2);
}

/* ══════════════════════════════════════════════════════════════════════════
   CLIENT SCREEN
   ══════════════════════════════════════════════════════════════════════════ */
.client-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 8px;
  z-index: 50;
  flex-shrink: 0;
}

.header-left  { display: flex; align-items: center; gap: 8px; }
.header-right { display: flex; align-items: center; gap: 4px; }

.server-meta { line-height: 1.3; }
.server-name-display { font-weight: 600; font-size: 0.95rem; }
.status-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

/* ── Status Dot ──────────────────────────────────────────────────────────── */
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.status-dot.connecting { background: var(--status-warn); animation: pulse-warn 1.2s infinite; }
.status-dot.connected  { background: var(--status-ok);  box-shadow: 0 0 6px var(--status-ok); }
.status-dot.unstable   { background: var(--status-warn); box-shadow: 0 0 6px var(--status-warn); animation: pulse-warn 1.8s infinite; }
.status-dot.high-latency { background: var(--status-warn); }
.status-dot.error,
.status-dot.disconnected { background: var(--status-err); }

.status-label { font-size: 0.72rem; color: var(--text-2); }

.latency-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--bg-hover);
  color: var(--text-2);
  font-weight: 500;
}
.latency-badge.ok   { color: var(--status-ok); }
.latency-badge.warn { color: var(--status-warn); }
.latency-badge.bad  { color: var(--status-err); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  backdrop-filter: blur(3px);
}
.sidebar-overlay.hidden { display: none; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--bg-card);
  border-right: 1px solid var(--border-2);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 32px rgba(0,0,0,0.3);
  padding-top: env(safe-area-inset-top, 0);
}
.sidebar.open { transform: none; }

.sidebar-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title { font-weight: 700; font-size: 1rem; }

.channel-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Channel items */
.ch-item {
  padding: 6px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition);
  border-radius: 0;
  position: relative;
}
.ch-item:hover { background: var(--bg-hover); }
.ch-item.selected { background: var(--accent-glow); }
.ch-icon { font-size: 0.9rem; opacity: 0.6; flex-shrink: 0; }
.ch-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
}
.ch-count {
  font-size: 0.7rem;
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 1px 6px;
  color: var(--text-3);
}

/* User items */
.u-item {
  padding: 5px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background var(--transition);
  border-radius: 0;
}
.u-item:hover        { background: var(--bg-hover); }
.u-item.me           { opacity: 0.7; cursor: default; }
.u-item.selected     { background: var(--accent-glow); }
.u-item.talking      { background: rgba(16,185,129,0.1); }
.u-icon              { font-size: 0.8rem; flex-shrink: 0; }
.u-name {
  flex: 1;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.u-talking-dot { font-size: 0.75rem; animation: bounce 0.6s infinite; }

.target-row {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  min-height: 40px;
  color: var(--accent-2);
  font-weight: 500;
}
.btn-clear {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-3);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-clear:hover { background: rgba(239,68,68,0.15); color: var(--status-err); }

/* ── Client Main ─────────────────────────────────────────────────────────── */
.client-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Chat panel */
.chat-panel {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.message-log { display: flex; flex-direction: column; gap: 6px; }

.msg-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  animation: slideIn 0.2s ease;
}
.msg-item.system { border-color: rgba(124,58,237,0.25); background: rgba(124,58,237,0.06); }
.msg-sender { font-size: 0.72rem; font-weight: 600; color: var(--accent-2); display: block; margin-bottom: 2px; }
.msg-text   { font-size: 0.85rem; line-height: 1.5; word-break: break-word; }

/* Target banner */
.target-banner {
  margin: 4px 8px;
  padding: 6px 12px;
  background: linear-gradient(90deg, rgba(124,58,237,0.15), rgba(168,85,247,0.1));
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--accent-2);
  font-weight: 500;
}
.btn-clear-sm {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-clear-sm:hover { color: var(--status-err); }

/* ── PTT Zone ─────────────────────────────────────────────────────────────── */
.ptt-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 8px;
  gap: 12px;
  flex-shrink: 0;
}

.ptt-hint {
  text-align: center;
  color: var(--text-3);
  font-size: 0.8rem;
  line-height: 1.6;
}
.ptt-hint small { display: block; font-size: 0.72rem; opacity: 0.7; }

.ptt-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── The PTT Button ───────────────────────────────────────────────────────── */
.ptt-btn {
  position: relative;
  width: 130px; height: 130px;
  border-radius: 50%;
  border: none;
  background: var(--ptt-idle);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ptt-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  border: 2px solid var(--accent);
  opacity: 0.3;
  transition: all 0.2s ease;
}
.ptt-ring-outer { width: 130px; height: 130px; }
.ptt-ring-mid   { width: 110px; height: 110px; }

.ptt-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 1;
}

.ptt-mic   { font-size: 2.2rem; transition: all 0.2s ease; }
.ptt-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

/* Active (held or toggle on) */
.ptt-btn.active {
  background: var(--ptt-active) !important;
  transform: scale(0.95);
}
.ptt-btn.active .ptt-ring {
  border-color: var(--status-ok);
  opacity: 0.8;
  animation: ptt-pulse 0.9s infinite;
}
.ptt-btn.active .ptt-label { color: var(--status-ok); }

/* Toggle-locked mode */
.ptt-btn.toggled:not(.active) {
  background: var(--ptt-toggle) !important;
}
.ptt-btn.toggled .ptt-ring {
  border-color: var(--status-warn);
  opacity: 0.7;
  animation: ptt-pulse 1.6s infinite;
}
.ptt-btn.toggled .ptt-label { color: var(--status-warn); }

/* Hover */
.ptt-btn:hover:not(.active):not(.toggled) {
  background: rgba(124,58,237,0.3);
  transform: scale(1.03);
}

/* ── VOX Meter ───────────────────────────────────────────────────────────── */
.vox-meter {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
  padding: 2px;
}
.vox-bar {
  width: 5px;
  background: var(--text-3);
  border-radius: 3px;
  transition: height 0.08s ease, background 0.15s ease;
  height: 4px;
  animation: vox-idle calc(1s + var(--i) * 0.15s) infinite alternate;
}
.vox-meter.active .vox-bar {
  background: var(--status-ok);
  animation: none;
}

/* ── Bottom Nav ─────────────────────────────────────────────────────────── */
.bottom-nav {
  height: var(--bottom-nav-h);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-top: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition);
  min-width: 56px;
}
.nav-btn:hover  { background: var(--bg-hover); color: var(--text); }
.nav-btn.active { color: var(--status-err); }
.nav-icon       { font-size: 1.3rem; }
.nav-label      { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

/* Volume control */
.volume-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 160px;
}
.volume-ctrl .nav-icon { font-size: 1.1rem; }

/* ── Range Slider ────────────────────────────────────────────────────────── */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: var(--border-2);
  outline: none;
  cursor: pointer;
  transition: background var(--transition);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-grad);
  cursor: pointer;
  box-shadow: 0 2px 6px var(--accent-glow);
  transition: transform var(--transition);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 6px var(--accent-glow);
}

/* ── Settings Panel ──────────────────────────────────────────────────────── */
.settings-panel {
  position: absolute;
  bottom: var(--bottom-nav-h);
  left: 0; right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-2);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.25s ease;
  transform-origin: bottom center;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
}
.settings-panel.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.settings-inner {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 50vh;
  overflow-y: auto;
}

.settings-section h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
.setting-name {
  font-size: 0.9rem;
  color: var(--text);
  flex: 1;
}

/* Toggle switch */
.toggle-switch { position: relative; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  display: block;
  width: 46px; height: 26px;
  background: var(--bg-hover);
  border-radius: 26px;
  border: 1px solid var(--border-2);
  transition: background 0.25s ease;
  position: relative;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--text-2);
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), background 0.25s;
}
.toggle-switch input:checked ~ .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(20px);
  background: #fff;
}

/* VOX sub-settings */
.vox-sub { flex-direction: column; align-items: stretch; gap: 8px; }
.slider-group { display: flex; align-items: center; gap: 8px; }
.slider-val { font-size: 0.8rem; color: var(--text-2); min-width: 28px; text-align: right; }

/* Theme switcher */
.theme-switcher { display: flex; gap: 8px; }
.theme-pill {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.theme-pill.active {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px var(--accent-glow);
}
.theme-pill:not(.active):hover { background: var(--bg-hover); }

/* ── Toast Notifications ─────────────────────────────────────────────────── */
#toasts {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(360px, 92vw);
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
  width: 100%;
  text-align: center;
}
.toast.error   { background: #ef4444; color: #fff; }
.toast.info    { background: var(--accent); color: #fff; }
.toast.success { background: var(--status-ok); color: #fff; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════════
   Keyframe Animations
   ══════════════════════════════════════════════════════════════════════════ */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ptt-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.8; }
  50%       { transform: scale(1.12); opacity: 0.4; }
}
@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}
@keyframes vox-idle {
  0%   { height: 4px; }
  100% { height: 10px; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-6px); pointer-events: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Responsive / Tablet & Desktop upgrades
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 640px) {
  .ptt-btn { width: 150px; height: 150px; }
  .ptt-ring-outer { width: 150px; height: 150px; }
  .ptt-ring-mid   { width: 128px; height: 128px; }
  .ptt-mic { font-size: 2.8rem; }

  .sidebar {
    position: relative;
    transform: none;
    width: 260px;
    border-right: 1px solid var(--border-2);
    box-shadow: none;
    flex-shrink: 0;
  }
  .sidebar-overlay { display: none !important; }

  #screen-client { flex-direction: column; }
  .client-layout { display: flex; flex: 1; overflow: hidden; }

  .client-main { border-left: 1px solid var(--border); }
  .sidebar-toggle { display: none; }
}

@media (min-width: 900px) {
  .modal { border-radius: var(--radius-xl); }
  .modal-overlay { align-items: center; }
  .chat-panel { min-height: 120px; }
}

/* Safe area insets for notched phones */
.bottom-nav {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
}
