/* ===== RESET & VARIABLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Scroll ── */
html { scroll-behavior: smooth; }

:root {
  --green:       #25D366;
  --green-dark:  #128C7E;
  --green-light: #d9fdd3;
  --green-muted: #e9fce4;
  --text:        #111b21;
  --text-muted:  #667781;
  --border:      #e2e8f0;
  --bg:          #f0f2f5;
  --white:       #ffffff;
  --danger:      #ef4444;
  --danger-bg:   #fee2e2;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.14);
  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;
  --transition:  all .22s cubic-bezier(.4,0,.2,1);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); min-height: 100vh; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: .875rem; }

/* ===== TOAST ===== */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--text); color: #fff; padding: 12px 20px;
  border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transform: translateY(12px);
  transition: opacity .3s, transform .3s;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.success { background: var(--green-dark); }
#toast.error   { background: var(--danger); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.page-login {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* --- Brand Panel --- */
.login-brand {
  background: linear-gradient(145deg, var(--green-dark) 0%, var(--green) 60%, #34d676 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}
.brand-inner { position: relative; z-index: 1; max-width: 400px; }

.brand-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.brand-logo svg { width: 52px; height: 52px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.brand-logo h1 { color: #fff; font-size: 2rem; font-weight: 800; letter-spacing: -.5px; }

.brand-tagline {
  color: rgba(255,255,255,.9); font-size: 1.1rem; line-height: 1.6;
  margin-bottom: 40px;
}

.brand-features { display: flex; flex-direction: column; gap: 16px; }
.brand-feature {
  display: flex; align-items: flex-start; gap: 12px;
  color: rgba(255,255,255,.95);
}
.feature-icon {
  width: 28px; height: 28px; background: rgba(255,255,255,.2);
  border-radius: 50%; display: grid; place-items: center;
  font-size: .85rem; flex-shrink: 0;
}
.brand-feature p { font-size: .95rem; line-height: 1.4; }

.brand-circles {
  position: absolute; bottom: -60px; left: -60px; opacity: .1;
  width: 300px; height: 300px;
  border: 60px solid #fff; border-radius: 50%;
}
.brand-circles::after {
  content: ''; position: absolute; inset: -80px;
  border: 40px solid #fff; border-radius: 50%;
}

/* --- Form Panel --- */
.login-form-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 32px; background: var(--white);
}
.login-form-inner { width: 100%; max-width: 400px; }

.form-header { margin-bottom: 36px; }
.form-header h2 { font-size: 1.75rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.form-header p  { color: var(--text-muted); font-size: .95rem; }

/* Tabs */
.auth-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 28px; }
.auth-tab {
  flex: 1; padding: 9px; border: none; background: transparent;
  border-radius: calc(var(--radius-sm) - 2px); font-size: .875rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.auth-tab.active { background: var(--white); color: var(--text); box-shadow: var(--shadow-sm); }

/* Form groups */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.form-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: .95rem; color: var(--text);
  background: var(--white); outline: none; transition: var(--transition);
}
.form-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(37,211,102,.12); }
.form-input::placeholder { color: #b0bec5; }

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

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: none; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: var(--green); color: #fff; width: 100%; padding: 13px;
  font-size: 1rem; border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(37,211,102,.3);
}
.btn-primary:hover { background: var(--green-dark); box-shadow: 0 6px 16px rgba(37,211,102,.35); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

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

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

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

.form-options { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--text-muted); cursor: pointer; }
.check-label input { accent-color: var(--green); width: 15px; height: 15px; }
.link-text { color: var(--green-dark); font-size: .875rem; font-weight: 500; text-decoration: none; cursor: pointer; }
.link-text:hover { text-decoration: underline; }

.divider { text-align: center; position: relative; margin: 22px 0; }
.divider::before { content: ''; position: absolute; inset: 50% 0 auto; height: 1px; background: var(--border); }
.divider span { position: relative; background: var(--white); padding: 0 12px; color: var(--text-muted); font-size: .8rem; }

.auth-switch { text-align: center; font-size: .875rem; color: var(--text-muted); margin-top: 4px; }

.error-msg {
  background: var(--danger-bg); color: var(--danger);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: .85rem; margin-top: 12px; border-left: 3px solid var(--danger);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.page-dashboard { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }

/* --- Navbar --- */
.navbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 64px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-brand svg { width: 34px; height: 34px; }
.nav-brand span { font-size: 1.2rem; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.nav-brand strong { color: var(--green-dark); }

.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-avatar {
  width: 36px; height: 36px; background: var(--green); border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: .85rem; font-weight: 700;
}
.nav-name { font-size: .9rem; font-weight: 600; color: var(--text); }
/* kept for fallback if referenced anywhere */
.nav-logout {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px;
  background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; color: var(--text-muted); cursor: pointer;
  transition: var(--transition); text-decoration: none;
}
.nav-logout:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* ── New logout button ── */
.btn-logout {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px; border: none; border-radius: 20px;
  background: rgba(239,68,68,.1); color: #dc2626;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); text-decoration: none;
}
.btn-logout:hover {
  background: #dc2626; color: #fff;
  box-shadow: 0 4px 12px rgba(220,38,38,.28);
  transform: translateY(-1px);
}
.btn-logout:active { transform: translateY(0); }

/* ── Ver site link (admin nav) ── */
.btn-site-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 20px; border: none;
  background: var(--green-muted); color: var(--green-dark);
  font-size: .875rem; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: var(--transition);
}
.btn-site-link:hover { background: var(--green); color: #fff; }

/* --- Main Layout --- */
.main-content { flex: 1; padding: 32px 28px; max-width: 1100px; margin: 0 auto; width: 100%; }

/* --- Stats Bar --- */
.stats-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--white); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0;
}
.stat-icon.green  { background: var(--green-muted); }
.stat-icon.blue   { background: #eff6ff; }
.stat-icon.purple { background: #f5f3ff; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* --- Page Tabs --- */
.page-tabs { display: flex; gap: 4px; background: var(--white); border-radius: var(--radius); padding: 5px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 24px; width: fit-content; }
.page-tab {
  padding: 9px 20px; border: none; border-radius: calc(var(--radius) - 4px);
  font-size: .9rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; background: transparent; transition: var(--transition);
  display: flex; align-items: center; gap: 7px;
}
.page-tab.active { background: var(--green); color: #fff; box-shadow: 0 2px 8px rgba(37,211,102,.3); }
.page-tab:not(.active):hover { background: var(--bg); color: var(--text); }

/* --- Card --- */
.card {
  background: var(--white); border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 22px; display: flex; align-items: center; gap: 8px; }

/* --- Create Form --- */
.create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }

.phone-input-wrap { position: relative; }
.phone-flag {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 1.1rem; pointer-events: none; user-select: none;
}
.phone-prefix {
  position: absolute; left: 38px; top: 50%; transform: translateY(-50%);
  font-size: .9rem; color: var(--text-muted); font-weight: 500; pointer-events: none;
}
.form-input.with-prefix { padding-left: 72px; }

.char-count { font-size: .8rem; color: var(--text-muted); text-align: right; margin-top: 5px; }

.link-preview-box {
  background: var(--green-muted); border: 1.5px dashed var(--green);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 18px;
  display: flex; align-items: center; gap: 12px;
}
.link-preview-box .link-url {
  flex: 1; font-size: .82rem; color: var(--green-dark); word-break: break-all; font-family: monospace;
}
.label-optional { font-size: .78rem; color: var(--text-muted); font-weight: 400; margin-left: 4px; }

.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.form-actions .btn { flex: 1; }

/* Preview Panel */
.preview-panel { }
.whatsapp-preview {
  background: #e5ddd5;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.wa-header {
  background: var(--green-dark); padding: 14px 16px;
  display: flex; align-items: center; gap: 10px; color: #fff;
}
.wa-avatar { width: 36px; height: 36px; background: rgba(255,255,255,.2); border-radius: 50%; display: grid; place-items: center; font-size: 1rem; }
.wa-contact h4 { font-size: .9rem; font-weight: 600; }
.wa-contact p  { font-size: .75rem; opacity: .8; }
.wa-body { padding: 16px; min-height: 140px; display: flex; align-items: flex-end; }
.wa-bubble {
  background: var(--white); border-radius: 8px 8px 8px 0; padding: 10px 14px;
  max-width: 85%; box-shadow: 0 1px 2px rgba(0,0,0,.13);
  font-size: .88rem; line-height: 1.5; color: var(--text); white-space: pre-wrap;
}
.wa-bubble.empty { color: var(--text-muted); font-style: italic; }
.wa-time { font-size: .7rem; color: var(--text-muted); text-align: right; margin-top: 4px; }

/* --- Links List --- */
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.search-box {
  position: relative; width: 260px;
}
.search-box input { padding-left: 36px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; pointer-events: none; }

.links-list { display: flex; flex-direction: column; gap: 10px; }

.link-item {
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 18px; display: flex; align-items: flex-start; gap: 14px;
  transition: var(--transition); position: relative; overflow: hidden;
}
.link-item:hover { border-color: var(--green); box-shadow: 0 2px 12px rgba(37,211,102,.1); }
.link-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--green); }

.link-item-icon { width: 40px; height: 40px; background: var(--green-muted); border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.link-item-body { flex: 1; min-width: 0; }
.link-item-label { font-weight: 700; font-size: .95rem; color: var(--text); margin-bottom: 2px; }
.link-item-phone { font-size: .85rem; color: var(--green-dark); font-weight: 500; margin-bottom: 4px; }
.link-item-msg { font-size: .83rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; }
.link-item-date { font-size: .75rem; color: var(--text-muted); margin-top: 5px; }

.link-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Edit inline */
.link-item.editing { border-color: var(--green); background: var(--green-muted); }
.edit-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.edit-fields .form-input { background: var(--white); font-size: .875rem; padding: 9px 12px; }
.edit-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Empty state */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: .5; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: .9rem; }

/* ============================================================
   CLICK BADGE & QR MODAL
   ============================================================ */
.click-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green-muted); color: var(--green-dark);
  border: 1px solid rgba(37,211,102,.3); border-radius: 20px;
  padding: 2px 10px; font-size: .78rem; font-weight: 600;
  transition: var(--transition);
}

