/* ==========================================================================
   BidiAI Control Center 2.0 - High-End Glossy White Theme (Light Mode)
   Aesthetic: Apple Silicon Light Mode + Stripe Executive Dashboard
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Surfaces & Canvas (White / Light Palette) */
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --glass-card: rgba(255, 255, 255, 0.92);
  --glass-card-hover: #ffffff;
  --glass-input: #ffffff;

  /* Borders & Specular Highlights ("Bóng & Sang") */
  --border-light: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-specular: #ffffff;
  --border-focus: #3b82f6;

  /* Shadows (Multi-layered, crisp, soft elevation) */
  --shadow-card: 0 10px 28px -4px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02), inset 0 1px 0 rgba(255, 255, 255, 1);
  --shadow-card-hover: 0 18px 36px -6px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255, 255, 255, 1);
  --shadow-btn-primary: 0 4px 14px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  --shadow-btn-zalo: 0 4px 14px rgba(0, 104, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);

  /* Colors */
  --primary-blue: #2563eb;
  --zalo-blue: #0068ff;
  --telegram-cyan: #0284c7;
  --emerald-online: #059669;
  --amber-warning: #d97706;
  --rose-danger: #e11d48;
  --purple-accent: #7c3aed;

  /* Text Tiers */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-subtle: #64748b;
  --text-muted: #94a3b8;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: auto;
  background-image: 
    radial-gradient(circle at 40% -20px, rgba(224, 242, 254, 0.6) 0%, transparent 60%),
    radial-gradient(circle at 90% 10%, rgba(237, 233, 254, 0.5) 0%, transparent 50%),
    radial-gradient(circle at 10% 60%, rgba(241, 245, 249, 0.8) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Ambient Subtle Background Lighting */
.ambient-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
}
.glow-top {
  top: -120px;
  left: 30%;
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(186, 230, 253, 0.4) 0%, transparent 70%);
  filter: blur(60px);
}
.glow-right {
  top: 15%;
  right: -80px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(221, 214, 254, 0.35) 0%, transparent 70%);
  filter: blur(70px);
}

/* Shell Layout */
.shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Rail Sidebar (Clean White Glass) */
.rail {
  width: 250px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 32px 18px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 16px rgba(15, 23, 42, 0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 10px 26px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.brand-gem {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff 0%, #ede9fe 100%);
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12), inset 0 1px 0 #ffffff;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.brand-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  text-transform: uppercase;
}

/* Nav */
.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.nav-item.active {
  color: var(--primary-blue);
  background: #ffffff;
  border-color: #dbeafe;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08), inset 0 1px 0 #ffffff;
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--primary-blue);
  stroke-width: 2.2;
}

.nav-item-special {
  margin-top: 12px;
  border: 1px dashed var(--border-light);
  background: #ffffff;
}

.rail-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.engine-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
}

.pulse-beacon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-online);
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.5);
  animation: beaconPulse 2.5s infinite;
}

@keyframes beaconPulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px rgba(5, 150, 105, 0.6); }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.engine-meta {
  display: flex;
  flex-direction: column;
}

.engine-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #1e293b;
}

.engine-ver {
  font-size: 10px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

/* Main Content Area */
.content-wrapper, .content {
  flex: 1 1 0%;
  min-width: 0 !important;
  padding: 24px 28px 60px !important;
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Page Header */
.dashboard-head, .page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 34px;
}

.page-title, .dashboard-head h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.15;
  margin-bottom: 6px;
}

.page-subtitle, .dashboard-head p {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 400;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.system-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.08);
  font-size: 12px;
  font-weight: 600;
  color: #065f46;
}

.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #059669;
  box-shadow: 0 0 6px #059669;
}

/* Glossy Action Button ("Bóng & Sang" on White Theme) */
.btn-glossy-primary, .btn-extract-glossy, .btn-quick-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  color: #ffffff;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  border: 1px solid #1e40af;
  box-shadow: var(--shadow-btn-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-glossy-primary:hover, .btn-extract-glossy:hover, .btn-quick-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* ==========================================================================
   Bento Metric Grid (Airy, Glossy White)
   ========================================================================== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 38px;
}

.metric-card {
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-top: 1px solid var(--border-specular);
  border-radius: 18px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.metric-card:hover {
  transform: translateY(-2px);
  background: var(--glass-card-hover);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-card-hover);
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.metric-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  text-transform: uppercase;
}

