:root {
  --bg: #000000;
  --bg2: #0d0d0d;
  --panel: #151515;
  --panel2: #1c1c1c;
  --border: #2a2a2a;
  --red: #e10600;
  --red-bright: #ff2a2a;
  --green: #2ecc71;
  --text: #ffffff;
  --muted: #8a8a8a;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
#bg {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: 0; display: block; pointer-events: none;
}
#app { position: relative; z-index: 1; height: 100vh; display: flex; flex-direction: column; background: transparent; }

.welcome-img {
  width: 148px; height: 148px; object-fit: cover; border-radius: 22px;
  border: 2px solid var(--red);
  box-shadow: 0 0 34px rgba(225,6,0,.55), inset 0 0 20px rgba(0,0,0,.4);
}

.muted { color: var(--muted); font-size: 14px; }
.center-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px;
}
.logo {
  font-weight: 900; font-size: 46px; letter-spacing: 2px;
  color: var(--red-bright);
  text-shadow: 0 0 24px rgba(225,6,0,.6);
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--red-bright);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red); color: #fff; border: none; border-radius: var(--radius);
  padding: 14px 18px; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: transform .05s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn.secondary { background: var(--panel2); color: #fff; border: 1px solid var(--border); }
.btn.ghost { background: transparent; border: 1px solid var(--red); color: var(--red-bright); }
.btn.green { background: var(--green); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }

/* header + nav */
header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(13,13,13,.72); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
header.topbar .title { font-weight: 800; color: var(--red-bright); letter-spacing: 1px; }
.role-badge { font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 700; }
.role-admin { background: rgba(255,59,48,.15); color: var(--red-bright); border: 1px solid var(--red); }
.role-speaker { background: rgba(46,204,113,.15); color: var(--green); border: 1px solid var(--green); }
.role-client { background: rgba(255,255,255,.08); color: #fff; border: 1px solid var(--border); }

nav.tabs {
  display: flex; background: rgba(13,13,13,.72); border-bottom: 1px solid var(--border);
  overflow-x: auto; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
nav.tabs button {
  flex: 1; min-width: max-content; background: none; border: none; color: var(--muted);
  padding: 12px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
nav.tabs button.active { color: #fff; border-bottom-color: var(--red-bright); }

main.content { flex: 1; overflow-y: auto; padding: 16px; }

/* cards */
.card {
  background: rgba(21,21,21,.88); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.card h3 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 20px; background: var(--panel2); border: 1px solid var(--border);
  font-size: 13px; cursor: pointer; user-select: none;
}
.chip.selected { border-color: var(--red); background: rgba(225,6,0,.15); color: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

label.field { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
input.inp, textarea.inp {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); color: #fff;
  border-radius: 10px; padding: 12px; font-size: 15px; outline: none;
}
input.inp:focus, textarea.inp:focus { border-color: var(--red); }

.lang-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 22px; background: var(--panel); border: 2px solid var(--border);
  border-radius: 18px; cursor: pointer; transition: border-color .2s, transform .05s;
}
.lang-btn:active { transform: scale(.97); }
.lang-btn.selected { border-color: var(--red); background: rgba(225,6,0,.12); }
.lang-btn .flag { font-size: 46px; line-height: 1; }
.lang-btn .name { font-weight: 700; font-size: 16px; }

.status-pill { font-size: 12px; padding: 3px 9px; border-radius: 12px; font-weight: 700; }
.st-open { background: rgba(255,255,255,.1); color: #fff; }
.st-taken { background: rgba(46,204,113,.15); color: var(--green); }
.st-done { background: rgba(120,120,120,.2); color: var(--muted); }

.amount-big { font-size: 20px; font-weight: 800; color: var(--red-bright); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---------- CHAT layout ---------- */
.chat-wrap {
  display: flex; height: 100%; gap: 0;
}
.chat-main {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: #000; border-right: 1px solid var(--border);
}
.chat-side {
  width: 240px; flex-shrink: 0; background: var(--bg2); overflow-y: auto;
}
.chat-side .side-title {
  padding: 12px 14px; font-size: 13px; color: var(--muted);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg2);
}
.chat-item {
  padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.chat-item:hover { background: var(--panel); }
.chat-item.active { background: var(--panel2); border-left: 3px solid var(--red-bright); }
.chat-item .ci-top { display: flex; justify-content: space-between; align-items: center; }
.chat-item .ci-name { font-weight: 700; font-size: 14px; }
.chat-item .ci-last { font-size: 12px; color: var(--muted); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.off { background: #444; }

.chat-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; background: var(--bg2);
}
.messages { flex: 1; overflow-y: auto; padding: 12px 14px; background: #000; }
.msg { margin-bottom: 6px; max-width: 80%; }
.msg .bubble {
  display: inline-block; padding: 7px 11px; border-radius: 11px;
  background: var(--panel); color: #fff; font-size: 14.5px; line-height: 1.35;
  word-break: break-word; border: 1px solid var(--border);
}
.msg .bubble a { color: #6cb2ff; }
.msg .bubble img { max-width: 200px; border-radius: 8px; display: block; margin-top: 4px; }
.msg.mine { margin-left: auto; text-align: right; }
.msg.mine .bubble { background: #2a0d0d; border-color: var(--red); text-align: left; }
/* compact inline role tag + time */
.who-tag {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  margin-right: 6px; opacity: .85; vertical-align: 1px;
}
.who-tag.role-speaker { color: var(--green); }
.who-tag.role-admin { color: var(--red-bright); }
.who-tag.role-client { color: #cfcfcf; }
.mtime { font-size: 9px; color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.msg.r-speaker .bubble { border-left: 3px solid var(--green); }
.msg.r-admin .bubble { border-left: 3px solid var(--red-bright); }
.msg.r-client .bubble { border-left: 3px solid #6a6a6a; }

.chat-input {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--bg2);
}
.chat-input input { flex: 1; background: #000; border: 1px solid var(--border); color: #fff;
  border-radius: 20px; padding: 11px 14px; outline: none; }
.chat-input input:focus { border-color: var(--red); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--panel2); color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.icon-btn.send { background: var(--red); }

/* online monitor */
.mon-group { margin-bottom: 18px; }
.mon-group h4 { margin: 0 0 8px; font-size: 14px; }
.mon-list { display: flex; flex-direction: column; gap: 6px; }
.mon-user {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.count-badge { font-size: 12px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 12px; padding: 2px 8px; color: var(--muted); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--red); color: #fff;
  padding: 12px 18px; border-radius: 12px; z-index: 999; font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90%;
}
.toast.show { opacity: 1; }

@media (max-width: 640px) {
  .chat-side { width: 132px; }
}