.btn-click {
  background: var(--green-muted) !important;
  color: var(--green-dark) !important;
  border: 1.5px solid rgba(37,211,102,.4) !important;
}
.btn-click:hover { background: var(--green) !important; color: #fff !important; }

/* QR Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 32px; max-width: 340px; width: 90%;
  box-shadow: var(--shadow-lg); text-align: center;
}
.modal-box h3 { font-size: 1.1rem; margin-bottom: 6px; }
.modal-box .text-muted { margin-bottom: 20px; font-size: .85rem; }
.qr-img { width: 180px; height: 180px; border-radius: var(--radius-sm); border: 3px solid var(--green-muted); margin: 0 auto 16px; display: block; }
.qr-url { font-size: .72rem; color: var(--text-muted); word-break: break-all; font-family: monospace; background: var(--bg); border-radius: 6px; padding: 8px; margin-bottom: 16px; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted);
}
.modal-box { position: relative; }

/* QR actions */
.qr-actions {
  display: flex; gap: 10px; justify-content: center; margin-top: 4px;
}
.qr-action-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--white); color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center; transition: var(--transition);
}
.qr-action-btn:hover {
  background: var(--green); color: #fff; border-color: var(--green);
  box-shadow: 0 4px 12px rgba(37,211,102,.3); transform: translateY(-2px);
}
.qr-action-btn:active { transform: translateY(0); }

