/* Rubik (SIL OFL, see /static/fonts/OFL.txt), self-hosted so no visitor data goes to Google. */
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/rubik-hebrew.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/rubik-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --primary: #F25A2B;
  --primary-600: #DD4A1D;
  --primary-50: #FFF1EC;
  --ink: #16123A;
  --ink-2: #4A4670;
  --muted: #8A87A3;
  --bg: #FFFFFF;
  --surface: #F7F6FB;
  --border: #ECEAF3;
  --danger: #D92D4B;
  --ok: #1F9D6B;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 6px 24px rgba(22, 18, 58, .08);
  --shadow-lg: 0 18px 48px rgba(22, 18, 58, .18);
  --topbar-h: 56px;
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary-600); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); direction: ltr; }
.brand img { width: 40px; height: 40px; display: block; }
.wordmark { font-weight: 700; font-size: 1.35rem; letter-spacing: -.01em; direction: ltr; unicode-bidi: isolate; }
.wordmark b { color: var(--primary); font-weight: 700; }
.brand-sm img { width: 32px; height: 32px; }
.brand-sm .wordmark { font-size: 1.1rem; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 0; border-radius: 999px; padding: .8rem 1.4rem;
  font-weight: 600; font-size: 1rem; background: var(--surface); color: var(--ink);
  transition: background .15s, transform .05s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(242, 90, 43, .3); }
.btn-primary:hover { background: var(--primary-600); }
.btn-primary:disabled { opacity: .55; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: .45rem .9rem; font-size: .9rem; }

