:root {
  --bg: #0e131f;
  --panel: #171d2b;
  --panel-2: #1e2536;
  --tile: #10151f;
  --ink: #e7ecf3;
  --muted: #9aa7bd;
  --line: #29324699;
  --accent: #4f9cf9;
  --accent-2: #5ee0c0;
  --danger: #ef4b5e;
  --on: #2a3346;
  --shadow: 0 10px 40px rgba(0,0,0,0.45);
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #eef2f9;
  --tile: #e2e8f0;
  --ink: #111827;
  --muted: #4b5563;
  --line: #cbd5e1;
  --accent: #2563eb;
  --accent-2: #059669;
  --danger: #dc2626;
  --on: rgba(37, 99, 235, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.theme-toggle-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.theme-toggle-btn:hover {
  border-color: var(--accent);
  background: var(--on);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--muted); }

/* ---------- view switching ---------- */
.view { display: none; height: 100vh; }
.view.active { display: flex; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand-name { font-weight: 800; letter-spacing: -0.01em; font-size: 20px; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent-2), var(--accent));
  box-shadow: 0 0 14px var(--accent);
}
.brand-dot.small { width: 10px; height: 10px; }
.brand-settings {
  margin-left: auto; background: transparent; border: none; color: var(--muted);
  font-size: 16px; padding: 4px 6px; border-radius: 8px; line-height: 1;
}
.brand-settings:hover { color: var(--ink); }

/* ---------- settings modal (Step 6) ---------- */
.modal-overlay {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(6,10,18,0.66); backdrop-filter: blur(3px); z-index: 50; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 16px;
}
.modal-body { padding: 18px; }
.modal-body textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; resize: vertical;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; outline: none;
}
.modal-body textarea:focus { border-color: var(--accent); }
.modal-body code { font-size: 11.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.field-group {
  margin-top: 8px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px;
  background: rgba(255,255,255,0.015);
}
.checkline { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; font-size: 13.5px; }
.checkline input { width: 16px; height: 16px; accent-color: var(--accent); }
.modal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-top: 1px solid var(--line);
}
.btn-primary.compact { width: auto; padding: 11px 22px; font-size: 14px; border-radius: 10px; }

/* ================= LOBBY ================= */
.lobby {
  flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; gap: 18px;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(79,156,249,0.16), transparent),
    radial-gradient(900px 500px at 100% 110%, rgba(94,224,192,0.12), transparent);
}
.lobby-card {
  width: 100%; max-width: 440px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px 30px 26px; box-shadow: var(--shadow);
}
.lobby-card h1 { font-size: 26px; margin: 0 0 6px; font-weight: 800; }
.lobby-card p { margin: 0 0 18px; font-size: 14px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,156,249,0.25); }
.field input[readonly] { cursor: default; background: var(--panel-2); opacity: 0.9; }
.input-with-action { position: relative; display: flex; align-items: center; width: 100%; }
.input-with-action input { width: 100%; padding-right: 76px; }
.icon-action-btn {
  position: absolute; top: 50%; transform: translateY(-50%); right: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--muted); font-size: 16px;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; z-index: 2;
  transition: color .15s, background .15s, transform .15s;
}
.icon-action-btn.second { right: 40px; }
.icon-action-btn:hover { color: var(--ink); background: rgba(255,255,255,0.06); }
.icon-action-btn:active { transform: translateY(-50%) scale(0.92); }
.icon-action-btn.spin { transform: translateY(-50%) rotate(360deg); transition: transform 0.35s ease-in-out; }

.share-bar { margin: 10px 0 16px; }
.btn-share {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 1px dashed var(--accent); background: rgba(79, 156, 249, 0.08);
  color: var(--accent); font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.btn-share:hover { background: rgba(79, 156, 249, 0.16); border-color: var(--accent-2); color: var(--ink); }
.btn-share:active { transform: scale(0.98); }

/* Page 1: Pre-Join Card Layout on Desktop (Video Preview on Left, Mic & Camera Stacked Vertically on Right) */
.prejoin-grid {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  margin: 12px 0 18px;
}

.prejoin-preview {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--tile);
  border: 1px solid var(--line);
}

.prejoin-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; background: var(--tile);
}
.prejoin-preview.off .preview-off { display: flex; }
.prejoin-preview.off video { visibility: hidden; }

.prejoin-controls {
  width: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
}

