/* WaveTalk v2 — Luxury tactical glass UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@300;400;500;600;700&family=Poppins:wght@400;500;600&display=swap');

:root {
  --bg-void: #030308;
  --bg-deep: #07070f;
  --bg-midnight: #0c1224;
  --bg-violet: #12102a;
  --glass: rgba(12, 18, 36, 0.55);
  --glass-strong: rgba(18, 24, 48, 0.82);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.04);
  --text: #f0f4ff;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --cyan: #22d3ee;
  --cyan-glow: rgba(34, 211, 238, 0.45);
  --violet: #a78bfa;
  --violet-glow: rgba(167, 139, 250, 0.4);
  --emerald: #34d399;
  --emerald-glow: rgba(52, 211, 153, 0.35);
  --rose: #fb7185;
  --danger: #f87171;
  --emergency: #ef4444;
  --silver: #e2e8f0;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-full: 999px;
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-accent: "Poppins", system-ui, sans-serif;
  --sidebar-w: 280px;
  --dock-h: 88px;
  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-glow: 0 0 40px var(--cyan-glow);
}

[data-theme="light"] {
  --bg-void: #f0f4ff;
  --bg-deep: #e8eef8;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --text: #0f172a;
  --text-muted: #475569;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body.wt-body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-void);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Ambient background */
.wt-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.wt-bg__mesh {
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(34, 211, 238, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 40% at 80% 30%, rgba(167, 139, 250, 0.15), transparent 50%),
    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(6, 78, 120, 0.2), transparent 55%);
  animation: meshDrift 24s ease-in-out infinite alternate;
}

.wt-bg__waves {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  opacity: 0.15;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 48px,
    rgba(34, 211, 238, 0.03) 48px,
    rgba(34, 211, 238, 0.03) 49px
  );
  mask-image: linear-gradient(to top, black, transparent);
}

.wt-bg__particles span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0.4;
  animation: floatParticle 12s linear infinite;
}

@keyframes meshDrift {
  from { transform: translate(0, 0) rotate(0deg); }
  to { transform: translate(-3%, -2%) rotate(2deg); }
}

@keyframes floatParticle {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* Layout */
.wt-app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

@media (max-width: 900px) {
  .wt-app { grid-template-columns: 1fr; }
  .wt-sidebar { display: none; }
  .wt-sidebar.is-open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 200;
    width: min(100%, 320px);
  }
}

.wt-sidebar {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-right: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
}

.wt-main {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(var(--dock-h) + 16px);
}

.wt-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.wt-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--silver), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.wt-glass-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 var(--glass-highlight);
}

/* Channels */
.wt-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s var(--ease);
  margin-bottom: 4px;
}

.wt-channel:hover, .wt-channel.is-active {
  background: rgba(34, 211, 238, 0.08);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.15);
}

.wt-channel__avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--bg-violet), var(--bg-midnight));
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cyan);
  flex-shrink: 0;
}

.wt-channel.is-emergency .wt-channel__avatar {
  background: linear-gradient(135deg, #7f1d1d, #450a0a);
  color: var(--emergency);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.wt-channel__live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald-glow);
  margin-left: auto;
  animation: pulseLive 1.5s ease infinite;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* Messages */
.wt-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wt-msg-group { display: flex; gap: 10px; max-width: 85%; }
.wt-msg-group.mine { margin-left: auto; flex-direction: row-reverse; }

.wt-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--glass-border);
}

.wt-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.mine .wt-msg-bubble {
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(167, 139, 250, 0.12));
  border-color: rgba(34, 211, 238, 0.2);
}

/* Image messages — medium thumbnail */
.wt-msg-bubble:has(.wt-msg-thumb) {
  padding: 6px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.mine .wt-msg-bubble:has(.wt-msg-thumb) {
  background: transparent;
  border: none;
}

.wt-msg-thumb {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 14px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--glass-border);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.wt-msg-thumb:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(34, 211, 238, 0.2);
  border-color: rgba(34, 211, 238, 0.35);
}

.wt-msg-thumb img {
  display: block;
  max-width: min(280px, 72vw);
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: cover;
}

/* Voice note messages (Voxer-style) */
.wt-msg-bubble:has(.wt-audio-msg) {
  padding: 8px 12px;
  min-width: 200px;
  max-width: min(320px, 88vw);
}

.mine .wt-msg-bubble:has(.wt-audio-msg) {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(34, 211, 238, 0.2));
  border-color: rgba(59, 130, 246, 0.35);
}

.wt-msg-group:not(.mine) .wt-msg-bubble:has(.wt-audio-msg) {
  background: rgba(30, 41, 59, 0.85);
}

.wt-audio-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.wt-audio-msg__play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  flex-shrink: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s var(--ease);
}

.wt-audio-msg__play:active {
  transform: scale(0.94);
}

