/*
 * Centinela — estilos alineados con el sistema de diseño CCVD (@camara-de-comercio-de-valledupar/design-system).
 * Los tokens y las clases (.btn, .panel, .badge, .alert, .data-table, .input…) son una traducción directa de
 * src/styles/tokens.css y src/styles/motif.css del paquete, sin Tailwind (el panel es Blade).
 * Reglas: nada de colores sueltos (todo por token), un solo motivo (extrusión cian solo en el botón primario),
 * dos radios, una familia (Mont con respaldo Schibsted Grotesk), español en la UI, sin mayúsculas sostenidas.
 * Cuando Centinela pase a centinela-web.ccvpar.com (Next.js) se usará el paquete directamente.
 */

@font-face { font-family: 'Mont'; src: url('fonts/Mont-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Mont'; src: url('fonts/Mont-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Schibsted Grotesk'; src: url('fonts/schibsted-grotesk-latin-wght-normal.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }

/* ---------- Claro (predeterminado) ---------- */
:root {
  --paper: #f5f5f5; --surface: #ffffff; --sunken: #eeeeee; --ink: #00204d; --text: #3a3a3a; --ink-soft: #4b4f58;
  --mist: #e5e5e5; --edge: #808285; --accent: #0070b3; --on-accent: #ffffff; --accent-ink: #0070b3; --cyan: #88d0ea;
  --extrude: #88d0ea; --focus: #0070b3; --ok: #1f8a5b; --ok-ink: #17694a; --ok-bg: #e3f4ec; --warn: #b7791f;
  --warn-ink: #8a5a12; --warn-bg: #fbf0dc; --bad: #c23b37; --bad-ink: #a22e2a; --bad-bg: #fbeae9; --info-bg: #e5f1f9;
  --on-bad: #ffffff; --on-cyan: #00204d; --brand-panel: #00204d; --on-brand: #ffffff; --on-brand-soft: #c7d6ea;
  color-scheme: light;
}
/* ---------- Oscuro ---------- */
:root[data-theme='dark'] {
  --paper: #00142f; --surface: #00204d; --sunken: #001938; --ink: #f5f5f5; --text: #e4e9f0; --ink-soft: #b4c3d8;
  --mist: #16386a; --edge: #6f8db8; --accent: #4da6e0; --on-accent: #00142f; --accent-ink: #88d0ea; --cyan: #88d0ea;
  --extrude: #88d0ea; --focus: #88d0ea; --ok: #3cb583; --ok-ink: #5ccb9b; --ok-bg: #0f3327; --warn: #d9a441;
  --warn-ink: #e3b967; --warn-bg: #3a2c0f; --bad: #e5645f; --bad-ink: #f59a95; --bad-bg: #4a1c1e; --info-bg: #0a3a6b;
  --on-bad: #1a0705; --on-cyan: #00204d; --brand-panel: #00204d; --on-brand: #ffffff; --on-brand-soft: #c7d6ea;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #00142f; --surface: #00204d; --sunken: #001938; --ink: #f5f5f5; --text: #e4e9f0; --ink-soft: #b4c3d8;
    --mist: #16386a; --edge: #6f8db8; --accent: #4da6e0; --on-accent: #00142f; --accent-ink: #88d0ea; --cyan: #88d0ea;
    --extrude: #88d0ea; --focus: #88d0ea; --ok: #3cb583; --ok-ink: #5ccb9b; --ok-bg: #0f3327; --warn: #d9a441;
    --warn-ink: #e3b967; --warn-bg: #3a2c0f; --bad: #e5645f; --bad-ink: #f59a95; --bad-bg: #4a1c1e; --info-bg: #0a3a6b;
    --on-bad: #1a0705; --on-cyan: #00204d; --brand-panel: #00204d; --on-brand: #ffffff; --on-brand-soft: #c7d6ea;
    color-scheme: dark;
  }
}
/* ---------- Tokens fijos ---------- */
:root {
  --extrusion: 6px 6px 0 var(--extrude); --extrusion-md: 4px 4px 0 var(--extrude);
  --focus-width: 3px; --focus-offset: 3px; --measure: 68ch;
  --dur-fast: 200ms; --dur-base: 300ms; --ease-out: cubic-bezier(0, 0, 0.2, 1); --ease-standard: ease;
  --font-sans: 'Mont', 'Schibsted Grotesk', Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --text-xs: 0.8125rem; --text-sm: 0.9375rem; --text-base: 1rem; --text-lg: 1.2rem;
  --radius-control: 0.5rem; --radius-container: 0.875rem;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { background: var(--paper); margin: 0; }
body { color: var(--text); font-family: var(--font-sans); font-size: var(--text-base); line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { color: var(--ink); font-weight: 700; text-wrap: balance; margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.3; letter-spacing: -0.015em; }
h2 { font-size: var(--text-lg); line-height: 1.3; letter-spacing: -0.006em; }
@media (min-width: 48rem) { h1 { font-size: 2rem; } }
p { max-width: var(--measure); text-wrap: pretty; margin: 0 0 0.75rem; }
a { color: var(--accent-ink); text-underline-offset: 0.2em; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); border-radius: var(--radius-control); }
::selection { background: var(--cyan); color: var(--on-cyan); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 0.75rem; top: -4rem; z-index: 100; padding: 0.5rem 1rem; background: var(--surface); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--radius-control); font-weight: 700; }
.skip-link:focus { top: 0.75rem; }
.muted { color: var(--ink-soft); }
.small { font-size: var(--text-sm); }

/* ---------- Armazón (AppShell + Sidebar del sistema de diseño) ---------- */
.shell-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 95%, transparent); backdrop-filter: blur(4px); border-bottom: 1px solid var(--mist); }
.shell-bar { display: flex; align-items: center; gap: 1rem; height: 4rem; max-width: 80rem; margin: 0 auto; padding: 0 1.5rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; margin-right: auto; }
.brand img { height: 38px; width: auto; }
.shell-actions { display: flex; align-items: center; gap: 0.5rem; }
.shell-user { color: var(--ink-soft); font-size: var(--text-sm); }
.shell-body { display: flex; gap: 2rem; max-width: 80rem; margin: 0 auto; padding: 0 1.5rem; }
.shell-side { display: none; width: 15rem; flex: none; }
.shell-side nav { position: sticky; top: 4rem; padding: 1.5rem 0.25rem 1.5rem 0; }
.shell-main { min-width: 0; flex: 1; padding: 1.5rem 0 6rem; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.side-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 2.75rem; padding: 0.5rem 0.75rem; border-left: 3px solid transparent; border-radius: var(--radius-control); color: var(--ink-soft); font-size: var(--text-sm); font-weight: 700; text-decoration: none; }
.side-item:hover { color: var(--ink); background: var(--sunken); }
.side-item[aria-current='page'] { border-left-color: var(--accent); background: var(--sunken); color: var(--ink); }
.mobile-nav { display: flex; gap: 0.25rem; overflow-x: auto; padding: 0 1.5rem 0.5rem; max-width: 80rem; margin: 0 auto; }
.mobile-nav .side-item { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; border-radius: var(--radius-control) var(--radius-control) 0 0; }
.mobile-nav .side-item[aria-current='page'] { border-bottom-color: var(--accent); }
@media (min-width: 64rem) { .shell-side { display: block; } .mobile-nav { display: none; } }
@media (max-width: 40rem) { .shell-bar, .shell-body, .mobile-nav { padding-left: 1rem; padding-right: 1rem; } .shell-user, .brand-name { display: none; } }

/* ---------- Encabezado de página (PageHeader) ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header .lead { color: var(--ink-soft); margin: 0.375rem 0 0; max-width: 72ch; }
.back { display: inline-block; margin-bottom: 0.75rem; font-size: var(--text-sm); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 1.15rem; border: 1.5px solid transparent; border-radius: var(--radius-control); font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--extrusion-md); }
.btn-primary:hover:not(:disabled) { box-shadow: 3px 3px 0 var(--extrude); transform: translate(1px, 1px); }
.btn-primary:active:not(:disabled), .btn-primary:focus-visible { box-shadow: 1px 1px 0 var(--extrude); transform: translate(3px, 3px); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--edge); }
.btn-secondary:hover:not(:disabled) { background: var(--sunken); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--sunken); }
.btn-danger { background: var(--bad); color: var(--on-bad); }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn-sm { min-height: 2.25rem; padding: 0 0.8rem; font-size: var(--text-sm); }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* ---------- Formularios ---------- */
.label { display: block; font-weight: 700; font-size: var(--text-sm); margin: 1rem 0 0.375rem; }
.hint { color: var(--ink-soft); font-size: var(--text-xs); margin-top: 0.375rem; }
.input, .select, .textarea { display: block; width: 100%; min-height: 2.75rem; padding: 0.5rem 0.75rem; background: var(--surface); color: var(--ink); border: 1.5px solid var(--edge); border-radius: var(--radius-control); font: inherit; }
.input.inline, .select.inline { display: inline-block; width: auto; min-height: 2.25rem; padding: 0.25rem 0.6rem; font-size: var(--text-sm); }
.textarea { min-height: 5.5rem; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-soft); opacity: 0.85; }
.checkbox { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; margin-right: 1rem; font-weight: 700; font-size: var(--text-sm); cursor: pointer; }
.checkbox input { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.form-narrow { max-width: 42rem; }

/* ---------- Contenedores ---------- */
.panel { background: var(--surface); border: 1px solid var(--mist); border-radius: var(--radius-container); padding: 1.25rem; margin-bottom: 1.25rem; }
.panel.flush { padding: 0; }
.panel > h2 { margin-bottom: 0.75rem; }
.panel.flush > h2 { padding: 1.25rem 1.25rem 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: 0 1.25rem; }
dl.datos { display: grid; grid-template-columns: 10rem 1fr; gap: 0.4rem 1rem; margin: 0; font-size: var(--text-sm); }
dl.datos dt { color: var(--ink-soft); font-weight: 700; }
dl.datos dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 40rem) { dl.datos { grid-template-columns: 1fr; } dl.datos dt { margin-top: 0.5rem; } }
.summary { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; margin-bottom: 1.25rem; color: var(--ink-soft); font-size: var(--text-sm); }
.summary b { color: var(--ink); font-size: var(--text-lg); margin-right: 0.25rem; }

