/* ========================================================
   SHOPEE AFFILIATE HUB — STYLES v2
   ======================================================== */

/* ── 1. CSS Variables ── */
:root {
  --bg:           #060912;
  --surface:      #0B0F1C;
  --card:         #111527;
  --card-hover:   #161B30;
  --border:       rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.11);
  --border-active: rgba(238, 77, 45, 0.3);

  --primary:      #EE4D2D;
  --primary-h:    #D94325;
  --primary-l:    #FF6B47;
  --primary-glow: rgba(238, 77, 45, 0.30);
  --primary-dim:  rgba(238, 77, 45, 0.12);
  --primary-dimmer: rgba(238, 77, 45, 0.06);

  --text:         #EDF0F7;
  --text-dim:     rgba(237, 240, 247, 0.55);
  --text-muted:   rgba(237, 240, 247, 0.28);

  --green:        #22C55E;
  --green-dim:    rgba(34, 197, 94, 0.10);
  --blue:         #3B82F6;
  --blue-dim:     rgba(59, 130, 246, 0.10);
  --purple:       #A855F7;
  --purple-dim:   rgba(168, 85, 247, 0.10);
  --orange:       #F97316;
  --orange-dim:   rgba(249, 115, 22, 0.10);
  --red:          #EF4444;
  --red-dim:      rgba(239, 68, 68, 0.10);
  --yellow:       #EAB308;
  --yellow-dim:   rgba(234, 179, 8, 0.10);

  --sidebar-w:    260px;
  --sidebar-w-c:  72px;
  --radius-xs:    6px;
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;
  --radius-xl:    22px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:    0 12px 50px rgba(0,0,0,0.7);
  --trans:        0.20s cubic-bezier(0.4, 0, 0.2, 1);
  --trans-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── 2. Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); cursor: pointer; text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--primary-l); }
input, textarea, select, button { font-family: inherit; }
img { max-width: 100%; }
::selection { background: var(--primary-dim); color: var(--text); }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

.page { min-height: 100vh; }

/* ── Glass Card ── */
.glass-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.glass-card:hover { border-color: var(--border-hover); }

/* ─────────────────────────────────────────────────
   AUTH SECTION
───────────────────────────────────────────────── */
.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-bg-shapes { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
}
.shape.s1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #EE4D2D 0%, transparent 70%);
  top: -200px; left: -200px;
  animation: floatShape 9s ease-in-out infinite;
}
.shape.s2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #FF8C42 0%, transparent 70%);
  bottom: -150px; right: -150px;
  animation: floatShape 12s ease-in-out infinite reverse;
}
.shape.s3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #3B82F6 0%, transparent 70%);
  top: 50%; left: 55%;
  transform: translate(-50%,-50%);
  animation: floatShape 15s ease-in-out infinite;
  opacity: 0.10;
}
@keyframes floatShape {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-40px) scale(1.08); }
}

.auth-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

/* Brand */
.auth-brand { text-align: center; }
.brand-logo-wrap { display: flex; justify-content: center; margin-bottom: 16px; }

.brand-logo-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #EE4D2D, #FF8C42);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(238,77,45,0.45), 0 0 0 1px rgba(238,77,45,0.2);
  animation: logoFloat 4s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotateZ(0deg); }
  50% { transform: translateY(-6px) rotateZ(1deg); }
}

.brand-name {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, rgba(237,240,247,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}
.brand-tagline { color: var(--text-muted); font-size: 14px; margin-top: 8px; }

/* Auth Card */
.auth-card {
  width: 100%;
  padding: 36px;
  background: rgba(17, 21, 39, 0.90);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.03) inset;
}
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 7px;
}
.form-group small { display: block; color: var(--text-muted); font-size: 11px; margin-top: 6px; line-height: 1.5; }

.input-wrap { position: relative; }

