/* bro.tips WhatsApp — "obsidian" premium theme.
 *
 * Not a green WhatsApp clone. Deep-black canvas, glass panels, gold hairlines, periwinkle focus.
 * WhatsApp green is spent ONLY on the "live/connected" affordance — that restraint is the whole
 * difference between elite and clone. Palette is the CRM's measured brand: gold #d4af37,
 * periwinkle #5b8def, canvas #0c1019 / paper #141a26, green #25D366 for live only.
 */
:root {
  --canvas: #0c1019;
  --paper: #141a26;
  --paper-2: #182031;
  --ink: #e8edf6;
  --ink-dim: #93a1b8;
  --ink-faint: #5f6d84;
  --gold: #d4af37;
  --peri: #5b8def;
  --green: #25d366;
  --danger: #ef4444;
  --hair: rgba(255, 255, 255, 0.08);
  --hair-2: rgba(255, 255, 255, 0.12);
  --glass: rgba(20, 26, 38, 0.72);
  --bubble-out: #1f3b52;
  --bubble-in: #1b2231;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --list-w: clamp(320px, 30%, 440px);
}

* { box-sizing: border-box; }
/* A class rule with `display:grid/flex` beats the UA `[hidden]{display:none}` (attribute selectors
 * lose to class selectors), so every .call-stage/.ring-toast/.chat left `hidden` in HTML still
 * rendered. This one line makes `hidden` authoritative again. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(91, 141, 239, 0.10), transparent 60%),
    radial-gradient(900px 600px at 8% 110%, rgba(212, 175, 55, 0.06), transparent 55%),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; }

/* ── boot veil ─────────────────────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: var(--canvas);
  transition: opacity .5s ease;
}
.boot.hide { opacity: 0; pointer-events: none; }
.boot-mark { text-align: center; }
.boot-glyph {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(145deg, #1a2butter 0%, #16324a 100%);
  background: linear-gradient(145deg, #16324a, #0e1b2a);
  border: 1px solid var(--hair-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 30px rgba(0,0,0,.5);
  position: relative;
}
.boot-glyph::after {
  content: ""; position: absolute; inset: 0; border-radius: 18px;
  background: radial-gradient(circle at 50% 42%, rgba(37,211,102,.9), rgba(37,211,102,0) 62%);
  opacity: .85;
}
.boot-word { font-family: var(--serif); font-size: 26px; letter-spacing: .5px; }
.boot-sub { margin-top: 6px; color: var(--ink-faint); font-size: 13px; letter-spacing: .3px; }

/* ── app shell ─────────────────────────────────────────────────────────── */
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--list-w) 1fr;
}
.pane { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.pane-list {
  background: linear-gradient(180deg, rgba(24,32,49,.55), rgba(18,24,36,.55));
  border-right: 1px solid var(--hair);
  backdrop-filter: blur(12px);
}

/* list header */
.list-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; }
.brand-glyph {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(145deg, #16324a, #0e1b2a);
  border: 1px solid var(--hair-2); position: relative;
}
.brand-glyph::after {
  content: ""; position: absolute; inset: 0; border-radius: 9px;
  background: radial-gradient(circle at 50% 44%, rgba(37,211,102,.85), transparent 62%);
}
.brand-name { font-family: var(--serif); font-size: 19px; letter-spacing: .3px; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint);
  box-shadow: 0 0 0 0 rgba(37,211,102,.5);
}
.live-dot.on { background: var(--green); animation: pulse 2.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(37,211,102,.45); }
  70% { box-shadow: 0 0 0 7px rgba(37,211,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}
.head-actions { display: flex; gap: 6px; }

.icon-btn {
  border: 1px solid transparent; background: transparent; color: var(--ink-dim);
  width: 38px; height: 38px; border-radius: 11px; font-size: 17px; cursor: pointer;
  display: grid; place-items: center; transition: all .16s ease;
}
.icon-btn:hover { background: rgba(255,255,255,.05); color: var(--ink); border-color: var(--hair); }

/* search */
.search { padding: 12px 14px; }
.search input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  background: rgba(12,16,25,.7); border: 1px solid var(--hair);
  color: var(--ink); font-size: 14px; outline: none; transition: border-color .16s;
}
.search input::placeholder { color: var(--ink-faint); }
.search input:focus { border-color: var(--peri); box-shadow: 0 0 0 3px rgba(91,141,239,.15); }

