/* ===========================================================
   meta-chatbot — design system
   Tokens, primitives, app shell, page styles.
   =========================================================== */

:root {
  --bg-canvas: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-muted: #F1F5F9;
  --bg-accent-soft: #EEF2FF;
  --border: #E2E8F0;
  --border-input: #CBD5E1;
  --border-soft: #F1F5F9;

  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-tertiary: #94A3B8;
  --text-on-accent: #FFFFFF;

  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --accent-ring: #C7D2FE;
  --accent-ring-soft: #E0E7FF;

  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;

  --messenger: #0084FF;
  --messenger-bg: #E8F4FF;
  --whatsapp: #25D366;
  --whatsapp-bg: #E8FBF0;
  --instagram: #E1306C;
  --instagram-bg: #FDE8EF;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08);

  --sidebar-w: 240px;
  --topbar-h: 64px;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ----- reset + base ----- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; margin: 0; color: var(--text-primary); }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

p { margin: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

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

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ===========================================================
   AUTH LAYOUT — centered card on canvas
   =========================================================== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-accent-soft) 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #ECFDF5 0%, transparent 55%),
    var(--bg-canvas);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
}

.auth-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.auth-card .brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, #8B5CF6 100%);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.auth-card .brand-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
}

.auth-card h1 {
  font-size: 22px;
  margin-bottom: 4px;
}
.auth-card .auth-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--text-tertiary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ===========================================================
   APP SHELL — sidebar + topbar
   =========================================================== */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
}

.sidebar {
  grid-area: sidebar;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 12px;
}
.sidebar .brand-mark {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, #8B5CF6 100%);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.sidebar .brand-name { font-weight: 600; font-size: 15px; }

.nav-section { margin-bottom: 16px; }
.nav-section .nav-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 8px 10px;
  font-weight: 600;
}
.nav-section .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  position: relative;
}
.nav-section .nav-item:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-section .nav-item.is-active {
  background: var(--bg-accent-soft);
  color: var(--accent);
}
.nav-section .nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}
.nav-section .nav-item .nav-icon {
  width: 18px; height: 18px;
  display: inline-block;
  flex-shrink: 0;
}
.nav-section .nav-item .nav-badge {
  margin-left: auto;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.nav-section .nav-item.is-active .nav-badge {
  background: var(--accent);
  color: #fff;
}

.nav-channel-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  margin-left: auto;
  flex-shrink: 0;
}
.nav-channel-dot.messenger { background: var(--messenger); }
.nav-channel-dot.whatsapp { background: var(--whatsapp); }
.nav-channel-dot.instagram { background: var(--instagram); }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border-soft); }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
}
.user-card:hover { background: var(--bg-muted); }
.user-card .avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #A5B4FC, #C4B5FD);
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.user-card .user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-card .user-name {
  font-weight: 600; font-size: 13px; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card .user-sub {
  font-size: 11px; color: var(--text-tertiary);
}

/* ----- topbar ----- */
.topbar {
  grid-area: topbar;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .breadcrumb {
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex; align-items: center; gap: 6px;
}
.topbar .breadcrumb .current { color: var(--text-primary); font-weight: 500; }

.topbar .search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar .search input {
  width: 100%;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 8px 12px 8px 36px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
}
.topbar .search input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring-soft);
}
.topbar .search::before {
  content: "";
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  background: currentColor;
  color: var(--text-tertiary);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat center / contain;
}

.topbar .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang-toggle { margin: 0; }
.lang-toggle select {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface, #fff);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.topbar .channel-status { display: flex; gap: 6px; padding: 0 8px; border-right: 1px solid var(--border); height: 24px; align-items: center; }
.topbar .channel-status .dot { width: 10px; height: 10px; border-radius: var(--radius-full); display: inline-block; }
.topbar .channel-status .dot.messenger { background: var(--messenger); }
.topbar .channel-status .dot.whatsapp { background: var(--whatsapp); }
.topbar .channel-status .dot.instagram { background: var(--instagram); }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  position: relative;
}
.icon-btn:hover { background: var(--bg-muted); color: var(--text-primary); }
.icon-btn .dot-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--danger);
  border: 2px solid var(--bg-surface);
}

