:root { --night: #040f12; --panel: #0a1c21; --raised: #10262c; --line: rgba(232,240,238,.12); --ink: #e8f0ee; --muted: rgba(232,240,238,.62); --action: #5b8cff; --mine: #6d28d9; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--night); color: var(--ink); font-family: "IBM Plex Sans Arabic", Geist, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif; }
html[lang=en] body { font-family: Geist, "IBM Plex Sans Arabic", -apple-system, "Segoe UI", Arial, sans-serif; }
button { font: inherit; }
a { color: var(--action); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 16px; }
.center { text-align: center; margin-top: 30vh; }
.linkish { background: none; border: 0; color: var(--action); cursor: pointer; padding: 0; text-decoration: underline; }
#app { height: 100%; }

/* linking */
.link { max-width: 760px; margin: 0 auto; padding: 48px 16px; text-align: center; }
.link .logo { width: 64px; height: 64px; border-radius: 16px; }
.link h1 { font-size: clamp(24px, 5vw, 34px); margin: 12px 0 24px; }
.link-row { display: flex; gap: 32px; align-items: center; justify-content: center; flex-wrap: wrap; text-align: start; }
.link ol { margin: 0; padding-inline-start: 22px; line-height: 2.2; font-size: 16px; max-width: 340px; }
.qr { width: 264px; height: 264px; padding: 12px; background: #fff; border-radius: 18px; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr.faded { opacity: .25; }

/* chats */
.shell { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; height: 100%; }
aside { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.side-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-head b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo-sm { width: 32px; height: 32px; border-radius: 8px; }
#list { overflow-y: auto; flex: 1; }
.chat { display: flex; gap: 10px; align-items: center; width: 100%; padding: 12px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; text-align: start; cursor: pointer; }
.chat:hover, .chat.on { background: rgba(232,240,238,.06); }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; background: #1d3b44; display: grid; place-items: center; font-weight: 700; }
.chat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-top { display: flex; gap: 8px; justify-content: space-between; }
.chat-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-top time { font-size: 12px; color: var(--muted); flex: none; }
.chat-last { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--action); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 8px; }
main { display: flex; flex-direction: column; min-height: 0; }
.pane-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 17px; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.e2e { align-self: center; font-size: 12px; color: var(--muted); background: rgba(232,240,238,.05); padding: 6px 12px; border-radius: 10px; margin: 0 0 8px; }
.row { display: flex; }
.bubble { max-width: min(70%, 520px); padding: 8px 12px 6px; border-radius: 16px; background: var(--raised); line-height: 1.6; word-wrap: break-word; }
.row.mine .bubble { background: var(--mine); }
.bubble.bare { background: none !important; padding: 0; }
.bubble time { display: block; font-size: 11px; color: var(--muted); text-align: end; margin-top: 2px; }
.bubble .text { white-space: pre-wrap; }
.photo { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.sticker { width: 150px; height: 150px; object-fit: contain; }
.opt { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
audio, video { max-width: 100%; margin-top: 6px; }
/* the typing bar */
.composer { position: relative; border-top: 1px solid var(--line); padding: 8px 12px; background: var(--panel); }
.composer .bar { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { flex: 1; min-width: 0; resize: none; max-height: 160px; background: rgba(232,240,238,.06); border: 1px solid var(--line); border-radius: 20px; color: var(--ink); font: inherit; font-size: 15.5px; line-height: 1.5; padding: 9px 14px; }
.composer textarea:focus { outline: none; border-color: var(--action); }
.icon { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; color: var(--action); font-size: 24px; line-height: 1; cursor: pointer; }
.icon:hover { background: rgba(232,240,238,.07); }
.sendbtn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--mine); color: #fff; font-size: 18px; cursor: pointer; }
.sendbtn:disabled { opacity: .4; cursor: default; }
html[dir=rtl] .sendbtn { transform: scaleX(-1); }
.bar.rec { align-items: center; gap: 10px; padding: 4px 0; }
.bar.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: pulse 1s infinite; }
.bar.rec .clock { font-variant-numeric: tabular-nums; direction: ltr; }
.bar.rec .sendbtn { margin-inline-start: auto; }
@keyframes pulse { 50% { opacity: .3; } }
.pop { position: absolute; bottom: calc(100% + 6px); inset-inline-start: 12px; background: var(--raised); border: 1px solid var(--line); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; min-width: 190px; box-shadow: 0 8px 30px rgba(0,0,0,.4); z-index: 5; }
.pop[hidden], .replybar[hidden] { display: none; }
.pop button { background: none; border: 0; color: var(--ink); text-align: start; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.pop button:hover { background: rgba(232,240,238,.07); }
.pop.stickers { display: grid; grid-template-columns: repeat(5, 64px); gap: 4px; inset-inline-start: 52px; }
.pop.stickers[hidden] { display: none; }
.pop.stickers img { width: 56px; height: 56px; object-fit: contain; }
.replybar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.replybar .quote { flex: 1; margin: 0; }
.x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; padding: 0 6px; }
.quote { display: flex; flex-direction: column; border-inline-start: 4px solid var(--action); background: rgba(91,140,255,.12); border-radius: 8px; padding: 4px 10px 5px; margin-bottom: 5px; cursor: pointer; font-size: 13.5px; line-height: 1.4; }
.row.mine .quote { border-color: rgba(255,255,255,.85); background: rgba(255,255,255,.16); }
.quote b { font-size: 13px; }
.quote span { color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row.mine .quote span { color: rgba(255,255,255,.85); }
/* a reply button beside each message, on hover */
.row { align-items: center; gap: 6px; border-radius: 10px; transition: background .4s; }
.row.mine { flex-direction: row; }
.row.theirs { flex-direction: row-reverse; justify-content: flex-start; }
.act { opacity: 0; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px; }
.row:hover .act, .act:focus { opacity: 1; }
@media (hover: none) { .act { opacity: .6; } }
.row.lit { background: rgba(91,140,255,.16); }
.tick { margin-inline-start: 5px; letter-spacing: -2px; }
.tick.read { color: #4fc3f7; }
.tick.failed { color: #f87171; font-weight: 700; letter-spacing: 0; }
.bubble.failed { outline: 1px solid #f87171; cursor: pointer; }
.e2e.warn { color: #fca5a5; }
.who { display: flex; flex-direction: column; line-height: 1.3; }
.who .status { font-size: 12.5px; color: var(--muted); }
/* polls and events */
.poll .opt { width: 100%; background: rgba(232,240,238,.05); border: 1px solid var(--line); border-radius: 10px; color: inherit; padding: 6px 10px; margin-top: 5px; cursor: pointer; text-align: start; }
.poll .opt.on { border-color: var(--action); }
.rsvps { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.rsvp { background: rgba(232,240,238,.06); border: 1px solid var(--line); color: inherit; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 13.5px; }
.rsvp.on { background: var(--action); border-color: var(--action); color: #fff; }
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .shell main { display: none; }
  .shell.chatting aside { display: none; }
  .shell.chatting main { display: flex; }
}
.pane-head { display: flex; align-items: center; gap: 10px; }
.back { display: none; background: none; border: 0; color: var(--ink); font-size: 22px; cursor: pointer; padding: 0 4px; }
@media (max-width: 720px) { .back { display: inline-block; } }
.who { flex: 1; min-width: 0; }
.calls { display: flex; gap: 2px; }
.calls .icon { font-size: 19px; }
/* translation on or off in this chat: faded when off */
.pane-head .icon.tr { font-size: 18px; }
.pane-head .icon.tr.off { opacity: .38; filter: grayscale(1); }
/* a call, over everything */
.call { position: fixed; inset: 0; z-index: 50; background: linear-gradient(#1b1530, #0f1012); display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 48px 16px 36px; color: #fff; }
.call #rv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call #lv { position: absolute; top: 16px; inset-inline-end: 16px; width: 180px; max-width: 32vw; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; transform: scaleX(-1); background: #000; z-index: 2; }
.call [hidden] { display: none !important; }
.call-info { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.call-info b { font-size: 26px; }
.call-info span { color: rgba(255,255,255,.75); font-size: 16px; }
.avatar.big { width: 112px; height: 112px; font-size: 44px; background: #2a2340; margin-bottom: 10px; }
.call-btns { position: relative; z-index: 2; display: flex; gap: 22px; }
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; color: rgba(255,255,255,.8); cursor: pointer; }
.cbtn span { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: rgba(255,255,255,.16); }
.cbtn.on span { background: #fff; }
.cbtn.red span { background: #ef4444; }
.cbtn.green span { background: #22c55e; }
.cbtn small { font-size: 12px; }

/* sheets: a new chat, sharing a contact, a poll, an event, live location */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 30; padding: 16px; }
.sheet { width: min(440px, 100%); max-height: min(640px, 92vh); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.sheet header { display: flex; align-items: center; justify-content: space-between; }
.sheet header b { font-size: 17px; }
.field { width: 100%; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); padding: 10px 12px; font: inherit; min-height: 44px; }
.field:focus { outline: 2px solid var(--action); outline-offset: 0; }
textarea.field { resize: vertical; min-height: 72px; }
.field[type=datetime-local] { color-scheme: dark; }
.people { display: flex; flex-direction: column; margin: 0 -16px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 40px; }
.check input { width: 18px; height: 18px; }
.lab { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.btn { background: var(--action); color: #fff; border: 0; border-radius: 12px; padding: 11px 16px; min-height: 44px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: var(--raised); color: var(--ink); border: 1px solid var(--line); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
details.other summary { cursor: pointer; color: var(--action); padding: 8px 0; }
details.other[open] { display: flex; flex-direction: column; gap: 8px; }
.toast { position: fixed; bottom: 24px; inset-inline: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); background: var(--raised); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; z-index: 40; }

/* live location */
.live { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.live-head { display: flex; align-items: center; gap: 8px; }
.pulse, .pin { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pulse { background: #22c55e; animation: pulse 1.6s infinite; }
.pin { background: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* the link code: time left before a new one */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-bar { width: 264px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.qr-bar i { display: block; height: 100%; background: var(--action); transition: width 1s linear; }
.qr-box > span { font-variant-numeric: tabular-nums; }

/* the owner's dashboard */
.dash { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; flex: 1; }
/* A long page scrolls; nothing in it is squeezed (a table that scrolls sideways would shrink to nothing). */
.dash > * { flex-shrink: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.who-row { display: flex; align-items: baseline; gap: 8px; }
.serial { font-variant-numeric: tabular-nums; color: var(--action); font-weight: 700; }
.ok { color: #34d399; } .bad { color: #f87171; }
.answers { margin: 0; padding-inline-start: 18px; font-size: 13px; }
.answers code { font-size: 12px; }
.table { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: var(--raised); margin-inline-start: 6px; }
.pill.bad { color: #f87171; }
#pane:has(.dash) { display: flex; flex-direction: column; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } .cards { grid-template-columns: 1fr; } }

/* PING!! */
.ping { color: #ef4444; font-weight: 900; font-size: 22px; letter-spacing: .5px; padding: 4px 2px; }
.pop .ping-item { color: #ef4444; font-weight: 700; }

/* the chat list's search and filters, and a list's colour on its chats */
.side-search { padding: 8px 12px 0; }
.side-search input { width: 100%; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); padding: 8px 12px; font: inherit; }
.filters { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; border: 0; background: var(--raised); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.fchip.on { background: color-mix(in srgb, var(--action) 22%, transparent); color: var(--ink); font-weight: 600; }
.fchip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.fchip small { color: var(--muted); font-size: 11px; }
.chat { position: relative; }
.chat.k-line::after { content: ''; position: absolute; bottom: 0; inset-inline: 72px 14px; height: 2.5px; border-radius: 2px; background: var(--k); }
.chat.k-bar::before { content: ''; position: absolute; inset-inline-start: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--k); }
.chat.k-ring .avatar { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4.5px var(--k); }
.chat.k-tint { background: color-mix(in srgb, var(--k) 11%, transparent); }
.ltag { font-style: normal; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 8px; color: var(--k); background: color-mix(in srgb, var(--k) 18%, transparent); margin-inline-start: 6px; }
.star { color: var(--muted); font-size: 12px; margin-inline-start: 4px; }
.ping-last { color: #ef4444 !important; font-weight: 700; }
.chat-top { justify-content: flex-start; align-items: center; }
.chat-top time { margin-inline-start: auto; }

/* broadcast and Rashid */
.people.picks { max-height: 240px; overflow-y: auto; margin: 0; padding: 4px 0; border: 1px solid var(--line); border-radius: 12px; }
.people.picks .check { padding: 4px 12px; }
.rashid-btn { position: fixed; inset-inline-end: 18px; bottom: 90px; width: 52px; height: 52px; border-radius: 50%; border: 0; z-index: 20;
  background: linear-gradient(135deg, #7c3aed, #2563eb); color: #fff; font-family: inherit; font-size: 22px; font-weight: 800; line-height: 1; box-shadow: 0 6px 18px rgba(0,0,0,.4); cursor: pointer; }
.notice { line-height: 1.8; font-size: 14px; }
.rlog { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; padding: 4px 0; }
.rmsg { align-self: flex-end; background: var(--raised); padding: 8px 12px; border-radius: 14px; max-width: 85%; white-space: pre-wrap; line-height: 1.6; }
.rmsg.mine { align-self: flex-start; background: var(--action); color: #fff; }

/* Groups */
.avatar.grp { background: color-mix(in srgb, var(--mine) 45%, var(--raised)); font-size: 20px; }
.bubble .from { display: block; font-size: 12.5px; margin-bottom: 2px; }
.who.tappable { cursor: pointer; }
.chat.member { cursor: default; flex-wrap: wrap; }
.chat.member .tools { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn.danger { color: #fca5a5; }
.row-field { display: flex; gap: 8px; align-items: center; }
.row-field .field { flex: 1; }
.mid { text-align: center; }
.chat.member .ltag { align-self: flex-start; margin-inline-start: 0; }

/* Groups: pinned message, settings */
.acts { display: flex; flex-direction: column; gap: 2px; align-self: center; }
#pinbar .pinned { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); cursor: pointer; }
#pinbar .pin-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#pinbar .pin-text b { font-size: 12px; color: #a78bfa; }
#pinbar .pin-text span { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.closing { margin: 0; padding: 10px 16px; font-size: 13px; line-height: 1.7; color: #fde68a; background: rgba(250, 204, 21, .08); border-radius: 12px; }
#pinbar .closing { border-radius: 0; }
.sheet h4 { margin: 14px 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.invite-code { flex: 1; font-size: 20px; font-weight: 700; letter-spacing: 3px; }
.invite-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; }
.btn.ghost.on { border-color: var(--action); color: #fff; background: color-mix(in srgb, var(--action) 30%, var(--raised)); }

/* The owner's dashboard: ID requests, and one account's page. */
.req { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.req .grow { flex: 1; min-width: 0; }
.table tr.tap { cursor: pointer; }
.table tr.tap:hover td { background: var(--raised); }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.field { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill.gold { color: #d4a72c; } .pill.grey { color: #a3a3a3; } .pill.blue { color: #60a5fa; } .pill.ok { color: #4ade80; }
/* Shields, in the colours the app draws them. */
.pill.badge-cofounder { background: #1e3a8a; color: #f2d06b; box-shadow: inset 0 0 0 1px #d4af37; }
.pill.badge-staff { background: #17181a; color: #c9cdd3; box-shadow: inset 0 0 0 1px #c9cdd3; }
.pill.badge-family { color: #f472b6; } .pill.badge-friend { color: #34d399; } .pill.badge-known { color: #a78bfa; }
.pill.badge-celebrity { color: #fb923c; } .pill.badge-gov { color: #a3a3a3; } .pill.badge-business { color: #d4a72c; }
.pill.badge-verified { color: #38bdf8; } .pill.badge-trusted { color: #2dd4bf; }
.go { color: var(--action); cursor: pointer; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.field .field-input { margin: 0; }
select.field-input.small { width: auto; padding: 6px 10px; }
@media (max-width: 760px) { .fields { grid-template-columns: 1fr 1fr; } }

/* Dashboard sections, its ← (shown on every screen size), forms and the save bar. */
.back.show { display: inline-block; }
.dash-tabs { display: flex; gap: 6px; padding: 10px 20px 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.dash-tabs .tab { background: none; border: 0; color: var(--muted); padding: 8px 12px 10px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; }
.dash-tabs .tab.on { color: var(--ink); border-bottom-color: var(--action); }
.dash-tabs .count { color: var(--action); }
.field-input { background: var(--raised); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; min-height: 42px; width: 100%; box-sizing: border-box; }
.field-input.small { width: 110px; }
.save-bar { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 6px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 6px 0; }
.tap { cursor: pointer; }
.card.tap:hover { border-color: var(--action); }
.quote { margin: 0; padding: 8px 12px; border-inline-start: 3px solid var(--line); background: var(--raised); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-line { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; max-width: 80%; align-self: flex-end; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.copy-line.mine { align-self: flex-start; background: color-mix(in srgb, var(--action) 18%, var(--panel)); }

/* ------------------------------------------------------------------ the dashboard, one system
   Tokens first; then the frame (sections in groups beside the content), the
   data list, tags, cards and forms. Later rules here replace the earlier
   dashboard ones above. */
:root {
  --ok: #34d399; --bad: #f87171; --warn: #fbbf24;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px;
  --r-s: 8px; --r-m: 12px; --r-l: 16px;
  --t-xs: 12px; --t-s: 13px; --t-m: 15px; --t-l: 18px; --t-xl: 28px;
}

/* The frame: sections in groups on the start side, the open one beside them. */
.dash-shell { flex: 1; min-height: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.dash-nav { border-inline-end: 1px solid var(--line); padding: var(--s-4) var(--s-3); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s-4); background: var(--panel); }
.dash-group { display: flex; flex-direction: column; gap: 2px; }
.dash-group-name { font-size: var(--t-xs); color: var(--muted); padding: 0 var(--s-3) var(--s-1); font-weight: 600; }
.dash-item { position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 40px; padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-s); background: none; color: var(--ink); font: inherit; font-size: var(--t-m); text-align: start; cursor: pointer; }
.dash-item:hover { background: var(--raised); }
.dash-item.on { background: color-mix(in srgb, var(--action) 16%, transparent); font-weight: 700; }
/* The one accent: a bar on the open section's edge. */
.dash-item.on::before { content: ''; position: absolute; inset-inline-start: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--action); }
.dash-item .count:empty { display: none; }
.dash-item .count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--action); color: #fff; font-size: var(--t-xs); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.dash { padding: var(--s-5); gap: var(--s-4); }
.dash > * { max-width: 1120px; width: 100%; }
@media (max-width: 900px) {
  .dash-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .dash-nav { flex-direction: row; gap: var(--s-1); padding: var(--s-2) var(--s-3); overflow-x: auto; overflow-y: hidden; border-inline-end: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .dash-nav::-webkit-scrollbar { display: none; }
  .dash-group { flex-direction: row; gap: var(--s-1); padding-inline-end: var(--s-2); border-inline-end: 1px solid var(--line); }
  .dash-group:last-child { border-inline-end: 0; }
  .dash-group-name { display: none; }
  .dash-item { white-space: nowrap; min-height: 36px; font-size: var(--t-s); }
  .dash-item.on::before { inset-inline: 10px; top: auto; bottom: 2px; width: auto; height: 2px; }
  .dash { padding: var(--s-4); }
}

/* Headings and short explanations inside a section. */
.dash-h { margin: var(--s-2) 0 0; font-size: var(--t-l); }
.card-h { margin: 0; font-size: var(--t-m); }
.lead { margin: 0; line-height: 1.7; max-width: 70ch; }
.card { border-radius: var(--r-l); padding: var(--s-4); gap: var(--s-2); }
.card.empty { color: var(--muted); }
.stat { border-radius: var(--r-l); }
.stat b { font-size: var(--t-xl); }

/* Tags: a row that wraps, never clipped. */
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-xs); line-height: 1.6; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.tags .pill, .choices .pill, .who-row .pill { margin: 0; }
.pill.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); }

/* Data lists: every column has its heading; long text wraps; numbers and times stay on one line. */
.table td { white-space: normal; vertical-align: middle; }
.table td.num, .table td.when, .table td.serial { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table th { padding: var(--s-3); }
.table td { padding: var(--s-3); }
.table tr.tap:focus-visible { outline: 2px solid var(--action); outline-offset: -2px; }
.table tr.tap:focus-visible td { background: var(--raised); }
.person { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.person .handle { font-size: var(--t-s); color: var(--muted); direction: ltr; text-align: start; }
.audit-table .detail { min-width: 220px; line-height: 1.6; }
@media (max-width: 760px) { .people-table .col-opt { display: none; } }

/* Approvals. */
.approval { gap: var(--s-2); }
.approval-what { margin: 0; font-size: var(--t-m); line-height: 1.7; }

/* Forms: a switch, a labelled number. */
.check.switch input { width: 36px; height: 20px; appearance: none; border-radius: 10px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.check.switch input::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: inset-inline-start .15s; }
.check.switch input:checked { background: var(--action); }
.check.switch input:checked::after { inset-inline-start: 18px; background: #fff; }
.num-field { display: flex; flex-direction: column; gap: var(--s-1); }
@media (prefers-reduced-motion: reduce) { .check.switch input, .check.switch input::after { transition: none; } }

/* Keyboard focus, visible on everything in the dashboard. */
.dash-shell :is(button, input, select, a, [tabindex]):focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.btn.small { min-height: 36px; }

/* With the dashboard open, it takes the whole window (the ← goes back to the chats). */
.shell:has(#pane .dash-shell) { grid-template-columns: minmax(0, 1fr); }
.shell:has(#pane .dash-shell) > aside { display: none; }
/* One line per row: the list scrolls sideways when the window is narrow. */
.table table.one-line td, .table table.one-line th { white-space: nowrap; }
.faint { color: var(--muted); opacity: .6; }
.audit-table td.what { min-width: 140px; }
.table table.one-line td, .table table.one-line th { padding: 10px; }
.table table.one-line td.name b, .table table.one-line td.clip { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.table table.one-line td.clip { display: table-cell; max-width: 130px; }
.table table.one-line td, .table table.one-line th { padding: 10px 8px; }
/* The dashboard header's language and page size, at its far end. */
.dash-tools { margin-inline-start: auto; display: flex; align-items: center; gap: var(--s-2); }
.zoom { display: flex; align-items: center; gap: 2px; }
.zoom .btn { min-width: 36px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.zoom-now { min-width: 56px !important; }
.table table.one-line td.name b { max-width: 120px; }
.table table.one-line td.clip { max-width: 110px; }
/* An account's devices: the first (its phone) shows whole; the rest, on a narrow window, in the hover. */
.table table.one-line td.devs { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1400px) { .table table.one-line td.devs { max-width: 240px; } }
/* Every list in the dashboard, laid out like the people list: one line per row, long text cut at its end (the whole of it on hover). */
.table table.one-line td.mid { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.table table.one-line td.wide { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.table table.one-line td.row-act { width: 1%; }
.table table.one-line td.row-act > * + * { margin-inline-start: 6px; }
.table table.one-line td.clip { vertical-align: middle; }
.table table.one-line td .field-input { width: 150px; min-height: 36px; padding-block: 6px; }
/* On a laptop's width the columns sit a little closer, so a whole row fits without scrolling sideways. */
@media (max-width: 1399px) {
  .table table.one-line td, .table table.one-line th { padding-inline: 5px; }
  .table table.one-line td.name b { max-width: 100px; }
  .table table.one-line td.clip { max-width: 100px; }
  .table table.one-line td.devs { max-width: 110px; }
}
/* Numbers, IDs and device names read left to right (so a long one is cut at its end, not its start); in Arabic they still line up on the right under their heading. */
[dir="rtl"] .table table.one-line td[dir="ltr"] { text-align: right; }
@media (max-width: 560px) { .zoom .zoom-now { display: none; } }
.dash-shell { grid-template-columns: 212px minmax(0, 1fr); }
@media (max-width: 900px) { .dash-shell { grid-template-columns: minmax(0, 1fr); } }
.dash > * { max-width: none; }

/* The side list's groups open and close; the open section's group starts open. */
.dash-group { gap: 2px; }
.dash-group-head { display: flex; align-items: center; gap: var(--s-2); min-height: 36px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-s);
  background: none; color: var(--muted); font: inherit; font-size: var(--t-s); font-weight: 700; cursor: pointer; text-align: start; }
.dash-group-head:hover { background: var(--raised); color: var(--ink); }
.dash-group-head > span:first-child { flex: 1; }
.dash-group-head .chev { transition: transform .15s; font-size: 14px; line-height: 1; }
/* Open, the chevron points down; closed, along the reading direction. */
.dash-group-head .chev { font-size: 0; }
.dash-group-head .chev::after { content: '⌄'; font-size: 16px; }
.dash-group:not(.open) .dash-group-head .chev::after { content: '›'; font-size: 20px; }
:root[dir=rtl] .dash-group:not(.open) .dash-group-head .chev::after { content: '‹'; }
/* A group's total shows while it is closed; open, each section shows its own. */
.dash-group.open .dash-group-head .count { display: none; }
.dash-group-head .count:empty { display: none; }
.dash-group-head .count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--action); color: #fff; font-size: var(--t-xs);
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.dash-group-items { display: flex; flex-direction: column; gap: 2px; }
.dash-group-items[hidden] { display: none; }
.dash-item { padding-inline-start: var(--s-5); }
.dash-menu { display: none; }
.to-chats { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .dash-group-head .chev { transition: none; } }

/* On a phone: one button names the open section; the list opens under it. */
@media (max-width: 900px) {
  .dash-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .dash-menu { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-2) var(--s-4) 0; min-height: 44px; padding: 0 var(--s-3);
    border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
  .dash-menu > span:nth-child(2) { flex: 1; text-align: start; }
  .dash-nav { display: none; flex-direction: column; gap: var(--s-2); overflow: visible; border: 1px solid var(--line); border-radius: var(--r-m);
    margin: var(--s-2) var(--s-4) 0; padding: var(--s-2); }
  .dash-shell.nav-open .dash-nav { display: flex; }
  .dash-group { flex-direction: column; border: 0; padding: 0; }
  .dash-item { white-space: normal; min-height: 44px; font-size: var(--t-m); }
  .dash-item.on::before { inset-inline-start: 0; inset-inline-end: auto; top: 9px; bottom: 9px; width: 3px; height: auto; }
  .pane-head .who { display: none; }
}

/* A photo that opens only on the phone, 1–3 times: the number in a ring, like the app. */
.limited { display: flex; align-items: center; gap: 10px; }
.limited-n { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-weight: 700; }
.limited.gone { color: var(--muted); }