.prejoin-controls .ctrl-group {
  width: 100%;
  display: flex;
  position: relative;
  align-items: stretch;
}

.prejoin-controls .toggle {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 10px;
  border-radius: 10px 0 0 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  justify-content: center;
  align-items: center;
  display: flex;
}

.prejoin-controls .btn-arrow-select {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  height: 44px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 10px 10px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  transition: background .15s, color .15s;
}

.ctrl-group .btn-arrow-select:hover {
  background: var(--on);
  color: var(--ink);
}

/* Page 2: In-Meeting Control Bar */
.bar .ctrl-group {
  flex: 1 1 0;
  min-width: 0;
  max-width: 140px;
  margin: 0 3px;
  display: flex;
  position: relative;
}

.bar .ctrl-group .btn-ctrl {
  flex: 1;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  justify-content: center;
}

.bar .ctrl-group .btn-arrow-select {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  height: 42px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 10px 10px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.bar .ctrl-group.single .btn-ctrl {
  border-radius: 10px !important;
}
.toggle span { font-weight: 600; }
.toggle.on { border-color: var(--accent); }
.toggle:not(.on) { opacity: 0.55; }

.btn-primary {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #6f7cf9); color: #fff;
  font-size: 16px; font-weight: 700; transition: transform .1s, filter .15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost-full {
  width: 100%; margin-top: 10px; padding: 11px; border-radius: 12px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  font-size: 14px; font-weight: 600; transition: color .15s, border-color .15s;
}
.btn-ghost-full:hover { color: var(--ink); border-color: var(--accent); }
.status { min-height: 18px; margin: 12px 0 0; font-size: 13px; color: var(--accent-2); text-align: center; }
.status.error { color: var(--danger); }
.footer-note { color: var(--muted); font-size: 12.5px; opacity: 0.75; }

/* ================= ROOM ================= */
.room { flex-direction: column; }
.room-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.room-info { display: flex; align-items: center; gap: 12px; }
.room-title {
  font-weight: 700;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.room-timer {
  font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px;
  background: var(--panel-2); padding: 3px 10px; border-radius: 999px;
}
.room-actions { display: flex; align-items: center; gap: 12px; }
.count-pill {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 700; color: var(--accent-2);
}
.online-pill {
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); white-space: nowrap;
}
.online-pill.online { color: var(--accent-2); border-color: var(--accent-2); }
.online-pill.offline { color: var(--danger); border-color: var(--danger); }

.stage { flex: 1; display: flex; min-height: 0; position: relative; }

/* video grid */
.grid {
  flex: 1; display: grid; gap: 12px; padding: 16px; align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  transition: padding .2s;
}
.grid.cols-1 { grid-template-columns: minmax(0, 900px); justify-content: center; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.tile {
  position: relative; background: var(--tile); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 10; min-height: 0;
}
.tile.speaking { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2); }
.tile.connecting { border-color: var(--accent); }
.tile.failed { border-color: var(--danger); }
.conn-status {
  position: absolute; right: 10px; top: 10px;
  background: rgba(0,0,0,0.55); color: var(--muted);
  padding: 3px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.tile.failed .conn-status { color: var(--danger); }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile.self video { transform: scaleX(-1); }
.tile .avatar {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; color: #fff; letter-spacing: 0.02em;
}
.tile.cam-off video { visibility: hidden; }
.tile:not(.cam-off) .avatar { display: none; }
.tile .name {
  position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.55); padding: 4px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.tile .mic-off { color: var(--danger); }

/* chat panel */
.chat-panel {
  width: 320px; border-left: 1px solid var(--line); background: var(--panel);
  display: none; flex-direction: column;
}
.chat-panel.open { display: flex; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px;
}
.chat-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { font-size: 13.5px; }
.msg .who { font-weight: 700; color: var(--accent); margin-right: 6px; }
.msg.self .who { color: var(--accent-2); }
.msg .time { color: var(--muted); font-size: 11px; margin-left: 6px; }
.chat-empty { color: var(--muted); font-size: 13px; text-align: center; margin: auto 0; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); outline: none; font-size: 14px;
}
.chat-input input:focus { border-color: var(--accent); }
.icon-btn { background: transparent; border: none; color: var(--muted); font-size: 15px; padding: 6px; border-radius: 8px; }
.icon-btn:hover { color: var(--ink); }
.icon-btn.send { color: var(--accent); font-size: 16px; }

/* Footer Control Bar */
.bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  flex-wrap: nowrap;
}

.ctrl-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ctrl-group .btn-ctrl,
.ctrl-group .toggle {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.btn-arrow-select-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}

.btn-arrow-select-inline:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
}

