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

/* ── Design tokens ── */
:root {
  --bg:        #f5f4f0;
  --surface:   #ffffff;
  --border:    #e2e0da;
  --text:      #1a1916;
  --muted:     #7a7870;
  --accent:    #1a1916;

  --high-bg:   #d4edda;
  --high-text: #1a5c2a;
  --high-dot:  #2e9950;

  --mid-bg:    #fef3cd;
  --mid-text:  #7a5200;
  --mid-dot:   #e6a817;

  --low-bg:    #ebebeb;
  --low-text:  #555;
  --low-dot:   #aaa;

  --av0: #dbeafe; --av0t: #1e40af;
  --av1: #d1fae5; --av1t: #065f46;
  --av2: #fce7f3; --av2t: #9d174d;
  --av3: #ede9fe; --av3t: #5b21b6;
  --av4: #ffedd5; --av4t: #9a3412;

  --radius:    10px;
  --radius-sm: 6px;
}

/* ── Body ── */
body {
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.logo span { color: var(--muted); font-weight: 400; }

/* ── Header nav ── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding-left: 1.25rem;
  margin-left: 1rem;
  border-left: 1px solid var(--border);
}

.header-nav a {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.header-nav a:hover  { background: var(--bg); border-color: var(--border); color: var(--text); }
.header-nav a.active { background: var(--bg); border-color: var(--text);   color: var(--text); }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-ctrl-btn {
  font-size: 11px;
  font-weight: 600;
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.header-ctrl-btn:hover { border-color: var(--text); color: var(--text); }

.lang-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
  transition: border-color 0.15s;
}
.lang-wrapper:focus-within { border-color: var(--text); }

.lang-icon { font-size: 12px; line-height: 1; }

.lang-select {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

.header-tag {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 100px;
  white-space: nowrap;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* ── Avatars ── */
.av0 { background: var(--av0); color: var(--av0t); }
.av1 { background: var(--av1); color: var(--av1t); }
.av2 { background: var(--av2); color: var(--av2t); }
.av3 { background: var(--av3); color: var(--av3t); }
.av4 { background: var(--av4); color: var(--av4t); }

/* ════════════════════════════════════════════════════════════
   Shared: view.php + users.php
   ════════════════════════════════════════════════════════════ */

/* ── Layout ── */
.layout {
  display: flex;
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem;
  gap: 1.5rem;
  align-items: flex-start;
}

/* ── Sidebar ── */
aside {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 72px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 14px 16px 8px;
}

.sidebar-search-wrap { padding: 0 10px 8px; }

.sidebar-search {
  width: 100%;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.sidebar-search:focus        { border-color: var(--text); }
.sidebar-search::placeholder { color: var(--muted); }

.sidebar-no-results {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 8px 16px 14px;
}

.sidebar-demo-notice {
  font-size: 10.5px;
  color: var(--mid-text);
  background: var(--mid-bg);
  border-top: 1px solid #f5d97a;
  padding: 7px 16px;
  text-align: center;
}

/* ── Main ── */
main { flex: 1; min-width: 0; }

/* ── Empty state ── */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4rem 2rem;
  text-align: center;
  color: var(--muted);
}
.empty-state h2 { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 14px; }

/* ── Contacts count badge ── */
.contacts-count {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 100px;
}
.contacts-count strong { color: var(--text); }

/* ── No results ── */
.no-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.no-results-icon  { font-size: 28px; color: var(--border); margin-bottom: 12px; line-height: 1; }
.no-results-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.no-results p      { margin-bottom: 6px; }
.no-results strong { color: var(--text); }
.no-results-hint  {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

/* ── Cards ── */
.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1rem;
}

.user-row { display: flex; align-items: flex-start; gap: 12px; }

/* ── Score ── */
.score-block  { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.score-number { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.score-number.high   { color: var(--high-text); }
.score-number.medium { color: var(--mid-text); }
.score-number.low    { color: var(--low-text); }

.score-pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 100px; text-transform: uppercase; letter-spacing: 0.04em; }
.score-pill.high   { background: var(--high-bg); color: var(--high-text); }
.score-pill.medium { background: var(--mid-bg);  color: var(--mid-text);  }
.score-pill.low    { background: var(--low-bg);  color: var(--low-text);  }

/* ── Meta row ── */
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 1rem; }
.meta-item  { background: var(--bg); border-radius: var(--radius-sm); padding: 8px 12px; }
.meta-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.meta-value { font-size: 13px; font-weight: 500; }

/* ── Breakdown ── */
.breakdown       { border-top: 1px solid var(--border); padding-top: 12px; }
.breakdown-title { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.breakdown-items { display: flex; flex-wrap: wrap; gap: 6px; }
.breakdown-item  { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); padding: 3px 9px; border-radius: 100px; }
.breakdown-contact { color: var(--text); font-weight: 500; }

.breakdown-section + .breakdown-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.breakdown-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.breakdown-sort { display: flex; gap: 3px; }

.bsort {
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.bsort:hover  { border-color: var(--text); color: var(--text); }
.bsort.active { border-color: var(--text); color: var(--text); }

/* ── Stage badge ── */
.stage-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.stage-prospectando    { background: var(--low-bg);  color: var(--low-text); }
.stage-en-conversacion { background: var(--mid-bg);  color: var(--mid-text); }
.stage-mandato         { background: var(--high-bg); color: var(--high-text); }
.stage-cerrado         { background: var(--text);    color: var(--surface); }
.stage-descartado      { background: #fff5f5;        color: #991b1b; }

/* ── Interaction type badge (breakdown) ── */
.itype {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
}
.itype-reunion { background: var(--high-bg); color: var(--high-text); }
.itype-llamada { background: var(--mid-bg);  color: var(--mid-text); }
.itype-email   { background: var(--low-bg);  color: var(--low-text); }
.itype-evento  { background: var(--bg); color: var(--text); border: 1px solid var(--border); }

/* ── Error ── */
.error-box { background: #fff5f5; border: 1px solid #fecaca; border-radius: var(--radius); padding: 1rem 1.5rem; color: #991b1b; font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 680px) {
  .layout { flex-direction: column; padding: 1rem; }
  aside   { width: 100%; position: static; }
  .meta   { grid-template-columns: 1fr 1fr; }
}

/* ── Hamburger button (hidden on desktop) ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
header.nav-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
header.nav-open .hamburger span:nth-child(2) { opacity: 0; }
header.nav-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  header {
    padding: 0 1rem;
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    row-gap: 0;
  }

  .hamburger { display: flex; }

  .header-nav {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    padding: 8px 0 12px;
    margin-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    gap: 2px;
  }

  header.nav-open .header-nav { display: flex; }

  .header-nav a {
    font-size: 13px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    border-color: transparent;
  }

  .header-right {
    gap: 6px;
  }

  .header-tag { display: none; }

  /* ── View responsive ── */
  .company-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .company-header-left { flex-wrap: wrap; }
}
