/* ══════════════════════════════════════════════
   PEI Portal — Hoja de estilos principal
   Colores: #F6A519 (brand) · #444444 (dark)
══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #F6A519;
  --brand-dark:  #d4890e;
  --brand-light: #fff8e7;
  --dark:        #444444;
  --sidebar-bg:  #2c2c2c;
  --sidebar-w:   240px;
  --bg:          #f4f5f7;
  --card:        #ffffff;
  --border:      #e2e8f0;
  --text:        #444444;
  --muted:       #7a8599;
  --success:     #10b981;
  --danger:      #ef4444;
  --radius:      12px;
  --shadow:      0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --topbar-h:    60px;
}

html, body { height: 100%; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* Logo SVG */
.pei-logo    { display: block; height: 44px; width: auto; margin-bottom: 22px; }
.pei-logo-sm { display: block; height: 30px; width: auto; }

/* En sidebar el logo necesita adaptarse al fondo oscuro */
.sidebar-brand .pei-logo,
.sidebar-brand .pei-logo-sm { height: 34px; margin-bottom: 0; }
/* Hacer texto oscuro del logo visible en sidebar oscuro */
.sidebar-brand svg text[fill="#444444"],
.sidebar-brand svg text[fill="#444"] { fill: #ffffff !important; }

.lnk { color: var(--brand); text-decoration: underline; cursor: pointer; }

/* ══════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════ */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #2c2c2c 0%, #444 100%);
}
.login-card {
  background: #fff; border-radius: 20px; padding: 44px 40px;
  width: 440px; max-width: 94vw;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.login-logo { display: block; height: 44px; margin-bottom: 24px; }
.login-card h2 { font-size: 21px; font-weight: 700; margin-bottom: 4px; }
.login-card > p { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.login-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.alert-error   { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }

/* ══════════════════════════════════════════════
   FORM BASE
══════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--dark); }
.form-group input,
.form-group select,
.form-group textarea,
input[type=text], input[type=email], input[type=password],
select, textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; font-family: inherit;
  background: #fff; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light);
}
textarea { resize: vertical; min-height: 80px; }

/* ══════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 700;
  cursor: pointer; border: 1.5px solid transparent; transition: .18s;
  text-decoration: none; white-space: nowrap;
}
.btn-primary, .btn.btn-primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
  width: auto;
}
.btn-primary:hover, .btn.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline, .btn.btn-outline {
  background: #fff; color: var(--dark); border-color: var(--border);
}
.btn-outline:hover, .btn.btn-outline:hover {
  border-color: var(--brand); color: var(--brand); background: var(--brand-light);
}
.btn-success, .btn.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger, .btn.btn-danger   { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-sm, .btn.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
/* Login submit — full width */
.field .btn-primary, form > .btn-primary { width: 100%; padding: 12px; font-size: 15px; }
.btn-text { background: none; border: none; color: var(--brand); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }

/* ══════════════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════════════ */
body.app-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform .25s;
  overflow: hidden;
}
.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-brand svg { height: 36px; width: auto; }

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Nav links generados por JS */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  white-space: nowrap;
}
.nav-link:hover  { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: var(--brand); color: #fff; }
.nav-icon  { font-size: 16px; flex-shrink: 0; }
.nav-label { flex: 1; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.btn-logout {
  width: 100%; padding: 9px 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px; color: rgba(255,255,255,.5); font-size: 13px;
  cursor: pointer; text-align: left; transition: .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ─── Main wrapper ─── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ─── Topbar ─── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.sidebar-toggle {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--dark); padding: 6px;
  border-radius: 6px; transition: .15s; display: none;
}
.sidebar-toggle:hover { background: var(--bg); }

.topbar-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
}

/* Notificaciones */
.notif-wrapper { position: relative; }
.topbar-icon-btn {
  position: relative; width: 38px; height: 38px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: .15s;
}
.topbar-icon-btn:hover { background: var(--brand-light); border-color: var(--brand); }

.notif-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 1px 5px;
  border: 2px solid #fff;
  min-width: 18px; text-align: center;
}

