:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #1c2330;
  --borde: #283040;
  --texto: #e6edf3;
  --texto-2: #8b949e;
  --ambar: #f59e0b;
  --ambar-soft: rgba(245, 158, 11, 0.15);
  --rojo: #f0616d;
  --verde: #3fb950;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", system-ui, sans-serif;
}

html,
body {
  background: transparent;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

/* La ventana es frameless: el redondeado y el borde los pone el CSS */
.ventana {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;          /* sigue al resize nativo de la ventana */
  background: var(--bg);
  border: 1px solid var(--borde);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* --- Barra superior --- */
.barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--borde);
  cursor: default;
}

.identidad {
  display: flex;
  align-items: center;
  gap: 9px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ambar-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  overflow: hidden;
}

.avatar img,
.login-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.nombre {
  font-size: 13px;
  font-weight: 600;
  color: var(--texto);
}

.estado {
  font-size: 11px;
  color: var(--verde);
  display: flex;
  align-items: center;
  gap: 5px;
}

.punto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--verde);
  display: inline-block;
}

.controles {
  display: flex;
  gap: 4px;
}

.ctrl {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--texto-2);
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s, color 0.12s;
}

.ctrl:hover {
  background: var(--bg-3);
  color: var(--texto);
}

#btn-cerrar:hover {
  background: rgba(240, 97, 109, 0.18);
  color: var(--rojo);
}

/* --- Mensajes --- */
.mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}

.mensajes::-webkit-scrollbar {
  width: 7px;
}
.mensajes::-webkit-scrollbar-thumb {
  background: var(--borde);
  border-radius: 4px;
}

.msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 13px;
  font-size: 12.5px;
  line-height: 1.5;
  word-wrap: break-word;
  user-select: text;
}

.msg.bot {
  align-self: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--borde);
  color: var(--texto);
  border-bottom-left-radius: 4px;
}

.msg.user {
  align-self: flex-end;
  background: var(--ambar);
  color: #1a1200;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.msg.cargando {
  color: var(--texto-2);
  font-style: italic;
}

.msg.error {
  border-color: rgba(240, 97, 109, 0.45);
  color: #f4a4a9;
}

.msg table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 12px;
}
.msg td {
  padding: 2px 0;
}
.msg td:last-child {
  text-align: right;
  font-weight: 600;
}
.msg .vencido {
  color: var(--rojo);
}

/* --- Entrada --- */
.entrada {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  background: var(--bg-2);
  border-top: 1px solid var(--borde);
}

#input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--borde);
  border-radius: 18px;
  padding: 8px 13px;
  color: var(--texto);
  font-size: 12.5px;
  outline: none;
  user-select: text;
}

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

#input::placeholder {
  color: var(--texto-2);
}

#btn-enviar {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--ambar);
  color: #1a1200;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s, opacity 0.12s;
}

#btn-enviar:hover {
  opacity: 0.9;
}
#btn-enviar:active {
  transform: scale(0.94);
}

/* ──────────────────────────────────────────
   Pantalla de login
────────────────────────────────────────── */
.login-ventana {
  display: flex;
  align-items: center;
  justify-content: center;
  /* height ya viene de .ventana (100%) */
}

.login-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 28px;
  width: 100%;
  max-width: 300px;
}

.login-avatar {
  font-size: 42px;
  line-height: 1;
  background: var(--ambar-soft);
  border-radius: 50%;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-titulo {
  font-size: 20px;
  font-weight: 700;
  color: var(--texto);
  text-align: center;
}

.login-sub {
  font-size: 12px;
  color: var(--texto-2);
  text-align: center;
  margin-top: -8px;
}

#login-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--texto);
  font-size: 13px;
  outline: none;
  text-align: center;
  user-select: text;
  transition: border-color 0.15s;
}

#login-input:focus {
  border-color: var(--ambar);
}

#login-input::placeholder {
  color: var(--texto-2);
}

#login-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--ambar);
  color: #1a1200;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.12s, transform 0.1s;
}

#login-btn:hover {
  opacity: 0.88;
}

#login-btn:active {
  transform: scale(0.97);
}

/* ──────────────────────────────────────────
   Chip de usuario en el header
────────────────────────────────────────── */
.chip-usuario {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--ambar-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 20px;
  padding: 2px 8px 2px 10px;
  font-size: 11px;
  color: var(--ambar);
  font-weight: 600;
  user-select: none;
  max-width: 120px;
}

#label-usuario {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#btn-cambiar-usuario {
  border: none;
  background: transparent;
  color: var(--texto-2);
  font-size: 12px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.12s;
}

#btn-cambiar-usuario:hover {
  color: var(--ambar);
}

/* Enlaces del bot en el chat */
.msg a.link-externo {
  color: var(--ambar);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.12s;
}

.msg a.link-externo:hover {
  opacity: 0.8;
}