/* ----- main area ----- */
.main {
  grid-area: main;
  padding: 24px 32px 48px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header .page-title { font-size: 24px; font-weight: 600; }
.page-header .page-sub { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.page-header .page-actions { display: flex; gap: 8px; }

/* ===========================================================
   PRIMITIVES — buttons, inputs, cards, pills
   =========================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-muted); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-primary); text-decoration: none; }
.btn-danger {
  background: var(--bg-surface);
  border-color: var(--danger-border);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger-bg); }
.btn-facebook {
  background: var(--messenger);
  color: #fff;
}
.btn-facebook:hover { background: #006FE6; color: #fff; text-decoration: none; }

.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* form */
.form-field { margin-bottom: 14px; }
.form-field label, .form-field > p > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-primary);
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  height: 38px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { height: auto; min-height: 88px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

/* Django {{ form.as_p }} renders <p><label>…<input /></p> — give it a sensible look. */
form p { margin: 0 0 14px; }
form p label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }

/* card */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* pill / tag */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-secondary);
  line-height: 1.6;
}
.pill .pill-dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-accent { background: var(--bg-accent-soft); color: var(--accent); }
.pill-messenger { background: var(--messenger-bg); color: var(--messenger); }
.pill-whatsapp { background: var(--whatsapp-bg); color: var(--whatsapp); }
.pill-instagram { background: var(--instagram-bg); color: var(--instagram); }

/* alerts */
.alert {
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 16px;
}
.alert.success { background: var(--success-bg); color: var(--success); border-color: #A7F3D0; }
.alert.warning { background: var(--warning-bg); color: #92400E; border-color: #FDE68A; }
.alert.error,
.alert .error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }

/* legacy class-name shims used by existing templates */
.success {
  display: inline-block;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #A7F3D0;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.error {
  display: inline-block;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.warning {
  display: inline-block;
  background: var(--warning-bg);
  color: #92400E;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ===========================================================
   DASHBOARD — overview grid
   =========================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.stat-card .stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 600;
  margin-top: 8px;
  letter-spacing: -0.02em;
}
.stat-card .stat-delta {
  margin-top: 6px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.stat-card .stat-delta.up { color: var(--success); }
.stat-card .stat-delta.down { color: var(--danger); }
.stat-card .stat-foot {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.stat-card .channel-bar {
  display: flex; gap: 4px; margin-top: 12px;
  height: 6px; border-radius: var(--radius-full); overflow: hidden;
  background: var(--bg-muted);
}
.stat-card .channel-bar > span { height: 100%; }
.stat-card .channel-bar .messenger { background: var(--messenger); }
.stat-card .channel-bar .whatsapp { background: var(--whatsapp); }
.stat-card .channel-bar .instagram { background: var(--instagram); }

.row-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .row-grid { grid-template-columns: 1fr; } }

.chart-card { min-height: 280px; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }
.chart-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .legend-swatch { width: 10px; height: 10px; border-radius: 2px; }

.chart-svg { width: 100%; height: 220px; display: block; }
.chart-svg .axis { stroke: var(--border); stroke-width: 1; }
.chart-svg .grid { stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-svg .axis-label { fill: var(--text-tertiary); font-size: 10px; font-family: var(--font-sans); }
.chart-svg .series { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bot-list .bot-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.bot-list .bot-row:last-child { border-bottom: none; padding-bottom: 0; }
.bot-list .bot-row:first-child { padding-top: 0; }
.bot-row .avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: grid; place-items: center;
  background: var(--bg-accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.bot-row .bot-meta { flex: 1; min-width: 0; }
.bot-row .bot-name { font-weight: 600; font-size: 14px; }
.bot-row .bot-progress {
  margin-top: 6px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  overflow: hidden;
}
.bot-row .bot-progress > span { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-full); }
.bot-row .bot-accuracy { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

.row-grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px) { .row-grid-2 { grid-template-columns: 1fr; } }

/* table */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-muted); }
.table .cell-contact { display: flex; align-items: center; gap: 10px; }
.table .cell-contact .avatar {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, #A5B4FC, #C4B5FD);
  color: #fff; font-size: 12px; font-weight: 600;
  display: grid; place-items: center; flex-shrink: 0;
}
.table .preview {
  color: var(--text-secondary);
  font-size: 13px;
  display: block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table .time { color: var(--text-tertiary); font-size: 12px; white-space: nowrap; }

/* quick actions */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.action-tile {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.action-tile:hover {
  border-color: var(--accent);
  background: var(--bg-accent-soft);
  color: var(--accent);
  text-decoration: none;
}
.action-tile .action-title { display: block; font-weight: 600; margin-bottom: 2px; }
.action-tile .action-sub { display: block; font-size: 12px; color: var(--text-tertiary); font-weight: 400; }
.action-tile:hover .action-sub { color: var(--accent); }

/* ===========================================================
   CHANNELS — page grid
   =========================================================== */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1100px) { .channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .channel-grid { grid-template-columns: 1fr; } }

.channel-card .channel-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.channel-card .channel-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: grid; place-items: center;
  flex-shrink: 0;
  font-weight: 700; font-size: 18px;
}
.channel-card .channel-icon.messenger { background: var(--messenger-bg); color: var(--messenger); }
.channel-card .channel-icon.whatsapp { background: var(--whatsapp-bg); color: var(--whatsapp); }
.channel-card .channel-icon.instagram { background: var(--instagram-bg); color: var(--instagram); }

.channel-card .channel-name { font-size: 15px; font-weight: 600; }
.channel-card .channel-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.channel-card .channel-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.channel-card .channel-meta dt { font-weight: 500; color: var(--text-secondary); margin-right: 4px; }
.channel-card .channel-meta dd { margin: 0; display: inline; }

.channel-card .channel-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

/* table-as-channel-list (legacy single-column pages.html) */
.channel-table .channel-name-cell { font-weight: 600; }
.channel-table .channel-id { color: var(--text-tertiary); font-size: 12px; font-family: ui-monospace, "JetBrains Mono", "SF Mono", monospace; }

/* misc */
.muted { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}
.empty-state .empty-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 8px 0 4px; }
.empty-state .empty-sub { font-size: 13px; margin-bottom: 16px; }

/* ===========================================================
   HOME / LANDING
   =========================================================== */
.home-page { background: var(--bg-canvas); }
.home-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 20px 0;
}
.home-nav .brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
}
.home-nav .brand-mark {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #8B5CF6);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
}
.home-nav .brand-name { font-weight: 600; font-size: 15px; }
.home-nav-links { display: flex; gap: 24px; }
.home-nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.home-nav-links a:hover { color: var(--text-primary); }
.home-nav-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) {
  .home-nav-links { display: none; }
}

