/* DAM Intel — lenguaje de diseño Site v14 / design/dam-intel:
   papel marfil, tinta verde oscuro, azul como acento analítico, serif
   editorial en énfasis, bordes finos, pills suaves con semántica estable:
   verde = observado · gris = inferencia · ámbar = pendiente/confirmar ·
   azul = análisis (Multi) · tinta = dato interno DAM. */
:root {
  --ink: #11221d;
  --muted: #66736e;
  --paper: #f5f5f1;
  --surface: #ffffff;
  --line: #dfe3df;
  --line-dark: #c9cfca;
  --green: #118b67;
  --blue: #4354d8;
  --amber: #a96d12;
  --red: #a03123;
  --soft-blue: #eef0ff;
  --soft-green: #eaf7f2;
  --soft-amber: #fff5df;
  --soft-gray: #e9ece9;
  --shadow: 0 14px 38px rgba(17, 34, 29, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--paper); color: var(--ink);
  font: 13px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
@page { margin: 11mm; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }

/* ─ Barra superior ─ */
.topbar { position: sticky; top: 0; z-index: 30; height: 64px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1120px) / 2)); background: rgba(245,245,241,.92); backdrop-filter: blur(14px); font-size: 11px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: .14em; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; letter-spacing: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-email { color: var(--muted); font-size: 10px; }

