@font-face { font-family: "Figtree"; src: url("/fonts/Figtree-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/Figtree-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/Figtree-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/Figtree-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --void: #0A0A0C;
  --raise: #131316;
  --raise2: #1B1B1F;
  --line: #262529;
  --line-soft: #1E1D21;
  --text: #F3F1EF;
  --text2: #9C9AA1;
  --text3: #625F68;
  --accent: #F04A60;
  --accent-bright: #FF8593;
  --success: #3FBE8F;
  --warn: #F0A24A;
  --relay-node: var(--text);
  --relay-bg: var(--void);
  --relay-line: var(--line);
  --relay-accent: var(--accent);
  --rail-w: 366px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Figtree", -apple-system, system-ui, sans-serif;
  background: var(--void);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { height: 100vh; height: 100dvh; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }
::selection { background: rgba(240, 74, 96, 0.28); }

.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--text3);
}
.brand-dot { width: 0.42em; height: 0.42em; border-radius: 50%; background: var(--accent); display: inline-block; margin-left: 0.14em; vertical-align: baseline; }
.mono { font-variant-numeric: tabular-nums; }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--success); display: inline-block; }

.ico { display: inline-flex; align-items: center; justify-content: center; }
.ico svg { width: var(--ico, 20px); height: var(--ico, 20px); display: block; }

.relay-mark { display: block; }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.auth-mark { margin-bottom: 6px; }
.auth-title { font-size: 30px; font-weight: 700; letter-spacing: -0.4px; }
.auth-sub { font-size: 15px; color: var(--text2); line-height: 1.5; max-width: 320px; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 14px; margin-top: 20px; text-align: left; }
.field-wrap { display: flex; flex-direction: column; gap: 8px; }
.field {
  width: 100%; height: 50px; padding: 0 15px; font-size: 16px;
  color: var(--text); background: var(--raise);
  border: 0.7px solid var(--line); border-radius: 14px; outline: none;
  transition: border-color 0.16s ease;
}
.field::placeholder { color: var(--text3); }
.field:focus { border-color: var(--accent); border-width: 1.2px; }
.auth-problem { font-size: 13px; font-weight: 500; color: var(--accent-bright); }
.auth-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text3); margin-top: 10px; }

.btn {
  width: 100%; height: 52px; border-radius: 16px; font-size: 16px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:disabled { background: var(--raise2); color: var(--text3); cursor: default; }
.btn.ghost { background: transparent; color: var(--text2); border: 0.7px solid var(--line); }
.btn.danger { background: transparent; color: var(--accent); border: 0.7px solid rgba(240, 74, 96, 0.3); }
.btn.small { height: 40px; font-size: 14px; width: auto; padding: 0 18px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100%; }
.rail { display: flex; flex-direction: column; border-right: 0.7px solid var(--line); min-height: 0; background: var(--void); }
.rail-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-size: 21px; font-weight: 700; letter-spacing: -0.4px; }
.brand .brand-dot { margin-left: -4px; }
.chip { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text3); border: 0.7px solid var(--line); border-radius: 20px; padding: 2px 8px; }
.rail-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); background: var(--raise2); border: 0.7px solid var(--line); transition: transform 0.12s ease, background 0.12s ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.accent { color: var(--accent); }
.icon-btn.back { display: none; }

.segmented { display: flex; gap: 4px; margin: 0 18px 12px; padding: 3px; background: var(--raise); border: 0.7px solid var(--line); border-radius: 12px; }
.seg { flex: 1; height: 34px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text2); }
.seg.on { background: var(--raise2); color: var(--text); }

