/* ── Le Paquet Design System ─────────────────────────────── */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s, color 0.2s;
}
input, textarea, select, button { font-family: inherit; }
button { cursor: pointer; }
a { text-decoration: none; color: inherit; }
::-webkit-scrollbar { width: 0; height: 0; }
input, textarea { -webkit-appearance: none; outline: none; }

/* ── Light ── */
:root {
  --bg:       #fafafa;
  --bg2:      #f4f4f5;
  --card:     #ffffff;
  --card2:    #fafafa;
  --text:     #09090b;
  --text2:    #3f3f46;
  --text3:    #71717a;
  --text4:    #a1a1aa;
  --accent:   #613f75;
  --accent2:  #7a4f90;
  --accent-s: #f4eef8;
  --border:   #e4e4e7;
  --sep:      #f4f4f5;
  --shadow:   0 1px 2px rgba(0,0,0,0.04);
  --shadow2:  0 2px 8px rgba(0,0,0,0.06);
  --green:    #16a34a;
  --green-s:  #f0fdf4;
  --red:      #dc2626;
  --red-s:    #fef2f2;
  --orange:   #d97706;
  --orange-s: #fffbeb;
  --blue:     #2563eb;
  --blue-s:   #eff6ff;
  --nav-h:    48px;
  --sub-h:    44px;
  /* Logo brand colors (Mesa 3 — light mode) */
  --logo-1:   #613f75;
  --logo-2:   #402c4f;
}

/* ── Logo paths color binding ── */
/* Both `.lp-logo` and `.brand-logo` are used historically; verify.js emits
   `.brand-logo` because that's how the SVG was originally exported. Either
   class binds to the theme tokens — never refactor without updating both. */
.lp-logo .lp-1, .brand-logo .lp-1 { fill: var(--logo-1); }
.lp-logo .lp-2, .brand-logo .lp-2 { fill: var(--logo-2); }
/* Display block: el SVG default es inline y arrastra un descender fantasma
   (espacio bajo el baseline) que en flex-containers con align-items:center
   lo empuja unos pixeles hacia arriba — se notaba especialmente en mobile
   donde el nav es más apretado. block elimina esa asimetría. */
.lp-logo, .brand-logo { display: block; }

/* ── Dark ── */
body.lp-dark {
  --bg:       #09090b;
  --bg2:      #18181b;
  --card:     #111113;
  --card2:    #18181b;
  --text:     #fafafa;
  --text2:    #d4d4d8;
  --text3:    #a1a1aa;
  --text4:    #52525b;
  --accent:   #b080d0;
  --accent2:  #c9a0e0;
  --accent-s: #1e1528;
  --border:   #27272a;
  --sep:      #18181b;
  --shadow:   0 1px 2px rgba(0,0,0,0.4);
  --shadow2:  0 2px 8px rgba(0,0,0,0.5);
  --green:    #4ade80;
  --green-s:  #052e16;
  --red:      #f87171;
  --red-s:    #450a0a;
  --orange:   #fbbf24;
  --orange-s: #451a03;
  --blue:     #60a5fa;
  --blue-s:   #172554;
  /* Logo brand colors (Mesa 4 — dark mode: rosa claro + blanco) */
  --logo-1:   #e5c3d1;
  --logo-2:   #ffffff;
}

