:root {
  /* ── Surfaces ── */
  --bg-base:        #F4F5FA;
  --bg-surface:     #FFFFFF;
  --bg-elevated:    #F8F8FB;
  --bg-overlay:     rgba(46, 38, 61, 0.5);

  /* ── Brand ── */
  --accent:         #7C3AED;
  --accent-light:   #EDE9FE;
  --accent-hover:   #6D28D9;
  --accent-subtle:  rgba(124, 58, 237, 0.08);
  --accent-gradient: linear-gradient(135deg, #7C3AED 0%, #8B5CF6 100%);

  /* ── Semantic ── */
  --success:        #28C76F;
  --success-light:  #E8FAF0;
  --warning:        #FF9F43;
  --warning-light:  #FFF3E0;
  --danger:         #EA5455;
  --danger-light:   #FDEAEA;
  --info:           #00CFE8;
  --info-light:     #E0F9FC;

  /* ── Text ── */
  --text-primary:   #2E263D;
  --text-secondary: #655B72;
  --text-muted:     #A3A0AE;
  --text-disabled:  #C8C5CE;
  --text-inverse:   #FFFFFF;

  /* ── Borders ── */
  --border-color:   #EBEBED;
  --border-focus:   var(--accent);
  --border:         #E2E8F0;
  --border-soft:    #CBD5E1;

  /* ── Inbox: Dark Sidebar ── */
  --sidebar-bg: #111827;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(108, 99, 255, 0.18);
  --sidebar-text: #e8e8f0;
  --sidebar-sub: #7a7a90;

  /* ── Inbox: Thread Panel ── */
  --thread-bg: var(--bg-surface, #f4f4f6);
  --thread-surface: var(--bg-elevated, #ffffff);

  /* ── Spacing (8px base) ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ── Border Radius ── */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 4px rgba(46, 38, 61, 0.06);
  --shadow-sm: 0 2px 8px rgba(46, 38, 61, 0.08);
  --shadow-md: 0 4px 16px rgba(46, 38, 61, 0.10);
  --shadow-lg: 0 8px 32px rgba(46, 38, 61, 0.12);
  --shadow-xl: 0 16px 48px rgba(46, 38, 61, 0.16);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-input: 0 4px 20px rgba(0,0,0,0.08);

  /* ── Sidebar ── */
  --sidebar-width:        260px;
  --sidebar-bg:           #2E263D;
  --sidebar-text:         rgba(255,255,255,0.72);
  --sidebar-text-active:  #FFFFFF;
  --sidebar-active-bg:    rgba(124, 58, 237, 0.16);
  --sidebar-active-accent:#7C3AED;
  --sidebar-icon-size:    20px;

  /* ── Typography ── */
  --font-base:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'SF Mono', 'Fira Code', monospace;
  --text-xs:      11px;
  --text-sm:      12px;
  --text-base:    14px;
  --text-md:      15px;
  --text-lg:      18px;
  --text-xl:      22px;
  --text-2xl:     26px;
  --text-3xl:     32px;

  /* ── Transitions ── */
  --transition-fast:   0.15s ease;
  --transition-base:   0.25s ease;
  --transition-slow:   0.35s ease;
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme (default) */
[data-theme="light"] {
  --bg-base:        #F4F5FA;
  --bg-surface:     #FFFFFF;
  --bg-elevated:    #F8F8FB;
  --text-primary:   #2E263D;
  --text-secondary: #655B72;
  --text-muted:     #A3A0AE;
  --border-color:   #EBEBED;
  --shadow-sm: 0 2px 8px rgba(46, 38, 61, 0.08);
  --shadow-md: 0 4px 16px rgba(46, 38, 61, 0.10);
}

/* Dark theme */
[data-theme="dark"] {
  --bg-base:        #25293C;
  --bg-surface:     #2F3349;
  --bg-elevated:    #373B52;
  --text-primary:   #E4DFF0;
  --text-secondary: #A3A0AE;
  --text-muted:     #6B6880;
  --border-color:   #3D4163;
  --sidebar-bg:     #25293C;
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.24);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.28);
  --border-soft:    #2D3748;
  --thread-bg:      #2F3349;
  --thread-surface: #373B52;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(108,99,255,0.25);
}

/* STEP 2: GLOBAL BASE STYLES */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Typography scale */
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-primary); }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); }
h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); }

p  { color: var(--text-secondary); line-height: 1.7; }

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

/* Global logo image constraints - prevent large images from blocking UI */
#login-logo img,
#app-logo img,
#current-logo img,
.logo img,
.sidebar-logo img,
.logo-icon img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

#login-logo,
#app-logo,
#current-logo,
.logo,
.sidebar-logo,
.logo-icon {
  overflow: hidden;
}

/* Lucide Icons */
i[data-lucide], .lucide-icon, .lucide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

.lucide-icon svg {
  width: 100%;
  height: 100%;
}
.auth-page {
  min-height: 100vh; /* fallback */
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: var(--space-6);
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.auth-card p {
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  font-size: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition-base);
  width: 100%;
}

.form-input:focus  { 
  border-color: var(--accent); 
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}
.form-input::placeholder { color: #6b7280; }

/* Login screen specific */
.login-screen {
  min-height: 100vh; /* fallback */
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-base) 0%, var(--bg-surface) 100%);
  padding: 20px;
}

/* Enhanced datetime input styling */
input[type="datetime-local"] {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  padding-left: 42px !important;
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition-base);
  width: 100%;
}

input[type="datetime-local"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

/* Calendar icon wrapper for datetime inputs */
.datetime-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.datetime-input-wrapper i[data-lucide="calendar"] {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 20px;
  color: var(--accent);
  pointer-events: none;
  z-index: 1;
}

.login-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  text-align: center;
  animation: fadeInUp 400ms ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-5);
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(108, 99, 255, 0.35);
}

.login-box h1 {
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.login-box p {
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  font-size: 14px;
}

.login-box .form-group {
  text-align: left;
}

.login-box .btn {
  width: 100%;
  margin-top: var(--space-4);
}

.setup-link {
  margin-top: var(--space-5);
  font-size: 13px;
}

.setup-link a {
  color: var(--text-secondary);
}

.setup-link a:hover {
  color: var(--accent);
}

.divider {
  margin: var(--space-6) 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

.btn-facebook {
  width: 100%;
  background: #1877F2;
  color: white;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn-facebook:hover {
  background: #1a85ff;
}

/* STEP 3: THREE-ZONE LAYOUT */
.app-layout {
  display: flex;
  min-height: 100vh; /* fallback */
  min-height: 100dvh;
}

/* DASHBOARD VIEW */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.dashboard-title {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.dashboard-platform-pills {
  display: flex;
  gap: 6px;
}

.dashboard-platform-pills .platform-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.dashboard-platform-pills .platform-pill.active {
  background: #e7f8ef;
  color: #16a34a;
}

.dashboard-platform-pills .platform-pill.instagram {
  background: #fdf2f8;
  color: #9d174d;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-card .stat-change {
  font-size: 12px;
}

.stat-card .stat-change.positive {
  color: var(--success);
}

.stat-card .stat-change.negative {
  color: var(--error);
}

.dashboard-bottom {
  display: flex;
  gap: 16px;
  padding: 0 24px 24px;
  flex: 1;
  min-height: 0;
}

.schedule-card,
.activity-card {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.card-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--error);
}

.live-indicator .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--error);
  animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.appointments-list,
.activity-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.appointment-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.2s;
}

.appointment-row:hover {
  background: var(--bg-elevated);
}

.appointment-row .appt-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 45px;
}

.appointment-row .appt-info {
  flex: 1;
  min-width: 0;
}

.appointment-row .appt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.appointment-row .appt-service {
  font-size: 11px;
  color: var(--text-secondary);
}

.appointment-row .appt-platform {
  font-size: 16px;
  width: 24px;
  text-align: center;
}

.appointment-row .appt-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
}