.scope-bar { padding: 0 14px 10px; display: flex; gap: 8px; }
.scope-bar select {
  flex: 1; padding: 8px 10px; border-radius: 10px; background: rgba(12,16,25,.7);
  border: 1px solid var(--hair); color: var(--ink-dim); font-size: 13px;
}

/* conversation list */
.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.conv {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 12px;
  align-items: center; padding: 11px 12px; border-radius: 14px; cursor: pointer;
  border: 1px solid transparent; transition: background .14s, border-color .14s;
}
.conv:hover { background: rgba(255,255,255,.035); }
.conv.active { background: rgba(91,141,239,.10); border-color: rgba(91,141,239,.25); }
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--serif); font-size: 18px;
  color: #0c1019; border: 1px solid rgba(255,255,255,.14);
}
.conv-mid { min-width: 0; }
.conv-name {
  font-family: var(--serif); font-size: 15.5px; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-prev {
  color: var(--ink-dim); font-size: 13px; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-prev .owner { color: var(--gold); opacity: .8; }
.conv-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.conv-time { color: var(--ink-faint); font-size: 11.5px; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--green); color: #06210f; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}

.list-foot { padding: 10px 16px; border-top: 1px solid var(--hair); }
.lock { color: var(--ink-faint); font-size: 11.5px; letter-spacing: .2px; }

/* ── chat pane ─────────────────────────────────────────────────────────── */
.pane-chat {
  background:
    linear-gradient(180deg, rgba(12,16,25,.4), rgba(12,16,25,.75)),
    radial-gradient(700px 500px at 80% 0%, rgba(91,141,239,.05), transparent 60%);
  position: relative;
}
.chat-intro {
  margin: auto; text-align: center; max-width: 440px; padding: 40px;
}
.intro-glyph {
  width: 88px; height: 88px; margin: 0 auto 24px; border-radius: 26px;
  background: linear-gradient(145deg, #16324a, #0e1b2a); border: 1px solid var(--hair-2);
  position: relative; box-shadow: var(--shadow);
}
.intro-glyph::after {
  content: ""; position: absolute; inset: 0; border-radius: 26px;
  background: radial-gradient(circle at 50% 44%, rgba(37,211,102,.8), transparent 60%);
}
.chat-intro h1 { font-family: var(--serif); font-weight: 500; font-size: 27px; margin: 0 0 12px; }
.chat-intro p { color: var(--ink-dim); font-size: 14.5px; line-height: 1.6; margin: 0 0 10px; }
.chat-intro .intro-lock { color: var(--gold); opacity: .85; font-size: 13px; margin-top: 18px; }

.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--hair); background: var(--glass); backdrop-filter: blur(12px);
}
.back-btn { display: none; font-size: 24px; }
.ch-avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); color: #0c1019; border: 1px solid rgba(255,255,255,.14); }
.ch-id { flex: 1; min-width: 0; }
.ch-name { font-family: var(--serif); font-size: 16px; }
.ch-sub { color: var(--ink-faint); font-size: 12px; margin-top: 2px; }
.ch-actions { display: flex; gap: 4px; }
.call-btn { font-size: 18px; }
.call-btn:hover { color: var(--green); border-color: rgba(37,211,102,.35); background: rgba(37,211,102,.08); }

/* messages */
.messages { flex: 1; overflow-y: auto; padding: 22px 8% 12px; display: flex; flex-direction: column; gap: 4px; }
.day { align-self: center; margin: 14px 0; padding: 4px 12px; border-radius: 20px;
  background: rgba(255,255,255,.04); color: var(--ink-faint); font-size: 11.5px; letter-spacing: .4px; }
