/**
 * Chasta Ai — Modern shadcn/ui Design System
 * Clean, minimal dark slate aesthetics with crisp Lucide icons and precision typography.
 */

:root {
  /* shadcn/ui Dark Zinc Palette */
  --bg-primary: #09090b;
  --bg-secondary: #121215;
  --bg-tertiary: #18181b;
  --bg-elevated: #27272a;
  --bg-card: #141418;
  
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-focus: rgba(0, 173, 181, 0.5);
  --border-accent: rgba(0, 173, 181, 0.35);

  --accent: #00adb5;
  --accent-light: #22d3ee;
  --accent-dark: #0891b2;
  --accent-dim: rgba(0, 173, 181, 0.12);
  --accent-glow: rgba(0, 173, 181, 0.2);

  --success: #10b981;
  --success-dim: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 16px var(--accent-glow);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Icon Helpers ───────────────────────────────────────── */
.icon-xs {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  flex-shrink: 0;
}

.icon-sm {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

.icon-md {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
}

.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ─── Layout ─────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────── */
.app-header {
  height: 54px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 100;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon-wrap {
  width: 28px;
  height: 28px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.logo-icon {
  width: 16px;
  height: 16px;
}

.logo-text h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo-accent {
  color: var(--accent);
}

.version-badge {
  font-size: 10px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

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

/* Coin Balance Badge */
.coin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.coin-badge .coin-icon {
  width: 14px;
  height: 14px;
}

.coin-amount {
  font-weight: 700;
}

.coin-label {
  font-size: 11px;
  opacity: 0.85;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-logout {
  font-size: 12px;
  padding: 5px 8px;
  color: var(--text-muted);
}

.btn-logout:hover {
  color: var(--danger);
  background: var(--danger-dim);
}

/* ─── Buttons (shadcn style) ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  outline: none;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 4px 9px;
  font-size: 11px;
}

.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
}

.btn-icon-sm {
  padding: 4px;
  width: 26px;
  height: 26px;
}

.btn-primary {
  background: var(--accent);
  color: #09090b;
  font-weight: 600;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: var(--accent-light);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: #323238;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-whatsapp {
  background: #15803d;
  color: #ffffff;
  font-weight: 600;
  border-color: #16a34a;
}

.btn-whatsapp:hover:not(:disabled) {
  background: #16a34a;
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.3);
}

/* ─── Main Content Split ─────────────────────────────────── */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.left-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.right-pane {
  width: 500px;
  min-width: 340px;
  max-width: 80vw;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  flex-shrink: 0;
  position: relative;
}

/* ─── Panel Resizer Bar ──────────────────────────────────── */
.panel-resizer {
  width: 6px;
  background: transparent;
  cursor: col-resize;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
  transition: background var(--transition-fast);
  margin-left: -3px;
  margin-right: -3px;
  user-select: none;
}

.panel-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 28px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.panel-resizer:hover,
.panel-resizer.dragging {
  background: rgba(0, 173, 181, 0.25);
}

.panel-resizer:hover::after,
.panel-resizer.dragging::after {
  background: var(--accent);
  height: 44px;
  width: 3px;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ─── Map Container ──────────────────────────────────────── */
.map-container {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.loading-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-text {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Radius Floating Control */
.radius-control {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 500;
  box-shadow: var(--shadow-md);
}

.radius-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.radius-control input[type="range"] {
  width: 90px;
  accent-color: var(--accent);
  cursor: pointer;
}

.radius-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
  min-width: 36px;
  text-align: right;
  font-family: var(--font-mono);
}

.btn-dock-results {
  position: absolute;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 18, 21, 0.95);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  border-radius: 9999px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  z-index: 550;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 12px var(--accent-glow);
  backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
  animation: slideUpFade 0.2s ease;
}

.btn-dock-results:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  transform: translateX(-50%) translateY(-2px);
}

.dock-pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.5s infinite;
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── Results Panel (Bottom of Map) ──────────────────────── */
.results-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 340px;
  max-height: 55vh;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 700;
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
}

.results-panel.open,
.results-panel.visible {
  transform: translateY(0);
}

.results-header {
  height: 44px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.panel-tabs {
  display: flex;
  gap: 4px;
}

.panel-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.panel-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.panel-tab.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border);
  font-weight: 600;
}

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

.results-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

.tab-pane.active {
  display: block;
}

/* ─── Places Grid & Cards ────────────────────────────────── */
.places-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 10px;
}

.place-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.place-card:hover {
  border-color: var(--border-accent);
  background: #18181f;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.place-card-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.place-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.place-header-main {
  flex: 1;
  min-width: 0;
}

.place-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 4px;
  background: var(--accent-dim);
  color: var(--accent-light);
  border: 1px solid var(--border-accent);
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.place-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.place-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  margin-top: 3px;
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #fbbf24;
  font-weight: 700;
}

.star-icon {
  width: 12px;
  height: 12px;
  fill: #fbbf24;
}

.review-count {
  color: var(--text-muted);
  font-weight: 400;
}

.cat-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.place-info-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.place-address {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.address-icon {
  margin-top: 2px;
  color: var(--text-muted);
}

.place-tags-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.place-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  white-space: nowrap;
}

.place-tag-hours {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

.place-tag-phone {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.25);
  background: rgba(74, 222, 128, 0.08);
}

.place-card-footer {
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 2px;
}

.place-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}

.btn-place-action {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-place-action:hover {
  background: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.btn-place-action.btn-emp {
  background: rgba(0, 173, 181, 0.08);
  border-color: var(--border-accent);
  color: var(--accent-light);
}

.btn-place-action.btn-emp:hover {
  background: var(--accent);
  color: #09090b;
}

.btn-place-action.btn-wa {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
  color: #4ade80;
}

.btn-place-action.btn-wa:hover {
  background: #16a34a;
  color: #ffffff;
}

.btn-place-action.focus-btn {
  background: rgba(255, 255, 255, 0.05);
}

/* ─── Charts Layout ──────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  position: relative;
}

.chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.chart-box canvas {
  max-height: 180px;
}

/* ─── Right Pane: AI Chat ────────────────────────────────── */
.chat-header {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

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

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.active-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--accent-light);
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.active-model-pill:hover {
  background: var(--bg-elevated);
  border-color: var(--border-accent);
  color: var(--accent);
}

.model-chevron {
  opacity: 0.6;
}

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

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online { background: #10b981; }
.status-dot.offline { background: #71717a; }
.status-dot.loading { background: #f59e0b; animation: pulse 1s infinite; }

.coin-tag {
  font-size: 9px;
  padding: 1px 4px;
  background: rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-xs);
  color: #fbbf24;
  font-weight: 700;
}

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

.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 24px;
}

.empty-icon-box {
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 12px;
}

.empty-icon {
  width: 22px;
  height: 22px;
}

.empty-chat h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-chat p {
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.5;
}

.empty-model-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 14px;
}

.empty-model-tag strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Chat Bubbles */
.chat-bubble {
  max-width: 95%;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  animation: fadeIn 0.15s ease;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #09090b;
  font-weight: 500;
  padding: 8px 12px;
  border-bottom-right-radius: 2px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bubble-header-left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bubble-model-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.bubble-model-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

.bubble-content {
  color: var(--text-primary);
}

.chat-h2, .chat-h3, .chat-h4 {
  color: var(--accent-light);
  font-weight: 700;
  margin: 10px 0 4px;
  line-height: 1.3;
}

.chat-h2 { font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.06); padding-bottom: 4px; }
.chat-h3 { font-size: 13px; }
.chat-h4 { font-size: 12px; }

.chat-bullet {
  padding-left: 10px;
  margin: 3px 0;
  line-height: 1.4;
}

.bullet-num {
  color: var(--accent-light);
  font-weight: 600;
  font-family: var(--font-mono);
}

.chat-inline-code {
  background: rgba(0, 173, 181, 0.12);
  border: 1px solid rgba(0, 173, 181, 0.25);
  color: var(--accent-light);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: var(--font-mono);
}

.chat-code-block {
  background: #09090b;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 6px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 11px;
}

.chat-bubble.system {
  align-self: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  max-width: 95%;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-typing {
  align-self: flex-start;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-typing span {
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Chat Templates */
.chat-templates {
  padding: 6px 12px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.template-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.template-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Chat Input Wrap */
.chat-input-wrap {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.chat-input-box {
  display: flex;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  align-items: flex-end;
  transition: border-color var(--transition-fast);
}

.chat-input-box:focus-within {
  border-color: var(--accent);
}

.chat-input-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 32px;
  max-height: 100px;
  line-height: 1.4;
}

.btn-send {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #09090b;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-bottom: 2px;
}

.btn-send:hover:not(:disabled) {
  background: var(--accent-light);
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Search Bar (Centered over Map Area) ─────────────────── */
.search-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 32px);
  max-width: 580px;
  z-index: 600;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

.search-icon-wrap, .keyword-icon-wrap {
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.search-main-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.search-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.search-keyword-input {
  width: 220px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.btn-search {
  padding: 7px 16px;
  font-weight: 600;
}

/* ─── Modals (shadcn style) ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  width: 480px;
  max-width: 92vw;
  max-height: 88vh;
  background: #141418;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal.modal-lg {
  width: 680px;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon-badge.badge-wa {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.3);
  color: #4ade80;
}

.modal-header h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ─── Form Controls in Modals ────────────────────────────── */
.setting-group {
  margin-bottom: 14px;
}

.setting-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setting-group input[type="text"],
.setting-group input[type="password"],
.setting-group select,
.setting-group textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.setting-group input:focus,
.setting-group select:focus,
.setting-group textarea:focus {
  border-color: var(--accent);
}

.input-with-action {
  display: flex;
  gap: 6px;
  align-items: center;
}

.input-with-action input {
  flex: 1;
}

.btn-toggle-eye {
  padding: 7px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-toggle-eye:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Radio Option Cards */
.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.radio-option {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radio-option:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.radio-option.active {
  background: rgba(0, 173, 181, 0.1);
  border-color: var(--accent);
}

.radio-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.radio-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.custom-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ─── Employee Modal List ────────────────────────────────── */
.emp-loading-state, .emp-empty-state {
  padding: 36px 16px;
  text-align: center;
}

.emp-empty-icon-wrap {
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  color: var(--text-muted);
}

.emp-empty-icon {
  width: 22px;
  height: 22px;
}

.emp-loading-text {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.emp-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.emp-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
}

.emp-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-elevated);
}

.emp-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  color: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.emp-info {
  flex: 1;
  min-width: 0;
}

.emp-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.emp-role, .emp-email {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.emp-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-linkedin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  background: rgba(14, 118, 168, 0.15);
  border: 1px solid rgba(14, 118, 168, 0.35);
  color: #38bdf8;
  text-decoration: none;
}

.btn-linkedin:hover {
  background: #0284c7;
  color: #ffffff;
}

/* ─── WhatsApp Template Manager ──────────────────────────── */
.template-mgr-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.template-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.template-card:hover {
  border-color: var(--border-accent);
}

.template-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.template-card-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.template-card-preview {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.editor-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.tag-helper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag-helper span {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-tag {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--accent-light);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: var(--font-mono);
}

.btn-tag:hover {
  background: var(--accent);
  color: #09090b;
}

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

/* ─── Toast Notifications ────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 64px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3000;
}

.toast {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #18181b;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* ─── Animations ─────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ─── Form Row & Template Column Layout ──────────────────── */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.template-list-column {
  display: flex;
  flex-direction: column;
  height: 100%;
}

