/* ==========================================================================
   वार्तालाप · Vartalap — styles
   ========================================================================== */

:root {
  --ink: #14162b;
  --ink-soft: #3b3f5c;
  --muted: #737a9b;
  --line: #e7e9f4;
  --line-soft: #f0f2f9;
  --bg: #f5f6fc;
  --card: #ffffff;
  --brand: #312e81;
  --brand-2: #6d28d9;
  --brand-soft: #eef0ff;
  --saffron: #f59e0b;
  --ok: #10b981;
  --danger: #e11d48;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 43, .06), 0 4px 14px rgba(20, 22, 43, .05);
  --shadow-md: 0 10px 34px rgba(20, 22, 43, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari",
          "Nirmala UI", "Mangal", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { overflow: hidden; }

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

.ic {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

/* ------------------------------------------------------------- boot screen */
.boot {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: linear-gradient(160deg, #211d5c 0%, #312e81 45%, #4c1d95 100%);
}
.boot-mark {
  font-size: 38px; font-weight: 700; color: #fff; letter-spacing: .02em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .35);
}
.boot-spinner, .spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .25);
  border-top-color: var(--saffron);
  animation: spin .8s linear infinite;
}
.spinner.sm { width: 15px; height: 15px; border-width: 2px; border-color: rgba(49, 46, 129, .2); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------- auth */
.auth {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 22px; overflow-y: auto;
  background: linear-gradient(160deg, #211d5c 0%, #312e81 42%, #4c1d95 100%);
}
.auth-bg {
  position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(245, 158, 11, .30), transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(99, 102, 241, .42), transparent 46%);
}
.auth-card {
  position: relative;
  width: 100%; max-width: 410px;
  background: var(--card);
  border-radius: 24px;
  padding: 32px 28px 24px;
  box-shadow: 0 30px 70px rgba(9, 8, 40, .45);
  margin: auto;
}

.brand { text-align: center; margin-bottom: 24px; }
.brand-hi {
  margin: 0; font-size: 34px; font-weight: 700; letter-spacing: .01em;
  background: linear-gradient(120deg, #312e81, #6d28d9 55%, #b45309);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-en {
  font-size: 11px; font-weight: 700; letter-spacing: .38em;
  color: var(--muted); margin-top: 6px; text-indent: .38em;
}
.brand-tag {
  margin: 12px 0 0; font-size: 12.5px; color: var(--muted); letter-spacing: .04em;
}

.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--line-soft); border-radius: 12px; margin-bottom: 20px;
}
.tabs button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 9px 0; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  transition: background .18s, color .18s, box-shadow .18s;
}
.tabs button.active {
  background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm);
}

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft);
  margin-bottom: 6px; letter-spacing: .02em;
}
.field input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fbfbff; outline: none; transition: border-color .16s, box-shadow .16s;
}
.field input:focus {
  border-color: #a5a2e0; background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}
.phone-wrap { display: flex; align-items: stretch; }
.phone-wrap .prefix {
  display: flex; align-items: center; padding: 0 12px;
  border: 1.5px solid var(--line); border-right: 0;
  border-radius: 12px 0 0 12px; background: var(--line-soft);
  font-size: 14px; color: var(--ink-soft); font-weight: 600;
}
.phone-wrap input { border-radius: 0 12px 12px 0; letter-spacing: .06em; }
.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--brand-2);
  font-size: 12px; font-weight: 700; padding: 8px; border-radius: 8px;
}
.pw-toggle:hover { background: var(--brand-soft); }

.error {
  margin: 0 0 12px; padding: 10px 12px;
  background: #fff1f4; color: #9f1239; border-radius: 10px;
  font-size: 13px; border: 1px solid #fecdd3;
}
.fineprint {
  margin: 16px 0 0; text-align: center; font-size: 11.5px; color: var(--muted);
  line-height: 1.6;
}

