/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface2: #f1f3f5;
  --border: #e9ecef;
  --accent: #007bff;
  --accent2: #0056b3;
  --green: #198754;
  --yellow: #ffc107;
  --red: #dc3545;
  --text: #212529;
  --muted: #6c757d;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Layout ── */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 24px 16px; flex-shrink: 0; }
.main { flex: 1; overflow-y: auto; padding: 28px 32px; }

/* ── Sidebar ── */
.logo { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 32px; display: flex; align-items: center; gap: 10px; }
.logo span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted); transition: all .2s; margin-bottom: 4px; }
.nav-item:hover, .nav-item.active { background: var(--surface2); color: var(--text); }
.nav-item.active { color: var(--accent); }
.nav-icon { transition: color 0.2s; }

/* ── Header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 700; }
.secret-input { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 8px; font-size: 13px; width: 200px; outline: none; }
.secret-input:focus { border-color: var(--accent); }
.btn { padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .2s; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2); }
.btn-success { background: linear-gradient(135deg, #22c55e, #10b981); color: #fff; border: none; }
.btn-success:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e9ecef; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); }
.btn-outline-danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn-outline-danger:hover { background: rgba(220, 53, 69, 0.05); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15); }
.btn-ghost-danger { background: transparent; border: none; color: var(--muted); }
.btn-ghost-danger:hover { background: rgba(220, 53, 69, 0.1); color: var(--red); transform: translateY(-1px); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-value.green { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.blue { color: var(--accent); }
.stat-value.purple { color: var(--accent2); }

/* ── Table ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 28px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; }
.filter-row { display: flex; gap: 8px; }
.filter-btn { padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; transition: all .2s; }
.filter-btn:hover, .filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: var(--surface2); }
td { padding: 13px 16px; font-size: 13px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--surface2); cursor: pointer; }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-new            { background: #cce5ff; color: #004085; } /* Blue */
.badge-unqualified    { background: #e2e3e5; color: #383d41; } /* Gray */
.badge-qualified      { background: #d4edda; color: #155724; } /* Green */
.badge-interested     { background: #fff3cd; color: #856404; } /* Orange */
.badge-not-interested { background: #f8d7da; color: #721c24; } /* Red */
.badge-unmatched-request { background: #d6d8d9; color: #1b1e21; } /* Dark Gray */
.badge-hot            { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.7; } }

/* ── Chat Panel (Modal) ── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; align-items: center; justify-content: center; }
.overlay.open { display: flex; }
.chat-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 600px; max-height: 85vh; display: flex; flex-direction: column; }
.chat-panel-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.chat-panel-name { font-size: 16px; font-weight: 700; }
.chat-panel-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.close-btn { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.close-btn:hover { color: var(--text); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.msg.user { background: var(--surface2); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.assistant { background: linear-gradient(135deg, #e9ecef, #dee2e6); border-bottom-left-radius: 4px; align-self: flex-start; color: var(--text); }
.msg-time { font-size: 10px; color: var(--muted); margin-top: 4px; }
/* RTL auto-detect for Arabic content */
.msg[dir="rtl"] { text-align: right; }
.msg[dir="rtl"].user { align-self: flex-start; border-bottom-left-radius: 4px; border-bottom-right-radius: 12px; }
.msg[dir="rtl"].assistant { align-self: flex-end; border-bottom-right-radius: 4px; border-bottom-left-radius: 12px; }
.desc-box { padding: 14px 22px; background: var(--surface2); border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.6; }
.desc-box strong { color: var(--text); }

/* ── Sections ── */
.section { display: none; }
.section.active { display: block; }

/* ── Loading ── */
.loading { text-align: center; padding: 40px; color: var(--muted); }
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Playground ── */
.playground { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; height: 520px; }
.chat-box-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-input-row { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input { flex: 1; background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: 8px; font-size: 13px; outline: none; direction: auto; }
.chat-input:focus { border-color: var(--accent); }
.info-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.info-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; margin-top: 16px; }
.info-label:first-child { margin-top: 0; }
.info-value { font-size: 13px; color: var(--text); line-height: 1.6; }
.buttons-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.quick-btn { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-size: 12px; cursor: pointer; transition: all .2s; }
.quick-btn:hover { background: var(--accent); color: #fff; }

/* ── Rate Limit Panel ── */
.rl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rl-field label { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing:.05em; margin-bottom: 5px; }
.rl-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 9px 12px; border-radius: 8px; font-size: 13px; outline: none; }
.rl-input:focus { border-color: var(--accent); }
.cost-bar-wrap { background: var(--surface2); border-radius: 6px; height: 8px; margin-top: 6px; overflow: hidden; }
.cost-bar { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--green), var(--accent)); transition: width .6s; }
.cost-bar.warn { background: linear-gradient(90deg, var(--yellow), var(--red)); }

/* ── Tenant Config Modal ── */
.tc-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200; align-items: center; justify-content: center; }
.tc-overlay.open { display: flex; }
.tc-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 760px; max-height: 90vh; display: flex; flex-direction: column; }
.tc-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.tc-body { flex: 1; overflow-y: auto; padding: 24px; }
.accordion-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.accordion-header { display: none; }
.accordion-content { display: block; padding: 0; }
.accordion-item.active { border-color: transparent; }
.accordion-icon { display: none; }
textarea.tc-textarea { width: 100%; background: #f8fafc; border: 1px solid var(--border); color: var(--text); padding: 16px; border-radius: 12px; font-size: 13px; font-family: 'Consolas', 'Monaco', monospace; resize: none; min-height: 120px; outline: none; line-height: 1.6; transition: all 0.2s ease; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); field-sizing: content; overflow: hidden; }
textarea.tc-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15); background: #ffffff; }
.tc-hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; background: rgba(0,123,255,0.05); padding: 10px 14px; border-radius: 8px; border-left: 3px solid var(--accent); }
.tc-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.tc-msg { font-size: 13px; }

