:root {
  color-scheme: dark;
  --bg: #12110f;
  --panel: #1b1916;
  --panel-2: #24211c;
  --line: #3a342c;
  --text: #f4efe6;
  --muted: #a39888;
  --accent: #e2a45a;
  --accent-ink: #2a1c0c;
  --danger: #e07a68;
  --ok: #8fbf78;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(226, 164, 90, 0.16), transparent 60%),
    var(--bg);
}
.card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.brand-mark {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.brand-mark strong { font-size: 28px; letter-spacing: -0.04em; }
.brand-mark span, .muted { color: var(--muted); }
.seal {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button, .ghost, .icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}
.tabs button[aria-selected="true"], .primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.primary { border-radius: 999px; padding: 10px 14px; font-weight: 650; }
label { display: block; margin: 12px 0; }
label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
textarea { resize: vertical; min-height: 74px; }
.error { color: var(--danger); }
.shell {
  height: 100%;
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 0;
}
.sidebar, .main { min-height: 0; }
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.side-head, .topbar, .composer, .me, .call-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.side-head { justify-content: space-between; }
.side-head h1 { font-size: 18px; margin: 0; letter-spacing: -0.04em; }
.channels { overflow: auto; padding: 8px; flex: 1; }
.section-label {
  margin: 14px 8px 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.channel-row { display: flex; align-items: center; gap: 4px; }
.channel-row .channel { flex: 1; }
.channel, .member, .voice-person {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.channel[aria-current="true"], .channel:hover, .member:hover { background: var(--panel-2); }
.channel small { color: var(--muted); }
.voice-people { margin: 0 0 8px 18px; }
.voice-person { color: var(--muted); padding: 4px 8px; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(143, 191, 120, 0.15);
}
.dot.off { background: #6d675f; box-shadow: none; }
.me { border-bottom: 0; border-top: 1px solid var(--line); margin-top: auto; }
.me .who { flex: 1; min-width: 0; }
.me strong, .topbar strong { display: block; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { justify-content: space-between; }
.stage { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px 8px; }
.log { display: flex; flex-direction: column; gap: 14px; }
.msg { display: grid; grid-template-columns: 36px 1fr; gap: 10px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #3c3328;
  color: var(--accent);
  font-weight: 700;
}
.msg header { display: flex; gap: 8px; align-items: baseline; }
.msg header em, .role { color: var(--muted); font-style: normal; font-size: 12px; }
.role { border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; }
.msg p { margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.files img, .files video { max-width: min(420px, 100%); border-radius: 12px; background: #000; }
.files a.file {
  display: inline-flex;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.delete {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.composer { border-top: 1px solid var(--line); border-bottom: 0; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 46px; max-height: 160px; }
.progress { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 0 14px 10px; }
.progress span { display: block; height: 100%; background: var(--accent); width: 0; }
.call-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 180px;
  position: relative;
  overflow: hidden;
}
.tile video { width: 100%; height: 220px; object-fit: cover; background: #090807; display: block; }
.tile .name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  padding: 4px 8px;
}
.tile .placeholder {
  height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.call-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.call-actions button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.in-call {
  margin-left: auto;
  color: var(--muted);
  background: transparent;
  border: 0;
}
.drawer-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  justify-content: end;
}
.drawer {
  width: min(420px, 100%);
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 18px;
  overflow: auto;
}
.person-row, .invite-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.empty { color: var(--muted); padding: 24px 0; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { max-height: 42vh; }
}