.metric-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon-wrap.blue { color: #2563eb; background: #eff6ff; border: 1px solid #dbeafe; }
.metric-icon-wrap.green { color: #059669; background: #ecfdf5; border: 1px solid #a7f3d0; }
.metric-icon-wrap.zalo-blue { color: #0068ff; background: #eff6ff; border: 1px solid #bfdbfe; box-shadow: 0 2px 8px rgba(0, 104, 255, 0.15); }
.metric-icon-wrap.tg-cyan { color: #0284c7; background: #f0f9ff; border: 1px solid #bae6fd; }
.metric-icon-wrap.purple { color: #7c3aed; background: #f5f3ff; border: 1px solid #ddd6fe; }

.metric-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 8px;
}

.metric-value small {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-subtle);
  margin-left: 2px;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.metric-sub-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-subtle);
}
.metric-sub-bar strong {
  color: #1e293b;
  font-family: var(--font-mono);
}

.pulse-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-online);
  box-shadow: 0 0 6px var(--emerald-online);
}

/* ==========================================================================
   Section Containers
   ========================================================================== */
.section-container, .section-block {
  margin-bottom: 38px;
}

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

.section-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title, .section-head h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.section-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.section-link, .section-head a {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-blue);
  text-decoration: none;
  transition: all 0.2s ease;
}

.section-link:hover, .section-head a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* ==========================================================================
   Node Fleet Cards (Airy White Glass)
   ========================================================================== */
.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.node-card {
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-top: 1px solid var(--border-specular);
  border-radius: 18px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.node-card:hover {
  transform: translateY(-2px);
  background: var(--glass-card-hover);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-card-hover);
}

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

.node-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.node-name {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.status-glow-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-glow-dot.online {
  background: var(--emerald-online);
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.5);
}
.status-glow-dot.offline {
  background: var(--rose-danger);
  box-shadow: 0 0 6px rgba(225, 29, 72, 0.5);
}

.node-meta {
  font-size: 12px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

.node-link-arrow {
  color: var(--text-subtle);
  font-size: 16px;
  transition: transform 0.2s ease, color 0.2s ease;
}
.node-card:hover .node-link-arrow {
  transform: translate(2px, -2px);
  color: var(--primary-blue);
}

.node-gauges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
}

.gauge-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gauge-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-subtle);
}
.gauge-label strong {
  color: #0f172a;
  font-family: var(--font-mono);
  font-weight: 600;
}

.gauge-bar {
  height: 5px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.gauge-fill.violet { background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.gauge-fill.cyan { background: linear-gradient(90deg, #0284c7, #06b6d4); }
.gauge-fill.emerald { background: linear-gradient(90deg, #10b981, #059669); }

.node-footer {
  font-size: 11.5px;
  color: var(--text-subtle);
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
}
.node-footer strong {
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Glass Table Card & Tables (Pristine White)
   ========================================================================== */
.table-glass-card, .panel {
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-top: 1px solid var(--border-specular);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 28px;
}

/* Card Header / Section Header inside Panel (Prevent Rounded Corner Clipping) */
.panel > .section-head,
.panel > .section-header,
.panel > .compact-head,
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  margin: 0 !important;
  border-bottom: 1px solid var(--border-light);
  background: #ffffff;
}

.section-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}

.panel > .section-head h2,
.panel > .section-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0;
}

.panel > h2 {
  padding: 22px 28px;
  margin: 0 !important;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  border-bottom: 1px solid var(--border-light);
  background: #ffffff;
}

.panel > form {
  padding: 24px 28px;
}

.panel > .empty, .panel .empty-state {
  padding: 36px 28px;
  color: var(--text-subtle);
  font-size: 14px;
}

.node-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  padding: 24px 28px;
  background: #ffffff;
  margin-bottom: 24px;
}

.node-detail-summary > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.node-detail-summary span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
}

.node-detail-summary strong {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.table-action-bar, .table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  background: #ffffff;
  gap: 16px;
  flex-wrap: wrap;
}

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

.filter-pill {
  border: 1px solid var(--border-light);
  background: #ffffff;
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  background: #f1f5f9;
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.filter-pill.is-active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
  font-weight: 600;
}

.filter-pill.pill-zalo.is-active {
  background: #0068ff;
  border-color: #0068ff;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 104, 255, 0.28);
}

.filter-pill.pill-tg.is-active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.28);
}

.search-input-wrap, .search-box-wrap {
  position: relative;
  min-width: 260px;
}