.pane { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.pane > .eyebrow { padding: 6px 20px 6px; }
.search {
  margin: 0 18px 16px; height: 42px; padding: 0 14px; font-size: 15px; color: var(--text);
  background: var(--raise); border: 0.7px solid var(--line-soft); border-radius: 13px; outline: none;
}
.search::placeholder { color: var(--text3); }
.search:focus { border-color: var(--line); }

.quick { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.quick > .eyebrow { padding: 0 20px; }
.quick-strip { display: flex; gap: 16px; overflow-x: auto; padding: 0 20px 4px; scrollbar-width: none; }
.quick-strip::-webkit-scrollbar { display: none; }
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 62px; flex: 0 0 auto; }
.quick-name { font-size: 12px; color: var(--text2); max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: var(--avatar-size, 44px); height: var(--avatar-size, 44px); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 600; font-size: calc(var(--avatar-size, 44px) * 0.4); flex: 0 0 auto;
}

.list { display: flex; flex-direction: column; padding-bottom: 24px; }
.row { display: flex; align-items: center; gap: 13px; padding: 13px 18px; text-align: left; width: 100%; border-bottom: 0.5px solid var(--line-soft); transition: background 0.1s ease; }
.row:hover { background: var(--raise); }
.row.selected { background: var(--raise); }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-top { display: flex; align-items: center; gap: 7px; }
.row-title { font-size: 16px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title.bold { font-weight: 600; }
.row-top .spacer { flex: 1; }
.row-top .ico { color: var(--text3); }
.row-time { font-size: 11px; color: var(--text3); flex: 0 0 auto; }
.row-bottom { display: flex; align-items: center; gap: 8px; }
.row-preview { flex: 1; min-width: 0; font-size: 14px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 40px 28px; margin: auto; }
.empty.small { padding: 32px 20px; }
.empty-title { font-size: 18px; font-weight: 600; }
.empty-copy { font-size: 14px; color: var(--text2); line-height: 1.5; max-width: 260px; }

/* ---------- calls pane ---------- */
.calls-pane { padding-top: 4px; gap: 12px; }
.calls-pane > .eyebrow { padding: 10px 20px 2px; }
.start-block { margin: 0 18px; padding: 20px; background: var(--raise); border: 0.7px solid var(--line); border-radius: 22px; display: flex; flex-direction: column; gap: 14px; }
.start-head { display: flex; align-items: center; justify-content: space-between; }
.start-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.status-pill { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--text2); }
.status-pill.preview .dot-live { background: var(--warn); }
.start-copy { font-size: 13px; color: var(--text2); line-height: 1.45; }
.start-actions { display: flex; gap: 10px; }
.start-btn { flex: 1; height: 48px; border-radius: 14px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.12s ease; }
.start-btn:active { transform: scale(0.98); }

.recent { display: flex; flex-direction: column; margin: 0 18px 30px; background: var(--raise); border: 0.7px solid var(--line); border-radius: 20px; overflow: hidden; }
.recent-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 0.5px solid var(--line-soft); }
.recent-row:last-child { border-bottom: none; }
.recent-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.recent-title { font-size: 15px; font-weight: 600; }
.recent-sub { font-size: 11px; color: var(--text2); }
.recent-empty { margin: 0 18px; font-size: 14px; color: var(--text2); padding: 16px; background: var(--raise); border: 0.7px solid var(--line); border-radius: 18px; }
.recent-row .icon-btn { width: 36px; height: 36px; }

/* ---------- thread ---------- */
.thread { display: flex; flex-direction: column; min-height: 0; background: var(--void); }
.thread-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 0.7px solid var(--line); }
.thread-identity { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; text-align: left; }
.thread-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-sub { font-size: 11px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-calls { display: flex; gap: 6px; }
.thread-calls .icon-btn { width: 38px; height: 38px; background: transparent; border: none; }

.msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 0 14px 8px; }
.msgs-intro { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 0 16px; text-align: center; }
.seal-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; color: var(--text2); padding: 4px 10px; border: 0.7px solid var(--line); border-radius: 20px; }
.msgs-intro-copy { font-size: 11px; color: var(--text3); }