/* ── Nav ── */
.lp-nav {
  height: var(--nav-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 200;
}
.lp-nav-left  { display:flex; align-items:center; gap:12px; min-width:0; }
/* Tools (search, bell, avatar) get more breathing room than module icons,
   to visually separate "where to navigate" from "what to do here". */
.lp-nav-right { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.lp-nav-right .lp-ico:not(:first-of-type) { margin-left:0; }
.lp-nav-modules { display:flex; align-items:center; gap:4px; }
.lp-nav-sep   { width:1px; height:18px; background:var(--border); margin:0 8px; }
.lp-nav-div   { width:1px; height:16px; background:var(--border); }
.lp-nav-sect  { font-size:13px; font-weight:500; color:var(--text3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:160px; }

.lp-ico {
  width:32px; height:32px; border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  font-size:16px; background:transparent; border:none;
  color:var(--text4); transition:background 0.12s, color 0.12s;
  text-decoration:none; flex-shrink:0;
}
.lp-ico:hover  { background:var(--bg2); color:var(--text2); }
.lp-ico:active { opacity:0.7; }
.lp-ico.active { background:var(--accent); color:#fff; }

.lp-user-btn {
  width:28px; height:28px; border-radius:50%;
  background:var(--accent); color:#fff;
  font-size:11px; font-weight:600;
  border:none; display:flex; align-items:center; justify-content:center;
  flex-shrink:0; transition:opacity 0.12s;
}
.lp-user-btn:hover { opacity:0.85; }

.lp-user-menu {
  position:absolute; top:calc(100% + 4px); right:0;
  background:var(--card); border:1px solid var(--border);
  border-radius:10px; box-shadow:var(--shadow2);
  min-width:200px; overflow:hidden; z-index:300; padding:4px 0;
  opacity:0; visibility:hidden; transform:translateY(-4px);
  transition:opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.lp-user-menu.open { opacity:1; visibility:visible; transform:translateY(0); }
.lp-user-menu-name {
  padding:8px 14px 2px; font-size:13px; font-weight:600; color:var(--text);
}
.lp-user-menu-mail {
  padding:0 14px 8px; font-size:11px; color:var(--text3);
}
.lp-user-menu-sep {
  height:1px; background:var(--border); margin:4px 0;
}
.lp-user-menu-item {
  display:block; width:100%; padding:8px 14px;
  background:none; border:none; text-align:left;
  font-size:13px; font-weight:500; cursor:pointer;
  color:var(--text2); transition:background 0.1s;
  font-family:inherit;
}
.lp-user-menu-item:hover { background:var(--bg2); }
/* Last item is always Logout — give it the danger affordance */
.lp-user-menu-item:last-child { color:var(--red); }
.lp-user-menu-item:last-child:hover { background:var(--red-s); }

/* ── Sub-header ── */
.lp-sub {
  height: var(--sub-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  position: sticky; top: var(--nav-h); z-index: 100;
}
.lp-sub-title { font-size: 14px; font-weight: 600; color: var(--text); }
.lp-sub-right { display:flex; gap:6px; align-items:center; }

/* ── Buttons ── */
.lp-btn {
  height: 32px; padding: 0 14px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap; transition: opacity 0.12s;
}
.lp-btn:hover { opacity: 0.85; }
.lp-btn:active { opacity: 0.7; }
.lp-btn-primary { background:var(--accent); color:#fff; }
.lp-btn-ghost   { background:var(--bg2); color:var(--text2); border:1px solid var(--border); }
.lp-btn-danger  { background:var(--red-s); color:var(--red); }

/* ── Content ── */
.lp-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .lp-nav-sect { display: none; }
  .lp-nav-div  { display: none; }
  .lp-nav-left { gap:8px; }
  .lp-ico { width:30px; height:30px; font-size:15px; }
  .lp-nav-sep { margin:0 4px; }
}

/* ── Preloader ── */
#lp-loading {
  position:fixed; inset:0; z-index:9999;
  background:var(--bg, #fafafa);
  display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:18px;
}
body.lp-dark #lp-loading { background:#09090b; }
.lp-logo-loader { position:relative; overflow:hidden; }
.lp-logo-loader::after {
  content:''; position:absolute; inset:-20% -50% -20% -50%;
  background:linear-gradient(100deg,transparent 30%,rgba(0,0,0,0.04) 45%,rgba(0,0,0,0.04) 55%,transparent 70%);
  animation:lp-shimmer 1.8s ease-in-out infinite;
}
body.lp-dark .lp-logo-loader::after {
  background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,0.04) 45%,rgba(255,255,255,0.04) 55%,transparent 70%);
}
@keyframes lp-shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }
.lp-load-bar { width:100px; height:2px; background:var(--border); border-radius:99px; overflow:hidden; }
.lp-load-bar-fill { width:40%; height:100%; background:var(--accent); border-radius:99px; animation:lp-bar 1.2s ease-in-out infinite; }
@keyframes lp-bar { 0%{transform:translateX(-100%)} 100%{transform:translateX(350%)} }
.lp-load-text { font-size:11px; color:var(--text4); font-family:'DM Sans',sans-serif; letter-spacing:0.3px; }

/* ── Animations ── */
@keyframes lp-fadeUp {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}
.lp-fadeUp { animation:lp-fadeUp 0.25s cubic-bezier(0.25,1,0.5,1) both; }

@keyframes lp-scaleIn {
  from { opacity:0; transform:scale(0.95); }
  to   { opacity:1; transform:scale(1); }
}
.lp-scaleIn { animation:lp-scaleIn 0.15s cubic-bezier(0.25,1,0.5,1) both; }

@keyframes lp-slideRight {
  from { opacity:0; transform:translateX(12px); }
  to   { opacity:1; transform:translateX(0); }
}
.lp-slideRight { animation:lp-slideRight 0.2s cubic-bezier(0.25,1,0.5,1) both; }

@keyframes lp-pulse {
  0%,100% { transform:scale(1); }
  50%     { transform:scale(1.06); }
}
.lp-pulse { animation:lp-pulse 0.35s ease-in-out; }

@keyframes lp-pop {
  0%   { transform:scale(1); }
  40%  { transform:scale(1.15); }
  100% { transform:scale(1); }
}
.lp-pop { animation:lp-pop 0.3s ease-out; }

.lp-stagger > * { animation:lp-fadeUp 0.25s cubic-bezier(0.25,1,0.5,1) both; }
.lp-stagger > *:nth-child(1) { animation-delay:0s; }
.lp-stagger > *:nth-child(2) { animation-delay:0.04s; }
.lp-stagger > *:nth-child(3) { animation-delay:0.08s; }
.lp-stagger > *:nth-child(4) { animation-delay:0.12s; }
.lp-stagger > *:nth-child(5) { animation-delay:0.16s; }
.lp-stagger > *:nth-child(6) { animation-delay:0.20s; }
.lp-stagger > *:nth-child(7) { animation-delay:0.24s; }
.lp-stagger > *:nth-child(8) { animation-delay:0.28s; }

@keyframes lp-confetti-fall {
  0%   { transform:translateY(-10px) rotate(0deg); opacity:1; }
  100% { transform:translateY(100vh) rotate(720deg); opacity:0; }
}
@keyframes lp-confetti-x {
  0%,100% { margin-left:0; }
  50%     { margin-left:30px; }
}
.lp-confetti-piece {
  position:fixed; top:-10px; z-index:9999; pointer-events:none;
  width:6px; height:6px; border-radius:1px;
  animation:lp-confetti-fall 2.5s ease-in forwards, lp-confetti-x 1s ease-in-out infinite;
}

/* ── Focus & accessibility ── */
:focus-visible {
  outline:2px solid var(--accent);
  outline-offset:2px;
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after {
    animation-duration:0.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:0.01ms !important;
  }
}

/* ── Global Overlay (Search + Notifications) ───────────────── */
/* Bell badge — number on the bell icon when there are pending alerts */
#lp-bell-btn { position: relative; }
.lp-bell-dot {
  position: absolute; top: 2px; right: 2px;
  min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 7px; background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 14px; text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--card);
}
@keyframes lp-ov-fadein  { from { opacity: 0; }                 to { opacity: 1; } }
@keyframes lp-ov-scalein { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.lp-ov-search, .lp-ov-notifs {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px 20px;
  animation: lp-ov-fadein 0.15s ease-out;
}
.lp-ov-notifs { align-items: flex-start; padding-top: calc(var(--nav-h) + 8px); padding-right: 12px; justify-content: flex-end; }
.lp-ov-back {
  position: absolute; inset: 0; background: rgba(0,0,0,0.45);
}
body.lp-dark .lp-ov-back { background: rgba(0,0,0,0.6); }
.lp-ov-card {
  position: relative;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%; max-width: 480px; max-height: calc(100vh - 80px);
  display: flex; flex-direction: column; overflow: hidden;
  animation: lp-ov-scalein 0.18s cubic-bezier(.22,.8,.2,1);
}
.lp-ov-card--notifs { max-width: 380px; }

/* Search input row */
.lp-ov-srow {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  color: var(--text3);
}
.lp-ov-srow input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 15px; color: var(--text);
}
.lp-ov-srow kbd {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 6px; font-size: 10px; font-family: monospace; color: var(--text3);
}

/* Search results */
.lp-ov-results { overflow-y: auto; max-height: 60vh; padding: 4px 0; }
.lp-ov-section {
  padding: 8px 16px 4px; font-size: 10px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--text4);
}
.lp-ov-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border: none; background: none; cursor: pointer;
  text-align: left; border-left: 2px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.lp-ov-item:hover, .lp-ov-item.active {
  background: var(--bg2); border-left-color: var(--accent);
}
.lp-ov-item-body { flex: 1; min-width: 0; }
.lp-ov-item-title {
  display: block; font-size: 14px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lp-ov-item-sub { display: block; font-size: 11px; color: var(--text3); margin-top: 1px; }
.lp-ov-item svg { color: var(--text4); flex-shrink: 0; }

.lp-ov-empty {
  padding: 32px 20px; text-align: center;
  color: var(--text3); font-size: 13px;
}

/* Search footer */
.lp-ov-foot {
  display: flex; gap: 14px; padding: 8px 14px;
  border-top: 1px solid var(--border); background: var(--bg2);
  font-size: 10px; color: var(--text4);
}
.lp-ov-foot kbd {
  padding: 1px 5px; border: 1px solid var(--border); border-radius: 3px;
  background: var(--card); font-family: monospace;
}

/* Notifications panel */
.lp-ov-nhead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--text);
}
.lp-ov-close {
  background: none; border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
}
.lp-ov-close:hover { background: var(--bg2); }
.lp-ov-nlist { overflow-y: auto; max-height: 60vh; padding: 4px 0; }

