/*
 * Brand colours from the PrayukTech logo:
 *   navy   #061639  ("Prayuk")
 *   blue   #0475EB / #006FCE (the P and T), deep blue #003D82
 *   orange #FE730F / #FF9A15 (the Y and the pixels)
 * Text/background pairs are chosen for WCAG AA contrast in both themes.
 */
:root {
  --navy: #061639;
  --primary: #0670DE;        /* buttons, fills, accents */
  --primary-dark: #003D82;   /* hover, pressed */
  --primary-text: #0564C8;   /* blue text and icons on light surfaces */
  --primary-soft: #E7F0FD;
  --accent: #FE730F;         /* orange highlights: unread badges, notices */
  --accent-light: #FF9A15;
  --accent-text: #B84A00;    /* orange text on light surfaces */
  --accent-soft: #FFF1E6;
  --on-accent: #061639;
  --header-bg: linear-gradient(120deg, #061639 0%, #0A3A7A 100%);
  --online: #22C55E;
  --bg: #E6ECF5;
  --panel: #ffffff;
  --panel-2: #F1F5FB;
  --border: #E1E8F2;
  --text: #0B1A33;
  --muted: #5B6B82;
  --bubble-in: #ffffff;
  --bubble-out: #DCEBFF;
  --chat-bg: #EEF3FA;
  --tick-read: #0064B4;
  --danger: #D0342C;
  --hover: #F4F7FC;
  --active: #E7EEF8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --primary: #1F6FDB;
    --primary-dark: #0B4FA8;
    --primary-text: #4DA3FF;
    --primary-soft: #102A52;
    --accent-text: #FF8A3D;
    --accent-soft: #2A1E14;
    --header-bg: linear-gradient(120deg, #050D20 0%, #0A2A5C 100%);
    --bg: #050B18;
    --panel: #0C1730;
    --panel-2: #13213F;
    --border: #1C2C4D;
    --text: #E6EDF7;
    --muted: #93A4BE;
    --bubble-in: #13213F;
    --bubble-out: #0B3F7A;
    --chat-bg: #07101F;
    --tick-read: #4DA3FF;
    --hover: #13213F;
    --active: #1A2B4F;
  }
}
:root[data-mode="dark"] {
  --primary: #1F6FDB;
  --primary-dark: #0B4FA8;
  --primary-text: #4DA3FF;
  --primary-soft: #102A52;
  --accent-text: #FF8A3D;
  --accent-soft: #2A1E14;
  --header-bg: linear-gradient(120deg, #050D20 0%, #0A2A5C 100%);
  --bg: #050B18;
  --panel: #0C1730;
  --panel-2: #13213F;
  --border: #1C2C4D;
  --text: #E6EDF7;
  --muted: #93A4BE;
  --bubble-in: #13213F;
  --bubble-out: #0B3F7A;
  --chat-bg: #07101F;
  --tick-read: #4DA3FF;
  --hover: #13213F;
  --active: #1A2B4F;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}
button { font: inherit; cursor: pointer; }
input, textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}
input:focus, textarea:focus { border-color: var(--primary); }
h1, h2 { margin: 0; font-weight: 500; }
h2 { font-size: 18px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 12px 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.center { align-items: center; text-align: center; }
.error { color: var(--danger); min-height: 1em; margin: 0; font-size: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }

.primary {
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 24px;
  padding: 10px 20px;
  font-weight: 500;
}
.primary:hover { background: var(--primary-dark); }
.primary:disabled { opacity: .6; cursor: default; }
.wide { width: 100%; }

.icon-btn {
  background: none;
  border: 0;
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 20px;
  flex: none;
}
.icon-btn:hover { background: var(--active); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }

/* ---------- auth ---------- */
.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--header-bg) top / 100% 220px no-repeat, var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; color: var(--primary-text); }
.brand-logo { width: 40px; height: 40px; }
.brand-logo.big { width: 88px; height: 88px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  flex: 1;
  background: none;
  border: 0;
  padding: 10px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
}
.tab.active { color: var(--primary-text); border-bottom-color: var(--primary); }
#auth-form { display: flex; flex-direction: column; gap: 14px; }
#auth-form select {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 8px;
}
.auth-lead { margin: 0; font-size: 14px; color: var(--muted); }
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.seg {
  border: 0;
  background: none;
  border-radius: 8px;
  padding: 8px;
  color: var(--muted);
  font-weight: 500;
}
.seg.active { background: var(--panel); color: var(--primary-text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.otp-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.otp-input-row { display: flex; gap: 8px; min-width: 0; }
.otp-input-row input { flex: 1; min-width: 0; }
.otp-input-row .cc { flex: none; width: 92px; }
.otp-code { display: flex; flex-direction: column; gap: 4px; }
.otp-code input { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.otp-code input::placeholder { letter-spacing: normal; }
.otp-meta { margin: 0; font-size: 12.5px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; }
.otp-meta .resend { font-size: 12.5px; }
.otp-meta .resend:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.otp-hint .dev-code { color: var(--accent-text); font-weight: 600; letter-spacing: .1em; }
#auth-use-email { align-self: center; }

/* ---------- layout ---------- */
.app {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(300px, 30%) 1fr;
  max-width: 1600px;
  margin: 0 auto;
  background: var(--panel);
}
.sidebar {
  position: relative;
  border-right: 1px solid var(--border);
  background: var(--panel);
  min-width: 0;
  overflow: hidden;
}
.panel { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--panel); }
.panel.overlay { z-index: 2; }
.settings-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.number-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 16px; background: var(--accent-soft); color: var(--text); border-bottom: 1px solid var(--border); font-size: 14px; }
.number-banner span { flex: 1 1 220px; }
.text.sealed { font-style: italic; color: var(--muted); }

.bar {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel-2);
}
.bar.green { background: var(--header-bg); color: #fff; height: 108px; align-items: flex-end; padding-bottom: 16px; box-shadow: inset 0 -3px 0 var(--accent); }
.bar.green .icon-btn { color: #fff; }
.bar.green .icon-btn:hover { background: rgba(255, 255, 255, .15); }
.bar-actions { margin-left: auto; display: flex; gap: 4px; }

.search { padding: 8px 12px; border-bottom: 1px solid var(--border); flex: none; }
.search input { background: var(--panel-2); border: 0; }

.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
}
.list li:hover { background: var(--hover); }
.list li.active { background: var(--active); }
.list .body {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.row { display: flex; align-items: center; gap: 8px; }
.row .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.row .time { font-size: 12px; color: var(--muted); }
.row .preview {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .preview.typing { color: var(--primary-text); }
.badge {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border-radius: 12px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.has-unread .time { color: var(--accent-text); font-weight: 500; }
.check { margin-left: auto; width: 20px; height: 20px; accent-color: var(--primary); }

/* ---------- avatars ---------- */
.avatar, .avatar-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  position: relative;
  border: 0;
  padding: 0;
}
.bar .avatar, .avatar-btn { width: 40px; height: 40px; }
.avatar.xl { width: 160px; height: 160px; font-size: 56px; }
.avatar.online::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--panel);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--panel-2);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 13px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.chip button { background: none; border: 0; color: var(--muted); padding: 0; }

/* ---------- chat ---------- */
.chat { min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); }
.empty-state {
  margin: auto;
  text-align: center;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.chat-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-title { min-width: 0; }
.chat-title .name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title .sub.typing { color: var(--primary-text); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 6%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background-color: var(--chat-bg);
  background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px);
  background-size: 18px 18px;
}
.day {
  align-self: center;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 8px;
  margin: 10px 0;
  box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
  text-transform: uppercase;
}
.msg {
  max-width: min(65%, 560px);
  padding: 6px 8px 8px 9px;
  border-radius: 8px;
  background: var(--bubble-in);
  box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
  align-self: flex-start;
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  margin-top: 2px;
}
.msg.first { margin-top: 8px; }
.msg.out { align-self: flex-end; background: var(--bubble-out); }
.msg .author { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.msg .meta {
  float: right;
  margin: 8px 0 -4px 10px;
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.msg.deleted .text { font-style: italic; color: var(--muted); }
/* ---------- status icons (public/icons) ---------- */
.status-icon { width: 17px; height: 17px; flex: none; }
.meta .status-icon { margin-left: 1px; }
.preview .status-icon { vertical-align: -4px; margin-right: 4px; width: 19px; height: 19px; }
.inline-icon { width: 20px; height: 20px; vertical-align: -5px; margin-right: 6px; }
.msg.failed { box-shadow: 0 0 0 1px rgba(208, 52, 44, .45); }
.msg .retry {
  display: block;
  clear: both;
  background: none;
  border: 0;
  padding: 4px 0 0;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}
.msg .retry:hover { text-decoration: underline; }
.masked-cover {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: 0;
  padding: 2px 0;
  color: var(--muted);
  font-style: italic;
  text-align: left;
}
.masked-cover small { margin-left: 8px; font-style: normal; color: var(--primary-text); font-weight: 500; }
.mask-btn img { width: 26px; height: 26px; opacity: .75; }
.mask-btn.active { background: var(--active); box-shadow: inset 0 0 0 2px var(--primary); }
.mask-btn.active img { opacity: 1; }
.msg .del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: inherit;
  border: 0;
  color: var(--muted);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  opacity: 0;
  font-size: 14px;
}
.msg:hover .del { opacity: 1; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel-2);
  flex: none;
}
/* The message box takes the rest of the row; the tool buttons keep their size. */
.composer > * { flex: none; }
.composer #message-input { flex: 1 1 0; min-width: 0; width: auto; }
/* On phones the message box gets a full-width row; the tools and mic sit on the row below. */
@media (max-width: 760px) {
  .composer { flex-wrap: wrap; row-gap: 6px; }
  .composer #message-input { order: -1; flex: 1 1 100%; }
  .composer > .emoji-wrap, .composer > .icon-btn { margin-right: 2px; }
}
.composer textarea {
  resize: none;
  max-height: 120px;
  border: 0;
  border-radius: 8px;
  line-height: 20px;
}
.send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  display: grid;
  place-items: center;
  flex: none;
}
.send svg { width: 22px; height: 22px; fill: #fff; }
.emoji-wrap { position: relative; }
.emoji-picker {
  position: absolute;
  bottom: 52px;
  left: 0;
  width: 280px;
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .2);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 3;
}
.emoji-picker button { background: none; border: 0; font-size: 22px; padding: 4px; border-radius: 6px; }
.emoji-picker button:hover { background: var(--hover); }