/* ----------------------------------------------------------------- buttons */
.btn {
  border: 0; border-radius: 12px; padding: 11px 18px;
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s, filter .16s, background .16s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, #4f46e5, #6d28d9);
  color: #fff; box-shadow: 0 8px 20px rgba(79, 70, 229, .28);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.wide { width: 100%; padding: 13px; }
.btn.ghost { background: var(--line-soft); color: var(--ink-soft); }
.btn.ghost:hover { background: #e8eaf5; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.success { background: var(--ok); color: #fff; }
.btn.tiny { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink-soft);
  transition: background .16s, color .16s;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }

/* -------------------------------------------------------------------- app */
.app {
  display: grid;
  grid-template-columns: 352px 1fr;
  height: 100dvh; height: 100vh;
  max-width: 1500px; margin: 0 auto;
  background: var(--card);
  box-shadow: 0 0 60px rgba(20, 22, 43, .07);
}

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line);
  background: #fbfbfe;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px 10px 18px;
}
.brand-mini { display: flex; flex-direction: column; line-height: 1.15; }
.brand-mini .hi { font-size: 19px; font-weight: 700; color: var(--brand); letter-spacing: .01em; }
.brand-mini .en {
  font-size: 9px; font-weight: 700; letter-spacing: .32em;
  color: var(--muted); text-indent: .32em; margin-top: 2px;
}

.search { padding: 4px 14px 12px; }
.search input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid transparent; border-radius: 12px;
  background: var(--line-soft); outline: none; font-size: 13.5px;
  transition: border-color .16s, background .16s;
}
.search input:focus { background: #fff; border-color: #c7c5ee; }

.user-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.user-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 10px; border-radius: 14px; cursor: pointer;
  transition: background .14s;
  position: relative;
}
.user-row:hover { background: #f1f2fa; }
.user-row.active { background: var(--brand-soft); }
.user-row.active::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 3px; background: var(--brand-2);
}
.user-row .info { flex: 1; min-width: 0; }
.user-row .info .nm {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.user-row .info .nm span.t {
  margin-left: auto; font-size: 10.5px; font-weight: 500; color: var(--muted);
}
.user-row .info .pv {
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.badge-unread {
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--brand-2); color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.tag-admin {
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  background: #fef3c7; color: #92400e; padding: 1px 5px; border-radius: 5px;
}

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  position: relative;
  text-transform: uppercase;
  user-select: none;
}
.avatar.xl { width: 96px; height: 96px; font-size: 34px; }
.avatar .dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ok); border: 2.5px solid #fff;
}

.side-foot {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; border-top: 1px solid var(--line);
  background: #fff;
}
.me-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.me-meta strong { font-size: 13.5px; }
.me-meta span { font-size: 11.5px; color: var(--muted); }

.list-empty {
  padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px;
}

/* ------------------------------------------------------------------- chat */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

.empty-chat {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; padding: 30px; text-align: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(99, 102, 241, .07), transparent 55%),
    var(--card);
}
.empty-art {
  width: 84px; height: 84px; border-radius: 26px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #312e81, #6d28d9);
  box-shadow: 0 16px 34px rgba(49, 46, 129, .28);
}
.empty-chat h2 { margin: 6px 0 0; font-size: 19px; }
.empty-chat p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 330px; }

.chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
}
.chat-head .back { display: none; }
.peer { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.peer strong { font-size: 15px; }
.peer span { font-size: 11.5px; color: var(--muted); }
.peer span.online { color: var(--ok); }
.call-actions { display: flex; gap: 2px; }

.messages {
  flex: 1; overflow-y: auto; padding: 20px 20px 8px;
  display: flex; flex-direction: column; gap: 3px;
  background:
    radial-gradient(circle at 18px 18px, rgba(99, 102, 241, .055) 1.4px, transparent 1.5px) 0 0/36px 36px,
    linear-gradient(180deg, #fbfbff, #f7f8fd);
  scroll-behavior: smooth;
}

.day-sep {
  align-self: center; margin: 14px 0 10px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: rgba(255, 255, 255, .9); padding: 4px 12px; border-radius: 20px;
  border: 1px solid var(--line);
}

.msg {
  display: flex; max-width: min(72%, 560px);
  margin: 2px 0; position: relative;
  animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.theirs { align-self: flex-start; }

.bubble {
  padding: 9px 13px 7px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.45;
  word-break: break-word; white-space: pre-wrap;
  position: relative;
}
.msg.theirs .bubble {
  background: #fff; border: 1px solid var(--line);
  border-bottom-left-radius: 5px; color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 22, 43, .04);
}
.msg.mine .bubble {
  background: linear-gradient(135deg, #4f46e5, #6d28d9);
  color: #fff; border-bottom-right-radius: 5px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .22);
}
.bubble .stamp {
  display: block; font-size: 10px; margin-top: 3px; opacity: .62; text-align: right;
  letter-spacing: .02em;
}
.bubble.deleted { font-style: italic; opacity: .6; }
.bubble.deleted::before { content: "🚫 "; }

.bubble.img { padding: 5px; }
.bubble.img img {
  display: block; max-width: 280px; width: 100%; height: auto;
  border-radius: 12px; cursor: zoom-in; background: #eef0f7;
}
.bubble.img .stamp { padding: 2px 6px 1px; }

.msg .report-btn {
  opacity: 0; align-self: center; margin: 0 6px;
  width: 26px; height: 26px; border: 0; border-radius: 8px;
  background: #fff; color: var(--muted); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s, color .15s;
}
.msg:hover .report-btn { opacity: 1; }
.msg .report-btn:hover { color: var(--danger); }
.msg .report-btn .ic { width: 14px; height: 14px; }

.typing-row {
  padding: 0 20px 4px; font-size: 12px; color: var(--muted); height: 18px;
}

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px 16px; border-top: 1px solid var(--line); background: #fff;
}
.composer .attach { cursor: pointer; }
.composer textarea {
  flex: 1; resize: none; max-height: 132px;
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fbfbff; outline: none; font-size: 14.5px; line-height: 1.45;
  transition: border-color .16s, background .16s;
}
.composer textarea:focus { background: #fff; border-color: #c7c5ee; }
.btn.send {
  width: 46px; height: 46px; padding: 0; border-radius: 14px;
  background: linear-gradient(135deg, #4f46e5, #6d28d9); color: #fff;
  box-shadow: 0 8px 18px rgba(79, 70, 229, .26);
}
.btn.send .ic { width: 19px; height: 19px; }

.upload-status {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px; font-size: 12.5px; color: var(--muted);
  background: #fff; border-top: 1px solid var(--line-soft);
}

/* ------------------------------------------------------------------ admin */
.admin {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; background: var(--bg);
}
.admin-head {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.admin-brand { display: flex; align-items: center; gap: 9px; }
.admin-brand .hi { font-size: 19px; font-weight: 700; color: var(--brand); }
.admin-badge {
  font-size: 9px; font-weight: 800; letter-spacing: .14em;
  background: #fef3c7; color: #92400e; padding: 3px 7px; border-radius: 6px;
}
.admin-tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.admin-tabs button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.admin-tabs button.active { background: var(--brand-soft); color: var(--brand); }
.admin-body { flex: 1; overflow-y: auto; padding: 24px; }
.admin-wrap { max-width: 1080px; margin: 0 auto; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat {
  background: #fff; border-radius: var(--radius); padding: 18px 20px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.stat .n { font-size: 28px; font-weight: 700; color: var(--brand); line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 4px; letter-spacing: .02em; }

.panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 22px; box-shadow: var(--shadow-sm);
}
.panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 10px;
}
.panel-body { padding: 6px 0; }

.row-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; border-bottom: 1px solid var(--line-soft);
}
.row-item:last-child { border-bottom: 0; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .nm { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.row-item .sub { font-size: 12px; color: var(--muted); }
.row-item .actions { display: flex; gap: 6px; }
.pill {
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
  letter-spacing: .03em;
}
.pill.ok { background: #d1fae5; color: #065f46; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.bad { background: #ffe4e6; color: #9f1239; }
.pill.muted { background: var(--line-soft); color: var(--muted); }

.mono { font-variant-numeric: tabular-nums; }

.admin-chat { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; }
.admin-msg {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: #fcfcff; font-size: 13.5px;
}
.admin-msg .meta {
  font-size: 11px; color: var(--muted); margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.admin-msg .body { white-space: pre-wrap; word-break: break-word; }
.admin-msg img { max-width: 220px; border-radius: 10px; display: block; margin-top: 6px; }
.admin-msg.flagged { border-color: #fecdd3; background: #fff5f7; }
.admin-msg .btn.danger {
  background: #fff1f4; color: #9f1239; box-shadow: none; font-weight: 600;
}
.admin-msg .btn.danger:hover { background: #ffe4e6; }
.admin-msg .report-note {
  margin-top: 6px; font-size: 12px; color: #9f1239; background: #ffe4e6;
  padding: 5px 9px; border-radius: 8px; display: inline-block;
}
.admin-empty { padding: 34px; text-align: center; color: var(--muted); font-size: 13.5px; }

.conv-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.conv-pick select, .conv-pick input {
  padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 13px; outline: none;
}

/* ------------------------------------------------------------------- call */
.call {
  position: fixed; inset: 0; z-index: 80;
  background: radial-gradient(circle at 50% 0%, #1e1b4b, #08080f 70%);
  display: flex; align-items: center; justify-content: center;
}
.call-stage { position: relative; width: 100%; height: 100%; overflow: hidden; }
.remote-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: #08080f;
}
.call-stage.audio-only .remote-video { display: none; }
.audio-stage {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: #fff;
}
.audio-stage h3 { margin: 8px 0 0; font-size: 22px; }
.audio-stage p { margin: 0; color: rgba(255, 255, 255, .6); font-size: 14px; }
.audio-stage .avatar { background: linear-gradient(135deg, #6366f1, #a855f7); }

.local-video {
  position: absolute; right: 18px; top: 18px;
  width: 148px; height: 200px; object-fit: cover;
  border-radius: 14px; background: #14142b;
  border: 1.5px solid rgba(255, 255, 255, .18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  transform: scaleX(-1);
  z-index: 3;
}
.local-video.screen { transform: none; object-fit: contain; width: 220px; height: 140px; background: #000; }
.local-video.hidden { display: none !important; }
[hidden] { display: none !important; }

.call-banner {
  position: absolute; top: 26px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 255, 255, .12); color: #fff;
  padding: 8px 18px; border-radius: 22px; font-size: 13px; font-weight: 600;
  backdrop-filter: blur(10px); z-index: 4; border: 1px solid rgba(255, 255, 255, .12);
}

.incoming {
  position: absolute; inset: 0; z-index: 6;
  background: rgba(8, 8, 18, .86); backdrop-filter: blur(14px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: #fff; text-align: center;
}
.incoming h3 { margin: 10px 0 0; font-size: 23px; }
.incoming p { margin: 0; color: rgba(255, 255, 255, .65); font-size: 14px; }
.incoming-actions { display: flex; gap: 14px; margin-top: 26px; }
.incoming-actions .btn { min-width: 122px; padding: 13px 20px; border-radius: 14px; }

.call-controls {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%);
  display: flex; gap: 12px; z-index: 5;
}
.ctl {
  width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .13); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  backdrop-filter: blur(10px);
  transition: background .16s, transform .12s;
  border: 1px solid rgba(255, 255, 255, .1);
}
.ctl span { font-size: 9.5px; font-weight: 600; letter-spacing: .02em; opacity: .85; }
.ctl:hover { background: rgba(255, 255, 255, .22); }
.ctl:active { transform: scale(.95); }
.ctl.off { background: rgba(255, 255, 255, .92); color: #14162b; }
.ctl.off .ic { opacity: .9; }
.ctl.hangup { background: #e11d48; }
.ctl.hangup:hover { background: #f43f5e; }
.ctl.hangup .ic { transform: rotate(135deg); }
.ctl.active { background: #4f46e5; }

/* ----------------------------------------------------------------- modals */
.modal {
  position: fixed; inset: 0; z-index: 85;
  background: rgba(14, 15, 30, .5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 18px; padding: 22px;
  width: 100%; max-width: 400px; box-shadow: var(--shadow-md);
}
.modal-card h3 { margin: 0 0 4px; font-size: 17px; }
.modal-sub { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.modal-card textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 12px; outline: none; resize: vertical; background: #fbfbff;
}
.modal-card textarea:focus { border-color: #c7c5ee; background: #fff; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 20px;
  padding: 6px 13px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}
.chip.active { background: var(--brand-soft); border-color: #c7c5ee; color: var(--brand); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: #14162b; color: #fff; padding: 11px 20px; border-radius: 12px;
  font-size: 13.5px; opacity: 0; pointer-events: none; z-index: 95;
  transition: opacity .2s, transform .2s; max-width: 88vw; text-align: center;
  box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.lightbox {
  position: fixed; inset: 0; z-index: 88; background: rgba(6, 6, 14, .92);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; }
  .chat { display: none; }
  .app.chat-open .sidebar { display: none; }
  .app.chat-open .chat { display: flex; }
  .chat-head .back { display: inline-flex; }
  .msg { max-width: 84%; }
  .local-video { width: 104px; height: 140px; right: 12px; top: 12px; }
  .ctl { width: 54px; height: 54px; }
  .admin-body { padding: 14px; }
  .admin-head { padding: 10px 14px; gap: 10px; }
  .admin-tabs { order: 3; width: 100%; }
  .bubble.img img { max-width: 220px; }
}

@media (min-width: 861px) {
  .app.chat-open .chat { display: flex; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d7daea; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c3c7dd; }
::-webkit-scrollbar-track { background: transparent; }
