:root {
  --bg: #07111c;
  --glass: rgba(10, 16, 30, 0.66);
  --line: rgba(120, 224, 255, 0.22);
  --text: #def7ff;
  --muted: #91b4c2;
  --accent: #5ee5ff;
  --accent2: #ff48c4;
  --good: #7ef89a;
  --warn: #ffcf5b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: Inter, system-ui, sans-serif; color: var(--text); background: var(--bg); overflow: hidden; }
button, input, textarea { font: inherit; }
button {
  border: 1px solid var(--line); background: rgba(20,30,46,.75); color: var(--text); border-radius: 14px; padding: .65rem .9rem; cursor: pointer;
  box-shadow: 0 0 12px rgba(94,229,255,.08), inset 0 0 8px rgba(255,72,196,.06);
}
button:hover { transform: translateY(-1px); }
input, textarea {
  width: 100%; background: rgba(7, 12, 24, .8); border: 1px solid rgba(111,205,255,.22); color: var(--text); border-radius: 14px; padding: .8rem .95rem;
}
textarea { min-height: 120px; resize: vertical; }
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.app-shell { position: relative; z-index: 1; height: 100%; padding: 18px; }
.glass {
  background: linear-gradient(180deg, rgba(13,20,38,.76), rgba(5,9,18,.74));
  border: 1px solid var(--line); border-radius: 26px; backdrop-filter: blur(14px);
  box-shadow: 0 18px 60px rgba(0,0,0,.38), inset 0 0 40px rgba(94,229,255,.035);
}
.auth-card {
  width: min(460px, calc(100vw - 36px)); margin: 6vh auto 0; padding: 24px; display: flex; flex-direction: column; gap: 12px;
}
.tabs { display: flex; gap: 8px; }
.tabs button.active { outline: 1px solid var(--accent); }
.status-line, .muted { color: var(--muted); }
.hidden { display: none !important; }
.chat-layout { display: grid; grid-template-columns: 1.6fr .8fr; gap: 18px; height: calc(100vh - 36px); }
.left-panel, .right-panel { display: flex; flex-direction: column; min-height: 0; }
.left-panel { padding: 14px; }
.right-panel { padding: 14px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.title { font-size: 1.15rem; font-weight: 700; }
.chat-header { padding: 10px 12px; border: 1px solid var(--line); border-radius: 18px; margin-bottom: 12px; }
.messages { flex: 1; overflow: auto; padding: 8px 4px 14px; display: flex; flex-direction: column; gap: 10px; }
.message {
  max-width: 82%; padding: 10px 12px; border-radius: 16px; border: 1px solid rgba(255,255,255,.08); position: relative;
}
.message.in { align-self: flex-start; background: rgba(18,26,40,.82); }
.message.out { align-self: flex-end; background: rgba(24,32,54,.88); }
.message .meta { font-size: .77rem; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.message .body { white-space: pre-wrap; word-break: break-word; }
.message.collapsed .body { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.message img.thumb { max-width: 240px; max-height: 220px; border-radius: 12px; cursor: pointer; display: block; margin-top: 8px; }
.collapse-btn { position: absolute; top: 8px; right: 8px; padding: .22rem .5rem; font-size: .8rem; }
.composer { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: rgba(20,30,46,.75); cursor: pointer; }
.contacts { overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.contact { padding: 12px; border-radius: 16px; border: 1px solid rgba(255,255,255,.08); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.contact.active { outline: 1px solid var(--accent); }
.contact .left { min-width: 0; }
.contact .name { font-weight: 600; }
.contact .sub { color: var(--muted); font-size: .83rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #5a6474; }
.dot.online { background: var(--good); box-shadow: 0 0 10px var(--good); }
.dot.hidden-status { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.invite-box { margin-bottom: 10px; padding: 12px; border-radius: 16px; border: 1px dashed var(--line); word-break: break-word; }
.preview-wrap { position: relative; width: fit-content; max-width: 220px; }
.preview-wrap img { max-width: 220px; max-height: 160px; border-radius: 16px; display: block; }
.preview-wrap button { position: absolute; top: 6px; right: 6px; }
.modal { position: fixed; inset: 0; z-index: 5; background: rgba(0,0,0,.42); display: grid; place-items: center; }
.modal-card { min-width: min(480px, 92vw); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.inline-row { display: flex; gap: 10px; align-items: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.image-modal-inner { max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.image-modal-inner img { max-width: 92vw; max-height: 82vh; border-radius: 18px; }
.console-toggle { position: fixed; left: 18px; bottom: 18px; z-index: 3; }
.console-panel { position: fixed; left: 18px; bottom: 70px; width: min(760px, calc(100vw - 36px)); height: 260px; z-index: 4; background: rgba(4,8,18,.94); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.console-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: rgba(18,25,42,.9); }
.console-panel pre { margin: 0; padding: 12px; overflow: auto; height: calc(100% - 46px); color: #9cffd7; }
@media (max-width: 980px) {
  .chat-layout { grid-template-columns: 1fr; }
  .right-panel { min-height: 240px; }
}