/* ── Config Cards & Layout ── */
.config-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); margin-bottom: 24px; animation: slideUp 0.4s ease-out forwards; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.config-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.config-title { font-size: 18px; font-weight: 700; color: var(--text); }
.config-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }
.glass-block { background: rgba(248, 249, 250, 0.6); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: 12px; padding: 16px; font-size: 12px; color: var(--text); line-height: 1.6; margin-bottom: 20px; }

/* ── Toast Notifications ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 9999; }
.toast { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; color: var(--text); transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.toast.show { transform: translateX(0); }
.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon { color: var(--red); }
.toast.info .toast-icon { color: var(--accent); }
.badge-custom { background: #cce5ff; color: #004085; font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 600; margin-left: 6px; }
.badge-default { background: var(--surface2); color: var(--muted); font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 600; margin-left: 6px; }
.product-cat { margin-bottom: 18px; }
.product-cat-title { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.product-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; font-size: 12px; line-height: 1.6; }
.product-item strong { color: var(--text); font-size: 13px; }
.drop-zone { border: 2px dashed var(--border); border-radius: 16px; padding: 40px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); margin-bottom: 16px; background: var(--surface); position: relative; overflow: hidden; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); color: var(--accent); background: rgba(0, 123, 255, 0.04); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 123, 255, 0.08); }
.drop-zone:active { transform: translateY(0); }
.drop-zone .icon { display: inline-block; font-size: 36px; margin-bottom: 12px; transition: transform 0.3s; }
.drop-zone:hover .icon, .drop-zone.drag-over .icon { transform: scale(1.1) translateY(-4px); }

/* ── SweetAlert2 Customization ── */
div.swal2-container {
  z-index: 99999 !important;
}
div.swal2-popup {
  width: 420px !important;
  max-width: 90% !important;
  padding: 1.5em 1em 1.25em !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 30px rgba(0,0,0,0.15) !important;
  border: 1px solid var(--border) !important;
}
div.swal2-icon {
  width: 3.5em !important;
  height: 3.5em !important;
  margin: 0 auto 1em !important;
  border: none !important;
}

/* ── Minimalist SVG Overrides for SweetAlert2 Icons ── */
div.swal2-icon.swal2-success {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23198754' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='8 12 11 15 16 10'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center center;
  background-size: contain;
}
div.swal2-icon.swal2-success * { display: none !important; }

div.swal2-icon.swal2-error {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc3545' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E") no-repeat center center;
  background-size: contain;
}
div.swal2-icon.swal2-error * { display: none !important; }

div.swal2-icon.swal2-warning {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffc107' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E") no-repeat center center;
  background-size: contain;
}
div.swal2-icon.swal2-warning * { display: none !important; }

div.swal2-icon.swal2-info {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007bff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'%3E%3C/line%3E%3C/svg%3E") no-repeat center center;
  background-size: contain;
}
div.swal2-icon.swal2-info * { display: none !important; }
h2.swal2-title {
  font-size: 1.25em !important;
  padding: 0 !important;
  margin-bottom: 0.5em !important;
}
div.swal2-html-container {
  font-size: 0.95em !important;
  margin: 0 1em 1em !important;
  color: var(--muted) !important;
}
div.swal2-actions {
  margin-top: 0.5em !important;
  gap: 10px !important;
}
button.swal2-confirm, button.swal2-cancel {
  padding: 10px 24px !important;
  font-size: 0.9em !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  margin: 0 !important;
}

