/* Nasa Team — internal chat */
:root {
  --side: #072C33;
  --side-hover: #0B3A43;
  --side-active: #0F4B56;
  --side-text: #DCEAEC;
  --side-muted: #88A9AF;
  --petrol: #0F5E6B;
  --petrol-hover: #0C4F5A;
  --amber: #F2A93B;
  --bg: #EDF2F3;
  --paper: #FFFFFF;
  --ink: #15232B;
  --muted: #5B6D75;
  --line: #D5DFE2;
  --in: #FFFFFF;
  --out: #0F5E6B;
  --out-text: #FFFFFF;
  --quote-in: #E8F0F1;
  --quote-out: rgba(255, 255, 255, .14);
  --danger: #B8402B;
  --ok: #2F8A5B;
  --focus: #F2A93B;
  --r-lg: 16px;
  --r: 10px;
  --r-sm: 6px;
  --shadow: 0 10px 30px rgba(7, 44, 51, .18);
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --side: #051E23;
    --side-hover: #0A2E35;
    --side-active: #0E3F48;
    --bg: #0C181C;
    --paper: #122328;
    --ink: #E1EBED;
    --muted: #8DA3A9;
    --line: #22393F;
    --in: #172F36;
    --out: #13707F;
    --quote-in: #1E3A42;
    --danger: #E0735E;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--petrol); }
@media (prefers-color-scheme: dark) { a { color: #6CC3CF; } }
img, video { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--paper); font-weight: 600; text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn.primary:hover { background: var(--petrol-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 6px 11px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn.on-dark { color: var(--side-muted); }
.icon-btn.on-dark:hover { background: var(--side-hover); color: #fff; }
.icon-btn.active { color: var(--petrol); }
input[type=text], input[type=search], input[type=email], input[type=password], input:not([type]), select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--paper); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--petrol); box-shadow: 0 0 0 3px rgba(15, 94, 107, .15); }
label { display: grid; gap: 5px; font-weight: 600; font-size: 14px; }
label .muted { font-weight: 400; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--petrol); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.form-error { margin: 0; padding: 9px 12px; border-radius: var(--r); background: rgba(184, 64, 43, .1); color: var(--danger); font-size: 14px; }
.notice { padding: 10px 12px; border-radius: var(--r); background: rgba(242, 169, 59, .16); }

/* ---------- avatars ---------- */
.av {
  --size: 40px; --hue: 190;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: hsl(var(--hue) 38% 38%); color: #fff;
  font-size: calc(var(--size) * .38); font-weight: 600; letter-spacing: .02em;
}
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av.group { border-radius: 30%; }
.av.group img { border-radius: 30%; }
.av .dot {
  position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 9px; min-height: 9px;
  border-radius: 50%; background: #3BC47A; border: 2px solid var(--dot-ring, var(--paper));
}
.av.sm { --size: 28px; }
.av.xs { --size: 22px; }
.av.lg { --size: 72px; }

/* ---------- layout ---------- */
.app {
  display: grid; grid-template-columns: 330px minmax(0, 1fr) auto;
  height: 100vh; height: 100dvh; overflow: hidden;
}
.side {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--side); color: var(--side-text);
  --dot-ring: var(--side);
  padding-top: env(safe-area-inset-top, 0px);
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 8px; }
.brand strong { display: block; font-size: 16.5px; line-height: 1.15; color: #fff; }
.brand span { display: block; font-size: 12.5px; color: var(--side-muted); }
.me-btn { border: 0; padding: 0; background: none; border-radius: 50%; }
.side-tools { display: flex; gap: 6px; align-items: center; padding: 4px 12px 8px 16px; }
.side-search { flex: 1; }
.side-search input {
  background: var(--side-hover); border-color: transparent; color: #fff; padding: 8px 12px;
}
.side-search input::placeholder { color: var(--side-muted); }
.side-search input:focus { border-color: var(--side-muted); box-shadow: none; }
.side-actions { display: flex; gap: 8px; padding: 0 16px 12px; }
.side-action {
  flex: 1; padding: 8px 10px; border-radius: var(--r); border: 1px solid #1D4F58;
  background: transparent; color: var(--side-text); font-weight: 600; font-size: 14px;
}
.side-action:hover { background: var(--side-hover); color: #fff; }
.conv-list { flex: 1; overflow-y: auto; padding: 2px 8px 12px; overscroll-behavior: contain; }
.conv-list::-webkit-scrollbar { width: 8px; }
.conv-list::-webkit-scrollbar-thumb { background: #1B444C; border-radius: 8px; }
.conv {
  display: flex; gap: 11px; align-items: center; width: 100%; padding: 9px 10px;
  border: 0; border-radius: 12px; background: transparent; text-align: left; color: inherit;
  position: relative;
}
.conv:hover { background: var(--side-hover); --dot-ring: var(--side-hover); }
.conv.active { background: var(--side-active); --dot-ring: var(--side-active); }
.conv.active::before {
  content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber);
}
.conv-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.conv-top, .conv-bot { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.conv-name { flex: 1; min-width: 0; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 12px; color: var(--side-muted); flex: none; }
.conv-prev { flex: 1; min-width: 0; font-size: 13.5px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-prev { color: var(--side-text); }
.conv.unread .conv-time { color: var(--amber); }
.conv .typing-txt { color: var(--amber); font-style: italic; }
.badge {
  flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--amber); color: #3A2400; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.side-empty { padding: 20px 12px; color: var(--side-muted); font-size: 14px; }
.admin-link {
  margin: 0 16px calc(12px + env(safe-area-inset-bottom, 0px)); padding: 9px 10px; border: 1px dashed #24545D;
  border-radius: var(--r); background: transparent; color: var(--side-muted); font-weight: 600; font-size: 13.5px;
}
.admin-link:hover { color: #fff; border-color: var(--side-muted); }

.main { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.empty-state { margin: auto; max-width: 400px; padding: 24px; text-align: center; color: var(--muted); }
.empty-state h1 { font-size: 21px; color: var(--ink); margin: 16px 0 6px; }
.empty-state p { margin: 0; }
.empty-state img { opacity: .9; border-radius: 14px; }

.chat { position: relative; display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--paper); border-bottom: 1px solid var(--line); z-index: 2;
}
.back-btn { display: none; }
.chat-id { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; border: 0; background: none; padding: 2px 6px; text-align: left; border-radius: var(--r); }
.chat-id-text { display: grid; min-width: 0; }
.chat-id-text strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-id-text span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-id-text span.online { color: var(--ok); }
.chat-head-actions { display: flex; gap: 2px; }
.banner { padding: 7px 14px; background: var(--amber); color: #3A2400; font-size: 13.5px; font-weight: 600; text-align: center; }

/* ---------- messages ---------- */
.messages {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px clamp(12px, 3vw, 36px) 8px; display: flex; flex-direction: column;
}
.messages > * { flex: none; }
.conv-start, .loading-older { margin: 8px auto 18px; color: var(--muted); font-size: 13px; }
.day { align-self: center; margin: 14px 0 10px; padding: 3px 12px; border-radius: 20px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; font-weight: 600; position: sticky; top: 4px; z-index: 1; }
.sys { align-self: center; max-width: 80%; margin: 6px 0; text-align: center; font-size: 13px; color: var(--muted); }
.msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; max-width: min(640px, 86%); position: relative; }
.msg.grouped { margin-top: 3px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .av { --size: 30px; }
.av-spacer { width: 30px; flex: none; }
.bubble {
  position: relative; min-width: 64px; max-width: 100%; padding: 7px 11px 6px;
  border-radius: var(--r-lg); background: var(--in); box-shadow: 0 1px 0 rgba(7, 44, 51, .06);
  overflow-wrap: anywhere;
}
.msg:not(.mine):not(.grouped) .bubble { border-bottom-left-radius: 5px; }
.msg.mine .bubble { background: var(--out); color: var(--out-text); }
.msg.mine:not(.grouped) .bubble { border-bottom-right-radius: 5px; }
.msg.mine .bubble a { color: #fff; }
.author { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; color: var(--petrol); }
@media (prefers-color-scheme: dark) { .author { color: #6CC3CF; } }
.text { white-space: pre-wrap; }
.text.jumbo { font-size: 34px; line-height: 1.2; }
.meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -3px 12px; font-size: 11.5px; color: var(--muted); line-height: 1; white-space: nowrap; }
.msg.mine .meta { color: rgba(255, 255, 255, .72); }
.ticks .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.ticks.read { color: var(--amber); }
.bubble.deleted { background: transparent; border: 1px dashed var(--line); box-shadow: none; color: var(--muted); }
.msg.mine .bubble.deleted { background: transparent; color: var(--muted); }
.msg.mine .bubble.deleted .meta { color: var(--muted); }
.bubble.media-only { padding: 4px; }
.bubble.media-only .meta { position: absolute; right: 10px; bottom: 9px; margin: 0; padding: 3px 7px; border-radius: 10px; background: rgba(0, 0, 0, .5); color: #fff; }
.bubble.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--amber); } 100% { box-shadow: 0 0 0 0 transparent; } }

.quote {
  display: block; width: 100%; margin: 2px 0 6px; padding: 5px 9px; border: 0; border-left: 3px solid var(--amber);
  border-radius: 6px; background: var(--quote-in); text-align: left; font-size: 13px; color: inherit;
}
.msg.mine .quote { background: var(--quote-out); }
.quote b { display: block; font-size: 12px; }
.quote span { display: block; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }

.imgs { display: grid; gap: 3px; margin: 0 0 4px; border-radius: 12px; overflow: hidden; }
.imgs.n2, .imgs.n4 { grid-template-columns: 1fr 1fr; }
.imgs.n3, .imgs.n5, .imgs.n6, .imgs.n7, .imgs.n8, .imgs.n9, .imgs.n10 { grid-template-columns: 1fr 1fr 1fr; }
.imgs button { padding: 0; border: 0; background: var(--line); display: block; line-height: 0; }
.imgs img { width: 100%; height: auto; max-height: 360px; object-fit: cover; display: block; }
.imgs.n1 img { max-width: 340px; }
.imgs:not(.n1) img { aspect-ratio: 1; height: 100%; }
.vid { display: block; width: 360px; max-width: 100%; max-height: 380px; border-radius: 12px; background: #000; margin-bottom: 4px; }
.aud { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; }
.aud audio { width: 260px; max-width: 100%; height: 40px; }
.aud-label { font-size: 12.5px; opacity: .8; }
.filecard {
  display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 340px; padding: 8px 10px; margin: 2px 0 4px;
  border-radius: 12px; background: var(--quote-in); color: inherit; text-decoration: none;
}
.msg.mine .filecard { background: var(--quote-out); color: #fff; }
.filecard .ext {
  flex: none; display: grid; place-items: center; width: 40px; height: 46px; border-radius: 6px;
  background: var(--petrol); color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.msg.mine .filecard .ext { background: #fff; color: var(--petrol); }
.filecard .fi { min-width: 0; flex: 1; display: grid; }
.filecard .fi b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filecard .fi span { font-size: 12px; opacity: .75; }
.filecard .ic { opacity: .75; }

.actions {
  position: absolute; top: -14px; display: none; gap: 2px; padding: 2px; z-index: 3;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.msg:not(.mine) .actions { right: -8px; transform: translateX(100%); top: auto; bottom: 4px; }
.msg.mine .actions { left: -8px; transform: translateX(-100%); top: auto; bottom: 4px; }
.actions button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: none; color: var(--muted); }
.actions button:hover { background: var(--bg); color: var(--ink); }
.actions button.danger:hover { color: var(--danger); }
.actions .ic { width: 17px; height: 17px; }
@media (hover: hover) { .msg:hover .actions { display: flex; } }
.msg.show-actions .actions { display: flex; }

.typing-line { min-height: 22px; padding: 0 clamp(14px, 3vw, 38px) 2px; font-size: 13px; color: var(--muted); font-style: italic; }
.typing-dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- composer ---------- */
.composer {
  background: var(--paper); border-top: 1px solid var(--line);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
}
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1; resize: none; max-height: 180px; min-height: 42px; padding: 10px 14px; line-height: 1.4;
  border-radius: 21px; background: var(--bg); border-color: transparent;
}
.composer textarea:focus { background: var(--paper); }
.composer .icon-btn { width: 42px; height: 42px; }
.send-btn {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%;
  background: var(--petrol); color: #fff;
}
.send-btn:hover { background: var(--petrol-hover); }
.send-btn[disabled] { opacity: .45; cursor: default; }
.ctx {
  display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 6px 6px 12px;
  border-left: 3px solid var(--amber); border-radius: 8px; background: var(--bg); font-size: 13.5px;
}
.ctx div { flex: 1; min-width: 0; }
.ctx b { display: block; font-size: 12.5px; }
.ctx span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.tray { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.chip {
  position: relative; flex: none; display: flex; align-items: center; gap: 8px; width: 190px; padding: 6px 30px 6px 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
}
.chip .thumb { width: 42px; height: 42px; flex: none; border-radius: 7px; object-fit: cover; background: var(--bg); display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.chip .ci { min-width: 0; display: grid; font-size: 12.5px; }
.chip .ci b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .ci span { color: var(--muted); }
.chip .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--bg); display: grid; place-items: center; color: var(--muted); }
.chip .rm .ic { width: 14px; height: 14px; }
.progress { height: 4px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-bottom: 8px; }
.progress span { display: block; height: 100%; width: 0; background: var(--amber); transition: width .2s; }
.rec { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 8px 0 14px; border-radius: 21px; background: rgba(184, 64, 43, .1); color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }
.rec .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.rec .grow { flex: 1; }
.rec button { border: 0; background: none; color: var(--muted); font-weight: 600; padding: 6px 10px; border-radius: 16px; }
.rec button:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
#micBtn.recording { background: var(--danger); color: #fff; }

.dropzone {
  position: absolute; inset: 10px; z-index: 20; display: grid; place-items: center;
  border: 2px dashed var(--petrol); border-radius: 18px; background: rgba(237, 242, 243, .92);
  font-size: 17px; font-weight: 700; color: var(--petrol); pointer-events: none;
}
@media (prefers-color-scheme: dark) { .dropzone { background: rgba(12, 24, 28, .92); color: #6CC3CF; border-color: #6CC3CF; } }

/* ---------- drawer ---------- */
.drawer {
  width: 340px; background: var(--paper); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; padding-top: env(safe-area-inset-top, 0px);
}
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 8px 18px; }
.drawer-head h2 { flex: 1; margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 9px 10px; border: 0; background: none; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--petrol); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; align-content: start; gap: 16px; }
.profile-card { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 8px 0; }
.profile-card h3 { margin: 8px 0 0; font-size: 18px; }
.profile-card p { margin: 0; color: var(--muted); font-size: 14px; }
.section-title { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.people { display: grid; gap: 2px; }
.person { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 10px; }
.person .pi { flex: 1; min-width: 0; display: grid; }
.person .pi b { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .pi span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 10px; background: rgba(242, 169, 59, .2); color: #8A5A0B; }
@media (prefers-color-scheme: dark) { .tag { color: var(--amber); } }
.tag.off { background: var(--bg); color: var(--muted); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.media-grid button { position: relative; padding: 0; border: 0; aspect-ratio: 1; background: var(--bg); border-radius: 6px; overflow: hidden; }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-grid .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, .25); }
.file-rows { display: grid; gap: 6px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: inherit; }
.file-row:hover { border-color: var(--muted); }
.file-row .ext { width: 34px; height: 40px; border-radius: 6px; background: var(--petrol); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; flex: none; }
.file-row .fi { min-width: 0; flex: 1; display: grid; font-size: 13px; }
.file-row .fi b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .fi span { color: var(--muted); }
.drawer-empty { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(4, 22, 26, .55);
}
.modal-card {
  width: min(460px, 100%); max-height: min(720px, calc(100dvh - 32px)); display: flex; flex-direction: column;
  background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden;
}
.modal-card.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 10px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; margin: 0; font-size: 17px; }
.modal-body { overflow-y: auto; padding: 18px 20px 20px; }
.pick-list { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; margin: 10px -6px 0; }
.pick { display: flex; align-items: center; gap: 11px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: none; text-align: left; }
.pick:hover { background: var(--bg); }
.pick .pi { flex: 1; min-width: 0; display: grid; }
.pick .pi b { font-weight: 600; }
.pick .pi span { font-size: 12.5px; color: var(--muted); }
.pick input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--petrol); }
.results { display: grid; gap: 4px; margin-top: 12px; }
.result { display: grid; gap: 2px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; text-align: left; }
.result:hover { background: var(--bg); }
.result .rt { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); }
.result .rt b { color: var(--ink); }
.result .rb { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result mark { background: rgba(242, 169, 59, .35); color: inherit; border-radius: 3px; }
.avatar-edit { display: flex; align-items: center; gap: 14px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.table-wrap { overflow-x: auto; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.users td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users tr.inactive td { opacity: .55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- lightbox & toasts ---------- */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(2, 12, 14, .94); display: grid; grid-template-rows: auto 1fr; color: #fff; }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.lb-bar .lb-name { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.lightbox .icon-btn { color: #fff; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 56px 24px; }
.lb-stage img { max-height: calc(100dvh - 90px); object-fit: contain; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-nav.prev { left: 8px; }
.lb-nav.next { right: 8px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); }
.toast { padding: 11px 14px; border-radius: 12px; background: var(--side); color: #fff; box-shadow: var(--shadow); font-size: 14px; }
.toast.err { background: var(--danger); }

/* ---------- sign-in & setup ---------- */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--side); }
.auth-card { width: min(400px, 100%); padding: 28px; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; margin: 22px 0 4px; }
.auth-card p { margin: 0 0 16px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { border-radius: 10px; }
.auth-brand strong { display: block; font-size: 17px; }
.auth-brand span { display: block; font-size: 13px; color: var(--muted); }
code { font-size: .92em; padding: 1px 5px; border-radius: 4px; background: var(--bg); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; box-shadow: var(--shadow); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 100%; }
  .main { position: fixed; inset: 0; z-index: 10; transform: translateX(100%); transition: transform .22s ease; background: var(--bg); }
  body.chat-open .main { transform: none; }
  .back-btn { display: inline-grid; }
  .drawer { width: 100%; }
  .msg { max-width: 92%; }
  .imgs.n1 img, .vid { max-width: 100%; }
  .actions { top: auto !important; bottom: -38px !important; left: auto !important; right: 0 !important; transform: none !important; }
  .msg:not(.mine) .actions { left: 38px !important; right: auto !important; }
  .msg.show-actions { margin-bottom: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
