/* Calls (static/js/calls_inbox.js): the receiver's side of the Communication Protocol's CONNECT exchange. */
#view-calls { flex-direction: column; gap: 1rem; width: 100%; height: calc(100vh - 4.5rem); min-height: 560px; }
#calls-root { display: flex; flex-direction: column; gap: 1rem; height: 100%; min-height: 0; font-family: var(--font-sans); color: var(--text-primary); }
.rl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.rl-title { margin: 0; font-size: 1.25rem; }
.rl-sub { margin: .25rem 0 0; color: var(--text-muted); font-size: .85rem; max-width: 60ch; }
.rl-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.rl-as { display: flex; gap: .4rem; align-items: center; font-size: .8rem; color: var(--text-muted); }
.rl-as input, .rl-compose textarea {
    background: var(--bg-dark); color: var(--text-primary); border: 1px solid var(--border-color);
    border-radius: 8px; padding: .4rem .6rem; font: inherit; font-size: .85rem;
}
.rl-as input { width: 9rem; }
.rl-btn {
    background: var(--bg-panel); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 8px;
    padding: .4rem .75rem; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.rl-btn.primary { background: var(--accent); border-color: transparent; color: #04211d; }
.rl-btn:disabled { opacity: .55; cursor: default; }
/* the standalone Calls page (/comms/calls) has no global .hidden rule, so this file carries its own */
.rl-media.hidden { display: none; }
.rl-media { position: relative; background: #000; border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; }
.rl-media.voice-only { background: var(--bg-panel); }
.rl-media.voice-only video { display: none; }
#calls-remote { display: block; width: 100%; max-height: min(300px, 42vh); object-fit: contain; background: #000; }
/* With video on, the call list and the conversation keep a usable height and the panel grows (the page scrolls)
   instead of squeezing them under the video (Nathan 2026-11-01, ScreenGrab: "This gets cut off, needs to be larger"). */
#view-calls:has(.rl-media:not(.hidden):not(.voice-only)) { height: auto; }
#calls-root:has(.rl-media:not(.hidden):not(.voice-only)) .rl-body { flex: none; height: 480px; }
#calls-local { position: absolute; right: 10px; top: 10px; width: 140px; height: 105px; object-fit: cover; border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .4); background: #111; }
.rl-media-bar { display: flex; gap: .5rem; align-items: center; padding: .6rem .8rem; background: var(--bg-panel); font-size: .85rem; }
.rl-media-bar span { flex: 1; }
.rl-media-bar button[hidden] { display: none; }
.rl-body { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 1rem; flex: 1; min-height: 0; }
.rl-list, .rl-pane { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; min-height: 0; }
.rl-list { overflow-y: auto; padding: .5rem; display: flex; flex-direction: column; gap: .35rem; }
.rl-row {
    text-align: left; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: .6rem .7rem;
    color: var(--text-primary); cursor: pointer; display: flex; flex-direction: column; gap: .25rem; font: inherit;
}
.rl-row:hover { border-color: var(--border-color); }
.rl-row.on { border-color: var(--accent); background: rgba(45, 212, 191, .07); }
.rl-row.ended { opacity: .65; }
.rl-row-top { display: flex; gap: .45rem; align-items: center; font-size: .85rem; }
.rl-row-caller { font-size: .78rem; color: var(--text-primary); }
.rl-row-text { font-size: .8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-row-when { font-size: .7rem; color: var(--text-muted); }
.rl-pill { white-space: nowrap; font-size: .65rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: .1rem .45rem; }
.rl-ringing { background: rgba(34, 197, 94, .2); color: #22c55e; animation: rl-ring 1s ease-in-out infinite; }
.rl-missed { background: rgba(239, 68, 68, .18); color: #ef4444; }
.rl-connected { background: rgba(45, 212, 191, .18); color: var(--accent); }
.rl-ended { background: rgba(148, 163, 184, .18); color: var(--text-muted); }
@keyframes rl-ring { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .rl-ringing { animation: none; } }
.rl-here { font-size: .7rem; color: #22c55e; }
.rl-unread {
    margin-left: auto; min-width: 1.2rem; height: 1.2rem; border-radius: 999px; background: #ef4444; color: #fff;
    font-size: .7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 .3rem;
}
.rl-pane { display: flex; flex-direction: column; overflow: hidden; }
.rl-empty { color: var(--text-muted); font-size: .85rem; padding: 1.25rem; }
.rl-thread-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; padding: .85rem 1rem; border-bottom: 1px solid var(--border-color); }
.rl-meta { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }
.rl-link { font-size: .75rem; color: var(--accent); word-break: break-all; }
.rl-before { margin: .6rem 1rem 0; font-size: .8rem; color: var(--text-muted); }
.rl-before summary { cursor: pointer; }
.rl-before pre {
    white-space: pre-wrap; font-family: var(--font-mono); font-size: .75rem; max-height: 180px; overflow-y: auto;
    background: var(--bg-dark); border: 1px solid var(--border-color); border-radius: 8px; padding: .6rem;
}
.rl-msgs { flex: 1; overflow-y: auto; padding: .85rem 1rem; display: flex; flex-direction: column; gap: .6rem; min-height: 0; }
.rl-receipt { padding: .6rem 1rem; border-top: 1px solid var(--border-color); font-family: var(--font-mono); }
.rl-sys { align-self: center; font-size: .75rem; color: var(--text-muted); text-align: center; }
.rl-msg { max-width: 75%; display: flex; flex-direction: column; gap: .2rem; }
.rl-msg.team { align-self: flex-end; align-items: flex-end; }
.rl-by { font-size: .7rem; color: var(--text-muted); }
.rl-bubble { padding: .5rem .75rem; border-radius: 12px; font-size: .88rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.rl-msg.visitor .rl-bubble { background: var(--bg-dark); border: 1px solid var(--border-color); border-top-left-radius: 4px; }
.rl-msg.team .rl-bubble { background: rgba(245, 158, 11, .16); border: 1px solid rgba(245, 158, 11, .5); border-top-right-radius: 4px; }
.rl-compose { display: flex; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid var(--border-color); }
.rl-compose textarea { flex: 1; min-height: 2.6rem; max-height: 8rem; resize: vertical; }
#calls-badge {
    margin-left: auto; min-width: 1.2rem; height: 1.2rem; border-radius: 999px; background: #ef4444; color: #fff;
    font-size: .7rem; font-weight: 700; align-items: center; justify-content: center; padding: 0 .3rem;
}
@media (max-width: 760px) {
    .rl-body { grid-template-columns: 1fr; }
    .rl-list { max-height: 220px; }
}

/* available for calls, or Relay answers: one switch per site (calls_inbox.js paintAvailability) */
.rl-sites { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.rl-sites[hidden] { display: none; }
.rl-sites-label { font-size: .8rem; color: var(--text-muted); margin-right: .2rem; }
.rl-avail { display: inline-flex; align-items: center; gap: .4rem; border-color: rgba(148, 163, 184, .35); }
.rl-avail.on { background: rgba(34, 197, 94, .18); border-color: #22c55e; color: #22c55e; }
.rl-dot { width: .55rem; height: .55rem; border-radius: 50%; background: rgba(148, 163, 184, .6); flex: none; }
.rl-avail.on .rl-dot { background: #22c55e; }
/* drafted replies */
.rl-drafts { padding: .5rem 1rem 0; display: flex; flex-direction: column; gap: .4rem; max-height: 260px; overflow-y: auto; }
.rl-drafts-head { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--text-muted); }
.rl-link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: .75rem; padding: 0; }
.rl-draft { border: 1px dashed var(--border-color); border-radius: 10px; padding: .5rem .65rem; display: flex; flex-direction: column; gap: .35rem; }
.rl-draft-text { font-size: .85rem; line-height: 1.4; white-space: pre-wrap; }
.rl-draft-row { display: flex; gap: .4rem; justify-content: flex-end; }
.rl-drafts-none { font-size: .8rem; color: var(--text-muted); }
.rl-wants { font-size: .65rem; font-weight: 700; color: #f59e0b; text-transform: uppercase; letter-spacing: .04em; }
.rl-urgent { font-size: .65rem; font-weight: 700; color: #fff; background: #dc2626; border-radius: 4px; padding: 0 .3rem; text-transform: uppercase; letter-spacing: .04em; }