/* ── Mobile Hamburger Button ── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 1001;
  color: var(--text);
  flex-shrink: 0;
}
.mobile-menu-btn svg { display: block; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
  opacity: 0;
  transition: opacity .3s;
}
.sidebar-backdrop.open { display: block; opacity: 1; }

/* ── Responsive: Tablet (≤ 900px) ── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .playground { grid-template-columns: 1fr !important; }
  .rl-grid { grid-template-columns: 1fr; }
  .tc-panel { width: 95vw; max-width: 95vw; }
  .chat-panel { width: 95vw; max-width: 95vw; }
}

/* ── Responsive: Phone (≤ 768px) ── */
@media (max-width: 768px) {
  /* Sidebar becomes overlay */
  .mobile-menu-btn { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }
  .layout { flex-direction: column; }
  .main { padding: 16px; width: 100%; }

  /* Page header — stack vertically */
  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px;
  }
  .page-header > div {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-header > div:last-child {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
  }
  .page-header .btn {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    font-size: 12px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  /* Stats grid — 2 columns on phone */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }

  /* Filter buttons — scrollable */
  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-btn { white-space: nowrap; flex-shrink: 0; }

  /* Card header — stack on mobile */
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* Tables — horizontally scrollable */
  #leadsTableWrap, #tenantsListWrap, #dashLeadsList {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #leadsTableWrap table,
  #tenantsListWrap table,
  #dashLeadsList table {
    min-width: 600px;
  }

  /* Playground — single column */
  .playground { grid-template-columns: 1fr !important; }
  .playground .chat-box { height: 400px; }
  .playground .info-panel { max-height: 300px; overflow-y: auto; }

  /* Playground inputs — stack */
  #section-playground > div:first-child > div {
    flex-wrap: wrap;
  }
  #section-playground .secret-input { width: 100% !important; }

  /* Tenant config modal — full screen on mobile */
  .tc-panel {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    height: 100vh;
  }
  .tc-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding: 10px 16px 0;
  }
  .tc-tabs::-webkit-scrollbar { display: none; }
  .tc-tab { white-space: nowrap; flex-shrink: 0; font-size: 12px; padding: 6px 12px; }
  .tc-body { padding: 16px; }
  .tc-header { padding: 14px 16px; }
  .tc-footer { padding: 12px 16px; flex-wrap: wrap; }

  /* Chat panel modal — full screen on mobile */
  .chat-panel {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  /* Chart area */
  #section-dashboard .card div[style*="height: 300px"] {
    height: 200px !important;
  }

  /* Tenant creation form — stack */
  #section-tenants .card div[style*="display: flex; gap: 10px;"] {
    flex-direction: column;
  }
  #section-tenants .secret-input { max-width: 100% !important; width: 100% !important; }

  /* Rate limit grid */
  .rl-grid { grid-template-columns: 1fr; }

  /* Auth card — full-width */
  .auth-card {
    max-width: 100%;
    margin: 0 12px;
    padding: 28px 20px;
    border-radius: 16px;
  }
  .auth-title { font-size: 20px; }
  .auth-bg-blob { width: 300px; height: 300px; }

  /* Products pane buttons */
  #tcPane-products > div:first-child {
    flex-direction: column;
    align-items: flex-start !important;
  }
  #tcPane-products > div:first-child > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  #tcPane-products > div:first-child > div:last-child .btn { flex: 1 1 auto; text-align: center; }
}

/* ── Responsive: Small Phone (≤ 400px) ── */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  .main { padding: 12px; }
  .stat-value { font-size: 20px; }
  .auth-card { margin: 0 8px; padding: 24px 16px; }
  .auth-card img { height: 50px !important; }
}

/* ── SaaS Auth Overlay ── */
.saas-auth-overlay {
  position: fixed;
  inset: 0;
  background: #f8f9fa;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

.auth-bg-blob {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 123, 255, 0.15) 0%, transparent 70%);
  top: -100px;
  left: -100px;
  z-index: 1;
  animation: float 10s infinite ease-in-out;
}

.auth-bg-blob.two {
  background: radial-gradient(circle, rgba(0, 86, 179, 0.1) 0%, transparent 70%);
  bottom: -100px;
  right: -100px;
  top: auto;
  left: auto;
  animation-delay: -5s;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(30px, 30px);
  }
}

.auth-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  z-index: 10;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: #212529;
  margin-bottom: 8px;
  text-align: center;
}

.auth-subtitle {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 24px;
  text-align: center;
}

.auth-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid #ced4da;
  color: #212529;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.auth-input:focus {
  border-color: #007bff;
}

.auth-btn {
  width: 100%;
  background: linear-gradient(135deg, #007bff, #0056b3);
  border: none;
  color: #fff;
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  box-sizing: border-box;
  font-size: 16px;
}

.auth-btn:hover {
  opacity: 0.9;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: #6c757d;
  cursor: pointer;
}

.auth-switch span {
  color: #007bff;
  font-weight: 500;
}