.notif-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 320px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  z-index: 400; display: none;
}
.notif-dropdown.open { display: block; }
.notif-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; font-weight: 700;
}
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: .15s; font-size: 13px;
}
.notif-item:hover   { background: var(--bg); }
.notif-item.unread  { background: var(--brand-light); }
.notif-item p       { margin-bottom: 3px; }
.notif-item small   { color: var(--muted); font-size: 11px; }
.notif-empty { padding: 20px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* User menu */
.user-menu-wrapper { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: 9px;
  background: none; border: 1px solid var(--border);
  border-radius: 10px; padding: 5px 12px 5px 5px;
  cursor: pointer; transition: .15s;
}
.user-menu-btn:hover { background: var(--bg); border-color: var(--brand); }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-info { display: flex; flex-direction: column; text-align: left; }
.topbar-info span  { font-size: 13px; font-weight: 600; line-height: 1.2; }
.topbar-info small { font-size: 11px; color: var(--muted); }

.user-menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 170px; z-index: 400; display: none;
  overflow: hidden;
}
.user-menu-dropdown.open { display: block; }
.user-menu-dropdown a {
  display: block; padding: 11px 16px;
  font-size: 13px; color: var(--text); text-decoration: none;
  transition: .15s;
}
.user-menu-dropdown a:hover { background: var(--bg); color: var(--brand); }

/* ══════════════════════════════════════════════
   PAGES
══════════════════════════════════════════════ */
.page-content { padding: 24px; flex: 1; min-width: 0; }

.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.page-header h2 { font-size: 20px; font-weight: 800; color: var(--dark); }

.empty-state, .error-state {
  text-align: center; color: var(--muted);
  padding: 40px 20px; font-size: 14px;
}

/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 16px;
}
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }

/* ══════════════════════════════════════════════
   HOME — Stats
══════════════════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; text-align: center; cursor: pointer; transition: .18s;
}
.stat-card:hover { border-color: var(--brand); box-shadow: 0 4px 20px rgba(246,165,25,.15); }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-num  { font-size: 32px; font-weight: 800; color: var(--brand); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Score bar */
.score-bar { height: 10px; background: var(--border); border-radius: 999px; margin: 10px 0 14px; overflow: hidden; }
.score-fill { height: 100%; background: var(--brand); border-radius: 999px; transition: width .5s; }

