:root,
[data-theme="light"] {
  --bg-canvas: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #eff6ff;
  --bg-active: #dbeafe;
  --bg-chat: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --brand-primary: #0052e0;
  --brand-primary-hover: #0041b8;
  --brand-cyan: #00a8ff;
  --brand-bubble-stroke: #0052e0;
  --brand-bubble-fill: #ffffff;
  --brand-zalo-text: #0044cc;
  --bubble-in-bg: #ffffff;
  --bubble-in-text: #0f172a;
  --bubble-out-bg: #0052e0;
  --bubble-out-text: #ffffff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --success: #059669;
  --success-bg: #ecfdf5;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16);
}

[data-theme="dark"] {
  --bg-canvas: #0b1120;
  --bg-surface: #111827;
  --bg-subtle: #162032;
  --bg-hover: #1e293b;
  --bg-active: #1e3a5f;
  --bg-chat: #0d1526;
  --border: #1f2937;
  --border-strong: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --brand-primary: #2563eb;
  --brand-primary-hover: #3b82f6;
  --brand-cyan: #38bdf8;
  --brand-bubble-stroke: #3b82f6;
  --brand-bubble-fill: #0f172a;
  --brand-zalo-text: #f8fafc;
  --bubble-in-bg: #1e293b;
  --bubble-in-text: #f1f5f9;
  --bubble-out-bg: #1d4ed8;
  --bubble-out-text: #ffffff;
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --warn: #fbbf24;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --success: #34d399;
  --success-bg: rgba(16, 185, 129, 0.14);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.65);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--text-muted); margin: 4px 0 0; font-size: 13px; }

/* Login Screen */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  background: radial-gradient(circle at top right, rgba(0, 168, 255, 0.14), transparent 45%),
              radial-gradient(circle at bottom left, rgba(0, 82, 224, 0.12), transparent 50%),
              var(--bg-canvas);
}

.floating-theme-btn {
  position: fixed;
  top: 16px;
  right: 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.login-logo-img {
  height: 76px;
  width: auto;
  object-fit: contain;
  display: block;
}

.login-subtitle {
  color: var(--text-secondary);
  margin: 0 0 24px;
  font-size: 13.5px;
}

.login-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-footer {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.form-error {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

/* App Shell & Topbar */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.topbar {
  min-height: 58px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  flex-shrink: 0;
  z-index: 20;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
}

.account-picker-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px 6px 3px 10px;
  min-width: 0;
}

.account-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  outline: none;
  max-width: 210px;
  min-width: 0;
  cursor: pointer;
}

.account-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-tab svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-tab.active {
  background: var(--brand-primary);
  color: #ffffff;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.degraded, .status-dot.connecting, .status-dot.qr_pending, .status-dot.qr_scanned { background: var(--warn); }
.status-dot.kicked { background: var(--danger); }
.status-dot.offline { background: var(--text-muted); }

.status-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill.online { background: var(--success-bg); color: var(--success); }
.status-pill.kicked { background: var(--danger-bg); color: var(--danger); }
.status-pill.degraded, .status-pill.connecting, .status-pill.qr_pending, .status-pill.qr_scanned { background: var(--warn-bg); color: var(--warn); }
.status-pill.offline { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }

/* Buttons & Inputs */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--bg-hover); color: var(--brand-primary); border-color: var(--border-strong); }
.icon-btn.active { background: var(--bg-active); color: var(--brand-primary); border-color: var(--brand-primary); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 6px; border: none; background: transparent; }
.icon-btn.xs svg { width: 13px; height: 13px; }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s;
  text-align: center;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--brand-primary); color: #ffffff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-primary-hover); }
.btn-secondary { background: var(--bg-subtle); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }
.btn-danger-outline { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-bg); }

.input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--brand-primary); }
.textarea { min-height: 88px; resize: vertical; font-family: inherit; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.field-group { display: flex; flex-direction: column; }

/* Main Body & Tabs */
.main-body {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  overflow: hidden;
}

.tab-panel {
  display: none;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.tab-panel.active { display: flex; }

/* Chat Layout */
.chat-layout {
  flex-direction: row;
  overflow: hidden;
}

.thread-sidebar {
  width: 340px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-toolbar {
  padding: 10px 12px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-box {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.search-ico {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 10px 0 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.search-input:focus { border-color: var(--brand-primary); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}

.filter-chip {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.filter-chip.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.thread-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.thread-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 2px;
}
.thread-item:hover { background: var(--bg-hover); }
.thread-item.active { background: var(--bg-active); }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-cyan));
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.thread-content { flex: 1; min-width: 0; }
.thread-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.thread-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.thread-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 3px; }
.thread-snippet {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unread-badge {
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.thread-tags-mini { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--brand-primary);
  border: 1px solid var(--border);
}

/* Chat Pane */
.chat-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
}

.alert-banner {
  background: var(--warn-bg);
  color: var(--warn);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
}
.alert-banner.danger { background: var(--danger-bg); color: var(--danger); }

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.chat-empty-card {
  max-width: 420px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
}

.chat-empty-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 12px;
}

.chat-empty-card h3 { margin: 4px 0 8px; font-size: 16px; }
.chat-empty-card p { margin: 0; color: var(--text-muted); font-size: 13px; }

.chat-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.chat-header-left, .chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-header-meta { min-width: 0; }
.chat-title {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-subline {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11.5px;
}
.mono-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.message-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
}

.message-list {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.msg-row.self { justify-content: flex-end; }
.msg-row.peer { justify-content: flex-start; }

.msg-bubble {
  max-width: min(74%, 640px);
  padding: 9px 13px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  word-break: break-word;
  position: relative;
}
.msg-row.peer .msg-bubble {
  background: var(--bubble-in-bg);
  color: var(--bubble-in-text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-row.self .msg-bubble {
  background: var(--bubble-out-bg);
  color: var(--bubble-out-text);
  border-bottom-right-radius: 4px;
}
.msg-bubble.recalled {
  opacity: 0.65;
  font-style: italic;
}

.msg-sender {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 3px;
}

.msg-quote {
  border-left: 3px solid var(--brand-cyan);
  background: rgba(0, 0, 0, 0.06);
  padding: 5px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}
.msg-row.self .msg-quote { background: rgba(255, 255, 255, 0.14); }
.msg-quote-sender { font-weight: 700; font-size: 11px; margin-bottom: 1px; }

/* Only .msg-text gets pre-wrap to avoid extra blank lines around child elements */
.msg-text {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.45;
}

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.msg-img {
  max-width: 260px;
  max-height: 260px;
  border-radius: 10px;
  cursor: zoom-in;
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
}

.msg-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  font-size: 10.5px;
  opacity: 0.72;
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}
.reaction-chip {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 11px;
}

.msg-reply-btn {
  opacity: 0;
  transition: opacity 0.12s;
}
.msg-row:hover .msg-reply-btn { opacity: 1; }

.typing-bar {
  padding: 4px 20px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Composer */
.composer-wrap {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  position: relative;
  flex-shrink: 0;
}

.quote-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--brand-primary);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
}
.quote-bar-body { min-width: 0; }
.quote-bar-title { font-size: 11.5px; font-weight: 700; color: var(--brand-primary); }
.quote-bar-text { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pending-files-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.pending-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
}
.pending-file-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 5px; }

.quick-reply-popover {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(100% + 6px);
  max-width: 520px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 30;
}
.qr-pop-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.qr-pop-item:hover { background: var(--bg-hover); }
.qr-pop-head { display: flex; gap: 8px; align-items: baseline; }
.qr-pop-shortcut { font-weight: 700; color: var(--brand-primary); font-family: monospace; }
.qr-pop-title { font-weight: 600; font-size: 12.5px; }
.qr-pop-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 980px;
  margin: 0 auto;
}

.composer-input {
  flex: 1;
  min-width: 0;
  max-height: 140px;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
}
.composer-input:focus { border-color: var(--brand-primary); }
.send-btn { width: 42px; min-height: 40px; padding: 0; flex-shrink: 0; }
.send-btn svg { width: 17px; height: 17px; }

/* Right Info Drawer */
.info-drawer {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.drawer-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-header h4 { margin: 0; font-size: 14px; }
.drawer-body { padding: 14px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.preset-tags, .active-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.preset-tag-btn {
  border: 1px dashed var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}
.preset-tag-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.inline-add { display: flex; gap: 6px; }
.inline-add .input { flex: 1; }

/* Page Panels (Auth, API, Health) */
.page-scroll {
  overflow-y: auto;
  padding: 20px;
  flex-direction: column;
}
.page-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.grid-2-tight {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-header { margin-bottom: 16px; }
.card-header h3 { margin: 0; font-size: 15.5px; }

.qr-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.qr-box {
  width: 240px;
  height: 240px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  background: #ffffff;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  overflow: hidden;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder { font-size: 13px; color: #64748b; }
.qr-status-msg { font-size: 13px; font-weight: 600; color: var(--brand-primary); text-align: center; min-height: 20px; }

/* Balanced 2x2 and 2-col button grids (Global Rule #6 compliant) */
.action-grid-2x2, .action-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.action-grid-2x2 .btn, .action-grid-2 .btn {
  width: 100%;
  min-height: 44px;
}

.copy-row { display: flex; gap: 6px; align-items: stretch; }
.copy-row .input { flex: 1; min-width: 0; }
.copy-row .btn { flex-shrink: 0; padding: 0 12px; }

.code-box-wrap { margin-top: 16px; }
.api-config-stack {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.api-advanced-card { padding: 0; overflow: hidden; }
.api-advanced-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  min-height: 48px;
  cursor: pointer;
  user-select: none;
}
.api-advanced-summary::-webkit-details-marker { display: none; }
.api-advanced-summary:hover { background: var(--bg-subtle); }
.api-advanced-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.api-advanced-heading h3 { margin: 0; font-size: 15px; }
.api-advanced-badge {
  flex-shrink: 0;
  margin-top: 1px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-hover);
  color: var(--brand-primary);
  border: 1px solid var(--border);
}
.api-advanced-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.18s ease;
}
.api-advanced-card[open] .api-advanced-chevron {
  transform: rotate(180deg);
}
.api-advanced-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.api-endpoints-wrap { margin-top: 4px; }
.code-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-x: auto;
  margin: 0;
  color: var(--text-secondary);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.metric-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.metric-value { font-size: 20px; font-weight: 800; margin-top: 4px; }
.metric-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.sync-status-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
}

.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }

.table-wrap { width: 100%; overflow-x: auto; }
.logs-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.logs-table th, .logs-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.logs-table th { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.lvl-badge { padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.lvl-info { background: var(--bg-hover); color: var(--brand-primary); }
.lvl-warn { background: var(--warn-bg); color: var(--warn); }
.lvl-error { background: var(--danger-bg); color: var(--danger); }

/* Modals & Lightbox */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}
.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-lg { max-width: 560px; }
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px 18px; max-height: 75dvh; overflow-y: auto; }
.modal-footer { margin-top: 6px; }

.qr-manage-list { display: flex; flex-direction: column; gap: 8px; }
.qr-manage-item {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.lightbox-wrap { position: relative; max-width: 92vw; max-height: 90dvh; }
.lightbox-wrap img { max-width: 92vw; max-height: 88dvh; border-radius: 12px; display: block; }
.lightbox-close { position: absolute; top: -14px; right: -14px; }

/* Toast */
.toast-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
}
.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--brand-primary);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 600;
  max-width: 340px;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

.mobile-only { display: none; }

/* Responsive Tablet & Mobile */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .info-drawer {
    position: fixed;
    top: 58px;
    right: 0;
    bottom: 0;
    z-index: 40;
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 820px) {
  .mobile-only { display: inline-flex; }
  .topbar {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }
  .topbar-left { flex: 1; min-width: 0; }
  .brand-logo { height: 32px; }
  .topbar-right { flex-shrink: 0; }
  .status-pill { display: none; }
  .topbar-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: space-between;
    scrollbar-width: none;
  }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .nav-tab { flex: 1; justify-content: center; padding: 7px 8px; font-size: 12.5px; }
  .account-select { max-width: 135px; }

  /* Master-Detail Chat Pattern on Mobile */
  .thread-sidebar { width: 100%; border-right: none; }
  .chat-layout:not(.mobile-detail) .chat-pane { display: none; }
  .chat-layout.mobile-detail .thread-sidebar { display: none; }
  .chat-layout.mobile-detail .chat-pane { display: flex; width: 100%; }

  .msg-bubble { max-width: 86%; }
  .page-scroll { padding: 12px; }
  .card { padding: 14px; }
  .api-advanced-summary { padding: 14px; }
  .api-advanced-heading { flex-direction: column; gap: 6px; }
  .api-advanced-body { padding: 14px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}


/* ==========================================================================
   1Zalo Multi-Tenant Platform: Landing Page, Auth Tabs, Profiles Hub & QR Modal
   ========================================================================== */

/* Landing Page — Bright, Playful Zalo-Inspired Light Aesthetic */
.landing-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 80% -5%, rgba(0, 145, 255, 0.16), transparent 60%),
    radial-gradient(ellipse 60% 45% at 8% 18%, rgba(0, 104, 255, 0.09), transparent 55%),
    linear-gradient(180deg, #f4f9ff 0%, #ffffff 42%, #f5f9ff 100%);
}

[data-theme="dark"] .landing-view {
  background:
    radial-gradient(ellipse 80% 50% at 80% -5%, rgba(0, 168, 255, 0.14), transparent 60%),
    radial-gradient(ellipse 60% 45% at 8% 18%, rgba(37, 99, 235, 0.12), transparent 55%),
    var(--bg-canvas);
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.landing-nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.landing-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  display: block;
}

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.landing-nav-actions a.btn {
  text-decoration: none;
}

.landing-main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 44px 24px 68px;
  display: flex;
  flex-direction: column;
  gap: 64px;
}

/* 2-Column Hero */
.landing-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: 42px;
}

.landing-hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  min-width: 0;
}

.landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e5f1ff;
  border: 1px solid #bfdbfe;
  color: #0052e0;
  font-size: 13px;
  font-weight: 600;
}

[data-theme="dark"] .landing-badge {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

.badge-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22); }
  50% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.04); }
}

.landing-title {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: -0.028em;
  color: var(--text-primary);
}

.title-highlight {
  background: linear-gradient(135deg, #0068ff 0%, #00a8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.landing-desc {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 540px;
}

.landing-cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn-lg {
  min-height: 48px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
}

.landing-btn-glow {
  background: linear-gradient(135deg, #0068ff 0%, #0088ff 100%);
  box-shadow: 0 10px 24px rgba(0, 104, 255, 0.28);
  transition: transform 0.16s, box-shadow 0.16s;
}

.landing-btn-glow:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 104, 255, 0.36);
}

.landing-trust-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 4px;
}

.trust-pill {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Playful Hero Visual Showcase */
.landing-hero-visual {
  position: relative;
  padding: 28px 8px 30px;
  min-width: 0;
}

.hero-blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(42px);
  pointer-events: none;
  z-index: 0;
}

.hero-blob-1 {
  width: 240px;
  height: 240px;
  top: -10px;
  right: 10px;
  background: rgba(0, 168, 255, 0.24);
}

.hero-blob-2 {
  width: 200px;
  height: 200px;
  bottom: 0;
  left: 0;
  background: rgba(0, 104, 255, 0.16);
}

.showcase-window {
  position: relative;
  z-index: 2;
  background: var(--bg-surface);
  border: 1px solid rgba(0, 104, 255, 0.16);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 82, 224, 0.14);
  overflow: hidden;
  animation: gentleFloat 6s ease-in-out infinite;
}

@keyframes gentleFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.showcase-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 16px;
  background: #f0f7ff;
  border-bottom: 1px solid #dbeafe;
}

[data-theme="dark"] .showcase-topbar {
  background: var(--bg-subtle);
  border-bottom-color: var(--border);
}

.showcase-dots {
  display: flex;
  gap: 6px;
}

.showcase-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.dot-red { background: #fb7185; }
.dot-yellow { background: #fbbf24; }
.dot-green { background: #34d399; }

.showcase-url {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.showcase-online-pill {
  font-size: 11.5px;
  font-weight: 700;
  color: #059669;
  background: #d1fae5;
  padding: 3px 9px;
  border-radius: 999px;
}

[data-theme="dark"] .showcase-online-pill {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.showcase-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.showcase-profiles-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

.mini-profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  min-width: 0;
}

.mini-profile-chip.active {
  background: #eff6ff;
  border-color: #93c5fd;
}

[data-theme="dark"] .mini-profile-chip.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(59, 130, 246, 0.45);
}

.mini-av {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.av-blue { background: linear-gradient(135deg, #0068ff, #2563eb); }
.av-cyan { background: linear-gradient(135deg, #0284c7, #00a8ff); }

.mini-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.mini-info strong {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-info span {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #10b981;
  flex-shrink: 0;
}

.mini-add-chip {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px;
  border: 1.5px dashed #3b82f6;
  background: #f0f7ff;
  color: #0052e0;
  font-size: 11px;
  font-weight: 700;
}

[data-theme="dark"] .mini-add-chip {
  background: rgba(37, 99, 235, 0.14);
  color: #60a5fa;
}

.mini-plus {
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
}

.showcase-chat-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: #f4f8fd;
  border: 1px solid #e2ecf9;
}

[data-theme="dark"] .showcase-chat-preview {
  background: var(--bg-chat);
  border-color: var(--border);
}

.chat-bubble-demo {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 15px;
  font-size: 13px;
  line-height: 1.45;
}

.chat-bubble-demo p {
  margin: 0;
}

.chat-bubble-demo.in {
  align-self: flex-start;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.chat-bubble-demo.out {
  align-self: flex-end;
  background: linear-gradient(135deg, #0068ff 0%, #0088ff 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 16px rgba(0, 104, 255, 0.22);
}

.bubble-sender {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-primary);
  margin-bottom: 3px;
}

.bubble-meta {
  display: block;
  font-size: 10.5px;
  opacity: 0.85;
  margin-top: 4px;
  text-align: right;
}

.floating-qr-card {
  position: absolute;
  left: -12px;
  bottom: 4px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid #dbeafe;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] .floating-qr-card {
  border-color: var(--border-strong);
}

.floating-qr-ico {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #0068ff, #00a8ff);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.floating-qr-ico svg {
  width: 19px;
  height: 19px;
}

.floating-qr-card strong {
  display: block;
  font-size: 12.5px;
  color: var(--text-primary);
}

.floating-qr-card span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.floating-api-card {
  position: absolute;
  right: 14px;
  top: -6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid #dbeafe;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

[data-theme="dark"] .floating-api-card {
  border-color: var(--border-strong);
}

.api-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0284c7;
  font-size: 11px;
  font-weight: 700;
}

/* Sections & Feature Cards */
.landing-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.section-eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-primary);
}

.landing-section-title {
  margin: 0;
  text-align: center;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 24px;
  box-shadow: 0 6px 20px rgba(0, 82, 224, 0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: #93c5fd;
  box-shadow: 0 16px 36px rgba(0, 82, 224, 0.11);
}

.feature-ico {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #e5f1ff;
  color: #0068ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fc-cyan .feature-ico {
  background: #e0f7ff;
  color: #0284c7;
}

.fc-indigo .feature-ico {
  background: #eef2ff;
  color: #4f46e5;
}

[data-theme="dark"] .feature-ico {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
}

.feature-ico svg {
  width: 24px;
  height: 24px;
}

.feature-card h3 {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.feature-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.landing-steps {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 28px;
  box-shadow: 0 8px 24px rgba(0, 82, 224, 0.05);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.step-num {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0068ff 0%, #00a8ff 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0, 104, 255, 0.24);
}

.step-item h4 {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.step-item p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Vibrant Zalo-Blue CTA Banner */
.landing-cta-banner {
  background: linear-gradient(135deg, #0052e0 0%, #0078ff 55%, #00a8ff 100%);
  border-radius: 24px;
  padding: 36px 36px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: 0 20px 44px rgba(0, 104, 255, 0.26);
}

.cta-banner-copy h2 {
  margin: 0;
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 800;
}

.cta-banner-copy p {
  margin: 6px 0 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
}

.btn-white {
  background: #ffffff;
  color: #0052e0;
  border: none;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

.btn-white:hover {
  background: #f0f7ff;
  transform: translateY(-1px);
}

.landing-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  background: var(--bg-surface);
}

.landing-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
}

/* Auth View Tabs & Floating Back */
.floating-back-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  text-decoration: none;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
}

.auth-tab {
  min-height: 38px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tab.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

/* Profiles Hub View */
.profiles-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

.profiles-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  max-width: 240px;
  min-width: 0;
  overflow: hidden;
}

.user-pill > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.role-tag-root {
  background: var(--brand-primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.profiles-main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.profiles-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.profiles-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.profiles-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profiles-stats .status-pill {
  display: inline-flex;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

/* Big '+' Add Zalo Profile Card */
.profile-add-card {
  min-height: 224px;
  border: 2px dashed var(--border-strong);
  border-radius: 18px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 18px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s, background 0.18s, transform 0.18s, box-shadow 0.18s;
  color: var(--text-primary);
}

.profile-add-card:hover {
  border-color: var(--brand-primary);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.profile-add-plus {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  background: var(--bg-active);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s, background 0.18s, color 0.18s;
}

.profile-add-card:hover .profile-add-plus {
  background: var(--brand-primary);
  color: #ffffff;
  transform: scale(1.06);
}

.profile-add-plus svg {
  width: 34px;
  height: 34px;
}

.profile-add-title {
  font-size: 16px;
  font-weight: 700;
}

.profile-add-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Profile Card — High-Contrast Online / Offline / Kicked States */
.profile-card {
  min-height: 232px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}

.profile-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.profile-card:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.profile-card-state-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.profile-state-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.state-led {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.profile-counts-mini {
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.8;
  white-space: nowrap;
}

.profile-card-inner {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.profile-state-hint {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* ONLINE state: crisp green */
.profile-card.state-online {
  border-color: rgba(16, 185, 129, 0.45);
}

.profile-card.state-online .profile-card-state-bar {
  background: #ecfdf5;
  color: #047857;
  border-bottom-color: #a7f3d0;
}

[data-theme="dark"] .profile-card.state-online .profile-card-state-bar {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-bottom-color: rgba(16, 185, 129, 0.25);
}

.profile-card.state-online .state-led {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.24);
  animation: pulseDot 2s infinite;
}

/* OFFLINE state: unmistakably disconnected (soft rose-red header + desaturated avatar + dashed border) */
.profile-card.state-offline {
  background: color-mix(in srgb, var(--bg-surface) 88%, var(--bg-subtle));
  border-color: #fca5a5;
  border-style: solid;
}

[data-theme="dark"] .profile-card.state-offline {
  border-color: rgba(248, 113, 113, 0.35);
}

.profile-card.state-offline .profile-card-state-bar {
  background: #fef2f2;
  color: #b91c1c;
  border-bottom-color: #fecaca;
}

[data-theme="dark"] .profile-card.state-offline .profile-card-state-bar {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border-bottom-color: rgba(239, 68, 68, 0.28);
}

.profile-card.state-offline .state-led {
  background: #ef4444;
}

.profile-card.state-offline .profile-avatar {
  background: #e2e8f0;
  color: #64748b;
  filter: grayscale(1);
  opacity: 0.78;
}

[data-theme="dark"] .profile-card.state-offline .profile-avatar {
  background: #1e293b;
  color: #94a3b8;
}

.profile-card.state-offline .profile-name {
  color: var(--text-secondary);
}

/* KICKED state: urgent crimson alert */
.profile-card.state-kicked {
  border-color: #ef4444;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.12);
}

.profile-card.state-kicked .profile-card-state-bar {
  background: #fee2e2;
  color: #991b1b;
  border-bottom-color: #fca5a5;
}

.profile-card.state-kicked .state-led {
  background: #dc2626;
}

.profile-card.state-kicked .profile-avatar {
  filter: grayscale(1);
  opacity: 0.75;
}

/* DEGRADED / CONNECTING states: amber */
.profile-card.state-degraded,
.profile-card.state-connecting {
  border-color: #fbbf24;
}

.profile-card.state-degraded .profile-card-state-bar,
.profile-card.state-connecting .profile-card-state-bar {
  background: #fffbeb;
  color: #b45309;
  border-bottom-color: #fde68a;
}

.profile-card.state-degraded .state-led,
.profile-card.state-connecting .state-led {
  background: #f59e0b;
}

.btn-danger-solid {
  background: #dc2626;
  color: #ffffff;
  border: none;
}

.btn-danger-solid:hover {
  background: #b91c1c;
}

.profile-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--bg-active);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  border: 2px solid var(--bg-surface);
}

.profile-meta {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
  font-size: 12.5px;
}

.profile-status-row .status-pill {
  display: inline-flex;
  font-size: 11.5px;
  padding: 3px 9px;
}

.profile-counts {
  color: var(--text-secondary);
  font-weight: 500;
}

.profile-card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.profile-card-actions-secondary {
  display: flex;
  gap: 6px;
}

.back-profiles-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* 1-Click QR Add Modal */
.qr-add-modal-card {
  max-width: 420px;
}

.qr-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.qr-modal-box {
  width: 248px;
  height: 248px;
  margin: 4px auto 0;
}

.qr-modal-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.qr-modal-body .modal-footer {
  width: 100%;
  margin-top: 4px;
}

.qr-success-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  color: var(--success);
}

.qr-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qr-success-icon svg {
  width: 30px;
  height: 30px;
}

@media (max-width: 960px) {
  .landing-hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .landing-hero-copy {
    align-items: center;
    text-align: center;
  }
  .landing-cta-row,
  .landing-trust-pills {
    justify-content: center;
  }
  .landing-features,
  .steps-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .landing-nav-inner {
    padding: 10px 12px;
    gap: 8px;
  }
  .landing-logo {
    height: 28px;
  }
  .landing-nav-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .landing-nav-actions .btn {
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  .landing-main {
    padding: 28px 16px 48px;
    gap: 40px;
  }
  .landing-cta-row {
    width: 100%;
    flex-direction: column;
  }
  .landing-cta-row .btn {
    width: 100%;
    justify-content: center;
  }
  .showcase-profiles-row {
    grid-template-columns: 1fr;
  }
  .floating-qr-card,
  .floating-api-card {
    position: static;
    margin-top: 10px;
    width: 100%;
    justify-content: center;
  }
  .landing-cta-banner {
    padding: 26px 20px;
    text-align: center;
    justify-content: center;
  }
  .landing-cta-banner .btn {
    width: 100%;
    justify-content: center;
  }
  .landing-footer-inner {
    justify-content: center;
    text-align: center;
  }
  .profiles-main {
    padding: 18px 14px 36px;
  }
  .profiles-grid {
    grid-template-columns: 1fr;
  }
  .user-pill {
    max-width: 150px;
  }
}

/* =========================================================
   Legal Pages (Terms of Service & Privacy Policy) & Footer Links
   ========================================================= */

.footer-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-legal-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-legal-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  padding: 4px 2px;
  transition: color 0.15s;
}

.footer-legal-links a:hover,
.footer-legal-links a[aria-current="page"] {
  color: var(--brand-primary);
}

.profiles-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 14px 20px;
}

.profiles-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Auth Legal Consent & Footer Links */
.auth-legal-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 4px 0 8px;
  cursor: pointer;
}

.auth-legal-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 1px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.auth-legal-check a,
.login-footer-links a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-legal-check a:hover,
.login-footer-links a:hover {
  text-decoration: underline;
}

.login-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  flex-wrap: wrap;
}

/* Legal Standalone Page Shell */
.legal-body {
  height: auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

.legal-top-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.legal-nav-pill {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.legal-nav-pill:hover {
  color: var(--text-primary);
}

.legal-nav-pill.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.legal-page {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.legal-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 34px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.legal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--brand-primary);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}

.legal-title {
  margin: 0 0 10px;
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text-primary);
}

.legal-subtitle {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 820px;
}

.legal-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.legal-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.legal-toc {
  position: sticky;
  top: 82px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.legal-toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.legal-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legal-toc-list a {
  display: block;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.legal-toc-list a:hover {
  background: var(--bg-hover);
  color: var(--brand-primary);
}

.legal-article {
  min-width: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 36px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.legal-section {
  scroll-margin-top: 88px;
}

.legal-section h2 {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.legal-section p {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section ul {
  margin: 8px 0 12px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.68;
}

.legal-section a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
}

.legal-section a:hover {
  text-decoration: underline;
}

.legal-section code,
.legal-callout code,
.legal-subtitle code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  word-break: break-word;
}

.legal-callout {
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.65;
  border: 1px solid var(--border);
}

.legal-callout.info {
  background: var(--bg-hover);
  border-color: rgba(0, 82, 224, 0.22);
  color: var(--text-primary);
}

.legal-callout.warn {
  background: var(--warn-bg);
  border-color: rgba(217, 119, 6, 0.28);
  color: var(--text-primary);
}

.legal-callout ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.legal-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 12px 0;
}

.legal-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.55;
}

.legal-table th,
.legal-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.legal-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-primary);
}

.legal-table td {
  color: var(--text-secondary);
}

.legal-table tbody tr:last-child td {
  border-bottom: none;
}

.legal-contact-list {
  list-style: none !important;
  padding-left: 0 !important;
}

@media (max-width: 900px) {
  .legal-layout {
    grid-template-columns: 1fr;
  }
  .legal-toc {
    position: static;
  }
  .legal-top-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .legal-page {
    padding: 20px 14px 44px;
  }
  .legal-hero {
    padding: 22px 18px;
    border-radius: 18px;
  }
  .legal-article {
    padding: 22px 18px;
    border-radius: 18px;
  }
  .footer-brand-group,
  .footer-legal-links,
  .profiles-footer-inner {
    justify-content: center;
    text-align: center;
  }
}


/* ============================================================
   SEO PAGES, COMPARISON TABLES, FAQ ACCORDION & FOOTER HUB
   ============================================================ */

.landing-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.landing-nav-link {
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.landing-nav-link:hover,
.landing-nav-link.active {
  background: var(--bg-hover);
  color: var(--brand-primary);
}

/* Homepage Pancake-Alternative Highlight Section */
.seo-switch-section {
  background: linear-gradient(135deg, rgba(0, 104, 255, 0.06) 0%, rgba(14, 165, 233, 0.08) 100%);
  border: 1px solid rgba(0, 104, 255, 0.16);
  border-radius: 26px;
  padding: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 28px;
  align-items: center;
}

[data-theme="dark"] .seo-switch-section {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14) 0%, rgba(14, 165, 233, 0.1) 100%);
  border-color: rgba(59, 130, 246, 0.3);
}

.seo-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.seo-switch-copy h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.seo-switch-copy p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.seo-switch-points {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.seo-switch-points li {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

.seo-switch-points li::before {
  content: "✓";
  color: #10b981;
  font-weight: 800;
  flex-shrink: 0;
}

.seo-switch-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.seo-switch-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.seo-switch-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Diff / Code Blocks */
.seo-code-block {
  max-width: 100%;
  margin: 12px 0;
  padding: 16px 18px;
  border-radius: 14px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.seo-code-block code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: inherit !important;
  font-size: inherit !important;
  word-break: normal !important;
  white-space: pre;
}

.seo-diff-line {
  display: block;
  padding: 2px 6px;
  border-radius: 5px;
}

.seo-diff-old {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.seo-diff-new {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

/* Breadcrumb */
.seo-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.seo-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.seo-breadcrumb a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

/* SEO Hero Actions */
.seo-hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

/* Pain-Point & Highlight Grids */
.seo-pain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.seo-pain-card {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.seo-pain-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.seo-pain-card p {
  margin: 0 !important;
  font-size: 13.5px !important;
  line-height: 1.58 !important;
  color: var(--text-secondary);
}

/* Comparison Table Enhancements */
.seo-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 14px 0;
  background: var(--bg-surface);
}

.seo-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.55;
}

.seo-table th,
.seo-table td {
  text-align: left;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.seo-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-primary);
}

.seo-table td {
  color: var(--text-secondary);
}

.seo-table tbody tr:last-child td {
  border-bottom: none;
}

.seo-table th.col-1zalo {
  background: rgba(0, 104, 255, 0.1);
  color: var(--brand-primary);
}

.seo-table td.col-1zalo {
  background: rgba(0, 104, 255, 0.035);
  color: var(--text-primary);
  font-weight: 500;
}

[data-theme="dark"] .seo-table th.col-1zalo {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

[data-theme="dark"] .seo-table td.col-1zalo {
  background: rgba(59, 130, 246, 0.08);
}

.seo-badge-yes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  font-size: 12px;
  font-weight: 700;
}

[data-theme="dark"] .seo-badge-yes {
  color: #34d399;
}

.seo-badge-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
}

[data-theme="dark"] .seo-badge-warn {
  color: #fbbf24;
}

/* FAQ Accordion */
.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.seo-faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.seo-faq-item[open] {
  border-color: rgba(0, 104, 255, 0.35);
}

.seo-faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 18px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.seo-faq-item summary::-webkit-details-marker {
  display: none;
}

.seo-faq-item summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-primary);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.seo-faq-item[open] summary::after {
  content: "−";
}

.seo-faq-body {
  padding: 0 18px 16px;
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--text-secondary);
}

.seo-faq-body p {
  margin: 0;
}

/* Inline CTA Card */
.seo-cta-card {
  background: linear-gradient(135deg, #0052e0 0%, #0088ff 100%);
  color: #ffffff;
  border-radius: 20px;
  padding: 26px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.seo-cta-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #ffffff;
}

.seo-cta-card p {
  margin: 0 !important;
  font-size: 14.5px !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Related Articles Grid */
.seo-related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.seo-related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  text-decoration: none !important;
  transition: border-color 0.15s, transform 0.15s;
}

.seo-related-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.seo-related-card strong {
  font-size: 14.5px;
  color: var(--text-primary);
  line-height: 1.4;
}

.seo-related-card span {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Multi-column SEO Footer */
.seo-footer-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: 28px;
  padding: 10px 0 22px;
  border-bottom: 1px solid var(--border);
}

.seo-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.seo-footer-brand p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 380px;
}

.seo-footer-col h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.seo-footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seo-footer-col a {
  font-size: 13.5px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.seo-footer-col a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.seo-footer-bottom {
  max-width: 1120px;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

@media (max-width: 960px) {
  .landing-nav-links {
    display: none;
  }
  .seo-switch-section {
    grid-template-columns: 1fr;
    padding: 26px 22px;
  }
  .seo-footer-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

@media (max-width: 640px) {
  .seo-switch-points,
  .seo-pain-grid,
  .seo-related-grid {
    grid-template-columns: 1fr;
  }
  .seo-hero-actions .btn,
  .seo-switch-actions .btn,
  .seo-cta-card .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .seo-cta-card {
    padding: 22px 18px;
  }
  .seo-footer-bottom {
    justify-content: center;
    text-align: center;
  }
}

/* =========================================================
   Pricing Section (Landing Page) & Billing / Renewal UI
   ========================================================= */

.pricing-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pricing-lead {
  margin: 8px auto 0;
  max-width: 640px;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.pricing-trial-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(0, 104, 255, 0.09) 0%, rgba(16, 185, 129, 0.09) 100%);
  border: 1px solid rgba(0, 104, 255, 0.22);
  font-size: 14px;
  color: var(--text-primary);
  text-align: center;
}

[data-theme="dark"] .pricing-trial-strip {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16) 0%, rgba(16, 185, 129, 0.14) 100%);
  border-color: rgba(59, 130, 246, 0.34);
}

.trial-strip-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #10b981;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.pricing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px 20px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pricing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.pricing-card.popular {
  border: 2px solid var(--brand-primary);
  box-shadow: 0 14px 32px rgba(0, 104, 255, 0.14);
}

.pricing-card.best-value {
  border-color: rgba(16, 185, 129, 0.45);
}

.pricing-ribbon {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0068ff 0%, #0ea5e9 100%);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.3);
}

.pricing-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pricing-card-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.pricing-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pricing-badge.neutral {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.pricing-badge.save {
  background: rgba(14, 165, 233, 0.14);
  color: #0284c7;
}

.pricing-badge.popular-badge {
  background: rgba(0, 104, 255, 0.14);
  color: var(--brand-primary);
}

.pricing-badge.best {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

[data-theme="dark"] .pricing-badge.save {
  color: #38bdf8;
}

[data-theme="dark"] .pricing-badge.best {
  color: #34d399;
}

.pricing-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.pricing-monthly {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.pricing-price-row span {
  font-size: 13px;
  color: var(--text-muted);
}

.pricing-total-line {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.pricing-strike {
  color: var(--text-muted);
  margin-right: 4px;
}

.pricing-save-note {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.pricing-save-note.positive {
  color: #059669;
}

[data-theme="dark"] .pricing-save-note.positive {
  color: #34d399;
}

.pricing-perks {
  list-style: none;
  margin: 4px 0 auto;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.pricing-card .btn {
  margin-top: 8px;
  min-height: 44px;
  text-decoration: none;
}

/* Profile Card Billing Pill */
.profile-billing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.profile-billing-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.profile-billing-pill.trial {
  background: rgba(0, 104, 255, 0.12);
  color: var(--brand-primary);
}

.profile-billing-pill.trial-warn {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.profile-billing-pill.active {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
}

.profile-billing-pill.expired {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.profile-billing-pill.exempt {
  background: rgba(139, 92, 246, 0.14);
  color: #7c3aed;
}

[data-theme="dark"] .profile-billing-pill.trial-warn {
  color: #fbbf24;
}

[data-theme="dark"] .profile-billing-pill.active {
  color: #34d399;
}

[data-theme="dark"] .profile-billing-pill.expired {
  color: #f87171;
}

[data-theme="dark"] .profile-billing-pill.exempt {
  color: #a78bfa;
}

.profile-renew-link {
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-primary);
  cursor: pointer;
  border-radius: 6px;
}

.profile-renew-link:hover {
  background: rgba(0, 104, 255, 0.08);
  text-decoration: underline;
}

/* Workspace Billing Banner */
.workspace-billing-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.workspace-billing-banner.warning {
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
}

.workspace-billing-banner.expired {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
}

[data-theme="dark"] .workspace-billing-banner.warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

[data-theme="dark"] .workspace-billing-banner.expired {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.workspace-billing-banner-text {
  flex: 1 1 240px;
  min-width: 0;
}

/* Billing Modal & Plan Selector */
.modal-card.modal-xl.billing-modal-card {
  width: 100%;
  max-width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.billing-modal-card .modal-body {
  overflow-y: auto;
  max-height: calc(100dvh - 104px);
}

.billing-paywall-notice {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #92400e;
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 600;
}

[data-theme="dark"] .billing-paywall-notice {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

.billing-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  font-size: 13.5px;
}

.billing-status-bar .account-select {
  max-width: 100%;
  min-width: 0;
}

.billing-plans-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.billing-plan-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px 16px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.billing-plan-option:hover {
  border-color: rgba(0, 104, 255, 0.45);
}

.billing-plan-option.selected {
  border-color: var(--brand-primary);
  background: rgba(0, 104, 255, 0.05);
  box-shadow: 0 6px 18px rgba(0, 104, 255, 0.14);
}

.billing-plan-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  flex-wrap: wrap;
}

.billing-plan-option-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.billing-plan-option-monthly {
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1.2;
}

.billing-plan-option-monthly span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.billing-plan-option-total {
  font-size: 13px;
  color: var(--text-secondary);
}

.billing-plan-option-save {
  font-size: 12px;
  font-weight: 700;
  color: #059669;
}

[data-theme="dark"] .billing-plan-option-save {
  color: #34d399;
}

.billing-modal-card .modal-footer.action-grid-2 .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  line-height: 1.25;
}

/* Checkout Transfer / VietQR Box */
.billing-checkout-box {
  padding: 16px;
  border-radius: 16px;
  border: 1.5px solid rgba(0, 104, 255, 0.35);
  background: rgba(0, 104, 255, 0.04);
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.billing-checkout-box.no-qr {
  grid-template-columns: minmax(0, 1fr);
}

.billing-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
}

.billing-qr-wrap img {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 8px;
  display: block;
}

.billing-transfer-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.billing-transfer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 13px;
}

.billing-transfer-row strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13.5px;
  word-break: break-all;
}

/* Orders History */
.billing-orders-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.billing-orders-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.billing-orders-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.root-billing-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.root-billing-filter.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.billing-orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.billing-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  font-size: 13px;
}

.billing-order-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 220px;
}

.billing-order-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 1024px) {
  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .pricing-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .billing-plans-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .billing-checkout-box {
    grid-template-columns: minmax(0, 1fr);
  }
}
