/* ============================================================================
 * 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; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(160deg, #1c2530 0%, #2b3a4d 100%);
  position: relative; overflow: hidden;
}
/* Fondo: bandera USA ondeando (generada, sin marcas), transparente */
.login-bg {
  position: absolute; inset: 0; pointer-events: none;
  background: url("/img/flag-bg.webp") center / cover no-repeat;
  opacity: .45;
}
.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;
}
.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); }
.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; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.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-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #8fa1b5; }
.side-foot button { margin-top: 8px; }

.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); }

/* --------------------------------- 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; }
/* 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; }

/* --------------------------------- 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); }
.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; }

@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; flex-direction: column; gap: 8px;
    position: sticky; top: 0; z-index: 40;
    background: var(--sidebar); color: #fff;
    padding: 10px 12px;
  }
  .mb-brand-row { display: flex; justify-content: center; width: 100%; }
  .mb-menu-row { display: flex; align-items: center; gap: 8px; width: 100%; }
  .app { flex-direction: column; }
  .main { flex: 1; }

  /* ---- 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); }
  /* 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); } }