/* Track URL in link item */
.link-track-url {
  font-size: .72rem; color: var(--green-dark); font-family: monospace;
  background: var(--green-muted); border-radius: 5px;
  padding: 4px 8px; margin-top: 5px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 480px; display: flex; align-items: center; gap: 5px;
  border: 1px dashed rgba(37,211,102,.4); transition: var(--transition);
}
.link-track-url:hover { background: var(--green); color: #fff; border-color: var(--green); }
.track-icon { flex-shrink: 0; }

/* Click count badge */
.track-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe; border-radius: 20px;
  padding: 2px 10px; font-size: .75rem; font-weight: 600;
}

/* Dashboard overview */
.dash-welcome {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  border-radius: var(--radius); padding: 24px 28px; margin-bottom: 24px;
  color: #fff;
}
.dash-welcome h2 { font-size: 1.4rem; font-weight: 800; color: #fff; margin-bottom: 4px; }
.dash-welcome p  { color: rgba(255,255,255,.85); font-size: .9rem; }
.dash-welcome .btn-primary {
  background: #fff; color: var(--green-dark);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.dash-welcome .btn-primary:hover { background: rgba(255,255,255,.9); transform: translateY(-1px); }

.dash-recent-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.dash-recent-row:last-child { border-bottom: none; }

.dash-tips { display: flex; flex-direction: column; gap: 16px; }
.dash-tip  { display: flex; gap: 12px; align-items: flex-start; }
.dash-tip-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.dash-tip strong { display: block; font-size: .875rem; color: var(--text); margin-bottom: 2px; }
.dash-tip p      { font-size: .8rem; color: var(--text-muted); line-height: 1.5; margin: 0; }

/* Message format toolbar */
.format-toolbar {
  display: flex; align-items: center; gap: 4px; margin-bottom: 8px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 8px;
}
.format-toolbar-sm { margin-top: 6px; }
.format-btn {
  width: 30px; height: 30px; border: none; background: transparent;
  border-radius: 6px; cursor: pointer; color: var(--text);
  display: grid; place-items: center; font-size: .9rem; transition: var(--transition);
}
.format-btn:hover { background: var(--white); box-shadow: var(--shadow-sm); }
.format-btn strong { font-weight: 900; }
.format-btn em { font-style: italic; font-size: .85rem; }
.format-btn s { text-decoration: line-through; font-size: .85rem; }
.format-btn code { font-family: monospace; font-size: .8rem; }
.format-hint {
  margin-left: 6px; font-size: .72rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.page-admin { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }

.admin-layout { display: flex; flex: 1; }

/* Sidebar */
.admin-sidebar {
  width: 230px; background: var(--white); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.sidebar-section-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); padding: 10px 10px 4px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border: none; background: transparent;
  width: 100%; text-align: left; transition: var(--transition);
}
.sidebar-item:hover { background: var(--bg); color: var(--text); }
.sidebar-item.active { background: var(--green-muted); color: var(--green-dark); font-weight: 700; }
.sidebar-item .s-icon { font-size: 1.1rem; }

/* Admin content */
.admin-content { flex: 1; padding: 28px; min-width: 0; }

/* Admin badge in navbar */
.admin-badge {
  background: #7c3aed; color: #fff; font-size: .7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .05em;
}

/* Badges */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-admin   { background: #ede9fe; color: #6d28d9; }
.badge-user    { background: var(--green-muted); color: var(--green-dark); }
.badge-active  { background: #d1fae5; color: #065f46; }
.badge-inactive{ background: var(--danger-bg); color: var(--danger); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: .9rem; vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* Mini avatar */
.mini-avatar {
  width: 32px; height: 32px; background: var(--green); border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: .85rem; font-weight: 700;
  flex-shrink: 0;
}

/* Overview grid */
.overview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.overview-card {
  background: var(--white); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}

/* Top links chart */
.top-link-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.top-link-row:last-child { border-bottom: none; }
.top-link-info { min-width: 160px; }
.top-link-label { font-weight: 600; font-size: .9rem; display: block; }
.top-link-owner { font-size: .78rem; }
.top-link-bar-wrap { flex: 1; background: var(--bg); border-radius: 4px; height: 10px; overflow: hidden; }
.top-link-bar { height: 100%; background: linear-gradient(90deg, var(--green-dark), var(--green)); border-radius: 4px; transition: width .6s ease; }
.top-link-count { width: 36px; text-align: right; font-weight: 700; font-size: .9rem; color: var(--green-dark); }

/* Mini bar in table */
.mini-bar-wrap { width: 60px; background: var(--bg); border-radius: 4px; height: 8px; overflow: hidden; }
.mini-bar { height: 100%; background: var(--green); border-radius: 4px; }

/* Recent users */
.recent-user-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.recent-user-row:last-child { border-bottom: none; }

/* Table toolbar */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.table-toolbar-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-toolbar-right { display: flex; gap: 8px; }

.filter-select {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .875rem; color: var(--text); background: var(--white); outline: none;
  transition: var(--transition); cursor: pointer;
}
.filter-select:focus { border-color: var(--green); }

/* Two-col overview */
.overview-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ============================================================
   GOOGLE BUTTON + BACK LINK + QUICK BTNS (login)
   ============================================================ */
.google-btn-wrap { display: flex; justify-content: center; margin-bottom: 4px; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--white); color: var(--text);
  font-size: .9rem; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.btn-google:hover { background: var(--bg); box-shadow: var(--shadow-sm); }

/* Google Sign-In principal */
.google-signin-wrap { margin-bottom: 20px; }
.btn-google-main {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--white); color: var(--text);
  font-size: .95rem; font-weight: 600; cursor: pointer; transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.btn-google-main:hover {
  border-color: #4285F4; box-shadow: 0 4px 14px rgba(66,133,244,.18);
  transform: translateY(-1px);
}
.btn-google-main:active { transform: translateY(0); }

.google-setup-notice {
  margin-top: 10px; padding: 10px 14px; background: #fffbeb;
  border: 1px solid #fcd34d; border-radius: var(--radius-sm);
  font-size: .82rem; color: #92400e;
  display: flex; align-items: center; gap: 8px;
}

/* Mostrar/ocultar senha */
.password-wrap { position: relative; }
.password-wrap .form-input { padding-right: 44px; }
.btn-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 4px; display: grid; place-items: center; transition: var(--transition);
}
.btn-eye:hover { color: var(--text); }

.back-link { display: inline-block; margin-bottom: 20px; font-size: .85rem; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--green-dark); }

.quick-btn {
  padding: 11px 8px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--white); cursor: pointer; font-size: .875rem; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: var(--transition); color: var(--text);
}
.quick-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-btn.admin { border-color: #7c3aed; color: #6d28d9; background: #faf5ff; }
.quick-btn.admin:hover { background: #7c3aed; color: #fff; }
.quick-btn.user  { border-color: var(--green); color: var(--green-dark); background: var(--green-muted); }
.quick-btn.user:hover  { background: var(--green); color: #fff; }
.quick-btn span  { font-size: 1.4rem; }
.quick-label { font-size: .7rem; opacity: .75; font-weight: 500; }

/* ============================================================
   LANDING PAGE
   ============================================================ */

/* Nav */
.landing-nav {
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.landing-nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 24px;
}
.landing-nav-links { display: flex; gap: 24px; margin-right: auto; margin-left: 32px; }
.landing-nav-links a { color: var(--text-muted); text-decoration: none; font-size: .9rem; font-weight: 500; transition: var(--transition); }
.landing-nav-links a:hover { color: var(--green-dark); }
.landing-nav-cta { display: flex; gap: 10px; align-items: center; }

/* Hero */
.hero-section {
  min-height: calc(100vh - 64px);
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 40%, #e0f2fe 100%);
  display: flex; align-items: center;
  padding: 60px 24px;
  gap: 48px;
  max-width: 1100px; margin: 0 auto;
}
.hero-content { flex: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white); border: 1.5px solid var(--green);
  color: var(--green-dark); border-radius: 20px; padding: 6px 16px;
  font-size: .82rem; font-weight: 700; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.hero-title { font-size: 3rem; font-weight: 900; line-height: 1.15; color: var(--text); margin-bottom: 16px; letter-spacing: -.5px; }
.hero-highlight { color: var(--green-dark); position: relative; }
.hero-highlight::after { content: ''; position: absolute; bottom: 2px; left: 0; right: 0; height: 3px; background: var(--green); border-radius: 2px; }
.hero-subtitle { font-size: 1.1rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 28px; max-width: 480px; }
.hero-btns { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.hero-btn-primary  { padding: 14px 28px; font-size: 1rem; box-shadow: 0 4px 16px rgba(37,211,102,.3); }
.hero-btn-secondary{ padding: 14px 24px; font-size: 1rem; }
.hero-social-proof { display: flex; align-items: center; gap: 12px; }
.social-avatars { display: flex; }
.social-avatars span { width: 30px; height: 30px; background: var(--green); border-radius: 50%; display: grid; place-items: center; font-size: .75rem; border: 2px solid #fff; margin-left: -6px; }
.social-avatars span:first-child { margin-left: 0; }
.hero-social-proof p { font-size: .85rem; color: var(--text-muted); }

/* Phone mockup */
.hero-mockup { flex-shrink: 0; position: relative; }
.mockup-phone {
  width: 220px; height: 380px; background: #1a1a2e;
  border-radius: 32px; padding: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25), 0 0 0 2px rgba(255,255,255,.1);
  position: relative; z-index: 1;
}
.mockup-screen { background: #e5ddd5; border-radius: 22px; overflow: hidden; height: 100%; }
.mockup-wa-header {
  background: var(--green-dark); padding: 10px 12px;
  display: flex; align-items: center; gap: 8px; color: #fff;
}
.mockup-bubble {
  background: #fff; border-radius: 8px 8px 8px 0; padding: 8px 10px;
  font-size: .72rem; line-height: 1.4; color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.1); max-width: 85%;
  display: inline-block;
}
.mockup-bubble.reply { background: var(--green-light); margin-left: auto; border-radius: 8px 8px 0 8px; display: block; }
.mockup-glow {
  position: absolute; inset: -20px; border-radius: 50px;
  background: radial-gradient(circle, rgba(37,211,102,.2) 0%, transparent 70%);
  z-index: 0; filter: blur(20px);
}

/* Section shared */
.section-inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-badge {
  display: inline-block; background: var(--green-muted); color: var(--green-dark);
  border-radius: 20px; padding: 4px 14px; font-size: .8rem; font-weight: 700;
  margin-bottom: 12px;
}
.section-header h2 { font-size: 2rem; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.section-header p  { font-size: 1rem; color: var(--text-muted); max-width: 500px; margin: 0 auto; }

/* Features */
.features-section { padding: 80px 0; background: var(--white); }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px;
}
.feature-card {
  padding: 24px; border: 1.5px solid var(--border); border-radius: var(--radius);
  transition: var(--transition);
}
.feature-card:hover { border-color: var(--green); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-icon-box {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  display: grid; place-items: center; font-size: 1.4rem; margin-bottom: 14px;
}
.feature-icon-box.green  { background: var(--green-muted); }
.feature-icon-box.blue   { background: #eff6ff; }
.feature-icon-box.purple { background: #f5f3ff; }
.feature-icon-box.orange { background: #fff7ed; }
.feature-icon-box.red    { background: #fef2f2; }
.feature-icon-box.teal   { background: #f0fdfa; }
.feature-icon-box.pink   { background: #fdf2f8; }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.feature-card p  { font-size: .875rem; color: var(--text-muted); line-height: 1.6; }

/* How it works */
.how-section { padding: 80px 0; background: var(--bg); }
.steps-grid { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }
.step-card { background: var(--white); border-radius: var(--radius); padding: 28px 24px; text-align: center; border: 1.5px solid var(--border); width: 220px; position: relative; }
.step-number { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: var(--green); color: #fff; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; font-weight: 800; }
.step-icon { font-size: 2rem; margin-bottom: 12px; }
.step-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 6px; }
.step-card p  { font-size: .83rem; color: var(--text-muted); line-height: 1.5; }
.step-arrow { font-size: 1.5rem; color: var(--green); font-weight: 700; }

/* Pricing */
.pricing-section { padding: 80px 0; background: var(--white); }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
.pricing-card {
  border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 28px;
  display: flex; flex-direction: column; position: relative; transition: var(--transition);
}
.pricing-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pricing-card.highlighted { border-color: var(--green); box-shadow: 0 0 0 2px rgba(37,211,102,.2), var(--shadow-md); transform: translateY(-4px); }
.pricing-badge { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: var(--green); color: #fff; padding: 3px 14px; border-radius: 20px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pricing-name  { font-size: 1rem; font-weight: 700; margin-bottom: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.pricing-price { margin-bottom: 20px; }
.price-curr { font-size: 1.1rem; color: var(--text-muted); vertical-align: top; margin-top: 6px; display: inline-block; }
.price-val  { font-size: 2.4rem; font-weight: 900; color: var(--text); line-height: 1; }
.price-per  { font-size: .85rem; color: var(--text-muted); }
.pricing-features { list-style: none; margin-bottom: 24px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.pricing-features li { font-size: .88rem; color: var(--text-muted); display: flex; gap: 8px; align-items: flex-start; }
.btn-full { width: 100%; display: block; text-align: center; }

/* CTA Banner */
.cta-banner { background: linear-gradient(135deg, var(--green-dark), var(--green)); padding: 80px 0; }

/* Footer */
.landing-footer { background: var(--text); padding: 48px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-col-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); margin-bottom: 14px; }
.landing-footer a  { display: block; color: rgba(255,255,255,.7); text-decoration: none; font-size: .875rem; margin-bottom: 10px; transition: var(--transition); }
.landing-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.footer-bottom p { font-size: .83rem; color: rgba(255,255,255,.4); }

/* ============================================================
   CADASTROS PANEL — period filter, plan stats, plan select
   ============================================================ */

/* Stats por plano */
.user-plan-stats {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.plan-stat-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 16px;
  font-size: .875rem; font-weight: 600; transition: var(--transition);
}
.plan-stat-chip .plan-stat-num { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1; }
.plan-stat-chip .plan-stat-lbl { font-size: .75rem; color: var(--text-muted); font-weight: 400; }

/* Filter bar */
.filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Period buttons */
.period-filter { display: flex; gap: 4px; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.period-btn {
  padding: 6px 14px; border: none; background: transparent;
  border-radius: calc(var(--radius-sm) - 2px); font-size: .8rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.period-btn.active { background: var(--green); color: #fff; box-shadow: 0 2px 6px rgba(37,211,102,.3); }
.period-btn:not(.active):hover { background: var(--bg); color: var(--text); }

/* Plan select inline in table */
.plan-select {
  padding: 4px 8px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: .8rem; color: var(--text); background: var(--white);
  cursor: pointer; outline: none; transition: var(--transition);
}
.plan-select:focus { border-color: var(--green); }

/* ============================================================
   PLANS EDITOR (admin)
   ============================================================ */
.plans-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.plan-form-card { background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 24px; position: sticky; top: 88px; }
.plan-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

.plan-card {
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; transition: var(--transition);
}
.plan-card.plan-highlighted { border-color: var(--green); background: var(--green-muted); }
.plan-popular-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #fff; padding: 2px 12px;
  border-radius: 20px; font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.plan-name  { font-size: 1rem; font-weight: 800; color: var(--text); }
.plan-price { font-size: .9rem; color: var(--green-dark); font-weight: 600; margin-bottom: 10px; }
.plan-features-list { list-style: none; display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.plan-features-list li { font-size: .8rem; color: var(--text-muted); }
.plan-card-actions { display: flex; gap: 8px; }

@media (max-width: 768px) {
  .page-login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .create-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .overview-two-col { grid-template-columns: 1fr; }
  .link-item-msg { max-width: 200px; }
  .main-content { padding: 20px 16px; }
  .navbar { padding: 0 16px; }
  .nav-name { display: none; }
  .admin-sidebar { width: 56px; padding: 20px 6px; }
  .sidebar-item span:not(.s-icon) { display: none; }
  .sidebar-section-label { display: none; }
  .admin-content { padding: 20px 16px; }
}
