﻿/* CWH PhotoSelect - Main CSS Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #0a0c11;
  --surface: #12151c;
  --surface2: #1a1f2a;
  --border: #22283a;
  --accent: #5b8ef0;
  --accent2: #8b6cf4;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;
  --text: #e2e8f0;
  --muted: #607080;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .4);
  --glow: 0 0 24px rgba(91, 142, 240, .2);
  --transition: .18s ease;
  --sidebar-w: 260px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html {
  scroll-behavior: smooth
}

body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px
}

a {
  color: var(--accent);
  text-decoration: none
}

a:hover {
  opacity: .85
}

img {
  max-width: 100%;
  height: auto
}

button {
  font-family: inherit
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: var(--surface)
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2
}

h2 {
  font-size: 1.5rem;
  font-weight: 700
}

h3 {
  font-size: 1.15rem;
  font-weight: 600
}

h4 {
  font-size: 1rem;
  font-weight: 600
}

.text-muted {
  color: var(--muted)
}

.text-sm {
  font-size: 13px
}

.text-xs {
  font-size: 11px
}

.fw-bold {
  font-weight: 700
}

/* Fade-in Animation for smooth loading */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Global Loader Spinner */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(91, 142, 240, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.layout {
  display: flex;
  min-height: 100vh
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .brand {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .brand .icon {
  font-size: 22px;
  -webkit-text-fill-color: initial
}

.sidebar-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
  padding-left: 32px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1
}

.nav-section {
  margin-bottom: 24px
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--accent)
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(91, 142, 240, .15), rgba(139, 108, 244, .15));
  color: var(--accent);
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  opacity: .8
}

.sidebar-bottom {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  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(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Hamburger button: hidden on desktop, shown by media query on mobile */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background var(--transition);
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, .07);
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1
}

/* Apply fade to content body */
.page-body {
  padding: 28px 24px;
  flex: 1;
  animation: fadeIn 0.4s ease forwards;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: 700
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px)
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-icon {
  font-size: 28px;
  margin-bottom: 12px
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: .92
}

.btn:active {
  transform: translateY(0)
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 12px rgba(91, 142, 240, .3)
}

.btn-danger {
  background: rgba(239, 68, 68, .15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, .3)
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff
}

.btn-success {
  background: rgba(34, 197, 94, .15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, .3)
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border)
}

.btn-outline:hover {
  background: var(--surface2)
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px
}

.btn-lg {
  padding: 13px 28px;
  font-size: 15px
}

.form-group {
  margin-bottom: 18px
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text)
}

.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 142, 240, .15)
}

.form-control::placeholder {
  color: var(--muted)
}

select.form-control {
  cursor: pointer
}

textarea.form-control {
  resize: vertical;
  min-height: 100px
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer
}

.form-check input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent)
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px
}

.table-wrap {
  overflow-x: auto
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px
}

thead tr {
  border-bottom: 2px solid var(--border)
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted)
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border)
}

tr:last-child td {
  border-bottom: none
}

tr:hover td {
  background: var(--surface2)
}

.table-actions {
  display: flex;
  gap: 6px
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em
}

.badge-success {
  background: rgba(34, 197, 94, .15);
  color: var(--success)
}

.badge-danger {
  background: rgba(239, 68, 68, .15);
  color: var(--danger)
}

.badge-warning {
  background: rgba(245, 158, 11, .15);
  color: var(--warning)
}

.badge-info {
  background: rgba(56, 189, 248, .15);
  color: var(--info)
}

.badge-muted {
  background: var(--surface2);
  color: var(--muted)
}

.alert {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Ensure links inside alerts wrap properly on narrow screens */
.alert a {
  word-break: break-all;
  min-width: 0;
  max-width: 100%;
}

/* Share URL card — responsive, URL wraps, button never overlaps */
.share-url-card {
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.share-url-card a {
  word-break: break-all;
  min-width: 0;
}

.alert-success {
  background: rgba(34, 197, 94, .1);
  border: 1px solid rgba(34, 197, 94, .25);
  color: #86efac
}

.alert-error {
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .25);
  color: #fca5a5
}

.alert-warning {
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .25);
  color: #fde68a
}