/* Filter chips above the notification list.
   Mask-image creates a soft fade on the right edge so users see there's
   more content to scroll into when chips overflow. Mobile-only — desktop
   has enough width for all 5 filters. */
.lp-ov-nfilters {
  display: flex; gap: 6px; padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent 100%);
}
.lp-ov-nfilters::-webkit-scrollbar { display: none; }
.lp-ov-nfilter { scroll-snap-align: start; }
.lp-ov-nfilter {
  flex-shrink: 0; padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg2);
  color: var(--text3); font-size: 11px; font-weight: 500; cursor: pointer;
  font-family: inherit; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.lp-ov-nfilter:hover { background: var(--card); color: var(--text2); }
.lp-ov-nfilter.active {
  background: var(--accent-s); border-color: var(--accent); color: var(--accent); font-weight: 600;
}
.lp-ov-nfilter-n {
  display: inline-block; min-width: 14px; padding: 0 4px; margin-left: 3px;
  border-radius: 7px; background: var(--card); color: inherit;
  font-size: 9px; font-weight: 700; line-height: 14px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.lp-ov-nfilter.active .lp-ov-nfilter-n { background: var(--accent); color: #fff; }

/* Notification row: avatar | body | action buttons */
.lp-ov-nitem {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: none; background: none; cursor: pointer;
  text-align: left; border-left: 3px solid var(--orange);
  transition: background 0.12s;
}
.lp-ov-nitem[data-color="red"]    { border-left-color: var(--red); }
.lp-ov-nitem[data-color="orange"] { border-left-color: var(--orange); }
.lp-ov-nitem[data-color="accent"] { border-left-color: var(--accent); }
.lp-ov-nitem[data-color="green"]  { border-left-color: var(--green); }
.lp-ov-nitem[data-color="blue"]   { border-left-color: var(--blue); }
.lp-ov-nitem:hover { background: var(--bg2); }

/* Avatar circle with the client's first letter */
.lp-ov-ava {
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-family: inherit;
}

/* Fallback (when there's no client, eg system alerts) */
.lp-ov-nicon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); color: var(--text3); flex-shrink: 0;
}
.lp-ov-nitem[data-color="red"]    .lp-ov-nicon { color: var(--red); background: var(--red-s); }
.lp-ov-nitem[data-color="orange"] .lp-ov-nicon { color: var(--orange); background: var(--orange-s); }
.lp-ov-nitem[data-color="accent"] .lp-ov-nicon { color: var(--accent); background: var(--accent-s); }
.lp-ov-nitem[data-color="green"]  .lp-ov-nicon { color: var(--green); background: var(--green-s); }
.lp-ov-nitem[data-color="blue"]   .lp-ov-nicon { color: var(--blue); background: var(--blue-s); }

