/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --primary-light: #EFF6FF;
  --success:       #16A34A;
  --success-light: #F0FDF4;
  --danger:        #DC2626;
  --danger-light:  #FEF2F2;
  --warning:       #D97706;
  --warning-light: #FFFBEB;
  --info:          #0891B2;
  --info-light:    #ECFEFF;

  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  --sidebar-w:   260px;
  --header-h:    64px;
  --border-r:    8px;
  --shadow-sm:   0 1px 2px 0 rgba(0,0,0,.05);
  --shadow:      0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
  --shadow-md:   0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg:   0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --transition:  all .2s ease;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── Auth Layout ──────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #EFF6FF 0%, #F0F9FF 50%, #F0FDF4 100%);
}
.auth-body { margin: 0; padding: 0; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px 40px 32px;
  box-sizing: border-box;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-icon {
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.auth-logo .logo-icon svg { color: #fff; }
.auth-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); }
.auth-logo p  { font-size: .85rem; color: var(--gray-500); margin-top: 2px; }
.auth-heading { font-size: 1.25rem; font-weight: 600; margin-bottom: 6px; }
.auth-sub     { font-size: .875rem; color: var(--gray-500); margin-bottom: 24px; }
.auth-footer-text {
  text-align: center;
  margin-top: 20px;
  font-size: .875rem;
  color: var(--gray-500);
}
.auth-footer-text a { font-weight: 600; color: var(--primary); }
/* Flash alert inside auth card */
.auth-alert {
  border-radius: 8px;
  padding: 11px 14px;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 18px;
  line-height: 1.4;
}
.auth-alert-error, .auth-alert-danger {
  background: var(--danger-light);
  color: #991B1B;
  border: 1px solid #FECACA;
}
.auth-alert-success {
  background: var(--success-light);
  color: #166534;
  border: 1px solid #BBF7D0;
}
.auth-alert-warning {
  background: var(--warning-light);
  color: #92400E;
  border: 1px solid #FDE68A;
}
.auth-alert-info {
  background: var(--info-light);
  color: #155E75;
  border: 1px solid #A5F3FC;
}

/* ── App Layout ───────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-box {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-box svg { color: #fff; }
.sidebar-logo .logo-text { font-weight: 700; font-size: 1rem; color: var(--gray-900); }
.sidebar-logo .logo-version { font-size: .7rem; color: var(--gray-400); display: block; line-height: 1; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 8px; }
.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 8px 8px 4px;
  margin-top: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: var(--transition);
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.nav-item:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--gray-100);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: var(--transition);
}
.user-info:hover { background: var(--gray-100); }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  flex-shrink: 0;
}
.user-details .user-name { font-size: .8rem; font-weight: 600; color: var(--gray-800); display: block; line-height: 1.2; }
.user-details .user-role { font-size: .7rem; color: var(--gray-400); display: block; }

/* ── Main content ─────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar h1 { font-size: 1.1rem; font-weight: 600; color: var(--gray-900); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--gray-400); }
.breadcrumb span { color: var(--gray-400); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  color: var(--gray-600);
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.hamburger:hover { background: var(--gray-100); }
.page-content { padding: 28px; flex: 1; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-r);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: .95rem; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  border-radius: 0 0 var(--border-r) var(--border-r);
}

/* ── Stats cards ──────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-r);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light); color: var(--danger); }
.stat-icon.cyan   { background: var(--info-light); color: var(--info); }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--gray-900); }
.stat-label { font-size: .8rem; color: var(--gray-500); margin-top: 3px; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-900); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803D; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  font-size: .875rem;
  color: var(--gray-800);
  font-family: inherit;
  transition: var(--transition);
  background: #fff;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-control::placeholder { color: var(--gray-400); }
.form-control.is-invalid { border-color: var(--danger); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 36px; }
.form-help { font-size: .75rem; color: var(--gray-500); margin-top: 4px; }
.form-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.form-check-input { width: 16px; height: 16px; border: 1.5px solid var(--gray-300); border-radius: 4px; cursor: pointer; accent-color: var(--primary); margin-top: 2px; flex-shrink: 0; }
.form-check-label { font-size: .875rem; color: var(--gray-700); cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ── Alerts / Flash ───────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #BBF7D0; }
.alert-error   { background: var(--danger-light); color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: var(--warning-light); color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: var(--info-light); color: #155E75; border: 1px solid #A5F3FC; }

/* ── Tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-green   { background: var(--success-light); color: var(--success); }
.badge-red     { background: var(--danger-light); color: var(--danger); }
.badge-orange  { background: var(--warning-light); color: var(--warning); }
.badge-blue    { background: var(--primary-light); color: var(--primary); }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-cyan    { background: var(--info-light); color: var(--info); }

/* ── Progress bar ─────────────────────────────────────── */
.progress { height: 6px; background: var(--gray-100); border-radius: 100px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 100px; transition: width .4s ease; }
.progress-bar.green { background: var(--success); }
.progress-bar.red { background: var(--danger); }

/* ── Platform selector ────────────────────────────────── */
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.platform-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--border-r);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.platform-card:hover { border-color: var(--primary); background: var(--primary-light); }
.platform-card.selected { border-color: var(--primary); background: var(--primary-light); }
.platform-card input { display: none; }
.platform-icon { font-size: 2rem; margin-bottom: 6px; }
.platform-name { font-size: .8rem; font-weight: 600; color: var(--gray-700); }