/* Device Selection Popup Menu */
.device-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  min-width: 240px;
  max-width: 320px;
  background: rgba(20, 26, 40, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.device-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  transition: background .15s;
}

.device-menu-item:hover {
  background: rgba(79, 156, 249, 0.15);
  color: var(--accent-2);
}

.device-menu-item.active {
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(46, 204, 113, 0.15);
}

.device-menu-item .check {
  font-size: 12px;
  width: 14px;
}

.btn-ctrl {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}

.btn-ctrl .ico {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-ctrl .label {
  font-size: 13.5px;
  font-weight: 600;
}

.btn-ctrl:hover {
  border-color: var(--accent);
  background: var(--on);
}

.btn-ctrl.on {
  background: rgba(79, 156, 249, 0.15);
  border-color: var(--accent);
  color: var(--ink);
}

.btn-ctrl.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: rgba(46, 204, 113, 0.15);
}

.btn-ctrl.leave {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.btn-ctrl.leave:hover {
  filter: brightness(1.15);
}

/* Recording Button & Status Badge */
.btn-ctrl.record-btn {
  border-color: rgba(239, 75, 94, 0.4);
  color: var(--ink);
}

.btn-ctrl.record-btn:hover {
  border-color: var(--danger);
  background: rgba(239, 75, 94, 0.15);
}

.btn-ctrl.record-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  animation: pulseRed 1.8s infinite;
}

@keyframes pulseRed {
  0% { box-shadow: 0 0 0 0 rgba(239, 75, 94, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 75, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 75, 94, 0); }
}

.rec-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(239, 75, 94, 0.15);
  border: 1px solid var(--danger);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-left: 6px;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: blinkRec 1s infinite alternate;
}

@keyframes blinkRec {
  from { opacity: 1; }
  to { opacity: 0.2; }
}

/* unread-chat badge (Step 5) */
.chat-badge {
  position: absolute; top: 4px; right: 8px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center;
}

/* Floating Tile Grid Pagination */
.grid-pagination {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(16, 21, 31, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.grid-pagination .page-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.grid-pagination .page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--on);
}

.grid-pagination .page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.grid-pagination .page-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-2);
  min-width: 40px;
  text-align: center;
}

