/* DeCario · hoja de estilos única. Identidad corporativa v1.1 (DeCario_Identidad_Claude_Code/tokens).
   Sin fuentes ni recursos remotos. Tokens de marca en :root; los alias (--primary, --text…) mantienen el resto
   de la hoja sin reescribirla.
   Contrastes (fórmula WCAG 2.x, cálculo propio y del kit qa/contrast-report.json):
   blanco sobre Azul Cario #0F2D4A 14,05:1 · Azul Cario sobre blanco 14,05:1 · #526579 sobre blanco 5,9:1 ·
   enlace #0F766E sobre blanco 5,47:1 · borde de control #718293 sobre blanco 3,9:1 (≥3:1 componente).
   Verde Ruta #14B8A6 SOLO decorativo o con texto Azul Cario encima (5,64:1); nunca texto blanco pequeño sobre él
   ni como texto sobre blanco. El éxito usa su propio verde semántico, no el de marca. */
@font-face {
  font-family: "Manrope";
  src: url("fonts/Manrope-wght.0ddd943711e8.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
:root {
  /* Marca */
  --dc-navy: #0F2D4A;
  --dc-navy-hover: #153C60;
  --dc-teal: #14B8A6;
  --dc-teal-accessible: #0F766E;
  --dc-teal-soft: #E6F7F4;
  --dc-gray-light: #E8EEF2;
  --dc-page: #F5F8FA;
  /* Alias usados por la hoja */
  --primary: var(--dc-navy);
  --primary-hover: var(--dc-navy-hover);
  --primary-soft: var(--dc-teal-soft);
  --link: var(--dc-teal-accessible);
  --text: #0F2D4A;
  --text-muted: #526579;
  --surface: #ffffff;
  --surface-2: var(--dc-page);
  --border: #D5DFE7;
  --border-strong: #718293;
  --focus: var(--dc-teal-accessible);
  /* Estados semánticos (texto + color; no dependen del verde de marca) */
  --ok: #027A48;
  --ok-bg: #ECFDF3;
  --warn: #92400E;
  --warn-bg: #FFFBEB;
  --err: #B42318;
  --err-bg: #FEF3F2;
  --info: #175CD3;
  --info-bg: #EFF8FF;
  --radius: 8px;
  --radius-card: 12px;
  --space: 16px;
  --font: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --tap: 44px;
  --shadow: 0 4px 20px rgb(15 45 74 / 7%);
}

* { box-sizing: border-box; }
/* scroll-padding: al enfocar o desplazarse a un control, la barra inferior fija no lo tapa (E2E B2). */
html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: 88px; }
@media (min-width: 960px) { html { scroll-padding-bottom: 0; } }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.5; color: var(--text); background: var(--surface-2); }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--primary); }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; margin: 0 0 .75rem; }
h2 { font-size: 1.25rem; line-height: 1.25; font-weight: 700; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 1rem 0 .4rem; }
@media (min-width: 960px) { h1 { font-size: 2rem; } h2 { font-size: 1.375rem; } }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Barras de aviso */
.demo-banner { background: var(--err-bg); color: var(--err); border-bottom: 1px solid #f5c2bd; padding: 6px var(--space); font-weight: 600; font-size: .9rem; }
.net-status { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #f3d9a4; padding: 8px var(--space); font-weight: 600; }

/* Estructura */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 20px 12px; display: none; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px var(--space); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
main { padding: var(--space); padding-bottom: 96px; max-width: 1180px; width: 100%; }
main.public { max-width: 480px; margin: 32px auto; }

/* Marca: imágenes suministradas, proporción intacta (no se recompone el wordmark con texto) */
.brand { display: inline-flex; align-items: center; text-decoration: none; line-height: 0; }
.brand img { display: block; height: auto; object-fit: contain; }
.brand-logo img { width: 184px; max-width: 100%; }
.brand-symbol img { width: 32px; }
.brand-public img { width: 200px; max-width: 100%; }
.tagline { color: var(--text-muted); font-size: .9rem; margin: 6px 0 16px; }
.nav-list { list-style: none; margin: 16px 0 0; padding: 0; }
.nav-list a { display: flex; align-items: center; min-height: var(--tap); padding: 0 12px; border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 600; }
.nav-list a:hover { background: var(--surface-2); color: var(--text); }
.nav-list a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); box-shadow: inset 3px 0 0 var(--dc-teal); }
.nav-sep { border-top: 1px solid var(--border); margin: 12px 0; }
.org-name { font-size: .9rem; color: var(--text-muted); overflow-wrap: anywhere; }

