/* ============================================================
   MASTRES IT — AsistenteOS CSS
   Mismo lenguaje visual que el CRM: Red Hat Display + Be Vietnam Pro
   Navy #212d39 · Gold #b2b09f · Cream #f5f4f0 · Editorial
   Mobile-first, táctil, funcional.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Display:wght@300;400;500;600;700&family=Be+Vietnam+Pro:wght@300;400;500;600;700&display=swap');

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

:root {
  /* Marca Mastres IT — alineada con theme.css del CRM */
  --brand-navy:      #212d39;
  --brand-accent:    #b2b09f;
  --brand-navy-2:    #161e27;
  --brand-accent-dk: #8e8c7c;

  /* Alias semánticos */
  --navy:       var(--brand-navy);
  --navy-light: #2a3748;
  --gold:       var(--brand-accent);
  --gold-dk:    var(--brand-accent-dk);
  --gold-light: #cac9b8;

  /* Estados */
  --green:     #2e7d32;
  --green-bg:  rgba(46,125,50,0.08);
  --amber:     #b45309;
  --amber-bg:  rgba(180,83,9,0.08);
  --red:       #c62828;
  --red-bg:    rgba(198,40,40,0.08);
  --blue:      #0369a1;
  --blue-bg:   rgba(3,105,161,0.08);

  /* Producto */
  --border:     rgba(33,45,57,0.10);
  --bg:         #f5f4f0;
  --surface:    #ffffff;
  --text:       #212d39;
  --text-muted: #6b7280;

  /* Tipografía */
  --font-head: 'Red Hat Display', system-ui, sans-serif;
  --font-body: 'Be Vietnam Pro', system-ui, sans-serif;

  /* Forma */
  --radius:    8px;
  --radius-sm: 6px;
  --ease:      cubic-bezier(0.22,1,0.36,1);

  /* Táctil */
  --tap:         48px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

html { -webkit-font-smoothing: antialiased; height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom, 16px));
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--navy);
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
}
.topbar-mark {
  width: 30px; height: 30px;
  background: rgba(178,176,159,.20);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  font-weight: 500; font-size: 10px; color: var(--gold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.topbar-name {
  font-family: var(--font-head);
  font-size: 13px; font-weight: 400;
  color: #fff;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.topbar-name span { opacity: .55; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: var(--tap); height: var(--tap);
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.08);
  border: none; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.70); font-size: 18px; cursor: pointer;
  position: relative;
  transition: background .15s;
}
.topbar-btn:active { background: rgba(255,255,255,.14); }
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--red); border-radius: 50%;
  border: 1.5px solid var(--navy);
}
.plan-chip {
  padding: 3px 9px; border-radius: 20px;
  font-family: var(--font-head);
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  background: rgba(178,176,159,.18); color: var(--gold);
  border: 1px solid rgba(178,176,159,.25);
}
.plan-chip.trial {
  background: rgba(180,83,9,.12);
  color: #b45309;
  border-color: rgba(180,83,9,.25);
}