input[type=text], input[type=email], input[type=password], input[type=search],
textarea, select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  outline: none;
  -webkit-appearance: none;
}
.input-wrap input, .input-wrap textarea {
  padding-left: 42px;
}
.input-wrap input[type=password] {
  padding-right: 44px;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
  background: rgba(255,255,255,0.06);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; line-height: 1.7; padding: 12px 16px; }

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}
.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  border-radius: 4px;
  transition: color var(--trans), opacity var(--trans);
  opacity: 0.5;
}
.pw-toggle:hover { color: var(--text); opacity: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--trans);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--trans);
}
.btn:hover::before { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #EE4D2D 0%, #D43D1F 100%);
  color: white;
  box-shadow: 0 4px 18px rgba(238,77,45,0.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(238,77,45,0.50);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-secondary:hover { color: var(--text); border-color: var(--border-hover); background: rgba(255,255,255,0.09); }

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

.btn-danger {
  background: rgba(239,68,68,0.10);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.20);
}
.btn-danger:hover { background: rgba(239,68,68,0.20); border-color: rgba(239,68,68,0.35); }

.btn-copy {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(238,77,45,0.18);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--trans);
  white-space: nowrap;
}
.btn-copy:hover { background: rgba(238,77,45,0.22); transform: none; }
.btn-copy.copied { background: var(--green-dim); color: var(--green); border-color: rgba(34,197,94,0.2); }

.btn-full { width: 100%; justify-content: center; padding: 13px 20px; font-size: 15px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-convert {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 15px;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  margin-top: 8px;
}
.btn-convert:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Alerts ── */
.alert-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.20);
  color: #FCA5A5;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
  margin-top: 12px;
  white-space: pre-line;
}

.tip-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,0.15);
  color: var(--blue);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.6;
  margin-top: 16px;
}
.tip-box svg { flex-shrink: 0; margin-top: 1px; }

.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(234,179,8,0.07);
  border: 1px solid rgba(234,179,8,0.18);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 24px;
  color: var(--yellow);
  font-size: 13.5px;
  line-height: 1.6;
}
.warning-banner svg { flex-shrink: 0; margin-top: 2px; }
.warning-banner div { display: flex; flex-direction: column; gap: 2px; }
.warning-banner strong { font-weight: 700; }
.warning-banner a { color: var(--primary); }

/* ── Required ── */
.required { color: var(--red); }
.optional { color: var(--text-muted); font-size: 11px; font-weight: 400; }

/* ─────────────────────────────────────────────────
   DASHBOARD LAYOUT
───────────────────────────────────────────────── */
#page-dashboard {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  transition: width var(--trans), transform var(--trans);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-w-c); }
.sidebar.collapsed .sb-brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn { display: none; }
/* Keep sidebar-toggle VISIBLE when collapsed so user can expand again */
.sidebar.collapsed .sidebar-toggle {
  /* override: stay visible, rotated to indicate expand direction */
  display: flex;
}
.sidebar.collapsed .sidebar-top { justify-content: center; padding: 18px 12px 15px; gap: 0; }
.sidebar.collapsed .sidebar-brand { display: none; }
.sidebar.collapsed .user-card { justify-content: center; padding: 0; }
.sidebar.collapsed .user-avatar { width: 36px; height: 36px; font-size: 14px; }

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 15px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.sb-logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #EE4D2D, #FF8C42);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(238,77,45,0.3);
}
.sb-brand-text { min-width: 0; }
.sb-brand-name { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.sb-brand-sub { font-size: 10.5px; color: var(--text-muted); line-height: 1; }

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  transition: color var(--trans), background var(--trans);
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--trans);
  white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(238,77,45,0.12);
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon { display: flex; flex-shrink: 0; width: 20px; justify-content: center; }
.nav-text { transition: opacity var(--trans); flex: 1; }

.nav-badge {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.sidebar.collapsed .nav-item { justify-content: center; padding: 11px; }
.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
  transition: all var(--trans);
  z-index: 200;
}
.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  transition: all var(--trans);
}
.user-card:hover { border-color: var(--border-hover); }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EE4D2D, #FF8C42);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; padding: 6px;
  display: flex; border-radius: 6px;
  transition: color var(--trans), background var(--trans);
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--red); background: var(--red-dim); }

/* Mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 99;
  backdrop-filter: blur(3px);
}
.mobile-header { display: none; }

/* ── Main ── */
.dash-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  transition: margin-left var(--trans);
  background: var(--bg);
}
.sidebar.collapsed ~ .dash-main { margin-left: var(--sidebar-w-c); }

.dash-section {
  padding: 32px 36px;
  max-width: 1280px;
  animation: fadeInUp 0.28s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.section-title { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; }
.section-desc { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--trans);
  cursor: default;
}
.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}
.stat-icon-wrap {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon-wrap.orange { background: var(--orange-dim); color: var(--orange); }
.stat-icon-wrap.blue   { background: var(--blue-dim);   color: var(--blue); }
.stat-icon-wrap.green  { background: var(--green-dim);  color: var(--green); }
.stat-icon-wrap.purple { background: var(--purple-dim); color: var(--purple); }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -1.5px; }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 5px; font-weight: 500; }

