/* ─────────────────────────────────────────────────────────────
   AutomatizaIA Panel — Design System
   Dark tech aesthetic | Cyan/green accent | Syne + DM Sans
───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&family=DM+Mono:wght@400;500&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:        #0a0c10;
  --bg-2:      #0f1218;
  --bg-3:      #151922;
  --bg-4:      #1c2130;
  --border:    #1e2535;
  --border-2:  #2a3347;
  --cyan:      #00e5c8;
  --cyan-dim:  #00b09a;
  --green:     #00c896;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --text:      #e8eaf0;
  --text-2:    #8892a4;
  --text-3:    #555f72;
  --sidebar-w: 220px;
  --sidebar-collapsed: 60px;
  --topbar-h:  60px;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --glow-cyan: 0 0 20px rgba(0,229,200,.15);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
code { font-family: 'DM Mono', monospace; font-size: .85em; }
button { cursor: pointer; border: none; background: none; }

/* ── Layout ─────────────────────────────────────────────────── */
.app-root {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.app-root.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
.app-root.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 14px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 16px;
  color: var(--bg);
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 15px;
  color: var(--text);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: all .15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav-item.router-link-active {
  background: rgba(0,229,200,.08);
  color: var(--cyan);
  border: 1px solid rgba(0,229,200,.2);
}
.nav-icon { flex-shrink: 0; display: flex; }
.nav-label { font-size: 13.5px; font-weight: 500; }

.sidebar-status {
  padding: 10px 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.status-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  text-transform: capitalize;
  color: var(--text-3);
}
.status-pill.online  { color: var(--green); }
.status-pill.offline { color: var(--red); }
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-label { white-space: nowrap; }

.sidebar-toggle {
  margin: 8px;
  padding: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.sidebar-toggle:hover { color: var(--cyan); border-color: var(--cyan); }

/* ── Main ────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.page-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 18px;
  color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

.btn-refresh {
  padding: 7px; border-radius: 6px;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-2);
  display: flex; align-items: center;
  transition: all .15s;
}
.btn-refresh:hover { color: var(--cyan); border-color: var(--cyan); }

.btn-logout {
  padding: 6px 14px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-2);
  font-size: 13px;
  transition: all .15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.page-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn-primary:hover { opacity: .9; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary.sm { padding: 6px 12px; font-size: 12.5px; }
.btn-primary.lg { padding: 12px 28px; font-size: 15px; }

.btn-outline {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all .15s;
}
.btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-outline.sm { padding: 5px 10px; font-size: 12px; }

.btn-ghost {
  padding: 6px 12px;
  background: transparent;
  color: var(--text-2); font-size: 12.5px;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }
.btn-ghost.sm { padding: 4px 8px; }

.btn-danger {
  padding: 6px 12px;
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--red);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  transition: all .15s;
}
.btn-danger:hover { background: rgba(239,68,68,.2); }
.btn-danger.sm { padding: 5px 10px; font-size: 12px; }

/* ── Cards ───────────────────────────────────────────────────── */
.section-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}
.section-desc { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header .section-title { margin-bottom: 0; }

/* ── Forms ───────────────────────────────────────────────────── */
.field-group { margin-bottom: 14px; }
.field-group label {
  display: block; font-size: 12.5px;
  color: var(--text-2); font-weight: 500;
  margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .15s;
  outline: none;
}
.field-group input:focus,
.field-group textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,229,200,.08);
}
.field-group input::placeholder { color: var(--text-3); }
.field-group.error input { border-color: var(--red); }
.field-hint  { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.field-error { display: block; font-size: 12px; color: var(--red); margin-top: 4px; }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 40px; }
.toggle-pwd {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  font-size: 14px; cursor: pointer; opacity: .6;
}
.toggle-pwd:hover { opacity: 1; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

/* ── Tables ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 8px 12px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-3); color: var(--text); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge.open    { background: rgba(0,229,200,.12); color: var(--cyan); }
.badge.resolved{ background: rgba(0,200,150,.12); color: var(--green); }
.badge.pending { background: rgba(245,158,11,.12); color: var(--amber); }
.badge.close   { background: rgba(239,68,68,.12); color: var(--red); }

/* ── Skeletons ───────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
.skeleton-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.skeleton-lines { flex: 1; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.w-8  { width: 32px; } .w-10 { width: 40px; } .w-12 { width: 48px; }
.w-24 { width: 96px; } .w-28 { width: 112px; } .w-32 { width: 128px; }
.w-40 { width: 160px; } .w-48 { width: 192px; }
.h-2  { height: 8px; } .h-3  { height: 12px; } .h-8  { height: 32px; }
.h-10 { height: 40px; } .h-12 { height: 48px; }
.rounded-full { border-radius: 50%; } .rounded { border-radius: var(--radius-sm); }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mx-auto { margin-left: auto; margin-right: auto; display: block; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-3); font-size: 13px;
}
.empty-state p { margin-bottom: 4px; }
.empty-icon { font-size: 32px; margin-bottom: 12px; }

/* ── Notification ────────────────────────────────────────────── */
.notification {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  max-width: 360px;
}
.notification.success { border-color: rgba(0,229,200,.4); }
.notification.error   { border-color: rgba(239,68,68,.4); }
.notification.info    { border-color: rgba(245,158,11,.4); }
.notif-icon { font-size: 14px; }
.notif-enter-active, .notif-leave-active { transition: all .25s ease; }
.notif-enter-from { opacity: 0; transform: translateX(20px); }
.notif-leave-to   { opacity: 0; transform: translateX(20px); }

/* ── Transitions ─────────────────────────────────────────────── */
.fade-enter-active, .fade-leave-active { transition: opacity .2s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* ── Two-col layout ──────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ── Avatar ──────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 13px;
  color: var(--bg);
  flex-shrink: 0;
}
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }

/* ── Link more ───────────────────────────────────────────────── */
.link-more { font-size: 12.5px; color: var(--cyan); }

/* ═══════════════════════════════════════════════════════════════
   PAGE — LOGIN
═══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-bg {
  position: fixed; inset: 0; pointer-events: none;
}
.grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,229,200,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,200,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}
.glow-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); pointer-events: none;
}
.orb-1 {
  width: 400px; height: 400px;
  background: rgba(0,229,200,.06);
  top: -100px; right: -100px;
}
.orb-2 {
  width: 300px; height: 300px;
  background: rgba(0,200,150,.05);
  bottom: -80px; left: -80px;
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), var(--glow-cyan);
}
.login-brand {
  text-align: center; margin-bottom: 32px;
}
.brand-hex {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border-radius: 14px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 26px;
  color: var(--bg);
  box-shadow: 0 0 30px rgba(0,229,200,.3);
}
.login-brand h1 {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800;
  color: var(--text); margin-bottom: 4px;
}
.login-brand p { font-size: 13px; color: var(--text-2); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.btn-login {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: var(--bg); border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 15px;
  border: none; cursor: pointer;
  transition: opacity .15s, transform .1s;
  display: flex; align-items: center; justify-content: center;
}
.btn-login:hover { opacity: .9; }
.btn-login:disabled { opacity: .5; cursor: not-allowed; }
.btn-login.loading { pointer-events: none; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-footer {
  text-align: center; margin-top: 24px;
}
.version-tag {
  font-size: 11px; color: var(--text-3);
  font-family: 'DM Mono', monospace;
}

/* ═══════════════════════════════════════════════════════════════
   PAGE — DASHBOARD
═══════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 16px;
}
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .2s;
  position: relative; overflow: hidden;
}
.stat-card:hover { border-color: var(--border-2); }
.stat-icon { display: flex; }
.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 26px; font-weight: 800;
  color: var(--text);
  display: flex; align-items: center;
}
.stat-label { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.stat-bar   { height: 3px; border-radius: 2px; margin-top: 6px; }
.stat-fill  { height: 100%; border-radius: 2px; transition: width .5s ease; }

.services-row {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.svc-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 160px;
}
.svc-card.online  { border-color: rgba(0,229,200,.2); }
.svc-card.offline { border-color: rgba(239,68,68,.2); }
.svc-indicator {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.svc-card.online  .svc-indicator { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.svc-card.offline .svc-indicator { background: var(--red); }
.svc-name  { font-size: 13px; font-weight: 500; text-transform: capitalize; }
.svc-state { font-size: 11.5px; color: var(--text-2); }

.activity-list { display: flex; flex-direction: column; gap: 1px; }
.activity-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.activity-item:hover { background: var(--bg-3); }
.activity-body { flex: 1; min-width: 0; }
.activity-name {
  font-size: 13.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.activity-phone { font-size: 11.5px; color: var(--text-2); margin-left: 8px; font-family: 'DM Mono', monospace; }
.activity-preview { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.activity-time { font-size: 11px; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════
   PAGE — WHATSAPP
═══════════════════════════════════════════════════════════════ */
.wa-status-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
}
.wa-status-banner.connected {
  background: rgba(0,229,200,.06);
  border: 1px solid rgba(0,229,200,.2);
  color: var(--cyan);
}
.wa-status-banner.disconnected {
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
  color: var(--red);
}
.wa-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.banner-actions { margin-left: auto; }

.qr-area {
  min-height: 220px; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg-3);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
  margin: 16px 0;
}
.qr-placeholder { text-align: center; color: var(--text-2); padding: 30px; }
.qr-icon { font-size: 36px; margin-bottom: 12px; }
.qr-placeholder p { font-size: 13px; }
.qr-connected { text-align: center; color: var(--green); padding: 30px; }
.connected-check {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(0,200,150,.15);
  border: 2px solid var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin: 0 auto 12px;
}
.qr-connected p { font-size: 13.5px; font-weight: 500; }
.instance-name { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.qr-image { width: 200px; height: 200px; border-radius: 8px; }
.qr-hint { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-2); }