.mobile-only { display: none; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .app.chat-open .sidebar { display: none; }
  .app:not(.chat-open) .chat { display: none; }
  .mobile-only { display: inline-grid; }
  .messages { padding: 12px 16px; }
  .msg { max-width: 85%; }
  .bar { padding: 0 8px; }
}

/* ---------- buttons that show an icon image ---------- */
.img-btn img { width: 28px; height: 28px; }
.icon-btn.img-btn:hover img { transform: scale(1.06); }
.primary.small { padding: 6px 16px; font-size: 14px; }

/* ---------- offline banner ---------- */
.offline-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent-soft);
  color: #9A3D00;
  border-left: 4px solid var(--accent);
  font-size: 13.5px;
  flex: none;
}
.offline-banner img { width: 36px; height: 36px; flex: none; }
.offline-banner strong { display: block; font-size: 14.5px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .offline-banner { color: #FFB37A; }
}
:root[data-mode="dark"] .offline-banner { color: #FFB37A; }

/* ---------- chat menu ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: 44px;
  min-width: 200px;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .2);
  padding: 6px 0;
  z-index: 5;
}
.menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: 0;
  color: var(--text);
  text-align: left;
}
.menu button:hover { background: var(--hover); }
.menu img { width: 24px; height: 24px; }

/* ---------- banners inside a chat ---------- */
.call-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: none;
  font-size: 14.5px;
}
.call-banner img { width: 30px; height: 30px; animation: pulse-scale 1.6s ease-in-out infinite; }
.call-banner span { flex: 1; min-width: 0; }
@keyframes pulse-scale { 50% { transform: scale(1.12); } }
.blocked-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 0;
  color: var(--muted);
  flex: none;
  width: 100%;
}
.blocked-banner:hover { color: var(--text); }
.blocked-banner img { width: 28px; height: 28px; }

