@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --green: #25D366;
  --green-dark: #1ebe5d;
  --green-light: #e8faf0;
  --dark: #0f172a;
  --dark2: #1e293b;
  --gray: #64748b;
  --gray-light: #f1f5f9;
  --border: #e2e8f0;
  --white: #ffffff;
  --red: #ef4444;
  --red-light: #fef2f2;
  --yellow: #f59e0b;
  --yellow-light: #fffbeb;
  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #f8fafc;
  color: var(--dark);
  font-size: 14px;
  line-height: 1.6;
}

/* NAVBAR */
.navbar {
  background: var(--dark);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
}
.navbar-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--green);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.navbar-right a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}
.navbar-right a:hover { color: white; }

/* CONTAINER */
.container {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 24px;
}
.container-sm {
  max-width: 680px;
  margin: 28px auto;
  padding: 0 24px;
}

/* CARDS */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
}
.card-body { padding: 24px; }

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
}
.stat-card .stat-sub {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
}
.stat-card.green .stat-value { color: var(--green-dark); }
.stat-card.blue .stat-value { color: var(--blue); }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  line-height: 1;
}
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--gray-light); color: var(--dark2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-dark { background: var(--dark); color: white; }
.btn-dark:hover { background: var(--dark2); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

/* FORMS */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark2);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--dark);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(37,211,102,0.1);
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--gray); margin-top: 4px; }

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.badge-connected { background: var(--green-light); color: #166534; }
.badge-disconnected { background: var(--red-light); color: #991b1b; }
.badge-waiting_qr { background: var(--yellow-light); color: #92400e; }
.badge-starting { background: var(--blue-light); color: #1e40af; }

/* TABLE */
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 11px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
  background: var(--gray-light);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 20px;
  border-bottom: 1px solid #f8fafc;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfc; }
.table .td-name { font-weight: 600; color: var(--dark); }
.table .td-sub { font-size: 12px; color: var(--gray); margin-top: 2px; }

/* FAQ ITEMS */
.faq-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-light);
}
.faq-item:last-of-type { border-bottom: none; }
.faq-q { font-weight: 600; color: var(--dark); font-size: 13px; margin-bottom: 2px; }
.faq-a { font-size: 13px; color: var(--gray); }

/* MESSAGES */
.msg-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-light);
}
.msg-item:last-child { border-bottom: none; }
.msg-in { color: var(--dark); font-size: 13px; margin-bottom: 4px; }
.msg-in::before { content: '👤 '; }
.msg-out { color: #166534; font-size: 13px; margin-bottom: 4px; }
.msg-out::before { content: '🤖 '; }
.msg-meta { font-size: 11px; color: #94a3b8; }

/* STATUS BOX */
.status-box {
  background: var(--gray-light);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.status-icon { font-size: 48px; margin-bottom: 12px; }
.status-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.status-sub { font-size: 13px; color: var(--gray); }
.qr-wrapper { margin: 20px auto; }
.qr-wrapper img { width: 220px; height: 220px; border-radius: 12px; border: 3px solid var(--border); }

/* ALERT */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-info { background: var(--blue-light); color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: var(--green-light); color: #166534; border: 1px solid #bbf7d0; }

/* PAGE HEADER */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header p { font-size: 13px; color: var(--gray); margin-top: 2px; }

/* GRID 2 */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* LOGIN PAGE */
.login-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 44px;
  width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 48px;
  height: 48px;
  background: var(--green);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
}
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-card p { color: var(--gray); font-size: 14px; margin-bottom: 28px; }
.error-msg { background: var(--red-light); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }

/* DIVIDER */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 40px; color: var(--gray); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* CHECKBOX TOGGLE */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle-wrap input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); }
.toggle-wrap span { font-size: 13px; font-weight: 500; color: var(--dark2); }

/* INFO ROW */
.info-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-light);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .info-label { color: var(--gray); font-weight: 500; min-width: 140px; }
.info-row .info-value { color: var(--dark); font-weight: 600; }

/* PLAN BADGE */
.plan-basic { background: #f1f5f9; color: #475569; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.plan-pro { background: #eff6ff; color: #1d4ed8; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.plan-enterprise { background: #fdf4ff; color: #7e22ce; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