/* ---------- responsive / phone ---------- */
@media (max-width: 680px) {
  .lobby {
    justify-content: flex-start !important;
    align-items: center !important;
    padding: 12px 10px 24px 10px !important;
    overflow-y: auto !important;
    height: 100dvh !important;
    height: 100vh !important;
    max-height: 100dvh !important;
    box-sizing: border-box !important;
  }

  .lobby-card {
    padding: 16px 14px 18px 14px !important;
    border-radius: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .brand {
    margin-bottom: 10px !important;
  }

  .lobby-card h1 {
    font-size: 22px !important;
    margin-bottom: 4px !important;
  }

  .lobby-card p {
    margin-bottom: 12px !important;
  }

  .field {
    margin-bottom: 10px !important;
  }

  .room {
    height: 100dvh;
    height: 100vh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .stage {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
  }
  .room-bar {
    padding: 8px 10px;
    flex-shrink: 0;
  }
  .room-info {
    gap: 6px;
    max-width: 60%;
  }
  .room-title {
    max-width: 100px;
    font-size: 13px;
  }
  .online-pill {
    padding: 2px 7px;
    font-size: 10.5px;
  }

  /* Docked Bottom Control Bar on Mobile */
  .bar {
    padding: 8px 6px;
    gap: 4px;
    justify-content: space-between;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    flex-shrink: 0;
    overflow: visible !important;
    position: relative;
    z-index: 50;
  }

  /* Page 1 (Pre-Join Screen): Video Preview on top, Mic & Camera in single horizontal row below */
  .prejoin-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin: 10px 0 14px;
  }

  .prejoin-preview {
    width: 100%;
    height: 125px !important;
    max-height: 125px !important;
  }

  .prejoin-controls {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 8px;
    margin-top: 0;
    margin-bottom: 12px;
  }

  #joinBtn,
  .join-action {
    margin-top: 12px !important;
  }

  .prejoin-controls .ctrl-group {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    position: relative;
  }

  .prejoin-controls .toggle {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 8px;
    border-radius: 10px 0 0 10px !important;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    justify-content: center;
    align-items: center;
    display: flex;
  }

  .prejoin-controls .btn-arrow-select {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    height: 44px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-left: none;
    border-radius: 0 10px 10px 0 !important;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
  }

  /* Page 2 (In-Meeting Bar): Hide Dropdown Arrows on Mobile */
  .bar .btn-arrow-select {
    display: none !important;
  }
  .desktop-only-ctrl {
    display: none !important;
  }

  .bar .ctrl-group {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: unset !important;
    margin: 0 !important;
    display: flex !important;
    position: relative !important;
  }

  .bar .btn-ctrl {
    flex: 1 1 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 10px !important;
    justify-content: center !important;
    align-items: center !important;
  }
  .btn-ctrl .label {
    display: none;
  }
  .btn-ctrl .ico {
    font-size: 19px;
  }

  .device-menu {
    position: fixed;
    bottom: 60px;
    left: 12px;
    right: 12px;
    min-width: unset;
    max-width: unset;
    z-index: 9999;
    background: rgba(18, 24, 38, 0.98);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  }

  .grid {
    padding: 8px;
    gap: 8px;
    grid-template-columns: repeat(2, 1fr) !important;
    align-content: start;
    overflow-y: auto;
  }
  .grid.cols-1 {
    grid-template-columns: 1fr !important;
  }
  .tile {
    aspect-ratio: 16 / 11;
  }
  .chat-panel {
    position: absolute;
    inset: 0;
    width: 100%;
    border-left: none;
    z-index: 5;
  }
  .prejoin { flex-direction: column; align-items: stretch; }
  .prejoin-preview { width: 100%; height: 150px; }
}

/* Dedicated Fullscreen Screen Share Spotlight View */
.screenshare-container {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: #0b0f19;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  transition: all 0.2s ease;
}

/* Fallback & Browser Fullscreen override */
.screenshare-container.is-fullscreen,
.screenshare-container:fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
}

.screenshare-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(16, 21, 31, 0.95);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-2);
  z-index: 2;
}

.screenshare-fs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(79, 156, 249, 0.15);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.screenshare-fs-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.screenshare-fs-btn.active {
  background: rgba(239, 75, 94, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}
.screenshare-fs-btn.active:hover {
  background: var(--danger);
  color: #ffffff;
}

.screenshare-view {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
  overflow: hidden;
}

.screenshare-view video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
}

/* Floating Exit Fullscreen Button */
.floating-exit-fs-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(79, 156, 249, 0.5);
  background: rgba(16, 21, 31, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  transition: all 0.2s ease;
  animation: fadeIn 0.25s ease;
}

.floating-exit-fs-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  transform: translateY(-1px);
}

.floating-exit-fs-btn kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-family: monospace;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}

/* Mobile Landscape Screen Rotation Support */
@media (max-height: 540px) and (orientation: landscape) {
  .room-bar {
    padding: 4px 12px !important;
  }
  .room-title {
    font-size: 12px !important;
    max-width: 140px !important;
  }
  .online-pill, .room-timer {
    font-size: 10.5px !important;
    padding: 2px 6px !important;
  }
  .bar {
    padding: 4px 6px !important;
  }
  .btn-ctrl {
    height: 36px !important;
  }
  .btn-ctrl .ico {
    font-size: 17px !important;
  }
  .grid {
    padding: 6px !important;
    gap: 6px !important;
  }
  .tile {
    aspect-ratio: 16 / 9 !important;
  }
}

/* ================= AUTHENTICATION UI (Step 1) ================= */
.auth-account-btn {
  margin-left: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color .15s, background .15s;
}
.auth-account-btn:hover {
  border-color: var(--accent);
  background: var(--on);
}

.auth-modal {
  max-width: 440px;
  width: 90%;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--panel-2);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.auth-tab-btn {
  flex: 1;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-tab-btn:hover {
  color: var(--ink);
}
.auth-tab-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 156, 249, 0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form .field {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.auth-form .field span {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.auth-form .field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}

.auth-form .field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,156,249,0.25);
}

