/* ================================================================
   TORRANO INDICA — MOBILE FIRST
   ================================================================ */

:root {
  --navy:      #1B3A6B;
  --navy-dk:   #0f2444;
  --gold:      #C8A84B;
  --gold-bg:   #FFF8E7;
  --wa:        #25D366;
  --wa-dk:     #1da950;
  --bg:        #F0F2F5;
  --white:     #FFFFFF;
  --border:    #E1E5EB;
  --text:      #0F172A;
  --muted:     #64748B;
  --r:         12px;
  --r-sm:      8px;
  --shadow:    0 1px 4px rgba(0,0,0,0.09);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---- CONTAINER ---- */
.container { max-width: 600px; margin: 0 auto; padding: 0 16px; }
.section    { padding: 16px 0 32px; }

/* ---- HEADER ---- */
.header { background: var(--navy); padding: 12px 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.header-logo  { font-size: 15px; font-weight: 700; color: white; line-height: 1.3; }
.header-sub   { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 1px; }
.header-pill  {
  background: var(--gold); color: white;
  font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 100px;
  flex-shrink: 0; margin-left: 10px;
}

/* ---- HERO ---- */
.hero { background: var(--navy); padding: 22px 0 20px; color: white; }
.hero-badge {
  display: inline-block; background: var(--gold); color: white;
  font-size: 10px; font-weight: 700; padding: 3px 10px;
  border-radius: 100px; margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.hero h1   { font-size: 26px; font-weight: 800; line-height: 1.15; margin-bottom: 8px; }
.hero h1 .gold { color: var(--gold); }
.hero p    { font-size: 14px; color: rgba(255,255,255,0.78); max-width: 360px; line-height: 1.5; }

/* ---- CARDS ---- */
.card    {
  background: var(--white); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.card-sm { padding: 12px; }

/* ---- SECTION TITLES ---- */
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--navy); }
.section-sub   { font-size: 12px; color: var(--muted); margin-top: -8px; margin-bottom: 12px; }

/* ---- STATS ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat  {
  background: var(--white); border-radius: var(--r-sm);
  padding: 12px 10px; box-shadow: var(--shadow); text-align: center;
}
.stat-value { font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
@media (min-width: 440px) { .stats { grid-template-columns: repeat(4, 1fr); } }

/* ---- HOW IT WORKS ---- */
.steps { display: flex; flex-direction: column; gap: 8px; }
.step  {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; background: var(--white);
  border-radius: var(--r-sm); box-shadow: var(--shadow);
}
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.step strong { display: block; font-size: 13px; font-weight: 700; }
.step p      { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

/* ---- FORMS ---- */
.field       { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: 16px; /* 16px prevents iOS zoom */
  color: var(--text); background: white;
  transition: border-color 0.15s;
  -webkit-appearance: none; appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27,58,107,0.12);
}
.field input::placeholder { color: #adb5bd; font-size: 14px; }
.field-row { display: flex; flex-direction: column; gap: 0; }
@media (min-width: 480px) {
  .field-row { flex-direction: row; gap: 10px; }
  .field-row .field { flex: 1; }
}

/* ---- BUTTONS ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 16px; border-radius: var(--r-sm);
  font-size: 15px; font-weight: 600;
  cursor: pointer; border: 1.5px solid transparent;
  transition: all 0.15s; text-align: center;
  width: 100%; line-height: 1.2; min-height: 48px; /* touch target */
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled  { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn:active    { transform: scale(0.98); }

.btn-primary   { background: var(--navy); color: white; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-dk); }
.btn-wa        { background: var(--wa); color: white; border-color: var(--wa); }
.btn-wa:hover  { background: var(--wa-dk); }
.btn-secondary { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: rgba(27,58,107,0.06); }
.btn-ghost     { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger    { background: #ef4444; color: white; border-color: #ef4444; }
.btn-success   { background: #16a34a; color: white; border-color: #16a34a; }

.btn-sm  { padding: 9px 14px; font-size: 13px; min-height: 40px; width: auto; }
.btn-xs  { padding: 6px 10px; font-size: 12px; min-height: 34px; width: auto; }

.btn-group     { display: flex; flex-direction: column; gap: 8px; }
.btn-group.row { flex-direction: row; }
.btn-group.row .btn { flex: 1; width: auto; }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-pendente   { background: #f3f4f6; color: #374151; }
.badge-aprovado   { background: #dbeafe; color: #1e3a8a; }
.badge-em_contato { background: #fef3c7; color: #78350f; }
.badge-negociacao { background: #ede9fe; color: #4c1d95; }
.badge-fechou     { background: #dcfce7; color: #14532d; }
.badge-perdido    { background: #fee2e2; color: #7f1d1d; }
.badge-self       { background: #d1fae5; color: #065f46; }
.badge-admin      { background: #dbeafe; color: #1e3a8a; }

/* ---- REFERRAL FORM ROWS ---- */
.ref-row        { background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 12px; margin-bottom: 10px; }
.ref-row-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ref-row-num    { font-size: 12px; font-weight: 700; color: var(--navy); }
.btn-remove     { background: none; border: none; color: #ef4444; font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 4px; }

/* ---- REFERRAL LIST ITEMS ---- */
.ref-item           { padding: 12px; border-bottom: 1px solid var(--border); }
.ref-item:last-child { border-bottom: none; }
.ref-item-top   { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ref-item-name  { font-weight: 600; font-size: 14px; }
.ref-item-phone { font-size: 12px; color: var(--muted); }
.ref-item-rel   { display: inline-block; font-size: 11px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); padding: 2px 7px; border-radius: 100px; margin-top: 3px; }

/* ---- STATUS TRACK ---- */
.status-track  { display: flex; gap: 3px; margin-top: 8px; }
.status-dot    { flex: 1; height: 3px; border-radius: 2px; background: var(--border); }
.status-dot.active { background: var(--navy); }
.status-dot.done   { background: #16a34a; }
.status-labels { display: flex; justify-content: space-between; margin-top: 3px; }
.status-labels span { font-size: 9px; color: var(--muted); }

/* ---- ADMIN NAV ---- */
.admin-nav  {
  background: white; border-bottom: 1px solid var(--border);
  padding: 8px 0; position: sticky; top: 0; z-index: 10;
}
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px 2px; -webkit-overflow-scrolling: touch; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab  {
  padding: 7px 13px; border-radius: 100px;
  font-size: 13px; font-weight: 500;
  border: none; background: none; cursor: pointer;
  color: var(--muted); white-space: nowrap; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.admin-tab.active { background: var(--navy); color: white; }
.pending-count { background: #ef4444; color: white; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 100px; margin-left: 3px; }

/* ---- ALERTS ---- */
.alert         { padding: 11px 13px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ---- RULES BOX ---- */
.rules    { background: var(--gold-bg); border: 1.5px solid #fde68a; border-radius: var(--r-sm); padding: 14px; }
.rules h3 { font-size: 13px; font-weight: 700; color: #78350f; margin-bottom: 9px; }
.rule-item { display: flex; gap: 7px; font-size: 12px; color: #78350f; margin-bottom: 6px; align-items: flex-start; line-height: 1.4; }

/* ---- LINK BOX ---- */
.link-box  {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px;
}
.link-text { flex: 1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn  {
  flex-shrink: 0; padding: 6px 12px;
  border: 1.5px solid var(--navy); border-radius: 6px;
  color: var(--navy); background: none;
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.copy-btn.copied { background: var(--navy); color: white; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
}
.modal {
  background: white; border-radius: var(--r) var(--r) 0 0;
  padding: 20px 16px 32px; /* extra bottom for iOS home bar */
  width: 100%; max-width: 600px;
  max-height: 88vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; color: var(--navy); }
.modal-sub   { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* ---- WA PREVIEW ---- */
.wa-preview {
  background: #e7f9e7; border: 1.5px solid #86efac;
  border-radius: var(--r-sm); padding: 12px;
  font-size: 13px; line-height: 1.65;
  white-space: pre-wrap; font-family: inherit;
}

/* ---- EMPTY STATE ---- */
.empty      { text-align: center; padding: 28px 16px; }
.empty-icon { font-size: 32px; margin-bottom: 8px; }
.empty h3   { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.empty p    { font-size: 13px; color: var(--muted); }

/* ---- SUCCESS ---- */
.success-card     { text-align: center; padding: 24px 12px; }
.success-icon-box {
  width: 56px; height: 56px; border-radius: 50%;
  background: #dcfce7; display: flex;
  align-items: center; justify-content: center;
  font-size: 26px; margin: 0 auto 14px;
}
.success-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.success-card p  { color: var(--muted); margin-bottom: 18px; font-size: 14px; }

/* ---- PASSWORD GATE ---- */
.gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--navy); padding: 20px;
}
.gate-card {
  background: white; border-radius: var(--r);
  padding: 28px 20px; width: 100%; max-width: 320px;
  text-align: center; box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.gate-card h1  { font-size: 20px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.gate-card .sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

/* ---- CHIPS ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip  {
  padding: 5px 12px; border-radius: 100px; font-size: 12px;
  background: var(--bg); border: 1.5px solid var(--border);
  color: var(--text); cursor: pointer; font-weight: 500;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.chip.active { background: var(--navy); color: white; border-color: var(--navy); }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: #0f172a; color: white;
  padding: 11px 20px; border-radius: var(--r-sm);
  font-size: 14px; z-index: 999;
  pointer-events: none; opacity: 0;
  transition: opacity 0.2s;
  max-width: calc(100vw - 32px);
  text-align: center; white-space: nowrap;
  /* safe area for iOS */
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
}
.toast.show { opacity: 1; }

/* ---- DIVIDER ---- */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ---- PIPE CARD ---- */
.pipe-card { background: white; border-radius: var(--r-sm); border: 1px solid var(--border); padding: 12px; margin-bottom: 10px; }
.pipe-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.pa { padding: 8px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; border: none; cursor: pointer; min-height: 36px; }
.pa-wa    { background: var(--wa); color: white; }
.pa-adv   { background: var(--navy); color: white; }
.pa-ghost { background: #f3f4f6; color: #374151; border: 1px solid var(--border); }

/* ---- UTILITIES ---- */
.hidden  { display: none !important; }
.flex    { display: flex; }
.flex-1  { flex: 1; min-width: 0; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-14  { margin-bottom: 14px; }
.mb-16  { margin-bottom: 16px; }
.mb-20  { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 12px; }
.text-muted  { color: var(--muted); }
.text-gold   { color: var(--gold); }
.text-navy   { color: var(--navy); }
.text-green  { color: #16a34a; }
.bold        { font-weight: 700; }
.w-full      { width: 100%; }
.pb-safe     { padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