.appointment-row .appt-status.pending {
  color: var(--warning);
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-detail {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.empty-schedule,
.empty-activity {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Responsive Dashboard */
@media (max-width: 1024px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-bottom {
    flex-direction: column;
  }
  
  .schedule-card,
  .activity-card {
    max-height: 300px;
  }
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
    padding: 12px 16px;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .dashboard-stats {
    grid-template-columns: 1fr !important;
  }
}

/* DARK SIDEBAR */
.sidebar {
  width: 260px;
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  padding: 16px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 16px;
  margin-bottom: 8px;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.sidebar-logo .logo-text {
  font-weight: 700;
  font-size: 15px;
  color: white;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s;
  position: relative;
}

.sidebar .nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar .nav-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar .badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar .plan-badge {
  margin: 12px 16px;
  padding: 6px 10px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
}

.language-switcher {
  padding: 0 16px;
  margin-bottom: 12px;
}

.language-switcher select {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: white;
  font-size: 12px;
}

.language-switcher select option {
  background: #1f2937;
  color: white;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

.user-info .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.user-info .user-meta {
  flex: 1;
  min-width: 0;
}

.user-info .user-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.user-info .user-email {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info .logout-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 4px;
}

.user-info .logout-btn:hover {
  color: white;
}

/* STEP 4: SIDEBAR CSS */
.sidebar {
  width: 260px;
  height: 100vh; /* fallback */
  height: 100dvh;
  background: var(--sidebar-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  padding: 16px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 8px;
}

.sidebar-logo img {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.sidebar-logo .logo-text {
  font-weight: 700;
  font-size: 15px;
  color: white;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s;
  position: relative;
}

.nav-item:hover {
  color: white;
  background: rgba(255,255,255,0.05);
}

.nav-item.active {
  color: white;
  background: rgba(255,255,255,0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nav-item .badge {
  position: absolute;
  right: 12px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Secondary nav items (inbox) are visually de-emphasized */
.nav-item.secondary {
  margin-top: 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

.nav-item.secondary:hover {
  color: rgba(255,255,255,0.55);
}

/* Superadmin nav item */
.superadmin-nav {
  margin-top: var(--space-2);
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
}

/* Impersonation banner */
.impersonation-banner {
  background: linear-gradient(135deg, var(--warning-soft), rgba(245, 158, 11, 0.15));
  border-bottom: 1px solid var(--warning);
  padding: var(--space-2) var(--space-4);
}

.impersonation-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  font-size: 14px;
}

.impersonation-content strong {
  color: var(--warning);
}

/* Plan badge */
.plan-badge {
  margin: 12px 16px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  border-radius: 6px;
  text-align: center;
}

.plan-badge.starter { background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%); color: white; }
.plan-badge.pro     { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); color: white; }

/* User info footer */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

.user-meta {
  flex: 1;
  overflow: hidden;
}

.user-name {
  display: block;
  font-weight: 600;
  font-size: 12px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  display: block;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.logout-btn:hover { color: var(--danger); }

/* STEP 5: MAIN CONTENT AREA CSS */
.main {
  flex: 1;
  margin-left: 260px;
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
  width: calc(100% - 260px);
}

.text-muted { color: var(--text-muted); font-size: 13px; }

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.page-header h1 {
  color: var(--text-primary);
}

.page-header .text-muted {
  margin-top: var(--space-1);
}

.page-actions {
  display: flex;
  gap: var(--space-3);
}

/* Stat cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-5);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--transition-smooth);
}

@media (hover: hover) and (pointer: fine) {
  .stat-card:hover { 
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
  }
}

.stat-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card-trend {
  font-size: 12px;
  font-weight: 500;
}

.stat-card-trend.up   { color: var(--success); }
.stat-card-trend.down { color: var(--danger); }
.stat-card-trend.flat { color: var(--text-muted); }

/* STEP 6: DATA TABLE CSS */
.data-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
  .data-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table-toolbar { flex-wrap: wrap; }
  .search-input { width: 100%; order: -1; }
  thead th { font-size: 10px; padding: 8px 12px; }
  tbody td { padding: 12px; font-size: 12px; }
}

.data-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  gap: var(--space-3);
}

.search-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-4);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  width: 220px;
  transition: border-color var(--transition-fast);
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: #6b7280; }

table {
  width: 100%;
  border-collapse: collapse;
  overflow: visible;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: var(--space-3) var(--space-5);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: var(--space-4) var(--space-5);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Status dots */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  font-weight: 500;
}

.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.confirmed::before {
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success-soft);
}

.status-dot.pending::before {
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--warning-soft);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.cancelled::before {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Channel pills */
.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--info-soft);
  color: var(--info);
}

.channel-pill.whatsapp  { background: var(--success-soft); color: var(--success); }
.channel-pill.instagram { background: var(--warning-soft); color: var(--warning); }
.channel-pill.messenger { background: var(--info-soft);    color: var(--info); }
.channel-pill.phone     { background: var(--bg-elevated);  color: var(--text-secondary); }

/* Loyalty star badge */
.loyalty-badge {
  color: #F59E0B;
  font-size: 14px;
  margin-left: var(--space-2);
}

/* STEP 7: BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 24px;
  min-height: 44px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { 
  background: var(--accent); 
  color: #fff; 
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); 
} 
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { 
    background: var(--accent-hover); 
    transform: translateY(-2px); 
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); 
  }
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success {
  background: var(--success-soft);
  color: var(--success);
}
.btn-success:hover { background: var(--success); color: #fff; }

.btn-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.btn-warning:hover { background: var(--warning); color: #fff; }

.btn-sm { padding: var(--space-1) var(--space-3); font-size: 12px; }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: 15px; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast),
              background var(--transition-fast);
  display: flex; align-items: center; justify-content: center;
}

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

/* STEP 8: DETAIL PANEL CSS */
.detail-panel {
  width: 360px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  position: fixed;
  right: 0; top: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.detail-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Detail panel field rows */
.detail-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.detail-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.detail-field-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* When main content area shifts left to make room */
.main.panel-open {
  margin-right: 360px;
  transition: margin-right 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1100px) {
  .detail-panel { box-shadow: 0 20px 40px rgba(15,23,42,0.15); }
  .main.panel-open { margin-right: 0; }
}

/* STEP 9: TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  transition: all var(--transition-smooth);
  max-width: 380px;
  backdrop-filter: blur(8px);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-warning { border-left: 3px solid var(--warning); }
.toast.toast-danger  { border-left: 3px solid var(--danger); }
.toast.toast-info    { background: var(--info-soft); border-left: 3px solid var(--info); color: var(--text-primary); }

@media (max-width: 768px) {
  .toast-container {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 12px);
    right: 12px;
    left: 12px;
  }
  .toast { max-width: 100%; }
}

/* CONFIRMATION MODAL */
.confirm-modal-content {
  max-width: 400px;
  text-align: center;
  padding: var(--space-8);
}
.confirm-modal-icon {
  font-size: 40px;
  margin-bottom: var(--space-4);
}
.confirm-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}
.confirm-modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

/* EMPTY STATES */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-10);
  gap: var(--space-4);
}
.empty-state-icon { font-size: 48px; }
.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.empty-state-body {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.6;
}

/* FIELD HINTS */
.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: 1.5;
}

/* HELP ICONS */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  margin-left: var(--space-2);
  position: relative;
}
.help-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-surface);
  font-size: 12px;
  font-weight: 400;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 220px;
  line-height: 1.5;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 500;
}
.help-icon:hover::after,
.help-icon:focus::after { opacity: 1; }

/* STEP 10: SKELETON LOADERS */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* STEP 11: FEATURE FLAG UPGRADE PROMPT */
.upgrade-prompt {
  background: var(--bg-surface);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  max-width: 440px;
  margin: var(--space-10) auto;
  transition: all var(--transition-base);
}

.upgrade-prompt:hover {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-lg);
}

.upgrade-prompt-icon {
  font-size: 32px;
  background: var(--accent-gradient);
  width: 64px; height: 64px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(108, 99, 255, 0.3);
}

.upgrade-prompt h3 {
  color: var(--text-primary);
}

.upgrade-prompt p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 300px;
  line-height: 1.7;
}

/* Cookie Consent Banner */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  padding: 24px;
  animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-content h3 {
  margin-top: 0;
  font-size: 18px;
  font-weight: 700;
}

.cookie-categories {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.cookie-categories label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
}

.cookie-categories label:hover {
  background: var(--bg-hover);
}

.cookie-categories input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.cookie-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

@keyframes slideInUp {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
  .cookie-banner {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px;
  }
}

/* STEP 12: RESPONSIVE / MOBILE */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main, .main-content {
    margin-left: 0 !important;
    padding: var(--space-4);
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    width: 100% !important;
    flex: none;
  }
  .mobile-nav { 
    display: flex; 
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    min-height: calc(64px + env(safe-area-inset-bottom, 0px));
    max-height: calc(64px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    flex-grow: 0;
    background: var(--sidebar-bg);
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 200;
  }
  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 100%;
    min-width: 0;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    padding: 8px 4px;
    color: rgba(255,255,255,0.55);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }
  .mobile-nav-item svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }
  .mobile-nav-item.active {
    color: var(--primary, #6C63FF);
  }
  .mobile-nav-item.active svg {
    stroke: var(--primary, #6C63FF);
    fill: none;
  }
  .detail-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); }
  .main.panel-open { margin-right: 0; }
  
  /* Body prevent iOS bounce */
  body {
    position: relative;
  }
}

/* Global iOS bounce prevention */
html, body {
  overscroll-behavior: none;
}

@media (min-width: 769px) {
  .mobile-nav { display: none !important; }
}

@media (max-width: 768px) {
  .mobile-nav { display: flex; }
}

