/* ── Hermes · OKU Muebles ─────────────────────────────────── */

:root {
  --bg-deep: #080c14;
  --bg-card: #0f1724;
  --bg-sidebar: #0a0f1a;
  --bg-input: #060a12;
  --border: #1a2540;
  --border-hover: #2a3a5c;
  --text: #e2e8f0;
  --text-muted: #8899b4;
  --text-dim: #5a6d8a;
  --oku-green: #4DC247;
  --oku-green-bg: #0d2a10;
  --oku-brown: #5C4535;
  --accent-blue: #3b82f6;
  --accent-purple: #7c3aed;
  --danger: #ef4444;
  --danger-bg: #2d0f0f;
  --warning: #f59e0b;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.app { display: flex; min-height: 100vh; }

.hidden { display: none !important; }

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

.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--oku-green), #3a9e35);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.brand h1 { font-size: 20px; font-weight: 700; }
.brand p  { font-size: 12px; color: var(--text-muted); }

nav { display: grid; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  width: 100%;
}

.nav-icon { font-size: 16px; width: 22px; text-align: center; }

.nav-item:hover { background: #111827; color: var(--text); border-color: var(--border-hover); }
.nav-item.active { background: #111d2e; color: #fff; border-color: var(--oku-green); font-weight: 600; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--oku-green); box-shadow: 0 0 8px var(--oku-green); }
.dot.offline { background: var(--danger); }

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

.main { flex: 1; padding: 32px 36px; overflow-y: auto; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.topbar h2 { font-size: 28px; font-weight: 700; }
.topbar p  { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.header-actions { display: flex; gap: 8px; }

/* ── Buttons ───────────────────────────────────────────── */

button { font-family: inherit; cursor: pointer; }

.btn-pill {
  background: #1a2740;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-pill:hover { background: #243450; border-color: var(--border-hover); }
.btn-pill.primary { background: var(--oku-green); color: #000; border-color: var(--oku-green); font-weight: 700; }
.btn-pill.primary:hover { background: #3db838; }

.btn-send {
  background: var(--oku-green);
  color: #000;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.btn-send:hover { transform: scale(1.08); }

/* ── Grid ──────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.layout-3col {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 18px;
}

@media (max-width: 1100px) {
  .layout-3col { grid-template-columns: 1fr; }
}

/* ── Cards ─────────────────────────────────────────────── */

.card, .status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.card h3 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h4 { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; }

.status-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-card.offline { border-color: #3d1515; }

.status-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.status-icon { font-size: 18px; }

.status-code { font-size: 28px; font-weight: 700; color: var(--text-muted); }
.status-card.offline .status-code { color: var(--danger); }

.badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: auto;
}

.badge.ok { background: var(--oku-green-bg); color: var(--oku-green); }
.badge.bad { background: var(--danger-bg); color: var(--danger); }
.badge.planned { background: #1a2740; color: var(--text-muted); }
.badge.warning { background: #2d1f00; color: var(--warning); }

/* ── Quick Actions ─────────────────────────────────────── */

.quick-actions { display: grid; gap: 8px; }

.action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  width: 100%;
}

.action-btn:hover { background: #111d2e; border-color: var(--oku-green); }

.action-icon { font-size: 24px; flex-shrink: 0; }

.action-btn strong { display: block; font-size: 14px; margin-bottom: 2px; }
.action-btn p { color: var(--text-muted); font-size: 12px; }

/* ── Mini Agents ───────────────────────────────────────── */

.mini-agent {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 2px 10px;
}

.mini-agent:last-child { border-bottom: none; }

.mini-agent .badge { grid-row: span 2; margin: 0; align-self: center; }

.mini-agent strong { font-size: 13px; text-transform: capitalize; }
.mini-agent p { font-size: 12px; color: var(--text-muted); margin: 0; grid-column: 2; }

/* ── Activity ──────────────────────────────────────────── */

.activity-feed { display: grid; gap: 8px; }

.activity-item {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.activity-item:last-child { border-bottom: none; }
.activity-item span { flex: 1; }
.activity-item small { color: var(--text-dim); font-size: 11px; }

/* ── Chat ──────────────────────────────────────────────── */

.chat-layout { display: grid; grid-template-columns: 1fr 240px; gap: 18px; height: calc(100vh - 140px); }

@media (max-width: 900px) { .chat-layout { grid-template-columns: 1fr; } .chat-sidebar { display: none; } }

.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg { display: flex; gap: 12px; max-width: 90%; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-msg.assistant .msg-avatar { background: var(--oku-green); color: #000; }
.chat-msg.user .msg-avatar { background: #334155; }

.msg-content {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.65;
}

.chat-msg.user .msg-content { background: #111d2e; border-color: var(--oku-green); }

.msg-content ul { padding-left: 18px; margin: 6px 0; }
.msg-content li { margin: 4px 0; }

.chat-input-area { padding: 14px 18px; border-top: 1px solid var(--border); }

.chat-quick-btns { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

.chat-quick-btns button {
  background: #1a2740;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.chat-quick-btns button:hover { background: var(--oku-green-bg); border-color: var(--oku-green); }

.chat-input-row { display: flex; gap: 10px; align-items: flex-end; }

.chat-sidebar { display: grid; gap: 14px; align-content: start; }

/* ── Inputs ────────────────────────────────────────────── */

textarea, .input, .select {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

textarea:focus, .input:focus, .select:focus { border-color: var(--oku-green); }

textarea { resize: none; }

.select { cursor: pointer; appearance: none; padding-right: 30px; }

.stat { font-size: 12px; color: var(--text-muted); padding: 4px 0; }

/* ── Agents Grid ───────────────────────────────────────── */

.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: border-color 0.15s;
}

.agent-card:hover { border-color: var(--oku-green); }

.agent-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

.agent-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  flex-shrink: 0;
}

.agent-card-head h3 { font-size: 16px; text-transform: capitalize; margin: 0; }
.agent-card-head .badge { margin: 4px 0 0; display: inline-block; }

.agent-card > p { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

.agent-capabilities { display: flex; flex-wrap: wrap; gap: 6px; }

.cap-tag {
  background: #111d2e;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Auditorías ────────────────────────────────────────── */

.audit-config { margin-bottom: 20px; }

.audit-config-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.field { display: flex; flex-direction: column; gap: 4px; }

.field label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field .input, .field .select { min-width: 180px; }

.audit-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
  gap: 12px;
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--oku-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.audit-summary { border-color: var(--oku-green); }

.finding {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.finding:last-child { border-bottom: none; }

.finding .badge { margin: 0; justify-self: start; }

.finding strong { font-size: 14px; display: block; }
.finding p { font-size: 13px; color: var(--text-muted); }

/* ── Details / Pre ─────────────────────────────────────── */

details { margin-top: 8px; }
details summary { color: var(--text-muted); cursor: pointer; font-size: 13px; }
details summary:hover { color: var(--text); }

pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  max-height: 500px;
  overflow-y: auto;
}

.muted { color: var(--text-muted); font-size: 13px; }

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 16px; }
  nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-item { flex: 1; min-width: 70px; justify-content: center; font-size: 12px; padding: 10px 8px; }
  .nav-icon { display: none; }
  .main { padding: 20px 16px; }
  .topbar h2 { font-size: 22px; }
  .audit-config-row { flex-direction: column; }
  .field .input, .field .select { min-width: 100%; }
}

/* ── Ventas: Login ─────────────────────────────────────── */

.ventas-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: 32px;
}

.ventas-login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.ventas-login-header {
  text-align: center;
  margin-bottom: 28px;
}

.ventas-login-logo {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--oku-green), #3a9e35);
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
  color: #fff;
  margin: 0 auto 16px;
}

.ventas-login-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ventas-login-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.ventas-login-form {
  display: grid;
  gap: 14px;
}

.ventas-login-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}

/* ── Ventas: Inbox Layout ──────────────────────────────── */

.inbox-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  height: calc(100vh - 180px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

@media (max-width: 900px) {
  .inbox-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: calc(100vh - 180px);
  }
}

/* ── Conversation List ─────────────────────────────────── */

.inbox-list {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.inbox-list-header h3 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.conversation-item:hover { background: #111827; }
.conversation-item.active { background: #111d2e; border-left: 3px solid var(--oku-green); }

.conv-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.conv-phone {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.conv-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conv-preview {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conv-state-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.conv-state-badge.state-ai_active      { background: #1a2740; color: var(--text-muted); }
.conv-state-badge.state-human_active   { background: var(--oku-green-bg); color: var(--oku-green); }
.conv-state-badge.state-pending_handoff { background: #2d1f00; color: var(--warning); }
.conv-state-badge.state-idle           { background: #1a1a2e; color: var(--text-dim); }

.unread-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 999px;
  padding: 0 6px;
}

/* ── Conversation Detail ───────────────────────────────── */

.inbox-detail {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
  padding: 32px;
  text-align: center;
}

.inbox-empty-icon {
  font-size: 48px;
  opacity: 0.4;
}

.inbox-detail-empty h3 {
  font-size: 18px;
  color: var(--text);
}

.inbox-detail-active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.conv-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.conv-detail-header h3 {
  font-size: 15px;
  font-weight: 600;
}

/* ── Takeover Bar ──────────────────────────────────────── */

.takeover-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.btn-takeover {
  background: var(--oku-green);
  color: #000;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-takeover:hover { background: #3db838; }
.btn-takeover:disabled { background: #1a3a18; color: #4a6a48; cursor: not-allowed; }

.btn-return {
  background: #d97706;
  color: #000;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-return:hover { background: #b65f04; }

.state-indicator {
  font-size: 13px;
  color: var(--text-muted);
}

.state-indicator.human { color: var(--oku-green); }
.state-indicator.idle { color: var(--text-dim); }

/* ── Message List ──────────────────────────────────────── */

.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.55;
}

.message-bubble.customer {
  align-self: flex-start;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.message-bubble.seller {
  align-self: flex-end;
  background: var(--oku-green-bg);
  border: 1px solid var(--oku-green);
}

.message-bubble.ai {
  align-self: center;
  background: #1a1a2e;
  border: 1px solid #2a2a4e;
  text-align: center;
  max-width: 85%;
}

.msg-sender {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.message-bubble.seller .msg-sender { color: var(--oku-green); }
.message-bubble.ai .msg-sender     { color: var(--accent-purple); }

.msg-text {
  color: var(--text);
  word-break: break-word;
}

.msg-time {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  text-align: right;
}

.message-bubble.ai .msg-time { text-align: center; }

/* ── Reply Box ─────────────────────────────────────────── */

.reply-box {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-input);
}

.reply-box textarea {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 120px;
}

.reply-box textarea:focus {
  border-color: var(--oku-green);
}
/* ═══════════════════════════════════════════════════════════
   HERMES v2 — Dashboard & Chat Improvements
   ═══════════════════════════════════════════════════════════ */

/* ── Stats Row (Dashboard) ─────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--oku-green); }

.stat-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card-icon.green  { background: var(--oku-green-bg); }
.stat-card-icon.blue   { background: #0d1b3e; }
.stat-card-icon.purple { background: #1a0d3e; }
.stat-card-icon.amber  { background: #2d1f00; }

.stat-info { display: flex; flex-direction: column; }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Loading Dots Animation ────────────────────────────── */

.chat-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  max-width: 90%;
}

.loading-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--oku-green);
  animation: dotBounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.loading-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Copy Button ───────────────────────────────────────── */

.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}

.btn-copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-copy:hover {
  background: #1a2740;
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-copy.copied {
  background: var(--oku-green-bg);
  color: var(--oku-green);
  border-color: var(--oku-green);
}

/* ── Markdown Content Styles ───────────────────────────── */

.msg-content h1, .msg-content h2, .msg-content h3 {
  font-size: 1.1em;
  font-weight: 700;
  margin: 12px 0 6px;
  color: #fff;
  line-height: 1.3;
}

.msg-content h1 { font-size: 1.25em; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.msg-content h2 { font-size: 1.15em; }
.msg-content h3 { font-size: 1.05em; color: var(--oku-green); }

.msg-content p { margin: 6px 0; }

.msg-content strong { color: #fff; font-weight: 700; }

.msg-content em { color: var(--text-muted); }

.msg-content code {
  background: #0d1520;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.88em;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: var(--oku-green);
}

.msg-content pre {
  background: #0a0f18;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 10px 0;
}

.msg-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

.msg-content ul, .msg-content ol {
  padding-left: 20px;
  margin: 8px 0;
}

.msg-content li { margin: 4px 0; line-height: 1.5; }

.msg-content blockquote {
  border-left: 3px solid var(--oku-green);
  padding: 6px 14px;
  margin: 10px 0;
  background: #0a120d;
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  font-style: italic;
}

.msg-content a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg-content a:hover { color: #60a5fa; }

.msg-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}

.msg-content th {
  background: #0d1520;
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

.msg-content td {
  border: 1px solid var(--border);
  padding: 6px 12px;
  color: var(--text-muted);
}

/* ── Chat Header Actions ───────────────────────────────── */

.chat-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Activity Timeline ─────────────────────────────────── */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  margin-top: 2px;
}

.timeline-dot.green  { background: var(--oku-green-bg); color: var(--oku-green); }
.timeline-dot.blue   { background: #0d1b3e; color: var(--accent-blue); }
.timeline-dot.purple { background: #1a0d3e; color: var(--accent-purple); }
.timeline-dot.amber  { background: #2d1f00; color: var(--warning); }

.timeline-content { flex: 1; min-width: 0; }

.timeline-content p {
  font-size: 13px;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
}

.timeline-content small {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

/* ── Chat Input Improvements ───────────────────────────── */

.chat-input-row textarea {
  min-height: 44px;
  max-height: 150px;
  overflow-y: auto;
  line-height: 1.5;
}

.char-count {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
}

/* ── Improved Message Bubbles ──────────────────────────── */

.chat-msg.assistant .msg-content {
  line-height: 1.7;
  font-size: 14px;
}

.chat-msg.user .msg-content {
  font-weight: 500;
}

/* ── Chat Welcome Screen ───────────────────────────────── */

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 16px;
}

.chat-welcome-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--oku-green), #3a9e35);
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 28px;
  color: #fff;
}

.chat-welcome h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.chat-welcome p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
}

/* ── Agent Selector Improvement ────────────────────────── */

.chat-sidebar .card {
  padding: 16px;
}

.chat-sidebar .card h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* ── Quick Buttons Improved ────────────────────────────── */

.chat-quick-btns button {
  font-weight: 500;
  transition: all 0.2s;
}

.chat-quick-btns button:hover {
  transform: translateY(-1px);
}

/* ── Responsive Chat ───────────────────────────────────── */

@media (max-width: 900px) {
  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 200px);
  }
  .chat-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .chat-messages { padding: 14px; }
  .chat-msg { max-width: 95%; }
  .chat-quick-btns { gap: 6px; }
  .chat-quick-btns button {
    font-size: 11px;
    padding: 5px 10px;
  }
}
/* ═══════════════════════════════════════════════════════════
   HERMES v2 — Mobile & Advanced Search Improvements
   ═══════════════════════════════════════════════════════════ */

/* ── Mobile Sidebar (Hamburger Menu) ──────────────────── */

.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 998;
}

.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .mobile-nav-toggle { display: flex; }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    z-index: 999;
    width: 280px;
    transition: left 0.25s ease;
    padding-top: 60px;
    height: 100vh;
    overflow-y: auto;
  }

  .sidebar.open { left: 0; }

  .main {
    padding: 16px;
    padding-top: 56px;
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    gap: 8px;
  }

  .topbar h2 { font-size: 20px; }

  .header-actions, .chat-header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .header-actions .btn-pill, .chat-header-actions .btn-pill {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 12px;
    padding: 8px 12px;
  }

  /* Stats row: 2 columns */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 14px; gap: 10px; }
  .stat-card-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 10px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }

  /* Grid: single column for status cards */
  .grid { grid-template-columns: 1fr; gap: 8px; }

  /* 3-col layout: stack */
  .layout-3col { grid-template-columns: 1fr; gap: 12px; }

  /* Cards */
  .card, .status-card { padding: 14px; border-radius: var(--radius); }
  .card h3 { font-size: 15px; margin-bottom: 10px; }

  /* Quick actions */
  .action-btn { padding: 12px 14px; }
  .action-btn strong { font-size: 13px; }
  .action-btn p { font-size: 11px; }

  /* Agents grid */
  .agents-grid { grid-template-columns: 1fr; gap: 10px; }
  .agent-card { padding: 16px; }
  .agent-card-head h3 { font-size: 14px; }

  /* Activity timeline */
  .timeline-item { padding: 8px 0; }
  .timeline-dot { width: 18px; height: 18px; font-size: 9px; }
  .timeline-content p { font-size: 12px; }
  .timeline-content small { font-size: 10px; }
}

/* ── Mobile Chat ──────────────────────────────────────── */

@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 120px);
  }

  .chat-sidebar { display: none; }

  .chat-messages { padding: 12px; gap: 12px; }

  .chat-msg { max-width: 95%; }

  .chat-msg .msg-avatar {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .msg-content {
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.55;
  }

  .chat-msg.assistant .msg-content {
    font-size: 13px;
    line-height: 1.6;
  }

  .msg-content h1 { font-size: 1.1em; }
  .msg-content h2 { font-size: 1.05em; }
  .msg-content h3 { font-size: 1em; }

  .chat-input-area {
    padding: 10px 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
  }

  .chat-quick-btns {
    gap: 6px;
    margin-bottom: 8px;
  }

  .chat-quick-btns button {
    font-size: 11px;
    padding: 6px 10px;
    flex: 1;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-input-row { gap: 8px; }

  .chat-input-row textarea {
    font-size: 14px;
    padding: 10px 12px;
    min-height: 42px;
  }

  .btn-send {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .char-count { font-size: 10px; }

  /* Welcome screen */
  .chat-welcome { padding: 24px 16px; }
  .chat-welcome-icon { width: 48px; height: 48px; font-size: 22px; }
  .chat-welcome h3 { font-size: 16px; }
  .chat-welcome p { font-size: 13px; }

  /* Copy button */
  .btn-copy { font-size: 10px; padding: 3px 8px; }
  .msg-actions { margin-top: 6px; }
}

/* ── Small phones (≤400px) ────────────────────────────── */

@media (max-width: 400px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card { padding: 10px 12px; gap: 8px; }
  .stat-card-icon { width: 32px; height: 32px; font-size: 14px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }

  .main { padding: 12px; padding-top: 52px; }

  .topbar h2 { font-size: 18px; }
  .topbar p { font-size: 12px; }

  .chat-layout { height: calc(100vh - 110px); }
  .chat-messages { padding: 8px; gap: 8px; }
  .chat-input-area { padding: 8px 10px; }
  .chat-quick-btns button { font-size: 10px; padding: 5px 8px; }
}

/* ── Touch-friendly improvements ──────────────────────── */

@media (hover: none) and (pointer: coarse) {
  /* Bigger touch targets for all interactive elements */
  .nav-item { min-height: 44px; }
  .btn-pill { min-height: 40px; padding: 10px 16px; }
  .btn-send { min-width: 44px; min-height: 44px; }
  .chat-quick-btns button { min-height: 36px; }
  .action-btn { min-height: 48px; }

  /* Remove hover effects on touch */
  .stat-card:hover { border-color: var(--border); }
  .chat-quick-btns button:hover { transform: none; }

  /* Add active states instead */
  .stat-card:active { border-color: var(--oku-green); }
  .chat-quick-btns button:active { background: var(--oku-green-bg); }
}

/* ── Search Command Styles ────────────────────────────── */

.search-mode-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--oku-green-bg);
  border: 1px solid var(--oku-green);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--oku-green);
  font-weight: 600;
}

.search-mode-indicator.active { display: flex; }

.search-mode-indicator .search-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--oku-green);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

/* ── Audit Config (mobile) ────────────────────────────── */

@media (max-width: 768px) {
  .audit-config-row {
    flex-direction: column;
    gap: 10px;
  }

  .field { width: 100%; }
  .field .input, .field .select { min-width: 0; width: 100%; }

  .audit-loading { padding: 32px 16px; }
  .audit-loading h3 { font-size: 16px; }

  .finding strong { font-size: 13px; }
  .finding p { font-size: 12px; }

  pre { font-size: 11px; padding: 12px; max-height: 300px; }
}

/* ── Ventas Tab (mobile) ──────────────────────────────── */

@media (max-width: 768px) {
  .ventas-login { padding: 16px; min-height: auto; }
  .ventas-login-card { padding: 24px; max-width: 100%; }
  .ventas-login-header h2 { font-size: 20px; }

  .inbox-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: calc(100vh - 180px);
    min-height: auto;
  }

  .inbox-list {
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .inbox-detail {
    min-height: 300px;
  }

  .message-bubble { max-width: 90%; font-size: 13px; }
  .message-list { padding: 10px 12px; gap: 8px; }
  .reply-box { padding: 8px 12px; }
  .reply-box textarea { font-size: 14px; min-height: 40px; }
}

/* ── Loading animations (mobile-safe) ─────────────────── */

@media (prefers-reduced-motion: reduce) {
  .loading-dots span { animation: none; opacity: 0.6; }
  .spinner { animation: none; border-top-color: var(--oku-green); }
  @keyframes dotBounce { 0%, 100% { transform: scale(0.8); opacity: 0.6; } }
}

/* ── Print styles ─────────────────────────────────────── */

@media print {
  .sidebar, .chat-input-area, .chat-quick-btns, .header-actions,
  .chat-header-actions, .btn-send, .btn-copy, .msg-actions,
  .mobile-nav-toggle, .sidebar-overlay { display: none !important; }

  .main { padding: 0; }
  .chat-messages { overflow: visible; max-height: none; }
  .msg-content { border: 1px solid #ccc; background: #fff; color: #000; }
  body { background: #fff; color: #000; }
}
/* ═══════════════════════════════════════════════════════════
   HERMES — Global Login Screen
   ═══════════════════════════════════════════════════════════ */

.global-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-deep);
  padding: 20px;
}

.global-login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.global-login-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--oku-green), #3a9e35);
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 26px;
  color: #fff;
  margin: 0 auto 20px;
}

.global-login-card h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.global-login-card > p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.global-login-form {
  display: grid;
  gap: 14px;
  text-align: left;
}

.global-login-form .field label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: block;
}

.global-login-form .input {
  font-size: 15px;
  padding: 12px 14px;
}

/* Sidebar logout button */
.sidebar-logout {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-logout button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.sidebar-logout button:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

@media (max-width: 768px) {
  .global-login-card {
    padding: 32px 24px;
    max-width: 100%;
  }
  .global-login-logo {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
  .global-login-card h2 { font-size: 20px; }
}
