:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --text: #e6e8ec;
  --muted: #8b93a1;
  --accent: #4f8cff;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#main { height: 100%; }

/* Layout de duas colunas */
.app {
  display: flex; height: 100vh; width: 100%;
  max-width: 1100px; margin: 0 auto;
  border: 1px solid #262b36;
}

/* Sidebar de conversas */
.sidebar {
  width: 270px; flex-shrink: 0;
  background: var(--panel); border-right: 1px solid #262b36;
  display: flex; flex-direction: column;
}
.sidebar--wide { width: 340px; }

/* Navegação Chat / Backoffice */
.nav { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid #262b36; }
.nav__btn {
  flex: 1; padding: 8px; border: 1px solid #2b313d; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 13px;
}
.nav__btn--active { background: var(--panel-2); color: var(--text); border-color: var(--accent); }
.nav__me { flex: 1; color: var(--text); font-size: 13px; align-self: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Login por client_id (chat) */
.login { height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid #262b36;
  border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 12px;
}
.login__card h2 { margin: 0; font-size: 18px; }
.login__hint { margin: 0; color: var(--muted); font-size: 13px; }
.f {
  padding: 10px 12px; border-radius: 10px; border: 1px solid #2b313d;
  background: var(--panel-2); color: var(--text); font-size: 14px; outline: none;
}
.f:focus { border-color: var(--accent); }

/* Filtros da backoffice */
.filters { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-bottom: 1px solid #262b36; }
.filters .f {
  padding: 8px 10px; border-radius: 8px; border: 1px solid #2b313d;
  background: var(--panel-2); color: var(--text); font-size: 13px; outline: none;
}
.filters .f:focus { border-color: var(--accent); }
.filters .new-btn { margin: 4px 0 0 0; }
.new-btn {
  margin: 12px; padding: 10px 12px; border: 1px solid #2b313d; border-radius: 10px;
  background: var(--panel-2); color: var(--text); font-weight: 600; cursor: pointer;
}
.new-btn:hover { border-color: var(--accent); }
.conv-list { flex: 1; overflow-y: auto; }
.conv {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px solid #20242e;
  padding: 10px 14px; color: var(--text);
}
.conv:hover { background: #1b1f28; }
.conv--active { background: var(--panel-2); border-left: 3px solid var(--accent); }
.conv__title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv__sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Chat */
.chat { flex: 1; display: flex; flex-direction: column; background: var(--panel); min-width: 0; }
.chat__header {
  padding: 14px 18px; font-weight: 600; border-bottom: 1px solid #262b36;
  display: flex; align-items: center; gap: 10px;
}
.chat__header small { color: var(--muted); font-weight: 400; margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #35c46a; }

.chat__messages {
  flex: 1; overflow-y: auto; padding: 18px; display: flex;
  flex-direction: column; gap: 10px;
}
.msg { max-width: 82%; padding: 10px 14px; border-radius: 12px; line-height: 1.45; white-space: pre-wrap; }
.msg--user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg--bot { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 4px; }

.chat__input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #262b36; }
.chat__input input {
  flex: 1; padding: 12px 14px; border-radius: 10px; border: 1px solid #2b313d;
  background: var(--panel-2); color: var(--text); font-size: 15px; outline: none;
}
.chat__input input:focus { border-color: var(--accent); }
.chat__input button {
  padding: 0 18px; border: 0; border-radius: 10px; background: var(--accent);
  color: #fff; font-weight: 600; cursor: pointer;
}
.chat__input button:disabled { opacity: .5; cursor: default; }
