:root {
  --bg:        #1a1b1e;
  --surface:   #25262b;
  --border:    #373a40;
  --muted:     #5c5f66;
  --text:      #c1c2c5;
  --bright:    #e9ecef;
  --accent:    #4dabf7;
  --ai:        #a9e34b;
  --system:    #868e96;
  --error:     #ff6b6b;
  --join:      #51cf66;
  --leave:     #ff6b6b;
  --sidebar-w: 200px;
  --input-h:   52px;
  --font:      'Menlo', 'Consolas', 'Liberation Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  overflow: hidden;
}

/* ── Layout ─────────────────────────────────────────────────── */

#app {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section {
  padding: 12px 10px 6px;
}

.sidebar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.sidebar-item {
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.sidebar-item:hover { background: var(--border); }

.sidebar-item.active {
  background: rgba(77, 171, 247, 0.15);
  color: var(--accent);
}

#member-list { flex: 1; overflow-y: auto; }
#member-list .sidebar-item { cursor: default; }
#member-list .sidebar-item:hover { background: none; }

.ai-badge {
  font-size: 10px;
  color: var(--ai);
  margin-left: 4px;
}

/* ── Main ────────────────────────────────────────────────────── */

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#topbar {
  height: 40px;
  min-height: 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}

#current-room {
  color: var(--accent);
  font-weight: 600;
}

#conn-status {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

#conn-status.connected { color: var(--join); }
#conn-status.error     { color: var(--error); }

/* ── Messages ────────────────────────────────────────────────── */

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.msg {
  display: flex;
  gap: 10px;
  padding: 2px 0;
  line-height: 1.45;
}

.msg-time {
  color: var(--muted);
  font-size: 12px;
  min-width: 44px;
  padding-top: 1px;
  user-select: none;
}

.msg-nick {
  min-width: 110px;
  max-width: 110px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-weight: 600;
}

.msg-nick.ai    { color: var(--ai); }
.msg-nick.system { color: var(--system); font-weight: 400; font-style: italic; }

.msg-content { flex: 1; word-break: break-word; color: var(--bright); }
.msg.system .msg-content { color: var(--system); font-style: italic; }

.msg-file-link {
  color: var(--accent);
  text-decoration: none;
}
.msg-file-link:hover { text-decoration: underline; }
.msg-file-size { color: var(--muted); font-size: 12px; margin-left: 6px; }

/* ── Input bar ───────────────────────────────────────────────── */

#inputbar {
  height: var(--input-h);
  min-height: var(--input-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
}

#msg-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--bright);
  font: inherit;
  padding: 8px 12px;
  outline: none;
}

#msg-input:focus { border-color: var(--accent); }
#msg-input::placeholder { color: var(--muted); }

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  padding: 6px 10px;
  line-height: 1;
}

.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

#file-input { display: none; }

/* ── Nick modal ──────────────────────────────────────────────── */

#modal h2 { color: var(--bright); font-size: 18px; font-weight: 600; }
#modal p  { color: var(--muted);  font-size: 13px; }

#modal input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--bright);
  font: inherit;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}

#modal input:focus { border-color: var(--accent); }

#modal button {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #000;
  cursor: pointer;
  font: 600 14px var(--font);
  padding: 10px;
  width: 100%;
}

#modal button:hover { opacity: .9; }
#modal-error { color: var(--error); font-size: 13px; min-height: 18px; }

/* ── Drop zone overlay ───────────────────────────────────────── */

#drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(77,171,247,.08);
  border: 2px dashed var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--accent);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 50;
}

#drop-overlay.visible { opacity: 1; }

/* ── Scrollbar ───────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* style-auth-additions.css
 * Add these rules to the bottom of style.css
 * They replace the old #modal-backdrop / #modal rules
 */

/* ── Auth modal ──────────────────────────────────────────────── */

#auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#auth-modal.hidden { display: none; }

#modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#modal h2 { color: var(--bright); font-size: 18px; font-weight: 600; }
#modal p  { color: var(--muted);  font-size: 13px; line-height: 1.5; }

#modal input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--bright);
  font: inherit;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}

#modal input:focus { border-color: var(--accent); }

#modal button {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #000;
  cursor: pointer;
  font: 600 14px var(--font);
  padding: 10px;
  width: 100%;
}

#modal button:disabled { opacity: .5; cursor: default; }
#modal button:not(:disabled):hover { opacity: .9; }

#auth-error {
  color: var(--error);
  font-size: 13px;
  min-height: 18px;
}

#auth-recovery-info {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .12em;
  padding: 14px;
  text-align: center;
  word-break: break-all;
}

#auth-alt {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

#auth-alt:hover { color: var(--text); }