.wt-audio-msg__icon {
  width: 0;
  height: 0;
  border-style: solid;
}

.wt-audio-msg__icon--play {
  margin-left: 3px;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent currentColor;
}

.wt-audio-msg__icon--pause {
  display: none;
  width: 10px;
  height: 12px;
  border: none;
  box-shadow: inset 3px 0 0 currentColor, inset -3px 0 0 currentColor;
}

.wt-audio-msg.is-playing .wt-audio-msg__icon--play {
  display: none;
}

.wt-audio-msg.is-playing .wt-audio-msg__icon--pause {
  display: block;
}

.wt-audio-msg__time {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 2.4rem;
  flex-shrink: 0;
}

.wt-audio-msg__track {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
  min-width: 48px;
}

.wt-audio-msg__progress {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width 0.08s linear;
}

.wt-audio-msg__el {
  display: none;
}

.wt-composer.is-recording {
  border-color: var(--rose);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.25);
}

#wt-voice-msg-btn.is-active {
  color: var(--rose);
  background: rgba(248, 113, 113, 0.15);
  animation: pulseLive 0.8s ease-in-out infinite;
}

/* Full-screen image lightbox */
.wt-lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}

.wt-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wt-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 8, 0.92);
  backdrop-filter: blur(12px);
}

.wt-lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 48px;
  height: 48px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-strong);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.2s, border-color 0.2s;
}

.wt-lightbox__close:hover {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.4);
}

.wt-lightbox__frame {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1200px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wt-lightbox__frame img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
}

.wt-msg-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Composer */
.wt-composer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--glass-border);
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
}

.wt-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 12px 18px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.wt-input:focus {
  border-color: rgba(34, 211, 238, 0.4);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

/* --------------------------------------------------------------------------
   Dropdowns / selects — dark glass theme app-wide
   -------------------------------------------------------------------------- */
.wt-body select,
.wt-body select.wt-input,
.wt-body select.input,
select.wt-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 42px 10px 16px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  background-color: var(--bg-midnight);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  color-scheme: dark;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s;
}

.wt-body select:hover,
.wt-body select.wt-input:hover,
.wt-body select.input:hover {
  border-color: rgba(34, 211, 238, 0.25);
  background-color: rgba(12, 18, 36, 0.95);
}

.wt-body select:focus,
.wt-body select.wt-input:focus,
.wt-body select.input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.wt-body select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Dropdown list items (best-effort cross-browser) */
.wt-body select option,
.wt-body select optgroup {
  background-color: var(--bg-deep);
  color: var(--text);
  padding: 10px 12px;
}

.wt-body select option:checked,
.wt-body select option:hover,
.wt-body select option:focus {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(167, 139, 250, 0.15));
  color: var(--text);
}

.wt-body select optgroup {
  font-weight: 600;
  color: var(--text-muted);
}

/* Date/time pickers — native calendar matches dark UI */
.wt-body input[type="date"],
.wt-body input[type="time"],
.wt-body input[type="datetime-local"],
.wt-body input[type="month"],
.wt-body input[type="week"] {
  color-scheme: dark;
  background-color: var(--bg-midnight);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text);
  min-height: 44px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9375rem;
}

.wt-body input[type="date"]::-webkit-calendar-picker-indicator,
.wt-body input[type="time"]::-webkit-calendar-picker-indicator,
.wt-body input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85) brightness(1.1);
  cursor: pointer;
  opacity: 0.85;
}

[data-theme="light"] .wt-body select,
[data-theme="light"] .wt-body select.wt-input,
[data-theme="light"] .wt-body select.input {
  color-scheme: light;
  background-color: #fff;
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

[data-theme="light"] .wt-body select option {
  background-color: #fff;
  color: var(--text);
}

/* Icon buttons */
.wt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
}

.wt-icon-btn:hover {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.15);
}

.wt-icon-btn--accent {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(167, 139, 250, 0.2));
  color: var(--cyan);
}

.wt-icon-btn--danger {
  color: var(--emergency);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Text buttons (Save, Cancel, Create — not fixed 44px square) */
.wt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  width: auto;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  box-sizing: border-box;
}

.wt-btn:hover {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.35);
}

.wt-btn--accent {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(167, 139, 250, 0.2));
  color: var(--cyan);
}

.wt-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
}

.wt-alert {
  margin: 12px 20px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.wt-alert--error {
  background: rgba(127, 29, 29, 0.45);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

/* Walkie page — full-width stage, centered PTT */
.walkie-page .wt-app {
  grid-template-columns: 1fr;
}

.walkie-page .wt-sidebar {
  display: none;
}

.walkie-page .wt-sidebar.is-open {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 200;
  width: min(100%, 320px);
}

.walkie-page .wt-walkie-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 24px;
  gap: 24px;
}

.walkie-page #voice-room {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  text-align: center;
}