/* ── Chart ── */
.chart-card { margin-bottom: 20px; }
.chart-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.chart-card-header h3 { font-size: 16px; font-weight: 700; }
.chart-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.chart-filter {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.chart-filter-btn {
  padding: 5px 12px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans);
}
.chart-filter-btn:hover { color: var(--text); }
.chart-filter-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(238,77,45,0.3);
}

.chart-wrapper { height: 220px; position: relative; }

/* ── Recent ── */
.recent-card {}
.recent-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px;
}
.recent-header h3 { font-size: 16px; font-weight: 700; }
.see-all { font-size: 13px; color: var(--primary); transition: color var(--trans); }
.see-all:hover { color: var(--primary-l); }

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 0.25s ease;
  transition: background var(--trans);
  border-radius: 4px;
  cursor: default;
}
.recent-item:last-child { border-bottom: none; }
.recent-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}
.recent-links { flex: 1; min-width: 0; }
.recent-original {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: 'Courier New', monospace;
}
.recent-converted {
  font-size: 12.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
  font-family: 'Courier New', monospace;
}
.recent-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.25; margin-bottom: 14px; }
.empty-state p { font-size: 14px; }
.empty-state.sm { padding: 36px 20px; }
.empty-state.sm svg { width: 28px; height: 28px; }

/* ── Convert Section ── */
.convert-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.convert-card { padding: 28px; }

.convert-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.cc-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #EE4D2D, #FF8C42);
  color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(238,77,45,0.3);
}
.convert-card-header h3 { font-size: 17px; font-weight: 700; }
.convert-card-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.link-textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  font-size: 13.5px;
  font-family: 'Courier New', monospace;
  resize: vertical;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
  line-height: 1.7;
}
.link-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.link-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 7px;
}

/* Shortlink status */
.shortlink-status {
  margin: 12px 0;
  padding: 12px 16px;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: var(--radius-sm);
}
.shortlink-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
  font-size: 13px;
}
.spinner-sm {
  width: 16px; height: 16px;
  border: 2px solid rgba(59,130,246,0.25);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-box {
  margin-top: 20px;
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.18);
  border-radius: var(--radius);
  padding: 20px;
  animation: fadeInUp 0.3s ease;
}
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green);
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 99px;
  padding: 4px 12px;
  margin-bottom: 16px;
}
.result-input-wrap { display: flex; gap: 8px; align-items: stretch; }
.result-input {
  flex: 1;
  background: rgba(0,0,0,0.25) !important;
  border: 1px solid rgba(34,197,94,0.18) !important;
  padding: 10px 14px !important;
  font-family: 'Courier New', monospace !important;
  font-size: 12.5px !important;
  color: var(--green) !important;
  border-radius: var(--radius-sm) !important;
}
.result-meta {
  margin-top: 12px;
  font-size: 12px;
  color: rgba(34,197,94,0.6);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.result-meta span { display: flex; align-items: center; gap: 4px; }

/* Clickable input link */
.result-input-clickable { cursor: pointer; }
.result-input-clickable:hover {
  border-color: rgba(34,197,94,0.45) !important;
  background: rgba(34,197,94,0.06) !important;
}

/* Nút Mua ngay */
.btn-buy-now {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans);
  box-shadow: 0 4px 14px rgba(34,197,94,0.30);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-buy-now:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 6px 20px rgba(34,197,94,0.45);
  transform: translateY(-1px);
}
.btn-buy-now:active { transform: translateY(0); }