/* ---------- Estados ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.125rem 0.55rem; border-radius: var(--radius-control); font-size: var(--text-xs); font-weight: 700; line-height: 1.5; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-bad { background: var(--bad-bg); color: var(--bad-ink); }
.badge-neutral { background: var(--sunken); color: var(--ink-soft); }
.alert { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.875rem 1rem; border-radius: var(--radius-container); border: 1px solid transparent; font-size: var(--text-sm); margin-bottom: 1.25rem; }
.alert-error { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn); }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok); }
.alert-info { background: var(--info-bg); color: var(--ink); border-color: var(--accent); }
.finding { display: flex; gap: 0.6rem; align-items: baseline; margin: 0.35rem 0; font-size: var(--text-sm); }

/* ---------- Tabla de datos (DataTable) ---------- */
.data-table-scroll { position: relative; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.data-table th { text-align: left; font-weight: 700; color: var(--ink-soft); padding: 0.625rem 0.875rem; border-bottom: 1.5px solid var(--edge); white-space: nowrap; }
.data-table td { padding: 0.7rem 0.875rem; border-bottom: 1px solid var(--mist); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--sunken); }
.data-table .row-title { color: var(--ink); font-weight: 700; }
.data-table .detail { color: var(--ink-soft); font-size: var(--text-xs); }
.data-table .nowrap { white-space: nowrap; }
.data-table .empty { color: var(--ink-soft); text-align: center; padding: 2rem 1rem; }