/* ── PAGE BODY ──────────────────────────────────────────── */
.page-body {
  padding-top: 56px;
  min-height: 100vh;
}
.page-section {
  padding: 20px 16px 0;
}
.page-title-bar {
  padding: 18px 16px 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.page-title-bar h1 {
  font-family: var(--font-head);
  font-size: 18px; font-weight: 400;
  color: var(--navy);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.page-sub {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
}

/* ── BOTTOM NAV ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(33,45,57,.20);
}
.bnav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  text-decoration: none;
  color: rgba(255,255,255,.35);
  font-family: var(--font-head);
  font-size: 8px; font-weight: 500;
  letter-spacing: 0.10em; text-transform: uppercase;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: color .15s;
  position: relative;
}
.bnav-item.active { color: var(--gold); }
.bnav-item.active .bnav-ico svg { stroke: var(--gold); }
.bnav-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  position: relative;
}
.bnav-badge {
  position: absolute;
  top: 4px; right: calc(50% - 18px);
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 600;
  padding: 1px 5px; border-radius: 10px;
  min-width: 16px; text-align: center;
}

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(33,45,57,.05);
  overflow: hidden;
  margin-bottom: 12px;
}
.card-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-header h3 {
  font-family: var(--font-head);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.20em; text-transform: uppercase;
  color: var(--text-muted);
  flex: 1;
}
.card-body { padding: 14px 16px; }

/* ── CONTACT CARD ────────────────────────────────────────── */
.contact-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(33,45,57,.04);
  margin-bottom: 10px;
  overflow: hidden;
}
.contact-card-header {
  padding: 14px 16px 10px;
  display: flex; align-items: flex-start; gap: 12px;
}
.contact-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-head);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name {
  font-family: var(--font-head);
  font-size: 15px; font-weight: 400;
  color: var(--navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.01em;
}
.contact-meta {
  font-size: 12px; color: var(--text-muted);
  margin-top: 2px;
}
.contact-badge {
  padding: 3px 9px; border-radius: 20px;
  font-family: var(--font-head);
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.10em; text-transform: uppercase;
  flex-shrink: 0;
  border: 1px solid;
}
.badge-d0   { background: rgba(180,83,9,.08);  color: #b45309; border-color: rgba(180,83,9,.2); }
.badge-d3   { background: rgba(3,105,161,.08); color: #0369a1; border-color: rgba(3,105,161,.2); }
.badge-d7   { background: rgba(109,40,217,.08);color: #6d28d9; border-color: rgba(109,40,217,.2); }
.badge-react{ background: rgba(157,23,77,.08); color: #9d174d; border-color: rgba(157,23,77,.2); }
.badge-resp { background: rgba(46,125,50,.08); color: #2e7d32; border-color: rgba(46,125,50,.2); }

.contact-msg {
  margin: 0 16px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.contact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px 14px;
}
.contact-actions.three {
  grid-template-columns: 2fr 1fr 1fr;
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-head);
  font-size: .72rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s var(--ease);
  padding: 0 14px;
}
.btn:active { transform: scale(.97); }
.btn-wa {
  background: #25D366; color: #fff;
  font-size: .75rem;
  border-color: #25D366;
}
.btn-wa:active { background: #1da851; }
.btn-done {
  background: rgba(46,125,50,.08);
  color: #2e7d32;
  border-color: rgba(46,125,50,.25);
}
.btn-skip {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:active { background: var(--navy-light); }
.btn-gold { background: transparent; color: var(--gold-dk); border-color: rgba(178,176,159,.5); }
.btn-gold:hover { background: rgba(178,176,159,.10); }
.btn-accent { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn-sm { min-height: 36px; font-size: .68rem; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

/* ── STATS ROW ──────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 16px;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(33,45,57,.04);
}
.stat-num {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 300;
  color: var(--navy); line-height: 1;
}
.stat-label {
  font-family: var(--font-head);
  font-size: 8px; color: var(--text-muted);
  margin-top: 4px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.stat-box.highlight { border-color: var(--navy); background: var(--navy); }
.stat-box.highlight .stat-num,
.stat-box.highlight .stat-label { color: #fff; }

/* ── SECTION HEADER ─────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
}
.section-header h2 {
  font-family: var(--font-head);
  font-size: 9px; font-weight: 500;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.22em;
}
.section-header a {
  font-family: var(--font-head);
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold-dk); text-decoration: none;
  opacity: .8; transition: opacity .12s;
}
.section-header a:hover { opacity: 1; }

/* ── FORMS ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-family: var(--font-head);
  font-size: 10px; font-weight: 500;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.14em; margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--surface); color: var(--text);
  outline: none; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(178,176,159,.22);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }

/* ── ALERT ──────────────────────────────────────────────── */
.alert {
  padding: 12px 15px; border-radius: var(--radius-sm);
  font-size: 14px; margin: 0 16px 12px;
  border: 1px solid;
}
.alert-ok  { background: var(--green-bg); color: #2e7d32; border-color: rgba(46,125,50,.25); }
.alert-err { background: var(--red-bg);   color: #c62828; border-color: rgba(198,40,40,.25); }
.alert-warn{ background: var(--amber-bg); color: #b45309; border-color: rgba(180,83,9,.25); }

/* ── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .ico { font-size: 40px; margin-bottom: 14px; opacity: .45; }
.empty-state h3 {
  font-family: var(--font-head);
  font-size: 16px; font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--navy); margin-bottom: 6px;
}
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ── FAB ────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(70px + var(--safe-bottom) + 12px);
  right: 16px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(33,45,57,.30);
  text-decoration: none;
  z-index: 99;
  border: none; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.fab:active { transform: scale(.93); }

/* ── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(33,45,57,.55);
  z-index: 200;
  display: flex; align-items: flex-end;
  backdrop-filter: blur(2px);
}
.modal-sheet {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0 0 calc(24px + var(--safe-bottom));
  border-top: 2px solid var(--gold);
}
.modal-handle {
  width: 36px; height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin: 14px auto 16px;
}
.modal-header {
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 {
  font-family: var(--font-head);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--navy);
}
.modal-close {
  width: 30px; height: 30px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 50%; font-size: 15px; cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.modal-body { padding: 16px; }

/* ── TABS ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
  padding: 0 16px;
  gap: 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-item {
  padding: 12px 14px;
  font-family: var(--font-head);
  font-size: .68rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.tab-item.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
}

/* ── BADGES (inline) ────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-family: var(--font-head);
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.10em; text-transform: uppercase;
  border: 1px solid;
}
.badge-green  { background: var(--green-bg);  color: #2e7d32; border-color: rgba(46,125,50,.22); }
.badge-amber  { background: var(--amber-bg);  color: #b45309; border-color: rgba(180,83,9,.22); }
.badge-red    { background: var(--red-bg);    color: #c62828; border-color: rgba(198,40,40,.22); }
.badge-blue   { background: var(--blue-bg);   color: #0369a1; border-color: rgba(3,105,161,.22); }
.badge-navy   { background: rgba(33,45,57,.08); color: var(--navy); border-color: var(--border); }
.badge-gold   { background: rgba(178,176,159,.15); color: var(--gold-dk); border-color: rgba(178,176,159,.35); }

/* ── UTILS ──────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 8px 0; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.fw-bold { font-weight: 600; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.gap-8 { display: flex; flex-direction: column; gap: 8px; }

/* ── DESKTOP FALLBACK ───────────────────────────────────── */
@media (min-width: 600px) {
  body { max-width: 480px; margin: 0 auto; }
  .topbar { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .fab { right: calc(50% - 480px/2 + 16px); }
  .modal-overlay { max-width: 480px; left: 50%; transform: translateX(-50%); }
}
