*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FFFFFF;
  --bg-surface: #F8F8F8;
  --bg-elevated: #F2F2F2;
  --border: #E5E5E5;
  --text: #0D0D0D;
  --text-muted: #666;
  --accent: #0D0D0D;
  --accent-text: #fff;
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #d97706;
  --blue: #2563eb;
  --font: 'Fredoka', -apple-system, sans-serif;
  --radius: 10px;
  --nav-h: 56px;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }

/* NAV */
.nav { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); height: var(--nav-h); display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1.5rem; }
.nav__brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -.3px; margin-right: auto; }
.nav__links { display: flex; align-items: center; gap: .25rem; }
.nav__link { padding: .4rem .75rem; border-radius: 6px; text-decoration: none; color: var(--text-muted);
  font-size: .9rem; transition: background .15s, color .15s; }
.nav__link:hover, .nav__link--active { background: var(--bg-elevated); color: var(--text); }
.nav__link--logout { color: var(--red); }

.main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; }

/* CARDS */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.card + .card, .card.mt { margin-top: 1rem; }
.card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card__header h2 { font-size: 1rem; font-weight: 600; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.stat-card--highlight { border-color: var(--accent); }
.stat-card__value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card__label { font-size: .8rem; color: var(--text-muted); margin-top: .35rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* LIST ITEMS */
.list-item { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--bg-elevated); flex-wrap: wrap; }
.list-item:last-child { border-bottom: none; }
.list-item--sm { font-size: .88rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem 1rem; border-radius: 7px;
  font-family: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; border: none;
  text-decoration: none; transition: opacity .15s, background .15s; }
.btn:hover { opacity: .85; }
.btn--primary { background: var(--accent); color: var(--accent-text); }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--bg-elevated); opacity: 1; }
.btn--danger-ghost { background: transparent; color: var(--red); border: 1px solid #fca5a5; }
.btn--sm { font-size: .82rem; padding: .35rem .75rem; }
.btn--xs { font-size: .78rem; padding: .25rem .55rem; }
.btn--full { width: 100%; justify-content: center; }

/* BADGES */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge--green { background: #dcfce7; color: #15803d; }
.badge--red { background: #fee2e2; color: #b91c1c; }
.badge--gray { background: var(--bg-elevated); color: var(--text-muted); }
.badge--blue { background: #dbeafe; color: #1d4ed8; }
.badge--yellow { background: #fef9c3; color: #92400e; }
.badge--lg { font-size: .88rem; padding: .3rem .8rem; }

/* ALERTS */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert--success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert--error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* FORMS */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  border: 1px solid var(--border); border-radius: 7px; padding: .55rem .75rem;
  font-family: inherit; font-size: .9rem; background: var(--bg); color: var(--text);
  transition: border-color .15s; width: 100%; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--accent); }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.form-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }
.form-check-group { display: flex; flex-wrap: wrap; gap: .75rem; }
.help-text { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* TABLES */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; padding: .6rem .75rem; border-bottom: 2px solid var(--border);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--bg-elevated); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.td-actions { display: flex; gap: .35rem; }
.table-footer { padding: .6rem 0; font-size: .82rem; color: var(--text-muted); }

/* FILTER ROW */
.filter-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-row input, .filter-row select { flex: 1; min-width: 150px; }

/* TAGS */
.tag { display: inline-block; background: var(--bg-elevated); border-radius: 4px; padding: .1rem .4rem;
  font-size: .75rem; margin: .1rem; }
.tag-checks { display: flex; flex-wrap: wrap; gap: .75rem; }

/* PROGRESS */
.progress-bar { height: 8px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; }
.progress-bar--lg { height: 12px; margin: .5rem 0; }
.progress-bar__fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.progress-mini { width: 80px; height: 6px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; display: inline-block; }
.progress-mini__bar { height: 100%; background: var(--accent); border-radius: 99px; }

/* CAMPAIGN */
.campaign-meta { display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat-row { display: flex; gap: 2rem; flex-wrap: wrap; }
.stat-item { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.stat-item strong { font-size: 1.5rem; font-weight: 700; }
.stat-item span { font-size: .78rem; color: var(--text-muted); }
.campaign-message { margin-top: 1rem; }
.campaign-message strong { font-size: .85rem; display: block; margin-bottom: .5rem; }
.stats-row { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }

/* WHATSAPP BUBBLE */
.wa-bubble { background: #dcf8c6; border-radius: 12px 12px 0 12px; padding: .75rem 1rem;
  max-width: 300px; font-size: .9rem; line-height: 1.5; white-space: pre-wrap; }
.wa-bubble__text { }

/* CONTACT PREVIEW */
.contact-preview { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px;
  padding: .75rem 1rem; font-size: .88rem; }

/* LOGIN */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #F5F5F5, #fff); }
.login-card { background: var(--bg); border: 1px solid var(--border); border-radius: 16px;
  padding: 2.5rem; width: 100%; max-width: 380px; }
.login-title { font-size: 1.6rem; font-weight: 700; margin-bottom: .25rem; }
.login-sub { color: var(--text-muted); margin-bottom: 1.5rem; font-size: .9rem; }

/* SURVEYS */
.flow-preview { display: flex; flex-direction: column; gap: .75rem; }
.flow-step { display: flex; gap: .75rem; align-items: flex-start; }
.flow-step__num { width: 24px; height: 24px; background: var(--accent); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; margin-top: .1rem; }
.flow-step__id { font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: .2rem; }
.flow-step__q { font-size: .9rem; white-space: pre-wrap; }
.help-list { padding-left: 1.25rem; font-size: .85rem; line-height: 2; }
.help-list code { background: var(--bg-elevated); padding: .1rem .35rem; border-radius: 4px; font-size: .8rem; }
.code-block { background: var(--bg-elevated); border-radius: 8px; padding: 1rem; font-size: .82rem;
  font-family: monospace; white-space: pre-wrap; overflow-x: auto; }

/* MODALS */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex;
  align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--bg); border-radius: var(--radius); padding: 2rem; width: 100%;
  max-width: 440px; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-bottom: 1.25rem; }

/* UTILITIES */
.mono { font-family: monospace; font-size: .88rem; }
.text-sm { font-size: .82rem; }
.text-muted { color: var(--text-muted); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.empty { color: var(--text-muted); font-size: .9rem; padding: 1rem 0; }
.mt { margin-top: 1rem; }
