/* ==========================================================================
   Shuffle Flow — Live Admin Command Center
   PRD-03 Color System:
   Primary: #355C7D | Secondary: #6C5B7B | Accent: #F8B195
   Background: #F7F5FA | Card: #FFFFFF | Primary Text: #27233A
   Secondary Text: #777286 | Success: #16865C | Error: #D93636
   Fully Mobile-Responsive Executive UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shuffle Flow Theme Tokens */
  --primary: #355C7D;
  --primary-hover: #294762;
  --primary-glow: rgba(53, 92, 125, 0.25);
  --primary-light: rgba(53, 92, 125, 0.08);

  --secondary: #6C5B7B;
  --secondary-hover: #564862;
  --secondary-glow: rgba(108, 91, 123, 0.22);
  --secondary-light: rgba(108, 91, 123, 0.1);

  --accent: #F8B195;
  --accent-hover: #f59e7e;
  --accent-glow: rgba(248, 177, 149, 0.3);
  --accent-light: rgba(248, 177, 149, 0.15);

  --bg-main: #F7F5FA;
  --bg-gradient: radial-gradient(circle at 10% 10%, rgba(248, 177, 149, 0.08) 0%, transparent 40%),
                 radial-gradient(circle at 90% 15%, rgba(108, 91, 123, 0.08) 0%, transparent 45%),
                 radial-gradient(circle at 50% 90%, rgba(53, 92, 125, 0.06) 0%, transparent 50%),
                 #F7F5FA;

  --card-bg: #FFFFFF;
  --card-border: rgba(53, 92, 125, 0.1);
  --card-hover-border: rgba(53, 92, 125, 0.25);

  --text-main: #27233A;
  --text-muted: #777286;
  --text-dim: #9894A6;

  --success: #16865C;
  --success-glow: rgba(22, 134, 92, 0.25);
  --success-light: rgba(22, 134, 92, 0.1);

  --danger: #D93636;
  --danger-glow: rgba(217, 54, 54, 0.25);
  --danger-light: rgba(217, 54, 54, 0.1);

  --warning: #E67E22;
  --warning-light: rgba(230, 126, 34, 0.12);

  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --shadow-card: 0 4px 20px -2px rgba(39, 35, 58, 0.06), 0 2px 6px -1px rgba(39, 35, 58, 0.04);
  --shadow-card-hover: 0 12px 28px -4px rgba(39, 35, 58, 0.12), 0 4px 10px -2px rgba(39, 35, 58, 0.06);
  --shadow-elevated: 0 16px 36px -6px rgba(39, 35, 58, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 120px;
}

/* Header Navigation */
header {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(39, 35, 58, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(53, 92, 125, 0.2);
  object-fit: cover;
  transition: transform 0.25s ease;
}

.brand img:hover {
  transform: rotate(5deg) scale(1.04);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

.brand-text p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.badge-pro {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(53, 92, 125, 0.25);
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Status Badges */
.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.status-badge.connected {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(22, 134, 92, 0.25);
}

.status-badge.disconnected {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(217, 54, 54, 0.25);
}

.user-profile-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  background: var(--bg-main);
  border-radius: 30px;
  border: 1px solid var(--card-border);
}

.avatar-chip {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(53, 92, 125, 0.2);
  flex-shrink: 0;
}

.user-email-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

/* Container */
.container {
  max-width: 1240px;
  margin: 28px auto;
  padding: 0 20px;
}

/* Alert Notification */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease forwards;
  word-break: break-word;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-info {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(53, 92, 125, 0.2);
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(22, 134, 92, 0.25);
}

.alert-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(217, 54, 54, 0.25);
}

.alert-warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(230, 126, 34, 0.25);
}

/* Auth Section */
.auth-box {
  max-width: 440px;
  margin: 50px auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  box-shadow: var(--shadow-elevated);
  text-align: center;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.auth-logo-badge {
  width: 74px;
  height: 74px;
  margin: 0 auto 20px;
  border-radius: 20px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 24px rgba(53, 92, 125, 0.15);
}

.auth-logo-badge img {
  border-radius: 16px;
}

.auth-box h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.auth-box p {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 26px;
}

/* Hero Stats Grid */
.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-widget {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: all 0.25s ease;
}

.stat-widget:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--card-hover-border);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.primary {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-icon.secondary {
  background: var(--secondary-light);
  color: var(--secondary);
}

.stat-icon.accent {
  background: var(--accent-light);
  color: #d86844;
}

.stat-icon.green {
  background: var(--success-light);
  color: var(--success);
}

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

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 22px;
}

.col-6 {
  grid-column: span 6;
}

.col-12 {
  grid-column: span 12;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease;
}

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

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