.banner { margin: 8px 0; padding: 14px; background: var(--raise); border: 0.7px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.banner.warn { border-color: rgba(240, 162, 74, 0.35); }
.banner-title { font-size: 13px; font-weight: 600; }
.banner-copy { font-size: 12px; color: var(--text2); line-height: 1.45; }

.msg-row { display: flex; padding: 2px 0; }
.msg-row.mine { justify-content: flex-end; }
.msg-row.theirs { justify-content: flex-start; }
.msg-col { display: flex; flex-direction: column; max-width: min(66%, 460px); gap: 3px; }
.msg-row.mine .msg-col { align-items: flex-end; }
.msg-sender { font-size: 11px; font-weight: 600; color: var(--accent-bright); padding-left: 4px; }
.msg { padding: 10px 14px; border-radius: 19px; display: flex; flex-direction: column; gap: 5px; }
.msg-row.theirs .msg { background: var(--raise2); color: var(--text); border-bottom-left-radius: 7px; }
.msg-row.mine .msg { background: var(--accent); color: #fff; border-bottom-right-radius: 7px; }
.msg-reply { font-size: 11px; opacity: 0.72; border-left: 2px solid currentColor; padding-left: 7px; }
.msg-body { font-size: 16px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.msg-meta { display: flex; align-items: center; gap: 5px; font-size: 10px; opacity: 0.7; align-self: flex-end; }
.msg-row.theirs .msg-meta { color: var(--text3); opacity: 1; }
.delivery.failed { color: #fff; opacity: 1; font-weight: 600; }
.msg-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.12s ease; }
.msg-row:hover .msg-actions { opacity: 1; }
.msg-action { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text2); background: var(--raise2); }
.msg-action:hover { color: var(--text); }

.composer { border-top: 0.7px solid var(--line); padding: 9px 12px calc(9px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; background: var(--void); }
.reply-banner { display: flex; align-items: center; gap: 9px; padding: 0 4px; }
.reply-bar { width: 3px; height: 30px; border-radius: 2px; background: var(--accent); flex: 0 0 auto; }
.reply-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.reply-name { font-size: 11px; font-weight: 600; color: var(--accent-bright); }
.reply-preview { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-cancel { color: var(--text3); display: inline-flex; }
.composer-bar { display: flex; align-items: flex-end; gap: 9px; }
.composer-input {
  flex: 1; resize: none; font-size: 16px; line-height: 1.4; color: var(--text);
  background: var(--raise2); border: 0.7px solid var(--line); border-radius: 20px;
  padding: 11px 15px; outline: none; max-height: 160px;
}
.composer-input::placeholder { color: var(--text3); }
.send { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; transition: transform 0.12s ease; }
.send:active { transform: scale(0.94); }

/* ---------- sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); display: grid; place-items: end center; z-index: 40; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; background: var(--void); border: 0.7px solid var(--line); border-radius: 24px 24px 0 0; margin-top: auto; }
@media (min-width: 640px) { .sheet-backdrop { place-items: center; } .sheet { border-radius: 24px; } }
.sheet-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; position: sticky; top: 0; background: var(--void); }
.sheet-title { font-size: 19px; font-weight: 700; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; padding: 6px 18px 24px; }
.sheet-hint { font-size: 12px; color: var(--text2); line-height: 1.45; }
.sheet-hint.mono { color: var(--text3); }

.picker { display: flex; flex-direction: column; gap: 8px; }
.picker-row { display: flex; align-items: center; gap: 13px; padding: 10px 14px; background: var(--raise); border: 0.7px solid var(--line); border-radius: 16px; text-align: left; }
.picker-row.on { background: rgba(240, 74, 96, 0.08); border-color: rgba(240, 74, 96, 0.35); }
.picker-label { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.picker-name { font-size: 15px; font-weight: 600; }
.picker-handle { font-size: 12px; color: var(--text2); }
.picker-tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--text3); display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; }
.picker-row.on .picker-tick { background: var(--accent); border-color: var(--accent); }
.picker-row.on .picker-tick::after { content: "\2713"; }

.safety-number { font-size: 17px; font-weight: 600; letter-spacing: 1px; font-variant-numeric: tabular-nums; background: var(--raise2); border-radius: 14px; padding: 16px; text-align: center; line-height: 1.7; }

.detail-head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; }
.detail-name { font-size: 22px; font-weight: 700; }
.detail-sub { font-size: 13px; color: var(--text2); }
.detail-actions { display: flex; gap: 10px; }
.detail-action { flex: 1; height: 46px; border-radius: 14px; border: 1px solid rgba(240, 74, 96, 0.35); color: var(--accent); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }

.identity { display: flex; align-items: center; gap: 15px; padding: 15px; background: var(--raise); border: 0.7px solid var(--line); border-radius: 20px; }
.identity-text { display: flex; flex-direction: column; gap: 3px; }
.identity-name { font-size: 18px; font-weight: 600; }
.identity-handle { font-size: 13px; color: var(--text2); }
.identity-tag { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; color: var(--text2); margin-top: 2px; }
.metrics { display: flex; gap: 10px; }
.metric { flex: 1; padding: 11px; background: var(--raise2); border: 0.7px solid var(--line-soft); border-radius: 14px; display: flex; flex-direction: column; gap: 3px; }
.metric-value { font-size: 13px; font-weight: 600; }
.metric-label { font-size: 9px; color: var(--text3); }
.call-status-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text2); }
.call-status-row .ico { color: var(--accent); }
.log { display: flex; flex-direction: column; gap: 4px; background: var(--raise); border-radius: 14px; padding: 12px; }
.log-row { font-size: 11px; color: var(--text2); font-variant-numeric: tabular-nums; }
.log-row.error { color: var(--accent-bright); }

/* ---------- menu ---------- */
.menu { position: fixed; z-index: 60; background: var(--raise2); border: 0.7px solid var(--line); border-radius: 12px; padding: 5px; display: flex; flex-direction: column; min-width: 168px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.menu-item { padding: 9px 12px; border-radius: 8px; font-size: 14px; text-align: left; color: var(--text); }
.menu-item:hover { background: var(--raise); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--raise2); border: 0.7px solid var(--line); color: var(--text); font-size: 13px; font-weight: 500; padding: 11px 16px; border-radius: 12px; z-index: 80; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); animation: rise 0.22s ease; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- call layer ---------- */
#call-layer:empty { display: none; }
.incoming { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); display: grid; place-items: center; z-index: 90; }
.incoming-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px; }
.incoming-name { font-size: 24px; font-weight: 700; }
.incoming-sub { font-size: 14px; color: var(--text2); }
.incoming-actions { display: flex; gap: 40px; margin-top: 18px; }
.round-btn { width: 62px; height: 62px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; transition: transform 0.12s ease; }
.round-btn:active { transform: scale(0.94); }
.round-btn.accept { background: var(--success); }
.round-btn.end { background: var(--accent); }

.active-call { position: fixed; inset: 0; background: var(--void); display: flex; flex-direction: column; z-index: 95; }
.call-top { padding: calc(14px + env(safe-area-inset-top)) 20px 8px; }
.call-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.call-status { font-size: 12px; font-weight: 500; color: var(--text2); font-variant-numeric: tabular-nums; margin-top: 3px; }
.tiles { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 8px 10px; grid-template-columns: 1fr; }
.tiles[data-count="3"], .tiles[data-count="4"], .tiles[data-count="5"], .tiles[data-count="6"] { grid-template-columns: 1fr 1fr; }
.tile { position: relative; background: var(--raise2); border: 0.7px solid var(--line); border-radius: 22px; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 0; }
.tile.speaking { border-color: rgba(240, 74, 96, 0.7); border-width: 1.4px; }
.tile-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-name { position: absolute; left: 12px; bottom: 12px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, 0.4); padding: 5px 10px; border-radius: 20px; }
.call-error { align-self: center; font-size: 12px; font-weight: 500; color: var(--accent-bright); background: rgba(240, 74, 96, 0.12); padding: 9px 14px; border-radius: 20px; }
.call-preview { align-self: center; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; color: var(--text2); }
.call-controls { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
.control { width: 54px; height: 54px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text); background: rgba(255, 255, 255, 0.06); border: 0.7px solid var(--line); transition: transform 0.12s ease; }
.control:active { transform: scale(0.94); }
.control.active { background: var(--text); color: var(--void); border-color: transparent; }
.control.end { background: var(--accent); color: #fff; border-color: transparent; width: 60px; height: 60px; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .thread { display: none; }
  .shell.viewing-thread .rail { display: none; }
  .shell.viewing-thread .thread { display: flex; }
  .icon-btn.back { display: inline-flex; }
  .msg-col { max-width: 82%; }
  .msg-actions { opacity: 1; }
}