.alert-info {
  background: rgba(56, 189, 248, .1);
  border: 1px solid rgba(56, 189, 248, .25);
  color: #bae6fd
}

.storage-bar {
  background: var(--surface2);
  border-radius: 99px;
  height: 8px;
  overflow: hidden
}

.storage-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .5s ease
}

.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 20px
}

.page-link {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: all var(--transition)
}

.page-link:hover,
.page-link.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent)
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* padding creates guaranteed gap from all viewport edges */
  padding: 48px 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
  /* allow the flex item (modal) to scroll if taller than padded space */
  overflow-y: auto;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  /* max-width controls how wide the dialog is */
  max-width: 640px;
  width: 100%;
  /* max-height = overlay inner height (100% of padded flex space) */
  max-height: 100%;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 6px 20px rgba(0, 0, 0, .35);
  transform: scale(.96) translateY(10px);
  transition: transform .22s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  flex-shrink: 0;
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px
}

/* â”€â”€ Modal compact: tighten inner spacing so content fits without scroll â”€â”€ */
.modal {
  overflow-y: visible;
}

.modal .modal-header {
  margin-bottom: 12px;
}

.modal .form-group {
  margin-bottom: 9px;
}

.modal .form-label {
  font-size: 11.5px;
  margin-bottom: 3px;
}

.modal .form-control {
  padding: 7px 11px;
  font-size: 13px;
}

.modal .form-row {
  gap: 10px;
}

.modal .pin-input-group .form-control {
  padding: 7px 10px;
}

.modal [id$="PhoneTags"],
.modal [id$="GenPhoneTags"],
.modal [id$="genPhoneTags"],
.modal [id$="evtGenPhoneTags"],
.modal [id$="slePhoneTags"],
.modal [id$="evtEditPhoneTags"] {
  min-height: 28px;
  padding: 4px 8px;
}

.modal .form-check {
  font-size: 13px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(91, 142, 240, .06);
}

.dropzone-icon {
  font-size: 40px;
  margin-bottom: 14px;
  opacity: .6
}

.upload-queue {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 13px
}

.upload-progress {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden
}

.upload-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .3s
}

.empty-state {
  text-align: center;
  padding: 60px 24px
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: .4
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px
}

.empty-text {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px
}

@media(max-width:1024px) {
  :root {
    --sidebar-w: 220px
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr)
  }
}

/* Legacy @media768 block removed â€” fully replaced by new responsive system at bottom of file */

@media(max-width:600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr
  }

  .stats-grid .stat-card {
    padding: 14px
  }

  .stat-value {
    font-size: 22px
  }

  table th,
  table td {
    padding: 8px 10px;
    font-size: 13px
  }

  .card {
    padding: 16px
  }

  /* Tablet: slightly reduce overlay top/bottom gap */
  .modal-overlay {
    padding: 32px 16px;
  }

  .modal {
    padding: 22px 24px;
  }
}