.hero {
  text-align: center;
  padding: 64px 16px 32px;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40px -10% 30%;
  background:
    radial-gradient(600px 280px at 20% 50%, rgba(99, 102, 241, 0.10), transparent 70%),
    radial-gradient(500px 240px at 80% 30%, rgba(16, 185, 129, 0.08), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.hero-title {
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 20px auto 16px;
  max-width: 760px;
}
.hero-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #8B5CF6 60%, #EC4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 24px;
  line-height: 1.6;
}
.hero-actions {
  display: inline-flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-channels {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-preview {
  max-width: 560px;
  margin: 32px auto 64px;
}
.chat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px;
}
.chat-card-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.chat-card-head .avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.chat-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
  max-width: 78%;
}
.chat-bubble.user {
  background: var(--bg-muted);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  margin-right: auto;
}
.chat-bubble.bot {
  background: var(--bg-accent-soft);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
  margin-left: auto;
}
.chat-bubble.bot.small { font-size: 13px; }

.section-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  margin-bottom: 8px;
}
.section-sub {
  color: var(--text-secondary);
  text-align: center;
  max-width: 520px;
  margin: 0 auto 32px;
  font-size: 15px;
}

.features { padding: 48px 0; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 900px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #D8DEE7;
}
.feature-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: grid; place-items: center;
  margin-bottom: 14px;
}
.feature-card h3 { font-size: 16px; margin-bottom: 6px; }
.feature-card p { color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

.channels-section { padding: 48px 0; }

.steps-section { padding: 48px 0; }
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  counter-reset: step;
  padding: 0;
  list-style: none;
}
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
}
.step-num {
  position: absolute;
  top: -14px; left: 24px;
  background: linear-gradient(135deg, var(--accent), #8B5CF6);
  color: #fff;
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.step h3 { font-size: 16px; margin-top: 12px; margin-bottom: 6px; }
.step p { color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

.cta-section { padding: 48px 0 64px; }
.cta-card {
  background: linear-gradient(135deg, #EEF2FF 0%, #FDE8EF 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.cta-card h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  max-width: 640px;
  margin-left: auto; margin-right: auto;
}
.cta-card p { color: var(--text-secondary); margin-bottom: 24px; font-size: 15px; }

.home-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.footer-brand .brand-mark {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #8B5CF6);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 11px;
}
.footer-links { display: flex; gap: 24px; }
.footer-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
}
.footer-links a:hover { color: var(--text-primary); }

/* ===========================================================
   DOC SHELL — long-form legal / compliance pages
   =========================================================== */
.doc-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 96px;
  color: var(--text-primary);
}
.doc-shell h1 { font-size: 28px; margin-bottom: 16px; letter-spacing: -0.01em; }
.doc-shell h2 { font-size: 18px; margin-top: 32px; margin-bottom: 12px; }
.doc-shell p, .doc-shell ul, .doc-shell ol { margin-bottom: 12px; color: var(--text-primary); font-size: 15px; line-height: 1.7; }
.doc-shell ul, .doc-shell ol { padding-left: 1.4em; list-style: revert; }
.doc-shell li { margin-bottom: 6px; }
.doc-shell em { color: var(--text-tertiary); font-style: normal; }
.doc-shell code {
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", monospace;
  font-size: 13px;
}
.doc-shell a { color: var(--accent); }

/* spinner placeholder */
#spinner { display: none; }