.walkie-page #voice-room .wt-ptt {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.walkie-page #voice-room p {
  width: 100%;
  text-align: center;
  margin-top: 16px;
}

.walkie-page #ptt-wave,
.walkie-page #live-speakers {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Walkie dock */
.wt-walkie-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg-void) 40%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.wt-ptt {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: var(--cyan);
  transition: transform 0.15s var(--ease), box-shadow 0.2s;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.walkie-page #voice-room,
.walkie-page #voice-room * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.wt-ptt::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--cyan), var(--violet)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.wt-ptt.is-active {
  transform: scale(1.06);
  box-shadow: var(--shadow-glow), 0 0 60px var(--violet-glow);
  color: #fff;
}

.wt-ptt.is-active::before { opacity: 1; animation: pttRing 1s ease infinite; }

@keyframes pttRing {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.7; }
}

.wt-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 32px;
}

.wt-waveform span {
  width: 4px;
  height: 8px;
  background: var(--cyan);
  border-radius: 2px;
  opacity: 0.35;
  transition: height 0.15s, opacity 0.15s;
}

.wt-waveform.is-live span {
  animation: waveBar 0.6s ease-in-out infinite;
}

.wt-waveform.is-live span:nth-child(2) { animation-delay: 0.1s; }
.wt-waveform.is-live span:nth-child(3) { animation-delay: 0.2s; }
.wt-waveform.is-live span:nth-child(4) { animation-delay: 0.15s; }
.wt-waveform.is-live span:nth-child(5) { animation-delay: 0.05s; }

@keyframes waveBar {
  0%, 100% { height: 8px; opacity: 0.4; }
  50% { height: 24px; opacity: 1; }
}

.wt-speakers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 40px;
}

.wt-speaker-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--glass);
  border: 1px solid rgba(52, 211, 153, 0.3);
  font-size: 0.8rem;
  animation: speakerGlow 1s ease infinite;
}

@keyframes speakerGlow {
  0%, 100% { box-shadow: 0 0 12px var(--emerald-glow); }
  50% { box-shadow: 0 0 24px var(--emerald-glow); }
}

/* Mobile bottom nav */
.wt-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--glass-strong);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  justify-content: space-around;
}

@media (max-width: 900px) {
  .wt-mobile-nav { display: flex; }
  .wt-main { padding-bottom: calc(var(--dock-h) + 72px); }
}

/* Auth */
.wt-auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.wt-auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
}

.wt-auth-card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  margin: 8px 0;
  letter-spacing: -0.03em;
}

.wt-overline {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
}

/* Admin */
.wt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 20px;
}

.wt-stat-card {
  padding: 20px;
  text-align: center;
}

.wt-stat-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--cyan);
}

.wt-stat-card span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Emergency mode */
body.emergency-mode .wt-topbar {
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.9), rgba(69, 10, 10, 0.85));
  animation: emergencyPulse 2s ease infinite;
}

@keyframes emergencyPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.8); }
}

/* Toasts */
.wt-toast-stack {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.wt-toast {
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  animation: toastIn 0.35s var(--ease);
  font-size: 0.875rem;
}

.wt-toast--emergency {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(127, 29, 29, 0.9);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

/* Tables */
.wt-table-wrap { overflow-x: auto; padding: 0 20px 20px; }
.wt-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.wt-table th, .wt-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}
.wt-table th { color: var(--text-dim); font-weight: 500; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; }

.wt-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.wt-status-dot--online { background: var(--emerald); box-shadow: 0 0 6px var(--emerald-glow); }
.wt-status-dot--speaking { background: var(--cyan); animation: pulseLive 1s infinite; }
.wt-status-dot--busy { background: #f59e0b; }
.wt-status-dot--offline { background: var(--text-dim); }

/* --------------------------------------------------------------------------
   Audio / video calls
   -------------------------------------------------------------------------- */
.wt-call-root {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 3, 8, 0.88);
  backdrop-filter: blur(16px);
}

.wt-call-root.is-reconnecting::before {
  content: "Reconnecting call…";
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.85rem;
  z-index: 2;
}

.wt-call-root[hidden] {
  display: none !important;
}

.wt-body.is-offline::before {
  content: "Offline mode: reconnecting automatically";
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5000;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(190, 24, 93, 0.18);
  color: #fecdd3;
  border: 1px solid rgba(251, 113, 133, 0.35);
  backdrop-filter: blur(12px);
}

body.in-call .wt-mobile-nav {
  display: none;
}

.wt-call-card {
  padding: 28px 32px;
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.wt-call-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 8px 0 0;
}

.wt-call-active {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 960px;
  height: min(90vh, 720px);
}

.wt-call-active[hidden] {
  display: none !important;
}

.wt-call-incoming[hidden] {
  display: none !important;
}

.wt-call-active__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 16px;
  font-family: var(--font-display);
  font-weight: 600;
}