.b {
  position: relative; width: fit-content; max-width: min(66%, 560px);
  padding: 9px 13px 7px; border-radius: 14px; font-size: 14.5px; line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.b.in { align-self: flex-start; background: var(--bubble-in); border: 1px solid var(--hair);
  border-bottom-left-radius: 5px; }
.b.out { align-self: flex-end; background: var(--bubble-out); border: 1px solid rgba(91,141,239,.18);
  border-bottom-right-radius: 5px; }
.b .meta { display: block; text-align: right; margin-top: 3px; font-size: 10.5px; color: var(--ink-faint); }
.b .tick.read { color: var(--peri); }
.b .tick.failed { color: var(--danger); }

/* composer */
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--hair); background: var(--glass); backdrop-filter: blur(12px);
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px; padding: 11px 14px; border-radius: 14px;
  background: rgba(12,16,25,.7); border: 1px solid var(--hair); color: var(--ink);
  font-size: 14.5px; font-family: inherit; outline: none; line-height: 1.4;
}
.composer textarea:focus { border-color: var(--peri); box-shadow: 0 0 0 3px rgba(91,141,239,.13); }
.send-btn { color: var(--green); font-size: 18px; }
.send-btn:hover { background: rgba(37,211,102,.1); border-color: rgba(37,211,102,.35); }

/* ── incoming ring toast ───────────────────────────────────────────────── */
.ring-toast {
  position: fixed; top: 22px; right: 22px; z-index: 40; width: 340px;
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--glass); backdrop-filter: blur(18px);
  border: 1px solid var(--hair-2); border-radius: 18px; box-shadow: var(--shadow);
  animation: slidein .3s ease;
}
@keyframes slidein { from { transform: translateY(-14px); opacity: 0; } }
.ring-avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); color: #0c1019; }
.ring-id { flex: 1; min-width: 0; }
.ring-name { font-family: var(--serif); font-size: 16px; }
.ring-kind { color: var(--ink-dim); font-size: 12.5px; margin-top: 2px; }
.ring-actions { display: flex; gap: 8px; }
.ring-btn { width: 44px; height: 44px; border-radius: 50%; border: none; font-size: 18px; cursor: pointer; }
.ring-btn.accept { background: var(--green); color: #06210f; }
.ring-btn.decline { background: var(--danger); color: #fff; }

/* ── in-call stage ─────────────────────────────────────────────────────── */
.call-stage { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; }
.stage-scrim { position: absolute; inset: 0; background: rgba(5,8,13,.82); backdrop-filter: blur(8px); }
.stage-card {
  position: relative; width: min(92vw, 460px); padding: 36px 28px 28px;
  background: var(--glass); border: 1px solid var(--hair-2); border-radius: 26px;
  box-shadow: var(--shadow); text-align: center;
}
.remote-video { width: 100%; border-radius: 18px; background: #000; margin-bottom: 18px; }
.local-video { position: absolute; top: 18px; right: 18px; width: 108px; border-radius: 12px;
  border: 1px solid var(--hair-2); background: #000; }
.stage-avatar { width: 108px; height: 108px; border-radius: 50%; margin: 0 auto 18px;
  display: grid; place-items: center; font-family: var(--serif); font-size: 40px; color: #0c1019; }
.stage-name { font-family: var(--serif); font-size: 23px; }
.stage-state { color: var(--ink-dim); font-size: 14px; margin-top: 6px; }
.stage-timer { color: var(--green); font-size: 15px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stage-controls { display: flex; justify-content: center; gap: 16px; margin-top: 26px; }
.stage-btn { width: 58px; height: 58px; border-radius: 50%; border: 1px solid var(--hair-2);
  background: rgba(255,255,255,.06); font-size: 22px; cursor: pointer; transition: all .15s; }
.stage-btn:hover { background: rgba(255,255,255,.12); }
.stage-btn.active { background: rgba(255,255,255,.9); color: #0c1019; }
.stage-btn.hangup { background: var(--danger); color: #fff; border-color: transparent; }

/* ── responsive: single pane on phones ─────────────────────────────────── */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .pane-chat { position: fixed; inset: 0; z-index: 20; transform: translateX(100%); transition: transform .26s ease; }
  .app.chat-open .pane-chat { transform: translateX(0); }
  .back-btn { display: grid; }
}

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.09); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }
