/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: all var(--transition);
  white-space: nowrap;
  max-width: 100%;
}

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

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

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text);
}

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

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

.btn-danger {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-danger:hover:not(:disabled) {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-color: var(--bg-inverse);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 10px 18px;
  font-size: 0.92rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg-hover);
}

/* Cards (Compact, never overflow) */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition);
  min-width: 0;
  max-width: 100%;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* Stat cards */
.stat-card {
  padding: 14px 16px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-value {
  font-size: 1.38rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-sub {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* Domain Search Bar */
.search-box {
  display: flex;
  align-items: stretch;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 5px;
  box-shadow: var(--shadow-md);
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.search-box:focus-within {
  border-color: var(--border-focus);
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 0.94rem;
}

.search-select {
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  padding: 0 10px;
  font-weight: 600;
  font-size: 0.9rem;
  outline: none;
  min-width: 96px;
  max-width: 100%;
}

.search-result {
  max-width: 600px;
  width: 100%;
  margin: 14px auto 0;
  text-align: left;
}

/* Live stats strip on homepage */
.live-stats-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 600px;
  width: 100%;
  margin: 18px auto 0;
  text-align: left;
}

.live-stat-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  min-width: 0;
}

.live-stat-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

@keyframes subtlePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  flex-shrink: 0;
  animation: subtlePulse 2.2s ease-in-out infinite;
}

.live-stat-num {
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  min-width: 0;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

.form-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.input, .select, .textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.textarea {
  min-height: 76px;
  resize: vertical;
}

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

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  cursor: pointer;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  max-width: 100%;
  white-space: nowrap;
}

.badge-solid {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-color: var(--bg-inverse);
}

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

/* Tables (Scrollable inside container, never push viewport) */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.table th {
  text-align: left;
  padding: 9px 11px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

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

/* Tabs (Clean horizontal swipe on mobile, no multi-row clutter) */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 8px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}

/* 3x3 Image Order CAPTCHA Widget (Compact & crisp) */
.captcha-box {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-subtle);
  margin-bottom: 14px;
  max-width: 360px;
  width: 100%;
}

.captcha-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.captcha-prompt {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
}

.captcha-timer {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.captcha-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}

.captcha-tile {
  position: relative;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fafafa;
  padding: 3px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.captcha-tile:hover {
  border-color: #09090b;
}

.captcha-tile.selected {
  border-color: #09090b;
  box-shadow: inset 0 0 0 2px #09090b;
  transform: scale(0.97);
}

.captcha-tile-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.captcha-order-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #09090b;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.captcha-accessible-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}

.captcha-acc-btn {
  position: relative;
  padding: 8px 10px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: left;
  font-size: 0.82rem;
  font-weight: 500;
}

.captcha-acc-btn.selected {
  border-color: var(--text);
  background: var(--bg-inverse);
  color: var(--text-inverse);
}

.captcha-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.76rem;
}

/* Payment & VietQR Card */
.payment-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.qr-frame {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  color: #09090b;
}

.qr-frame img {
  margin: 0 auto;
  width: 200px;
  max-width: 100%;
  height: auto;
}

.copy-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  min-width: 0;
}

.copy-field > div {
  min-width: 0;
}

.copy-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
}

.copy-value {
  font-weight: 600;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

/* FAQ Accordion */
.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  background: transparent;
  border: none;
  text-align: left;
  font-weight: 600;
  font-size: 0.92rem;
}

.faq-body {
  padding-bottom: 14px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  display: none;
}

.faq-item.open .faq-body {
  display: block;
}

/* Modal & Confirm Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(9, 9, 11, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-panel {
  width: 100%;
  max-width: min(500px, calc(100vw - 24px));
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-lg);
}

.modal-panel-lg {
  max-width: min(700px, calc(100vw - 24px));
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 14px;
  right: 14px;
  left: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(340px, calc(100vw - 28px));
}

.toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  animation: fadeIn 200ms ease-out;
}

.toast-error {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-color: var(--bg-inverse);
}

/* Auth centered layout */
.auth-page {
  padding: 36px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

/* Legal prose */
.prose {
  padding: 36px 0 48px;
}

.prose h1 {
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  margin-bottom: 8px;
}

.prose h2 {
  font-size: 1.08rem;
  margin: 22px 0 8px;
}

.prose p, .prose li {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.prose ul, .prose ol {
  padding-left: 18px;
  margin: 6px 0 14px;
}

/* Alert box */
.callout {
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--text);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  overflow-wrap: break-word;
}

.recovery-codes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0;
}

.recovery-code-item {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 7px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: center;
}

/* Pricing card */
.pricing-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.price-figure {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

@media (max-width: 720px) {
  .card { padding: 14px; }
  .search-box { flex-direction: column; padding: 6px; }
  .search-select { border-left: none; border-top: 1px solid var(--border); padding: 8px 10px; width: 100%; }
  .search-box .btn-lg { width: 100%; }
  .payment-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .captcha-box { max-width: 100%; }
}

@media (max-width: 520px) {
  /* Compact horizontal stat rows on mobile so they never waste vertical space or overflow */
  .live-stats-bar { grid-template-columns: 1fr; gap: 8px; }
  .live-stat-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
  }
  .live-stat-head { margin-bottom: 0; }
  .live-stat-num { font-size: 1.08rem; }
  .copy-field { flex-direction: column; align-items: stretch; }
  .copy-field .btn { align-self: flex-end; }
  .recovery-codes-grid { grid-template-columns: 1fr; }
}