.wt-call-active__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wt-call-health {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wt-call-quality,
.wt-call-network-label {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  font-family: var(--font-body);
}

.wt-call-quality {
  color: var(--emerald);
}

.wt-call-quality--excellent,
.wt-call-quality--good {
  color: var(--emerald);
}

.wt-call-quality--fair {
  color: #f59e0b;
}

.wt-call-quality--poor,
.wt-call-quality--critical {
  color: var(--rose);
}

.wt-call-network-label {
  color: var(--text-muted);
}

.wt-call-timer {
  font-size: 0.85rem;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

.wt-call-videos {
  flex: 1;
  position: relative;
  background: var(--bg-deep);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  min-height: 200px;
}

.wt-call-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.wt-call-video--local {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 120px;
  height: 90px;
  border-radius: 12px;
  border: 2px solid var(--glass-border);
  z-index: 2;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.wt-call-remotes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 8px;
  box-sizing: border-box;
}

.wt-call-remote-wrap {
  position: relative;
  min-height: 160px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-midnight);
}

.wt-call-remote-wrap .wt-call-video {
  position: absolute;
  inset: 0;
}

.wt-call-remote__label,
.wt-call-remote__state {
  position: absolute;
  left: 10px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(3, 3, 8, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  backdrop-filter: blur(12px);
}

.wt-call-remote__label {
  top: 10px;
  color: var(--text);
}

.wt-call-remote__state {
  bottom: 10px;
  color: var(--text-muted);
}

.wt-call-remote-wrap.is-audio-only .wt-call-video {
  object-fit: contain;
  opacity: 0.28;
}

.wt-call-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 20px 0 8px;
}

.wt-call-controls .wt-icon-btn.is-muted,
.wt-call-controls .wt-icon-btn.is-off {
  opacity: 0.5;
  border-color: var(--rose);
}

/* --------------------------------------------------------------------------
   Realtime debug / diagnostics
   -------------------------------------------------------------------------- */
.wt-debug-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 4200;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  background: rgba(3, 3, 8, 0.82);
  backdrop-filter: blur(14px);
  cursor: pointer;
}

.wt-debug-panel {
  position: fixed;
  right: 16px;
  bottom: 68px;
  width: min(420px, calc(100vw - 24px));
  max-height: min(70vh, 720px);
  z-index: 4200;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: rgba(3, 3, 8, 0.92);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.wt-debug-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.wt-debug-panel__body {
  overflow: auto;
  padding: 12px;
}

.wt-debug-section {
  margin-bottom: 12px;
}

.wt-debug-section h4 {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: var(--cyan);
}

.wt-debug-btn,
.wt-diagnostics__pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wt-debug-btn {
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.wt-debug-section pre {
  margin: 0;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.72rem;
}

.wt-diagnostics {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.wt-diagnostics__hero {
  padding: 20px 22px;
}

.wt-diagnostics__hero h1 {
  margin: 6px 0 10px;
  font-family: var(--font-display);
}

.wt-diagnostics__grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.wt-diagnostics__card {
  padding: 18px;
}

.wt-diagnostics__card h3 {
  margin: 0 0 14px;
}

.wt-diagnostics__videos {
  min-height: 180px;
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.wt-diagnostics__videos--dual {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.wt-diagnostics__pre {
  margin: 12px 0 0;
  padding: 12px;
  min-height: 110px;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.74rem;
}

.wt-diagnostics__pre--lg {
  min-height: 240px;
}

@media (max-width: 900px) {
  .wt-call-active__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .wt-debug-panel {
    right: 8px;
    left: 8px;
    width: auto;
  }

  .wt-debug-toggle {
    right: 8px;
    bottom: 76px;
  }

  .wt-diagnostics {
    padding: 16px;
  }
}

/* PWA install / update banners */
#wt-pwa-root {
  position: fixed;
  inset: auto 12px calc(12px + env(safe-area-inset-bottom, 0px)) 12px;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.wt-pwa-banner {
  pointer-events: auto;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 14px 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 24px var(--cyan-glow);
  transform: translateY(16px);
  opacity: 0;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.wt-pwa-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.wt-pwa-banner.is-hidden {
  opacity: 0;
  transform: translateY(12px);
}

.wt-pwa-banner__content {
  flex: 1;
  min-width: 0;
}

.wt-pwa-banner__title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 4px;
}

.wt-pwa-banner__body {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.wt-pwa-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wt-pwa-banner__primary {
  font-size: 0.78rem;
  padding: 8px 14px;
}

.wt-pwa-banner__later {
  font-size: 0.78rem;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.wt-pwa-banner__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 600px) {
  #wt-pwa-root {
    inset: auto 8px calc(72px + env(safe-area-inset-bottom, 0px)) 8px;
  }

  .wt-pwa-banner {
    max-width: none;
  }
}