.mobile-nav {
  /* Hidden until JS auth check runs. JS sets display to control visibility. */
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,0.1);
  z-index: 300;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  min-height: calc(64px + env(safe-area-inset-bottom, 0px));
  max-height: calc(64px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  flex-shrink: 0;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,0.55);
  font-size: 10px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  flex: 1;
  height: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mobile-nav-item:hover {
  color: white;
}

.mobile-nav-item svg { width: 24px; height: 24px; }
.mobile-nav-item.active { 
  color: white; 
}

/* ============================================ */
/* EXISTING COMPONENT STYLES - ADAPTED         */
/* ============================================ */

/* Dashboard */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: 260px !important;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: relative;
  overflow-x: hidden;
  width: calc(100% - 260px) !important;
  max-width: calc(100% - 260px) !important;
  box-sizing: border-box;
}

/* Detail panel shift for dashboard layout */
@media (min-width: 1101px) {
  .main-content.panel-open {
    margin-right: 360px;
    transition: margin-right 280ms cubic-bezier(0.4, 0, 0.2, 1);
  }
}

.main-content > * {
  max-width: 100%;
}

/* Views */
.view {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.view.active {
  display: block !important;
  visibility: visible !important;
  position: relative !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.view-header h2 {
  color: var(--text-primary);
}

/* Filters */
.filters {
  display: flex;
  gap: 12px;
}

.filters select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.filters select:focus {
  outline: none;
}

@media (max-width: 640px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .view-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .filters { flex-wrap: wrap; }
  .filters select { flex: 1; min-width: 140px; }
}

/* Bookings grid */
.bookings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

.booking-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-smooth);
}

@media (hover: hover) and (pointer: fine) {
  .booking-card:hover {
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
  }
}

.booking-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.booking-service {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.booking-status {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.booking-status.confirmed {
  background: var(--success-soft);
  color: var(--success);
}

.booking-status.pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.booking-status.cancelled {
  background: var(--danger-soft);
  color: var(--danger);
}

.booking-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.booking-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.booking-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-10) var(--space-6);
  color: var(--text-muted);
}

.empty-state span {
  display: block;
  margin-bottom: var(--space-4);
}

/* Emoji Icon */
.emoji-icon {
  display: inline-block;
  vertical-align: middle;
  font-style: normal;
  line-height: 1;
}

/* Phone entry form */
.form-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 640px;
  box-shadow: var(--shadow-lg);
}

.form-container form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-container .form-group {
  margin-bottom: 0;
}

.form-container label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-container input,
.form-container select,
.form-container textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px;
  font-size: 14px;
  font-family: var(--font-sans);
}

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

.form-container input::placeholder,
.form-container textarea::placeholder {
  color: var(--text-muted);
}

/* Settings */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 640px;
}

.settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.settings-section:hover {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-lg);
}

