:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --border: #262626;
  --text: #f2f2f0;
  --text-dim: #9a9a95;
  --terracotta: #c1652f;
  --terracotta-dim: #8a4a24;
  --green: #4a7c59;
  --red: #a34a3f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* --- Login --- */
.login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.login-card h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 10px;
  text-align: center;
}
.login-card h1 span { color: var(--terracotta); }
.login-card input {
  background: #1c1c1c;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.login-card button {
  background: var(--terracotta);
  border: none;
  border-radius: 8px;
  padding: 10px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.login-error { color: var(--red); font-size: 13px; min-height: 16px; margin: 0; }

/* --- Layout general --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; }
.topbar h1 span { color: var(--terracotta); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { color: var(--text); border-color: var(--terracotta); }

/* --- Tablero Kanban --- */
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  padding: 20px;
  overflow-x: auto;
}
.column {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 60vh;
}
.column h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin: 0 0 10px;
}
.card {
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.card:hover { border-color: var(--terracotta); }
.card .card-name { font-weight: 600; font-size: 14px; }
.card .card-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.card.dragging { opacity: 0.4; }
.column.drag-over { border-color: var(--terracotta); }

/* --- Drawer de conversacion --- */
.drawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 380px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10;
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-header h2 { margin: 0; font-size: 16px; }
.drawer-header p { margin: 4px 0 0; font-size: 12px; color: var(--text-dim); }

.drawer-fields {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-fields label {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drawer-fields input, .drawer-fields select, .drawer-fields textarea {
  background: #1c1c1c;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.neo-info {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.neo-info strong { color: var(--text); }
.neo-info .neo-summary {
  margin-top: 4px;
  padding: 8px;
  background: #1a1a1a;
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
}
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
#bot-toggle-label.on { color: var(--green); }
#bot-toggle-label.off { color: var(--terracotta); }

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--green);
  border-radius: 20px;
  transition: background 0.15s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.switch input:checked + .switch-slider {
  background: var(--terracotta);
}
.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}
.msg.lead { align-self: flex-start; background: #1c1c1c; }
.msg.bot { align-self: flex-end; background: #26201a; border: 1px solid var(--terracotta-dim); }
.msg.human { align-self: flex-end; background: var(--terracotta); color: #fff; }
.msg .msg-time { display: block; font-size: 10px; color: var(--text-dim); margin-top: 3px; }

.message-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.message-form textarea {
  flex: 1;
  background: #1c1c1c;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  color: var(--text);
  font-family: inherit;
  resize: none;
}
.message-form button {
  background: var(--terracotta);
  border: none;
  border-radius: 6px;
  padding: 0 16px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}
