/* C&J Legal — portal de clientes. Primero para el celular; en pantallas grandes, columna centrada. */
:root {
  --pj-navy: #002438;
  --pj-navy-2: #0a3150;
  --pj-wine: #6b0f03;
  --pj-wine-2: #8e2414;
  --pj-silver: #d9d8dd;
  --pj-bg: #f3f5f9;
  --pj-card: #ffffff;
  --pj-text: #1b2333;
  --pj-muted: #657089;
  --pj-border: #e2e7ef;
  --pj-ok: #2e9e6b;
  --pj-warn: #c98a0b;
  --pj-radius: 16px;
  --pj-nav-h: 64px;
}

body.pj {
  background: var(--pj-bg);
  color: var(--pj-text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
/* Color de enlace por defecto con especificidad mínima: cualquier clase propia (menú, botones, chips) lo reemplaza */
:where(.pj) a:where(:not([class*="btn"]):not([class*="pj-"])) { color: var(--pj-navy-2); }
.pj-wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* Encabezado */
.pj-header { background: var(--pj-navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.pj-header .pj-wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.pj-brand { display: flex; flex-direction: column; line-height: 1.05; color: #fff; text-decoration: none; }
.pj-brand:hover { color: #fff; }
.pj-brand strong { font-family: "Playfair Display", Georgia, serif; font-size: 1.3rem; letter-spacing: .06em; }
.pj-brand small { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--pj-silver); }
.pj-topnav { display: none; gap: 4px; }
.pj-topnav a { color: rgba(255, 255, 255, .78); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.pj-topnav a.active, .pj-topnav a:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.pj-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--pj-wine); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; text-decoration: none; }
.pj-avatar:hover { color: #fff; }

/* Contenido */
.pj-main { padding: 20px 0 calc(var(--pj-nav-h) + 28px); }
.pj-title { font-size: 1.35rem; font-weight: 700; margin: 0 0 4px; }
.pj-sub { color: var(--pj-muted); margin-bottom: 18px; }
.pj-card { background: var(--pj-card); border: 1px solid var(--pj-border); border-radius: var(--pj-radius); padding: 18px;
  box-shadow: 0 1px 2px rgba(0, 36, 56, .04); }
.pj-card + .pj-card { margin-top: 12px; }
.pj-section { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--pj-muted);
  margin: 24px 0 10px; }

/* Bienvenida */
.pj-hero { background: linear-gradient(140deg, var(--pj-navy) 0%, var(--pj-navy-2) 60%, #1d4a6b 100%); color: #fff;
  border-radius: var(--pj-radius); padding: 22px 20px; position: relative; overflow: hidden; }
.pj-hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%;
  border: 22px solid rgba(255, 255, 255, .06); }
.pj-hero h1 { font-size: 1.3rem; font-weight: 700; margin: 0 0 6px; }
.pj-hero p { color: rgba(255, 255, 255, .8); margin: 0 0 16px; }
.pj-btn-main { background: var(--pj-wine); border: 0; color: #fff; font-weight: 600; border-radius: 12px; padding: 12px 18px;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.pj-btn-main:hover, .pj-btn-main:focus { background: var(--pj-wine-2); color: #fff; }
.pj-btn-light { background: #fff; color: var(--pj-navy); border: 1px solid var(--pj-border); font-weight: 600; border-radius: 12px;
  padding: 11px 16px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.pj-btn-light:hover { background: #f7f8fb; color: var(--pj-navy); }

/* Accesos */
.pj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pj-tile { background: var(--pj-card); border: 1px solid var(--pj-border); border-radius: var(--pj-radius); padding: 16px 14px;
  text-decoration: none; color: var(--pj-text); display: flex; flex-direction: column; gap: 10px; min-height: 118px;
  transition: transform .12s ease, box-shadow .12s ease; position: relative; }
.pj-tile:hover { color: var(--pj-text); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 36, 56, .08); }
.pj-tile i { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.25rem; background: #e8eef5; color: var(--pj-navy); }
.pj-tile.pj-tile-main i { background: var(--pj-wine); color: #fff; }
.pj-tile strong { font-size: .98rem; }
.pj-tile small { color: var(--pj-muted); line-height: 1.3; }
.pj-tile .pj-dot { position: absolute; top: 12px; right: 12px; }

/* Listas */
.pj-list { list-style: none; margin: 0; padding: 0; }
.pj-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--pj-border);
  text-decoration: none; color: var(--pj-text); }
.pj-item:last-child { border-bottom: 0; padding-bottom: 0; }
.pj-item:first-child { padding-top: 0; }
.pj-item:hover { color: var(--pj-text); }
.pj-item .pj-ico { flex: 0 0 40px; height: 40px; border-radius: 12px; background: #e8eef5; color: var(--pj-navy);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.pj-item .pj-body { flex: 1; min-width: 0; }
.pj-item .pj-body strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.pj-item .pj-meta { color: var(--pj-muted); font-size: .84rem; }
.pj-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pj-wine); display: inline-block; flex: 0 0 10px; margin-top: 6px; }
.pj-badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: #e8eef5; color: var(--pj-navy); white-space: nowrap; }
.pj-badge.ok { background: #e3f4ec; color: #1f7a52; }
.pj-badge.warn { background: #fdf2dc; color: #8a5d00; }
.pj-badge.off { background: #eef0f3; color: var(--pj-muted); }
.pj-badge.wine { background: #f6e6e3; color: var(--pj-wine); }
.pj-empty { text-align: center; color: var(--pj-muted); padding: 28px 12px; }
.pj-empty i { font-size: 2rem; display: block; margin-bottom: 8px; color: #b6bfcd; }

/* Conversación */
.pj-thread { display: flex; flex-direction: column; gap: 10px; }
.pj-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--pj-border);
  word-wrap: break-word; }
.pj-msg.mine { align-self: flex-end; background: var(--pj-navy); color: #fff; border-color: var(--pj-navy); border-bottom-right-radius: 4px; }
.pj-msg.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.pj-msg .pj-msg-meta { font-size: .72rem; opacity: .7; margin-top: 4px; white-space: normal; }
.pj-msg a.pj-file { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 10px; border-radius: 10px;
  background: rgba(0, 36, 56, .06); text-decoration: none; font-size: .85rem; }
.pj-msg.mine a.pj-file { background: rgba(255, 255, 255, .14); color: #fff; }
.pj-reply { position: static; }

/* Progreso */
.pj-progress { height: 8px; background: #e8eef5; border-radius: 99px; overflow: hidden; }
.pj-progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--pj-navy-2), var(--pj-wine)); }
.pj-steps { list-style: none; padding: 0; margin: 0; }
.pj-steps li { display: flex; gap: 12px; padding: 8px 0; align-items: center; }
.pj-steps li i { font-size: 1.15rem; }
.pj-steps .done i { color: var(--pj-ok); }
.pj-steps .current { font-weight: 600; }
.pj-steps .current i { color: var(--pj-wine); }
.pj-steps .todo { color: var(--pj-muted); }

/* Formularios */
.pj .form-control, .pj .form-select { border-radius: 12px; padding: .65rem .85rem; border-color: var(--pj-border); }
.pj .form-control:focus, .pj .form-select:focus { border-color: var(--pj-navy-2); box-shadow: 0 0 0 .2rem rgba(10, 49, 80, .12); }
.pj .form-label { font-weight: 600; font-size: .86rem; }
.pj-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.pj-choice label { border: 1px solid var(--pj-border); border-radius: 12px; padding: 10px 12px; display: flex; gap: 8px;
  align-items: center; cursor: pointer; background: #fff; font-size: .9rem; }
.pj-choice input { accent-color: var(--pj-wine); }

/* Barra inferior (celular) */
.pj-tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--pj-nav-h); background: #fff; border-top: 1px solid var(--pj-border);
  display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.pj-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--pj-muted); font-size: .72rem; font-weight: 500; position: relative; }
.pj-tabbar a i { font-size: 1.3rem; }
.pj-tabbar a.active { color: var(--pj-navy); }
.pj-tabbar a.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--pj-wine); }
.pj-tabbar .pj-dot { position: absolute; top: 10px; right: calc(50% - 18px); width: 8px; height: 8px; margin: 0; }

/* Página pública */
.pj-public-hero { background: linear-gradient(150deg, var(--pj-navy) 0%, var(--pj-navy-2) 55%, #1d4a6b 100%); color: #fff;
  padding: 40px 0 56px; }
.pj-public-hero h1 { font-family: "Playfair Display", Georgia, serif; font-size: 2rem; line-height: 1.15; margin: 14px 0 10px; }
.pj-public-hero p { color: rgba(255, 255, 255, .82); font-size: 1.02rem; }
.pj-kicker { display: inline-block; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; background: rgba(255, 255, 255, .12);
  padding: 5px 10px; border-radius: 999px; color: var(--pj-silver); }
.pj-steps-how { counter-reset: s; display: grid; gap: 12px; }
.pj-steps-how .pj-card { display: flex; gap: 14px; align-items: flex-start; }
.pj-steps-how .pj-num { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--pj-wine); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
.pj-auth { max-width: 460px; margin: 0 auto; }
.pj-footer { color: var(--pj-muted); font-size: .8rem; text-align: center; padding: 24px 0 36px; }

@media (min-width: 768px) {
  .pj-topnav { display: flex; }
  .pj-tabbar { display: none; }
  .pj-main { padding-bottom: 40px; }

  .pj-grid { grid-template-columns: repeat(3, 1fr); }
  .pj-public-hero h1 { font-size: 2.6rem; }
}

/* Asistente virtual */
.pj-msg.bot { border-color: #d8e3ef; background: #f5f9fd; }
.pj-typing { color: var(--pj-muted); font-size: .9rem; }
.pj-dots span { animation: pj-blink 1.2s infinite both; }
.pj-dots span:nth-child(2) { animation-delay: .2s; }
.pj-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pj-blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* Ver contraseña */
.pj .input-group > .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pj .pw-toggle { border-color: var(--pj-border); border-radius: 0 12px 12px 0; color: var(--pj-muted); background: #fff; }
.pj .pw-toggle:hover { color: var(--pj-navy); background: #f7f8fb; }

/* Chat: respuestas sugeridas y envío */
.pj-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pj-chip { border: 1px solid #c9d6e4; background: #fff; color: var(--pj-navy); border-radius: 999px; padding: 7px 14px;
  font-size: .88rem; font-weight: 500; cursor: pointer; transition: background .12s ease, border-color .12s ease; }
.pj-chip:hover, .pj-chip:focus { background: #eef3f9; border-color: var(--pj-navy-2); }
.pj-msg.pj-sending { opacity: .65; white-space: pre-line; }
.pj-reply textarea { resize: none; }

/* Botón «Atrás» del encabezado */
.pj-back { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-left: -6px;
  border-radius: 50%; color: #fff; font-size: 1.25rem; text-decoration: none; flex-shrink: 0; }
.pj-back:hover, .pj-back:focus { color: #fff; background: rgba(255,255,255,.12); }
.pj-back + .pj-brand { margin-right: auto; }