.search-svg, .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.search-input-wrap input, .search-box-wrap input {
  width: 100%;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  padding: 8px 16px 8px 36px;
  color: #0f172a;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.search-input-wrap input:focus, .search-box-wrap input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Tables */
.table-responsive, .table-shell {
  width: 100%;
  overflow-x: auto;
}

.glass-table, .modern-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.glass-table th, .modern-table th {
  padding: 14px 22px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

/* Modern Unboxed Table Header Sorting */
.sort-button {
  all: unset;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  user-select: none;
  transition: color 0.15s ease;
}

.sort-button:hover {
  color: #0f172a;
}

.sort-button .sort-indicator {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  color: var(--text-subtle, #64748b);
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sort-button:hover .sort-indicator {
  opacity: 0.55;
}

.sort-button.is-active {
  color: #2563eb;
  font-weight: 700;
}

.sort-button.is-active .sort-indicator {
  opacity: 1;
  color: #2563eb;
  font-weight: 800;
  transform: translateY(-0.5px);
}

.glass-table td, .modern-table td {
  padding: 16px 22px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-subtle);
  color: #1e293b;
  vertical-align: middle;
}

.glass-table tbody tr, .modern-table tbody tr {
  transition: background-color 0.15s ease;
}

.glass-table tbody tr:hover, .modern-table tbody tr:hover {
  background: #f8fafc;
}

.glass-table tbody tr:last-child td, .modern-table tbody tr:last-child td {
  border-bottom: none;
}

/* Bot Name Cell */
.bot-identity, .bot-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-avatar-badge, .bot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
}

.bot-avatar-badge.zalo, .bot-avatar.zalo {
  background: linear-gradient(135deg, #0068ff 0%, #004ecc 100%);
  box-shadow: 0 2px 8px rgba(0, 104, 255, 0.25);
}

.bot-avatar-badge.telegram, .bot-avatar.telegram {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
}

.bot-avatar-badge.customer, .customer-avatar {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

.bot-label, .bot-name strong {
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

/* Channel Pill */
.channel-pill, .channel-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.channel-pill.zalo, .channel-tag.zalo {
  color: #0068ff;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.channel-pill.telegram, .channel-tag.telegram {
  color: #0284c7;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}

/* Status Pill */
.status-pill, .status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.online, .status-chip.online {
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.status-pill.online .status-dot, .status-chip.online .status-dot {
  background: #059669;
}

.status-pill.offline, .status-chip.offline {
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid #fecdd3;
}

.status-pill.pairing, .status-chip.pairing {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

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

.mono-badge, .runtime-badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.node-chip, .node-tag {
  font-size: 12px;
  color: var(--text-secondary);
}

.count-emphasis, .metric-count {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.text-subtle, .muted-text {
  color: var(--text-subtle);
  font-size: 12.5px;
}

.table-footnote, .table-more {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  background: #ffffff;
  font-size: 12px;
  color: var(--text-subtle);
}

.table-footnote a, .table-more a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 600;
}

/* ==========================================================================
   Smart Quick-Paste Panel (Glossy White)
   ========================================================================== */
.smart-paste-panel {
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-top: 1px solid var(--border-specular);
  border-radius: 20px;
  padding: 24px 28px;
  margin-bottom: 34px;
  box-shadow: var(--shadow-card);
}

.smart-paste-header {
  margin-bottom: 16px;
}

.smart-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.smart-flash-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #d97706;
}

.smart-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.smart-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.smart-paste-body textarea {
  width: 100%;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px 16px;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
  min-height: 75px;
  transition: all 0.2s ease;
}

.smart-paste-body textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.smart-paste-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-glass-secondary {
  padding: 9px 18px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-glass-secondary:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.smart-paste-feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 12.5px;
}

.smart-paste-feedback.success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.smart-paste-feedback.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.smart-paste-feedback.error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
}

/* ==========================================================================
   Bot Admin Cards & Provision Forms (White Theme)
   ========================================================================== */
.node-admin-panel {
  padding: 28px;
  margin-bottom: 28px;
}

.node-admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
}

.node-admin-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.node-server-name {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.node-server-meta {
  font-size: 12px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

.channel-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.channel-card {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.channel-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.channel-badge-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.channel-badge-label.zalo { color: #0068ff; }
.channel-badge-label.telegram { color: #0284c7; }

.runtime-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.provision-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-row input, .form-row select {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 14px;
  color: #0f172a;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-row input:focus, .form-row select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn-submit-channel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13.5px;
  color: #ffffff;
  cursor: pointer;
  border: 1px solid transparent;
  margin-top: 6px;
  transition: all 0.2s ease;
}

.btn-submit-channel.zalo {
  background: linear-gradient(180deg, #1a75ff 0%, #0052cc 100%);
  border-color: #004ecc;
  box-shadow: var(--shadow-btn-zalo);
}
.btn-submit-channel.zalo:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 104, 255, 0.4);
}

.btn-submit-channel.telegram {
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  border-color: #0369a1;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-submit-channel.telegram:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.4);
}

/* Admin Access Top Right */
.admin-access-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  padding: 6px 14px 6px 16px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.admin-access-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.lock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber-warning);
}

.admin-login-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-login-form input {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  padding: 5px 12px;
  font-size: 12px;
  color: #0f172a;
  width: 120px;
}

.admin-login-form input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.btn-unlock-glossy, .btn-unlock {
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  padding: 5px 12px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-unlock-glossy:hover, .btn-unlock:hover {
  background: #e2e8f0;
}

/* Empty states */
.empty-state, .empty {
  padding: 36px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 13.5px;
}

/* Responsive */
@media (max-width: 1200px) {
  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .shell {
    flex-direction: column;
  }
  .rail {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .channel-admin-grid {
    grid-template-columns: 1fr;
  }
  .content-wrapper, .content {
    padding: 24px 20px;
  }
}

/* ==========================================================================
   Mobile Native App Optimizations (PWA, Android APK & Full Mobile View)
   "Hiển thị đầy đủ, tròn trong màn hình điện thoại, chuẩn Safe-Area"
   ========================================================================== */

/* Target Audience Segment Badges */
.badge-province {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.22);
}
.badge-edu {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.22);
}
.badge-commune {
  background: rgba(5, 150, 105, 0.08);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.22);
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}

.mobile-top-bar {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  /* Prevent horizontal stretch & viewport zoom out */
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    -webkit-text-size-adjust: 100% !important;
  }

  .shell {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    flex-direction: column !important;
  }

  .rail {
    display: none !important;
  }

  /* Native Mobile Top App Header (with Notch Safe-Area) */
  .mobile-top-bar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px 16px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border-bottom: 1px solid var(--border-light) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 99 !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-logo {
    width: 26px;
    height: 26px;
    border-radius: 8px;
  }

  .mobile-brand-title {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
  }

  .mobile-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #059669;
    background: #ecfdf5;
    padding: 3px 8px;
    border-radius: 9999px;
    border: 1px solid #a7f3d0;
  }

  /* Content area perfectly framed inside phone bounds */
  .content-wrapper, .content {
    padding: 12px 12px calc(86px + env(safe-area-inset-bottom, 0px)) 12px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* Compact Dashboard Head */
  .dashboard-head, .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .page-title {
    font-size: 22px !important;
  }

  .page-subtitle {
    font-size: 12.5px !important;
  }

  .head-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .btn-glossy-primary {
    flex: 1 !important;
    justify-content: center !important;
    padding: 9px 12px !important;
    font-size: 13px !important;
  }

  /* Bento 2-Column Metrics on Phone */
  .metric-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 18px !important;
    width: 100% !important;
  }

  .metric-card {
    padding: 12px 12px !important;
    border-radius: 14px !important;
    box-sizing: border-box !important;
  }

  .metric-value {
    font-size: 22px !important;
  }

  .metric-label {
    font-size: 11px !important;
  }

  .metric-card.card-customers {
    grid-column: span 2 !important;
  }

  /* Node Cards on Phone */
  .node-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .node-card {
    border-radius: 16px !important;
    padding: 14px 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Glass Panels & Tables on Mobile Phone */
  .table-glass-card, .panel {
    border-radius: 16px !important;
    margin-bottom: 18px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Touch Scrollable Tables without distorting layout */
  .table-responsive,
  .table-shell,
  .admin-table-shell,
  .panel > table,
  .table-glass-card > table {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
  }

  .glass-table, .modern-table {
    width: 100% !important;
    min-width: 580px !important;
  }

  .glass-table th, .glass-table td,
  .modern-table th, .modern-table td {
    padding: 9px 12px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  /* Responsive Filter Toolbar */
  .table-action-bar, .table-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .filter-pills {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    width: 100% !important;
  }

  .filter-pill {
    flex: 1 1 auto !important;
    min-width: 55px !important;
    text-align: center !important;
    padding: 5px 8px !important;
    font-size: 11px !important;
    justify-content: center !important;
  }

  .search-input-wrap {
    width: 100% !important;
  }

  .search-input-wrap input {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 13px !important;
  }

  .channel-admin-grid {
    grid-template-columns: 1fr !important;
  }

  /* Native Mobile Bottom Navigation Bar (Docked with Safe-Area) */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(255, 255, 255, 0.97) !important;
    backdrop-filter: blur(28px) !important;
    -webkit-backdrop-filter: blur(28px) !important;
    border-top: 1px solid var(--border-light) !important;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)) 8px !important;
    justify-content: space-around !important;
    z-index: 100 !important;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08) !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .m-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 2px !important;
    color: var(--text-subtle) !important;
    text-decoration: none !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    padding: 4px 6px !important;
    border-radius: 10px !important;
    transition: all 0.2s ease !important;
    flex: 1 !important;
    max-width: 70px !important;
    text-align: center !important;
  }

  .m-nav-item svg {
    width: 19px !important;
    height: 19px !important;
  }

  .m-nav-item.active {
    color: var(--primary-blue) !important;
  }

  .m-nav-highlight {
    color: #0068ff !important;
  }
}


.table-responsive, .table-shell, .admin-table-shell {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  display: block !important;
}

.pill {
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}