@media(max-width:480px) {
  .stats-grid {
    grid-template-columns: 1fr
  }

  .page-body {
    padding: 12px
  }

  .card {
    padding: 14px;
    border-radius: 10px
  }

  h2 {
    font-size: 1.1rem
  }

  .btn {
    font-size: 13px;
    padding: 8px 14px
  }

  /* Mobile: tighter overlay gap, compact modal */
  .modal-overlay {
    padding: 20px 12px;
  }

  .modal {
    padding: 18px 16px;
    border-radius: 14px;
  }

  /* 4-col row (Min/Max/Deadline/PIN) â†’ 2-col on mobile */
  .modal [style*="grid-template-columns:1fr 1fr 1.4fr 1.6fr"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* 2-col rows inside modal â†’ 1-col on very small screens */
  .modal [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* WhatsApp input row: stack on mobile */
  .modal [style*="display:flex;gap:6px;align-items:stretch"] {
    flex-wrap: wrap;
  }

  .modal [style*="display:flex;gap:6px;align-items:stretch"] select {
    width: 100% !important;
    border-radius: 0 !important;
  }

  .topbar {
    height: 52px
  }

  .card-header {
    padding-bottom: 12px;
    gap: 8px
  }
}

@media(max-width:380px) {
  .modal-overlay {
    padding: 14px 8px;
  }

  .page-body {
    padding: 10px
  }

  .topbar {
    padding: 0 10px
  }

  .sidebar-logo {
    padding: 16px 14px 12px
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   NEW (Phase 5) â€” Hamburger, Footer, Form alias, Added Responsiveness
â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* form-control = alias for form-input so both classes work */
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

.form-control:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.form-control option {
  background: var(--surface2);
}

/* â”€â”€ Hamburger / menu-toggle: HIDDEN on desktop â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: var(--surface2);
}

/* Remove font-size residue from old text icon */
.menu-toggle svg {
  display: block;
}

/* â”€â”€ Body overflow lock when sidebar is open on mobile â”€â”€ */
body.sb-lock {
  overflow: hidden;
}

/* â”€â”€ Client Panel Footer â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.client-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  margin-top: auto;
}

.client-footer-sep {
  opacity: .4;
}

/* â”€â”€ Full responsive system â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

/* 1. Desktops > 1400px â€” generous gutter / max readable width */
@media (min-width: 1400px) {
  .page-body {
    padding: 32px 36px;
  }
}

/* 2. iPad Pro / large tablet landscape â€” sidebar narrower */
@media (max-width: 1280px) {
  :root {
    --sidebar-w: 240px;
  }
}

/* 3. Standard tablet landscape / small laptop */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 220px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* any 2-col grid in pages narrows to 1-col if below 400px each */
}

/* 4. â‰¤768px â€” mobile sidebar, hamburger shown â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 768px) {

  /* Sidebar: off-canvas */
  .sidebar {
    transform: translateX(-110%);
    z-index: 200;
    /* width stays 260px so it looks normal when open */
    width: var(--sidebar-w);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, .5);
  }

  /* Close button inside sidebar â€” show it */
  #sidebar-close-btn {
    display: flex !important;
  }

  /* Overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 199;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .sidebar-overlay.open {
    display: block;
  }

  /* Main takes full width */
  .main-content {
    margin-left: 0;
  }

  /* Show hamburger on mobile */
  .menu-toggle {
    display: flex !important;
  }

  /* Topbar adjustments */
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .topbar-title {
    font-size: 14px;
  }

  /* Form rows â†’ single column */
  .form-row,
  .settings-row {
    grid-template-columns: 1fr !important;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  /* Card header wrap */
  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Page body padding */
  .page-body {
    padding: 16px;
  }

  /* Tables: horizontal scroll only on table containers */
  .table-wrap,
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: max-content;
  }

  /* Modals */
  .modal {
    margin: 8px;
    padding: 20px;
    max-width: calc(100vw - 16px) !important;
  }

  /* Footer wraps nicely */
  .client-footer {
    gap: 6px;
    padding: 14px 16px;
  }

  .client-footer-sep {
    display: none;
  }

  /* Branding / plan grids collapse */
  .branding-layout {
    grid-template-columns: 1fr !important;
  }

  .plan-grid,
  .plan-grid-3 {
    grid-template-columns: 1fr !important;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }
}

