:root {
  --bg-primary: #0b1120;
  --bg-secondary: #131d31;
  --bg-card: #18233c;
  --bg-hover: #1f2d4d;
  --border-color: #263659;
  --border-subtle: #1e2c48;
  
  --brand-green: #25d366;
  --brand-green-hover: #1ebd5a;
  --brand-teal: #128c7e;
  --wa-dark-header: #1f2c34;
  --wa-bubble-green: #005c4b;
  --wa-bubble-incoming: #202c33;
  --wa-canvas-bg: #0b141a;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-blue: #38bdf8;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Top Navigation Bar (User Request: "menu taruh atas aja biar ga ruwet")
   ========================================================================== */
.top-navbar {
  height: 64px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--brand-green), var(--brand-teal));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #0b1120;
  box-shadow: 0 0 15px rgba(37, 211, 102, 0.4);
}

.brand-text .brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-tag {
  background: var(--brand-green);
  color: #0b1120;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(11, 17, 32, 0.6);
  padding: 5px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: #ffffff;
  background: var(--brand-teal);
  box-shadow: 0 2px 8px rgba(18, 140, 126, 0.4);
}

.nav-tab-btn .badge {
  background: var(--accent-red);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.nav-tab-btn .badge:empty {
  display: none;
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--brand-green);
  box-shadow: 0 0 8px var(--brand-green);
}

/* Right Nav Controls */
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quick-kpi-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(24, 35, 60, 0.6);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
}

.quick-kpi-pill .kpi-label {
  color: var(--text-muted);
}

.quick-kpi-pill .kpi-val {
  font-weight: 700;
  color: var(--accent-blue);
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 24px;
  border: 1px solid var(--border-subtle);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-purple), #6366f1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.1;
}

.user-role-badge {
  font-size: 0.68rem;
  color: var(--brand-green);
  font-weight: 600;
}

/* ==========================================================================
   Main Workspace Layout
   ========================================================================== */
.main-workspace {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.tab-view {
  display: none;
  flex: 1;
  height: 100%;
}

.tab-view.active {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Shared Components & Utility Classes
   ========================================================================== */
.section-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin: 20px 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--brand-green);
  color: #0b1120;
}

.btn-primary:hover {
  background-color: var(--brand-green-hover);
  box-shadow: 0 0 15px rgba(37, 211, 102, 0.4);
}

.btn-success {
  background-color: #10b981;
  color: #ffffff;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent-blue);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
}