/* Side col */
.info-card, .guide-card { padding: 20px; }
.info-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.config-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.config-row:last-child { border-bottom: none; }
.config-label { font-size: 11.5px; color: var(--text-muted); }
.config-value { font-size: 13px; font-weight: 600; color: var(--text); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.config-missing { color: var(--red); font-size: 12px; font-weight: 600; }

.guide-steps-compact { display: flex; flex-direction: column; gap: 10px; }
.guide-step-c {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.step-n {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(238,77,45,0.18);
  margin-top: 1px;
}

/* ── History Section ── */
.history-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search-wrap {
  flex: 1;
  position: relative;
  min-width: 200px;
}
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-wrap input {
  width: 100%;
  padding: 9px 14px 9px 38px !important;
  font-size: 14px;
}
.history-toolbar-right { display: flex; align-items: center; gap: 10px; }
.history-count { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

.filter-select {
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  width: auto;
}
.filter-select:focus { border-color: var(--primary); box-shadow: none; }
.filter-select option { background: var(--card); color: var(--text); }

/* History Table */
.history-table { width: 100%; border-collapse: collapse; }
.history-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}
.history-table td {
  padding: 13px 14px;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: rgba(255,255,255,0.02); }
.td-link {
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block; font-family: 'Courier New', monospace; font-size: 12px;
}
.td-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.btn-icon {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  padding: 5px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 5px;
  transition: all var(--trans);
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dimmer); }
.btn-icon.del:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border-top: 1px solid var(--border);
}
.page-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans);
}
.page-btn:hover { border-color: var(--border-hover); color: var(--text); }
.page-btn.active { background: var(--primary-dim); border-color: var(--border-active); color: var(--primary); font-weight: 700; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.settings-card { padding: 26px; }
.settings-card-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.settings-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.settings-icon.orange { background: var(--orange-dim); color: var(--orange); }
.settings-icon.blue { background: var(--blue-dim); color: var(--blue); }
.settings-icon.green { background: var(--green-dim); color: var(--green); }
.settings-card-header h3 { font-size: 16px; font-weight: 700; }
.settings-card-header p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.subids-section { margin-top: 4px; }
.subids-label { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; }
.subids-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.subids-grid .form-group { margin-bottom: 0; }
.subids-grid input { padding: 9px 12px !important; font-size: 13px; }

.preview-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 14px;
}
.preview-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.preview-box code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--primary);
  word-break: break-all;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.toggle-label { font-size: 14px; font-weight: 600; }
.toggle-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.toggle-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.10);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--trans);
}
.switch-track::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: transform var(--trans);
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .switch-track { background: var(--primary); }
.toggle-switch input:checked + .switch-track::before { transform: translateX(20px); }

.url-group { display: flex; align-items: center; }
.url-prefix {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-right: none;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  white-space: nowrap;
  font-family: monospace;
  flex-shrink: 0;
}
.url-group input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  flex: 1;
  padding-left: 12px !important;
}

.public-link-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.20);
  border-radius: var(--radius-sm);
  font-size: 13px;
  flex-wrap: wrap;
  margin-top: 8px;
  animation: fadeInUp 0.25s ease;
}
.pub-link-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pub-link-content span { font-size: 11px; color: var(--text-muted); }
.pub-link-text { color: var(--green); font-size: 12.5px; font-family: monospace; word-break: break-all; }
.btn-icon-copy {
  background: rgba(34,197,94,0.12); border: none;
  color: var(--green); cursor: pointer;
  padding: 7px 10px; border-radius: 6px;
  display: flex; align-items: center;
  transition: all var(--trans);
  flex-shrink: 0;
}
.btn-icon-copy:hover { background: rgba(34,197,94,0.22); }

/* Per-card save row */
.card-save-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}


.success-msg {
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.20);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 8px;
}

/* Account info grid */
.account-info-grid { margin-bottom: 4px; }

.ai-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: background var(--trans);
}
.ai-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.ai-row:hover { background: rgba(255,255,255,0.025); }

.ai-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 130px;
  flex-shrink: 0;
}
.ai-value {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}
.ai-username {
  font-family: 'Courier New', monospace;
  color: var(--primary);
  font-weight: 700;
}

/* Editable rows */
.ai-row-edit { align-items: center; }
.ai-edit-wrap { flex: 1; display: flex; justify-content: flex-end; }
.ai-input {
  width: 100%;
  max-width: 260px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  text-align: right;
}
.ai-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
  background: rgba(255,255,255,0.07);
}
.ai-input::placeholder { color: var(--text-muted); font-weight: 400; }

/* Save row */
.ai-save-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 0 4px;
  flex-wrap: wrap;
}


/* Role tag */
.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.role-tag.admin { background: rgba(234,179,8,0.12); color: var(--yellow); border: 1px solid rgba(234,179,8,0.25); }
.role-tag.user  { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59,130,246,0.20); }

/* Change password collapsible */
.change-pw-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 16px 0;
  overflow: hidden;
}
.change-pw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
  transition: background var(--trans);
  user-select: none;
}
.change-pw-header:hover { background: rgba(255,255,255,0.05); }
.change-pw-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.change-pw-chevron { color: var(--text-muted); transition: transform var(--trans); flex-shrink: 0; }
.change-pw-body {
  padding: 18px 16px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
  animation: fadeInUp 0.2s ease;
}