/* ── Credential fields ────────────────────────────────── */
.credentials-block { display: none; }
.credentials-block.visible { display: block; }

/* ── Migration options ────────────────────────────────── */
.options-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.option-item {
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.option-item:hover { background: var(--gray-50); border-color: var(--primary); }
.option-item input { accent-color: var(--primary); width: 16px; height: 16px; }
.option-label { font-size: .85rem; font-weight: 500; color: var(--gray-700); }
.option-desc { font-size: .75rem; color: var(--gray-400); }

/* ── Migration log ────────────────────────────────────── */
.migration-log {
  background: var(--gray-900);
  border-radius: 8px;
  padding: 16px;
  max-height: 320px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: .78rem;
}
.log-line { padding: 2px 0; line-height: 1.5; }
.log-info    { color: #93C5FD; }
.log-success { color: #86EFAC; }
.log-warning { color: #FDE68A; }
.log-error   { color: #FCA5A5; }
.log-time    { color: #6B7280; margin-right: 8px; }

/* ── Plans ────────────────────────────────────────────── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.plan-card {
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  padding: 28px 24px;
  position: relative;
  transition: var(--transition);
}
.plan-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.plan-card.featured { border-color: var(--primary); }
.plan-badge {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 100px;
  white-space: nowrap;
}
.plan-name { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.plan-price { font-size: 2rem; font-weight: 800; color: var(--gray-900); margin-bottom: 4px; }
.plan-price sup { font-size: 1rem; font-weight: 600; vertical-align: super; }
.plan-interval { font-size: .8rem; color: var(--gray-500); }
.plan-limit { font-size: .85rem; color: var(--gray-600); margin: 12px 0; padding: 10px 12px; background: var(--gray-50); border-radius: 6px; }
.plan-features { list-style: none; margin: 16px 0; }
.plan-features li { font-size: .85rem; color: var(--gray-600); padding: 5px 0; display: flex; align-items: center; gap: 8px; }
.plan-features li::before { content: '✓'; color: var(--success); font-weight: 700; }
.plan-current { text-align: center; padding: 9px; border-radius: 7px; background: var(--success-light); color: var(--success); font-size: .85rem; font-weight: 600; }

/* ── Pagination ───────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-item { display: inline-flex; }
.page-link {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: .8rem;
  color: var(--gray-600);
  transition: var(--transition);
}
.page-link:hover { background: var(--gray-100); color: var(--gray-900); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ── Overlay / Sidebar mobile ─────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

/* ── Misc ─────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--gray-900); }
.empty-state { text-align: center; padding: 52px 20px; color: var(--gray-500); }
.empty-state svg { width: 52px; height: 52px; margin-bottom: 12px; opacity: .35; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; }
.divider { height: 1px; background: var(--gray-200); margin: 20px 0; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: .8rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 6px; }
.mt-3 { margin-top: 16px; }
.mb-4 { margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.w-full { width: 100%; }
.justify-between { justify-content: space-between; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrap { margin-left: 0; }
  .hamburger { display: flex; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .plans-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .platform-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Migration Create ─────────────────────────────────────── */
.form-grid { display: grid; gap: 20px; }
.migration-stores-grid { display: grid; grid-template-columns: 1fr 48px 1fr; align-items: center; gap: 12px; }
.migration-arrow { display: flex; align-items: center; justify-content: center; color: var(--gray-400); padding-top: 24px; }
.options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.option-checkbox { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--gray-200); border-radius: 8px; cursor: pointer; transition: var(--transition); }
.option-checkbox:hover { border-color: var(--primary); background: var(--primary-light); }
.option-checkbox input[type=checkbox] { display: none; }
.checkbox-custom { width: 18px; height: 18px; min-width: 18px; border: 2px solid var(--gray-300); border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: var(--transition); margin-top: 2px; }
.option-checkbox input:checked + .checkbox-custom { background: var(--primary); border-color: var(--primary); }
.option-checkbox input:checked + .checkbox-custom::after { content: '✓'; color: #fff; font-size: 11px; font-weight: 700; }
.option-info { display: flex; flex-direction: column; gap: 2px; }
.option-label { font-size: .875rem; font-weight: 600; color: var(--gray-800); display: flex; align-items: center; gap: 6px; }
.option-label svg { color: var(--primary); }
.option-desc { font-size: .78rem; color: var(--gray-500); }
.mt-4 { margin-top: 20px; }
.section-desc { font-size: .875rem; color: var(--gray-600); margin-bottom: 14px; }

/* ── Migration Show ───────────────────────────────────────── */
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col-asymmetric { grid-template-columns: 380px 1fr; }
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.progress-label { font-size: .875rem; font-weight: 600; color: var(--gray-700); }
.progress-pct { font-size: .875rem; font-weight: 700; color: var(--primary); }
.progress-lg { height: 14px; border-radius: 8px; }
.progress-sm { height: 6px; border-radius: 4px; margin-bottom: 4px; }
.progress-note { margin-top: 10px; font-size: .8rem; color: var(--gray-500); display: flex; align-items: center; gap: 8px; }
.pulse-dot { width: 8px; height: 8px; background: var(--warning); border-radius: 50%; animation: pulse 1.5s infinite; flex-shrink: 0; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.info-table { width: 100%; border-collapse: collapse; }
.info-table tr { border-bottom: 1px solid var(--gray-100); }
.info-table tr:last-child { border-bottom: none; }
.info-table td { padding: 9px 0; font-size: .875rem; }
.info-label { color: var(--gray-500); font-weight: 500; width: 40%; }
.migration-log { background: #0f172a; border-radius: 0 0 10px 10px; min-height: 280px; max-height: 380px; overflow-y: auto; padding: 14px; font-family: 'Fira Code', 'Cascadia Code', monospace; font-size: .78rem; line-height: 1.7; }
.log-line { display: flex; gap: 10px; }
.log-time { color: #475569; flex-shrink: 0; }
.log-info    .log-msg { color: #94a3b8; }
.log-success .log-msg { color: #4ade80; }
.log-warning .log-msg { color: #fbbf24; }
.log-error   .log-msg { color: #f87171; }
.p-0 { padding: 0 !important; }
.stat-icon-orange { background: #fff7ed; color: #ea580c; }
.stat-icon-red    { background: #fef2f2; color: var(--danger); }
.store-pair { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }

/* ── Plans ────────────────────────────────────────────────── */
.plan-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 28px 24px; position: relative; transition: var(--transition); }
.plan-card:hover { box-shadow: var(--shadow-md); }
.plan-card-active { border-color: var(--success); }
.plan-card-featured { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.plan-badge { position: absolute; top: -1px; right: 20px; background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 10px; border-radius: 0 0 6px 6px; text-transform: uppercase; letter-spacing: .05em; }
.plan-header { margin-bottom: 18px; }
.plan-name { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.price-amount { font-size: 1.75rem; font-weight: 800; color: var(--gray-900); }
.price-period { font-size: .8rem; color: var(--gray-500); }
.plan-limits { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.plan-limit-item { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--gray-700); }
.plan-limit-item svg { color: var(--primary); }
.plan-features { list-style: none; margin-bottom: 20px; display: flex; flex-direction: column; gap: 7px; }
.plan-features li { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--gray-700); }
.plan-features li svg { color: var(--success); flex-shrink: 0; }
.plan-action .btn { width: 100%; justify-content: center; }
.bank-info { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 16px; font-size: .875rem; color: var(--gray-700); font-family: monospace; line-height: 1.8; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

/* ── Admin ────────────────────────────────────────────────── */
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 24px; }
.quick-link-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px 12px; background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; color: var(--gray-700); font-size: .85rem; font-weight: 600; text-align: center; transition: var(--transition); }
.quick-link-card:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); box-shadow: var(--shadow-sm); }
.quick-link-card svg { color: var(--primary); }
.search-form { display: flex; gap: 10px; align-items: center; }
.search-input-wrap { position: relative; flex: 1; }
.search-input-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.search-input { padding-left: 34px !important; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.required { color: var(--danger); }
.alert-link { font-weight: 600; color: inherit; text-decoration: underline; margin-left: 4px; }

/* ── Misc ─────────────────────────────────────────────────── */
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.w-full { width: 100%; }
.text-center { text-align: center; }

@media (max-width: 768px) {
  .migration-stores-grid { grid-template-columns: 1fr; }
  .migration-arrow { padding-top: 0; transform: rotate(90deg); }
  .options-grid { grid-template-columns: 1fr; }
  .two-col-grid { grid-template-columns: 1fr; }
  .two-col-asymmetric { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .search-form { flex-wrap: wrap; }
  .quick-links { grid-template-columns: repeat(2, 1fr); }
}

/* ── Semantic badge aliases (Bootstrap-compatible naming) ─── */
.badge-primary   { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-orange    { background: var(--warning-light); color: var(--warning); }

/* ── Alert close button ─────────────────────────────────────── */
.alert-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; margin-left: auto; padding: 0 4px; opacity: .6; line-height: 1; }
.alert-close:hover { opacity: 1; }

/* ── Page layout helpers ─────────────────────────────────────── */
.page-header   { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:24px; flex-wrap:wrap; }
.page-title    { font-size:1.35rem; font-weight:700; color:var(--gray-900); margin:0 0 2px; }
.page-subtitle { font-size:.875rem; color:var(--gray-500); margin:0; }
.page-actions  { display:flex; gap:8px; flex-shrink:0; }

.form-actions  { display:flex; gap:10px; align-items:center; margin-top:20px; padding-top:20px; border-top:1px solid var(--gray-200); }

.card-footer   { padding:14px 20px; border-top:1px solid var(--gray-100); background:var(--gray-50); border-radius:0 0 10px 10px; }

/* ── Info table (migration show) ────────────────────────────── */
.info-table    { width:100%; border-collapse:collapse; }
.info-table tr { border-bottom:1px solid var(--gray-100); }
.info-table tr:last-child { border-bottom:none; }
.info-table td { padding:9px 0; font-size:.875rem; vertical-align:middle; }
.info-label    { color:var(--gray-500); font-weight:500; width:44%; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination      { display:flex; align-items:center; gap:8px; }
.pagination-info { font-size:.85rem; color:var(--gray-500); }

/* ── Two-column asymmetric grid ─────────────────────────────── */
.two-col-asymmetric { grid-template-columns:380px 1fr; }
@media(max-width:900px){ .two-col-asymmetric { grid-template-columns:1fr; } }

/* ── Store pair in table ────────────────────────────────────── */
.store-pair { display:inline-flex; align-items:center; gap:5px; font-size:.85rem; color:var(--gray-700); }

/* ── Progress note ──────────────────────────────────────────── */
.progress-note { margin-top:8px; font-size:.8rem; color:var(--gray-500); display:flex; align-items:center; gap:8px; }

/* ── Quick link cards (admin dashboard) ─────────────────────── */
.quick-links     { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:14px; margin-top:20px; }
.quick-link-card { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:20px 12px; background:#fff; border:1px solid var(--gray-200); border-radius:10px; color:var(--gray-700); font-size:.85rem; font-weight:600; text-align:center; transition:var(--transition); }
.quick-link-card:hover { border-color:var(--primary); color:var(--primary); background:var(--primary-light); box-shadow:var(--shadow-sm); }
.quick-link-card svg   { color:var(--primary); }

/* ── Bank info block ────────────────────────────────────────── */
.bank-info { background:var(--gray-50); border:1px solid var(--gray-200); border-radius:8px; padding:16px; font-family:'Fira Code',monospace,sans-serif; font-size:.875rem; color:var(--gray-700); line-height:1.9; }

/* ── Plan features list ─────────────────────────────────────── */
.plan-features     { list-style:none; margin-bottom:20px; display:flex; flex-direction:column; gap:7px; }
.plan-features li  { display:flex; align-items:center; gap:8px; font-size:.85rem; color:var(--gray-700); }
.plan-features svg { color:var(--success); flex-shrink:0; }

/* ── Search form in admin ───────────────────────────────────── */
.search-form       { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.search-input-wrap { position:relative; flex:1; min-width:200px; }
.search-input-wrap > svg { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--gray-400); pointer-events:none; }
.search-input { padding-left:34px !important; }

/* ── Admin form-row ─────────────────────────────────────────── */
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media(max-width:600px){ .form-row { grid-template-columns:1fr; } }

/* ── Required star ──────────────────────────────────────────── */
.required { color:var(--danger); }

/* ── Alert link ─────────────────────────────────────────────── */
.alert-link { font-weight:600; color:inherit; text-decoration:underline; margin-left:4px; }

/* ── Pulse dot ──────────────────────────────────────────────── */
.pulse-dot { width:8px; height:8px; min-width:8px; background:var(--warning); border-radius:50%; animation:pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.35} }

/* ── Section description ────────────────────────────────────── */
.section-desc { font-size:.875rem; color:var(--gray-600); margin-bottom:14px; }

/* ── stat-icon color variants (hyphen style) ──────────────── */
.stat-icon-blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon-green  { background: var(--success-light); color: var(--success); }
.stat-icon-purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon-cyan   { background: var(--info-light);    color: var(--info); }
.alert-danger  { background: var(--danger-light); color: #991B1B; border: 1px solid #FECACA; }

/* ── Profile Page ─────────────────────────────────────────── */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}
.profile-avatar-big {
  width: 64px;
  height: 64px;
  min-width: 64px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .5px;
}

/* ── Modal (global fix) ───────────────────────────────────── */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay.open,
.modal-overlay[style*="flex"] {
  display: flex !important;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  margin: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.modal-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--gray-400); line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--gray-900); }

/* ── Admin Settings: ensure cards have vertical spacing ─── */
.card + .card { margin-top: 20px; }
.two-col-grid  { margin-bottom: 20px; }

/* ── Nav badge (open ticket count) ──────────────────────────── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger, #dc2626);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: auto;
}

/* ════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE FIXES — v1.4
   ════════════════════════════════════════════════════════════ */

/* ── Sticky header on ALL pages including admin ─────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
}

/* ── Stats grid: 2 columns on mobile ────────────────────── */
@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .stat-card {
    padding: 14px 12px !important;
  }
  .stat-value {
    font-size: 1.4rem !important;
  }
  .stat-label {
    font-size: .72rem !important;
  }
  .stat-icon {
    width: 36px !important;
    height: 36px !important;
  }
}

/* ── Page header: stack on mobile ───────────────────────── */
@media (max-width: 640px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-title {
    font-size: 1.15rem !important;
    word-break: break-word;
  }
}

/* ── Plans page: stack alert on mobile ──────────────────── */
@media (max-width: 640px) {
  .alert {
    font-size: .82rem !important;
    padding: 10px 12px !important;
    flex-wrap: wrap;
    word-break: break-word;
  }
  .alert strong { word-break: break-word; }
  .plans-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Ticket detail page header: truncate long title ─────── */
@media (max-width: 640px) {
  .page-title {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page-header {
    overflow: hidden;
  }
}

/* ── Admin Plans table: horizontal scroll on mobile ─────── */
@media (max-width: 640px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table {
    min-width: 500px;
  }
}

/* ── Payment method tabs: scroll on small screens ───────── */
@media (max-width: 480px) {
  .pmt-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .pmt-tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ── Migration create: warning message wrapping ─────────── */
@media (max-width: 640px) {
  .alert a {
    word-break: break-all;
  }
  .card-body p, .card-body .alert {
    font-size: .85rem;
  }
}

/* ── Add Store: platform cards grid on mobile ───────────── */
@media (max-width: 640px) {
  .platform-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .platform-card {
    padding: 14px 10px !important;
    font-size: .82rem !important;
  }
}

/* ── Sidebar support nav icon (question mark) fix ───────── */
.nav-item svg {
  min-width: 18px;
  min-height: 18px;
  flex-shrink: 0;
}

/* ── Badge: prevent overflow ────────────────────────────── */
.badge {
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* ── Card mobile padding ────────────────────────────────── */
@media (max-width: 640px) {
  .card-body {
    padding: 14px !important;
  }
  .card-header {
    padding: 12px 14px !important;
  }
  .form-actions {
    flex-direction: column;
  }
  .form-actions .btn {
    width: 100%;
    text-align: center;
  }
  .two-col-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Topbar title truncate on mobile ────────────────────── */
@media (max-width: 640px) {
  .topbar h1 {
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 120px);
  }
}

/* ── Filter tabs mobile ─────────────────────────────────── */
@media (max-width: 640px) {
  .filter-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .filter-tab {
    flex-shrink: 0;
  }
}

/* ── Plans page active plan alert ───────────────────────── */
@media (max-width: 640px) {
  .alert-success {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ── Ticket reply thread mobile ─────────────────────────── */
@media (max-width: 640px) {
  .reply-body {
    font-size: .85rem !important;
    padding: 10px 12px !important;
  }
  .reply-header {
    padding: 8px 12px !important;
    flex-wrap: wrap;
    gap: 6px !important;
  }
}

/* ── Support nav icon full size fix ─────────────────────── */
.nav-item svg path,
.nav-item svg circle,
.nav-item svg line,
.nav-item svg polyline,
.nav-item svg polygon {
  vector-effect: non-scaling-stroke;
}

/* ── Payment history mobile ─────────────────────────────── */
@media (max-width: 640px) {
  .proof-thumb {
    display: flex;
    align-items: center;
    gap: 6px;
  }
}

/* ── Mobile visibility helpers ──────────────────────────── */
@media (max-width: 640px) {
  .d-none-mobile { display: none !important; }
}
@media (min-width: 641px) {
  .d-mobile-only { display: none !important; }
}

.mt-3 { margin-top: 16px !important; }

/* ── Admin dashboard mobile grid fix ───────────────────── */
@media (max-width: 640px) {
  /* Prevent stats grid overflow causing drift */
  .stats-grid {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .stat-card {
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
  }
  .stat-content, .stat-info {
    min-width: 0;
    overflow: hidden;
  }
  .stat-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Page content padding on mobile */
  .page-content {
    padding: 16px !important;
    overflow-x: hidden;
  }
  .main-wrap {
    min-width: 0;
    overflow-x: hidden;
  }
}

/* ── Plans page: usage bar section spacing ──────────────── */
.card .usage-row {
  padding-bottom: 8px;
}

/* ══════════════════════════════════════════════════════════
   v1.5 PATCH FIXES
   ══════════════════════════════════════════════════════════ */

/* ── Admin Plans: table scrollable on mobile ─────────────── */
@media (max-width: 768px) {
  /* Plans table must scroll horizontally */
  .two-col-asymmetric .card .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .two-col-asymmetric .table {
    min-width: 420px;
  }
  /* Form stays full-width, stacked */
  .two-col-asymmetric {
    gap: 16px;
  }
}

/* ── Support ticket list: truncate long subjects ─────────── */
.ticket-subject-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .ticket-subject-cell {
    max-width: 140px;
  }
}

/* ── Support ticket thread: reduce whitespace ────────────── */
.ticket-reply + .ticket-reply {
  margin-top: 10px;
}
.reply-header {
  padding: 8px 14px !important;
  background: rgba(0,0,0,.02);
  border-bottom: 1px solid var(--gray-100);
}
.reply-staff .reply-header {
  background: rgba(37,99,235,.04) !important;
  border-bottom-color: #bfdbfe !important;
}
.reply-body {
  padding: 10px 14px !important;
  font-size: .875rem !important;
  line-height: 1.6 !important;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Admin support_show: reply form bottom area ──────────── */
@media (max-width: 640px) {
  /* "Ticket status → Answered" label wrap fix */
  .reply-submit-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .reply-submit-row .btn {
    width: 100%;
    text-align: center;
  }
  .reply-submit-row span {
    font-size: .78rem;
    color: var(--gray-400);
  }
}

/* ── Countdown timer styling ─────────────────────────────── */
.lockout-timer {
  display: inline-block;
  font-weight: 700;
  color: var(--danger);
  min-width: 24px;
}

/* ── Ticket reply body: normal flow, preserve intentional newlines only ── */
.reply-body {
  white-space: normal !important; /* Override pre-wrap - nl2br handles breaks */
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* Ensure thread has tight, consistent spacing */
.ticket-thread {
  gap: 10px !important;
}