.btn-text.highlight {
  color: var(--brand-green);
  font-weight: 600;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

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

.dot.green {
  background-color: var(--brand-green);
  box-shadow: 0 0 8px var(--brand-green);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group .label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select,
.styled-select {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}

.hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.styled-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.styled-table th {
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.styled-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.styled-table tbody tr:hover {
  background-color: var(--bg-hover);
}

/* ==========================================================================
   View 1: Live Inbox Layout (Full height)
   ========================================================================== */
#view-inbox {
  height: calc(100vh - 64px);
}

.inbox-layout {
  display: flex;
  height: 100%;
  width: 100%;
}

.inbox-list-pane {
  width: 380px;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.inbox-search-box {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.inbox-filter-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  background-color: rgba(11, 17, 32, 0.3);
}

.filter-tab {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab.active {
  color: var(--brand-green);
  border-bottom-color: var(--brand-green);
}

.conversations-scroll {
  flex: 1;
  overflow-y: auto;
}

.conv-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background-color 0.15s;
}

.conv-item:hover {
  background-color: var(--bg-hover);
}

.conv-item.active {
  background-color: rgba(18, 140, 126, 0.2);
  border-left: 3px solid var(--brand-green);
}

.conv-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.conv-details {
  flex: 1;
  min-width: 0;
}

.conv-top-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.conv-name {
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.conv-snippet {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.conv-meta {
  display: flex;
  gap: 6px;
}

.badge-tag {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-tag.agent {
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Chat Window */
.chat-window-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
}

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

.chat-header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-user .avatar {
  width: 40px;
  height: 40px;
  background: var(--brand-teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.chat-header-user h3 {
  font-size: 1rem;
  font-weight: 700;
}

.chat-header-user p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
}

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

.chat-placeholder {
  margin: auto;
  text-align: center;
  max-width: 400px;
  color: var(--text-muted);
}

.chat-placeholder .icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 65%;
}

.msg-row.inbound {
  align-self: flex-start;
}

.msg-row.outbound {
  align-self: flex-end;
}

.msg-bubble-box {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
  word-break: break-word;
}

.msg-row.inbound .msg-bubble-box {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
}

.msg-row.outbound .msg-bubble-box {
  background-color: var(--wa-bubble-green);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.msg-bubble-box.bot-bubble {
  background-color: #27272a !important;
  border-left: 3px solid var(--accent-purple);
}

.msg-info-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.msg-row.outbound .msg-info-sub {
  justify-content: flex-end;
}

.sender-tag {
  font-weight: 600;
}

.sender-tag.cs {
  color: var(--accent-blue);
}

.sender-tag.bot {
  color: var(--accent-purple);
}

.sender-tag.system {
  color: #38bdf8;
  font-weight: 700;
}

.chat-compose-bar {
  padding: 14px 24px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
}

.chat-compose-bar input {
  flex: 1;
}

.chat-compose-bar .sub-text {
  font-size: 0.7rem;
  opacity: 0.8;
  display: block;
}

/* ==========================================================================
   View 2: Accounts Grid
   ========================================================================== */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.account-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s;
}

.account-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-subtle);
}

.account-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.account-label {
  font-size: 1.05rem;
  font-weight: 700;
}

.account-phone {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-badge.connected {
  background: rgba(37, 211, 102, 0.15);
  color: var(--brand-green);
  border: 1px solid rgba(37, 211, 102, 0.3);
}

.status-badge.disconnected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.account-stats {
  background-color: var(--bg-card);
  padding: 12px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}

.account-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ==========================================================================
   View 3: Contacts Book Toolbar & Filter
   ========================================================================== */
.contacts-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.search-input-wrapper {
  flex: 1;
  max-width: 450px;
}

.filter-pills {
  display: flex;
  gap: 8px;
}

.filter-pill {
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-pill:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.filter-pill.active {
  background: var(--brand-green);
  color: #0b1120;
  border-color: var(--brand-green);
}

.badge-blacklist {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-active {
  background: rgba(37, 211, 102, 0.15);
  color: var(--brand-green);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ==========================================================================
   View 4: Bot Rules & Interactive Sandbox Layout
   ========================================================================== */
.bot-rules-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  padding: 20px 24px;
  flex: 1;
}

.bot-rules-layout .section-card {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.sandbox-simulator-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 420px;
}

.sandbox-chat-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
}

.sandbox-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.sandbox-msg.user {
  align-self: flex-end;
}

.sandbox-msg.bot {
  align-self: flex-start;
}

.sandbox-msg .msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.sandbox-msg.user .msg-bubble {
  background: var(--brand-teal);
  color: white;
  border-bottom-right-radius: 2px;
}

.sandbox-msg.bot .msg-bubble {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
}

.sandbox-input-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ==========================================================================
   View 5: Revamped Broadcast UI & Phone Mockup
   ========================================================================== */
.broadcast-layout-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 24px;
  padding: 20px 24px;
}

.broadcast-composer-card {
  margin: 0;
}

/* Smart Chips */
.smart-chips-wrapper {
  margin-bottom: 16px;
  background: rgba(11, 17, 32, 0.4);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.chips-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.smart-chips-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.smart-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--brand-green);
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
}

.smart-chip:hover {
  background: var(--brand-green);
  color: #0b1120;
  transform: translateY(-1px);
}

.anti-ban-checklist {
  background-color: rgba(18, 140, 126, 0.1);
  border: 1px solid rgba(18, 140, 126, 0.3);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.anti-ban-checklist h4 {
  font-size: 0.9rem;
  color: var(--brand-green);
  margin-bottom: 8px;
}

.anti-ban-checklist ul {
  list-style: none;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==========================================================================
   WhatsApp Smartphone Mockup
   ========================================================================== */
.phone-mockup-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
}

.mockup-header-title {
  text-align: center;
  margin-bottom: 16px;
}

.mockup-header-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.mockup-header-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Realistic Smartphone Bezel */
.smartphone-frame {
  width: 320px;
  height: 580px;
  background-color: #1a1a1a;
  border-radius: 38px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), inset 0 0 4px rgba(255, 255, 255, 0.2);
  border: 4px solid #2e2e2e;
  padding: 10px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 18px;
  background: #000000;
  border-radius: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.phone-speaker {
  width: 36px;
  height: 3px;
  background: #333333;
  border-radius: 2px;
}

.phone-camera {
  width: 8px;
  height: 8px;
  background: #111111;
  border-radius: 50%;
  border: 1px solid #222;
}

/* WhatsApp Screen */
.wa-screen {
  flex: 1;
  background-color: var(--wa-canvas-bg);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.wa-app-header {
  height: 60px;
  padding-top: 18px;
  padding-left: 10px;
  padding-right: 12px;
  background-color: var(--wa-dark-header);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e9edef;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.wa-back-btn {
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.wa-header-avatar {
  width: 32px;
  height: 32px;
  background: #00a884;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

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

.wa-contact-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-contact-status {
  font-size: 0.68rem;
  color: #8696a0;
}

.wa-header-icons {
  display: flex;
  gap: 10px;
  font-size: 0.85rem;
  color: #aebac1;
}

/* Authentic Chat Canvas */
.wa-chat-canvas {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 16px 16px;
}

.wa-date-pill {
  align-self: center;
  background: #182229;
  color: #8696a0;
  font-size: 0.68rem;
  padding: 4px 10px;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.wa-bubble-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.wa-chat-bubble.outgoing {
  background-color: var(--wa-bubble-green);
  color: #e9edef;
  border-radius: 8px;
  border-top-right-radius: 2px;
  padding: 8px 10px;
  max-width: 88%;
  font-size: 0.82rem;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  word-break: break-word;
}

.bubble-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.bubble-time {
  font-size: 0.65rem;
  color: rgba(233, 237, 239, 0.6);
}

.bubble-ticks {
  font-size: 0.72rem;
  color: #53bdeb; /* WA blue tick color */
}

/* WA Bottom Fake Footer */
.wa-fake-footer {
  height: 44px;
  background-color: var(--wa-dark-header);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
}

.fake-input {
  flex: 1;
  background-color: #2a3942;
  border-radius: 18px;
  padding: 6px 12px;
  font-size: 0.75rem;
  color: #8696a0;
}

.fake-mic {
  width: 30px;
  height: 30px;
  background-color: #00a884;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

/* Mockup Under Controls */
.mockup-controls {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.mockup-name-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.styled-select-sm {
  padding: 4px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.78rem;
}

.history-card {
  margin-top: 0;
}

/* ==========================================================================
   View 6: Reports & Analytics Layout
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 20px 24px;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-icon {
  font-size: 1.5rem;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.kpi-title {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.reports-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0 24px 20px 24px;
}

.reports-tables-grid .section-card {
  margin: 0;
}

/* ==========================================================================
   Modals & Login Screen
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.login-card {
  max-width: 460px;
  border-color: var(--brand-teal);
  box-shadow: 0 0 35px rgba(18, 140, 126, 0.3);
}

.quick-login-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}



.qr-canvas-wrapper {
  margin: 20px auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
}

.qr-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Floating Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: #18233c;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid #263659;
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

.toast-success {
  border-color: var(--brand-green);
}

.toast-error {
  border-color: var(--accent-red);
}

.toast.fade-out {
  animation: toast-out 0.25s forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(16px) scale(0.95); }
}

/* Utility */
.text-center { text-align: center; }

/* ==========================================================================
   Modern Glassmorphism Login Modal Overlay
   ========================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.25s ease-out;
  padding: 16px;
}

.login-card {
  background: rgba(19, 29, 49, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(37, 211, 102, 0.08);
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header {
  text-align: center;
}

.login-logo-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
  margin-bottom: 12px;
}

.login-header h2 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.login-header h2 .brand-tag {
  background: linear-gradient(135deg, #25d366, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1rem;
  font-weight: 800;
  margin-left: 4px;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.login-card .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.login-card .form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-card .styled-input {
  background: rgba(11, 17, 32, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
  width: 100%;
}

.login-card .styled-input:focus {
  outline: none;
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
  background: rgba(11, 17, 32, 0.95);
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  user-select: none;
  border-radius: 6px;
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn-toggle-pwd:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.08);
}

.btn-toggle-pwd:active {
  transform: scale(0.95);
}

.login-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  text-align: center;
}

.login-footer-info {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  text-align: center;
}

.secure-badge {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