/* ---------- typing / recording indicators ---------- */
.preview .icon-typing, .preview .icon-recording, .preview .icon-calling,
.sub .status-icon { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.sub .status-icon { width: 16px; height: 16px; vertical-align: -3px; }
.row .name + .icon-blocked { width: 16px; height: 16px; }

/* ---------- starred messages ---------- */
.msg .star {
  position: absolute;
  top: 2px;
  right: 26px;
  background: inherit;
  border: 0;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  padding: 2px;
  opacity: 0;
}
.msg:not(.out) .star { right: 2px; }
.msg:hover .star, .msg .star:focus-visible { opacity: 1; }
.msg .star .star-icon { width: 18px; height: 18px; filter: grayscale(1) opacity(.6); }
.msg .star.on .star-icon { filter: none; }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--primary); } }
.starred-list .preview .status-icon { margin-right: 4px; }
.empty-icon { width: 96px; height: 96px; }

/* ---------- voice messages ---------- */
.msg.voice { min-width: 250px; }
.voice-player { display: flex; align-items: center; gap: 10px; padding: 4px 2px 0; }
.voice-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  flex: none;
  display: grid;
  place-items: center;
}
.voice-bar { flex: 1; min-width: 80px; accent-color: var(--primary); padding: 0; border: 0; background: none; }
.voice-time { font-size: 12px; color: var(--muted); min-width: 32px; }
.mic {
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  background: none;
  flex: none;
  display: grid;
  place-items: center;
}
.mic img { width: 42px; height: 42px; }
.mic:hover img { transform: scale(1.06); }
.recorder {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel-2);
  flex: none;
}
.recorder .rec-icon { width: 40px; height: 40px; animation: pulse-scale 1.2s ease-in-out infinite; }
.recorder .rec-time { font-variant-numeric: tabular-nums; font-size: 16px; min-width: 44px; }
.recorder .rec-hint { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- call log entries ---------- */
.msg.call-entry { cursor: pointer; white-space: normal; min-width: 220px; }
.call-entry .call-row { display: flex; align-items: center; gap: 10px; padding: 2px 2px 0; }
.call-entry .call-entry-icon { width: 38px; height: 38px; flex: none; }
.call-entry .call-title { font-size: 14.5px; }
.call-entry.missed .call-title { color: var(--danger); }
.call-entry .call-sub { font-size: 12.5px; color: var(--muted); }

/* ---------- call screen ---------- */
.call {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: radial-gradient(circle at 50% 30%, #0B2D63, #050B18 70%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}
.call-grid {
  position: absolute;
  inset: 0;
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  grid-auto-rows: 1fr;
  gap: 6px;
}
.call.active .call-grid { display: grid; }
.call.active.group .call-grid { padding: 96px 8px 120px; }
.tile {
  position: relative;
  background: #0E1B36;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 0;
}
.call.group .tile { border-radius: 12px; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.no-video video { visibility: hidden; }
.tile-avatar { display: none; width: 96px; height: 96px; font-size: 34px; }
.tile.no-video .tile-avatar { display: grid; }
.tile-name {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}
.call:not(.group) .tile-name { display: none; }
.tile-hold { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; display: none; }
.tile.on-hold .tile-hold { display: block; }
.call-info {
  position: relative;
  margin-top: 12vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 0 16px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.call-info h2 { font-size: 26px; }
.call-state { margin: 0; display: flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, .85); font-size: 16px; }
.call-state-icon { width: 34px; height: 34px; }
.call.ringing .call-state-icon { animation: pulse-scale 1.2s ease-in-out infinite; }
.call.active .call-info { margin-top: 20px; }
.call.active .call-info .avatar { display: none; }
.call.active .call-info h2 { font-size: 20px; }
.call.ringing .call-info .avatar { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent); }
  100% { box-shadow: 0 0 0 30px color-mix(in srgb, var(--primary) 0%, transparent); }
}
.local-video {
  position: absolute;
  right: 16px;
  bottom: 120px;
  width: min(28vw, 220px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  background: #0E1B36;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .5);
  transform: scaleX(-1);
  display: none;
  z-index: 1;
}
.call.show-local .local-video { display: block; }
.call-controls {
  position: absolute;
  bottom: 32px;
  display: flex;
  gap: 18px;
  z-index: 2;
}
.round {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
  padding: 0;
}
.round svg { width: 28px; height: 28px; fill: #fff; }
.round:hover { background: rgba(255, 255, 255, .28); }
.round.off { background: #fff; }
.round.off svg { fill: #111b21; }
/* image buttons: the icon is the button */
.round.img { background: none; backdrop-filter: none; }
.round.img img { width: 64px; height: 64px; transition: transform .15s; }
.round.img:hover img { transform: scale(1.07); }
.round.img.off img { filter: drop-shadow(0 0 6px #fff); }
#call-hold.off { outline: 3px solid #fff; outline-offset: -2px; }
/* incoming: only accept / decline; otherwise no accept/decline */
.call:not(.incoming) #call-accept, .call:not(.incoming) #call-decline { display: none; }
.call.incoming #call-mute, .call.incoming #call-camera, .call.incoming #call-hold, .call.incoming #call-hangup { display: none; }
.call[data-kind="audio"] #call-camera { display: none; }
.call.ended .call-controls { display: none; }

@media (max-width: 760px) {
  .local-video { width: 30vw; bottom: 116px; right: 12px; }
  .call-controls { gap: 10px; }
  .round, .round.img img { width: 56px; height: 56px; }
}

/* ---------- status updates ---------- */
.status-btn { position: relative; }
.status-btn.has-unseen::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--panel-2);
}
.status-scroll { overflow-y: auto; flex: 1; }
.status-ring { position: relative; width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
.status-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.status-ring circle { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.status-ring circle.unseen { stroke: var(--primary); }
.status-ring circle.seen { stroke: #b9c2c7; }
.status-ring .avatar { width: 42px; height: 42px; font-size: 15px; }
.status-ring.empty .avatar { width: 48px; height: 48px; }
.status-ring .add-badge {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--panel);
  font-size: 15px;
  line-height: 1;
}
.my-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 8px solid var(--panel-2);
}
.my-status:hover { background: var(--hover); }
.my-status .body, .status-list .body { flex: 1; min-width: 0; }
.my-status .name, .status-list .name { font-size: 16px; }
.my-status .sub, .status-list .sub, #sv-viewers-list .sub { font-size: 13.5px; color: var(--muted); }
.status-actions { display: flex; gap: 2px; }
.section-title {
  margin: 0;
  padding: 14px 16px 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.status-list li { padding: 8px 16px; gap: 14px; }

/* composer */
.status-composer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background .25s;
}
.sc-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 12px; }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255, 255, 255, .15); }
.status-composer[data-mode="text"] .photo-only, .status-composer[data-mode="image"] .text-only { display: none; }
#status-text-input {
  background: none;
  border: 0;
  color: #fff;
  font-size: clamp(22px, 4vw, 38px);
  text-align: center;
  resize: none;
  width: min(90%, 760px);
  height: 50vh;
  padding-top: 18vh;
  line-height: 1.3;
}
#status-text-input::placeholder { color: rgba(255, 255, 255, .7); }
#status-photo-preview { max-width: 100%; max-height: calc(100% - 160px); object-fit: contain; }
.sc-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .35));
}
.sc-bottom .error { flex: 1; color: #ffd2cf; }
#status-caption { flex: 3; background: rgba(0, 0, 0, .45); color: #fff; border: 0; border-radius: 22px; padding: 11px 16px; }
#status-caption::placeholder { color: rgba(255, 255, 255, .75); }

/* viewer */
.status-viewer {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: #111;
  color: #fff;
  display: flex;
  flex-direction: column;
  user-select: none;
}
.sv-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; padding: 10px 12px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.sv-bars { display: flex; gap: 4px; margin-bottom: 10px; }
.sv-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.sv-fill { height: 100%; background: #fff; width: 0; }
.sv-head { display: flex; align-items: center; gap: 10px; }
.sv-head .avatar { width: 40px; height: 40px; font-size: 15px; }
.sv-who { flex: 1; min-width: 0; }
.sv-time { font-size: 13px; color: rgba(255, 255, 255, .8); }
.sv-stage { flex: 1; display: grid; place-items: center; overflow: hidden; cursor: pointer; touch-action: manipulation; }
.sv-text {
  max-width: min(90%, 760px);
  font-size: clamp(22px, 4vw, 38px);
  text-align: center;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.3;
  grid-area: 1 / 1;
}
.sv-text.long { font-size: clamp(18px, 2.6vw, 26px); }
.sv-media { max-width: 100%; max-height: 100%; object-fit: contain; grid-area: 1 / 1; }
.sv-media:not([src]) { display: none; }
.sv-caption {
  position: absolute;
  bottom: 84px;
  left: 0;
  right: 0;
  text-align: center;
  padding: 10px 16px;
  background: rgba(0, 0, 0, .45);
  white-space: pre-wrap;
}
.sv-bottom { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; padding: 14px 16px; z-index: 2; }
.status-viewer:not(.mine) .mine-only, .status-viewer.mine .others-only { display: none; }
.sv-views {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, .4);
  color: #fff;
  border: 0;
  border-radius: 18px;
  padding: 7px 16px;
  font-size: 15px;
}
.sv-views svg { width: 20px; height: 20px; fill: #fff; }
.sv-reply { display: flex; gap: 8px; width: min(100%, 640px); }
.sv-reply input { flex: 1; background: rgba(0, 0, 0, .5); color: #fff; border: 1px solid rgba(255, 255, 255, .25); border-radius: 22px; padding: 11px 16px; }
.sv-reply input::placeholder { color: rgba(255, 255, 255, .7); }
.sv-viewers {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 60%;
  background: var(--panel);
  color: var(--text);
  border-radius: 14px 14px 0 0;
  display: flex;
  flex-direction: column;
  z-index: 3;
}
.sv-viewers header { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); }
.sv-viewers h3 { margin: 0; font-size: 16px; font-weight: 500; }
#sv-viewers-list li { padding: 8px 16px; gap: 12px; cursor: default; }

/* reply quote in chat */
.status-quote {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 200px;
  margin-bottom: 4px;
  padding: 0;
  background: rgba(0, 0, 0, .05);
  border: 0;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  overflow: hidden;
  text-align: left;
  color: inherit;
  white-space: normal;
}
.status-quote:hover { background: rgba(0, 0, 0, .09); }
.sq-body { flex: 1; min-width: 0; padding: 6px 4px 6px 8px; }
.sq-who { font-size: 12.5px; font-weight: 600; color: var(--primary-text); }
.sq-text { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sq-swatch { width: 44px; flex: none; display: grid; place-items: center; color: #fff; font-size: 13px; overflow: hidden; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .status-quote { background: rgba(255, 255, 255, .06); }
}
:root[data-mode="dark"] .status-quote { background: rgba(255, 255, 255, .06); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: var(--navy);
  border-bottom: 3px solid var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 60;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  max-width: calc(100% - 32px);
}

/* ---------- developer settings ---------- */
.link-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px;
  background: var(--panel-2);
  border: 0;
  border-radius: 10px;
  color: var(--text);
  text-align: left;
}
.link-row:hover { background: var(--active); }
.link-row svg { width: 24px; height: 24px; fill: var(--primary-text); flex: none; }
.link-row small { display: block; color: var(--muted); font-size: 13px; }
.dev-scroll { overflow-y: auto; flex: 1; }
.dev-intro { font-size: 14px; line-height: 1.5; margin: 0; }
.dev-intro a { color: var(--primary-text); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.dev-list li { cursor: default; padding: 8px 16px; gap: 10px; }
.dev-list li:hover { background: none; }
.dev-list .body { padding: 4px 0; border: 0; }
.dev-list .name { font-size: 15px; }
.dev-list .sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.dev-list .sub.error { color: var(--danger); }
.dev-url { overflow-wrap: anywhere; }
.dev-empty { padding: 8px 16px; font-size: 14px; }
.dev-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.link, .danger-link { background: none; border: 0; padding: 2px 0; font-size: 13.5px; color: var(--primary-text); }
.danger-link { color: var(--danger); }
.link:hover, .danger-link:hover { text-decoration: underline; }
.dev-form { display: flex; gap: 8px; flex-wrap: wrap; }
.dev-form input { flex: 1; min-width: 180px; }
.dev-form.stack { flex-direction: column; align-items: stretch; }
.secret-box { background: var(--accent-soft); color: #9A3D00; border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.secret-box p { margin: 0 0 8px; }
.secret-box code { background: rgba(0, 0, 0, .07); color: inherit; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 6px 8px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .secret-box { color: #FFB37A; }
}
:root[data-mode="dark"] .secret-box { color: #FFB37A; }
#panel-profile { overflow-y: auto; }

/* ---------- chat lock ---------- */
.lock-icon { width: 15px; height: 15px; fill: var(--muted); flex: none; }
.menu .menu-svg { width: 24px; height: 24px; fill: var(--muted); }
.lock-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: var(--chat-bg);
}
.lock-screen h2 { font-size: 22px; }
.lock-screen p { max-width: 360px; margin: 0; }
.lock-big { width: 72px; height: 72px; fill: var(--primary-text); opacity: .85; }
.unlock-form { display: flex; gap: 8px; margin-top: 8px; width: min(100%, 340px); }
.unlock-form input { flex: 1; text-align: center; letter-spacing: .15em; }
.link-row.static { cursor: default; }
.link-row.static:hover { background: var(--panel-2); }
.lock-actions { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0 4px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .45);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-card {
  width: min(100%, 400px);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-card h3 { margin: 0; font-size: 18px; font-weight: 500; }
.modal-card p { margin: 0; font-size: 14px; }
.modal-buttons { display: flex; justify-content: flex-end; align-items: center; gap: 16px; }

/* ---------- chat header (tap for contact info) ---------- */
.chat-title-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  background: none;
  border: 0;
  padding: 4px 0;
  color: inherit;
  text-align: left;
}
.name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.name-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.badges { display: inline-flex; gap: 4px; align-items: center; flex: none; }
.biz-badge { width: 15px; height: 15px; fill: var(--primary-text); flex: none; }
.timer-icon { width: 14px; height: 14px; fill: var(--muted); flex: none; }
.row .timer-icon, .row .biz-badge { margin-left: 2px; }
.meta .timer-icon { width: 12px; height: 12px; }
.preview .timer-icon { vertical-align: -2px; margin-right: 4px; }
.auto-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--primary-text); margin-right: 2px; }

/* ---------- disappearing messages ---------- */
.timer-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--panel);
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
  text-align: left;
  flex: none;
  width: 100%;
}
.timer-banner:hover { color: var(--text); }
.timer-banner svg { width: 18px; height: 18px; fill: var(--primary-text); flex: none; }
.system-note {
  align-self: center;
  max-width: min(90%, 520px);
  margin: 8px 0;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #9A3D00;
  font-size: 12.5px;
  text-align: center;
  box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
}
.system-note .timer-icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 5px; fill: currentColor; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .system-note { color: #FFB37A; }
}
:root[data-mode="dark"] .system-note { color: #FFB37A; }
.timer-options { display: flex; flex-direction: column; gap: 8px; }
.timer-options label { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 15px; }
.timer-options input { width: auto; accent-color: var(--primary); }
.timer-custom { display: flex; gap: 8px; }
.timer-custom label { flex: 1; }
.timer-custom.disabled { opacity: .45; }
.small-note { font-size: 12.5px; }

/* ---------- contact / group info ---------- */
.contact-scroll { overflow-y: auto; flex: 1; background: var(--panel-2); }
.info-top { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px 18px; background: var(--panel); text-align: center; }
.info-top p { margin: 0; }
.info-name { display: flex; align-items: center; gap: 8px; font-size: 22px; margin-top: 10px; }
.info-name .biz-badge { width: 20px; height: 20px; }
.info-card { background: var(--panel); margin-top: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.info-label { font-size: 13px; color: var(--muted); }
.info-value { color: var(--text); overflow-wrap: anywhere; }
a.info-value { color: var(--primary-text); text-decoration: none; }
a.info-value:hover { text-decoration: underline; }
.info-row { display: flex; flex-direction: column; gap: 1px; padding-top: 6px; }
.info-action { flex-direction: row; align-items: center; gap: 12px; }
.info-action .timer-icon { width: 22px; height: 22px; fill: var(--primary-text); }
.grow { flex: 1; }
.biz-head { display: flex; align-items: center; gap: 8px; color: var(--primary-text); font-weight: 500; }
.biz-head .biz-badge { width: 18px; height: 18px; }
.biz-desc { margin: 0; white-space: pre-wrap; }
.biz-status { font-size: 14px; }
.biz-status.open strong { color: var(--primary-text); }
.biz-status.closed strong { color: var(--danger); }
.biz-week { display: grid; gap: 2px; font-size: 13.5px; color: var(--muted); }
.biz-day { display: flex; justify-content: space-between; gap: 12px; }
.biz-day.today { color: var(--text); font-weight: 600; }
.member-list li { cursor: default; padding: 0; }
.member-list li:hover { background: none; }
.admin-tag { font-size: 11px; color: var(--primary-text); border: 1px solid var(--primary); border-radius: 4px; padding: 0 4px; }

/* ---------- business settings ---------- */
.biz-form { overflow-y: auto; flex: 1; padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.biz-intro { margin: 0; font-size: 13.5px; }
.biz-form select, .biz-form textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
.biz-form textarea { resize: vertical; }
.biz-form fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.biz-form legend { color: var(--primary-text); font-size: 14px; padding: 0 4px; }
.biz-form label.agreeline { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text); font-size: 13.5px; }
.biz-form label.agreeline input { flex: none; width: 18px; height: 18px; padding: 0; margin: 1px 0 0; accent-color: var(--primary); }
.biz-form label.agreeline span { flex: 1; min-width: 0; }
.hours-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px 8px; align-items: center; font-size: 13.5px; padding: 4px 0; }
.hours-row + .hours-row { border-top: 1px solid var(--border); }
.hours-row select { padding: 6px 8px; font-size: 13.5px; min-width: 0; }
.hours-row .times { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.hours-row .times input { flex: 1; min-width: 0; padding: 6px 6px; font-size: 13.5px; }
.day-name { color: var(--text); }
#business-remove { align-self: center; }

/* ---------- brand touches ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }
.auth-card { border-top: 4px solid var(--accent); }
.brand h1 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.brand h1 span { color: var(--primary-text); }
.send { background: var(--primary); }
.send:hover { background: var(--primary-dark); }
.msg.out .meta { color: #4A5E7E; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .msg.out .meta { color: #A9C3E6; }
}
:root[data-mode="dark"] .msg.out .meta { color: #A9C3E6; }
/* Text fields: a soft blue glow while typing; the orange ring is for keyboard focus on buttons and links. */
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* Row action buttons (e.g. hide a contact's chat in New chat) */
.list li .row-action { flex: none; width: 36px; height: 36px; color: var(--muted); }
.list li .row-action svg { width: 20px; height: 20px; fill: currentColor; }
.list li .row-action:hover { color: var(--primary-text); }

/* End-to-end encryption */
.e2ee-banner {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 6px 14px; font-size: 12.5px; color: var(--muted); background: var(--panel-2);
  border-bottom: 1px solid var(--border); text-align: center;
}
.e2ee-banner svg { width: 14px; height: 14px; fill: currentColor; flex: none; }
.e2ee-banner.warn { background: var(--accent-soft); color: var(--accent-text); }
.msg .plain-mark { display: inline-block; width: 11px; height: 11px; margin-right: 3px; vertical-align: -1px; fill: currentColor; opacity: .7; }
.msg .undecryptable { font-style: italic; opacity: .8; }
.safety { font-variant-numeric: tabular-nums; letter-spacing: .04em; line-height: 1.7; word-spacing: .3em; }
.device-this { color: var(--online); font-size: 12.5px; }
#modal-text { white-space: pre-line; }

/* Verified / not verified badge (next to names) */
.trust-badge { width: 16px; height: 16px; flex: none; vertical-align: -3px; margin-left: 2px; }
.trust-badge.verified path:not(.check) { fill: var(--primary); }
.trust-badge.verified .check { fill: #fff; }
.trust-badge.unverified path { fill: none; stroke: var(--muted); stroke-width: 1.6; opacity: .75; }
.info-name .trust-badge { width: 22px; height: 22px; vertical-align: -4px; }
.verify-name .trust-badge { width: 28px; height: 28px; margin: 0; }
.link-row .verify-name { display: grid; place-items: center; width: 24px; }
#modal select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 8px; width: 100%; }

.premium-badge { width: 15px; height: 15px; fill: var(--accent); flex: none; vertical-align: -2px; margin-left: 2px; }
.info-name .premium-badge { width: 20px; height: 20px; }
.verify-name .premium-badge { width: 26px; height: 26px; margin: 0; }

/* Profile views */
.views-switch { display: flex; gap: 12px; align-items: flex-start; flex-direction: row; color: var(--text); }
.views-switch input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--primary); }
.views-switch small { display: block; font-size: 12.5px; margin-top: 2px; }
.contact-tag { margin-left: auto; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.contact-tag.in { color: var(--primary-text); border-color: var(--primary); }
.tappable { cursor: pointer; }
.view-note { padding: 8px 16px 14px; text-align: center; }

/* Translation */
.translate-banner { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 5px 14px; font-size: 12.5px; background: var(--accent-soft); color: var(--accent-text); border-bottom: 1px solid var(--border); }
.translate-banner .link { color: inherit; font-weight: 600; }
.msg .tr-note { display: block; font-size: 11.5px; opacity: .75; margin-top: 3px; }
.msg .tr-note button { background: none; border: 0; padding: 0; color: var(--primary-text); font-size: 11.5px; cursor: pointer; text-decoration: underline; }

/* Product catalogue */
.catalogue-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.inline-label { flex-direction: row; align-items: center; gap: 8px; }
.inline-label select { font: inherit; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); }
.product-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.product { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.product .thumb { width: 72px; height: 72px; border-radius: 10px; background: var(--panel-2); flex: none; object-fit: cover; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.product .info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.product .pname { font-weight: 600; }
.product .price { color: var(--primary-text); font-weight: 600; }
.product .price small { color: var(--muted); font-weight: 400; }
.product .pdesc { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.product .ptag { align-self: flex-start; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.product .actions { display: flex; gap: 14px; margin-top: 4px; flex-wrap: wrap; }
.product.out .pname, .product.out .thumb { opacity: .6; }
.price-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product-photo { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.product-photo img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; }
.photo-pick { font-size: 14px; }
.photo-pick input { margin-top: 6px; }
.biz-card .catalogue-btn { margin-top: 10px; width: 100%; }

/* Public channels */
.channels-btn { position: relative; }
.badge-dot { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
#panel-channels .tabs { margin: 0; flex: none; }
.tab-style { flex: 1; background: none; border: 0; padding: 10px; color: var(--muted); border-bottom: 3px solid transparent; }
.tab-style.active { color: var(--primary-text); border-bottom-color: var(--primary); }
.btn-outline, .primary.small.outline, button.outline { background: none; border: 1px solid var(--primary); color: var(--primary-text); border-radius: 24px; padding: 6px 16px; font-size: 14px; }
.channel-posts { padding: 12px 18px; display: flex; flex-direction: column; gap: 6px; }
.channel-more { align-self: center; padding: 8px; }
.channel-public-note { align-self: center; text-align: center; font-size: 12px; color: var(--muted); background: var(--panel-2); border-radius: 8px; padding: 6px 12px; margin-bottom: 6px; max-width: 520px; }
.channel-empty { align-self: center; color: var(--muted); padding: 20px; }
.post { align-self: flex-start; max-width: min(640px, 92%); background: var(--bubble-in, var(--panel)); border-radius: 10px; padding: 8px 12px; box-shadow: 0 1px 1px rgba(0, 0, 0, .12); }
.post-by { font-size: 13px; font-weight: 600; color: var(--primary-text); margin-bottom: 2px; }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.post-text a { color: var(--primary-text); }
.post-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; text-align: right; }
.post-meta .danger-link { font-size: 11.5px; }
.channel-readonly { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--panel-2); border-top: 1px solid var(--border); font-size: 13.5px; color: var(--muted); text-align: center; }
#channel-follow { flex: none; margin-right: 6px; }

/* Administrator announcements and maintenance */
.announce { position: sticky; top: 0; z-index: 60; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 8px 14px; background: var(--accent); color: var(--on-accent); font-size: 14px; text-align: center; }
.announce button { background: none; border: 0; font-size: 20px; line-height: 1; color: inherit; cursor: pointer; }
.maintenance { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: var(--header-bg); }
.maintenance-card { max-width: 420px; text-align: center; background: var(--panel); border-radius: 14px; padding: 28px; border-top: 4px solid var(--accent); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.feature-off { display: none !important; }

/* Call recording (everyone must agree) */
.call-rec { position: absolute; bottom: 118px; left: 50%; transform: translateX(-50%); z-index: 6; background: rgba(0, 0, 0, .65); color: #fff; padding: 6px 14px; border-radius: 16px; font-size: 14px; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.call-rec .dot { width: 10px; height: 10px; border-radius: 50%; background: #FF3B3B; animation: recpulse 1.2s ease-in-out infinite; }
@keyframes recpulse { 50% { opacity: .25; } }
.round.rec svg { fill: #FF5C5C; }
.round.rec.on { background: #D92D2D; }
.round.rec.on svg { fill: #fff; }
.round.rec.waiting { animation: recpulse 1s ease-in-out infinite; }
.record-consent { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(0, 0, 0, .55); padding: 16px; }
.record-consent-card { background: var(--panel); color: var(--text); border-radius: 14px; padding: 22px; max-width: 360px; display: flex; flex-direction: column; gap: 10px; text-align: center; border-top: 4px solid #D92D2D; }
.record-consent-card p { margin: 0; color: var(--muted); font-size: 14px; }
.record-consent-actions { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }

/* ---------- personalisation ---------- */
html[data-avatar-shape="rounded"] .avatar { border-radius: 28%; }
html[data-avatar-shape="square"] .avatar { border-radius: 6px; }
.swatches, .icon-grid, .shape-grid, .mode-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch, .icon-opt, .shape-opt, .mode-opt {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px; min-width: 64px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--panel); color: var(--text); font-size: 12px; cursor: pointer;
}
.swatch[aria-pressed="true"], .icon-opt[aria-pressed="true"], .shape-opt[aria-pressed="true"], .mode-opt[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.swatch i { width: 28px; height: 28px; border-radius: 50%; display: block; }
.icon-opt svg { width: 36px; height: 36px; }
.shape-opt i { width: 30px; height: 30px; background: var(--primary); display: block; }
.shape-opt[data-shape="circle"] i { border-radius: 50%; }
.shape-opt[data-shape="rounded"] i { border-radius: 28%; }
.shape-opt[data-shape="square"] i { border-radius: 4px; }
.locked::after { content: "\2605"; position: absolute; top: 2px; right: 5px; font-size: 11px; color: var(--accent-text); }
#appearance-panel h3 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }

.brand-full { justify-content: center; }
.brand-full-img { display: block; width: min(280px, 85%); height: auto; }
.brand-full-img.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .brand-full-img.on-light { display: none; }
  :root:not([data-mode="light"]) .brand-full-img.on-dark { display: block; }
}
:root[data-mode="dark"] .brand-full-img.on-light { display: none; }
:root[data-mode="dark"] .brand-full-img.on-dark { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.load-earlier { display: block; margin: 8px auto 12px; }
.cache-switch { display: inline-flex; align-items: center; }
.cache-switch input { width: 20px; height: 20px; accent-color: var(--primary); }

/* ---------- consent ---------- */
.consent { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.consent-title { font-weight: 600; font-size: 14px; }
.consent-facts { margin: 0; padding-inline-start: 18px; font-size: 13px; color: var(--muted); }
.consent-lang { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.consent-lang select { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line, #d5dde9); background: var(--bg-elev, transparent); color: inherit; font: inherit; }
label.agree { display: flex; gap: 10px; align-items: flex-start; flex-direction: row; font-size: 14px; color: var(--text); cursor: pointer; }
label.agree input[type=checkbox] { width: 20px; min-width: 20px; height: 20px; flex: 0 0 20px; margin: 2px 0 0; padding: 0; accent-color: var(--primary); }
label.agree span { flex: 1; min-width: 0; line-height: 1.4; }
.consent-links, .legal-links { font-size: 13px; text-align: center; margin: 4px 0; }
.legal-links { margin-top: 14px; color: var(--muted); }
.gate-card { max-width: 480px; text-align: left; align-items: stretch; }
.gate-alt { text-align: center; font-size: 13px; margin: 4px 0 0; }
.card-lite { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--panel); }
.card-lite p { margin: 6px 0; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.danger-btn { border: 1px solid var(--danger); color: var(--danger); background: transparent; border-radius: 8px; padding: 10px 14px; font: inherit; cursor: pointer; }
.consent-toggle { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
.consent-toggle { flex-direction: row; color: var(--text); }
.consent-toggle input[type=checkbox] { width: 20px; min-width: 20px; height: 20px; flex: 0 0 20px; padding: 0; accent-color: var(--primary); margin-top: 2px; }
.consent-toggle span { flex: 1; min-width: 0; font-size: 14px; }
.consent-links a, .legal-links a, .card-lite a, .gate-card a { color: var(--primary-text); }

#modal-text { white-space: pre-line; }
#btn-payments.hidden { display: none; }

/* ---------- profile photos ---------- */
.avatar { background-size: cover; background-position: center; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; align-items: start; }
.radio-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.radio-row input { margin-top: 3px; flex: none; }
.radio-row span { min-width: 0; }
.photo-tile { display: grid; gap: 4px; justify-items: center; }
.photo-tile .pic { width: 96px; height: 96px; border-radius: 12px; background: var(--panel-2) center / cover no-repeat; border: 2px solid transparent; padding: 0; cursor: pointer; position: relative; }
.photo-tile.main .pic { border-color: var(--primary); }
.photo-tile .tag { font-size: 11px; color: var(--primary-text); font-weight: 600; }
.photo-tile .tag.warn { color: var(--accent-text); }
.photo-tile .acts { display: flex; gap: 8px; font-size: 12px; }
.photo-add { width: 96px; height: 96px; border-radius: 12px; border: 2px dashed var(--border); background: none; color: var(--primary-text); font-size: 28px; cursor: pointer; }
.photo-add:disabled { opacity: .5; cursor: default; }
.avatar.xl.has-photo, .avatar.has-photo { color: transparent; }
.crop-card canvas { width: 280px; height: 280px; border-radius: 12px; touch-action: none; cursor: grab; background: #000; align-self: center; }
.crop-zoom { display: grid; gap: 4px; text-align: left; }
.photo-viewer { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .92); display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; padding: 16px; }
.photo-viewer.hidden { display: none; }
.photo-viewer img { max-width: min(92vw, 640px); max-height: 74vh; border-radius: 8px; object-fit: contain; }
.pv-close { position: absolute; top: 10px; right: 14px; font-size: 34px; color: #fff; background: none; border: 0; cursor: pointer; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 44px; color: #fff; background: rgba(255,255,255,.12); border: 0; border-radius: 50%; width: 48px; height: 48px; cursor: pointer; }
.pv-nav.prev { left: 10px; } .pv-nav.next { right: 10px; }
.pv-nav[hidden] { display: none; }
.pv-bar { color: #fff; display: flex; gap: 14px; align-items: center; padding: 10px 0; }
.pv-bar .link { color: #FFB27A; }

/* ---------- parent or guardian ---------- */
.guardian-off { display: none !important; }
.guardian-box { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.guardian-box.hidden { display: none; }
.guardian-box .small-note { margin: 0; }
.otp-field-lite { display: grid; gap: 4px; }

/* ---------- shared locations ---------- */
.msg.place { min-width: 230px; }
.place-card { display: grid; gap: 4px; white-space: normal; }
.place-card .place-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.place-card .place-title svg { width: 20px; height: 20px; fill: var(--primary-text); flex: none; }
.place-card .place-live { color: var(--accent-text); font-size: 13px; }
.place-card .place-coords { color: var(--muted); font-size: 13px; }
.place-card .place-open { color: var(--primary-text); font-weight: 600; width: fit-content; }
.place-card .place-stop { width: fit-content; background: none; border: 1px solid var(--danger); color: var(--danger); border-radius: 16px; padding: 4px 12px; cursor: pointer; font: inherit; }
.msg.place.live-on .place-title svg { fill: var(--accent); animation: place-pulse 1.8s ease-in-out infinite; }
@keyframes place-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .msg.place.live-on .place-title svg { animation: none; } }
.live-banner { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--accent-soft); color: var(--accent-text); font-size: 14px; border-bottom: 1px solid var(--border); }
.live-banner svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.live-banner span { flex: 1; min-width: 0; }
.live-banner button { color: var(--danger); font-weight: 600; }
.live-banner.hidden { display: none; }

.passcode-box { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.passcode-box.hidden { display: none; }
.passcode-box p { margin: 0; }
.passcode-box input { text-align: center; letter-spacing: 0.3em; font-size: 20px; }
.passcode-big { display: block; font-size: 36px; letter-spacing: 0.25em; text-align: center; font-variant-numeric: tabular-nums; }

/* polls and events */
.msg.plan { min-width: min(280px, 100%); }
.plan-card { display: grid; gap: 6px; white-space: normal; }
.plan-title { font-weight: 600; word-break: break-word; }
.plan-sub { font-size: 13px; color: var(--muted, #5b6b82); }
.plan-when { font-weight: 500; }
.plan-desc { font-size: 14px; word-break: break-word; }
.plan-warn { color: #c0302a; font-weight: 600; }
.event-card.canceled .plan-title, .event-card.canceled .plan-when { text-decoration: line-through; opacity: 0.7; }
.poll-opt { position: relative; display: block; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--border, #e1e8f2); border-radius: 8px; background: transparent; color: inherit; overflow: hidden; cursor: pointer; font: inherit; }
.poll-opt:disabled { cursor: default; opacity: 0.85; }
.poll-opt.chosen { border-color: var(--primary, #0670de); }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--primary, #0670de) 18%, transparent); transition: width 0.2s; }
.poll-label { position: relative; display: flex; gap: 8px; align-items: center; }
.poll-text { flex: 1; word-break: break-word; }
.poll-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.rsvp-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rsvp { flex: 1; display: flex; gap: 6px; justify-content: center; align-items: center; padding: 7px 8px; border: 1px solid var(--border, #e1e8f2); border-radius: 8px; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.rsvp.chosen { border-color: var(--primary, #0670de); background: color-mix(in srgb, var(--primary, #0670de) 18%, transparent); font-weight: 600; }
.rsvp small { opacity: 0.7; }
.plan-actions { display: flex; gap: 14px; }
.plan-action { justify-self: start; }
#modal-fields textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px; border: 1px solid var(--border, #e1e8f2); border-radius: 8px; background: transparent; color: inherit; resize: vertical; }