/* ── Plan Free Banner ── */
.plan-banner {
  background: linear-gradient(135deg, #2c2c2c, #444);
  border-radius: var(--radius); padding: 22px 24px;
  color: #fff; margin-bottom: 18px;
}
.plan-badge {
  display: inline-block; background: var(--brand);
  border-radius: 999px; padding: 3px 13px;
  font-size: 11px; font-weight: 800; margin-bottom: 8px;
}
.plan-banner p { font-size: 13px; opacity: .85; margin-bottom: 14px; }
.plan-counters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.plan-counter {
  background: rgba(255,255,255,.1); border-radius: 10px;
  padding: 12px 16px; text-align: center; min-width: 80px;
}
.counter-num   { display: block; font-size: 20px; font-weight: 800; color: var(--brand); }
.counter-label { display: block; font-size: 11px; opacity: .7; margin-top: 2px; }

/* Diagnosis CTA on home */
.diag-cta { background: var(--brand-light); border: 1.5px solid var(--brand); }
.diag-cta h3 { color: var(--brand); }

/* ══════════════════════════════════════════════
   CHAT
══════════════════════════════════════════════ */
.chat-layout {
  display: flex; height: calc(100vh - var(--topbar-h) - 48px);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: #fff;
}

.chat-sidebar {
  width: 220px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  background: #fff;
}
.chat-sidebar-header {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.btn-new-chat {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand-light); border: 1.5px solid var(--brand);
  color: var(--brand); font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: .15s; flex-shrink: 0;
}
.btn-new-chat:hover { background: var(--brand); color: #fff; }

/* Estado vacío del chat */
.chat-empty {
  padding: 32px 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.chat-empty-icon { font-size: 36px; opacity: .4; }
.chat-empty p { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Item de nueva conversación en modal */
.new-chat-user {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); cursor: pointer;
  transition: .15s; background: #fff;
}
.new-chat-user:hover {
  border-color: var(--brand); background: var(--brand-light);
}
.contact-item {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; gap: 9px;
  transition: background .15s;
}
.contact-item:hover  { background: var(--bg); }
.contact-item.active { background: var(--brand-light); border-left: 3px solid var(--brand); }
.contact-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-info strong { display: block; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-info span   { font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.unread-badge {
  background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 700; padding: 2px 6px; flex-shrink: 0;
}

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 700; background: #fff;
  flex-shrink: 0;
}
.chat-messages {
  flex: 1; padding: 16px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  background: #f8f9fb;
}

/* Messages */
.msg { max-width: 70%; display: flex; flex-direction: column; }
.msg.mine  { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; }
.msg p {
  padding: 9px 13px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; word-break: break-word;
}
.msg.mine  p { background: var(--brand); color: #fff; border-radius: 12px 0 12px 12px; }
.msg.theirs p { background: #fff; border: 1px solid var(--border); border-radius: 0 12px 12px 12px; }
.msg small { font-size: 10px; color: var(--muted); margin-top: 3px; }
.file-msg {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px; color: var(--brand);
  text-decoration: none;
}
.file-msg:hover { background: var(--brand-light); }

.chat-input-area {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center; background: #fff;
  flex-shrink: 0;
}
#chat-text {
  flex: 1; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 13px; outline: none; font-family: inherit;
}
#chat-text:focus { border-color: var(--brand); }
.file-upload-btn {
  width: 36px; height: 36px; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; flex-shrink: 0; transition: .15s;
}
.file-upload-btn:hover { background: var(--brand-light); border-color: var(--brand); }
.btn-send { padding: 9px 16px; }

/* ══════════════════════════════════════════════
   TICKETS
══════════════════════════════════════════════ */
.ticket-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  margin-bottom: 12px; box-shadow: var(--shadow);
  border-left: 4px solid var(--border);
}
.ticket-card.status-abierto     { border-left-color: var(--brand); }
.ticket-card.status-en_progreso { border-left-color: #3b82f6; }
.ticket-card.status-resuelto    { border-left-color: var(--success); }

.ticket-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px; gap: 10px;
}
.ticket-header h4 { font-size: 14px; font-weight: 700; }
.ticket-priority  { font-size: 12px; font-weight: 600; white-space: nowrap; }
.ticket-card p    { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.ticket-meta {
  display: flex; align-items: center; gap: 12px; font-size: 12px;
  color: var(--muted); margin-bottom: 10px; flex-wrap: wrap;
}
.ticket-status {
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--brand-light); color: var(--brand);
}
.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ticket-actions select {
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 12px; cursor: pointer;
}

/* ══════════════════════════════════════════════
   APROBACIONES
══════════════════════════════════════════════ */
.approval-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  margin-bottom: 12px; box-shadow: var(--shadow);
}
.approval-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px; gap: 10px;
}
.approval-header h4 { font-size: 14px; font-weight: 700; }
.status-badge-pending  { background: #fff3cd; color: #92400e; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-badge-approved { background: #d1fae5; color: #065f46; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-badge-rejected { background: #fee2e2; color: #991b1b; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-badge-revision { background: #dbeafe; color: #1e40af; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.approval-card p { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.approval-comment {
  background: var(--bg); border-radius: 8px; padding: 10px 14px;
  font-size: 13px; margin-bottom: 10px;
}
.approval-file { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--brand); text-decoration: none; margin-bottom: 10px; }
.approval-meta { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════
   CLIENTES
══════════════════════════════════════════════ */
.client-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  margin-bottom: 10px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.client-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.client-info { flex: 1; min-width: 0; }
.client-info strong { display: block; font-size: 14px; font-weight: 700; }
.client-info span   { display: block; font-size: 12px; color: var(--muted); }
.plan-tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; background: var(--brand-light); color: var(--brand);
  margin-top: 3px; text-transform: uppercase;
}
.client-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ══════════════════════════════════════════════
   FACTURACIÓN
══════════════════════════════════════════════ */
.invoice-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.invoice-table th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--bg); border-bottom: 2px solid var(--border); }
.invoice-table td { padding: 13px 14px; border-bottom: 1px solid var(--border); }
.invoice-table tr:last-child td { border-bottom: none; }
.invoice-table tr:hover td { background: #fafafa; }
.status-badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-pendiente { background: #fff3cd; color: #92400e; }
.status-pagada    { background: #d1fae5; color: #065f46; }
.status-anulada   { background: #fee2e2; color: #991b1b; }
.status-borrador  { background: #f1f5f9; color: #64748b; }

/* ══════════════════════════════════════════════
   ONBOARDING
══════════════════════════════════════════════ */
.onboarding-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 32px; max-width: 640px; margin: 0 auto;
}
.onboarding-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.onboarding-card p  { color: var(--muted); margin-bottom: 20px; }
.onboarding-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--dark); }

.rubro-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 10px;
}
.rubro-btn {
  padding: 14px 10px; border: 1.5px solid var(--border); border-radius: 10px;
  background: #fff; cursor: pointer; font-size: 13px; font-weight: 600;
  text-align: center; transition: .15s; line-height: 1.4;
}
.rubro-btn:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

.ob-progress {
  height: 6px; background: var(--border); border-radius: 999px;
  margin-bottom: 6px; overflow: hidden;
}
.ob-progress-bar {
  height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s;
}
.ob-step-label { font-size: 11px; color: var(--muted); margin-bottom: 20px; }
.ob-options { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.ob-option {
  padding: 13px 16px; border: 1.5px solid var(--border); border-radius: 10px;
  background: #fff; cursor: pointer; font-size: 14px; text-align: left;
  font-weight: 500; transition: .15s;
}
.ob-option:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

/* ══════════════════════════════════════════════
   AI LOADING
══════════════════════════════════════════════ */
.ai-loading {
  text-align: center; padding: 48px 32px;
  background: linear-gradient(135deg, #2c2c2c, #444);
  border-radius: var(--radius); color: #fff;
  max-width: 640px; margin: 0 auto;
}
.ai-loading h3 { font-size: 20px; font-weight: 700; margin: 16px 0; }
.ai-spinner {
  width: 64px; height: 64px; margin: 0 auto 8px;
  border: 4px solid rgba(246,165,25,.25);
  border-top-color: var(--brand);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-steps { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; text-align: left; max-width: 320px; margin-inline: auto; }
.ai-step { font-size: 13px; opacity: .35; transition: opacity .5s; padding: 6px 0; }
.ai-step.active { opacity: 1; font-weight: 700; color: var(--brand); }

/* ══════════════════════════════════════════════
   DIAGNÓSTICO
══════════════════════════════════════════════ */
.diagnosis-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 32px; max-width: 680px; margin: 0 auto;
}
.diagnosis-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 20px; }
.diagnosis-card h3 { font-size: 16px; font-weight: 700; margin: 24px 0 12px; }

.diag-score-circle {
  width: 140px; height: 140px; margin: 0 auto 20px;
}
.diag-score-circle svg { width: 100%; height: 100%; }
.diag-summary { color: var(--muted); font-size: 14px; margin-bottom: 20px; text-align: center; line-height: 1.6; }

.diag-areas { display: flex; flex-direction: column; gap: 12px; }
.diag-area  { display: flex; align-items: center; gap: 12px; }
.area-name  { width: 200px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.area-bar   { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.area-fill  { height: 100%; border-radius: 999px; }
.area-fill.status-good   { background: var(--success); }
.area-fill.status-medium { background: var(--brand); }
.area-fill.status-bad    { background: var(--danger); }
.area-score { width: 36px; text-align: right; font-size: 12px; color: var(--muted); flex-shrink: 0; }

.diag-recs { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.diag-recs li {
  display: flex; gap: 10px; font-size: 13px; padding: 12px 14px;
  background: var(--bg); border-radius: 8px; line-height: 1.5;
}
.diag-recs li::before { content: '→'; color: var(--brand); font-weight: 700; flex-shrink: 0; margin-top: 1px; }

.diag-cta { background: var(--brand-light); border: 1.5px solid var(--brand); border-radius: var(--radius); padding: 22px; text-align: center; margin-top: 24px; }
.diag-cta p { color: var(--muted); margin-bottom: 14px; }
.diag-cta .btn { margin: 4px; }

/* ══════════════════════════════════════════════
   CONFIGURACIÓN
══════════════════════════════════════════════ */
.settings-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 20px; max-width: 560px;
}
.settings-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.profile-photo-preview {
  width: 60px; height: 60px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--brand); margin-top: 8px; display: block;
}
.mt-2 { margin-top: 12px; }

/* ══════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.48);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 16px; padding: 28px;
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { font-size: 17px; font-weight: 700; margin-bottom: 18px; }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 20px;
  color: var(--muted); cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--dark); }

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #2c2c2c; color: #fff;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  z-index: 9999; opacity: 0; transform: translateY(10px);
  transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: all; }
.toast.toast-success { background: var(--success); }
.toast.toast-error   { background: var(--danger); }
.toast.toast-info    { background: #2c2c2c; }

/* ══════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ══════════════════════════════════════════════
   CARD ASESOR (home del cliente)
══════════════════════════════════════════════ */
.advisor-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 16px;
  border-left: 4px solid var(--brand);
}
.advisor-card.advisor-pending { border-left-color: var(--muted); opacity: .85; }
.advisor-photo {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--brand); flex-shrink: 0;
}
.advisor-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.advisor-info { flex: 1; min-width: 0; }
.advisor-label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); margin-bottom: 3px; }
.advisor-name  { display: block; font-size: 16px; font-weight: 800; color: var(--dark); }
.advisor-role  { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ══════════════════════════════════════════════
   CLIENTES — mejoras
══════════════════════════════════════════════ */
.client-photo {
  width: 46px; height: 46px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--brand); flex-shrink: 0;
}
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-left: 4px; vertical-align: middle;
}
.status-dot.active   { background: var(--success); }
.status-dot.inactive { background: var(--muted); }