.danger-zone {
  border-top: 1px solid rgba(239,68,68,0.15);
  padding-top: 16px;
}
.danger-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  opacity: 0.8;
}

/* ─────────────────────────────────────────────────
   PUBLIC PAGE
───────────────────────────────────────────────── */
#page-public { min-height: 100vh; background: var(--bg); }
.pub-bg-shapes { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.pub-404 {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.pub-404-inner {
  text-align: center;
  position: relative;
  z-index: 1;
  padding: 40px 24px;
}
.pub-404-icon { font-size: 64px; margin-bottom: 20px; }
.pub-404-inner h1 { font-size: 28px; font-weight: 800; margin-bottom: 12px; }
.pub-404-inner p { color: var(--text-dim); font-size: 15px; margin-bottom: 28px; }

.pub-header {
  position: sticky; top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  background: rgba(6,9,18,0.85);
}
.pub-header-inner {
  max-width: 960px; margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pub-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--text); }
.pub-brand-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #EE4D2D, #FF8C42);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(238,77,45,0.3);
}

.pub-hero {
  position: relative; z-index: 1;
  text-align: center;
  padding: 72px 24px 48px;
  max-width: 700px;
  margin: 0 auto;
}
.pub-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-dim);
  border: 1px solid rgba(238,77,45,0.20);
  border-radius: 99px;
  padding: 5px 14px;
  margin-bottom: 20px;
  letter-spacing: 0.04em;
}
.pub-hero-title {
  font-size: 46px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.12;
  background: linear-gradient(135deg, #fff 0%, rgba(237,240,247,0.65) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}
.pub-hero-desc { font-size: 17px; color: var(--text-dim); line-height: 1.7; }

.pub-body {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.pub-converter-card {}
.pub-conv-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.pub-conv-icon {
  width: 50px; height: 50px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #EE4D2D, #FF8C42);
  color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 5px 18px rgba(238,77,45,0.35);
}
.pub-conv-header h2 { font-size: 19px; font-weight: 700; }
.pub-conv-header p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Public page product info card ── */
.pub-product-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 0;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  animation: fadeInUp 0.3s ease;
}
.pub-product-img-wrap {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  position: relative;
}
.pub-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.pub-product-skeleton {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.06) 25%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
.pub-product-skeleton-text {
  height: 16px;
  border-radius: 4px;
  width: 85%;
  margin-bottom: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.pub-product-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.pub-product-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pub-product-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 2px;
}

.pub-guide-card { padding: 24px; }
.pub-guide-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 18px; }
.guide-steps { display: flex; flex-direction: column; gap: 14px; }
.guide-step { display: flex; align-items: flex-start; gap: 12px; }
.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(238,77,45,0.20);
}
.step-text { font-size: 13px; color: var(--text-dim); line-height: 1.6; padding-top: 4px; }

.pub-footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────────────
   MODALS