.field { display: grid; gap: .35rem; }
.field label { font-weight: 500; font-size: .95rem; }
.input, select.input, textarea.input {
  width: 100%; padding: .8rem 1rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: #fff; transition: border-color .15s;
}
.input:focus { border-color: var(--primary); outline: none; }
textarea.input { resize: vertical; min-height: 80px; }
textarea.bio-input { min-height: 0; resize: none; }
.hint { font-size: .85rem; color: var(--muted); }
.avatar-picker { display: flex; align-items: center; gap: 1rem; }
.photo-circle { position: relative; flex: none; width: 76px; height: 76px; border-radius: 50%; border: 2px dashed #D5D1E6; background: var(--surface); color: var(--muted); display: grid; place-items: center; padding: 0; overflow: hidden; transition: border-color .15s; }
.photo-circle:hover { border-color: var(--primary); color: var(--primary); }
.photo-circle.has-photo { border-style: solid; border-color: var(--primary); }
.photo-circle svg { width: 30px; height: 30px; }
.photo-circle img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-meta { display: grid; gap: .4rem; }
.photo-label { font-weight: 500; font-size: .95rem; }
.photo-buttons { display: flex; gap: .4rem; flex-wrap: wrap; }
.field-row { display: flex; gap: .75rem; align-items: flex-start; }
.field-age { flex: 0 0 92px; }
.field-gender { flex: 1; min-width: 0; border: 0; padding: 0; margin: 0; }
.field-gender legend { font-weight: 500; font-size: .95rem; padding: 0; margin-bottom: .35rem; }
.segmented { display: flex; gap: .35rem; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: .78rem .25rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: #fff; cursor: pointer; font-weight: 500; transition: .15s; }
.segmented input:checked + span { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.bio-input { min-height: 0; resize: none; }
.counter { text-align: end; }
.form-error { color: var(--danger); font-size: .9rem; min-height: 1.3em; margin: 0; }

.check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; font-size: .95rem; }
.check input { appearance: none; flex: none; width: 22px; height: 22px; margin: 1px 0 0; border-radius: 7px; border: 1.5px solid #CFCBE0; background: #fff; display: grid; place-content: center; cursor: pointer; }
.check input::after { content: ""; width: 11px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { opacity: 1; }

/* ---------- landing ---------- */
.landing { min-height: 100%; display: flex; flex-direction: column; background:
  radial-gradient(900px 400px at 85% -10%, var(--primary-50), transparent 70%),
  radial-gradient(700px 380px at -10% 110%, #F1EFFA, transparent 70%), var(--bg); }
.landing header { padding: 1.1rem 1.25rem; display: flex; justify-content: center; }
.landing main { flex: 1; display: grid; place-items: center; padding: 1rem 1.25rem 2rem; }
.hero { width: 100%; max-width: 420px; }
.hero h1 { font-size: 2rem; line-height: 1.15; margin: .25rem 0 .5rem; font-weight: 700; }
.hero h1 span { color: var(--primary); }
.hero .lead { color: var(--ink-2); margin: 0 0 1.5rem; }
.card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 1.4rem; border: 1px solid var(--border); }
.gate { display: grid; gap: 1.05rem; }
.features { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.25rem; padding: 0; list-style: none; color: var(--ink-2); font-size: .9rem; }
.features li { background: var(--surface); border-radius: 999px; padding: .3rem .8rem; }
.landing footer, .site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem; }
.landing footer a, .site-footer a { color: var(--ink-2); }

/* ---------- chat app ---------- */
.app { height: 100%; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: .5rem;
  padding: 0 .6rem; border-bottom: 1px solid var(--border); background: #fff; z-index: 5;
}
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.topbar-title h1 { margin: 0; font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title span { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title.clickable { cursor: pointer; border-radius: 10px; padding: .15rem .4rem; margin-inline: -.4rem; }
.topbar-title.clickable:hover { background: var(--surface); }
/* where am I: room vs private chat */
.brand .header-icon { width: 36px; height: 36px; font-size: 1rem; border-radius: 11px; }
.brand .avatar.header-icon { border-radius: 50%; }
body[data-context="pm"] { --chat-bg: #F4F1FF; --header-bg: #F7F4FF; --header-line: #E4DCFF; }
body[data-context="pm"] .topbar { background: var(--header-bg); border-bottom-color: var(--header-line); }
body[data-context="pm"] .chat { background: var(--chat-bg); }
body[data-context="pm"] .topbar-title span { color: #6B57D6; font-weight: 500; }
body[data-context="pm"] .composer { background: var(--header-bg); border-top-color: var(--header-line); }
body[data-context="room"] .topbar-title span { color: var(--primary-600); }
.icon-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
  min-width: 40px; height: 40px; padding: 0 .5rem; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); font-size: .85rem; font-weight: 600;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn svg { width: 22px; height: 22px; }
.conn-banner { background: var(--ink); color: #fff; text-align: center; font-size: .85rem; padding: .3rem; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; position: relative; overflow: clip; }
.sidebar, .chat { min-height: 0; }
.sidebar { overflow-y: auto; padding: .75rem .75rem 2rem; background: #fff; }
.sidebar h2, .users-panel h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1rem .5rem .5rem; font-weight: 600; }
.sidebar section:first-child h2 { margin-top: .25rem; }
.layout[data-view="home"] .chat { display: none; }
.layout[data-view="chat"] .sidebar { display: none; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.list-item {
  width: 100%; display: flex; align-items: center; gap: .75rem; text-align: start;
  padding: .7rem .75rem; border: 0; border-radius: 14px; background: transparent;
}
.list-item:hover { background: var(--surface); }
.list-item.active { background: var(--primary-50); }
.list-item .avatar { flex: none; }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .sub { font-size: .85rem; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { flex: none; font-size: .8rem; font-weight: 600; color: var(--ink-2); background: var(--surface); padding: .15rem .55rem; border-radius: 999px; display: inline-flex; align-items: center; gap: .3rem; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.badge { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.side-tabs { display: flex; gap: .3rem; padding: .3rem; margin: 0 .25rem .5rem; background: var(--surface); border-radius: 14px; position: sticky; top: 0; z-index: 1; }
.side-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; background: transparent; padding: .6rem .5rem; border-radius: 11px; font-weight: 600; color: var(--ink-2); }
.side-tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(22,18,58,.1); }
.side-tab .badge { min-width: 20px; height: 20px; font-size: .7rem; }
.side-panel h2 { margin-top: 1rem; }
.side-panel h2:first-child, .side-panel .section-head:first-child { margin-top: .5rem; }
.title-row { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.title-row .title { flex: 1; min-width: 0; }
.conv-time { flex: none; font-size: .75rem; color: var(--muted); }
.list-item.unread .title, .list-item.unread .sub { color: var(--ink); font-weight: 600; }
.list-item.unread .conv-time { color: var(--primary-600); font-weight: 600; }
.room-tag.in { color: var(--ok); background: #E8F7F0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1rem .5rem .5rem; }
.section-head h2 { margin: 0 !important; }
.btn-soft { background: var(--primary-50); color: var(--primary-600); }
.btn-soft:hover { background: #FFE3D8; }
.room-tag { font-size: .7rem; font-weight: 600; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 0 .45rem; margin-inline-start: .35rem; vertical-align: middle; }
.room-icon.user { background: #F1EFFA; color: var(--ink); }
.empty-note { color: var(--muted); font-size: .9rem; padding: .25rem .75rem; margin: 0; }

.room-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; color: var(--primary); background: var(--primary-50); }
.avatar { position: relative; overflow: hidden; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .95rem; user-select: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.has-photo { overflow: visible; }
.avatar.has-photo img { border-radius: 50%; }

/* chat column */
.chat { display: flex; flex-direction: column; background: var(--surface); position: relative; }
.empty { margin: auto; color: var(--muted); text-align: center; padding: 2rem; }
.empty img { width: 72px; opacity: .9; }
.messages { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 1rem .75rem .5rem; display: flex; flex-direction: column; gap: .35rem; overscroll-behavior: contain; }
.msg { display: flex; gap: .5rem; align-items: flex-end; max-width: 100%; }
.msg .avatar { width: 30px; height: 30px; font-size: .8rem; border: 0; cursor: pointer; padding: 0; }
.bubble { max-width: min(78%, 560px); background: #fff; border-radius: 18px; border-end-start-radius: 6px; padding: .45rem .8rem .35rem; box-shadow: 0 1px 2px rgba(22,18,58,.06); }
.bubble .who { display: block; font-weight: 600; font-size: .8rem; color: var(--primary-600); background: none; border: 0; padding: 0; cursor: pointer; }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.bubble .time { display: block; font-size: .7rem; color: var(--muted); text-align: end; margin-top: .1rem; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--primary); color: #fff; border-end-start-radius: 18px; border-end-end-radius: 6px; }
.msg.mine .bubble .time { color: rgba(255,255,255,.8); }
.msg.cont .avatar { visibility: hidden; }
.msg.cont .who { display: none; }
.msg-system { align-self: center; font-size: .8rem; color: var(--muted); background: rgba(22,18,58,.05); padding: .2rem .7rem; border-radius: 999px; }
.typing { min-height: 1.4rem; font-size: .8rem; color: var(--muted); padding: 0 1rem; }

.composer { flex: none; display: flex; gap: .5rem; padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--border); }
.composer input { flex: 1; min-width: 0; border-radius: 999px; padding: .75rem 1.1rem; border: 1.5px solid var(--border); background: var(--surface); font-size: 16px; }
.composer input:focus { outline: none; border-color: var(--primary); background: #fff; }
.attach-btn { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink-2); display: grid; place-items: center; }
.attach-btn:hover { background: var(--primary-50); color: var(--primary-600); }
.attach-btn:disabled { opacity: .5; cursor: progress; }
.attach-btn svg { width: 23px; height: 23px; }
.msg-photo { position: relative; display: block; margin: .15rem 0 .2rem; border-radius: 12px; overflow: hidden; background: rgba(22,18,58,.06); max-width: min(260px, 60vw); cursor: zoom-in; }
.msg-photo img { display: block; width: 100%; height: auto; transition: filter .2s; }
.msg-photo.blurred { cursor: pointer; }
.msg-photo.blurred img { filter: blur(22px) saturate(.7); transform: scale(1.1); }
.msg-photo .reveal { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: .2rem; border: 0; background: rgba(22,18,58,.25); color: #fff; font-weight: 600; font-size: .9rem; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.msg-photo .reveal small { font-weight: 400; font-size: .75rem; opacity: .9; }
.photo-gone { font-size: .85rem; color: var(--muted); font-style: italic; }
.msg.mine .photo-gone { color: rgba(255,255,255,.85); }
.receipt { margin-inline-start: .3rem; font-weight: 700; letter-spacing: -.12em; white-space: nowrap; }
.receipt.delivered { opacity: .7; }
.receipt.read, .receipt.seen { color: #fff; text-shadow: 0 0 1px rgba(0,0,0,.25); }
.receipt.seen { letter-spacing: 0; font-weight: 600; }
.avatar.gone { background: #C9C6D6 !important; color: #fff; box-shadow: none !important; }
.bubble .who.gone { color: var(--muted); font-style: italic; font-weight: 500; }
.photo-delete { position: absolute; top: 6px; left: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(22,18,58,.62); color: #fff; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: background .15s, transform .1s; z-index: 1; }
.photo-delete:hover, .photo-delete:focus-visible { background: var(--danger); }
.photo-delete:active { transform: scale(.92); }
.photo-delete svg { width: 18px; height: 18px; }
.once-photo { position: relative; }
.once-photo .avatar.gone { background: #C9C6D6 !important; color: #fff; box-shadow: none !important; }
.bubble .who.gone { color: var(--muted); font-style: italic; font-weight: 500; }
.photo-delete { position: static; flex: none; margin-inline-start: auto; width: 30px; height: 30px; background: rgba(255,255,255,.2); }
.once-photo { display: flex; align-items: center; gap: .6rem; margin: .15rem 0 .2rem; padding: .55rem .8rem; border-radius: 14px; border: 1.5px dashed var(--primary); background: var(--primary-50); color: var(--ink); text-align: start; min-width: 200px; }
button.once-photo { cursor: pointer; }
button.once-photo:hover { background: #FFE3D8; }
.once-photo b { display: block; font-size: .9rem; }
.once-photo small { display: block; font-size: .75rem; color: var(--ink-2); }
.once-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--primary); color: var(--primary); }
.once-photo.viewed { border-style: solid; border-color: var(--border); background: var(--surface); }
.once-photo.viewed .once-icon { border-color: var(--muted); color: var(--muted); }
.once-photo.mine { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.7); color: #fff; }
.once-photo.mine small { color: rgba(255,255,255,.85); }
.once-photo.mine .once-icon { border-color: #fff; color: #fff; }
.lightbox.once img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.once-note { position: absolute; bottom: max(1.25rem, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.85); font-size: .85rem; margin: 0; }
.photo-confirm { text-align: center; }
.photo-confirm-preview { display: block; max-width: 100%; max-height: 45vh; margin: .25rem auto 1rem; border-radius: 14px; }
.photo-confirm-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.btn-once { background: var(--ink); color: #fff; }
.btn-once:hover { background: #241e5a; }
.photo-confirm-note { margin: .75rem 1rem .25rem; }
.bubble.deleted { background: transparent !important; color: var(--muted) !important; border: 1.5px dashed var(--border); box-shadow: none; font-style: italic; }
.msg.mine .bubble.deleted .time { color: var(--muted); }
.msg.mine .bubble { cursor: pointer; }
.sheet-note { margin: .25rem .9rem .5rem; }
.call-header-btn { color: var(--ok); }
.call-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; align-content: center; gap: 2.5rem; padding: 1.5rem; background: radial-gradient(120% 90% at 50% 0%, #2a2366 0%, var(--ink) 60%); color: #fff; animation: fadein .2s ease; }
.call-card { text-align: center; display: grid; justify-items: center; gap: .4rem; width: min(100%, 360px); }
.call-avatar .avatar { width: 120px; height: 120px; font-size: 3rem; }
.call-overlay.incoming .call-avatar, .call-overlay.ringing .call-avatar, .call-overlay.calling .call-avatar { animation: pulse 1.6s ease-in-out infinite; border-radius: 50%; }
.call-name { margin: .75rem 0 0; font-size: 1.6rem; }
.call-status { margin: 0; opacity: .8; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
/* video calls */
.call-peer-muted { margin: .2rem 0 0; font-size: .85rem; opacity: .85; }
.call-remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-local-video { position: absolute; z-index: 2; top: max(1rem, env(safe-area-inset-top)); left: 1rem; width: min(30vw, 150px); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 6px 20px rgba(0,0,0,.4); transform: scaleX(-1); background: #111; }
.call-overlay.has-remote { background: #000; }
.call-overlay.has-remote .call-card { position: absolute; z-index: 1; top: max(1rem, env(safe-area-inset-top)); inset-inline: 0; gap: .1rem; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.call-overlay.has-remote .call-name { margin: 0; font-size: 1.15rem; }
.call-overlay.is-video:not(.incoming) .call-actions { position: absolute; z-index: 2; bottom: max(1.5rem, env(safe-area-inset-bottom)); inset-inline: 0; gap: 1.1rem; }
.call-overlay.is-video:not(.incoming) .call-btn svg { width: 56px; height: 56px; padding: 15px; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.call-overlay.is-video .call-btn.hangup svg { background: var(--danger); }
.call-overlay.is-video .call-btn.on svg { background: #fff; color: var(--ink); }
.call-btn.camera.on svg { background: #fff; color: var(--ink); }
.call-overlay.incoming.is-video .call-actions { gap: 1.6rem; }
.call-btn.accept-audio svg { background: rgba(255,255,255,.22); }
.call-actions { display: flex; gap: 2.5rem; justify-content: center; }
.call-btn { display: grid; justify-items: center; gap: .45rem; border: 0; background: none; color: #fff; font-size: .85rem; }
.call-btn svg { width: 64px; height: 64px; padding: 18px; border-radius: 50%; background: rgba(255,255,255,.16); box-sizing: border-box; transition: transform .1s, background .15s; }
.call-btn:active svg { transform: scale(.94); }
.call-btn.accept svg { background: #1F9D6B; }
.call-btn.reject svg, .call-btn.hangup svg { background: var(--danger); }
.call-btn.mute.on svg { background: #fff; color: var(--ink); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(242,90,43,.55); } 50% { box-shadow: 0 0 0 22px rgba(242,90,43,0); } }
@keyframes fadein { from { opacity: 0; } }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10,8,30,.92); display: grid; place-items: center; padding: 1rem; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lightbox .close { position: absolute; top: max(1rem, env(safe-area-inset-top)); inset-inline-start: 1rem; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 1.4rem; }
.send-btn { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; }
.send-btn:hover { background: var(--primary-600); }
.send-btn svg { width: 22px; height: 22px; transform: scaleX(-1); } /* point left in RTL */

/* users drawer */
.users-panel {
  position: absolute; inset-block: 0; inset-inline-end: 0; width: min(82vw, 300px);
  background: #fff; border-inline-start: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility .2s; overflow-y: auto; padding: .5rem .5rem 2rem; z-index: 6;
}
[dir="ltr"] .users-panel { transform: translateX(105%); }
.layout.users-open .users-panel { transform: none; visibility: visible; }
.scrim { position: absolute; inset: 0; background: rgba(22,18,58,.35); z-index: 5; }
.user-row { display: flex; align-items: center; gap: .15rem; }
.user-row .list-item { flex: 1; min-width: 0; }
.user-row .list-item:disabled { cursor: default; }
.user-row .list-item:disabled:hover { background: transparent; }
.user-more { color: var(--muted); }
.user-more svg { stroke-width: 3.2; }
.user-more:hover { color: var(--ink); }
.users-panel .list-item .you { font-size: .75rem; color: var(--muted); font-weight: 400; }
.user-blocked .title { text-decoration: line-through; color: var(--muted); }

/* action sheet / dialogs / menu */
.sheet-wrap { position: fixed; inset: 0; background: rgba(22,18,58,.4); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 440px; background: #fff; border-radius: 22px 22px 0 0; padding: .75rem .75rem calc(1rem + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .18s ease; }
.sheet h3 { margin: .25rem .75rem .75rem; font-size: 1rem; display: flex; align-items: center; gap: .6rem; }
.sheet .quote { margin: 0 .75rem .75rem; padding: .5rem .75rem; background: var(--surface); border-radius: 12px; font-size: .9rem; color: var(--ink-2); overflow-wrap: anywhere; }
.sheet-btn { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .85rem .9rem; border: 0; background: transparent; border-radius: 14px; font-weight: 500; text-align: start; }
.sheet-btn:hover { background: var(--surface); }
.sheet-btn.danger { color: var(--danger); }
.sheet-btn svg { width: 20px; height: 20px; }
.profile-card { text-align: center; padding-top: 1.5rem; }
.avatar-lg { width: 84px; height: 84px; font-size: 2rem; margin: 0 auto .5rem; }
.profile-name { justify-content: center; font-size: 1.3rem !important; margin: .25rem 0 .1rem !important; }
.profile-facts { margin: 0 0 .75rem; color: var(--ink-2); font-weight: 500; }
.profile-bio { margin: 0 1rem 1rem; padding: .75rem 1rem; background: var(--surface); border-radius: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.profile-bio.empty { color: var(--muted); font-style: italic; }
.profile-actions { display: flex; gap: .5rem; justify-content: center; margin-bottom: .5rem; flex-wrap: wrap; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

dialog { border: 0; border-radius: 22px; padding: 1.4rem; width: min(92vw, 420px); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog::backdrop { background: rgba(22,18,58,.45); }
dialog h3 { margin: 0 0 1rem; }
.profile-dialog { width: min(94vw, 440px); max-height: 92vh; overflow-y: auto; }
.profile-dialog form { gap: .9rem; }
dialog form { display: grid; gap: 1rem; }
.report-shot { display: flex; align-items: flex-start; gap: .5rem; }
.report-shot img { max-width: 70%; max-height: 30vh; border-radius: 10px; border: 1px solid var(--border); }
.dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; }

.menu { position: absolute; top: calc(var(--topbar-h) - 6px); inset-inline-end: .6rem; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); padding: .35rem; z-index: 30; min-width: 190px; border: 1px solid var(--border); }
.menu button { width: 100%; text-align: start; border: 0; background: transparent; padding: .65rem .8rem; border-radius: 10px; }
.menu button:hover { background: var(--surface); }

.toast { position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 12px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }

.overlay { position: fixed; inset: 0; background: #fff; z-index: 50; display: grid; place-items: center; text-align: center; padding: 2rem; }
.overlay h2 { margin: .5rem 0; }

/* desktop */
@media (min-width: 900px) {
  .layout { grid-template-columns: 290px 1fr 260px; }
  .layout[data-view] .sidebar, .layout[data-view] .chat { display: flex; }
  .sidebar { display: block !important; border-inline-end: 1px solid var(--border); }
  .users-panel { position: static; transform: none !important; visibility: visible; box-shadow: none; width: auto; z-index: auto; }
  .scrim, .only-mobile { display: none !important; }
  .bubble { max-width: 70%; }
  .toast { bottom: 96px; }
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 22px; }
}

/* ---------- content pages (terms) ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.page header { padding: .5rem 0 1rem; display: flex; justify-content: space-between; align-items: center; }
.page h1 { font-size: 1.7rem; margin: .5rem 0; }
.page h2 { font-size: 1.15rem; margin: 1.6rem 0 .4rem; }
.page p, .page li { color: var(--ink-2); }
.page .lang-switch { display: flex; gap: .4rem; }
.page .notice { background: var(--primary-50); border-radius: 14px; padding: .8rem 1rem; color: var(--ink); font-size: .92rem; }
.page hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ---------- admin ---------- */
.admin { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.admin header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { border: 0; background: var(--surface); padding: .5rem 1rem; border-radius: 999px; font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.cards { display: grid; gap: .75rem; }
.rcard { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 1rem; display: grid; gap: .5rem; }
.rcard .row { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .9rem; color: var(--ink-2); }
.rcard .row b { color: var(--ink); font-weight: 600; }
.rcard .quote { background: var(--surface); border-radius: 10px; padding: .6rem .8rem; overflow-wrap: anywhere; }
.rcard .actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; background: var(--primary-50); color: var(--primary-600); }
.tag-urgent { background: var(--danger); color: #fff; }
.rcard.urgent { border-color: var(--danger); box-shadow: inset 4px 0 0 var(--danger); }
.rcard .handled { background: var(--surface); border-radius: 10px; padding: .5rem .8rem; display: grid; gap: .25rem; }
.rcard textarea { resize: vertical; }
.rcard .report-screenshot { max-width: min(100%, 420px); max-height: 70vh; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; direction: ltr; unicode-bidi: isolate; }
.target-row { align-items: center; }
.admin-photo { display: inline-flex; align-items: center; gap: .5rem; }
.admin-photo img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface); }
.reported-photo { max-width: 240px; max-height: 240px; border-radius: 10px; object-fit: contain; background: var(--surface); }
.login-card { max-width: 380px; margin: 12vh auto 0; }

/* dir="auto" treats an empty field as LTR; keep the Hebrew placeholder RTL */
input[dir="auto"]:placeholder-shown, textarea[dir="auto"]:placeholder-shown { direction: rtl; }