/* ══════════════════════════════════════════════
   MODAL EDITAR USUARIO — tabs
══════════════════════════════════════════════ */
.edit-tabs {
  display: flex; gap: 4px; margin-bottom: 18px;
  border-bottom: 2px solid var(--border); padding-bottom: 0;
}
.edit-tab {
  padding: 8px 18px; background: none; border: none;
  font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: .15s;
}
.edit-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.edit-tab-content { padding-top: 4px; }

/* Colaboradores asignados en el modal */
.assigned-collab {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 8px; background: var(--bg);
}
.assigned-collab span { flex: 1; font-size: 13px; font-weight: 600; }
.mini-photo {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--brand); flex-shrink: 0;
}
.mini-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   FOTO DE PERFIL — settings
══════════════════════════════════════════════ */
.photo-upload-row {
  display: flex; align-items: center; gap: 16px; margin-top: 8px;
}
.photo-upload-preview {
  width: 68px; height: 68px; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--brand); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-light);
}
.profile-photo-preview {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.photo-upload-placeholder { font-size: 28px; }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex !important; }
  .rubro-grid { grid-template-columns: 1fr 1fr; }
  .chat-sidebar { display: none; }
  .diag-area { flex-wrap: wrap; }
  .area-name { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar-info { display: none; }
}
@media (max-width: 480px) {
  .page-content { padding: 14px; }
  .onboarding-card, .diagnosis-card { padding: 20px; }
  .rubro-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .plan-counters { justify-content: center; }
  .services-grid { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════
   FORM ROW 2 COLS
══════════════════════════════════════════════ */
.form-row-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

/* ══════════════════════════════════════════════
   SETTINGS — secciones
══════════════════════════════════════════════ */
.settings-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--brand); margin: 20px 0 12px;
  padding-bottom: 6px; border-bottom: 2px solid var(--brand-light);
}
.settings-section-title:first-child { margin-top: 0; }