/* ─ Encabezado editorial ─ */
.wrap { max-width: 1120px; margin: 0 auto; padding: 44px 24px 80px; }
.top { padding-bottom: 6px; }
.eyebrow { font-size: 9px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; color: var(--muted); }
h1 { margin-top: 12px; font-size: clamp(34px, 4.6vw, 54px); line-height: .96; letter-spacing: -.055em; font-weight: 530; }
h1 em { color: var(--blue); font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.035em; }
.sub { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1.6px; margin-top: 16px; }
h2 { margin: 34px 0 4px; font-size: 19px; letter-spacing: -.03em; font-weight: 640; }
h2 small { font-weight: 500; color: var(--muted); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; margin-left: 8px; }
h3 { font-size: 9px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); font-weight: 800; margin: 22px 0 8px; }
.note { color: var(--muted); font-size: 10px; margin-top: 8px; line-height: 1.55; }
.warn { font-size: 10px; color: var(--red); border: 1px solid var(--red); background: #fdf3f2; padding: 7px 11px; margin-top: 12px; display: inline-block; }
.warn-soft { font-size: 9.5px; color: var(--red); margin-top: 9px; }

/* ─ Semántica de evidencia (pills suaves, un color = un significado) ─ */
.ev-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.ev-legend span { display: inline-flex; align-items: center; padding: 6px 11px; border-radius: 999px; font-size: 9.5px; font-weight: 750; background: var(--soft-gray); color: #596560; }
.ev-legend span b { font-weight: 400; margin-right: 6px; }
.ev-legend span:nth-child(1) { color: var(--green); background: var(--soft-green); }
.ev-legend span:nth-child(3) { color: #fff; background: var(--ink); }
.ev-pill { display: inline-flex; align-items: center; padding: 6px 11px; border-radius: 999px; font-size: 9px; font-weight: 750; background: var(--soft-gray); color: #596560; }
.ev-pill.pill-obs { color: var(--green); background: var(--soft-green); }
.ev-pill.pill-int { color: #fff; background: var(--ink); }

/* ─ Pestañas ─ */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 26px 0 0; }
.tabs button { padding: 10px 15px; border: 1px solid var(--line); background: transparent; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.tabs button:hover { border-color: var(--ink); color: var(--ink); }
.tabs button.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ─ Métricas ─ */
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 20px; border-top: 1px solid var(--line-dark); border-bottom: 1px solid var(--line-dark); }
.metric { min-height: 118px; padding: 19px 18px 15px 0; display: flex; flex-direction: column; }
.metric + .metric { padding-left: 18px; border-left: 1px solid var(--line); }
.metric strong { font-size: 29px; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric span { margin-top: 12px; font-size: 10.5px; font-weight: 750; }
.metric small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.seg-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }

/* ─ Tablas como paneles ─ */
.tbl { overflow-x: auto; border: 1px solid var(--line-dark); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 8.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 750; border-bottom: 1px solid var(--line-dark); white-space: nowrap; background: #fbfbf9; }
tbody tr:hover td, table tr:hover td { background: #fafaf8; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hi { font-weight: 700; }
.mail { color: #4b5652; font-size: 10px; }
.k { display: inline-block; background: var(--soft-gray); color: #4b5652; padding: 3px 9px; margin: 2px 3px 2px 0; font-size: 10px; border-radius: 999px; }
.k b { font-weight: 750; color: var(--ink); }
.tag { display: inline-block; border-radius: 999px; padding: 5px 10px; font-size: 8.5px; font-weight: 750; letter-spacing: .3px; white-space: nowrap; background: var(--soft-gray); color: #596560; }
.tag-meta { background: var(--ink); color: #fff; }
.tag-multi { background: var(--soft-blue); color: var(--blue); }
.tag-confirmar { background: var(--soft-amber); color: var(--amber); }
.tag-obs { background: var(--soft-green); color: var(--green); }
.tag-69b { background: #fdf3f2; color: var(--red); }
.ev-obs { color: var(--green); }
.empty-row td { color: var(--muted); padding: 22px 14px; }
tr.dim td { color: #9aa39f; }
tr.dim td.hi { color: #9aa39f; font-weight: 500; }
tr.dim .k { color: #9aa39f; }
tr.dim .k b { color: #9aa39f; }

/* ─ Filtros ─ */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 12px; }
.filters input[type="search"] { flex: 1 1 280px; min-height: 46px; padding: 0 16px; border: 1px solid var(--line-dark); background: var(--surface); outline: 0; font-size: 13px; box-shadow: var(--shadow); }
.filters input[type="search"]:focus { border-color: var(--blue); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 12px; border: 1px solid var(--line); background: transparent; font-size: 9.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.check { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--muted); cursor: pointer; }

/* ─ Botones ─ */
.btn { background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 9px; font-size: 10.5px; font-weight: 800; letter-spacing: .4px; }
.btn:hover { background: #1e332c; }
.btn:disabled { cursor: wait; opacity: .6; }
.btn-ghost { border: 1px solid var(--line-dark); background: var(--surface); padding: 8px 13px; border-radius: 9px; font-size: 10px; font-weight: 700; color: #4b5652; }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-ghost:disabled { opacity: .4; cursor: default; }

/* ─ Paginación ─ */
.pager { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.pager .note { margin: 0; }

/* ─ Precios ─ */
.price-card { border: 1px solid var(--line-dark); background: var(--surface); box-shadow: var(--shadow); padding: 24px 26px; margin-top: 14px; max-width: 620px; }
.price-card .sub { margin: 0 0 14px; }
.price-card strong.big { font-size: 34px; letter-spacing: -.05em; font-weight: 700; }
.price-card .row { margin-top: 10px; font-size: 12px; }
.price-card .row.note { margin-top: 14px; padding: 13px 15px; border-left: 3px solid var(--green); background: var(--soft-green); color: #4f6058; font-size: 10.5px; }

/* ─ Login ─ */
.login-shell { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); border: 1px solid var(--line-dark); background: var(--surface); box-shadow: var(--shadow); padding: 32px; }
.login-card h1 { font-size: 34px; margin-top: 10px; }
.login-copy { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 12px 0 4px; }
.login-card label { display: block; margin: 16px 0 6px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .9px; color: var(--muted); }
.login-card input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line-dark); background: var(--surface); outline: 0; }
.login-card input:focus { border-color: var(--blue); }
.login-card .btn { width: 100%; margin-top: 18px; }
.login-error { margin-top: 12px; font-size: 10.5px; color: var(--red); border: 1px solid var(--red); background: #fdf3f2; padding: 8px 11px; }

/* ─ Investigación ─ */
.ask-box { display: flex; gap: 9px; margin-top: 16px; max-width: 680px; }
.ask-box input { flex: 1; min-width: 0; min-height: 54px; padding: 0 18px; border: 1px solid var(--line-dark); background: var(--surface); outline: 0; font-size: 14px; box-shadow: var(--shadow); }
.ask-box input:focus { border-color: var(--blue); }

/* ─ Diálogos ─ */
.access-dialog { position: fixed; inset: 0; z-index: 40; background: rgba(17, 34, 29, .3); display: grid; place-items: center; padding: 20px; }
.access-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line-dark); box-shadow: 0 24px 50px rgba(17,34,29,.14); padding: 28px; }
.access-card .sub { margin-top: 0; }
.access-title { all: unset; display: block; font-size: 22px; font-weight: 640; letter-spacing: -.03em; margin: 10px 0 8px; }
.access-card .note { margin-top: 0; }
.access-card label { display: block; margin: 14px 0 6px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .9px; color: var(--muted); }
.access-card input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line-dark); background: var(--surface); outline: 0; }
.access-card input:focus { border-color: var(--blue); }
.access-actions { display: flex; gap: 9px; margin-top: 16px; }

/* ─ Toast ─ */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; color: #fff; background: var(--ink); border-radius: 10px; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: .22s; text-align: center; font-size: 11px; box-shadow: 0 18px 44px rgba(17,34,29,.22); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ─ Responsive ─ */
@media (max-width: 780px) {
  .topbar { padding: 0 16px; }
  .wrap { padding: 30px 16px 56px; }
  h1 { font-size: 34px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { border-left: 0 !important; padding-left: 0 !important; border-top: 1px solid var(--line); }
  .metric:nth-child(-n+2) { border-top: 0; }
  .tabs button { padding: 9px 11px; }
  th, td { padding: 10px 10px; }
}

/* ─ Impresión ─ */
@media print {
  body { background: #fff; }
  .topbar, .tabs, .filters, .pager, .ask-box, .btn, .btn-ghost, .toast, .access-dialog { display: none !important; }
  .tab-panel[hidden] { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .tbl, .price-card, .login-card { box-shadow: none; }
}