/* ---------- Código de un solo uso ---------- */
.one-time-code { display: inline-block; margin: 0.5rem 0 1rem; padding: 0.875rem 1.25rem; background: var(--sunken); color: var(--ink); border: 1.5px solid var(--ink); border-radius: var(--radius-container); font: 700 2rem/1.2 var(--font-mono); letter-spacing: 0.08em; user-select: all; }

/* ---------- Pantalla de acceso (AuthLayout) ---------- */
.auth-layout { display: grid; grid-template-rows: auto 1fr; min-height: 100dvh; background: var(--paper); }
.auth-brand { background: var(--brand-panel); color: var(--on-brand); padding: 0.875rem 1.5rem; display: flex; align-items: center; gap: 0.875rem; }
.auth-brand img { width: 2.75rem; height: auto; }
.auth-brand-title { color: var(--on-brand); font-weight: 700; font-size: var(--text-lg); line-height: 1.25; }
.auth-brand-org, .auth-brand-slogan { display: none; }
.auth-main { display: flex; flex-direction: column; justify-content: center; gap: 1.25rem; width: 100%; max-width: 30rem; margin: 0 auto; padding: 2rem 1.5rem; }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; color: var(--ink-soft); font-size: var(--text-sm); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--mist); }
@media (min-width: 64rem) {
  .auth-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: none; }
  .auth-brand { min-height: 100dvh; padding: 3rem 3.5rem; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2rem; }
  .auth-brand img { width: min(18.75rem, 100%); }
  .auth-brand-org { display: block; font-weight: 700; max-width: 20ch; line-height: 1.3; }
  .auth-brand-title { font-size: 2.5rem; line-height: 1.15; letter-spacing: -0.015em; max-width: 12ch; }
  .auth-brand-slogan { display: block; color: var(--on-brand-soft); font-size: var(--text-lg); max-width: 28ch; line-height: 1.5; }
}