.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); display: flex; z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { flex: 1; text-align: center; padding: 10px 4px; min-height: 56px; text-decoration: none; color: var(--text); font-size: .85rem; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.bottomnav a[aria-current="page"] { color: var(--primary); font-weight: 700; box-shadow: inset 0 3px 0 var(--dc-teal); }

@media (min-width: 960px) {
  .sidebar { display: block; }
  .bottomnav { display: none; }
  .topbar .brand { display: none; }
  main { padding: 24px 32px 48px; }
}

/* Tarjetas y secciones */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--space); margin-bottom: var(--space); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: var(--space); }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.muted { color: var(--text-muted); }
.small { font-size: .9rem; }
.stack > * + * { margin-top: 12px; }
ul.stack, ol.stack { list-style: none; padding: 0; margin: 0 0 var(--space); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.break { overflow-wrap: anywhere; word-break: break-word; }

/* Botones: rectangulares con radio discreto (no pastilla) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border-radius: var(--radius);
       border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--primary); }
.btn-secondary:hover { background: var(--primary-soft); color: var(--primary-hover); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--link); text-decoration: underline; padding: 0 8px; }
.btn-quiet:hover { background: var(--surface-2); color: var(--primary-hover); }
.btn-danger { background: var(--surface); color: var(--err); border-color: var(--err); }
.btn-danger:hover { background: var(--err-bg); color: var(--err); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Formularios */
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px var(--space) 4px; margin: 0 0 var(--space); background: var(--surface); min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-weight: 600; margin-bottom: 4px; }
.req { color: var(--err); }
.help { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 8px 10px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); }
textarea { min-height: 96px; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border: 2px solid var(--err); }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: var(--tap); }
.check input { width: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; }
.check label { font-weight: 400; }
.field-error { color: var(--err); font-weight: 600; margin-top: 4px; }
.field-warning { color: var(--warn); margin-top: 4px; }
@media (min-width: 768px) { .fields-2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--space); } .fields-2 .span-2 { grid-column: span 2; } }

/* Avisos */
.alert { border: 1px solid var(--border); border-left: 5px solid var(--info); background: var(--info-bg); padding: 12px var(--space); border-radius: var(--radius); margin-bottom: var(--space); }
.alert-success { border-left-color: var(--ok); background: var(--ok-bg); }
.alert-warning { border-left-color: #b45309; background: var(--warn-bg); }
.alert-error { border-left-color: var(--err); background: var(--err-bg); }
.alert h2, .alert h3 { margin-top: 0; font-size: 1.05rem; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* Estados con texto + color */
/* Sin nowrap: en 360 px los avisos largos deben partirse en líneas, no desbordar la página (E2E B1). */
.badge { display: inline-block; max-width: 100%; border-radius: 4px; padding: 1px 8px; font-size: .85rem; font-weight: 600;
         border: 1px solid currentColor; overflow-wrap: anywhere; }
.badge-draft { color: #4b5563; background: #f9fafb; }
.badge-issued { color: var(--ok); background: var(--ok-bg); }
.badge-failed { color: var(--err); background: var(--err-bg); }
.badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }

/* Pasos */
.steps { list-style: none; padding: 0; margin: 0 0 var(--space); display: flex; flex-wrap: wrap; gap: 6px; counter-reset: s; }
.steps li { flex: 1 1 140px; }
.steps a, .steps span { display: block; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); font-size: .95rem; }
.steps [aria-current="step"] { border: 2px solid var(--primary); color: var(--primary); font-weight: 700; }

/* Listas de documentos: tabla en escritorio, tarjetas en móvil */
.doc-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.doc-table th, .doc-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-table th { font-size: .9rem; color: var(--text-muted); font-weight: 600; }
@media (max-width: 767px) {
  .doc-table thead { position: absolute; left: -9999px; }
  .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; width: 100%; }
  .doc-table tr { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; padding: 8px 10px; background: var(--surface); }
  .doc-table td { border: 0; padding: 3px 0; }
  .doc-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--text-muted); }
}
.filters { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: var(--space); }
@media (min-width: 768px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; } }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: var(--space); flex-wrap: wrap; }

/* Definiciones (revisión, detalle) */
.kv { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
.kv dt { font-weight: 600; color: var(--text-muted); font-size: .9rem; margin-top: 8px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 768px) { .kv { grid-template-columns: 220px 1fr; } .kv dt { margin-top: 0; } }
.preview-section { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }

/* QR e inspección */
.qr { background: #fff; display: block; line-height: 0; max-width: 240px; }
.qr svg { display: block; width: 100%; height: auto; }
.inspection { background: #fff; min-height: 100vh; padding: 16px; text-align: center; }
.inspection .qr { max-width: min(100%, 420px); margin: 0 auto; }
.inspection h1 { font-size: 1.4rem; }
.inspection .kv { text-align: left; max-width: 520px; margin: 16px auto; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid var(--border); padding: 4px 0 8px 12px; }
.empty { color: var(--text-muted); padding: 12px 0; }
footer.app-footer { color: var(--text-muted); font-size: .85rem; padding: 16px var(--space) 88px; }
@media (min-width: 960px) { footer.app-footer { padding-bottom: 16px; } }

@media print {
  .sidebar, .bottomnav, .topbar, .demo-banner, .net-status, .no-print { display: none !important; }
  body { background: #fff; }
}