.config-form { margin-top: 8px; }
.new-instance-form {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.new-instance-form input { flex: 1; padding: 7px 10px; font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════
   PAGE — CONVERSATIONS
═══════════════════════════════════════════════════════════════ */
.conversations-toolbar {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.filter-tabs { display: flex; gap: 4px; }
.tab-btn {
  padding: 6px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px; color: var(--text-2);
  transition: all .15s;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active {
  background: rgba(0,229,200,.1);
  border-color: rgba(0,229,200,.3);
  color: var(--cyan);
}
.search-box input {
  padding: 7px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text); font-size: 13px;
  width: 220px; outline: none;
}
.search-box input:focus { border-color: var(--cyan); }

.conversations-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  height: calc(100vh - 160px);
}
@media (max-width: 900px) { .conversations-layout { grid-template-columns: 1fr; } }

.conv-list {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
}
.conv-list-inner { padding: 8px; }
.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.conv-item:hover { background: var(--bg-3); }
.conv-item.active { background: rgba(0,229,200,.06); border: 1px solid rgba(0,229,200,.15); }
.conv-body { flex: 1; min-width: 0; }
.conv-name { font-size: 13.5px; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-time { font-size: 11px; color: var(--text-3); }

.messages-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.messages-empty {
  flex: 1; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-3);
}
.messages-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.contact-info { flex: 1; }
.contact-name  { font-size: 14px; font-weight: 600; }
.contact-phone { font-size: 12px; color: var(--text-2); font-family: 'DM Mono', monospace; }
.header-actions { margin-left: auto; }

.messages-body {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex;
  flex-direction: column; gap: 8px;
}
.msgs-loading { text-align: center; color: var(--text-3); padding: 20px; }
.msg-bubble {
  max-width: 75%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  padding: 9px 13px;
  align-self: flex-start;
}
.msg-bubble.outgoing {
  background: rgba(0,229,200,.06);
  border-color: rgba(0,229,200,.15);
  align-self: flex-end;
  border-radius: 12px 12px 4px 12px;
}
.msg-content { font-size: 13.5px; line-height: 1.5; }
.msg-time { font-size: 10.5px; color: var(--text-3); margin-top: 4px; text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   PAGE — AGENTS
═══════════════════════════════════════════════════════════════ */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.agent-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: border-color .2s;
}
.agent-card:hover { border-color: var(--border-2); }
.agent-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 18px;
  color: var(--bg);
  margin: 0 auto 12px;
}
.agent-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.agent-email { font-size: 11.5px; color: var(--text-2); margin-bottom: 8px; word-break: break-all; }
.agent-role  { margin-bottom: 8px; }
.agent-availability {
  display: flex; align-items: center; justify-content: center;
  gap: 5px; font-size: 11.5px; text-transform: capitalize;
}
.agent-availability.online  { color: var(--green); }
.agent-availability.offline { color: var(--text-3); }
.agent-availability .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* ═══════════════════════════════════════════════════════════════
   PAGE — AUTOMATION
═══════════════════════════════════════════════════════════════ */
.loading-rows { display: flex; flex-direction: column; }
.test-result {
  margin-top: 14px; padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.test-result.ok   { background: rgba(0,229,200,.08); border: 1px solid rgba(0,229,200,.2); color: var(--cyan); }
.test-result.fail { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2);  color: var(--red); }

/* ═══════════════════════════════════════════════════════════════
   PAGE — SETTINGS
═══════════════════════════════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.connection-badge {
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.connection-badge.ok   { background: rgba(0,229,200,.1); color: var(--cyan); }
.connection-badge.fail { background: rgba(239,68,68,.1);  color: var(--red); }
.settings-footer {
  margin-top: 8px; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

/* ── Scrollbars ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ── Light theme ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary:    #f0f2f5;
  --bg-secondary:  #ffffff;
  --bg-tertiary:   #e8eaed;
  --bg-sidebar:    #ffffff;
  --border-color:  #d1d5db;
  --text-primary:  #111827;
  --text-secondary:#4b5563;
  --text-muted:    #9ca3af;
  --accent:        #00b8a0;
  --accent-glow:   rgba(0,184,160,0.15);
  --shadow:        0 1px 4px rgba(0,0,0,0.12);
  --topbar-bg:     #ffffff;
}

/* ── Topbar buttons: lang + theme toggle ─────────────────── */
.btn-lang, .btn-theme {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.btn-lang:hover, .btn-theme:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.lang-flag { font-size: 14px; }
.lang-label { font-size: 11px; letter-spacing: .5px; }

/* Login controls */
.login-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.btn-lang-sm, .btn-theme-sm {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.btn-lang-sm:hover, .btn-theme-sm:hover {
  background: var(--accent);
  color: #fff;
}
