/* ── Botones ───────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 42px; padding: 0 var(--sp-5);
  border: 1px solid transparent; border-radius: 10px;
  font-weight: 700; font-size: var(--fs-sm); cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  text-decoration: none !important; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn--primary { background: var(--gold-500); color: var(--accent-ink); }
.btn--primary:hover { background: var(--gold-600); }
.btn--dark { background: var(--navy-900); color: var(--white); }
.btn--dark:hover { background: var(--navy-700); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--gray-100); }
.btn--danger { background: var(--err-500); color: var(--white); }
.btn--link { background: none; border: 0; padding: 0; min-height: auto; color: var(--link); }
.btn--sm { min-height: 34px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.btn--block { width: 100%; }
.btn--xl { min-height: 64px; font-size: var(--fs-lg); border-radius: var(--radius); }
.btn[aria-busy="true"]::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Formularios ───────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 700; }
.field .hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field .error { font-size: var(--fs-xs); color: var(--err-500); min-height: 1em; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--gray-300); border-radius: 10px; background: var(--white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue-500); box-shadow: var(--focus); outline: none; }
.input[aria-invalid="true"] { border-color: var(--err-500); }
.check { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-sm); }
.check input { margin-top: 3px; accent-color: var(--blue-500); }

/* Selector de días L M M J V S D */
.days { position: relative; display: flex; gap: 6px; flex-wrap: wrap; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days label {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--gray-300); cursor: pointer;
  font-weight: 700; font-size: var(--fs-sm); user-select: none;
}
.days input:checked + label { background: var(--navy-900); color: var(--white); border-color: var(--navy-900); }
.days input:focus-visible + label { box-shadow: var(--focus); }

/* Tarjetas de opción (tipo de empresa) estilo landing */
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
@media (max-width: 560px) { .options { grid-template-columns: 1fr; } }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option label {
  display: block; height: 100%; padding: var(--sp-4); border-radius: var(--radius);
  background: var(--gray-50); border: 2px solid transparent; cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.option label strong { display: block; font-size: var(--fs-md); }
.option label span { display: block; font-size: var(--fs-sm); color: var(--text-muted); }
.option input:checked + label { border-color: var(--gold-500); background: var(--gold-100); }
.option input:focus-visible + label { box-shadow: var(--focus); }

/* ── Tarjetas ──────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm);
}
.card__head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.card__head h3 { margin: 0; font-size: var(--fs-lg); }

.stat {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-5); overflow: hidden;
}
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--stat-color, var(--gold-500)); }
.stat__value { font-size: var(--fs-3xl); font-weight: 800; line-height: 1; }
.stat__label { margin-top: var(--sp-2); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }

/* ── Badges ────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px;
  border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
  background: var(--gray-100); color: var(--gray-700);
}
.badge--ok { background: var(--ok-100); color: var(--ok-500); }
.badge--warn { background: var(--warn-100); color: var(--warn-500); }
.badge--err { background: var(--err-100); color: var(--err-500); }
.badge--info { background: var(--info-100); color: var(--blue-600); }
.badge--gold { background: var(--gold-100); color: #8a5d0b; }

/* ── Tablas ────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); background: var(--gray-50); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
/* Botones de acción alineados (mismo alto aunque alguno lleve ícono o sea enlace) */
.acciones { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.acciones .btn { height: 34px; line-height: 1; box-sizing: border-box; margin: 0; }
.table .actions .btn { vertical-align: middle; }
.btn--sm svg { width: 14px; height: 14px; flex-shrink: 0; }
.thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--gray-100); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy-800); color: var(--white); font-size: var(--fs-xs); font-weight: 800; flex: none;
}