.auth-form button[type="submit"] {
  margin-top: 8px;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #6f7cf9);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}

.auth-form button[type="submit"]:hover {
  filter: brightness(1.1);
}

.auth-form button[type="submit"]:active {
  transform: scale(0.99);
}

.user-card-badge {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 16px;
}
.avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(79, 156, 249, 0.3);
}
.user-card-badge h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: #fff; }
.user-card-badge p { margin: 0; font-size: 13px; color: var(--muted); }
.activated-tag { color: var(--accent-2); font-size: 12px; font-weight: 700; margin-top: 6px !important; }

.btn-secondary {
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary.danger-btn { border-color: rgba(239, 75, 94, 0.4); color: var(--danger); }
.btn-secondary.danger-btn:hover { background: var(--danger); color: #fff; }

.auth-notice {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(79, 156, 249, 0.12);
  border: 1px solid var(--accent);
  color: var(--ink);
}
.auth-notice a { color: var(--accent-2); font-weight: bold; word-break: break-all; }

/* ================= PERSONALIZED ROOM NAMES UI (Step 2) ================= */
.personalized-room-box {
  margin-bottom: 14px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px dashed var(--accent);
  border-radius: 12px;
}
.field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}
.availability-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}
.availability-badge.available {
  background: rgba(94, 224, 192, 0.2);
  color: var(--accent-2);
}
.availability-badge.taken {
  background: rgba(239, 75, 94, 0.2);
  color: var(--danger);
}
.btn-save-slug {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}
.btn-save-slug:hover { filter: brightness(1.1); }
.field-subnote {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}
.field-subnote.error { color: var(--danger); }
.field-subnote.success { color: var(--accent-2); }