.card-title {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

/* Switch Items */
.switch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(53, 92, 125, 0.06);
  gap: 12px;
}

.switch-item:last-of-type {
  border-bottom: none;
}

.switch-label-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.switch-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

.switch-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Switch Toggle Styling */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 27px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #D6D2E0;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 21px;
  width: 21px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

input:checked + .slider.secondary-slider {
  background-color: var(--secondary);
  box-shadow: 0 0 12px var(--secondary-glow);
}

input:checked + .slider.accent-slider {
  background-color: #d86844;
  box-shadow: 0 0 12px var(--accent-glow);
}

input:checked + .slider.danger-slider {
  background-color: var(--danger);
  box-shadow: 0 0 12px var(--danger-glow);
}

input:checked + .slider:before {
  transform: translateX(21px);
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 7px;
  flex-wrap: wrap;
  gap: 4px;
}

.label-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(53, 92, 125, 0.15);
  white-space: nowrap;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: #FCFBFE;
  border: 1.5px solid #E2DFEC;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13.5px;
  transition: all 0.2s ease;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-with-copy {
  display: flex;
  position: relative;
}

.input-with-copy .form-control {
  padding-right: 76px;
}

.copy-btn {
  position: absolute;
  right: 5px;
  top: 5px;
  bottom: 5px;
  background: #FFFFFF;
  border: 1px solid #E2DFEC;
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 0 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
  word-break: break-word;
}

.hint code {
  background: #ECE9F4;
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
}

/* Password input wrapper */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.password-toggle-btn:hover {
  color: var(--primary);
}

/* Grids for Cards 3 and 4 */
.action-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.app-ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.app-ads-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.footer-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #2a4964 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #20384d 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-secondary-outline {
  background: #FFFFFF;
  border: 1px solid #D6D2E0;
  color: var(--secondary);
}

.btn-secondary-outline:hover {
  background: var(--secondary-light);
  border-color: var(--secondary);
}

.btn-outline {
  background: #FFFFFF;
  border: 1px solid #D6D2E0;
  color: var(--text-main);
}

.btn-outline:hover {
  background: #F3F1F8;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger-outline {
  background: #FFFFFF;
  border: 1px solid rgba(217, 54, 54, 0.25);
  color: var(--danger);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Badges */
.badge-pill-green {
  background: var(--success-light);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(22, 134, 92, 0.25);
  white-space: nowrap;
}

.badge-pill-amber {
  background: var(--warning-light);
  color: var(--warning);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(230, 126, 34, 0.25);
  white-space: nowrap;
}

/* Sticky Footer */
.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--card-border);
  padding: 12px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 99;
  box-shadow: 0 -4px 20px rgba(39, 35, 58, 0.08);
}

.save-status-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.save-status-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.save-status-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Auto-save compact toggle */
.auto-save-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: #F3F1F8;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #D6D2E0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  user-select: none;
}

.auto-save-toggle input {
  display: none;
}

.toggle-slider-compact {
  width: 28px;
  height: 16px;
  background: #D6D2E0;
  border-radius: 12px;
  position: relative;
  transition: 0.2s ease;
  flex-shrink: 0;
}

.toggle-slider-compact:before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: #FFFFFF;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: 0.2s ease;
}

.auto-save-toggle input:checked + .toggle-slider-compact {
  background: var(--success);
}

.auto-save-toggle input:checked + .toggle-slider-compact:before {
  transform: translateX(12px);
}

