/* ============================================================================
 * DATATAX — estilos. Diseño sobrio y profesional (software de oficina).
 * Sin emojis en la UI: solo iconos SVG inline.
 * ========================================================================== */

:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #1f2937;
  --ink-soft: #4b5563;
  --ink-faint: #9ca3af;
  --line: #d7dce2;
  --accent: #1e4fa3;          /* azul sobrio */
  --accent-dark: #163c7d;
  --sidebar: #1c2530;
  --sidebar-ink: #cbd5e1;
  --ok: #1a7a4c;
  --warn: #b45309;
  --bad: #b4232a;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ic-lg { width: 26px; height: 26px; }

/* ------------------------------- demo banner ------------------------------ */
.demo-banner {
  background: #7c2d12; color: #fff; text-align: center;
  font-size: 13px; font-weight: 700; letter-spacing: .06em;
  padding: 8px 12px; position: sticky; top: 0; z-index: 200;
}

/* --------------------------------- login ---------------------------------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(160deg, #1c2530 0%, #2b3a4d 100%);
  position: relative; overflow: hidden;
}
/* Fondo: oficina de taxes (generada 2026-10-20, sin marcas) */
.login-bg {
  position: absolute; inset: 0; pointer-events: none;
  background: url("/img/office-bg.webp") center / cover no-repeat;
  opacity: .55;
}
.login-card {
  background: var(--panel); border-radius: 16px; padding: 48px 44px;
  width: 100%; max-width: 520px; box-shadow: 0 18px 50px rgba(0,0,0,.35);
  position: relative; z-index: 1;
}
.ficha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ficha-grid .form-panel { margin: 0; }
.ficha-grid .form-panel:nth-child(1) { grid-column: 1; grid-row: 1 / span 2; }
.ficha-grid .form-panel:nth-child(2) { grid-column: 2; grid-row: 1; }
.ficha-grid .form-panel:nth-child(3) { grid-column: 2; grid-row: 2; }
@media (max-width: 1000px) { .ficha-grid { grid-template-columns: 1fr; } .ficha-grid .form-panel:nth-child(n) { grid-column: auto; grid-row: auto; } }
.side-copy { margin-top: 10px; font-size: 10.5px; line-height: 1.5; }
.sidebar .side-copy { color: rgba(255,255,255,.55); }
.mb-drawer .side-copy { color: #64748b; }
.side-copy a { color: var(--accent); font-weight: 600; }
.legal-text { font-size: 13.5px; line-height: 1.65; color: #334155; text-align: left; }
.legal-text p { margin: 0 0 12px; }
.legal-text p:last-child { margin-bottom: 0; }
.login-legal {
  background: var(--panel); border-radius: 16px; padding: 20px 24px; margin-top: 16px;
  width: 100%; max-width: 520px; box-shadow: 0 18px 50px rgba(0,0,0,.35);
  position: relative; z-index: 1; font-size: 11.5px; line-height: 1.55; color: #475569;
}
.login-legal p { margin: 0 0 8px; }
.login-legal p:last-child { margin-bottom: 0; }
.login-legal-title { text-align: center; font-weight: 800; font-size: 12.5px; color: #0f172a; }
.login-legal-strong { font-weight: 700; color: #0f172a; }
.login-card h1 { margin: 0 0 4px; font-size: 30px; letter-spacing: .04em; }
.login-card h1 .mark { color: var(--accent); }
.login-card p.sub { margin: 0 0 22px; color: var(--ink-soft); font-size: 15px; }
/* Idioma: dos botones grandes */
.lang-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.lang-btn {
  min-height: 54px; border-radius: 10px; font-size: 16px; font-weight: 700;
  border: 2px solid transparent; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.lang-btn.en { background: #2563eb; }
.lang-btn.es { background: #16a34a; }
.lang-btn:not(.active) { opacity: .45; }
.lang-btn.active { box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.demo-hint {
  background: #fef3e2; border: 1px solid #f0d9a8; border-radius: var(--radius);
  padding: 10px 12px; font-size: 13px; margin-bottom: 16px; color: #7c4a12;
}

/* --------------------------------- layout --------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none;
}
.brand { padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); flex: none; }
.wt-brand { display: inline-flex; align-items: center; gap: 10px; }
/* Asistente guiado (primer acceso del cliente) */
.guided-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.guided-nav { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.guided-nav .btn { flex: 1 1 0; min-height: 50px; white-space: normal; }
.brand .name { font-size: 20px; font-weight: 800; letter-spacing: .08em; color: #fff; }
.brand .name .mark { color: #7aa7e8; }
.brand .who { font-size: 12px; color: #8fa1b5; margin-top: 2px; }
.who-wrap { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.info-i { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255,255,255,.45); background: transparent; color: #cbd5e1; cursor: pointer; padding: 0; flex: none; }
.info-i svg { width: 12px; height: 12px; }
.info-i:hover { background: rgba(255,255,255,.14); color: #fff; }
.info-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 80; width: 232px; background: #fff; color: #0f172a; border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.35); padding: 12px 14px; display: none; text-align: left; }
.info-pop.open, .who-wrap:hover .info-pop { display: block; }
.info-pop-name { display: block; font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.info-pop a { display: block; font-size: 12.5px; font-weight: 600; color: #0369a1; text-decoration: none; margin: 2px 0; }
.info-pop-rights { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0; font-size: 11px; color: #64748b; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; color: var(--sidebar-ink);
  text-decoration: none; padding: 10px 12px; border-radius: 6px; font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(122,167,232,.18); color: #fff; }
.side-user { display: flex; align-items: center; gap: 10px; background: rgba(140,160,190,.13); border: 1px solid rgba(140,160,190,.28); border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; width: 100%; box-sizing: border-box; }
.side-user-av { width: 34px; height: 34px; border-radius: 50%; background: #27a9fd; color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
.side-user-info { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.side-user-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { font-size: 11px; opacity: .75; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #8fa1b5;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; flex: none; }
.side-foot > div { width: 100%; }
.side-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.side-actions .btn { width: 100%; justify-content: flex-start; box-sizing: border-box; }
.side-actions { gap: 6px; }
.side-actions .btn { padding: 7px 10px; font-size: 12.5px; border-radius: 9px; gap: 7px; }
.side-actions .btn svg { width: 15px; height: 15px; }
.mb-drawer-foot .btn { padding: 8px 10px; font-size: 13px; }
.btn-block { box-sizing: border-box; }
.lic-layout { display: grid; grid-template-columns: 600px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1150px) { .lic-layout { grid-template-columns: 1fr; } }
.lic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.lic-grid .field label { font-size: 12px; margin-bottom: 4px; }
.lic-grid .field input, .lic-grid .field select { padding: 8px 10px; font-size: 14px; }
.lic-grid .field { margin: 0; }
.lic-grid .field input, .lic-grid .field select { width: 100%; }
.lic-span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .lic-grid { grid-template-columns: 1fr; } }
.btn-logout-red { background: #dc2626 !important; border-color: #991b1b !important; color: #ffffff !important; }
.btn-logout-red:hover { background: #b91c1c !important; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; }
.page-head .crumb { font-size: 13px; color: var(--ink-faint); margin-bottom: 2px; }
.page-head .crumb a { color: var(--accent); text-decoration: none; }
/* Nombre del cliente en el breadcrumb: destacado para identificar el expediente */
.page-head .crumb .crumb-client {
  font-weight: 800; font-size: 15px; color: var(--accent);
  background: rgba(30,79,163,.1); padding: 4px 12px; border-radius: 980px;
  border: 1px solid rgba(30,79,163,.25); white-space: nowrap;
}
.page-head .crumb .crumb-client:hover { background: rgba(30,79,163,.18); }
/* Breadcrumb grande con acceso directo al estatus (regla de Wellington) */
.page-head .crumb-big {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 19px; font-weight: 700; color: var(--ink); margin-bottom: 6px;
}
.page-head .crumb-big .crumb-client { font-size: 19px; }
.status-quick {
  font-size: 14px; font-weight: 600; padding: 6px 10px;
  border: 1.5px solid var(--accent); border-radius: 8px; background: #fff; color: var(--accent);
  cursor: pointer; max-width: 220px;
}
.page-head .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-head h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* --------------------------------- cards ---------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.card h3 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.stat { font-size: 34px; font-weight: 800; color: var(--ink); }
.stat small { font-size: 14px; font-weight: 400; color: var(--ink-soft); }
.rowline { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid #eef1f4; font-size: 14px; }
.rowline:first-of-type { border-top: 0; }
/* La píldora de la derecha (fecha) queda compacta y centrada verticalmente,
   sin estirarse a la altura de la fila (regla de Wellington 2026-10-16). */
.rowline > .nav-badge {
  margin-left: auto; background: #e0242e; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 999px; padding: 0 6px;
  align-items: center; justify-content: center; line-height: 1;
}
.nav-badge {
  margin-left: auto; background: #e0242e; color: #fff; font-size: 11px; font-weight: 800;
  min-width: 20px; height: 20px; border-radius: 999px; padding: 0 6px;
  align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35);
}
.badge { align-self: center; }
/* Ficha del cliente: filas simétricas label arriba, valor abajo */
.kv-row { padding: 10px 0; border-top: 1px solid #eef1f4; }
.kv-row:first-of-type { border-top: 0; }
.kv-label { display: block; font-size: 12px; margin-bottom: 4px; }
.kv-val { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.kv-val b { word-break: break-word; }
.kv-copy { flex-shrink: 0; }
.muted { color: var(--ink-soft); } .faint { color: var(--ink-faint); } .small { font-size: 13px; }

/* --------------------------------- tablas --------------------------------- */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; padding: 10px 14px; background: #f6f8fa; color: var(--ink-soft);
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.grid td { padding: 11px 14px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: #f4f7fb; }

/* Vista de usuarios: nombre destacado, permisos en píldoras, filas aireadas */
.u-cell { display: flex; align-items: center; gap: 12px; }
.u-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
}
.u-name { font-weight: 800; font-size: 16px; color: var(--ink); letter-spacing: .01em; }
.u-user { background: #eef2f7; padding: 3px 9px; border-radius: 6px; font-size: 13px; }
.u-perms { display: flex; flex-wrap: wrap; gap: 6px; }
table.grid.users-tbl td { padding: 14px; }
.b-purple { background: #ece5fb; color: #5b21b6; }
/* Acciones de fila: botones separados; Eliminar en rojo sólido */
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: 12px; }
.btn-del { background: #e02424; border-color: #c81e1e; color: #fff; font-weight: 700; }
.btn-del:hover { background: #c81e1e; border-color: #a11f26; color: #fff; }

/* --------------------------------- botones --------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: 6px; padding: 9px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--panel); color: var(--ink); border-color: var(--line);
}
.btn:hover { background: #f4f6f8; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
/* Botones de WhatsApp: siempre verdes (regla de Wellington) */
.btn-wa { background: #25d366; border-color: #1da851; color: #fff; }
.btn-wa:hover { background: #1da851; border-color: #178a43; color: #fff; }
.btn-danger { background: #fff; border-color: #e5b3b6; color: var(--bad); }
.btn-danger:hover { background: #fdf0f0; }
.btn-beige { background: #f1e9d6; border-color: #ddd0b3; color: #6d5f42; }
.btn-beige:hover { background: #e9dec3; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); padding: 6px 8px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* --------------------------------- forms ---------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--ink); font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(30,79,163,.25); border-color: var(--accent);
}
.field textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.form-panel h3 { margin: 0 0 14px; font-size: 16px; }

.yesno { display: flex; gap: 10px; }
.yesno button {
  flex: 1; padding: 12px; border: 2px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--ink-soft);
}
.yesno button.sel-yes,
.yesno button.sel-no { border-color: #22a355; border-width: 2px; }

/* Pregunta de opción múltiple: cuadros seleccionables */
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 480px) { .choice-grid { grid-template-columns: 1fr; } }
.choice-box {
  padding: 16px 12px; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  color: var(--ink-soft); text-align: center; min-height: 64px;
  display: flex; align-items: center; justify-content: center;
}
.choice-box.sel { border-color: var(--accent); color: var(--accent); background: #eef3fd; }

/* --------------------------------- badges --------------------------------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.b-amber { background: #fdf0dc; color: #92600a; }
.b-blue { background: #e3ecfa; color: #1e4fa3; }
.b-green { background: #ddf0e5; color: #14663c; }
.b-gray { background: #e9edf1; color: #5b6572; }
.b-red { background: #fbe3e4; color: #a11f26; }

/* ---------------------------------- tabs ---------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  background: none; border: 0; padding: 10px 14px; font-size: 14px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* -------------------------------- checklist ------------------------------- */
.check-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: #fff;
}
.check-item .grow { flex: 1; min-width: 0; }
.check-item .t { font-weight: 600; font-size: 14px; }
.check-item .h { font-size: 12px; color: var(--ink-faint); }
.check-item.done { border-color: #bfe3cd; background: #f3faf6; }
.check-dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); color: transparent;
}
.check-item.done .check-dot, .doc-card.done .check-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; flex: none; color: var(--ink-soft);
}
.icon-btn.danger { color: #c0392b; border-color: #f0c9c4; }
.icon-btn.danger:hover { background: #fdecea; }
.check-item .meta { font-size: 12px; color: var(--ink-soft); text-align: right; }

/* ---------------------------------- chat ---------------------------------- */
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; max-height: 420px; overflow-y: auto; padding: 4px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.msg .who { font-size: 11px; font-weight: 700; margin-bottom: 3px; opacity: .75; }
.msg .when { font-size: 11px; opacity: .6; margin-top: 4px; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.msg.them { align-self: flex-start; background: #e9edf1; color: var(--ink); border-bottom-left-radius: 3px; }
.chat-input { display: flex; gap: 8px; }
.chat-input input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }

/* --------------------------------- modal ---------------------------------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(20,28,38,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto; padding: 24px 26px;
}
.modal h3 { margin: 0 0 16px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ------------------------------ firma (canvas) ----------------------------- */
.sig-pad { border: 2px dashed var(--line); border-radius: var(--radius); background: #fbfcfd; touch-action: none; }
.sig-pad canvas { display: block; width: 100%; height: 180px; cursor: crosshair; }
.sig-preview { max-width: 320px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* ------------------------------ portal cliente ----------------------------- */
.portal-wrap { max-width: 640px; margin: 0 auto; padding: 18px 14px 60px; min-height: 100vh; }
@media (min-width: 1100px) { .portal-wrap { max-width: 1000px; } }
@media (min-width: 1500px) { .portal-wrap { max-width: 1280px; } }
.portal-top {
  background: var(--sidebar); color: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 16px;
}
.portal-top .t { font-size: 19px; font-weight: 800; letter-spacing: .05em; }
.portal-top .s { font-size: 13px; color: #aebbce; margin-top: 2px; }
.portal-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 14px; }
.steps-bar { display: flex; gap: 6px; margin-bottom: 18px; }
.steps-bar span { flex: 1; height: 6px; border-radius: 3px; background: #dfe4ea; }
.steps-bar span.on { background: var(--accent); }
.pin-input {
  font-size: 30px !important; letter-spacing: .5em; text-align: center;
  padding: 14px !important; font-weight: 800;
}
.doc-upload { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.legal-text {
  white-space: pre-wrap; font-size: 13px; background: #f6f8fa; border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 16px; max-height: 260px; overflow-y: auto; margin-bottom: 14px;
  font-family: Georgia, serif;
}

/* ------------------------------- impresión -------------------------------- */
.print-toolbar {
  position: sticky; top: 0; z-index: 50; background: var(--sidebar); color: #fff;
  padding: 12px 18px; display: flex; align-items: center; gap: 12px;
}
.print-doc { background: #fff; color: #111; max-width: 820px; margin: 24px auto; padding: 48px 52px; box-shadow: 0 2px 18px rgba(0,0,0,.12); font-size: 14px; }
.print-doc h1 { font-size: 24px; margin: 0; }
.print-doc h2 { font-size: 16px; border-bottom: 2px solid #111; padding-bottom: 6px; margin: 28px 0 12px; text-transform: uppercase; letter-spacing: .04em; }
.print-doc .doc-print { break-inside: avoid; margin-bottom: 24px; }
@media print { .print-doc .doc-print { break-before: page; } .print-doc .doc-print:first-of-type { break-before: auto; } }
.print-doc table { width: 100%; border-collapse: collapse; margin: 8px 0 4px; }
.print-doc table td, .print-doc table th { border: 1px solid #999; padding: 6px 9px; font-size: 13px; text-align: left; vertical-align: top; }
.print-doc table th { background: #eee; }
.print-doc .kv { display: grid; grid-template-columns: 220px 1fr; gap: 4px 12px; margin: 6px 0; }
.print-doc .kv dt { font-weight: 700; } .print-doc .kv dd { margin: 0; }
.print-doc .sigimg { max-width: 300px; border: 1px solid #999; }
.print-doc .foot { margin-top: 34px; font-size: 12px; color: #444; border-top: 1px solid #999; padding-top: 10px; }

@media print {
  body { background: #fff; }
  .print-toolbar, .demo-banner, .no-print { display: none !important; }
  .print-doc { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* --------------------------------- varios --------------------------------- */
.alert {
  border-radius: var(--radius); padding: 12px 16px; font-size: 14px; margin-bottom: 16px;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert-err { background: #fdeeee; border: 1px solid #f0c4c6; color: #8f1d23; }
.alert-ok { background: #e9f6ee; border: 1px solid #bfe3cd; color: #14663c; }
.alert-info { background: #e8effa; border: 1px solid #c3d4ef; color: #1e4fa3; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .searchbox { margin: 0; }
.toolbar .searchbox input { height: 46px; }
.toolbar select {
  height: 46px; padding: 0 14px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--ink); margin: 0;
}
.searchbox { position: relative; }
.searchbox .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); }
.searchbox input { padding-left: 34px; width: 260px; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-faint); }
.empty .ic-lg { opacity: .4; margin-bottom: 8px; }
.pin-display {
  font-size: 40px; font-weight: 800; letter-spacing: .35em; text-align: center;
  background: #f6f8fa; border: 2px dashed var(--accent); border-radius: 10px; padding: 14px; margin: 12px 0;
}
.link-box {
  font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all;
  background: #f6f8fa; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
}
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 22px 0 10px; font-weight: 700; }

/* Barra móvil: oculta en escritorio, visible solo en teléfono (ver @media abajo) */
.mobilebar { display: none; }
/* Drawer móvil: oculto en escritorio por defecto */
.mb-drawer { display: none; }
.mb-scrim { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 16px 14px 60px; }
  .print-doc { padding: 24px 20px; }
  .cards { grid-template-columns: 1fr 1fr; }
  /* Barra superior móvil: reemplaza al sidebar oculto */
  .mobilebar {
    display: flex; align-items: center; gap: 8px;
    position: -webkit-sticky; position: sticky; top: 0; z-index: 40;
    background: rgba(255, 255, 255, .95); color: var(--ink);
    -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--line-soft);
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    min-height: 56px;
  }
  .app { flex-direction: column; }
  .main { flex: 1; -webkit-overflow-scrolling: touch; }
/* Drawer de navegación móvil */
.mb-drawer {
  display: flex;
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 85vw;
  background: #fff; z-index: 100;
  transform: translateX(-100%); transition: transform .25s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,.15);
  flex-direction: column;
}
.mb-drawer.open { transform: translateX(0); }
.mb-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.mb-drawer-nav { display: flex; flex-direction: column; padding: 10px; gap: 2px; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.mb-drawer-nav a {
  display: flex; align-items: center; gap: 12px; color: #d7e5fb;
  text-decoration: none; padding: 10px 12px; border-radius: 10px;
  font-size: 15px; font-weight: 600; min-height: 46px;
}
.mb-drawer-nav a.active { background: var(--accent-soft); color: var(--accent); }
.mb-drawer-nav a .ic { width: 22px; height: 22px; }
.mb-scrim {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99;
}
.mb-scrim.open { display: block; }
.mb-drawer-foot { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); margin-top: auto; flex: none; }
@media (max-width: 860px) {
  .mb-drawer { display: flex; }
}

  /* ---- Optimización móvil del portal del cliente ---- */
  /* Tarjeta de documento: texto arriba, botón Subir grande a todo ancho abajo */
  .check-item { flex-wrap: wrap; gap: 10px; padding: 14px; }
  .check-item .check-dot { width: 26px; height: 26px; }
  .check-item .grow { flex: 1 1 calc(100% - 40px); }
  .check-item .t { font-size: 15px; }
  .check-item > div:last-child { flex: 1 1 100%; }
  .check-item > div:last-child .btn { width: 100%; justify-content: center; min-height: 46px; font-size: 15px; }
  /* Botones con tamaño táctil cómodo */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  /* Pestañas del portal en 2 filas para smartphone */
  .portal-wrap .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-bottom: none; margin-bottom: 14px; }
  .portal-wrap .tabs button { flex: none; justify-content: center; padding: 12px 4px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 0; white-space: normal; text-align: center; line-height: 1.2; }
  .portal-wrap .tabs button.active { color: var(--accent); border-color: var(--accent); background: rgba(37,99,235,0.08); }
  /* Pestañas del ADMIN en cuadrícula para smartphone (regla de Wellington:
     ver el menú completo sin deslizar hacia los lados). No afecta al portal
     del cliente: .portal-wrap .tabs tiene mayor especificidad. */
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-bottom: none; margin-bottom: 14px; overflow: visible; }
  .tabs button { justify-content: center; padding: 12px 4px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 0; white-space: normal; text-align: center; line-height: 1.2; }
  .tabs button.active { color: var(--accent); border-color: var(--accent); background: rgba(37,99,235,0.08); }
  .tabs button:last-child:nth-child(3n+1) { grid-column: 1 / -1; }
  /* Inputs a 16px para que iOS no haga zoom al enfocarlos */
  .field input, .field select, .field textarea { font-size: 16px; padding: 12px; }
  .searchbox input { font-size: 16px !important; }
  /* Encabezado y tarjetas del portal más compactos */
  .portal-top { padding: 14px 16px; border-radius: 10px; }
  .portal-top .t { font-size: 17px; }
  .portal-card { padding: 16px; }
  .section-title { font-size: 14px; margin: 20px 0 10px; }
  /* PIN: tamaño que cabe bien en pantallas angostas */
  .pin-input { font-size: 26px !important; letter-spacing: .35em; }
}
.mb-brand { font-weight: 800; letter-spacing: .08em; font-size: 16px; color: #fff; }
.mb-brand .mark { color: #7aa7e8; }
.mb-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mb-nav a {
  display: flex; align-items: center; gap: 6px; color: var(--sidebar-ink);
  text-decoration: none; padding: 8px 10px; border-radius: 6px; font-size: 14px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.mb-nav a.active { background: rgba(122,167,232,.25); color: #fff; }

/* Selector de idioma ES | EN */
.lang-toggle {
  display: inline-flex; align-items: center; vertical-align: middle;
  border-radius: 980px; padding: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,.8), rgba(245,245,247,.55));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(210,210,215,.85);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.9), 0 2px 8px rgba(0,0,0,.07);
}
.lang-toggle button {
  background: none; border: 0; padding: 7px 18px; cursor: pointer;
  font-weight: 700; font-size: 12.5px; letter-spacing: .05em;
  color: var(--ink-soft); border-radius: 980px; font-family: inherit;
  line-height: 1; transition: all .15s;
}
.lang-toggle button.on {
  background: linear-gradient(180deg, rgba(47,107,208,.95), rgba(30,79,163,.9));
  color: #fff;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.45), 0 2px 10px rgba(30,79,163,.4);
  text-shadow: 0 1px 2px rgba(0,30,80,.3);
}
.sidebar .lang-toggle { margin-bottom: 10px; }
.portal-topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.copy-ok { margin-top: 10px; }
.link-box.selectable { user-select: all; cursor: text; }

/* Checklist "qué me debe cada cliente" */
.gap-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.gap-row:last-child { border-bottom: 0; padding-bottom: 0; }
.gap-row:first-of-type { padding-top: 4px; }
.gap-link { color: var(--accent); text-decoration: underline; font-weight: 600; }
.gap-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gap-tags .badge { white-space: nowrap; }

/* Portal del cliente: subsecciones en paralelo (desktop), apiladas en teléfono */
.doc-cols { display: grid; grid-template-columns: 1fr; gap: 4px 24px; }
@media (min-width: 1024px) {
  .doc-cols { grid-template-columns: 1fr 1fr; align-items: start; }
  .doc-items-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
}

/* Documentos del cliente: cuadrícula simétrica, legible en móvil y escritorio */
.doc-sections { display: grid; gap: 28px; margin-top: 6px; min-width: 0; }
.doc-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
@media (min-width: 640px) { .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .doc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .doc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.doc-card {
  display: flex; flex-direction: column; gap: 8px; height: 100%; min-width: 0;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff;
}
.doc-card.done { border-color: #bfe3cd; background: #f3faf6; }
.doc-card-top { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.doc-card-top > div:last-child { min-width: 0; flex: 1; }
.doc-card .t { font-weight: 700; font-size: 15px; line-height: 1.35; }
.doc-card .h { font-size: 13px; color: var(--ink-faint); margin-top: 2px; }
.doc-card .file-row { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.doc-card .file-name {
  flex: 1; min-width: 0; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-card .file-date { font-size: 12px; color: var(--ink-faint); }
.doc-card-act { margin-top: auto; padding-top: 6px; }
.doc-card-act .btn { width: 100%; justify-content: center; }

/* Tabla de datos extraídos por IA */
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv tr:last-child td { border-bottom: none; }

/* Asistente del cuestionario: una pregunta por pantalla */
.quiz-top { display: flex; justify-content: space-between; align-items: center; }
.quiz-count { font-weight: 700; color: var(--accent); }
.quiz-bar { height: 8px; background: var(--line); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.quiz-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.quiz-nav .btn { min-height: 48px; }

/* Botón copiar en ficha: feedback visual */
.kv-copy.copied { border-color: #22a355; color: #22a355; }

/* ============ Optimización smartphone ============ */
@media (max-width: 640px) {
  /* Tablas → tarjetas apiladas */
  .table-wrap { overflow-x: visible; border: none; background: transparent; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td {
    display: block; width: 100%;
  }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); margin-bottom: 10px; padding: 6px 0;
  }
  .table-wrap td { border: none; padding: 6px 14px; }
  .table-wrap td:last-child { text-align: right; }

  /* Formularios a una columna */
  .form-grid { grid-template-columns: 1fr; }

  /* Toolbar: botones envuelven */
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .toolbar .btn { flex: 1 1 auto; min-height: 44px; justify-content: center; }

  /* Modal a pantalla completa */
  .modal-box { width: 100%; max-width: 100%; margin: 0; border-radius: 0; max-height: 100dvh; }

  /* Ficha: filas más compactas */
  .rowline { flex-wrap: wrap; gap: 4px; }
  .rowline b { word-break: break-word; }

  /* Quiz nav: botones grandes táctiles */
  .quiz-nav { gap: 8px; }
  .quiz-nav .btn { min-height: 52px; font-size: 16px; }

  /* Yes/No a una columna en pantallas muy pequeñas */
  .yesno { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Dashboard cards a una columna */
  .cards { grid-template-columns: 1fr; }

  /* Encabezados más compactos */
  h2 { font-size: 20px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
}

/* Indicador de subida en curso */
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spinrot .7s linear infinite; vertical-align: -2px; }
@keyframes spinrot { to { transform: rotate(360deg); } }

/* Línea de tiempo del estatus (portal del cliente) */
.st-track { display: flex; align-items: flex-start; }
.st-step { display: flex; flex-direction: column; align-items: center; flex: 0 1 auto; min-width: 0; }
.st-dot { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 2px solid #d1d5db; background: #fff; color: #9ca3af; flex: none; }
.st-dot .ic { width: 15px; height: 15px; }
.st-dot.st-done { background: #22c55e; border-color: #22c55e; color: #fff; }
.st-dot.st-todo { opacity: 0.55; }
.st-label { font-size: 10.5px; text-align: center; margin-top: 6px; line-height: 1.25; color: #6b7280; max-width: 78px; }
.st-step.current .st-label { color: #111827; font-weight: 700; }
.st-step.done .st-label { color: #374151; }
.st-step.todo .st-label { opacity: 0.55; }
.st-conn { flex: 1 1 auto; height: 2px; background: #e5e7eb; margin-top: 15px; min-width: 8px; }
.st-conn.st-conn-done { background: #22c55e; }

/* Tabla comparativa año tras año (portal del cliente) */
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cmp-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; padding: 8px 6px; border-bottom: 2px solid #e5e7eb; }
.cmp-table td { padding: 10px 6px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.cmp-table tr:last-child td { border-bottom: none; }
@media (max-width: 420px) {
  .st-label { font-size: 9.5px; max-width: 64px; }
  .st-dot { width: 26px; height: 26px; font-size: 12px; }
  .st-conn { margin-top: 13px; }
}

/* ===== LIQUID GLASS · muestra (login + Inicio) ===== */
.login-bg::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(800px 500px at 85% -10%, rgba(39,169,253,.5), transparent 60%),
              radial-gradient(700px 500px at -10% 110%, rgba(124,58,237,.35), transparent 60%),
              linear-gradient(160deg, rgba(10,41,99,.18), rgba(4,18,46,.42)); }
.login-card { background: linear-gradient(150deg, rgba(255,255,255,.84), rgba(255,255,255,.64));
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255,255,255,.7); border-radius: 28px;
  box-shadow: 0 24px 60px rgba(1,10,35,.45), inset 0 1px 0 rgba(255,255,255,.9); }
.login-legal { background: linear-gradient(150deg, rgba(255,255,255,.8), rgba(255,255,255,.6));
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255,255,255,.65); border-radius: 22px;
  box-shadow: 0 18px 44px rgba(1,10,35,.4), inset 0 1px 0 rgba(255,255,255,.85); }
.login-card .btn { border-radius: 14px; }
.login-card .btn-primary { background: linear-gradient(135deg, #38b6ff, #1b7fd4); border-color: transparent;
  box-shadow: 0 8px 22px rgba(27,127,212,.45), inset 0 1px 0 rgba(255,255,255,.5); }
.login-card input, .login-card select { border-radius: 12px; }
.login-card .tabs { border-radius: 999px; }
.login-card .tabs button { border-radius: 999px; }

body.glass-on .app {
  background: radial-gradient(900px 600px at 88% -10%, rgba(39,169,253,.5), transparent 60%),
              radial-gradient(760px 540px at -12% 108%, rgba(124,58,237,.34), transparent 60%),
              radial-gradient(620px 420px at 55% 118%, rgba(16,185,166,.26), transparent 60%),
              linear-gradient(160deg, #0a2963 0%, #071c46 55%, #04122e 100%);
  background-attachment: fixed; }
body.glass-on .sidebar { margin: 12px 0 12px 12px; top: 12px; height: calc(100vh - 24px); border-radius: 24px;
  background: linear-gradient(165deg, rgba(13,48,110,.82), rgba(6,22,54,.78));
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid rgba(255,255,255,.16); box-shadow: 0 24px 48px rgba(1,10,35,.45), inset 0 1px 0 rgba(255,255,255,.14); }
body.glass-on .page-head h2 { color: #fff; }
body.glass-on .page-head .crumb { color: #7cc4ff; }
body.glass-on #view > .muted { color: rgba(255,255,255,.8); }
body.glass-on .page-head .btn-primary { background: linear-gradient(135deg, #38b6ff, #1b7fd4); border-color: transparent;
  box-shadow: 0 8px 22px rgba(27,127,212,.5), inset 0 1px 0 rgba(255,255,255,.5); }
body.glass-on .card { background: linear-gradient(140deg, rgba(255,255,255,.8), rgba(255,255,255,.58));
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255,255,255,.7); border-radius: 22px;
  box-shadow: 0 14px 34px rgba(1,10,35,.28), inset 0 1px 0 rgba(255,255,255,.9); }
body.glass-on .mobilebar { background: rgba(8,30,72,.72);
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid rgba(255,255,255,.16); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .login-card, .login-legal { background: #fff; }
  body.glass-on .card { background: #fff; }
  body.glass-on .sidebar { background: var(--sidebar); }
}

/* Pestañas del login: dos botones píldora simétricos y separados, sin barra */
.login-card .tabs { display: flex; gap: 10px; border-bottom: none; overflow: visible; margin-bottom: 16px; }
.login-card .tabs button { flex: 1 1 0; justify-content: center; padding: 11px 0; margin-bottom: 0;
  border: 1px solid #cbd5e1; border-radius: 999px; background: rgba(255,255,255,.65);
  color: #334155; font-weight: 700; font-size: 14px; white-space: nowrap; }
.login-card .tabs button.active { background: linear-gradient(135deg, #38b6ff, #1b7fd4);
  border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(27,127,212,.35); }

/* Login centrado y simétrico: idioma y textos alineados, legal sin negritas */
.login-card .sub { text-align: center; }
.login-card .field label { display: block; text-align: center; }
.login-card .lang-pick { gap: 10px; }
.login-card .lang-btn { min-height: 46px; border-radius: 999px; border: 1px solid #cbd5e1;
  background: rgba(255,255,255,.65); color: #334155; font-size: 15px; }
.login-card .lang-btn:not(.active) { opacity: 1; }
.login-card .lang-btn.active { background: linear-gradient(135deg, #38b6ff, #1b7fd4);
  border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(27,127,212,.35); }
.login-legal .login-legal-title { font-weight: 400; color: #334155; font-size: 12px; }

/* Idioma del login como toggle segmentado (una sola píldora) */
.login-card .lang-pick { display: flex; justify-content: center; }
.lang-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: rgba(15,23,42,.08); border: 1px solid rgba(15,23,42,.07); }
.lang-seg-btn { border: 0; background: transparent; padding: 7px 24px; border-radius: 999px;
  font-size: 14px; font-weight: 700; color: #475569; cursor: pointer; transition: all .18s ease; }
.lang-seg-btn.active { background: linear-gradient(135deg, #38b6ff, #1b7fd4); color: #fff;
  box-shadow: 0 4px 12px rgba(27,127,212,.4); }

/* ===== LIQUID GLASS · fase 2 (toda la plataforma) ===== */
body.glass-on .form-panel { background: linear-gradient(140deg, rgba(255,255,255,.8), rgba(255,255,255,.58));
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255,255,255,.7); border-radius: 22px;
  box-shadow: 0 14px 34px rgba(1,10,35,.28), inset 0 1px 0 rgba(255,255,255,.9); }
body.glass-on .table-wrap { background: linear-gradient(140deg, rgba(255,255,255,.82), rgba(255,255,255,.6));
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255,255,255,.7); border-radius: 22px;
  box-shadow: 0 14px 34px rgba(1,10,35,.28), inset 0 1px 0 rgba(255,255,255,.9); }
body.glass-on table.grid th { background: rgba(255,255,255,.4); }
body.glass-on table.grid td, body.glass-on table.grid th { border-color: rgba(15,23,42,.07); }
body.glass-on table.grid tbody tr:hover { background: rgba(255,255,255,.38); }
body.glass-on .btn:not(.btn-primary):not(.btn-logout-red):not(.btn-wa) {
  background: rgba(255,255,255,.78); border: 1px solid rgba(15,23,42,.1); border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9); }
body.glass-on .btn-primary { background: linear-gradient(135deg, #38b6ff, #1b7fd4); border-color: transparent;
  border-radius: 999px; box-shadow: 0 8px 22px rgba(27,127,212,.4), inset 0 1px 0 rgba(255,255,255,.5); }
body.glass-on input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.glass-on select, body.glass-on textarea {
  background: rgba(255,255,255,.78); border: 1px solid rgba(15,23,42,.13); border-radius: 12px; }
body.glass-on .modal { background: linear-gradient(150deg, rgba(255,255,255,.92), rgba(255,255,255,.82));
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid rgba(255,255,255,.75); border-radius: 26px;
  box-shadow: 0 28px 64px rgba(1,10,35,.5), inset 0 1px 0 rgba(255,255,255,.95); }
body.glass-on .modal-back { background: rgba(4,18,46,.48);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.glass-on .alert { border-radius: 14px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
body.glass-on .kv-row, body.glass-on .rowline { border-color: rgba(15,23,42,.07); }
body.glass-on .mb-drawer { background: linear-gradient(165deg, rgba(13,48,110,.9), rgba(6,22,54,.88));
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  border-right: 1px solid rgba(255,255,255,.16); }
@media (min-width: 641px) {
  body.glass-on .tabs { border-bottom: none; gap: 6px; }
  body.glass-on .tabs button { border: 1px solid transparent; border-bottom: 1px solid transparent;
    border-radius: 999px; padding: 8px 15px; margin-bottom: 0; }
  body.glass-on .tabs button.active { background: rgba(27,127,212,.14); color: #1b7fd4;
    border-color: rgba(27,127,212,.25); }
}
/* Portal del cliente: cristal claro */
body:has(.portal-wrap) { background:
  radial-gradient(800px 480px at 90% -10%, rgba(39,169,253,.22), transparent 60%),
  radial-gradient(700px 460px at -10% 105%, rgba(10,41,99,.14), transparent 60%),
  linear-gradient(170deg, #e9f2fd, #f7fbff); background-attachment: fixed; }
.portal-card { background: linear-gradient(150deg, rgba(255,255,255,.88), rgba(255,255,255,.72));
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255,255,255,.8); border-radius: 20px;
  box-shadow: 0 12px 30px rgba(10,41,99,.13), inset 0 1px 0 rgba(255,255,255,.95); }
.portal-wrap .btn-primary { background: linear-gradient(135deg, #38b6ff, #1b7fd4); border-color: transparent;
  border-radius: 999px; box-shadow: 0 8px 22px rgba(27,127,212,.35), inset 0 1px 0 rgba(255,255,255,.5); }
.portal-wrap .btn { border-radius: 999px; }
@media print {
  body.glass-on .app { background: #fff !important; }
  body.glass-on .card, body.glass-on .form-panel, body.glass-on .table-wrap {
    background: #fff !important; -webkit-backdrop-filter: none; backdrop-filter: none;
    box-shadow: none; border-color: #ddd; }
}

/* Pestañas sobre el fondo aurora: letra clara (dentro de tarjetas quedan oscuras) */
body.glass-on #view > .tabs button { color: rgba(255,255,255,.8); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); }
body.glass-on #view > .tabs button.active { background: rgba(56,182,255,.9); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(27,127,212,.45); }
body.glass-on .card .tabs button, body.glass-on .form-panel .tabs button, body.glass-on .modal .tabs button { color: var(--ink-soft); background: transparent; border-color: transparent; box-shadow: none; }
body.glass-on .card .tabs button.active, body.glass-on .form-panel .tabs button.active, body.glass-on .modal .tabs button.active { background: rgba(27,127,212,.14); color: #1b7fd4; border-color: rgba(27,127,212,.25); }

/* Notificaciones: tarjeta compacta y filas con aire */
.notif-card { max-width: 880px; }
.notif-item { box-shadow: 0 2px 8px rgba(10,41,99,.06); transition: box-shadow .15s ease, transform .15s ease; }
.notif-item:hover { box-shadow: 0 6px 16px rgba(10,41,99,.13); transform: translateY(-1px); }
.notif-item .faint { color: var(--ink-soft); font-weight: 600; white-space: nowrap; }

/* Barrido de legibilidad: texto suelto sobre el fondo aurora va claro;
   dentro de tarjetas/paneles/tablas/modales vuelve a su color oscuro */
body.glass-on .muted { color: rgba(255,255,255,.78); }
body.glass-on .faint { color: rgba(255,255,255,.58); }
body.glass-on .section-title { color: rgba(255,255,255,.88); }
body.glass-on .empty { color: rgba(255,255,255,.65); }
body.glass-on #view > h3, body.glass-on #view > h4 { color: #fff; }
body.glass-on .card .muted, body.glass-on .form-panel .muted, body.glass-on .table-wrap .muted,
body.glass-on .modal .muted, body.glass-on .check-item .muted, body.glass-on .tbl .muted { color: var(--ink-soft); }
body.glass-on .card .faint, body.glass-on .form-panel .faint, body.glass-on .table-wrap .faint,
body.glass-on .modal .faint, body.glass-on .check-item .faint, body.glass-on .tbl .faint { color: var(--ink-faint); }
body.glass-on .card .section-title, body.glass-on .form-panel .section-title,
body.glass-on .modal .section-title { color: var(--ink-soft); }
body.glass-on .card .empty, body.glass-on .table-wrap .empty { color: var(--ink-faint); }
body.glass-on .card h3, body.glass-on .card h4, body.glass-on .form-panel h3,
body.glass-on .form-panel h4, body.glass-on .modal h3, body.glass-on .modal h4 { color: var(--ink); }
body.glass-on .tbl { width: 100%; border-collapse: separate; border-spacing: 0; color: var(--ink);
  background: linear-gradient(140deg, rgba(255,255,255,.85), rgba(255,255,255,.65));
  border: 1px solid rgba(255,255,255,.7); border-radius: 18px; overflow: hidden;
  box-shadow: 0 14px 34px rgba(1,10,35,.28); }
body.glass-on .tbl th, body.glass-on .tbl td { padding: 10px 12px; border-bottom: 1px solid rgba(15,23,42,.07); text-align: left; }
body.glass-on .tbl th { background: rgba(255,255,255,.4); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
body.glass-on #review-panel > div { background: linear-gradient(140deg, rgba(255,255,255,.8), rgba(255,255,255,.58));
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255,255,255,.7); border-radius: 22px; padding: 18px;
  box-shadow: 0 14px 34px rgba(1,10,35,.28), inset 0 1px 0 rgba(255,255,255,.9); }

/* Pie de barra: botones a todo el ancho, alineados con la tarjeta de sesión
   (regla de Wellington 2026-10-22: todo simétrico, nada de píldoras centradas) */
.side-actions { align-items: stretch; }
.side-actions .btn { width: 100%; }
.side-logout-badge { margin-left: auto; flex: none; width: 32px; height: 32px; padding: 0;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.25); color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(220,38,38,.45); }
.side-logout-badge svg { width: 16px; height: 16px; }
.side-logout-badge:hover { filter: brightness(1.1); }
.mb-drawer-foot { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.mb-drawer-foot .btn { width: auto; padding-left: 16px; padding-right: 16px; }

/* ===== FONDO BLANCO (orden de Wellington): el oscuro queda solo en el menú lateral ===== */
body.glass-on .app { background: #fff; }
body.glass-on .page-head h2 { color: var(--ink); }
body.glass-on .page-head .crumb { color: #1b7fd4; }
body.glass-on .muted { color: var(--ink-soft); }
body.glass-on .faint { color: var(--ink-faint); }
body.glass-on .section-title { color: var(--ink-soft); }
body.glass-on .empty { color: var(--ink-faint); }
body.glass-on #view > h3, body.glass-on #view > h4 { color: var(--ink); }
body.glass-on #view > .tabs button { color: var(--ink-soft); background: rgba(15,23,42,.05); border-color: rgba(15,23,42,.1); box-shadow: none; }
body.glass-on .card, body.glass-on .form-panel, body.glass-on .table-wrap {
  background: #fff; border: 1px solid #e5edf7;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 10px 28px rgba(10,41,99,.08); }
body.glass-on .tbl { background: #fff; border: 1px solid #e5edf7; box-shadow: 0 10px 28px rgba(10,41,99,.08); }
body.glass-on .tbl th { background: #f2f7fd; }
body.glass-on table.grid th { background: #f2f7fd; }
body.glass-on #review-panel > div { background: #fff; border: 1px solid #e5edf7;
  -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 10px 28px rgba(10,41,99,.08); }
body.glass-on .btn:not(.btn-primary):not(.btn-logout-red):not(.btn-wa) {
  background: #fff; border: 1px solid rgba(15,23,42,.14); box-shadow: 0 2px 8px rgba(10,41,99,.06); }
body.glass-on input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.glass-on select, body.glass-on textarea { background: #fff; }
body.glass-on .modal { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }


/* ===== MOBILE PASS: cajón legible + toolbars sin encimarse (2026-10-20) ===== */
.mb-drawer { color: #eaf2ff; }
.mb-drawer-nav a { color: #d7e5fb; }
.mb-drawer-nav a.active { background: rgba(39,169,253,.25); color: #ffffff; }
.mb-drawer .side-user-name { color: #ffffff; }
.mb-drawer .side-user-role { color: #a9c3ee; opacity: 1; }
.mb-drawer .side-copy { color: #9db8e8; }
@media (max-width: 640px) {
  /* Toolbars con campo (mes/fecha/select): el campo ocupa su fila y el botón la suya */
  .toolbar:has(> .field) > .field { flex: 1 1 100%; min-width: 0; }
  .toolbar:has(> .field) > .field input,
  .toolbar:has(> .field) > .field select { width: 100%; max-width: 100%; min-width: 0; }
  .toolbar:has(> .field) > .btn { flex: 1 1 100%; justify-content: center; }
  input[type="month"], input[type="date"] { max-width: 100%; }
  /* Pestañas de WoFFice en cuadrícula de 3 (sin deslizar) */
  .off-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .off-tabs .btn { width: 100%; justify-content: center; min-height: 44px; }
}


/* ===== Tablero por etapas (Kanban) ===== */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; -webkit-overflow-scrolling: touch; }
.board-col { flex: 0 0 252px; background: #f4f8fd; border: 1px solid #e5edf7; border-radius: 16px; padding: 10px; min-height: 140px; }
.board-col.over { outline: 2px dashed #27a9fd; outline-offset: -2px; }
.board-col h4 { margin: 2px 2px 10px; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; }
.board-card { background: #fff; border: 1px solid #e5edf7; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: 0 2px 8px rgba(15,23,42,.05); }
.board-card select { width: 100%; margin-top: 8px; }

/* Panel principal (Inicio): una sola rejilla de 4 columnas para que las
   costuras verticales coincidan entre filas en cualquier pantalla. */
.dash-cards { grid-template-columns: repeat(4, 1fr); }
.dash-hero .card { grid-column: span 2; }
.dash-cards .card > h3 { min-height: 36px; display: flex; align-items: flex-start; gap: 8px; }
@media (max-width: 1250px) {
  .dash-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-hero .card { grid-column: span 1; }
}
@media (max-width: 560px) {
  .dash-cards { grid-template-columns: 1fr; }
}

/* Encabezado del expediente: botones con aire y pestañas separadas por una
   línea (orden de Wellington 2026-10-22: nada junto ni desordenado) */
.page-head .toolbar { gap: 10px; row-gap: 10px; }
@media (min-width: 641px) {
  body.glass-on #view > .tabs { gap: 10px; padding-top: 16px; margin-top: 2px;
    border-top: 1px solid rgba(15,23,42,.09); }
  body.glass-on #view > .tabs button { padding: 9px 17px; }
}

/* Barra de desplazamiento del menú: fina y acorde a los colores del menú
   (Wellington 2026-10-22: que se vea, pero menos invasiva) */
.sidebar .nav, .mb-drawer-nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.sidebar .nav::-webkit-scrollbar, .mb-drawer-nav::-webkit-scrollbar { width: 6px; }
.sidebar .nav::-webkit-scrollbar-track, .mb-drawer-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar .nav::-webkit-scrollbar-thumb, .mb-drawer-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }
.sidebar .nav::-webkit-scrollbar-thumb:hover, .mb-drawer-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.38); }
.sidebar .nav::-webkit-scrollbar-button, .mb-drawer-nav::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