/* ── Estados vacíos / carga ───────────────── */
.empty { padding: var(--sp-7) var(--sp-5); text-align: center; color: var(--text-muted); }
.empty strong { display: block; color: var(--text); font-size: var(--fs-lg); margin-bottom: var(--sp-2); }
.skeleton { background: linear-gradient(90deg, var(--gray-100), var(--gray-50), var(--gray-100)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ── Alertas ───────────────────────────────── */
.alert { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); font-size: var(--fs-sm); border: 1px solid transparent; }
.alert--info { background: var(--info-100); color: var(--navy-800); border-color: #c7def1; }
.alert--warn { background: var(--warn-100); color: #7a4c0c; border-color: #f3d7a8; }
.alert--err { background: var(--err-100); color: #8e2a23; border-color: #f2c2bd; }
.alert--ok { background: var(--ok-100); color: #1d6b47; border-color: #bfe5d2; }

/* ── Modal ─────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(12, 28, 43, .55); padding: var(--sp-4);
  animation: fade .15s ease;
}
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 2rem); overflow: auto;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.modal--wide { width: min(820px, 100%); }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-5) var(--sp-5) 0; }
.modal__head h3 { margin: 0; }
.modal__body { padding: var(--sp-5); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--sp-3); padding: 0 var(--sp-5) var(--sp-5); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--text-muted); }
.icon-btn:hover { background: var(--gray-100); color: var(--text); }
@keyframes fade { from { opacity: 0; } }

/* ── Toasts ────────────────────────────────── */
.toasts { position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 200; display: flex; flex-direction: column; gap: var(--sp-2); }
.toast {
  min-width: 240px; max-width: 360px; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
  background: var(--navy-900); color: var(--white); box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
  border-left: 4px solid var(--gold-500); animation: fade .2s ease;
}
.toast--err { border-left-color: var(--err-500); }
.toast--ok { border-left-color: var(--ok-500); }

/* ── Tabs / segmentado ─────────────────────── */
.seg { display: inline-flex; padding: 4px; background: var(--gray-100); border-radius: 12px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; color: var(--text-muted); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── Chat ──────────────────────────────────── */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat__log { flex: 1; overflow-y: auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); background: var(--gray-50); }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: var(--fs-sm); white-space: pre-wrap; word-wrap: break-word; }
.msg time { display: block; margin-top: 4px; font-size: 10px; opacity: .65; }
.msg--me { align-self: flex-end; background: var(--navy-900); color: var(--white); border-bottom-right-radius: 4px; }
.msg__autor { display: block; font-size: 11px; font-weight: 800; color: var(--gold-700, #a16207); margin-bottom: 2px; }
.msg--them { align-self: flex-start; background: var(--white); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat__form { display: flex; gap: var(--sp-2); padding: var(--sp-3); border-top: 1px solid var(--border); background: var(--surface); }
.chat__form { align-items: center; }
.chat__form .input { min-height: 44px; border-radius: 22px; padding-left: 16px; }
.chat__enviar {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--gold-500); color: var(--navy-900);
  transition: transform .1s ease, filter .15s ease;
}
.chat__enviar svg { margin-left: 2px; }
.chat__enviar:hover { filter: brightness(.96); }
.chat__enviar:active { transform: scale(.92); }
.chat__enviar:focus-visible { outline: 3px solid var(--blue-100); outline-offset: 2px; }

/* Logo: símbolo de TIAD + nombre del producto (misma composición que tusimpuestosaldia.mx) */
.brand { display: inline-flex; align-items: center; gap: .8rem; color: inherit; text-decoration: none !important; }
.brand__mark { height: 44px; width: auto; aspect-ratio: 80 / 88; flex: none; }
.brand__text { font-weight: 900; line-height: 1.02; font-size: 1.12rem; letter-spacing: -.035em; color: var(--navy-900); }
.brand__line { display: block; }
.brand__producto { color: var(--tiad-azul-texto); }
.lp-top .brand__producto { color: var(--tiad-azul); }

/* Mostrar / ocultar contraseña */
.pass-wrap { position: relative; display: block; }
.pass-wrap .input { padding-right: 48px; }
.pass-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--gray-500); cursor: pointer; }
.pass-eye:hover { color: var(--navy-900); background: var(--gray-100); }

/* Guías de uso */
.guia { max-width: 760px; line-height: 1.6; }
.guia h2 { margin: var(--sp-6) 0 var(--sp-2); font-size: var(--fs-lg); scroll-margin-top: 80px; }
.guia h3 { margin: var(--sp-4) 0 var(--sp-1); font-size: var(--fs-md, 1rem); }
.guia p, .guia li, .guia dd { font-size: var(--fs-sm); }
.guia ol, .guia ul { padding-left: 1.3rem; display: grid; gap: .35rem; }
.guia__lead { font-size: var(--fs-md, 1rem) !important; color: var(--text); }
.guia__indice { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); }
.guia__indice button { border: 1px solid var(--border); background: var(--white); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: var(--fs-xs); font-weight: 700; color: var(--navy-900); cursor: pointer; }
.guia__indice button:hover { background: var(--gray-100); }
.guia__flujo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: var(--sp-3) 0; }
.guia__flujo span { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: var(--fs-xs); font-weight: 700; }
.guia__flujo .guia__decision { border-color: var(--gold-500); background: var(--gold-100); }
.guia__flujo b { color: var(--text-muted); }
.guia__faq dt { font-weight: 700; margin-top: var(--sp-2); font-size: var(--fs-sm); }
.guia__faq dd { margin: 0; }
.guia-link { display: grid; gap: 2px; text-decoration: none !important; color: inherit; }

/* Chats grupales */
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field > span { font-size: var(--fs-sm); font-weight: 700; }
.avatar--grupo { background: var(--gold-100); color: var(--gold-700); }
.lista-check { display: grid; gap: 8px; max-height: 280px; overflow-y: auto; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); }
.chat-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.chat-head h3 { margin: 0; font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Responder mensajes (deslizar o ↩) */
.msg { position: relative; }
.msg__cita { display: block; width: 100%; text-align: left; margin: 0 0 6px; padding: 6px 8px; border: 0; border-left: 3px solid var(--gold-500); border-radius: 0; background: rgba(0, 0, 0, .06); color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.msg--me .msg__cita { background: rgba(255, 255, 255, .14); }
.msg__cita b { display: block; font-size: 11px; color: var(--gold-700); }
.msg--me .msg__cita b { color: var(--gold-500); }
.msg__cita span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }
.msg__resp-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--white); color: var(--navy-900); font-size: 14px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.msg--them .msg__resp-btn { right: -36px; }
.msg--me .msg__resp-btn { left: -36px; }
.msg:hover .msg__resp-btn, .msg__resp-btn:focus-visible { opacity: 1; }
@media (hover: none) { .msg__resp-btn { display: none; } }
.msg::before { content: "↩"; position: absolute; left: -30px; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0; font-size: 18px; color: var(--navy-900); transition: opacity .1s, transform .1s; }
.msg.is-listo::before { opacity: 1; transform: translateY(-50%) scale(1); }
.msg.is-resaltado { animation: resaltar 1.2s ease; }
@keyframes resaltar { 0%, 40% { box-shadow: 0 0 0 3px var(--gold-500); } 100% { box-shadow: 0 0 0 0 transparent; } }
.chat__resp { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--gray-50); }
.chat__resp-txt { flex: 1; min-width: 0; border-left: 3px solid var(--gold-500); padding-left: 8px; font-size: 12px; }
.chat__resp-txt b { display: block; color: var(--gold-700); font-size: 11px; }
.chat__resp-txt span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.chat__resp-x { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; }
.chat__log { overflow-x: hidden; }
.chat__resp { flex-shrink: 0; }