/* 5. â‰¤600px â€” small handsets */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-value {
    font-size: 22px;
  }

  table th,
  table td {
    padding: 8px 10px;
    font-size: 13px;
  }

  .card {
    padding: 16px;
  }

  .modal {
    padding: 16px;
  }

  /* 3-col location dropdowns â†’ 1-col */
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    display: block !important;
  }

  .settings-row[style*="1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* 6. â‰¤480px â€” very small phones */
@media (max-width: 480px) {
  :root {
    --sidebar-w: 88vw;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-body {
    padding: 12px;
  }

  .card {
    padding: 14px;
    border-radius: 10px;
  }

  h2 {
    font-size: 1.1rem;
  }

  .btn {
    font-size: 13px;
    padding: 8px 14px;
  }

  .modal {
    margin: 4px;
    padding: 14px;
  }

  .topbar {
    height: 52px;
  }

  .card-header {
    padding-bottom: 12px;
    gap: 8px;
  }

  .feat-grid {
    grid-template-columns: 1fr !important;
  }
}

/* 7. â‰¤380px â€” tiny phones */
@media (max-width: 380px) {
  .page-body {
    padding: 10px;
  }

  .topbar {
    padding: 0 10px;
  }

  .sidebar-logo {
    padding: 16px 14px 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* â”€â”€ Prevent ANY horizontal overflow globally â”€â”€ */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

* {
  min-width: 0;
}

/* Mobile sidebar open: lock body scroll */
body.sb-lock {
  overflow: hidden;
}

/* -- Admin: client show stat boxes (3-col grid) --*/
.client-stat-boxes {
  grid-template-columns: repeat(3, 1fr) !important;
}

@media (max-width: 600px) {
  .client-stat-boxes {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 380px) {
  .client-stat-boxes {
    grid-template-columns: 1fr !important;
  }
}

/* Fallback: prevent inline 1fr 2fr grid overflowing on mobile */
@media (max-width: 768px) {

  [style*='grid-template-columns:1fr 2fr'],
  [style*='grid-template-columns: 1fr 2fr'] {
    grid-template-columns: 1fr !important;
  }
}

/* ------------------------------------------------------
   RESPONSIVE LAYOUT UTILITY CLASSES
   Added to replace all hard-coded inline grid overrides
   so media queries can properly collapse grids on mobile.
   ------------------------------------------------------ */

/* Admin dashboard: Recent Clients + Recent Events 2-col */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 860px) {
  .dash-grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Settings: Location 3-col (Country / State / City) */
.location-row {
  grid-template-columns: 1fr 1fr 1fr !important;
}

@media (max-width: 860px) {
  .location-row {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 560px) {
  .location-row {
    grid-template-columns: 1fr !important;
  }
}

/* Prevent any remaining inline grid overrides from overflowing on small phones */
@media (max-width: 480px) {
  [style*="grid-template-columns:1fr 1fr"]:not(.stats-grid) {
    grid-template-columns: 1fr !important;
  }
}

/* Ensure card-header flex always wraps on mobile (prevents button clip) */
@media (max-width: 768px) {
  .card-header {
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
  }
}

/* Global: all long text truncation for table cells with emails */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}


/* Admin branding form: 2-col collapse */
@media (max-width: 860px) {
  [style*="grid-template-columns:1fr 1fr;gap:20px;align-items:start"] {
    grid-template-columns: 1fr !important;
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   Generate Share Link Modal â€” Responsive
   (.gen-modal-wrap applies to the modal div; form is overflow-y:auto flex:1)
â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Tablet / iPad (â‰¤ 820px) */
@media (max-width: 820px) {
  .gen-modal-wrap {
    max-height: calc(100dvh - 24px) !important;
    border-radius: 14px !important;
  }

  /* 3-col settings row â†’ single column */
  .gen-settings-row {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Notify-email + PIN row â†’ full width single col */
  .gen-email-pin-row {
    grid-template-columns: 1fr !important;
  }

  .gen-email-pin-row>div[style*="opacity:0"] {
    display: none !important;
  }

  .gen-email-pin-row>div[style*="min-width"] {
    min-width: 0 !important;
    width: 100% !important;
  }
}

/* Mobile (â‰¤ 540px) */
@media (max-width: 540px) {

  /* Overlay: flush to all edges with small gap */
  #genModal.modal-overlay {
    padding: 10px 8px !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
  }

  .gen-modal-wrap {
    max-width: 100% !important;
    max-height: calc(100dvh - 20px) !important;
    border-radius: 12px !important;
    margin: 0 !important;
  }

  /* Header tighter on mobile */
  .gen-modal-wrap>div:first-child {
    padding: 14px 16px 12px !important;
  }

  /* Form padding tighter */
  .gen-modal-wrap form {
    padding: 14px 16px !important;
  }

  /* Settings row â†’ 1-col stack */
  .gen-settings-row {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* 2-col Event+Label row â†’ 1-col */
  .gen-modal-wrap [style*="grid-template-columns:1fr 1fr;gap:12px"] {
    grid-template-columns: 1fr !important;
  }

  /* WhatsApp country select â€” full width on very small */
  #genPhoneCc,
  #evtGenPhoneCc {
    width: 110px !important;
    min-width: 100px !important;
  }
}

/* Very small phones (â‰¤ 380px) */
@media (max-width: 380px) {
  .gen-modal-wrap form {
    padding: 12px 12px !important;
  }

  #genPhoneCc,
  #evtGenPhoneCc {
    width: 90px !important;
    min-width: 80px !important;
  }
}