/* Animations */
.spin-animation {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (Mobile, Tablet, Desktop)
   ========================================================================== */

/* Tablet (Max 992px) */
@media (max-width: 992px) {
  .col-6 {
    grid-column: span 12;
  }

  .hero-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  header {
    padding: 12px 20px;
  }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (Mobile, Tablet, Desktop)
   ========================================================================== */

/* Tablet & Smaller Screens (Max 992px) */
@media (max-width: 992px) {
  .col-6 {
    grid-column: span 12;
  }

  .hero-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  header {
    padding: 12px 20px;
  }
}

/* Mobile Devices (Max 768px) */
@media (max-width: 768px) {
  body {
    /* Generous safe margin for fixed bottom action bar + safe area on modern phones */
    padding-bottom: calc(170px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
  }

  /* Header scrolls naturally on mobile so it doesn't consume screen real estate */
  header {
    position: relative;
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .brand {
    justify-content: space-between;
    width: 100%;
  }

  .brand img {
    width: 38px;
    height: 38px;
  }

  .brand-text h1 {
    font-size: 17.5px;
  }

  .brand-text p {
    font-size: 11.5px;
  }

  .header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    gap: 8px;
  }

  .user-profile-bar {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px 3px 4px;
    max-width: 100%;
    gap: 6px;
  }

  .user-email-text {
    max-width: 125px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11.5px;
  }

  .avatar-chip {
    width: 26px;
    height: 26px;
    font-size: 10.5px;
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: 11.5px;
    min-height: 32px;
  }

  .container {
    padding: 0 14px;
    margin: 14px auto;
  }

  /* Hero stats: 2 columns on mobile */
  .hero-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }

  .stat-widget {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 12px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .stat-icon svg {
    width: 18px;
    height: 18px;
  }

  .stat-label {
    font-size: 10.5px;
  }

  .stat-value {
    font-size: 14px;
  }

  /* Cards */
  .card {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .card-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
  }

  .card-title {
    font-size: 15px;
  }

  /* Switch items on mobile */
  .switch-item {
    padding: 11px 0;
    gap: 12px;
  }

  .switch-label {
    font-size: 13.5px;
  }

  .switch-desc {
    font-size: 11.5px;
    line-height: 1.4;
  }

  .switch {
    width: 46px;
    height: 26px;
    flex-shrink: 0;
  }

  .slider:before {
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
  }

  input:checked + .slider:before {
    transform: translateX(20px);
  }

  /* Form inputs (16px to prevent iOS auto-zoom) */
  .form-control, input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea {
    padding: 10px 12px;
    font-size: 16px; /* Prevents auto-zoom on iOS Safari */
    border-radius: 8px;
  }

  .input-with-copy .form-control {
    padding-right: 72px;
  }

  .copy-btn {
    font-size: 11.5px;
    padding: 0 9px;
    height: 32px;
    top: 5px;
    right: 5px;
  }

  /* Grids in cards */
  .action-rules-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .app-ads-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .app-ads-actions {
    flex-direction: column;
    gap: 8px;
  }

  .app-ads-actions .btn {
    width: 100%;
    min-height: 38px;
  }

  /* Auth box (Login) on mobile */
  .auth-box {
    margin: 24px auto;
    padding: 28px 18px;
    border-radius: 16px;
    max-width: 100%;
  }

  .auth-logo-badge {
    width: 62px;
    height: 62px;
    margin-bottom: 14px;
  }

  .auth-logo-badge img {
    width: 42px;
    height: 42px;
  }

  .auth-box h2 {
    font-size: 21px;
  }

  .auth-box p {
    font-size: 12.5px;
    margin-bottom: 20px;
  }

  /* Sticky Bottom Footer on mobile */
  .sticky-footer {
    padding: 10px 14px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .save-status-info {
    justify-content: space-between;
    width: 100%;
  }

  .save-status-title {
    font-size: 12.5px;
  }

  .save-status-subtitle {
    font-size: 11px;
  }

  .footer-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .footer-actions #saveBtn {
    flex: 1;
    padding: 10px 14px;
    font-size: 13.5px;
    min-height: 40px;
  }

  .footer-actions #discardBtn {
    padding: 10px 12px;
    font-size: 13px;
    min-height: 40px;
  }

  .auto-save-toggle {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 36px;
  }
}

/* Small Mobile Phones (Max 480px) */
@media (max-width: 480px) {
  .container {
    padding: 0 10px;
    margin: 10px auto;
  }

  .brand-text h1 {
    font-size: 16px;
  }

  .badge-pro {
    font-size: 9.5px;
    padding: 2px 6px;
  }

  .header-actions {
    gap: 6px;
  }

  .status-badge {
    padding: 5px 8px;
    font-size: 10.5px;
  }

  .user-email-text {
    max-width: 90px;
    font-size: 10.5px;
  }

  .hero-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-widget {
    padding: 10px;
    gap: 8px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
  }

  .stat-value {
    font-size: 13px;
  }

  .card {
    padding: 15px 12px;
  }

  .footer-actions {
    gap: 6px;
  }

  .footer-actions #saveBtn {
    font-size: 12.5px;
    padding: 9px 10px;
  }

  .footer-actions #discardBtn {
    font-size: 12.5px;
    padding: 9px 10px;
  }

  .auto-save-toggle {
    padding: 5px 8px;
    font-size: 10.5px;
  }

  .toggle-slider-compact {
    width: 24px;
    height: 14px;
  }

  .toggle-slider-compact:before {
    width: 10px;
    height: 10px;
  }

  .auto-save-toggle input:checked + .toggle-slider-compact:before {
    transform: translateX(10px);
  }
}

/* Mobile Touch & Haptic Feedback Enhancements */
@media (hover: none) and (pointer: coarse) {
  .btn:active, .copy-btn:active, .password-toggle-btn:active {
    transform: scale(0.96);
    transition: transform 0.08s ease;
  }

  .switch {
    -webkit-tap-highlight-color: transparent;
  }
}
