/* ============================================================================
 * WellForms — estilos. Estética limpia inspirada en apple.com:
 * clara, aireada y premium. Sin emojis en la UI: solo iconos SVG inline.
 * ========================================================================== */

:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --ink: #1d1d1f;
  --ink-soft: #515154;
  --ink-faint: #86868b;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: #e9f2fd;
  --ok: #1d8127;
  --ok-soft: #e6f4ea;
  --warn: #b25000;
  --warn-soft: #fef3e2;
  --bad: #d70015;
  --bad-soft: #fdeeee;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .05);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, .10);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(0, 113, 227, .18); }

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

/* ------------------------------- demo banner ------------------------------ */
.demo-banner {
  background: #fff4d6; color: #7a4d00; text-align: center;
  font-size: 13px; font-weight: 600; letter-spacing: .04em;
  padding: 9px 12px; position: sticky; top: 0; z-index: 200;
  border-bottom: 1px solid #f0dfae;
}

/* --------------------------------- login ---------------------------------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(0, 113, 227, .07), transparent 60%),
    radial-gradient(700px 500px at 85% 90%, rgba(0, 113, 227, .05), transparent 60%),
    var(--bg);
}
.login-card {
  background: var(--panel); border-radius: 20px; padding: 40px 38px;
  width: 100%; max-width: 400px; box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft);
  text-align: center;
}
.login-card .tabs { display: flex; width: 100%; box-sizing: border-box; }
.login-card .tabs button { flex: 1; justify-content: center; }
.login-card .field label { text-align: center; }
.login-card p.sub { text-align: center; }
/* Selector de idioma centrado arriba del cuadro de login */
.login-lang {
  width: 100%; max-width: 400px; display: flex; justify-content: center;
  margin-bottom: 16px;
}
.login-card h1 { margin: 0 0 6px; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
/* Línea legal del login (©) — espejo de WellProTax */
.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; }
/* Centro de notificaciones: píldora liquid glass gris con el título */
.notif-hero { display: flex; justify-content: center; margin: 2px 0 16px; }
.notif-hero-pill {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: #1e293b;
  padding: 12px 24px; border-radius: 999px;
  background: linear-gradient(150deg, rgba(226,232,240,.88), rgba(203,213,225,.72));
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255,255,255,.75);
  box-shadow: 0 12px 30px rgba(15,23,42,.16), inset 0 1px 0 rgba(255,255,255,.9);
}
.notif-hero-pill svg { width: 21px; height: 21px; }
/* X de eliminar notificación: fondo rojo, siempre visible */
.notif-del {
  flex: 0 0 auto; align-self: center; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; cursor: pointer;
  background: #dc2626; color: #fff;
  box-shadow: 0 4px 12px rgba(220,38,38,.35);
}
.notif-del:hover { background: #b91c1c; }
.notif-del:active { transform: scale(.94); }
.notif-del svg { width: 16px; height: 16px; }
/* Pie con © del portal del cliente */
.portal-copy { text-align: center; color: var(--ink-faint, #94a3b8); font-size: 12px; padding: 22px 12px 8px; }
.login-card p.sub { margin: 0 0 24px; color: var(--ink-soft); font-size: 14px; }
.demo-hint {
  background: var(--warn-soft); border: 1px solid #f0d9a8; border-radius: var(--radius);
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px; color: #7c4a12;
}

/* --------------------------------- layout --------------------------------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 252px; background: rgba(255, 255, 255, .85); color: var(--ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none;
  border-right: 1px solid var(--line-soft);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
.brand { padding: 22px 20px 16px; flex: none; }
.brand .name { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.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(0,0,0,.3); background: transparent; color: #0071e3; cursor: pointer; padding: 0; flex: none; }
.info-i svg { width: 12px; height: 12px; }
.info-i:hover { background: rgba(0,113,227,.1); }
.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,.28); 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: #0071e3; 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; }
.brand .who {
  font-size: 15px; font-weight: 700; color: #0071e3; margin-top: 6px; letter-spacing: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
}
.nav { padding: 8px 12px; 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(--ink-soft);
  text-decoration: none; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: #f0f0f2; color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.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: 16px 20px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--ink-faint); display: flex; flex-direction: column; gap: 10px; align-items: stretch; flex: none; }
.side-foot .lang-toggle { align-self: flex-start; }
.side-foot button { margin-top: 0; width: 100%; justify-content: center; }

.main { flex: 1; min-width: 0; padding: 32px 36px 70px; max-width: 1560px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.page-head .crumb { font-size: 13px; color: var(--ink-faint); margin-bottom: 4px; font-weight: 500; }
.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(0,113,227,.12); padding: 4px 12px; border-radius: 980px;
  border: 1px solid rgba(0,113,227,.25); white-space: nowrap;
}
.page-head .crumb .crumb-client:hover { background: rgba(0,113,227,.2); }

/* --------------------------------- cards ---------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 24px; align-items: stretch; }
.cards-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1200px) { .cards-5 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.card {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.card h3 { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.stat { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.stat small { font-size: 14px; font-weight: 400; color: var(--ink-soft); }
.rowline { display: flex; justify-content: space-between; gap: 6px 12px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 14px; flex-wrap: wrap; min-width: 0; }
.rowline > * { min-width: 0; }
.rowline:first-of-type { border-top: 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-soft); border-radius: var(--radius-lg); overflow-x: auto; box-shadow: var(--shadow-sm); }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; padding: 12px 16px; color: var(--ink-faint);
  font-size: 12px; font-weight: 600; letter-spacing: .04em; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
table.grid td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); 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: #f9f9fb; }

/* Vista de usuarios: nombre destacado */
.u-cell { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.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: 17px; color: var(--ink); letter-spacing: .01em; }
.b-purple { background: #ece5fb; color: #5b21b6; }
/* Acciones: botones separados; Eliminar en rojo sólido */
.card-act { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.btn-del { background: #e02424; border-color: #c81e1e; color: #fff; font-weight: 700; }
.btn-del:hover { background: #c81e1e; border-color: #a11f26; color: #fff; }

/* --------------------------------- botones --------------------------------- */
/* --------------------- botones: liquid glass ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid rgba(210,210,215,.9); border-radius: 980px; padding: 10px 20px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  color: var(--accent);
  font-family: inherit; white-space: nowrap;
  background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(245,245,247,.55));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.9),
    inset 0 -1px 2px rgba(0,0,0,.04),
    0 4px 14px rgba(0,0,0,.08);
  transition: transform .05s, box-shadow .15s, background .15s;
}
.btn:hover {
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(245,245,247,.7));
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,1),
    inset 0 -1px 2px rgba(0,0,0,.04),
    0 6px 20px rgba(0,0,0,.12);
}
.btn:active { transform: scale(.98); }
.btn-primary {
  color: #fff; border: 1px solid rgba(255,255,255,.35);
  background: linear-gradient(180deg, rgba(10,132,255,.88), rgba(0,113,227,.78));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.5),
    inset 0 -1px 3px rgba(0,40,90,.35),
    0 8px 24px rgba(0,113,227,.35);
  text-shadow: 0 1px 2px rgba(0,40,90,.25);
}
.btn-primary:hover {
  background: linear-gradient(180deg, rgba(20,140,255,.94), rgba(0,122,240,.85));
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.6),
    inset 0 -1px 3px rgba(0,40,90,.35),
    0 10px 28px rgba(0,113,227,.45);
}
/* Botones de WhatsApp: siempre verdes (regla de Wellington) */
.btn-wa {
  color: #fff; border: 1px solid rgba(255,255,255,.35);
  background: linear-gradient(180deg, rgba(37,211,102,.92), rgba(18,140,70,.85));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.5),
    inset 0 -1px 3px rgba(0,60,25,.35),
    0 8px 24px rgba(18,140,70,.35);
  text-shadow: 0 1px 2px rgba(0,60,25,.25);
}
.btn-wa:hover {
  background: linear-gradient(180deg, rgba(45,220,110,.96), rgba(22,150,75,.9));
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.6),
    inset 0 -1px 3px rgba(0,60,25,.35),
    0 10px 28px rgba(18,140,70,.45);
}
.btn-danger {
  color: #fff; border: 1px solid rgba(255,255,255,.35);
  background: linear-gradient(180deg, rgba(255,99,88,.88), rgba(215,0,21,.78));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.5),
    inset 0 -1px 3px rgba(90,0,10,.35),
    0 8px 24px rgba(215,0,21,.3);
  text-shadow: 0 1px 2px rgba(90,0,10,.25);
}
.btn-danger:hover {
  background: linear-gradient(180deg, rgba(255,110,100,.94), rgba(230,10,30,.85));
}
/* Pagos anulados: se quedan en el historial, tachados y con su motivo. */
.pay-voided .strike { text-decoration: line-through; opacity: .55; }
.void-note { margin-top: 4px; font-size: .85em; line-height: 1.45; }
.btn-beige {
  color: #6d5f42; border: 1px solid rgba(255,255,255,.55);
  background: linear-gradient(180deg, rgba(252,248,238,.88), rgba(240,232,210,.6));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.9),
    inset 0 -1px 2px rgba(120,100,60,.08),
    0 4px 14px rgba(120,100,60,.12);
}
.btn-beige:hover {
  background: linear-gradient(180deg, rgba(253,250,242,.95), rgba(244,236,216,.72));
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); padding: 8px 10px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* --------------------------------- forms ---------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; font-size: 15px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, .15);
}
.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-soft); border-radius: var(--radius-lg); padding: 22px 24px; margin: 0 auto 20px; max-width: 640px; box-shadow: var(--shadow-sm); }
.req-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.req-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.req-head { display: flex; align-items: center; justify-content: space-between; }
.req-form { font-size: 18px; font-weight: 700; color: #1a3a8f; }
.req-lang { font-size: 12px; font-weight: 700; background: #e8eefc; color: #1a3a8f; padding: 4px 10px; border-radius: 20px; }
.req-link { font-size: 13px; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.req-link:hover { text-decoration: underline; }
.req-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.form-panel h3 { margin: 0 0 16px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }

.yesno { display: flex; gap: 12px; }
.yesno button {
  flex: 1; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fff; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--ink-soft);
  font-family: inherit; transition: border-color .15s, background .15s;
  min-width: 0;
}
.yesno button:hover { border-color: var(--ink-faint); }
.yesno button.sel-yes { border-color: #22a355; border-width: 2px; }
.yesno button.sel-no { border-color: #22a355; border-width: 2px; }

/* --------------------------------- badges --------------------------------- */
.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; }
.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(10,41,99,.18);
}
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 980px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.b-amber { background: #fdf0dc; color: #92600a; }
.b-blue { background: var(--accent-soft); color: #0a5fc2; }
.b-green { background: var(--ok-soft); color: #14663c; }
.b-teal { background: #e6f3ee; color: #14663c; }
.b-purple { background: #f0e9fd; color: #5b21b6; }
.b-gold { background: #f7ecd4; color: #8a5f14; }
.b-gray { background: #ececf0; color: #515154; }
.b-red { background: var(--bad-soft); color: #a11f26; }

/* ---------------------------------- tabs ---------------------------------- */
.tabs {
  display: inline-flex; gap: 2px; margin-bottom: 20px; max-width: 100%;
  background: rgba(118, 118, 128, .12); border-radius: 12px; padding: 3px;
  overflow-x: auto;
}
.tabs button {
  background: none; border: 0; padding: 8px 16px; font-size: 14px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-family: inherit; flex: none;
}
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }

/* -------------------------------- checklist ------------------------------- */
.check-item {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px;
  border: 1px solid var(--line-soft); border-radius: 16px; margin-bottom: 12px; background: #fff;
  box-shadow: var(--shadow-sm);
}
.check-item .grow { flex: 1; min-width: 0; }
.check-item .t { font-weight: 600; font-size: 15px; overflow-wrap: break-word; line-height: 1.35; }
.check-item .small { overflow-wrap: break-word; }
.check-item .h { font-size: 13px; color: var(--ink-faint); margin-top: 2px; line-height: 1.4; }
.check-dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); color: transparent; background: #fff;
}
.sample-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; }
.sample-link:hover { color: var(--accent-hover); text-decoration: underline; }
.sample-link svg { width: 15px; height: 15px; flex: none; }
.sample-img { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line-soft); background: #fff; }
.file-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 8px 10px; background: var(--bg); border-radius: 10px; font-size: 13px; }
.file-row svg { width: 16px; height: 16px; flex: none; color: var(--ink-soft); }
.file-row .file-name { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.file-row .faint { font-size: 12px; color: var(--ink-faint); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border-radius: 9px; border: 1px solid var(--line-soft); background: #fff; cursor: pointer; color: var(--ink-soft); margin-left: auto; }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.danger { color: #d92d20; }
.icon-btn.danger:hover { background: #fef3f2; border-color: #fecdca; }
.check-item .check-act { flex: none; padding-top: 2px; }
.check-item .check-act label.btn + label.btn { margin-left: 8px; }
.check-item.done { border-color: #bfe3cd; background: #f4faf6; }
.check-item.done .check-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-item .meta { font-size: 12px; color: var(--ink-soft); text-align: right; flex: none; }

/* ---------------------------------- 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: 18px; font-size: 14px; overflow-wrap: break-word; }
.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: 4px; }
.msg.them { align-self: flex-start; background: #e9e9eb; color: var(--ink); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; }
.chat-input input { flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: 980px; font-size: 15px; font-family: inherit; }
.chat-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, .15); }

/* --------------------------------- modal ---------------------------------- */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.modal-back {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.modal {
  background: rgba(255, 255, 255, .96); border-radius: 20px; width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto; padding: 28px; box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft); position: relative;
}
.modal-x {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.06); cursor: pointer; display: flex; align-items: center;
  justify-content: center; color: #333; z-index: 2;
}
.modal-x:hover { background: rgba(0,0,0,.12); }
.modal-x svg { width: 18px; height: 18px; }
.modal h3 { margin: 0 0 18px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

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

/* ------------------------------ portal cliente ----------------------------- */
.portal-wrap { max-width: 680px; margin: 0 auto; padding: 20px 16px 70px; min-height: 100vh; }
.portal-top {
  background: var(--panel); border: 1px solid var(--line-soft); color: var(--ink);
  border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.portal-top .t { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: break-word; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.portal-top .t-sep { color: var(--ink-faint); font-weight: 400; }
.portal-top .t-name { font-weight: 800; }
.top-logo { height: 46px; width: auto; display: inline-block; vertical-align: middle; border-radius: 6px; }
.brand-logo { height: 76px; width: auto; display: block; border-radius: 10px; }
.brand-logo-sm { height: 44px; width: auto; display: block; border-radius: 6px; }
.login-logo { height: 88px; width: auto; display: block; margin: 0 auto 12px; border-radius: 10px; }
.portal-top .s { font-size: 13px; color: var(--ink-faint); margin-top: 6px; overflow-wrap: break-word; }
.portal-card { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.portal-card h3 { margin-top: 0; letter-spacing: -0.01em; }
.steps-bar { display: flex; gap: 6px; margin-bottom: 20px; }
.steps-bar span { flex: 1; height: 6px; border-radius: 3px; background: #e3e3e8; }
.steps-bar span.on { background: var(--accent); }
.pin-input {
  font-size: 30px !important; letter-spacing: .5em; text-align: center;
  padding: 14px !important; font-weight: 700;
}
.doc-upload { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.legal-text {
  white-space: pre-wrap; font-size: 13px; background: #f9f9fb; border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px 18px; max-height: 260px; overflow-y: auto; margin-bottom: 16px;
  font-family: Georgia, serif; line-height: 1.6;
}

/* ------------------------------- impresión -------------------------------- */
.print-toolbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .8); color: var(--ink);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.print-doc { background: #fff; color: #111; max-width: 820px; margin: 24px auto; padding: 48px 52px; box-shadow: var(--shadow-md); border-radius: 4px; font-size: 14px; }
.print-doc h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.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 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; overflow-wrap: break-word; }
.print-doc table th { background: #f2f2f4; }
.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; overflow-wrap: break-word; }
.print-doc .sigimg { max-width: 300px; border: 1px solid #999; border-radius: 4px; }
.print-doc .foot { margin-top: 34px; font-size: 12px; color: #444; border-top: 1px solid #999; padding-top: 10px; }
.print-doc .docimg { margin: 16px 0; page-break-inside: avoid; text-align: center; }
.print-doc .docimg p { text-align: left; margin: 0 0 8px; }
.print-doc .docimg img { max-width: 100%; max-height: 900px; border: 1px solid #999; border-radius: 4px; }
.print-doc .docimg-2x2 img { width: 51mm; height: 51mm; max-width: 51mm; max-height: 51mm; object-fit: cover; }

@media print {
  @page { margin: 18mm 15mm; size: letter; }
  body { background: #fff; }
  .print-toolbar, .demo-banner, .no-print, .sidebar, .mobilebar, .topbar { display: none !important; }
  .main { padding: 0; max-width: none; }
  .print-doc { box-shadow: none; margin: 0 auto; padding: 0; max-width: 100%; border-radius: 0; font-size: 12px; }
  .print-doc h1 { font-size: 20px; text-align: center; }
  .print-doc h2 { font-size: 14px; margin: 20px 0 10px; page-break-after: avoid; }
  .print-doc table { page-break-inside: auto; }
  .print-doc table tr { page-break-inside: avoid; }
  .print-doc .kv { grid-template-columns: 200px 1fr; }
  .print-doc .docimg { page-break-inside: avoid; }
  .print-doc .docimg img { max-height: 220mm; }
  .print-doc .docimg-2x2 img { width: 51mm; height: 51mm; }
}

/* --------------------------------- varios --------------------------------- */
.alert {
  border-radius: var(--radius); padding: 13px 16px; font-size: 14px; margin-bottom: 16px;
  display: flex; gap: 10px; align-items: flex-start; overflow-wrap: break-word;
}
.alert > div, .alert > span { min-width: 0; }
.alert-err { background: var(--bad-soft); border: 1px solid #f3c2c6; color: #8f1d23; }
.alert-ok { background: var(--ok-soft); border: 1px solid #bfe3cd; color: #14663c; }
.alert-info { background: var(--accent-soft); border: 1px solid #c3d9f5; color: #0a5fc2; }
.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: #fff; color: var(--ink); margin: 0;
}
.searchbox { position: relative; }
.searchbox .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); }
.searchbox input { padding-left: 36px; width: 260px; max-width: 100%; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-faint); }
.empty .ic-lg { opacity: .4; margin-bottom: 8px; }
.pin-display {
  font-size: 40px; font-weight: 700; letter-spacing: .35em; text-align: center;
  background: #f9f9fb; border: 1.5px dashed var(--accent); border-radius: 14px; padding: 16px; margin: 12px 0;
  overflow-wrap: break-word;
}
.link-box {
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; word-break: break-all;
  background: #f9f9fb; border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 14px;
}
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 24px 0 12px; font-weight: 700; }

/* Barra móvil: oculta en escritorio, visible solo en teléfono (ver @media abajo) */
.mobilebar { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 20px 16px 70px; max-width: none; -webkit-overflow-scrolling: touch; }
  .print-doc { padding: 24px 20px; }
  .print-doc .kv { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { padding: 16px; }
  .stat { font-size: 30px; }
  /* Barra superior móvil con efecto cristal: 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; }

  /* Panel: encabezado apilado y botones a todo ancho en móvil */
  .page-head { flex-direction: column; align-items: stretch; margin-bottom: 18px; }
  .page-head h2 { font-size: 24px; }
  .page-head .toolbar { display: grid; grid-template-columns: 1fr; width: 100%; }
  .page-head .toolbar .btn { justify-content: center; width: 100%; }

  /* ---- Optimización móvil del portal del cliente ---- */
  .check-item { flex-wrap: wrap; gap: 10px; padding: 16px; overflow: hidden; }
  .check-item .check-dot { width: 26px; height: 26px; }
  .check-item .grow { flex: 1 1 calc(100% - 40px); min-width: 0; max-width: 100%; }
  .check-item .t { font-size: 15px; }
  .check-item .check-act { flex: 1 1 100% !important; min-width: 0; max-width: 100%; padding-top: 8px; }
  .check-item .check-act .btn,
  .check-item .check-act label.btn { width: 100% !important; max-width: 100%; justify-content: center; min-height: 48px; font-size: 15px; box-sizing: border-box; margin: 0; }
  .check-item .check-act label.btn + label.btn { margin-left: 0; margin-top: 8px; }
  /* Botones con tamaño táctil cómodo */
  .btn { min-height: 46px; }
  /* Seguridad global: nada se sale de la pantalla */
  html, body { overflow-x: hidden; max-width: 100vw; }
  .portal-wrap, .page-head, .form-panel, .portal-card { max-width: 100%; overflow-x: hidden; }
  .rowline { flex-wrap: wrap; gap: 8px; }
  .rowline select { flex: 1 1 100%; min-width: 0; max-width: 100%; }
  .file-row { flex-wrap: wrap; }
  img { max-width: 100%; height: auto; }
  .btn-sm { min-height: 42px; }
  /* Pestañas estilo control segmentado: 4 caben a 360px; scroll si el texto es largo */
  .portal-wrap .tabs { display: flex; width: 100%; }
  .portal-wrap .tabs button { flex: 1 1 0; justify-content: center; padding: 9px 2px; font-size: 12px; gap: 5px; min-width: 0; }
  .portal-wrap .tabs button .ic { width: 15px; height: 15px; }
  /* Pestañas del detalle del caso: en dos líneas en teléfono, sin scroll lateral */
  .tabs { display: flex; flex-wrap: wrap; overflow-x: visible; width: 100%; }
  .tabs button { flex: 1 1 auto; justify-content: center; padding: 10px 8px; font-size: 13px; white-space: nowrap; }
  /* Inputs a 16px para que iOS no haga zoom al enfocarlos */
  .field input, .field select, .field textarea { font-size: 16px; padding: 13px 14px; }
  .searchbox input { font-size: 16px !important; }
  /* Encabezado y tarjetas del portal */
  .portal-top { padding: 18px; }
  .portal-top .t { font-size: 20px; }
  .portal-card { padding: 20px 18px; }
  .section-title { font-size: 13px; margin: 20px 0 10px; }
  /* PIN: tamaño que cabe bien en pantallas angostas */
  .pin-input { font-size: 26px !important; letter-spacing: .35em; }
  /* Login más compacto */
  .login-card { padding: 32px 26px; }
  .login-card h1 { font-size: 26px; }
  /* Quiz: botones sí/no apilados si no caben */
  .yesno { flex-wrap: wrap; }
  .yesno button { flex: 1 1 140px; }
  .modal { padding: 22px 20px; }
}
.mb-brand { font-weight: 700; letter-spacing: -0.02em; font-size: 17px; color: var(--ink); flex: none; }
.mb-nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.mb-nav::-webkit-scrollbar { display: none; }
.mb-nav a {
  display: flex; align-items: center; gap: 6px; color: var(--ink-soft);
  text-decoration: none; padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
  white-space: nowrap; flex: none; min-height: 44px;
}
.mb-nav a.active { background: var(--accent-soft); color: var(--accent); }
.mb-lang { flex: none; }
/* Drawer de navegación móvil */
.mb-drawer {
  display: none;
  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: var(--ink);
  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; }
/* Pull-to-refresh */
#ptr-indicator { position: fixed; top: -60px; left: 50%; transform: translateX(-50%); z-index: 200;
  transition: top .2s; }
#ptr-indicator.on { top: 12px; }
.ptr-spinner { width: 36px; height: 36px; border: 3px solid #e8eefc; border-top-color: #1a3a8f;
  border-radius: 50%; animation: ptr-spin 0.8s linear infinite; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
/* Timeline de seguimiento USCIS */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line-soft); }
.timeline-item { position: relative; padding: 10px 0; }
.timeline-dot { position: absolute; left: -24px; top: 14px; width: 16px; height: 16px; border-radius: 50%; background: #1a3a8f; border: 3px solid #fff; box-shadow: 0 0 0 2px #1a3a8f; }
.timeline-body { background: #f8faff; border-radius: 8px; padding: 10px 12px; }
@media (max-width: 860px) {
  .mb-drawer { display: flex; }
}

/* Selector de idioma ES | EN — control segmentado */
.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(10,132,255,.95), rgba(0,113,227,.88));
  color: #fff;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.45), 0 2px 10px rgba(0,113,227,.4);
  text-shadow: 0 1px 2px rgba(0,40,90,.3);
}
.portal-topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.copy-ok { margin-top: 10px; }
.link-box.selectable { user-select: all; cursor: text; }

/* Checklist "qué me debe cada cliente" */
.gap-row { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.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: none; font-weight: 600; }
.gap-link:hover { text-decoration: underline; }
.gap-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.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; }
.doc-col { min-width: 0; }
@media (min-width: 1024px) {
  .doc-cols { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* Asistente del cuestionario: una pregunta por pantalla */
.quiz-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.quiz-top > * { min-width: 0; }
.quiz-count { font-weight: 700; color: var(--accent); white-space: nowrap; }
.quiz-qnum { font-weight: 600; color: var(--ink-soft); overflow-wrap: break-word; }
.quiz-bar { height: 8px; background: #e3e3e8; border-radius: 99px; margin-top: 10px; overflow: hidden; }
.quiz-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #4da3ff); border-radius: 99px; transition: width .25s; }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.quiz-nav .btn { min-height: 50px; flex: 1; }
/* Asistente guiado (primer acceso): X arriba a la derecha, nav de documentos */
.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; }
/* Botones grandes Sí/No (p. ej. pregunta de viaje DS-160) */
.lang-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.lang-btn {
  min-height: 56px; border-radius: 10px; font-size: 17px; font-weight: 700;
  border: 2px solid transparent; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.quiz-card { text-align: left; }
.quiz-q { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 6px 0 18px; overflow-wrap: break-word; }

/* Hijos en el cuestionario: una línea por hijo — nombre | fecha nac. | edad | quitar */
#q-children { display: flex; flex-direction: column; gap: 10px; }
.child-row { display: grid; grid-template-columns: 1fr 136px 86px 44px; gap: 8px; align-items: stretch; }
.child-row input {
  width: 100%; box-sizing: border-box; font-size: 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-height: 50px;
}
.child-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.child-age {
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px;
  font-weight: 700; font-size: 14px; color: var(--ink-soft); min-height: 50px; padding: 0 6px;
}
.child-del {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font-size: 22px; line-height: 1; color: var(--ink-faint); cursor: pointer; min-height: 50px;
}
.child-del:hover { color: #c00; border-color: #c00; }
.q-add-child { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; }
.q-add-child .ic { width: 18px; height: 18px; }
@media (max-width: 560px) {
  .child-row { grid-template-columns: 1fr 44px; grid-template-areas: "name del" "dob age"; }
  .child-name { grid-area: name; }
  .child-dob { grid-area: dob; }
  .child-age { grid-area: age; }
  .child-del { grid-area: del; }
}

/* 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; box-shadow: none; }
  .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-soft);
    border-radius: var(--radius-lg); 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 lado a lado */
  .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 extracción en curso */
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.25); border-top-color: currentColor; border-radius: 50%; animation: spinrot .7s linear infinite; vertical-align: -2px; }
@keyframes spinrot { to { transform: rotate(360deg); } }

/* Badges de casos en la ficha del cliente (estilo WellTAX) */
.case-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.case-badge { cursor: pointer; border: 1px solid transparent; font-size: 13px; padding: 5px 12px; }
.case-badge:hover { filter: brightness(0.94); }

/* Documentos en tarjetas uniformes (como WellTAX) */
.doc-items { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); grid-auto-rows: 1fr; }
@media (min-width: 640px) { .doc-items { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .doc-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .doc-items { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Con los grupos en paralelo (Personales / Del caso), máximo 2 tarjetas por
 * fila dentro de cada grupo: tarjetas anchas y proporcionadas, no una pared
 * de cuadros estrechos y largos desalineados. */
@media (min-width: 1024px) { .doc-cols .doc-items { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.doc-items .check-item .h { min-height: 2.8em; }

/* Modal de edición de caso: rejilla pareja de 2 columnas, etiquetas en una
 * sola línea para que cada fila arranque a la misma altura. */
.case-edit-grid { grid-template-columns: 1fr 1fr; }
.case-edit-grid .field label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 819px) { .case-edit-grid { grid-template-columns: 1fr; } }

/* Sello azul de verificado (Archivado Visado) */
.verified-badge { display: inline-flex; vertical-align: -3px; margin-left: 3px; }
.doc-items .check-item {
  flex-direction: column; align-items: stretch; gap: 10px;
  height: 100%; margin-bottom: 0; padding: 14px;
}
.doc-items .check-item .check-dot { margin-top: 0; }
.doc-items .check-item .t { font-weight: 700; }
.doc-items .file-row .file-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-items .check-act { padding-top: 6px; margin-top: auto; }
.doc-items .check-act .btn { width: 100%; justify-content: center; }

/* Tarjeta de documento: punto de estado arriba a la derecha */
.doc-items .check-item { position: relative; padding-top: 14px; }
.doc-items .check-item .check-dot {
  position: absolute; top: 12px; right: 12px;
  width: 24px; height: 24px; margin: 0;
}
.doc-items .check-item .grow { padding-right: 28px; }

/* Filas de datos con botón Copiar (como WellTAX) */
.kv-row { padding: 7px 0; border-top: 1px solid #eef1f4; }
.kv-row:first-of-type { border-top: 0; }
.kv-label { display: block; font-size: 12px; margin-bottom: 2px; }
.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; }
.kv-copy.copied { border-color: #22a355; color: #22a355; }

/* Pie de barra: botones alineados a todo lo ancho + salir como badge rojo junto a la sesión */
.side-logout-badge { margin-left: auto; flex: none; width: 32px; height: 32px; padding: 0;
  border-radius: 999px; border: 1px solid rgba(0,0,0,.08); 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: 100%; box-sizing: border-box; }


/* ===== Notificaciones compactas (paridad WellProTax) ===== */
.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; }

/* Cuestionario en edición: lo que falta sigue ROJO hasta corregirlo */
.field-missing > label { color: #dc2626 !important; font-weight: 700 }
.field-missing input, .field-missing select, .field-missing textarea {
  border-color: #dc2626 !important; background: #fef2f2;
}
.field-missing .yesno { box-shadow: 0 0 0 2px rgba(220, 38, 38, .35); border-radius: 10px }

/* 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; }
#view > .tabs { gap: 8px; padding-top: 14px; margin-top: 2px;
  border-top: 1px solid var(--line-soft); }

/* 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(15,23,42,.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(15,23,42,.18); border-radius: 999px; }
.sidebar .nav::-webkit-scrollbar-thumb:hover, .mb-drawer-nav::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,.32); }
.sidebar .nav::-webkit-scrollbar-button, .mb-drawer-nav::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* Tarjeta de sesión blindada: el botón de salir es un circulito de 32px
 * que NUNCA se estira, y la tarjeta jamás se sale de la barra lateral */
.side-user { max-width: 100%; overflow: hidden; }
.side-user-info { flex: 1 1 auto; min-width: 0; }
.side-logout-badge { flex: 0 0 32px !important; width: 32px !important; height: 32px !important;
  max-width: 32px !important; min-width: 32px; box-sizing: border-box; }

/* Barras de desplazamiento GLOBALES — regla de Wellington (2026-10-23): ninguna
   plataforma muestra la barra nativa gruesa con flechas (rompe la armonía visual).
   Todas las barras: finas, sin botones, track transparente, thumb suave. */
* { scrollbar-width: thin; scrollbar-color: rgba(100,116,139,.45) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,.38); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.62); background-clip: padding-box; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }

/* --------------------- editor de recorte de foto (portal) ------------------ */
.crop-back {
  position: fixed; inset: 0; z-index: 300; background: #0b1220;
  display: flex; flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
}
.crop-head { color: #fff; padding: 2px 2px 10px; }
.crop-head h3 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.crop-head p { margin: 4px 0 0; font-size: 13px; color: #b9c6d6; }
.crop-stage {
  position: relative; flex: 1 1 auto; min-height: 0; border-radius: 12px;
  overflow: hidden; background: #101827; touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.crop-stage canvas { position: absolute; inset: 0; display: block; }
.crop-frame {
  position: absolute; border: 2px solid #fff; border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(3, 8, 16, .62); cursor: move; touch-action: none; z-index: 2;
}
.crop-grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.333% - .5px), rgba(255,255,255,.35) 0, transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.35) 0, transparent calc(66.666% + .5px)),
    linear-gradient(to bottom, transparent calc(33.333% - .5px), rgba(255,255,255,.35) 0, transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.35) 0, transparent calc(66.666% + .5px));
}
.crop-h { position: absolute; width: 32px; height: 32px; margin: -16px 0 0 -16px; z-index: 3; touch-action: none; }
.crop-h::after {
  content: ""; position: absolute; inset: 9px; background: #fff; border-radius: 50%;
  border: 2px solid var(--accent, #2563eb); box-shadow: 0 1px 5px rgba(0,0,0,.5);
}
.crop-h[data-h="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.crop-h[data-h="n"]  { left: 50%; top: 0; cursor: ns-resize; }
.crop-h[data-h="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.crop-h[data-h="e"]  { left: 100%; top: 50%; cursor: ew-resize; }
.crop-h[data-h="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-h[data-h="s"]  { left: 50%; top: 100%; cursor: ns-resize; }
.crop-h[data-h="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.crop-h[data-h="w"]  { left: 0; top: 50%; cursor: ew-resize; }
.crop-tools { display: flex; align-items: center; gap: 12px; padding: 12px 2px 10px; color: #dbe5f1; }
.crop-zoom { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.crop-zoom input[type="range"] { flex: 1; height: 32px; accent-color: var(--accent, #27a9fd); }
.crop-rot {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1);
  color: #fff; border: 1px solid rgba(255,255,255,.28); border-radius: 10px;
  padding: 9px 14px; font-size: 14px; cursor: pointer; min-height: 44px;
}
.crop-actions { display: flex; gap: 10px; }
.crop-actions .btn { flex: 1; justify-content: center; min-height: 50px; }
.crop-btn-ghost {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: 10px; padding: 0 14px; font-size: 15px; cursor: pointer; min-height: 50px;
}
.crop-loading {
  position: fixed; inset: 0; z-index: 300; background: rgba(8, 13, 22, .92);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px;
}

/* Barra de estado del caso (pasos del proceso por tipo de formulario) */
.stagebar {
  display: flex; align-items: flex-start; gap: 0;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px;
  padding: 16px 18px 12px; margin: 0 0 14px;
}
.sb-step { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; min-width: 0; }
.sb-dot {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: #f0f0f3; color: var(--ink-faint); border: 2px solid var(--line-soft);
}
.sb-step.done .sb-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.sb-step.current .sb-dot { background: #fff; border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.sb-label { font-size: 12px; line-height: 1.25; color: var(--ink-faint); max-width: 130px; }
.sb-step.done .sb-label { color: var(--ink-soft); }
.sb-step.current .sb-label { color: var(--ink); font-weight: 700; }
.sb-line { flex: 1 1 auto; height: 2px; background: var(--line-soft); border-radius: 2px; margin-top: 15px; min-width: 12px; }
.sb-line.done { background: var(--accent); }
@media (max-width: 640px) {
  .stagebar { padding: 12px 10px 9px; overflow-x: auto; }
  .sb-label { font-size: 10.5px; max-width: 84px; }
  .sb-dot { width: 26px; height: 26px; flex-basis: 26px; font-size: 12px; }
  .sb-line { margin-top: 13px; }
}

/* Edición en línea de la ficha (lápiz por campo) */
.kv-edit { padding: 2px 7px; line-height: 0; }
.kv-edit svg { width: 13px; height: 13px; }
.kv-editbox { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kv-input {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; max-width: 240px; background: #fff; color: var(--ink);
}
.kv-save svg, .kv-cancel svg { width: 13px; height: 13px; display: block; }

/* Selector de estado junto a la barra de estado del caso */
.stagebar-wrap { display: flex; gap: 12px; align-items: stretch; margin: 0 0 14px; }
.stagebar-wrap .stagebar { flex: 1 1 auto; margin: 0; }
.stagebar-side {
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px; padding: 10px 14px;
}
.stagebar-side label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.stagebar-side select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; background: #fff; color: var(--ink); max-width: 230px;
}
@media (max-width: 640px) {
  .stagebar-wrap { flex-direction: column; }
  .stagebar-side select { max-width: none; width: 100%; }
}

/* Pestañas del caso: rejilla fija de 5 por línea (regla de Wellington: 5 y 5) */
.tabs-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; width: 100%; overflow-x: visible; }
.tabs-grid button { justify-content: center; white-space: normal; text-align: center; }
@media (max-width: 640px) {
  .tabs-grid button { font-size: 11.5px; padding: 7px 2px; gap: 4px; }
}

/* Ventana CEAC PDF (dos espacios de subida) */
.ceac-slot { border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.ceac-slot-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.ceac-file { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.ceac-fname { font-weight: 600; word-break: break-all; }
.ceac-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ceac-actions label.btn { cursor: pointer; margin: 0; }

/* Espacio de subida vacío de CEAC PDF: zona amplia y evidente */
.ceac-empty-zone {
  border: 2px dashed var(--line); border-radius: 12px; padding: 20px 14px;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.ceac-empty-zone label.btn { cursor: pointer; margin: 0; }