/* ══════════════════════════════════════════════
   PRESENCIA EN REDES (settings)
══════════════════════════════════════════════ */
.social-platform-row {
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 8px;
  transition: border-color .15s;
}
.social-platform-row:has(input:checked) {
  border-color: var(--brand); background: var(--brand-light);
}
.social-toggle {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  user-select: none;
}
.social-toggle input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }
.social-icon  { font-size: 18px; }
.social-name  { font-size: 13px; font-weight: 600; flex: 1; }
.social-inputs { margin-top: 8px; }
.social-url-input { width: 100%; padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 13px; }

/* ══════════════════════════════════════════════
   ONBOARDING — paso de presencia en medios
══════════════════════════════════════════════ */
.ob-platforms-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 8px;
}
.ob-platform-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px; border: 1.5px solid var(--border); border-radius: 10px;
  background: #fff; cursor: pointer; font-size: 12px; font-weight: 600;
  text-align: center; transition: .15s; line-height: 1.3;
}
.ob-platform-btn:hover  { border-color: var(--brand); background: var(--brand-light); }
.ob-platform-btn.selected { border-color: var(--brand); background: var(--brand); color: #fff; }
.ob-platform-icon { font-size: 22px; }
.ob-platform-name { font-size: 11px; }

/* ══════════════════════════════════════════════
   TICKETS — nuevo diseño con prioridad
══════════════════════════════════════════════ */
.ticket-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 14px;
}
.priority-border-urgente { border-left: 4px solid var(--danger); }
.priority-border-alta    { border-left: 4px solid var(--brand); }
.priority-border-normal  { border-left: 4px solid var(--success); }

