:root {
  --primario: #0b63ce; --primario-suave: #e8f1fc; --ok: #138a4a; --peligro: #c62828; --texto: #16202c; --muted: #5d6b7a;
  --linea: #dde4ec; --fondo: #f3f6fa; --card: #fff; --aviso: #fff6e0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; color: var(--texto); background: var(--fondo); line-height: 1.45; }
[hidden] { display: none !important; }
h1 { font-size: 1.45rem; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
h3 { font-size: .92rem; margin: 14px 0 8px; }
a { color: var(--primario); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.opt, .hint { color: var(--muted); font-weight: 400; font-size: .8rem; }
.hint { display: block; margin-top: 2px; }
.error { color: var(--peligro); }

.top { background: linear-gradient(120deg, #0b63ce, #084a9c); color: #fff; }
.top-in { max-width: 1060px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.marca { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.marca small { font-weight: 400; opacity: .8; font-size: .8rem; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-b { background: transparent; border: 0; color: #fff; font: inherit; font-size: .9rem; padding: 6px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; opacity: .85; }
.nav-b:hover, .nav-b.activo { background: rgba(255, 255, 255, .16); opacity: 1; }

.contenedor { max-width: 1060px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--linea); border-radius: 14px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16, 32, 48, .04); }
.cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.login { max-width: 420px; margin: 40px auto; }

label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 12px; }
input, textarea, select { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--linea); border-radius: 10px; font: inherit; background: #fff; color: inherit; }
textarea { resize: vertical; line-height: 1.45; }
input:disabled, textarea:disabled, select:disabled { background: #f6f8fb; color: #3b4652; }
input[type=search] { max-width: 320px; margin: 0; }
.fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.fila .ancho { grid-column: span 2; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 26px; }
.check input { width: auto; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--linea); background: #fff; color: var(--texto); font: inherit; font-weight: 600; font-size: .9rem; padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #b8c4d2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primario { background: var(--primario); border-color: var(--primario); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn.grande { padding: 12px 18px; font-size: .98rem; }
.btn.chico { padding: 6px 11px; font-size: .84rem; }
.btn.archivo { cursor: pointer; font-weight: 500; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--primario); cursor: pointer; text-decoration: underline; }
.link.peligro { color: var(--peligro); }
.fila-btn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.pie-acc { text-align: right; font-size: .85rem; }

.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--linea); color: inherit; text-decoration: none; }
.item:first-child { border-top: 0; }
a.item:hover { background: #f8fafd; }
.item small { display: block; color: var(--muted); font-size: .82rem; }
.estado { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: #eef2f6; color: var(--muted); white-space: nowrap; }
.estado.aprobada { background: #e3f5ea; color: var(--ok); }
.estado.borrador { background: var(--aviso); color: #7a5300; }

.grabar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; padding: 12px; border-radius: 12px; background: var(--primario-suave); }
.grabar-b.activo { background: var(--peligro); border-color: var(--peligro); color: #fff; animation: latido 1.4s infinite; }
@keyframes latido { 50% { box-shadow: 0 0 0 6px rgba(198, 40, 40, .18); } }

.alertas { background: var(--aviso); border-color: #f1d9a0; }
.alertas ul { margin: 0; padding-left: 20px; }
.alertas li { margin: 4px 0; }
.cab-doc { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cab-doc h2 { margin: 0; }
.ind { display: grid; grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 2fr) auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.ind input, .ind textarea { margin: 0; }
.ind-med { font-weight: 700; }
.flecha { padding-top: 9px; color: var(--muted); }
.ind-quitar { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 9px 4px; }
.ind-quitar:hover { color: var(--peligro); }
@media (max-width: 640px) {
  .ind { grid-template-columns: minmax(0, 1fr) auto; }
  .ind .flecha { display: none; }
  .ind-det { grid-column: 1 / -1; grid-row: 2; }
  .fila .ancho { grid-column: auto; }
}

.dos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
@media (max-width: 800px) { .dos { grid-template-columns: 1fr; } }
.chat { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.msg { padding: 9px 12px; border-radius: 12px; max-width: 92%; white-space: pre-wrap; font-size: .92rem; }
.msg.yo { align-self: flex-end; background: var(--primario); color: #fff; }
.msg.ia { align-self: flex-start; background: #f1f4f8; }
.msg.pensando { color: var(--muted); font-style: italic; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { margin: 0; }

.sello { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.sello-vista { width: 240px; min-height: 110px; border: 1px dashed var(--linea); border-radius: 10px; display: grid; place-items: center; padding: 8px; background: repeating-conic-gradient(#f4f6f9 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.sello-vista img { max-width: 100%; max-height: 140px; }