───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.70);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  /* Bắt đầu ẩn, hiện khi có class .show */
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  /* Transition thay vì animation */
  transform: scale(0.93) translateY(12px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
}
.modal-overlay.show .modal-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.modal-icon.danger {
  background: var(--red-dim);
  color: var(--red);
}
.modal-box h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal-box p { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin-bottom: 28px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal-actions .btn { min-width: 120px; justify-content: center; }

/* ─────────────────────────────────────────────────
   TOAST
───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(80px) scale(0.95);
  opacity: 0;
  transition: all 0.35s var(--trans-spring);
  pointer-events: none;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show { transform: translateY(0) scale(1); opacity: 1; }
.toast.success { border-color: rgba(34,197,94,0.25); color: var(--green); }
.toast.error { border-color: rgba(239,68,68,0.25); color: #FCA5A5; }
.toast.info { border-color: rgba(59,130,246,0.25); color: var(--blue); }

/* ─────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .convert-layout { grid-template-columns: 1fr; }
  .convert-side-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .pub-body { grid-template-columns: 1fr; }
  .pub-hero-title { font-size: 34px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .dash-main { margin-left: 0 !important; }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky; top: 0; z-index: 50;
  }
  .mobile-menu-btn {
    background: none; border: none;
    color: var(--text); cursor: pointer;
    padding: 6px; display: flex; border-radius: 6px;
    flex-shrink: 0;
  }
  .mobile-brand { flex: 1; display: flex; align-items: center; gap: 9px; }
  .mobile-logo {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, #EE4D2D, #FF8C42);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .mobile-title { font-size: 15px; font-weight: 700; }
  .mobile-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #EE4D2D, #FF8C42);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: white;
    flex-shrink: 0;
  }

  .dash-section { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-value { font-size: 24px; }
  .section-header { flex-direction: column; gap: 12px; margin-bottom: 18px; }
  .section-title { font-size: 22px; }
  .convert-side-col { grid-template-columns: 1fr; }
  .subids-grid { grid-template-columns: 1fr; }
  .history-toolbar { flex-direction: column; align-items: stretch; }
  .history-toolbar-right { justify-content: space-between; }
  .auth-card { padding: 28px 22px; }
  .pub-hero { padding: 48px 16px 36px; }
  .header-actions { width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .pub-hero-title { font-size: 28px; letter-spacing: -0.8px; }
  .pub-hero-desc { font-size: 15px; }
  .modal-box { padding: 28px 22px; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { min-width: 0; width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────
   ADMIN PANEL STYLES
───────────────────────────────────────────────── */

/* Role Badge */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.role-badge.admin {
  background: linear-gradient(135deg, rgba(238,77,45,0.18), rgba(249,115,22,0.12));
  color: #FF8C42;
  border: 1px solid rgba(238,77,45,0.25);
}
.role-badge.user {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Nav Divider */
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 10px;
  display: none;
}
.nav-item-admin {
  color: var(--primary) !important;
  position: relative;
}
.nav-item-admin:hover { background: var(--primary-dim) !important; }
.nav-item-admin.active {
  background: var(--primary-dim) !important;
  border-color: rgba(238,77,45,0.12) !important;
}
/* Show divider when admin nav is shown (via JS, but we can handle via sibling) */
#nav-admin[style*="flex"] ~ * { display: block; }

/* Admin Tab Switcher */
.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
}
.admin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
}
.admin-tab-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.admin-tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 3px 12px rgba(238,77,45,0.35);
}
.admin-tab-count {
  background: rgba(255,255,255,0.18);
  color: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}
.admin-tab-btn:not(.active) .admin-tab-count {
  background: rgba(238,77,45,0.12);
  color: var(--primary);
}

/* Admin Table */
.admin-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.admin-table-header h3 { font-size: 15px; font-weight: 700; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.admin-table thead tr {
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr {
  transition: background var(--trans);
}
.admin-table tbody tr:hover { background: rgba(255,255,255,0.025); }

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}
.admin-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--text);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.admin-uname { font-size: 13.5px; font-weight: 600; }
.admin-uid { font-size: 11px; color: var(--text-muted); margin-top: 1px; font-family: monospace; }
.td-email { font-size: 12.5px; color: var(--text-dim); }
.td-links { font-size: 13.5px; font-weight: 700; color: var(--text); text-align: center; }
.td-num { color: var(--text-muted); font-size: 12px; text-align: center; }
.td-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* Modal Header (for admin modal) */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  display: flex;
  border-radius: 6px;
  transition: color var(--trans), background var(--trans);
}
.modal-close-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }


/* Admin modal: kế thừa hệ thống .show chung, chỉ override text-align */
#admin-user-modal .modal-box { text-align: left; }

/* Top Users Leaderboard */
.top-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.top-user-row:last-child { border-bottom: none; }
.top-rank { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.top-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.top-info { flex: 1; min-width: 0; }
.top-uname { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.top-count { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.top-bar-wrap {
  width: 70px;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}
.top-bar {
  height: 100%;
  background: linear-gradient(90deg, #EE4D2D, #FF8C42);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1);
}

/* Sys Info */
.sysinfo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.sysinfo-row:last-child { border-bottom: none; }
.sysinfo-row span { color: var(--text-muted); }
.sysinfo-row strong { color: var(--text); font-weight: 600; }

/* Admin responsive */
@media (max-width: 900px) {
  #asec-stats > div:last-child { grid-template-columns: 1fr !important; }
  .admin-tabs { flex-wrap: wrap; }
  .admin-tab-btn { flex: 1; justify-content: center; }
  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3),
  .admin-table th:nth-child(6),
  .admin-table td:nth-child(6) { display: none; }
}
@media (max-width: 600px) {
  .admin-table th:nth-child(5),
  .admin-table td:nth-child(5) { display: none; }
  .admin-uname { font-size: 12.5px; }
}