.settings-section h3 {
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.setting-item {
  margin-bottom: 20px;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.debug-section {
  margin-bottom: 28px;
}

.debug-section h4 {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.debug-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}

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

.debug-table td:first-child {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  width: 180px;
  background: var(--bg-hover);
}

.service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.service-info {
  flex: 1;
}

.service-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.service-details {
  font-size: 13px;
  color: var(--text-muted);
}

.service-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.booking-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 8px;
}

.booking-price-note {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: normal;
}

.setting-item > label:not(.toggle-label) {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.theme-options,
.color-options {
  display: flex;
  gap: 10px;
}

.theme-btn,
.color-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.theme-btn:hover,
.color-btn:hover {
  transform: scale(1.1);
}

.theme-btn.selected,
.color-btn.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.logo-upload {
  display: flex;
  align-items: center;
  gap: 20px;
}

.current-logo {
  width: 80px;
  height: 80px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  overflow: hidden;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  padding: var(--space-2) 0;
}

.toggle-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.password-form .form-group {
  margin-bottom: 0;
}

.error-message {
  color: var(--danger);
  font-size: 13px;
}

.success-message {
  color: var(--success);
  font-size: 13px;
}

/* Settings Tabs */
.settings-layout {
  display: flex;
  gap: var(--space-6);
}

.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  background: var(--bg-surface);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  height: fit-content;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: left;
}

.settings-tab:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.settings-tab.active {
  background: var(--accent);
  color: white;
}

.settings-tab i {
  width: 18px;
  height: 18px;
}

.settings-content {
  flex: 1;
  max-width: 640px;
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .settings-layout {
    flex-direction: column;
    gap: var(--space-4);
  }
  
  .settings-content {
    max-width: 100%;
  }
  
  .settings-tab-content.active {
    gap: var(--space-4);
    padding: var(--space-4);
  }
  
  .settings-tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-width: auto;
    padding: 8px;
    gap: 4px;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  
  .settings-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .settings-tab {
    flex: 0 0 auto;
    min-width: 70px;
    justify-content: center;
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .settings-tab span {
    display: inline;
    font-size: 11px;
    margin-left: 4px;
  }
  
  .settings-tab i {
    width: 16px;
    height: 16px;
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Table styles for clients */
.clients-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.clients-table th,
.clients-table td {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.clients-table th {
  background: var(--bg-elevated);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.clients-table tbody tr {
  transition: all var(--transition-base);
}

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

.clients-table td {
  font-size: 13px;
  color: var(--text-primary);
}

/* Filter bar for tables */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 13px;
}

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

/* No messages state */
.no-messages {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.no-messages span {
  font-size: 48px;
  margin-bottom: 16px;
}

/* Booking Edit Form */
.booking-edit-form .form-group {
  margin-bottom: 16px;
}

.booking-edit-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.booking-edit-form .form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
}

.booking-edit-form .form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.booking-edit-form select.form-input {
  cursor: pointer;
}

/* Meta Channels Widget */
.alert-warning {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  color: #856404;
}

.alert-warning strong {
  display: block;
  margin-bottom: 8px;
}

.alert-warning p {
  margin: 0 0 12px 0;
}

.alert-warning .btn {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.meta-channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.channel-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.channel-card:hover {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.channel-icon {
  font-size: 24px;
}

.channel-info {
  display: flex;
  flex-direction: column;
}

.channel-name {
  font-weight: 500;
  font-size: 14px;
}

.channel-status {
  font-size: 12px;
  color: var(--text-muted);
}

.channel-status.connected {
  color: var(--success);
}

.channel-status.needs-reconnect {
  color: var(--warning);
}

/* WhatsApp Business account management */
.wa-account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.wa-account-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}
.wa-phone {
  font-weight: 600;
}
.wa-name {
  color: var(--text-muted);
  font-size: 13px;
}
.wa-status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.wa-status-badge.active    { background: #dcfce7; color: #166534; }
.wa-status-badge.suspended { background: #fef9c3; color: #854d0e; }
.wa-status-badge.disconnected { background: #f3f4f6; color: #6b7280; }
.wa-quality-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.wa-quality-badge.high   { background: #dcfce7; color: #166534; }
.wa-quality-badge.medium { background: #fef9c3; color: #854d0e; }
.wa-quality-badge.low    { background: #fee2e2; color: #991b1b; }
.wa-verified-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; background: #dcfce7; color: #166534; }
.wa-warning-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; background: #fef9c3; color: #854d0e; }
.wa-account-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.wa-accounts-list .no-accounts {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
}

.human-handoff-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

.btn-warning {
  background-color: var(--warning);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-warning:hover {
  background-color: #d97706;
}

/* Language Switcher */
.language-switcher {
  padding: 0 var(--space-4);
  margin-bottom: var(--space-3);
}

.language-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.language-select:hover {
  background-color: var(--bg-hover);
}

.language-select:focus {
  outline: none;
  border-color: var(--accent);
}

.language-select option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

/* Login Page Language Switcher */
.login-language-switcher {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 10;
}

.login-language-switcher .language-select {
  width: auto;
  min-width: 100px;
}

/* Registration Plan Info */
.setup-plan-info {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-soft);
  text-align: left;
}

.trial-highlight {
  background: var(--accent-soft);
  color: var(--accent);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-5);
  display: block;
  text-align: center;
}

.tier-mini-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.tier-mini-card {
  background: var(--bg-elevated);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  transition: all var(--transition-base);
}

.tier-mini-card:hover {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-md);
}

.tier-mini-card h4 {
  margin-bottom: var(--space-3);
  color: var(--text-primary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tier-mini-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tier-mini-card li {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.3;
}

.tier-mini-card li::before {
  content: '✓';
  color: var(--success);
  flex-shrink: 0;
}

.upgrade-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* TOUR STYLES */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 2000;
  pointer-events: none;
}
.tour-highlight {
  position: relative;
  z-index: 2001;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 4px var(--accent), 0 0 0 8px rgba(108,99,255,0.2);
}
.tour-bubble {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  width: 280px;
  box-shadow: var(--shadow-xl);
  z-index: 2002;
}
.tour-step-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.tour-bubble-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.tour-bubble-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}
.tour-bubble-footer {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}
.tour-bubble-footer .btn {
  flex: 1;
}

/* ===================================
   BRAND COLOR PICKER
   Applied: 2026-03-17
=================================== */

.color-swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}

.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--swatch-color);
  border: 3px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.15s;
  outline: none;
}
.color-swatch:hover {
  transform: scale(1.12);
}
.color-swatch.selected {
  border-color: var(--swatch-color);
  box-shadow:
    0 0 0 2px white,
    0 0 0 4px var(--swatch-color);
}

.color-preview-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0 24px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.color-preview-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.color-preview-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-main);
  transition: background 0.3s, color 0.3s;
}

@media (max-width: 480px) {
  .color-preview-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .color-swatch-grid {
    gap: 10px;
  }
  .color-swatch {
    width: 40px;
    height: 40px;
  }
}

/* ===================================
   RESPONSIVE TABLE WRAPPERS
   Applied: 2026-03-17
=================================== */

.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

@media (max-width: 768px) {
  .table-scroll-wrapper table {
    min-width: 500px;
  }
  
  /* Modal mobile width */
  .modal-content {
    width: 92%;
    max-width: 600px;
    margin: 16px auto;
  }
}

/* ===================================
   480PX SMALL PHONE BREAKPOINT
   Applied: 2026-03-17
=================================== */

@media (max-width: 480px) {
  /* Stats grid: stack to 1 column on very small screens */
  .stats-grid,
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
  
  /* Auth forms full width */
  .login-container {
    padding: 24px 16px;
    margin: 20px 16px;
  }
  
  /* Reduce heading size for very small screens */
  h1 { font-size: 22px; }
  h2 { font-size: 17px; }
  .stat-card-value { font-size: 24px; }
  
  /* Modal near-fullscreen on very small screens */
  .modal-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ============================================
   ACCESSIBILITY FIXES - Applied: 2026-03-17
   WCAG 2.1 Level AA + EN 301 549
   ============================================ */

/* === ACCESSIBILITY: Skip Navigation Link === */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  padding: 12px 24px;
  background: var(--accent, #6C63FF);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-radius: 0 0 8px 8px;
  z-index: 9999;
  transition: top 0.1s;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

/* === ACCESSIBILITY: Focus Indicators === */
/* Override all outline:none with visible focus styles */
*:focus {
  outline: 3px solid var(--accent, #6C63FF) !important;
  outline-offset: 2px !important;
}
*:focus:not(:focus-visible) {
  outline: none !important;  /* Remove outline for mouse clicks only */
}
*:focus-visible {
  outline: 3px solid var(--accent, #6C63FF) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px rgba(108, 99, 255, 0.25) !important;
}
/* Ensure form inputs retain their existing focus box-shadow AND get outline */
.form-input:focus-visible,
.form-control:focus-visible {
  outline: 3px solid var(--accent, #6C63FF) !important;
  outline-offset: 2px !important;
}
/* Nav items and buttons */
.nav-item:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent, #6C63FF) !important;
  outline-offset: 3px !important;
  border-radius: 4px;
}

/* === ACCESSIBILITY: Screen Reader Only Text === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* === ACCESSIBILITY: Touch Targets === */
button,
[role="button"],
a,
input[type="checkbox"],
input[type="radio"],
select {
  min-height: 44px;
  min-width: 44px;
}
/* Override for inline/small elements that cannot expand */
.inline-link,
.breadcrumb a {
  display: inline-flex;
  align-items: center;
  padding: 8px 4px;
}

/* === ACCESSIBILITY: Required Field Indicator === */
.required-star {
  color: var(--danger, #ef4444);
  margin-left: 2px;
}

/* === ACCESSIBILITY: Page Header Styles === */
.page-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}
.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  text-decoration: none;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
}
.nav-link:hover {
  color: var(--text-primary);
}

/* === ACCESSIBILITY: Page Footer Styles === */
.page-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 24px;
  margin-top: auto;
}
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}
.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.footer-copyright {
  color: var(--text-muted);
  font-size: 14px;
}

/* === ACCESSIBILITY: Form Notes === */
.form-note {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* --- Rule 6: plan-card as button reset --- */
.plan-card[role="radio"] {
  background: var(--bg-elevated);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  display: block;
}
.plan-card[role="radio"]:hover {
  border-color: var(--accent);
}
.plan-card[role="radio"][aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ================================================
   MOBILE & A11Y FIXES
   Applied: 2026-03-20
   ================================================ */

/* --- Rule 1: Hide settings & superadmin on mobile --- */
@media (max-width: 768px) {
  .hide-on-mobile { display: none !important; }
  #superadmin-nav-item,
  #mobile-superadmin-nav-item { display: none !important; }
}

/* --- Rule 8: Minimum 44×44px tap targets --- */
.modal-close,
.theme-btn,
#logout-btn,
.nav-icon,
.color-swatch {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Rule 9: booking-respond.html date comparison grid --- */
@media (max-width: 480px) {
  .datetime-comparison { grid-template-columns: 1fr; }
  .datetime-box:first-child { margin-bottom: 12px; }
}

/* --- Rule 9: index.html settings content mobile padding --- */
@media (max-width: 768px) {
  .settings-content { max-width: 100%; padding: 0 16px; }
}

/* --- Rule 9: simulator/index.html mobile blocking overlay --- */
/* DISABLED: Simulator is a dev tool, should be accessible at all widths */
/* @media (max-width: 768px) {
  body.sim-body::before {
    content: "The WhatsApp Simulator is designed for desktop use.";
    display: flex; align-items: center; justify-content: center;
    position: fixed; inset: 0; background: var(--bg);
    font-size: 1rem; padding: 2rem; text-align: center; z-index: 9999;
  }
  body.sim-body .sim-container { display: none; }
} */

/* --- Rule 7: conversation-item button reset --- */
button.conversation-item {
  background: none; border: none; width: 100%;
  text-align: left; cursor: pointer; padding: 0;
}

/* --- Settings tabs tablist styles --- */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border-soft);
}

/* --- Nav list reset for accessibility --- */
.sidebar-nav ul,
.mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* === TESTER ENVIRONMENT BANNER === */
.tester-banner {
  background: #f59e0b;
  color: #000;
  padding: 10px 20px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
.tester-banner-icon {
  font-size: 1.25rem;
}
.tester-banner-text {
  flex: 1;
}

/* ══════════════════════════════════════════════════
   INBOX — Modern Dark Sidebar Design
   ══════════════════════════════════════════════════ */

#inbox-view {
  height: calc(100vh - 60px);
  display: flex;
  overflow: hidden;
  padding: 12px;
  background: var(--sidebar-bg);
  box-sizing: border-box;
}

.inbox-container {
  display: flex;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
}

/* ── Dark Sidebar ─────────────────────────────────── */
.inbox-sidebar {
  width: 300px;
  min-width: 260px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 4px 0;
}

.sidebar-header {
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--sidebar-text);
  letter-spacing: 0.01em;
}

/* ── Search ───────────────────────────────────────── */
.sidebar-search { position: relative; }

.sidebar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  pointer-events: none;
  opacity: 0.5;
}

.sidebar-search input {
  width: 100%;
  padding: 7px 12px 7px 30px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  font-size: 0.8rem;
  outline: none;
  box-sizing: border-box;
  color: var(--sidebar-text);
  transition: all 0.15s;
  caret-color: var(--accent);
}

.sidebar-search input::placeholder { color: var(--sidebar-sub); }

.sidebar-search input:focus {
  border-color: rgba(108, 99, 255, 0.5);
  background: rgba(108, 99, 255, 0.08);
}

/* ── Platform Filters ─────────────────────────────── */
.platform-filters { display: flex; gap: 4px; flex-wrap: wrap; }

.filter-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--sidebar-sub);
  transition: all 0.15s;
  white-space: nowrap;
  font-weight: 500;
}

.filter-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }

.filter-btn.active {
  background: var(--accent-dim);
  color: #4a44d0;
  font-weight: 600;
}

/* ── Conversation List ────────────────────────────── */
.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  scrollbar-width: none;
}

.conversation-list::-webkit-scrollbar { display: none; }

.conversation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.12s;
  position: relative;
  margin-bottom: 1px;
}

.conversation-item:hover { background: var(--sidebar-hover); }
.conversation-item.active { background: var(--sidebar-active); }

.conversation-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* ── Gradient Avatars ─────────────────────────────── */
.conv-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6C63FF 0%, #a78bfa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 8px rgba(108,99,255,0.35);
}

.conv-platform-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--sidebar-bg);
  background: #25D366;
  font-size: 0;
}

.conv-info { flex: 1; min-width: 0; }

