:root {
  --wa-green: #22c55e;
  --wa-green-dark: #16a34a;
  --text-dark: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
}

a { color: var(--wa-green-dark); }

/* ---------- Topbar (shared) ---------- */
.topbar {
  background: var(--wa-green);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.logo-row { display: flex; align-items: center; gap: 10px; }

.logo-badge {
  width: 36px; height: 36px;
  background: #fff;
  color: var(--wa-green-dark);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.topbar h1 { color: #fff; font-size: 22px; margin: 0; }
.accent { color: #d1fae5; }
.card h2 .accent { color: var(--wa-green-dark); }

.user-row {
  display: flex; align-items: center; gap: 14px;
  color: #fff;
  font-size: 14px;
  flex-wrap: wrap;
}

.nav-links { display: flex; gap: 14px; flex-wrap: wrap; }
.nav-links a { color: #fff; text-decoration: none; font-size: 14px; opacity: .92; }
.nav-links a:hover, .nav-links a.active { text-decoration: underline; }

/* ---------- Hamburger button (admin mobile nav) ---------- */
.hamburger-btn {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 34px; height: 34px; background: rgba(255,255,255,0.15); border: none;
  border-radius: 8px; cursor: pointer; flex-shrink: 0; padding: 0;
}
.hamburger-btn span { display: block; width: 18px; height: 2px; background: #fff; margin: 0 auto; border-radius: 2px; }

/* ---------- Mobile sidebar (admin panel) ---------- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 299;
}
.sidebar-overlay.open { display: block; }

.mobile-sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: 260px; max-width: 82vw;
  background: #fff; z-index: 300; box-shadow: 4px 0 18px rgba(0,0,0,0.2);
  transform: translateX(-100%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.mobile-sidebar.open { transform: translateX(0); }
.mobile-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.mobile-sidebar-header .logo-row h1 { color: var(--text-dark); font-size: 19px; margin: 0; }
.mobile-sidebar-header .logo-badge { background: var(--wa-green); color: #fff; }
.sidebar-close-btn { background: none; border: none; font-size: 22px; color: var(--text-muted); cursor: pointer; }
.mobile-sidebar-nav { display: flex; flex-direction: column; padding: 10px; gap: 2px; }
.mobile-sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-radius: 8px;
  color: var(--text-dark); text-decoration: none; font-size: 15px; font-weight: 600;
}
.mobile-sidebar-nav a:hover { background: #f3f4f6; }
.mobile-sidebar-nav a.active { background: #ecfdf5; color: var(--wa-green-dark); }
.mobile-sidebar-nav a.sidebar-logout { color: var(--danger); margin-top: 8px; border-top: 1px solid var(--border); padding-top: 14px; border-radius: 0; }
.mobile-sidebar-user {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700; color: var(--text-dark);
}
.mobile-sidebar-user span:first-child { word-break: break-word; }

/* ---------- Layout ---------- */
.wrap {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.wrap-narrow { max-width: 420px; }
.wrap-wide { max-width: 1180px; }

/* ---------- Dashboard 2-column layout: form left, links right (desktop) ---------- */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
@media (min-width: 901px) {
  .dashboard-grid {
    display: grid;
    grid-template-columns: minmax(340px, 420px) 1fr;
    align-items: start;
    gap: 24px;
  }
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 { margin-top: 0; font-size: 22px; }
.card h3 { font-size: 17px; margin-bottom: 10px; }

/* ---------- Forms ---------- */
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.field { margin-bottom: 16px; flex: 1; }
.field-grow { flex: 3; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

input[type="text"], input[type="password"], input[type="email"], input[type="tel"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}

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

.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.prefix-input { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.prefix-input .prefix { background: #f9fafb; padding: 10px 12px; color: var(--text-muted); font-size: 14px; white-space: nowrap; }
.prefix-input input { border: none; border-radius: 0; }

#slug-status { display: block; margin-top: 6px; font-size: 13px; }
#slug-status.ok { color: var(--wa-green-dark); }
#slug-status.err { color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; border: none;
  font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
}

.btn-primary { background: var(--wa-green); color: #fff; }
.btn-primary:hover { background: var(--wa-green-dark); }

.btn-secondary { background: #e5e7eb; color: var(--text-dark); }
.btn-secondary:hover { background: #d1d5db; }

.btn-ghost { background: transparent; color: #fff; border: 1px solid #ffffff88; }

.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }

.btn-warn { background: #fef3c7; color: #92400e; }
.btn-warn:hover { background: #fde68a; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 8px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ---------- Result box ---------- */
.result-box { margin-top: 20px; padding: 16px; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 10px; }
.result-box.hidden { display: none; }
.result-link-row { display: flex; gap: 10px; margin-top: 8px; }
.result-link-row input { flex: 1; background: #fff; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; }
.msg-cell { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-row { color: var(--text-muted); text-align: center; padding: 24px; }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #e5e7eb; color: #374151; }
.badge-amber { background: #fef3c7; color: #92400e; }

.stat-strip { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.stat-box { background: #f9fafb; border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; min-width: 120px; }
.stat-box .num { font-size: 24px; font-weight: 700; color: var(--wa-green-dark); }
.stat-box .lbl { font-size: 12px; color: var(--text-muted); }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #b91c1c; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ---------- Login / Auth cards ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
  background: linear-gradient(135deg, #0f2e1c 0%, var(--wa-green-dark) 45%, var(--wa-green) 100%);
  background-size: 200% 200%;
  position: relative; overflow: hidden;
}
.login-body::before, .login-body::after {
  content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,0.08); pointer-events: none;
}
.login-body::before { width: 420px; height: 420px; top: -160px; left: -140px; }
.login-body::after { width: 320px; height: 320px; bottom: -140px; right: -100px; }

.login-card {
  background: #fff; padding: 36px 32px; border-radius: 18px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.28); position: relative; z-index: 1;
  text-align: center;
}
.login-card .logo-row { justify-content: center; margin-top: 6px; }
.login-card .logo-row h1 { color: var(--text-dark); font-size: 24px; }
.login-card .logo-row .logo-badge { background: var(--wa-green); color: #fff; }
.login-card h2 { font-size: 16px; color: var(--text-muted); margin-top: 4px; margin-bottom: 22px; font-weight: 500; }
.login-card form { text-align: left; }
.login-card .foot-link { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-muted); }

.login-icon-badge {
  width: 56px; height: 56px; border-radius: 50%; margin: -58px auto 14px;
  background: #fff; border: 4px solid #fff; box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  background: linear-gradient(135deg, var(--wa-green), var(--wa-green-dark));
}
.login-tag {
  display: inline-block; margin: 10px 0 2px; padding: 4px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.login-tag-admin { background: #1e293b; color: #fff; }
.login-tag-user { background: #ecfdf5; color: var(--wa-green-dark); }

/* ---------- Homepage ---------- */
.hero { background: linear-gradient(135deg, var(--wa-green), var(--wa-green-dark)); color: #fff; padding: 60px 20px 70px; text-align: center; }
.hero h1 { font-size: 34px; margin: 10px 0; }
.hero p { font-size: 16px; max-width: 560px; margin: 0 auto; opacity: .95; }
.home-wrap { max-width: 920px; margin: -40px auto 40px; padding: 0 16px; display: flex; gap: 24px; flex-wrap: wrap; }
.home-wrap .card { flex: 1; min-width: 300px; }
.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.feature-list li:last-child { border-bottom: none; }
.feature-list .tick { color: var(--wa-green-dark); font-weight: 700; }
.site-footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }
.site-footer a { color: var(--text-muted); }

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider-toggle { position: absolute; cursor: pointer; inset: 0; background-color: #d1d5db; transition: .2s; border-radius: 24px; }
.slider-toggle:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: #fff; transition: .2s; border-radius: 50%; }
input:checked + .slider-toggle { background-color: var(--wa-green); }
input:checked + .slider-toggle:before { transform: translateX(18px); }

/* ---------- Modal (click analytics) ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-overlay.hidden { display: none; }
.modal-box { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 560px; max-height: 80vh; overflow-y: auto; }
.modal-box h3 { margin-top: 0; }
.analytics-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eee; }
.analytics-pagination.hidden { display: none; }
.analytics-pagination button { border: 1px solid var(--wa-green); background: #fff; color: var(--wa-green-dark); font-weight: 600; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.analytics-pagination button:hover:not(:disabled) { background: #ecfdf5; }
.analytics-pagination button:disabled { opacity: 0.4; cursor: default; }
.analytics-pagination span { font-size: 13px; color: var(--text-muted); }
.modal-close { float: right; cursor: pointer; font-size: 20px; color: var(--text-muted); background: none; border: none; }
.click-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.click-row:last-child { border-bottom: none; }
.click-loc { color: var(--text-dark); font-weight: 600; }
.click-source { color: var(--wa-green-dark); font-weight: 600; }
.click-time { color: var(--text-muted); }

/* ---------- Premium upsell card + badges ---------- */
.premium-card {
  background: linear-gradient(135deg, #fffbeb, #fff);
  border: 1px solid #fde68a; position: relative; overflow: hidden;
}
.premium-card::before {
  content: ''; position: absolute; top: -50px; right: -50px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(245,158,11,0.28), transparent 70%);
}
.premium-card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.premium-badge {
  display: inline-flex; align-items: center; gap: 4px; background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .04em; padding: 5px 14px; border-radius: 999px;
}
.premium-price { font-weight: 800; color: #b45309; }
.premium-price .price-amount { font-size: 20px; }
.premium-price .price-period { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.premium-features { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 9px; }
.premium-features li { font-size: 14px; color: var(--text-dark); }
.premium-active-alert { background: #fef3c7; color: #92400e; }
.link-action-locked { color: var(--text-muted); }
.link-action-locked:hover { color: #92400e; }
.premium-chip {
  display: inline-flex; align-items: center; gap: 3px; background: linear-gradient(135deg, #fde68a, #fbbf24);
  color: #78350f; font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 999px;
}

/* ---------- User dashboard top nav: Go Premium button / active chip / Profile button ---------- */
.btn-premium-nav {
  background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #78350f;
  padding: 8px 16px; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.btn-premium-nav:hover { background: linear-gradient(135deg, #f59e0b, #d97706); }
.premium-chip-nav {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.2); color: #fff;
  font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px;
}
.profile-form-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.profile-form-section:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.profile-form-section h4 { margin: 0 0 12px; font-size: 15px; }

/* ---------- Admin Users page: responsive card grid (mobile friendly by default) ---------- */
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 16px; }

.user-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  background: #fff; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: relative; overflow: hidden;
}
.user-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--wa-green), var(--wa-green-dark));
}
.user-card-top { display: flex; gap: 12px; align-items: flex-start; }
.user-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--wa-green), var(--wa-green-dark)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px;
}
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; word-break: break-word; }
.user-card-contact { font-size: 13px; color: var(--text-muted); margin-top: 3px; word-break: break-all; }

.user-card-stats { display: flex; gap: 10px; padding: 12px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.user-stat { text-align: center; flex: 1; min-width: 68px; }
.user-stat-num { font-size: 20px; font-weight: 800; color: var(--wa-green-dark); line-height: 1; }
.user-stat-lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 3px; display: block; }
.limit-cell-row { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 4px; }
.limit-cell-row .limit-input { width: 56px; padding: 5px 6px; text-align: center; }

.user-card-premium-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.premium-toggle-label { font-weight: 600; font-size: 13px; }
.premium-toggle-label small { font-weight: 400; color: var(--text-muted); }

.user-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.user-card-actions .btn { flex: 1 1 auto; text-align: center; }

/* ---------- Hero topbar + login popup (homepage) ---------- */
/* ---------- Homepage top navbar (always visible, solid background) ---------- */
.site-navbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 14px 20px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.site-navbar-inner {
  max-width: 920px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.site-navbar-brand { font-size: 20px; font-weight: 800; color: var(--text-dark); }
.accent-dark { color: var(--wa-green-dark); }
.logo-badge-alt { background: var(--wa-green); color: #fff; }
.btn-navbar-login {
  padding: 10px 28px; font-size: 15px;
  box-shadow: 0 2px 8px rgba(34,197,94,0.3);
}

.card-register { order: -1; }

/* ---------- Generator card: link creation form ---------- */
.generator-layout { display: flex; }
.generator-form { flex: 1 1 auto; min-width: 0; max-width: 560px; }

.wa-toolbar {
  display: inline-flex; gap: 2px; margin-bottom: 10px; padding: 4px;
  background: #f3f4f6; border: 1px solid var(--border); border-radius: 10px;
}
.wa-fmt-btn {
  width: 38px; height: 34px; border-radius: 7px; border: none;
  background: transparent; color: var(--text-dark); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, box-shadow .15s, color .15s;
}
.wa-fmt-btn b, .wa-fmt-btn i, .wa-fmt-btn s { pointer-events: none; }
.wa-fmt-btn:hover { background: #e5e7eb; }
.wa-fmt-btn:active,
.wa-fmt-btn:focus-visible {
  background: #fff; color: var(--wa-green-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  outline: none;
}

/* ---------- Links header (title + search) ---------- */
.links-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.links-header h2 { margin: 0; }
.links-search { display: flex; gap: 8px; flex-wrap: wrap; }
.links-search input { min-width: 200px; }
.links-search select { min-width: 190px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; }

/* ---------- Owner badge (admin: kis user ne link banaya) ---------- */
.owner-badge {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.owner-badge-user { background: #ede9fe; color: #6d28d9; }
.owner-badge-admin { background: #dbeafe; color: #1e40af; }

/* ---------- Link cards (with QR) - ek ke niche ek, full-width rows ---------- */
.links-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }

.link-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  background: #fff; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: box-shadow .15s, transform .15s;
  position: relative; overflow: hidden;
  width: 100%;
}
.link-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--wa-green), var(--wa-green-dark));
}
.link-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,0.12); transform: translateY(-3px); }

/* Wide screens: sab kuch ek hi horizontal row me - QR/info | divider | actions/stats | download */
@media (min-width: 901px) {
  .link-card { flex-direction: row; align-items: center; gap: 20px; }
  .link-card-top { flex: 1 1 auto; min-width: 0; }
  .link-card-divider { align-self: stretch; width: 1px; border-top: none; border-left: 1px solid var(--border); flex-shrink: 0; }
  .link-card-bottom { flex-shrink: 0; }
  .download-qr-btn { width: auto; flex-shrink: 0; margin-top: 0; }
}

.link-card-top { display: flex; gap: 14px; }
.link-qr {
  width: 52px; height: 52px; border-radius: 8px; border: 1px solid var(--border);
  flex-shrink: 0; background: #fff; padding: 3px;
}
.link-card-info { flex: 1; min-width: 0; }
.link-card-title { font-size: 17px; font-weight: 700; color: var(--text-dark); word-break: break-word; }
.link-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.link-card-url { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.link-card-url a { font-size: 13px; word-break: break-all; }
.link-card-phone { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

.link-card-divider { border-top: 1px solid var(--border); }

.link-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.link-card-actions { display: flex; flex-direction: column; gap: 6px; }
.link-action-btn {
  background: none; border: none; text-align: left; padding: 2px 0;
  color: var(--wa-green-dark); font-size: 13px; font-weight: 600; cursor: pointer;
}
.link-action-btn:hover { text-decoration: underline; }
.link-action-danger { color: var(--danger); }

.link-card-stats {
  text-align: center; background: #ecfdf5; border: 1px solid #a7f3d0;
  border-radius: 12px; padding: 8px 20px; flex-shrink: 0;
}
.link-card-stats .stat-num { font-size: 30px; font-weight: 800; color: var(--wa-green-dark); line-height: 1; }
.link-card-stats .stat-lbl { font-size: 11px; color: var(--wa-green-dark); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.download-qr-btn { text-align: center; }

/* ---------- Admin: link limit editable cell ---------- */
.limit-cell { display: flex; align-items: center; gap: 6px; }
.limit-cell .limit-input { width: 64px; padding: 6px 8px; }

@media (max-width: 780px) {
  .hamburger-btn { display: flex; }
  /* Sab actions (nav links, premium button/chip, profile, name, logout) ab
     slide-in sidebar ke andar duplicate hote hain, isliye topbar par sirf
     logo + hamburger dikhta hai - green header ab hamesha ek hi row me
     rehta hai, chahe user ke paas kitne bhi buttons ho. */
  .topbar .user-row { display: none; }
}

/* Safety net: mobile drawer sidebar + its dark overlay must NEVER appear on
   wider screens - not even inline in the page flow. This guarantees the
   drawer only ever shows as a proper slide-in panel on small screens. */
@media (min-width: 781px) {
  .mobile-sidebar, .sidebar-overlay { display: none !important; }
}

@media (max-width: 900px) {
  .generator-layout { flex-direction: column; align-items: stretch; }
  .generator-form { max-width: none; }
}

@media (max-width: 560px) {
  .form-row { flex-direction: column; gap: 0; }
  .card { padding: 18px; }
  .hero h1 { font-size: 26px; }
  .stat-box { flex: 1; min-width: 100px; }
  .home-wrap { flex-direction: column; }
  .links-grid { grid-template-columns: 1fr; }
  .link-card-top { flex-wrap: wrap; }
}

/* ---------- Responsive "card" table (Users page etc. on small screens) ---------- */
@media (max-width: 760px) {
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap th, .table-wrap td, .table-wrap tr {
    display: block;
  }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }
  .table-wrap tr.empty-row-wrap { border: none; box-shadow: none; }
  .table-wrap td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 8px 0; border-bottom: 1px dashed var(--border); text-align: right;
  }
  .table-wrap td:last-child { border-bottom: none; }
  .table-wrap td::before {
    content: attr(data-label); font-weight: 700; color: var(--text-muted);
    font-size: 12px; text-transform: uppercase; letter-spacing: .03em; text-align: left;
  }
  .table-wrap .actions-cell { justify-content: flex-end; }
}
