* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; background: #f0f2f5; min-height: 100vh; }

/* ── ADMIN NAV — style "pilule" comme simulio.fr ─────────────────────────── */
.admin-nav {
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 24px;
}
/* La "pilule" blanche flottante */
.admin-nav-inner {
  display: flex;
  align-items: center;
  height: 56px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 0 16px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 2px 16px rgba(0,0,0,.09), 0 0 0 1px rgba(0,0,0,.04);
}
.admin-nav-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 28px;
}
.admin-nav-logo-mark {
  height: 24px;
  width: auto;
  display: block;
}
.admin-nav-brand {
  font-size: 16px;
  font-weight: 700;
  color: #0D3532;
  letter-spacing: -.02em;
}
.admin-nav-badge {
  background: #e8f5ee;
  color: #39785B;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.admin-nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.admin-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: #4b5563;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.admin-nav-link:hover { background: #f3f4f6; color: #111; }
.admin-nav-link.active { background: #e8f5ee; color: #39785B; font-weight: 600; }
.admin-nav-link svg { opacity: .65; flex-shrink: 0; }
.admin-nav-link.active svg { opacity: 1; }
.admin-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.admin-nav-user {
  font-size: 12px;
  color: #9ca3af;
  display: none;
}
@media (min-width: 900px) { .admin-nav-user { display: block; } }
/* Bouton Déconnexion — style "Demander une démo" du site Simulio */
.admin-nav-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #0D3532;
  color: #fff;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.admin-nav-logout-btn:hover { background: #1a5244; }
.admin-nav-logout-btn:active { transform: scale(.97); }
.admin-nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #374151;
  padding: 6px;
  border-radius: 8px;
}
.admin-nav-hamburger:hover { background: #f3f4f6; }
/* Mobile drawer — reste en dehors de la pilule */
.admin-nav-drawer {
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  margin: 8px 24px 0;
  padding: 8px 12px 12px;
  gap: 2px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}
.admin-nav-drawer.open { display: flex; }
.admin-nav-drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
}
.admin-nav-drawer-link:hover, .admin-nav-drawer-link.active { background: #e8f5ee; color: #39785B; }
.admin-nav-drawer-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #dc3545;
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 4px;
  width: 100%;
  text-align: left;
}
.admin-nav-drawer-logout:hover { background: #fff5f5; }

/* ── LAYOUT ──────────────────────────────────────────────────────────────── */
.page { width: min(1480px, calc(100vw - 32px)); margin: 0 auto; padding: 32px 0; }

/* ── RESPONSIVE BREAKPOINTS ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-nav-links { display: none; }
  .admin-nav-logout-btn { display: none; }
  .admin-nav-hamburger { display: flex; }
  .admin-nav-inner { padding: 0 16px; }
  .page { width: calc(100vw - 24px); padding: 16px 0; }
  .stats { gap: 10px; }
  .stat-card { min-width: calc(50% - 5px); padding: 14px 16px; }
  .stat-card .n { font-size: 24px; }
  .token-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto; }
}
@media (max-width: 480px) {
  .stat-card { min-width: 100%; }
  .section-actions { width: 100%; }
  .btn { font-size: 13px; padding: 8px 14px; }
  .search-input { width: 100%; }
}

/* STATS */
.stats { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px 24px; flex: 1; min-width: 160px;
             border-left: 4px solid #39785B; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.stat-card .n  { font-size: 30px; font-weight: 700; color: #1a3a2a; }
.stat-card .lb { font-size: 13px; color: #777; margin-top: 2px; }

/* SECTION HEADER */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 12px; }
.section-header h2 { font-size: 17px; color: #222; font-weight: 600; }
.section-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* SEARCH */
.search-input { border: 1px solid #ddd; border-radius: 8px; padding: 8px 14px 8px 36px; font-size: 13px;
                outline: none; width: 220px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23aaa' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center; }
.search-input:focus { border-color: #39785B; }

/* BUTTON */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 8px;
       font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all .18s; }
.btn-primary { background: #39785B; color: #fff; }
.btn-primary:hover { background: #2d6048; }
.btn-danger  { background: #fff; color: #dc3545; border: 1px solid #dc3545; padding: 5px 11px; font-size: 12px; }
.btn-danger:hover { background: #dc3545; color: #fff; }
.btn-toggle  { background: #fff; color: #39785B; border: 1px solid #39785B; padding: 5px 11px; font-size: 12px; }
.btn-toggle:hover { background: #39785B; color: #fff; }
.btn-toggle.off { color: #aaa; border-color: #ccc; }
.btn-toggle.off:hover { background: #aaa; color: #fff; }
.btn-copy  { background: #f0f0f0; color: #333; border: 1px solid #ddd; padding: 5px 11px; font-size: 12px; }
.btn-copy:hover { background: #e0e0e0; }
.btn-copy.off { color: #8a8f98; border-color: #d7dce2; background: #f7f8fa; }
.btn-copy.off:hover { background: #eceff3; }
.btn-edit  { background: #eef7f2; color: #2d6048; border: 1px solid #b7d8c8; padding: 5px 11px; font-size: 12px; }
.btn-edit:hover { background: #dcefe5; }
.btn-preview { background: #f0f4ff; color: #3b5bdb; border: 1px solid #bac8ff; padding: 5px 11px; font-size: 12px; }
.btn-preview:hover { background: #dbe4ff; }
.btn-nav { background: rgba(255,255,255,.08); color: #e8f5ef; border: 1px solid rgba(255,255,255,.18); padding: 7px 12px; font-size: 12px; }
.btn-nav:hover { background: rgba(255,255,255,.16); }

/* TABLE */
.table-wrap { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.07); overflow-x: auto; overflow-y: hidden; width: 100%; }
table { width: 100%; min-width: 1100px; border-collapse: collapse; }
thead th { background: #f8f9fa; padding: 13px 16px; font-size: 12px; font-weight: 600;
           text-transform: uppercase; letter-spacing: .5px; color: #777; text-align: left;
           border-bottom: 1px solid #e9ecef; white-space: nowrap; }
tbody tr { border-bottom: 1px solid #f0f2f5; transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
tbody td { padding: 14px 16px; font-size: 14px; color: #333; vertical-align: middle; }
.color-dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff;
             box-shadow: 0 0 0 1px #ccc; vertical-align: middle; margin-right: 6px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 50px; font-size: 11px; font-weight: 600; }
.badge-on  { background: #d4f5e9; color: #1a8754; }
.badge-off { background: #f5f5f5; color: #999; }
.badge-neutral { background: #eef2f7; color: #526071; }
.badge-webhook { background: #e8f1ff; color: #315ea8; }
.badge-hubspot { background: #fff1e8; color: #c05621; }
.badge-pipedrive { background: #eef9e8; color: #2f855a; }
.badge-salesforce { background: #e6f4fb; color: #006ba1; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.public-id { font-family: monospace; font-size: 11px; color: #888; display: block; margin-top: 2px; }
.sim-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.sim-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eef7f2; color: #2d6048; }
.sim-pill.unavailable { background: #f5f5f5; color: #aaa; }
.lead-routing { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.lead-primary { font-size: 13px; color: #5f6b65; }

/* EMBED CODE */
.embed-box { background: #1e1e1e; border-radius: 8px; padding: 14px 18px; font-family: monospace;
             font-size: 12px; color: #9cdcfe; line-height: 1.8; position: relative; }
.embed-box .kw  { color: #569cd6; }
.embed-box .attr { color: #9cdcfe; }
.embed-box .val  { color: #ce9178; }
.embed-list { display: flex; flex-direction: column; gap: 14px; }
.embed-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.embed-item-title { font-size: 13px; font-weight: 700; color: #1a3a2a; }
.embed-item-actions { display: flex; align-items: center; gap: 8px; }
.btn-preview { display: inline-flex; align-items: center; gap: 5px; background: #f0f0f0; color: #333;
               border: 1px solid #ddd; border-radius: 6px; padding: 5px 11px; font-size: 12px; cursor: pointer; }
.btn-preview:hover, .btn-preview:focus-visible { background: #e0e0e0; }
.embed-preview-popover { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
                          max-width: 94vw; max-height: 85vh; overflow: auto;
                          background: #fff; border: 1px solid #ddd; border-radius: 12px;
                          box-shadow: 0 24px 64px rgba(0,0,0,.32); z-index: 500; padding: 14px; }
.embed-preview-popover.visible { display: block; }
.embed-preview-scale { overflow: hidden; transition: height .15s ease; }
.embed-preview-scale iframe { border: 0; display: block; border-radius: 6px; transform-origin: top left; }
.embed-preview-loading { font-size: 12px; color: #888; text-align: center; padding: 24px 0; }
.embed-preview-close {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px;
  border-radius: 50%; border: 1px solid #ddd; background: #fff;
  color: #333; font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
.embed-preview-close:hover { background: #f0f0f0; }

/* MODAL */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
           justify-content: center; align-items: center; }
.overlay.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; padding: 32px;
         box-shadow: 0 20px 60px rgba(0,0,0,.2); position: relative; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 18px; margin-bottom: 22px; color: #1a3a2a; }
.modal-close { position: absolute; top: 18px; right: 20px; background: none; border: none;
               font-size: 22px; cursor: pointer; color: #aaa; line-height: 1; }
.modal-close:hover { color: #333; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; border: 1px solid #ddd; border-radius: 7px; padding: 9px 12px;
    font-size: 14px; outline: none; transition: border .15s; }
.form-group textarea { resize: vertical; min-height: 128px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #39785B; }
.logo-upload-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px dashed #cfd8e3; border-radius: 10px; background: #fafcfd; }
.logo-preview { min-height: 74px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; padding: 14px 18px; }
.logo-preview img { max-height: 30px; max-width: min(240px, 100%); width: auto; object-fit: contain; display: block; }
.logo-preview.empty { color: #94a3b8; font-size: 12px; }
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.check-row input { width: auto !important; margin: 0 !important; }
.check-row label { margin: 0; font-size: 13px; color: #374151; font-weight: 500; }
.mini-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-hint { font-size: 11px; color: #999; margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.sim-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sim-option { display: flex; align-items: center; gap: 8px; border: 1px solid #ddd; border-radius: 8px; padding: 10px 12px; background: #fafafa; cursor: pointer; transition: border-color .15s; }
.sim-option:has(input:checked) { border-color: #39785B; background: #eef7f2; }
.sim-option input { width: auto !important; margin: 0 !important; cursor: pointer; }
.sim-option span { font-size: 13px; color: #333; }
.sim-option .sim-status { font-size: 10px; color: #39785B; font-weight: 700; margin-left: auto; }
.sim-option .sim-status.wip { color: #f59e0b; }


/* SUCCESS PANEL */
.success-panel { background: #d4f5e9; border: 1px solid #a8e6cd; border-radius: 10px; padding: 20px; margin-top: 16px; display: none; }
.success-panel h4 { color: #1a8754; margin-bottom: 10px; font-size: 15px; }
.security-note { font-size: 13px; color: #55616b; line-height: 1.55; margin-bottom: 16px; }
.security-box { text-align: left; background: #f8fbf9; border: 1px solid #dcefe5; border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.security-actions { display: flex; gap: 10px; }
.security-actions .btn { justify-content: center; flex: 1; }

/* EMPTY STATE */
.empty { text-align: center; padding: 60px 20px; color: #aaa; }
.empty svg { margin-bottom: 12px; opacity: .4; }
.empty p { font-size: 14px; }

/* LOGIN */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 14px; padding: 40px; width: 100%; max-width: 380px;
              box-shadow: 0 4px 24px rgba(0,0,0,.1); text-align: center; }
.login-card .logo { font-size: 24px; font-weight: 700; color: #1a3a2a; margin-bottom: 6px; }
.login-card .logo span { color: #39785B; }
.login-card p { color: #777; font-size: 14px; margin-bottom: 28px; }
.login-card input { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 11px 14px;
                    font-size: 15px; margin-bottom: 14px; outline: none; }
.login-card input:focus { border-color: #39785B; }
.login-card textarea { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 11px 14px; font-size: 13px; outline: none; resize: vertical; min-height: 88px; color: #555; }
.login-card .login-primary { width: 100%; background: #39785B; color: #fff; border: none; border-radius: 8px;
                             padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.login-card .login-primary:hover { background: #2d6048; }
.login-card .login-actions { display: flex; gap: 10px; }
.login-card .login-actions .login-primary { margin: 0; }
.login-card .login-secondary { flex: 0 0 108px; background: #fff; color: #39785B; border: 1px solid #39785B; border-radius: 8px; padding: 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-card .login-secondary:hover { background: #eef7f2; }
.login-card .login-copy-row { display: flex; gap: 8px; margin-bottom: 12px; }
.login-card .login-copy-row input { margin-bottom: 0; font-size: 13px; }
.login-card .login-copy-btn { width: auto; min-width: 84px; background: #eef7f2; color: #2d6048; border: 1px solid #b7d8c8; border-radius: 8px; padding: 0 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.login-card .login-copy-btn:hover { background: #dcefe5; }
.login-card .login-hint { color: #555; font-size: 13px; line-height: 1.5; margin: 0 0 18px; }
.login-card .login-link-btn { width: 100%; background: transparent; color: #39785B; border: none; padding: 8px 0 0; font-size: 13px; font-weight: 600; cursor: pointer; }
.login-card .login-link-btn:hover { color: #2d6048; text-decoration: underline; }
.login-card .login-setup { text-align: left; background: #f8fbf9; border: 1px solid #dcefe5; border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.login-card .login-setup-title { color: #1a3a2a; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.login-card .login-meta { color: #5f6b65; font-size: 12px; line-height: 1.5; margin: 0 0 12px; }
.login-card .login-meta-label { display: block; color: #374151; font-size: 12px; font-weight: 700; margin-bottom: 6px; text-align: left; }
.login-card .login-uri-toggle { color: #39785B; font-size: 12px; cursor: pointer; margin-top: 4px; }
.login-card .login-uri-toggle summary { list-style: none; }
.login-card .login-uri-toggle summary::-webkit-details-marker { display: none; }
.login-card .login-uri-toggle[open] summary { margin-bottom: 10px; }
.login-card .login-qr { display: flex; justify-content: center; margin-bottom: 12px; }
.login-card .login-qr img { width: 168px; height: 168px; border-radius: 12px; border: 1px solid #e5e7eb; background: #fff; padding: 8px; }
.login-card .login-qr #loginQrCanvas { width: 168px; height: 168px; border-radius: 12px; border: 1px solid #e5e7eb; background: #fff; padding: 8px; display: flex; align-items: center; justify-content: center; }
.login-card .login-qr #loginQrCanvas img { width: 100% !important; height: 100% !important; border: 0; padding: 0; border-radius: 8px; }
.login-error { color: #dc3545; font-size: 13px; margin-bottom: 12px; display: none; }

/* TOAST */
.toast { position: fixed; bottom: 28px; right: 28px; background: #1a3a2a; color: #fff; border-radius: 10px;
         padding: 12px 20px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2);
         transform: translateY(80px); opacity: 0; transition: all .25s; z-index: 999; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 900px) {
  .page { width: calc(100vw - 32px); padding: 24px 0; }
  .section-header { gap: 12px; flex-wrap: wrap; }
  .stats { gap: 12px; }
  .search-input { width: 100%; }
}

/* ── Admin redesign aligned with client dashboard ─────────────────────────── */
:root {
  --brand: #39785B;
  --brand-dark: #1f4c39;
  --ink: #122026;
  --muted: #6b7280;
  --bg: #f5f7f6;
  --card: #ffffff;
  --line: #dde5e2;
}

body {
  color: var(--ink);
  background: linear-gradient(180deg, #f9fbfa 0%, var(--bg) 100%);
}

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: auto;
  padding: 10px 20px;
  background: linear-gradient(135deg, #16372b 0%, #0f2620 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav-logo-label,
.nav-user {
  color: rgba(236,244,240,.82);
}

.nav-logo-sep {
  color: rgba(95, 207, 160, .4);
}

.nav-user a,
#logoutLink {
  color: rgba(236,244,240,.86);
}

.nav-user a:hover,
#logoutLink:hover {
  color: #fff;
}

.nav-right {
  gap: 10px;
}

.page {
  width: min(1280px, 100%);
  padding: 28px 16px 48px;
}

.page-shell {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero-card,
.filters-card,
.table-wrap,
.stat-card,
.admin-stat-card {
  border: 1px solid rgba(18,32,38,.07);
  box-shadow: 0 14px 38px rgba(18,32,38,.06);
}

.hero-card {
  background: var(--card);
  border-radius: 24px;
  padding: 24px;
  background-image:
    radial-gradient(circle at top right, rgba(57,120,91,.08), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #fcfdfc 100%);
}

.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.hero-copy h1 {
  font-size: 30px;
  line-height: 1.06;
  margin-bottom: 10px;
}

.hero-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--brand);
  font-weight: 700;
}

.hero-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  max-width: 720px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-search {
  flex: 1 1 240px;
  min-width: 0;
}

.search-input {
  width: 100%;
  border: 1px solid rgba(18,32,38,.10);
  border-radius: 18px;
  padding: 14px 16px 14px 42px;
  font-size: 14px;
  color: var(--ink);
  background-color: #fff;
  background-position: 14px center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}

.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(57,120,91,.12), 0 10px 24px rgba(57,120,91,.08);
}

.btn {
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.btn-copy,
.btn-edit,
.btn-preview,
.btn-toggle,
.btn-danger {
  border-radius: 999px;
}

.admin-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: linear-gradient(180deg, #edf2f1 0%, #e6edeb 100%);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  width: min(360px, 100%);
}

.admin-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.admin-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(18,32,38,.10);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 0;
}

.stat-card {
  background: var(--card);
  border-radius: 18px;
  padding: 20px 22px;
  border-left: 0;
}

.stat-card .n {
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card .lb {
  font-size: 12px;
  color: var(--muted);
}

.section-header h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}

.section-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.table-wrap {
  background: var(--card);
  border-radius: 20px;
}

table {
  min-width: 1080px;
}

thead th {
  background: #f8fbfa;
  border-bottom: 1px solid var(--line);
}

tbody td {
  color: var(--ink);
}

.filters-card {
  background: var(--card);
  border-radius: 24px;
  padding: 24px;
  background-image:
    radial-gradient(circle at top right, rgba(57,120,91,.08), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #fcfdfc 100%);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  font-weight: 700;
}

.period-type-card,
.period-picker-card {
  background: rgba(244,247,246,.92);
  border: 1px solid rgba(18,32,38,.06);
  border-radius: 20px;
  padding: 14px;
}

.period-picker-card {
  position: relative;
  padding: 16px;
}

.period-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: linear-gradient(180deg, #edf2f1 0%, #e6edeb 100%);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.period-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.period-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(18,32,38,.10);
}

.period-nav {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
}

.period-nav-btn,
.period-current-btn {
  border: 1px solid rgba(18,32,38,.10);
  background: #fff;
  color: var(--ink);
  min-height: 56px;
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}

.period-nav-btn {
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

.period-current-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 18px;
  text-align: left;
  cursor: pointer;
}

.period-current-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .7;
  background: no-repeat center/18px 18px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23122026' stroke-width='1.8'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18'/%3E%3C/svg%3E");
}

.period-current-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.period-current-label {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.period-current-hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.period-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 30;
  border: 1px solid rgba(18,32,38,.10);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 48px rgba(18,32,38,.16);
  overflow: hidden;
}

.period-menu[hidden] {
  display: none;
}

.period-menu-head {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(18,32,38,.08);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
  background: #f8fbfa;
}

.period-menu-list {
  max-height: 320px;
  overflow-y: auto;
}

.period-option {
  width: 100%;
  border: 0;
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid rgba(18,32,38,.06);
}

.period-option:hover {
  background: #f6faf8;
}

.period-option.active {
  background: #eef7f2;
}

.period-option-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.period-option-title {
  font-weight: 800;
}

.period-option-meta {
  color: var(--muted);
  font-size: 12px;
}

.period-option-check {
  color: var(--brand);
  font-weight: 800;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.admin-stat-card {
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
}

.admin-stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-stat-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.admin-stat-logo,
.admin-stat-logo-fallback {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
  background: #f3f7f5;
  border: 1px solid rgba(18,32,38,.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-stat-logo {
  object-fit: contain;
  padding: 8px;
}

.admin-stat-logo-fallback {
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-dark);
}

.admin-stat-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.admin-stat-id {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.admin-stat-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.admin-kpi {
  border: 1px solid rgba(18,32,38,.08);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfc 100%);
}

.admin-kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.admin-kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.admin-kpi-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.admin-stat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(18,32,38,.08);
  color: var(--muted);
  font-size: 12px;
}

.admin-stat-sims {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.badge-on,
.badge-off,
.badge-neutral,
.badge-webhook,
.badge-hubspot,
.badge-pipedrive,
.badge-salesforce {
  border-radius: 999px;
}

@media (max-width: 1100px) {
  .stats,
  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .hero-head,
  .filters-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .nav {
    padding: 10px 14px;
  }
}

@media (max-width: 760px) {
  .stats,
  .admin-stats-grid,
  .admin-kpi-grid,
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .filters-card,
  .stat-card,
  .admin-stat-card,
  .table-wrap {
    border-radius: 20px;
  }

  .hero-copy h1 {
    font-size: 24px;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 18px 10px 32px;
  }

  .hero-card,
  .filters-card {
    padding: 16px;
  }

  .hero-actions {
    gap: 8px;
  }

  .admin-tabs {
    width: 100%;
  }

  .period-nav {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
  }

  .period-nav-btn,
  .period-current-btn {
    min-height: 50px;
    border-radius: 16px;
  }

  .period-current-btn {
    padding: 0 14px;
  }

  .stat-card,
  .admin-stat-card {
    padding: 16px;
  }

  .admin-stat-head,
  .admin-stat-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-stat-badges {
    justify-content: flex-start;
  }

  .table-wrap {
    overflow-x: auto;
  }
}

/* ── DASHBOARD CLIENT ACCESS BOX ─────────────────────────────────────────── */
.dashboard-access-box {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Toggle switch */
.dashboard-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-switch input:checked + .toggle-track { background: #39785B; }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-label { font-size: 13.5px; font-weight: 500; color: #374151; }

/* Password field with show/hide */
.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-field-input {
  flex: 1;
  padding-right: 44px !important;
}
.password-toggle-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
}
.password-toggle-btn:hover { color: #374151; }

/* Copy URL row */
.copy-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.copy-url-input {
  flex: 1;
  background: #fff !important;
  color: #374151 !important;
  font-size: 12.5px !important;
  font-family: monospace;
  min-width: 0;
}
.copy-url-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #39785B;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.copy-url-btn:hover { background: #2d6048; }
.copy-url-btn:active { transform: scale(.97); }
.copy-url-btn.copied { background: #16a34a; }

/* ── TABLE RESPONSIVE ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .token-table th:nth-child(4),
  .token-table td:nth-child(4),
  .token-table th:nth-child(5),
  .token-table td:nth-child(5) { display: none; }
  .token-table { font-size: 12.5px; }
  .token-table td, .token-table th { padding: 10px 8px; }
  .stats { flex-direction: column; }
  .stat-card { min-width: unset; }
}

/* ── HUBSPOT CRM ─────────────────────────────────────────────────────────── */
.hubspot-box {
  background: #fff8f5;
  border: 1.5px solid #ffd6c4;
  border-radius: 10px;
  padding: 16px;
}
.hubspot-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #888;
  font-size: 13px;
}
.hubspot-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #ffd6c4;
  border-top-color: #FF7A59;
  border-radius: 50%;
  animation: hubspot-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes hubspot-spin { to { transform: rotate(360deg); } }
.hubspot-desc {
  font-size: 13px;
  color: #555;
  margin: 0 0 14px;
  line-height: 1.5;
}
.btn-hubspot-connect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FF7A59;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-hubspot-connect:hover { background: #e8622e; }
.btn-hubspot-connect:active { transform: scale(.97); }
.hubspot-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.hubspot-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #16a34a;
  flex-shrink: 0;
}
.hubspot-status-label {
  font-size: 13px;
  font-weight: 600;
  color: #166534;
}
.hubspot-hub-id {
  font-size: 12px;
  color: #888;
  flex: 1;
}
.btn-hubspot-disconnect {
  background: none;
  border: 1px solid #fca5a5;
  color: #dc2626;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}
.btn-hubspot-disconnect:hover { background: #fee2e2; }
.hubspot-settings {
  background: #fff;
  border: 1px solid #ffe5d6;
  border-radius: 8px;
  padding: 14px;
}
.hubspot-select {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
  color: #222;
  outline: none;
  cursor: pointer;
}
.hubspot-select:focus { border-color: #FF7A59; box-shadow: 0 0 0 2px rgba(255,122,89,.15); }