.ticket-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.ticket-header h4 { flex: 1; font-size: 15px; font-weight: 700; }
.priority-badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.priority-urgente { background: #fee2e2; color: #991b1b; }
.priority-alta    { background: #fff3cd; color: #92400e; }
.priority-normal  { background: #d1fae5; color: #065f46; }

.ticket-desc { font-size: 13px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
.ticket-attachment {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--brand); text-decoration: none;
  padding: 4px 10px; background: var(--brand-light); border-radius: 6px;
  margin-bottom: 8px;
}
.ticket-attachment:hover { text-decoration: underline; }

.ticket-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.ticket-status-badge {
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.ticket-status-badge.status-abierto     { background: #dbeafe; color: #1d4ed8; }
.ticket-status-badge.status-en_progreso { background: #fef3c7; color: #92400e; }
.ticket-status-badge.status-resuelto    { background: #d1fae5; color: #065f46; }

.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ticket-actions select { padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 12px; }

/* Adjunto en formulario de ticket */
.ticket-file-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1.5px dashed var(--border); border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--muted); transition: .15s;
  margin-top: 4px;
}
.ticket-file-label:hover { border-color: var(--brand); color: var(--brand); }

/* ══════════════════════════════════════════════
   CAMBIAR SERVICIOS
══════════════════════════════════════════════ */
.services-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.service-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; display: flex; flex-direction: column; gap: 10px;
  position: relative; transition: box-shadow .2s, border-color .2s;
}
.service-card:hover { box-shadow: 0 4px 24px rgba(0,0,0,.12); border-color: #ccc; }
.service-highlighted {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light), var(--shadow);
}
.service-current { opacity: .7; }
.service-current-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 12px; border-radius: 999px; white-space: nowrap;
}
.service-icon { font-size: 36px; text-align: center; }
.service-name { font-size: 17px; font-weight: 800; text-align: center; }
.service-desc { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; }
.service-features {
  list-style: none; display: flex; flex-direction: column; gap: 6px;
  padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.service-features li { font-size: 13px; color: var(--text); }
.service-price {
  font-size: 20px; font-weight: 800; text-align: center; margin-top: 4px;
}
.service-btn { width: 100%; justify-content: center; margin-top: auto; }

/* ══════════════════════════════════════════════
   EXPEDIENTE DEL PLAN
══════════════════════════════════════════════ */
.expediente-empty {
  text-align: center; padding: 60px 20px;
  color: var(--muted); display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.expediente-category { margin-bottom: 28px; }
.expediente-cat-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--brand); margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 2px solid var(--brand-light);
}
.expediente-list { display: flex; flex-direction: column; gap: 8px; }
.expediente-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.expediente-file-icon { font-size: 28px; flex-shrink: 0; }
.expediente-file-info { flex: 1; min-width: 0; }
.expediente-file-info strong { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expediente-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.expediente-file-info small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.expediente-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ══════════════════════════════════════════════
   TABS CLIENTES / COLABORADORES
══════════════════════════════════════════════ */
.clients-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 2px solid var(--border); padding-bottom: 0;
}
.clients-tab {
  background: none; border: none; border-bottom: 3px solid transparent;
  margin-bottom: -2px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-radius: 6px 6px 0 0;
  transition: color .15s, border-color .15s;
}
.clients-tab:hover  { color: var(--brand); }
.clients-tab.active { color: var(--brand); border-bottom-color: var(--brand); background: var(--brand-light); }

/* ══════════════════════════════════════════════
   TARJETAS DE COLABORADORES
══════════════════════════════════════════════ */
.collaborators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.collaborator-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
  transition: box-shadow .2s, border-color .2s;
}
.collaborator-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); border-color: #ccc; }
.collaborator-card--inactive { opacity: .6; }

.collab-card-header {
  display: flex; justify-content: center; position: relative;
  margin-bottom: 4px;
}
.collab-card-header .status-dot {
  position: absolute; top: 2px; right: 2px;
}
.collab-card-photo {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border);
}
.collab-card-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #fff;
}
.collab-card-body {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; text-align: center;
}
.collab-card-name {
  font-size: 15px; font-weight: 700;
}
.collab-level-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.collab-card-sector {
  font-size: 12px; color: var(--muted); font-style: italic;
}
.collab-card-email {
  font-size: 12px; color: var(--muted); word-break: break-all;
}
.collab-card-clients {
  display: flex; align-items: baseline; gap: 5px;
  margin-top: 4px; padding: 6px 14px;
  background: var(--bg); border-radius: 8px; border: 1px solid var(--border);
}
.collab-clients-count {
  font-size: 22px; font-weight: 800; color: var(--brand);
}
.collab-clients-label {
  font-size: 11px; color: var(--muted);
}
.collab-card-actions {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
}

/* ══════════════════════════════════════════════
   COLLAB ROLE BADGE (Mi perfil colaborador)
══════════════════════════════════════════════ */
.collab-role-badge {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; background: var(--brand-light);
  border: 1.5px solid var(--brand); border-radius: 10px;
  margin-bottom: 4px;
}
.collab-role-icon { font-size: 28px; flex-shrink: 0; }
.collab-role-badge strong { display: block; font-size: 15px; font-weight: 700; }
.collab-role-badge span   { font-size: 12px; color: var(--muted); }