.lp-ov-nbody { flex: 1; min-width: 0; }
.lp-ov-nitem-title {
  display: block; font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.3;
}
.lp-ov-nitem-sub { display: block; font-size: 11px; color: var(--text3); margin-top: 2px; }

/* Action buttons (WhatsApp + Ver) */
.lp-ov-nactions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.lp-ov-nbtn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--accent); font-size: 11px; font-weight: 600;
  font-family: inherit; cursor: pointer; text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.lp-ov-nbtn:hover { background: var(--bg2); border-color: var(--accent); }
.lp-ov-nbtn--wa {
  background: #25D366; border-color: #25D366; color: #fff;
  width: 28px; padding: 0;
}
.lp-ov-nbtn--wa:hover { background: #1ebe5a; border-color: #1ebe5a; color: #fff; }

/* Icon-only buttons (Listo / dismiss) — same width as the WhatsApp button */
.lp-ov-nbtn[data-action="dismiss"] {
  width: 28px; padding: 0;
}

/* History view — slightly muted appearance */
.lp-ov-nitem--seen { border-left-color: var(--text4); opacity: 0.85; }
.lp-ov-nitem--seen:hover { opacity: 1; }
.lp-ov-nitem--seen .lp-ov-nicon { color: var(--text3); background: var(--bg2); }
.lp-ov-nbtn--primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.lp-ov-nbtn--primary:hover {
  background: var(--accent2); border-color: var(--accent2); color: #fff;
}
.lp-ov-nbtn--primary:disabled {
  opacity: 0.6; cursor: not-allowed;
}

/* ── Account modal (change password) ───────────────────────── */
.lp-ov-card--account { max-width: 380px; }
.lp-ov-account-body { padding: 14px 16px 16px; }
.lp-ov-account-help { font-size: 12px; color: var(--text3); margin-bottom: 14px; }
.lp-ov-field {
  display: block; margin-bottom: 12px;
}
.lp-ov-field span {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 5px;
}
.lp-ov-field input {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--bg2); color: var(--text);
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.12s, background 0.12s;
}
.lp-ov-field input:focus { border-color: var(--accent); background: var(--card); }
.lp-ov-account-msg {
  font-size: 12px; font-weight: 600; padding: 0;
  margin-bottom: 10px; min-height: 16px;
}
.lp-ov-account-msg.is-ok  { color: var(--green); }
.lp-ov-account-msg.is-err { color: var(--red); }
.lp-ov-account-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* Mobile: fill more of the screen, less padding */
@media (max-width: 600px) {
  .lp-ov-search { padding: 12px; }
  .lp-ov-notifs { padding: calc(var(--nav-h) + 4px) 8px 8px; }
  .lp-ov-card { max-width: 100%; }
  .lp-ov-card--notifs { max-width: 100%; }
}