.btn-link-sm {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-link-sm:hover {
  color: var(--accent-2);
}

/* ================= ADMISSION TOAST & WAITING ROOM ================= */
.admission-toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-icon { font-size: 22px; }
.toast-text {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
.toast-text strong { color: #fff; font-weight: 700; }
.toast-text span { color: var(--muted); font-size: 12px; }

.toast-actions {
  display: flex;
  gap: 8px;
}
.btn-toast {
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-toast.admit { background: var(--accent-2); color: #000; }
.btn-toast.admit:hover { filter: brightness(1.1); }
.btn-toast.decline { background: rgba(239, 75, 94, 0.2); color: var(--danger); border: 1px solid rgba(239, 75, 94, 0.4); }
.btn-toast.decline:hover { background: var(--danger); color: #fff; }

.pending-dot {
  position: absolute;
  top: 4px;
  right: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Participants Drawer Body */
.participants-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pending-admission-box {
  background: rgba(239, 75, 94, 0.08);
  border: 1px dashed var(--danger);
  border-radius: 12px;
  padding: 12px;
}
.pending-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.pending-item:last-child { border-bottom: none; }
.pending-item-name { font-size: 13px; font-weight: 600; color: #fff; }
.active-peers-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.peer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--panel-2);
  border-radius: 10px;
  margin-top: 6px;
}
.peer-item-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.peer-item-badge { font-size: 11px; background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 700; margin-left: 6px; }

/* Waiting Room Section View */
.waiting-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.waiting-card {
  background: var(--panel-1);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  max-width: 460px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
}
.waiting-spinner {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 1.5s infinite alternate;
}
@keyframes pulse {
  from { transform: scale(0.95); opacity: 0.8; }
  to { transform: scale(1.08); opacity: 1; }
}
.waiting-card h2 { margin: 0 0 0.5rem; font-size: 22px; color: #fff; font-weight: 800; }

/* ---------- Bottom Control Bar & Buttons ---------- */
.bar, .controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  z-index: 10;
}

.btn-ctrl, .ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ctrl:hover, .ctrl:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.btn-ctrl.on, .ctrl.on {
  background: var(--on);
  border-color: rgba(79, 156, 249, 0.3);
}

.btn-ctrl.active, .ctrl.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-ctrl.leave, .ctrl.danger {
  background: rgba(239, 75, 94, 0.15);
  color: var(--danger);
  border-color: rgba(239, 75, 94, 0.3);
}

.btn-ctrl.leave:hover, .ctrl.danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-ctrl .ico, .ctrl .ico {
  font-size: 16px;
}
.btn-ctrl .label, .btn-ctrl .lbl, .ctrl .lbl {
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- Room Choice Radio Selector ---------- */
.room-choice-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 12px;
}
.room-choice-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.2s ease;
}
.room-choice-option:hover {
  background: rgba(255, 255, 255, 0.05);
}
.room-choice-option.active {
  background: rgba(79, 156, 249, 0.12);
  border-color: var(--accent);
}
.room-choice-option input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.choice-text {
  display: flex;
  flex-direction: column;
}
.choice-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.choice-subtitle {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Admission Toast Banner ---------- */
.admission-toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 360px;
  padding: 12px 18px;
  background: rgba(23, 29, 43, 0.95);
  border: 1px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  animation: slideDownToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDownToast {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-icon {
  font-size: 20px;
}
.toast-text {
  display: flex;
  flex-direction: column;
  font-size: 13.5px;
}
.toast-text strong {
  color: var(--ink);
  font-weight: 700;
}
.toast-text span {
  color: var(--muted);
  font-size: 12px;
}
.toast-actions {
  display: flex;
  gap: 8px;
}
.btn-toast {
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-toast.admit {
  background: var(--accent);
  color: #ffffff;
}
.btn-toast.admit:hover {
  background: #3b82f6;
}
.btn-toast.decline {
  background: rgba(239, 75, 94, 0.2);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-toast.decline:hover {
  background: var(--danger);
  color: #ffffff;
}
.waiting-card p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0; }
.waiting-card p strong { color: var(--accent-2); }

/* Room Choice Selector UI */
.room-choice-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.room-choice-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.room-choice-option:hover {
  border-color: var(--accent);
}
.room-choice-option.active {
  border-color: var(--accent);
  background: rgba(79, 156, 249, 0.12);
}
.room-choice-option input[type="radio"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.choice-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.choice-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.choice-subtitle {
  font-size: 12px;
  color: var(--accent-2);
  font-family: monospace;
}
.btn-copy-link-inline {
  background: rgba(79, 156, 249, 0.15);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: auto;
  z-index: 2;
}
.btn-copy-link-inline:hover {
  background: var(--accent);
  color: #fff;
}

/* ================= 1-ON-1 DIRECT CHAT STYLES ================= */
.direct-chat-btn {
  position: relative;
  background: rgba(79, 156, 249, 0.15);
  border: 1px solid var(--accent);
}
.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
  display: inline-block;
}

.direct-chat-modal {
  max-width: 840px;
  width: 95%;
  height: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.direct-chat-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.direct-chat-sidebar {
  width: 280px;
  border-right: 1px solid var(--line);
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
}

.contact-search-box {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.contact-search-box input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  box-sizing: border-box;
}

.sidebar-section-label {
  padding: 10px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contacts-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.contact-card:hover {
  background: rgba(255, 255, 255, 0.05);
}
.contact-card.active {
  background: rgba(79, 156, 249, 0.15);
  border: 1px solid rgba(79, 156, 249, 0.3);
}

.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #6f7cf9);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--panel-2);
}
.status-indicator.online { background: #10b981; }
.status-indicator.offline { background: #6b7280; }

.contact-info {
  flex: 1;
  min-width: 0;
}
.contact-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.contact-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-time {
  font-size: 10.5px;
  color: var(--muted);
}
.contact-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.unread-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

.direct-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel);
}

.no-contact-selected {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.chat-placeholder-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}
.no-contact-selected h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--ink);
}
.no-contact-selected p {
  max-width: 320px;
  font-size: 13px;
  margin: 0;
}

.contact-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.btn-icon-back {
  display: none;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
}

.contact-header-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.contact-header-status {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: #10b981; }
.status-dot.offline { background: #6b7280; }

.direct-chat-log-box {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.direct-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
  position: relative;
}
.direct-msg-bubble.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #4a75f5);
  color: #ffffff;
  border-bottom-right-radius: 3px;
}
.direct-msg-bubble.peer {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 3px;
}

.direct-msg-meta {
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.75;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.direct-chat-input-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.direct-chat-input-form input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
}
.direct-chat-input-form input:focus {
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .direct-chat-sidebar {
    width: 100%;
  }
  .direct-chat-main {
    display: none;
  }
  .direct-chat-layout.chat-active .direct-chat-sidebar {
    display: none;
  }
  .direct-chat-layout.chat-active .direct-chat-main {
    display: flex;
  }
  .btn-icon-back {
    display: block;
  }
}