.conv-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-preview {
  font-size: 0.74rem;
  color: var(--sidebar-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.conv-time { font-size: 0.68rem; color: var(--sidebar-sub); }

.conv-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  min-width: 16px;
  text-align: center;
}

.conv-ai-tag {
  font-size: 0.62rem;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(108, 99, 255, 0.2);
  color: #6c63ff;
}

.conv-escalated-tag {
  font-size: 0.62rem;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  font-weight: 600;
}

/* ── Thread Panel ─────────────────────────────────── */
.inbox-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--thread-bg);
  border-radius: 14px;
  overflow: hidden;
  margin: 4px 4px 4px 6px;
  box-shadow: var(--shadow-card);
}

/* ── Thread Header ────────────────────────────────── */
.thread-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--thread-surface);
  min-height: 60px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

.thread-header-info { flex: 1; }
.thread-placeholder { color: #6b7280; font-size: 0.875rem; margin: 0; }
.thread-contact-name { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.thread-contact-sub { font-size: 0.75rem; color: var(--text-secondary); margin: 2px 0 0; }
/* Contrast fix: ensure sufficient contrast against thread header background */
.thread-header-info .thread-contact-sub { color: var(--text-muted); }

/* ── Messages ─────────────────────────────────────── */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.msg-bubble {
  max-width: 68%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: break-word;
  position: relative;
}

.msg-bubble.inbound {
  background: var(--thread-surface);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-card);
}

.msg-bubble.outbound {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 12px rgba(108,99,255,0.3);
}

.msg-bubble.ai-sent {
  background: linear-gradient(135deg, #eef2ff 0%, #e8f0fe 100%);
  color: var(--text-primary);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(108,99,255,0.15);
  box-shadow: var(--shadow-card);
}

.msg-time { font-size: 0.62rem; margin-top: 4px; display: block; text-align: right; }
/* Contrast fix: ensure timestamp is readable against white/light bubble background */
.msg-bubble.inbound .msg-time { color: rgba(0,0,0,0.55); }
.msg-bubble.outbound .msg-time { color: rgba(255,255,255,0.85); }
/* AI sent bubbles use light background - use darker timestamp */
.msg-bubble.ai-sent .msg-time { color: rgba(0,0,0,0.55); }
.msg-ai-label { font-size: 0.62rem; color: var(--accent); margin-top: 2px; text-align: right; display: block; opacity: 0.8; }

.msg-date-divider {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin: 10px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-date-divider::before,
.msg-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(0,0,0,0.06);
}

/* ── Frosted Input ────────────────────────────────── */
.message-input {
  padding: 12px 16px;
  background: var(--thread-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--thread-surface);
  border-radius: 14px;
  padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-input);
  border: 1px solid rgba(0,0,0,0.05);
  transition: box-shadow 0.2s;
}

.input-row:focus-within {
  box-shadow: 0 4px 20px rgba(108,99,255,0.12), 0 0 0 2px rgba(108,99,255,0.15);
}

.input-row textarea {
  flex: 1;
  padding: 4px 0;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  resize: none;
  outline: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.55;
  font-family: inherit;
  color: var(--text-primary);
}

.input-row textarea::placeholder { color: #6b7280; }

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(108,99,255,0.4);
}

.send-btn:hover { background: #5a52d5; transform: scale(1.06); box-shadow: 0 4px 14px rgba(108,99,255,0.45); }
.send-btn:active { transform: scale(0.95); }

.input-footer { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }

.ai-status-badge {
  font-size: 0.72rem;
  color: #5a52e0;
  background: rgba(108, 99, 255, 0.1);
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* L1 — Human active state */
.ai-status-badge.human-active {
  background: var(--warning-soft, #FEF3C7);
  color: var(--warning, #F59E0B);
}

.takeover-btn {
  font-size: 0.72rem;
  color: #f6a623;
  background: rgba(246,166,35,0.1);
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.ai-suggestions {
  background: linear-gradient(135deg, #f8f7ff 0%, #f0f0ff 100%);
  border-bottom: 1px solid rgba(108, 99, 255, 0.15);
  padding: 10px 12px;
}

.ai-suggestions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #6c63ff;
  font-weight: 600;
  margin-bottom: 8px;
}

.ai-suggestions-close {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}

.ai-suggestions-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-suggestion-chip {
  background: white;
  border: 1px solid rgba(108, 99, 255, 0.25);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: #444;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-suggestion-chip:hover {
  background: #6c63ff;
  color: white;
  border-color: #6c63ff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(108, 99, 255, 0.3);
}
.takeover-btn {
  transition: background 0.15s;
}

.takeover-btn:hover { background: rgba(246,166,35,0.18); }

/* ── Mobile Back Button ───────────────────────────── */
.mobile-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background 0.12s;
}

.mobile-back-btn:hover { background: rgba(0,0,0,0.05); }

/* ── Mobile Responsive ────────────────────────────── */
@media (max-width: 768px) {
  #inbox-view { padding: 0; }

  .inbox-container { border-radius: 0; position: relative; }

  .inbox-sidebar {
    width: 100%;
    position: absolute;
    inset: 0;
    z-index: 2;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .inbox-thread {
    width: 100%;
    position: absolute;
    inset: 0;
    z-index: 1;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
    margin: 0;
  }

  .inbox-container.thread-open .inbox-thread { transform: translateX(0); }
  .mobile-back-btn { display: flex; }
  .msg-bubble { max-width: 82%; }
}

/* Cookie Consent Banner */
.cookie-banner {
  position: fixed;
  bottom: 80px; /* Above mobile nav */
  left: 20px;
  right: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: slideUp 0.3s ease-out;
}

.cookie-content {
  max-width: 800px;
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.cookie-content p {
  font-size: 13px;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.cookie-banner.hidden {
  display: none !important;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 769px) {
  .cookie-banner {
    bottom: 24px;
    left: auto;
    right: 24px;
    width: 400px;
  }
  .cookie-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ── Accessibility Statement Page ─────────────────────────────────────────── */

.content-section {
  margin-bottom: 32px;
}

.content-section ul {
  margin-top: 16px;
}

.content-section p + p {
  margin-top: 16px;
}

.lead {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* ═══════════════════════════════════════════════════
   SETTINGS PAGE — IMPROVED LAYOUT
   ═══════════════════════════════════════════════════ */

/* Settings view must be flex to allow sidebar + scrollable content */
#settings-view.view.active {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  overflow: hidden !important;
  padding: 0 !important;
}

.settings-page-wrapper {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.settings-nav-sidebar {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
  flex-shrink: 0;
  padding: 20px 0;
  border-right: 1px solid var(--border-color);
  background: var(--bg-surface);
  overflow-y: auto;
  position: sticky;
  top: 0;
  align-self: flex-start;
}

.settings-nav-sidebar[aria-label] {
  flex-shrink: 0;
}

.settings-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
}

.settings-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.settings-nav-link.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.settings-nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.settings-nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.settings-nav-label {
  font-size: 13px;
}

.settings-content-area {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  height: 100%;
}

.settings-content-area > .settings-anchor-section {
  max-width: 760px;
}

.settings-anchor-section {
  margin-bottom: 52px;
  padding-top: 4px;
}

.settings-anchor-section:last-child {
  margin-bottom: 0;
  padding-bottom: 40px;
}

.settings-anchor-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.settings-anchor-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.settings-anchor-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.settings-anchor-body {
  display: flex;
  flex-direction: column;
}

/* Standard row: label left, control right */
.settings-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft, var(--border-color));
  min-width: 0;
}

.settings-row:last-child {
  border-bottom: none;
}

/* Stacked row variant: full width, label on top */
.settings-row--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

/* Full-width row: no two-column split */
.settings-row--full {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

/* Highlight row (used in Superadmin Access) */
.settings-row--highlight {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm, 8px);
  padding: 14px 16px;
  border-bottom: none;
  margin-bottom: 12px;
}

.settings-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-row-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.settings-row-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.settings-row-control {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* When row is stacked, control takes full width */
.settings-row--stacked .settings-row-control,
.settings-row--full .settings-row-control {
  flex-shrink: 1;
  width: 100%;
}

.settings-row-control .form-input {
  min-width: 220px;
  max-width: 340px;
  font-size: 14px;
}

.settings-row-danger {
  border-color: rgba(220, 38, 38, 0.2);
}

.settings-row-danger .settings-row-label {
  color: var(--danger);
}

.settings-row-danger .settings-row-desc {
  color: rgba(220, 38, 38, 0.65);
}

.settings-danger-zone {
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 24px;
}

.settings-danger-zone-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  margin-bottom: 12px;
}

.settings-saved-indicator {
  font-size: 12px;
  color: var(--success, #10B981);
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}

.settings-saved-indicator.show {
  opacity: 1;
}

/* Time range inputs (Business Hours / Quiet Hours) */
.settings-time-range {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-time-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-time-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.settings-time-field .form-input {
  min-width: 110px;
  max-width: 130px;
}

.settings-time-sep {
  color: var(--text-muted);
  font-size: 13px;
}

/* Meta channel cards — responsive grid */
.meta-channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  width: 100%;
}

.channel-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  min-width: 0;
}

.channel-info {
  min-width: 0;
  flex: 1;
}

.channel-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-status {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.channel-status.connected {
  color: var(--success, #10B981);
}

/* WhatsApp bot settings sub-section */
#whatsapp-bot-settings {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Mobile tab bar */
.settings-mobile-tabs {
  display: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  flex-shrink: 0;
  padding: 0 12px;
  gap: 4px;
}

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

.settings-mobile-tab {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.settings-mobile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Mobile styles */
@media (max-width: 767px) {
  .settings-mobile-tabs {
    display: flex !important;
  }

  .settings-nav-sidebar {
    display: none !important;
  }

  .settings-content-area {
    padding: 16px;
  }

  .settings-row {
    flex-direction: column;
    gap: 10px;
  }

  .settings-row-control {
    width: 100%;
  }

  .settings-row-control .form-input {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .settings-page-wrapper {
    flex-direction: column;
  }

  .settings-time-range {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-time-field {
    width: 100%;
  }

  .settings-time-field .form-input {
    width: 100%;
    max-width: 100%;
  }

  .settings-time-sep {
    display: none;
  }
}

.settings-mobile-notice-content {
  max-width: 360px;
}

.settings-mobile-notice-content .notice-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 16px;
}

.settings-mobile-notice-content h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.settings-mobile-notice-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

@media (max-width: 767px) {
  .mobile-nav-item[data-view="settings"],
  a[href="#settings"],
  .nav-item[data-route="settings"] {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .settings-nav-sidebar {
    width: 180px;
    min-width: 180px;
  }

  .settings-content-area {
    padding: 20px 16px;
  }
}

/* ── Inbox Human/Bot Toggle Buttons ─────────────────────────────────── */
.release-to-bot-btn,
.activate-human-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.release-to-bot-btn {
  background: #dcf8c6;
  color: #128c7e;
}

.release-to-bot-btn:hover {
  background: #c8e6b5;
}

.activate-human-btn {
  background: #fff3e0;
  color: #f57c00;
}

.activate-human-btn:hover {
  background: #ffe0b2;
}

/* 
 * FINAL RESPONSIVE OVERRIDES
 * Added to ensure 1-column layout on small screens
 */
@media (max-width: 600px) {
  #dashboard .dashboard-stats, 
  #dashboard .stats-grid {
    grid-template-columns: 1fr !important;
  }
  
  .stat-card {
    margin-bottom: 12px;
  }
}
/* 
 * FINAL RESPONSIVE OVERRIDES (RE-APPLIED)
 */
@media (max-width: 600px) {
  #dashboard .dashboard-stats, 
  #dashboard .stats-grid {
    grid-template-columns: 1fr !important;
  }
  
  .stat-card {
    margin-bottom: 12px;
  }
}

/* ============================================
   PART 1: IMPROVED BOTTOM NAVIGATION
   ============================================ */
@media (max-width: 768px) {
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-surface, #FFFFFF);
    border-top: 1px solid var(--border-color, #E2E8F0);
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  }

  .mobile-nav ul {
    display: flex !important;
    width: 100%;
    height: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .mobile-nav ul li {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-nav-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted, #94A3B8);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color 0.15s ease;
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 8px;
  }

  .mobile-nav-item.active {
    color: var(--accent, #6C63FF);
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
    transition: transform 0.15s ease;
  }

  .mobile-nav-item.active svg {
    transform: translateY(-1px);
    stroke-width: 2.2;
  }

  .mobile-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    width: 32px;
    height: 3px;
    background: var(--accent, #6C63FF);
    border-radius: 0 0 4px 4px;
  }

  .mobile-nav-item[data-view="logout"] {
    color: var(--danger, #DC2626);
    opacity: 0.7;
  }

  .nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    background: var(--danger, #DC2626);
    color: white;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-surface, #FFFFFF);
  }

  .mobile-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 16px);
    background: var(--danger, #DC2626);
    color: white;
    font-size: 9px;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    display: none !important;
  }

  .main-content,
  .view-content,
  [data-view-content] {
    padding-bottom: calc(64px + env(safe-area-inset-bottom) + 16px) !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* ============================================
   PART 2: BOOKINGS + CLIENTS COMBINED VIEW
   ============================================ */
@media (max-width: 768px) {
  .view-sub-tabs {
    display: flex;
    background: var(--bg-elevated, #F1F5F9);
    border-radius: var(--radius-md, 10px);
    padding: 4px;
    margin: 12px 16px 0;
    gap: 4px;
  }

  .sub-tab-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: calc(var(--radius-md, 10px) - 2px);
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .sub-tab-btn.active {
    background: var(--bg-surface, #FFFFFF);
    color: var(--accent, #6C63FF);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  }

  #clients-view .client-edit-btn,
  #clients-view .client-delete-btn {
    display: none !important;
  }
  
  /* Mobile Clients View */
  #clients-view {
    display: flex !important;
    flex-direction: column !important;
    height: calc(100vh - 64px - env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: 80px !important;
    overflow-y: auto !important;
  }
  
  #clients-view .view-header {
    padding: 16px !important;
    flex-shrink: 0;
  }
  
  #clients-view #clients-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  #clients-view .clients-table {
    font-size: 14px;
  }
  
  #clients-view .clients-table th,
  #clients-view .clients-table td {
    padding: 12px 8px !important;
  }
}

/* ============================================
   PART 3: INBOX CONVERSATIONS + CHAT
   ============================================ */
@media (max-width: 768px) {
  #inbox-view {
    height: calc(100vh - 64px - env(safe-area-inset-bottom, 0px)) !important;
    margin-top: 0 !important;
  }

  #inbox-view .inbox-container {
    display: block !important;
    height: 100%;
  }

  #inbox-view .inbox-sidebar {
    width: 100% !important;
    border-right: none !important;
    display: block !important;
  }

  #inbox-view .inbox-thread {
    display: none !important;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 64px;
    width: 100% !important;
    background: var(--bg-surface, #FFFFFF);
    z-index: 500;
  }

  #inbox-view .inbox-thread.thread-open {
    display: flex !important;
    flex-direction: column;
  }

  /* Conversations list */
  .conversations-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    overflow-y: auto;
  }

  .conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, #F1F5F9);
    cursor: pointer;
    background: var(--bg-surface, #FFFFFF);
    transition: background 0.1s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .conversation-item:active {
    background: var(--bg-elevated, #F1F5F9);
  }

  .conversation-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent, #6C63FF);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
  }

  .conversation-preview {
    flex: 1;
    min-width: 0;
  }

  .conversation-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary, #0F172A);
  }

  .conversation-last-msg {
    font-size: 12px;
    color: var(--text-muted, #94A3B8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
  }

  .conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
  }

  .conversation-time {
    font-size: 11px;
    color: var(--text-muted, #94A3B8);
  }

  .conversation-unread {
    background: var(--accent, #6C63FF);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
  }

  /* Chat screen */
  .chat-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface, #FFFFFF);
    border-bottom: 1px solid var(--border-color, #F1F5F9);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }

  .chat-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: none;
    color: var(--accent, #6C63FF);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    min-width: 44px;
    min-height: 44px;
  }

  .chat-header-info {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  .chat-contact-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary, #0F172A);
  }

  .chat-contact-phone {
    font-size: 12px;
    color: var(--text-muted, #94A3B8);
  }

  .chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 80px);
  }

  .chat-input-bar {
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    background: var(--bg-surface, #FFFFFF);
    border-top: 1px solid var(--border-color, #F1F5F9);
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
  }

  .chat-message.outbound {
    background: var(--accent, #6C63FF);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
  }

  .chat-message.inbound {
    background: var(--bg-elevated, #F1F5F9);
    color: var(--text-primary, #0F172A);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
  }
}

/* ============================================
   PART 4: MOBILE SPACING AND TYPOGRAPHY
   ============================================ */
@media (max-width: 768px) {
  .view-content {
    padding: 0 0 calc(64px + env(safe-area-inset-bottom, 0px) + 16px);
  }

  .view-header {
    padding: 16px 16px 12px;
    position: sticky;
    top: 0;
    background: var(--bg-base, #F8FAFC);
    z-index: 50;
    border-bottom: 1px solid var(--border-color, #F1F5F9);
  }

  .view-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
  }

  .card {
    border-radius: var(--radius-md, 10px);
    padding: 14px;
    margin: 0 16px 12px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
  }

  .stat-label {
    font-size: 12px;
    color: var(--text-muted, #94A3B8);
    margin-top: 4px;
  }

  .btn,
  button[class*="btn"] {
    min-height: 44px;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: var(--radius-sm, 8px);
  }

  .btn-sm {
    min-height: 36px;
    font-size: 12px;
    padding: 6px 12px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--radius-sm, 8px);
  }

  .booking-item,
  .client-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm, 8px);
    margin: 0 16px 8px;
  }

  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  h3 { font-size: 15px; }
  p, span, div { line-height: 1.5; }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
  }

  .app-container {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .dashboard {
    flex-direction: column;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
  }

  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
    padding: 12px 16px;
    gap: 12px;
  }

  .dashboard-bottom {
    flex-direction: column;
    padding: 0 16px 16px;
  }

  .schedule-card,
  .activity-card {
    max-height: 300px;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .stat-value { font-size: 22px; }
  .card { padding: 12px; margin: 0 12px 10px; }
  .mobile-nav-item span { font-size: 9px; }
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
}

/* Duplicate settings CSS removed */

/* ============================================
   PART 6: DESKTOP/MOBILE VISIBILITY
   ============================================ */
.desktop-only {
  display: inherit;
}

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  
  .mobile-only {
    display: flex !important;
  }
}

/* ============================================
   PART 7: MATERIO-INSPIRED APP SHELL
   ============================================ */

/* ── App Shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
  font-family: var(--font-base);
  font-size: var(--text-base);
  color: var(--text-primary);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition-base);
  overflow-y: auto;
  scrollbar-width: none;
}

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

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
}

.sidebar-logo-text {
  color: white;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
}

/* Nav items */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.3);
  padding: 12px 8px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: white;
}

.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-icon {
  width: var(--sidebar-icon-size);
  height: var(--sidebar-icon-size);
  flex-shrink: 0;
  stroke-width: 1.8;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-chip {
  margin-left: auto;
  background: rgba(124, 58, 237, 0.25);
  color: #C4B5FD;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 10px 0;
}

/* Footer */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-plan {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.sidebar-logout-btn:hover { color: var(--danger); }

/* Sidebar always expanded - no collapsed state */

/* ── Main Wrapper ── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
}

.topbar-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all var(--transition-fast);
}

.topbar-icon-btn:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}

.topbar-notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 13px;
  border: none;
  cursor: pointer;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  padding: var(--space-6);
  width: calc(100% - 260px);
  max-width: calc(100% - 260px);
  box-sizing: border-box;
}

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.kpi-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-fast);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.kpi-icon--accent   { background: var(--accent-light); color: var(--accent); }
.kpi-icon--success  { background: var(--success-light); color: var(--success); }
.kpi-icon--warning  { background: var(--warning-light); color: var(--warning); }
.kpi-icon--danger   { background: var(--danger-light);  color: var(--danger); }
.kpi-icon--info     { background: var(--info-light);    color: var(--info); }

.kpi-body { flex: 1; }

.kpi-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: 700;
}

.kpi-trend svg { width: 13px; height: 13px; }

.kpi-trend--up   { color: var(--success); }
.kpi-trend--down { color: var(--danger); }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body { padding: var(--space-6); }

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-color);
  background: var(--bg-elevated);
}

/* ── Data Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table th {
  text-align: left;
  padding: 10px var(--space-4);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background var(--transition-fast);
}

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

/* ── Status Chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.3px;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip--confirmed  { background: var(--success-light); color: var(--success); }
.chip--pending    { background: var(--warning-light); color: var(--warning); }
.chip--cancelled  { background: var(--danger-light);  color: var(--danger); }
.chip--ai         { background: var(--accent-light);  color: var(--accent); }
.chip--human      { background: var(--info-light);    color: var(--info); }
.chip--free       { background: var(--bg-elevated);   color: var(--text-muted); }
.chip--pro        { background: #FFF3E0; color: var(--warning); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  min-height: 36px;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.28);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.38);
  transform: translateY(-1px);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-xs);
  min-height: 30px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--text-base);
  min-height: 44px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
}

.btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  flex-shrink: 0;
}

/* ── Form Elements ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: var(--font-base);
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  min-height: 38px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.form-helper {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  font-weight: 500;
}

/* ── Mobile Nav ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  z-index: 9999;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
  align-items: center;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  min-height: 44px;
  position: relative;
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item.active { color: var(--accent); }

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.mobile-nav-item--fab { flex: 1; }

.mobile-nav-fab {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
  margin-bottom: 6px;
}

.mobile-nav-fab svg {
  color: white;
  width: 22px;
  height: 22px;
  stroke-width: 2.5;
}

/* ── Sidebar Overlay ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 199;
  display: none;
}

.sidebar-overlay.active { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .topbar-menu-btn {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-4);
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .mobile-nav {
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (min-width: 769px) {
  .mobile-nav { display: none; }
}

/* ── View Header ── */
.view-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.view-heading {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.view-subheading {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 4px 0 0;
}

.view-actions {
  display: flex;
  gap: var(--space-3);
}

/* ── Analytics Grid ── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

@media (max-width: 768px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Loyalty Tiers ── */
.loyalty-tiers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.loyalty-tier-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.loyalty-tier-card:hover {
  border-color: var(--accent);
}

.loyalty-tier-card--active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.loyalty-tier-icon {
  font-size: 32px;
  margin-bottom: var(--space-2);
}

.loyalty-tier-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.loyalty-tier-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: var(--space-2) 0;
}

.loyalty-tier-rule {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .loyalty-tiers-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   INBOX MOBILE UI FIXES (12 Improvements)
   ============================================= */

/* FIX 9: Typography System */
:root {
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 800;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
}

/* FIX 3: Conversation List */
.conversations-list {
  background: var(--bg-surface);
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color, #F1F5F9);
  cursor: pointer;
  background: var(--bg-surface);
  transition: background var(--transition-fast, 0.15s ease);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.conv-item:active {
  background: var(--bg-elevated);
  transform: scale(0.99);
  transition: transform 0.1s ease, background 0.1s ease;
}

.conv-item--unread {
  background: rgba(124, 58, 237, 0.02);
}

.conv-item--unread .conv-name {
  font-weight: 700;
}

/* Avatar */
.conv-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--avatar-color, var(--accent));
  color: white;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.5px;
  line-height: 1;
  text-align: center;
  overflow: hidden;
}

/* Content */
.conv-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conv-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conv-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Name — primary, dominant */
.conv-name {
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Preview — secondary, muted */
.conv-preview {
  font-size: 12px;
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Time — tertiary, right-aligned */
.conv-time {
  font-size: 11px;
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-tight);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Meta: badge + unread */
.conv-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* AI badge */
.conv-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.conv-badge--ai {
  background: var(--accent-light, #EDE9FE);
  color: var(--accent, #7C3AED);
}

.conv-badge--human {
  background: var(--info-light, #E0F9FC);
  color: var(--info, #00CFE8);
}

/* Unread count */
.conv-unread {
  min-width: 18px;
  height: 18px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* FIX 4: Reduce Purple — Accent not background */
.sidebar-item.active {
  background: rgba(124, 58, 237, 0.08);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.mobile-nav-item.active {
  color: var(--accent);
}

.mobile-nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}

/* Cards — remove heavy shadow */
.card,
.conv-item,
.booking-item,
.client-item {
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* FIX 5: Row Menu */
.row-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  opacity: 0;
}

.conv-item:hover .row-action-btn,
.conv-item:focus-within .row-action-btn {
  opacity: 1;
}

@media (max-width: 768px) {
  .row-action-btn {
    opacity: 1;
  }
}

.row-menu {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  min-width: 160px;
  padding: 4px;
  animation: menuIn 0.1s ease;
}

@keyframes menuIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.row-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  text-align: left;
}

.row-menu-item:hover {
  background: var(--bg-elevated);
}

.row-menu-item svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

/* FIX 6: Filter Bar */
.inbox-filter-bar {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
}

.inbox-filter-bar::-webkit-scrollbar {
  display: none;
}

.inbox-filter {
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1.5px solid var(--border-color);
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.inbox-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.inbox-filter:not(.active):hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* FIX 7: Loading Skeletons */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-color) 50%, var(--bg-elevated) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton--avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton--name {
  height: 14px;
  width: 120px;
  border-radius: 4px;
}

.skeleton--time {
  height: 11px;
  width: 36px;
  border-radius: 4px;
}

.skeleton--preview {
  height: 12px;
  width: 80%;
  border-radius: 4px;
  margin-top: 4px;
}

.conv-skeleton {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

/* FIX 8: Micro-interactions */
.conv-item,
.booking-item,
.client-item {
  transition: background var(--transition-fast), transform 0.1s ease;
}

.conv-item:active,
.booking-item:active,
.client-item:active {
  transform: scale(0.99);
  background: var(--bg-elevated);
}

#inbox-chat-screen {
  animation: slideInRight 0.22s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

#inbox-conversations-screen {
  animation: slideInLeft 0.22s ease;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.btn:active {
  transform: scale(0.97);
}

/* FIX 10: Breathing Room + Spacing */
@media (max-width: 768px) {
  .view-content > * + * {
    margin-top: var(--space-4, 16px);
  }

  .inbox-section-header {
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
  }

  .conv-item {
    padding: 14px 16px;
    min-height: 72px;
  }

  .card,
  .kpi-card {
    padding: 16px;
  }

  .kpi-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
  }
}

/* FIX 11: Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  background: var(--bg-elevated);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-state-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

.empty-state-text {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 200px;
  line-height: 1.5;
}

/* FIX 12: Bottom Nav Polish */
@media (max-width: 768px) {
  .mobile-nav-item span {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.1px;
    margin-top: 1px;
  }

  .mobile-nav-item svg {
    width: 21px;
    height: 21px;
    stroke-width: 1.75;
  }

  .mobile-nav-item {
    position: relative;
  }

  .mobile-nav-item.active {
    color: var(--accent);
  }

  .mobile-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
  }
}

/* Backward compatibility: map conversation-item to conv-item */
.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color, #F1F5F9);
  cursor: pointer;
  background: var(--bg-surface);
  transition: background var(--transition-fast, 0.15s ease);
}

.conversation-item.active {
  background: rgba(124, 58, 237, 0.08);
}

/* =============================================
   SCREENSHOT BUG FIXES
   ============================================= */

/* FIX 6: Desktop Inbox Chat Panel - Dark Theme */
#inbox-chat-screen,
.inbox-thread,
.chat-panel,
.conversation-detail {
  background: var(--bg-surface, #1E293B) !important;
  color: var(--text-primary, #F8FAFC) !important;
}

.chat-messages-list .msg-bubble,
.msg-bubble {
  background: var(--bg-elevated, #334155) !important;
  color: var(--text-primary, #F8FAFC) !important;
}

.msg-bubble.outbound,
.msg-bubble.ai-sent {
  background: var(--accent, #7C3AED) !important;
  color: white !important;
}

.chat-input-bar,
.chat-input,
#reply-content {
  background: var(--bg-surface, #1E293B) !important;
  color: var(--text-primary, #F8FAFC) !important;
  border-color: var(--border-color, #475569) !important;
}

/* FIX 7: Dashboard KPI Grid - 2x2 on Mobile */
@media (max-width: 768px) {
  .kpi-grid,
  .stats-grid,
  .dashboard-stats,
  .kpi-cards,
  .stats-cards {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    padding: 12px 16px !important;
  }

  .kpi-card,
  .stat-card,
  .kpi-card .card {
    padding: 14px !important;
    min-height: 100px;
  }

  .kpi-value,
  .stat-value {
    font-size: 24px !important;
    font-weight: 800 !important;
  }

  .kpi-label,
  .stat-label {
    font-size: 11px !important;
    color: var(--text-muted) !important;
  }
}

/* FIX 8: Filter Tabs Overflow */
.inbox-filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.inbox-filter-bar::-webkit-scrollbar {
  display: none;
}

.inbox-filter {
  flex-shrink: 0;
  padding: 6px 14px;
  white-space: nowrap;
}

/* FIX 10: Loyalty Tier Cards - Silver Contrast */
.loyalty-tier-card,
.loyalty-tier-card:nth-child(2) {
  background: var(--bg-elevated, #334155);
  border: 2px solid var(--border-color, #475569);
}

.loyalty-tier-card:nth-child(2) .tier-name,
.loyalty-tier-card--silver .tier-name {
  color: var(--text-primary, #F8FAFC) !important;
  font-weight: 700 !important;
}

.loyalty-tier-card:nth-child(2) .tier-count,
.loyalty-tier-card--silver .tier-count {
  color: var(--text-secondary, #94A3B8) !important;
}

.loyalty-tier-card--active {
  border: 2px solid var(--accent, #7C3AED);
  background: rgba(124, 58, 237, 0.1);
}

.loyalty-tier {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.loyalty-tier--bronze {
  background: linear-gradient(135deg, #92400E 0%, #B45309 100%);
  color: white;
}

.loyalty-tier--silver {
  background: linear-gradient(135deg, #64748B 0%, #94A3B8 100%);
  color: white;
}

.loyalty-tier--gold {
  background: linear-gradient(135deg, #B45309 0%, #FCD34D 100%);
  color: #78350F;
}

/* FIX 11: Bookings/Clients Tab Switcher - only hide on mobile */
@media (max-width: 768px) {
  .subtab-content {
    display: none;
  }

  .subtab-content:not([style*="display: none"]) {
    display: block;
  }
}

/* On desktop, always show bookings subtab, hide clients subtab */
@media (min-width: 769px) {
  #subtab-bookings.subtab-content {
    display: block !important;
  }
  
  #subtab-clients.subtab-content {
    display: none !important;
  }
}

.subtab-bar {
  display: flex;
  background: var(--bg-elevated, #334155);
  border-radius: var(--radius-md, 8px);
  padding: 4px;
  margin: 12px 16px;
  gap: 4px;
}

.subtab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: calc(var(--radius-md, 8px) - 2px);
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #94A3B8);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
}

.subtab.active {
  background: var(--bg-surface, #1E293B);
  color: var(--accent, #7C3AED);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.subtab svg {
  width: 14px;
  height: 14px;
}

/* Phone Entry Form Redesign */
.phone-entry-view .booking-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.phone-entry-view .form-group {
  margin-bottom: 0;
}

.phone-entry-view .btn-full {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 15px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .phone-entry-view .page-header {
    padding: 16px;
  }
  
  .phone-entry-view .form-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .phone-entry-view .form-row > * {
    width: 100% !important;
  }
}

/* =============================================
   FULL-SCREEN LAYOUT FIXES
   ============================================= */

/* Step 1: Full-screen body + html */
html, body {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Step 2: Dashboard container fills viewport */
#dashboard,
.dashboard {
  display: flex !important;
  width: 100vw !important;
  height: 100vh !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Step 3: App layout = full-width flex row */
.app-layout {
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

/* Step 4: Sidebar — desktop fixed width, mobile hidden */
.sidebar {
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
  flex-shrink: 0 !important;
  height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: none !important;
  flex-direction: column !important;
  z-index: 100 !important;
}

/* Show sidebar only when dashboard is visible */
#dashboard[style*="display: flex"] .sidebar,
#dashboard[style*="display: block"] .sidebar,
#dashboard.dashboard-visible .sidebar {
  display: flex !important;
}

/* Step 5: Main content — fills all remaining space */
.main-content {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
}

/* Step 6: Views fill main content */
.view {
  flex: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
}

.view:not(.active) {
  display: none !important;
}

.view.active {
  display: flex !important;
  flex-direction: column !important;
}

/* Step 7: Bottom mobile nav — fixed, full width */
.mobile-nav {
  display: none !important;
}

@media (max-width: 768px) {
  .sidebar {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
  }

  .main-content {
    width: 100% !important;
    max-width: 100vw !important;
    padding-bottom: 64px !important;
  }

  .mobile-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 60px !important;
    z-index: 1000 !important;
  }

  .mobile-nav ul {
    display: flex !important;
    width: 100% !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .mobile-nav li {
    flex: 1 !important;
  }

  .mobile-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    gap: 2px;
    text-decoration: none;
    font-size: 10px;
    color: var(--text-secondary);
    position: relative;
  }

  .mobile-nav-item.active {
    color: var(--accent);
  }
}

/* Step 8: Inbox view — two-panel layout */
.inbox-container {
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  flex: 1 !important;
}

.inbox-sidebar {
  width: 360px !important;
  min-width: 300px !important;
  max-width: 400px !important;
  flex-shrink: 0 !important;
  height: 100% !important;
  overflow-y: auto !important;
  border-right: 1px solid var(--border-color, #E2E8F0) !important;
}

.inbox-thread {
  flex: 1 !important;
  min-width: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

@media (max-width: 768px) {
  .inbox-container {
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .inbox-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    border-right: none !important;
  }

  .inbox-thread {
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 60px !important;
    z-index: 200 !important;
    background: var(--bg-surface) !important;
  }

  .inbox-thread.is-open {
    display: flex !important;
  }
}

/* Step 10: View header — sticky at top */
.view-header,
.view-header-bar,
.dashboard-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  background: var(--bg-surface) !important;
}

/* Autocomplete dropdown for phone entry */
.autocomplete-dropdown {
  position: absolute;
  z-index: 100;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}

.autocomplete-dropdown:not([hidden]) {
  display: block;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft, #f1f5f9);
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--bg-elevated, #f8fafc);
}

.autocomplete-item-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
}

.autocomplete-item-phone {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}

.autocomplete-no-results {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
  font-style: italic;
}
